aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2008-04-13 16:47:01 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-07-03 08:25:03 -0400
commit402e490997ddaae310a080534a61d7ec24df8124 (patch)
treea40d61d6ef76886e6574e53d7342af62e2a703cf /arch
parent5cca91479b8ac6a60b61bc56e72389c681387211 (diff)
[ARM] pxa: make mainstone use the generic PWM backlight driver
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-pxa/Kconfig1
-rw-r--r--arch/arm/mach-pxa/mainstone.c63
2 files changed, 18 insertions, 46 deletions
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
index b7a3281c420e..2d711308076f 100644
--- a/arch/arm/mach-pxa/Kconfig
+++ b/arch/arm/mach-pxa/Kconfig
@@ -41,6 +41,7 @@ config MACH_LOGICPD_PXA270
41config MACH_MAINSTONE 41config MACH_MAINSTONE
42 bool "Intel HCDDBBVA0 Development Platform" 42 bool "Intel HCDDBBVA0 Development Platform"
43 select PXA27x 43 select PXA27x
44 select HAVE_PWM
44 45
45config ARCH_PXA_IDP 46config ARCH_PXA_IDP
46 bool "Accelent Xscale IDP" 47 bool "Accelent Xscale IDP"
diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c
index 7399fb34da4e..266594426e8b 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>
@@ -349,56 +349,27 @@ static struct platform_device mst_flash_device[2] = {
349 }, 349 },
350}; 350};
351 351
352#ifdef CONFIG_BACKLIGHT_CLASS_DEVICE 352#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
353static int mainstone_backlight_update_status(struct backlight_device *bl) 353static struct platform_pwm_backlight_data mainstone_backlight_data = {
354{ 354 .pwm_id = 0,
355 int brightness = bl->props.brightness; 355 .max_brightness = 1023,
356 356 .dft_brightness = 1023,
357 if (bl->props.power != FB_BLANK_UNBLANK || 357 .pwm_period_ns = 78770,
358 bl->props.fb_blank != FB_BLANK_UNBLANK) 358};
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 359
378static /*const*/ struct backlight_ops mainstone_backlight_ops = { 360static struct platform_device mainstone_backlight_device = {
379 .update_status = mainstone_backlight_update_status, 361 .name = "pwm-backlight",
380 .get_brightness = mainstone_backlight_get_brightness, 362 .dev = {
363 .parent = &pxa27x_device_pwm0.dev,
364 .platform_data = &mainstone_backlight_data,
365 },
381}; 366};
382 367
383static void __init mainstone_backlight_register(void) 368static void __init mainstone_backlight_register(void)
384{ 369{
385 struct backlight_device *bl; 370 int ret = platform_device_register(&mainstone_backlight_device);
386 371 if (ret)
387 bl = backlight_device_register("mainstone-bl", &pxa_device_fb.dev, 372 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} 373}
403#else 374#else
404#define mainstone_backlight_register() do { } while (0) 375#define mainstone_backlight_register() do { } while (0)