aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa/mainstone.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-pxa/mainstone.c')
-rw-r--r--arch/arm/mach-pxa/mainstone.c71
1 files changed, 18 insertions, 53 deletions
diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c
index 7399fb34da4e..f2e9e7c4da8e 100644
--- a/arch/arm/mach-pxa/mainstone.c
+++ b/arch/arm/mach-pxa/mainstone.c
@@ -23,9 +23,9 @@
23#include <linux/ioport.h> 23#include <linux/ioport.h>
24#include <linux/mtd/mtd.h> 24#include <linux/mtd/mtd.h>
25#include <linux/mtd/partitions.h> 25#include <linux/mtd/partitions.h>
26#include <linux/backlight.h>
27#include <linux/input.h> 26#include <linux/input.h>
28#include <linux/gpio_keys.h> 27#include <linux/gpio_keys.h>
28#include <linux/pwm_backlight.h>
29 29
30#include <asm/types.h> 30#include <asm/types.h>
31#include <asm/setup.h> 31#include <asm/setup.h>
@@ -280,12 +280,6 @@ static pxa2xx_audio_ops_t mst_audio_ops = {
280 .resume = mst_audio_resume, 280 .resume = mst_audio_resume,
281}; 281};
282 282
283static struct platform_device mst_audio_device = {
284 .name = "pxa2xx-ac97",
285 .id = -1,
286 .dev = { .platform_data = &mst_audio_ops },
287};
288
289static struct resource flash_resources[] = { 283static struct resource flash_resources[] = {
290 [0] = { 284 [0] = {
291 .start = PXA_CS0_PHYS, 285 .start = PXA_CS0_PHYS,
@@ -349,56 +343,27 @@ static struct platform_device mst_flash_device[2] = {
349 }, 343 },
350}; 344};
351 345
352#ifdef CONFIG_BACKLIGHT_CLASS_DEVICE 346#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
353static int mainstone_backlight_update_status(struct backlight_device *bl) 347static struct platform_pwm_backlight_data mainstone_backlight_data = {
354{ 348 .pwm_id = 0,
355 int brightness = bl->props.brightness; 349 .max_brightness = 1023,
356 350 .dft_brightness = 1023,
357 if (bl->props.power != FB_BLANK_UNBLANK || 351 .pwm_period_ns = 78770,
358 bl->props.fb_blank != FB_BLANK_UNBLANK) 352};
359 brightness = 0;
360
361 if (brightness != 0)
362 pxa_set_cken(CKEN_PWM0, 1);
363
364 PWM_CTRL0 = 0;
365 PWM_PWDUTY0 = brightness;
366 PWM_PERVAL0 = bl->props.max_brightness;
367
368 if (brightness == 0)
369 pxa_set_cken(CKEN_PWM0, 0);
370 return 0; /* pointless return value */
371}
372
373static int mainstone_backlight_get_brightness(struct backlight_device *bl)
374{
375 return PWM_PWDUTY0;
376}
377 353
378static /*const*/ struct backlight_ops mainstone_backlight_ops = { 354static struct platform_device mainstone_backlight_device = {
379 .update_status = mainstone_backlight_update_status, 355 .name = "pwm-backlight",
380 .get_brightness = mainstone_backlight_get_brightness, 356 .dev = {
357 .parent = &pxa27x_device_pwm0.dev,
358 .platform_data = &mainstone_backlight_data,
359 },
381}; 360};
382 361
383static void __init mainstone_backlight_register(void) 362static void __init mainstone_backlight_register(void)
384{ 363{
385 struct backlight_device *bl; 364 int ret = platform_device_register(&mainstone_backlight_device);
386 365 if (ret)
387 bl = backlight_device_register("mainstone-bl", &pxa_device_fb.dev, 366 printk(KERN_ERR "mainstone: failed to register backlight device: %d\n", ret);
388 NULL, &mainstone_backlight_ops);
389 if (IS_ERR(bl)) {
390 printk(KERN_ERR "mainstone: unable to register backlight: %ld\n",
391 PTR_ERR(bl));
392 return;
393 }
394
395 /*
396 * broken design - register-then-setup interfaces are
397 * utterly broken by definition.
398 */
399 bl->props.max_brightness = 1023;
400 bl->props.brightness = 1023;
401 backlight_update_status(bl);
402} 367}
403#else 368#else
404#define mainstone_backlight_register() do { } while (0) 369#define mainstone_backlight_register() do { } while (0)
@@ -528,7 +493,6 @@ static struct platform_device mst_gpio_keys_device = {
528 493
529static struct platform_device *platform_devices[] __initdata = { 494static struct platform_device *platform_devices[] __initdata = {
530 &smc91x_device, 495 &smc91x_device,
531 &mst_audio_device,
532 &mst_flash_device[0], 496 &mst_flash_device[0],
533 &mst_flash_device[1], 497 &mst_flash_device[1],
534 &mst_gpio_keys_device, 498 &mst_gpio_keys_device,
@@ -638,6 +602,7 @@ static void __init mainstone_init(void)
638 pxa_set_ficp_info(&mainstone_ficp_platform_data); 602 pxa_set_ficp_info(&mainstone_ficp_platform_data);
639 pxa_set_ohci_info(&mainstone_ohci_platform_data); 603 pxa_set_ohci_info(&mainstone_ohci_platform_data);
640 pxa_set_i2c_info(NULL); 604 pxa_set_i2c_info(NULL);
605 pxa_set_ac97_info(&mst_audio_ops);
641 606
642 mainstone_init_keypad(); 607 mainstone_init_keypad();
643} 608}