diff options
Diffstat (limited to 'drivers/video/backlight/hp680_bl.c')
-rw-r--r-- | drivers/video/backlight/hp680_bl.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/drivers/video/backlight/hp680_bl.c b/drivers/video/backlight/hp680_bl.c index fbea2bd129c73d..9badb23c1ef813 100644 --- a/drivers/video/backlight/hp680_bl.c +++ b/drivers/video/backlight/hp680_bl.c @@ -1,6 +1,7 @@ /* * Backlight Driver for HP Jornada 680 * + * Copyright (c) 2007 Kristoffer Ericson * Copyright (c) 2005 Andriy Skulysh * * Based on Sharp's Corgi Backlight Driver @@ -27,11 +28,13 @@ static int hp680bl_suspended; static int current_intensity = 0; -static DEFINE_SPINLOCK(bl_lock); +static DEFINE_SPINLOCK(jornada_bl_lock); +unsigned long jornada_flags; +static struct platform_device *hp680_platform_device; +static struct backlight_device *hp680_backlight_device; static void hp680bl_send_intensity(struct backlight_device *bd) { - unsigned long flags; u16 v; int intensity = bd->props.brightness; @@ -42,7 +45,7 @@ static void hp680bl_send_intensity(struct backlight_device *bd) if (hp680bl_suspended) intensity = 0; - spin_lock_irqsave(&bl_lock, flags); + spin_lock_irqsave(&jornada_bl_lock, jornada_flags); if (intensity && current_intensity == 0) { sh_dac_enable(DAC_LCD_BRIGHTNESS); v = inw(HD64461_GPBDR); @@ -58,17 +61,19 @@ static void hp680bl_send_intensity(struct backlight_device *bd) } else if (intensity) { sh_dac_output(255-(u8)intensity, DAC_LCD_BRIGHTNESS); } - spin_unlock_irqrestore(&bl_lock, flags); + spin_unlock_irqrestore(&jornada_bl_lock, jornada_flags); current_intensity = intensity; + } - #ifdef CONFIG_PM static int hp680bl_suspend(struct platform_device *pdev, pm_message_t state) { struct backlight_device *bd = platform_get_drvdata(pdev); + bd->props.power = FB_BLANK_POWERDOWN; + hp680bl_suspended = 1; hp680bl_send_intensity(bd); return 0; @@ -78,6 +83,8 @@ static int hp680bl_resume(struct platform_device *pdev) { struct backlight_device *bd = platform_get_drvdata(pdev); + bd->props.power = FB_BLANK_UNBLANK; + hp680bl_suspended = 0; hp680bl_send_intensity(bd); return 0; @@ -105,18 +112,13 @@ static struct backlight_ops hp680bl_ops = { static int __init hp680bl_probe(struct platform_device *pdev) { - struct backlight_device *bd; + hp680_backlight_device = backlight_device_register ("hp680-bl", &pdev->dev, NULL, &hp680bl_ops); - bd = backlight_device_register ("hp680-bl", &pdev->dev, NULL, - &hp680bl_ops); - if (IS_ERR(bd)) - return PTR_ERR(bd); + platform_set_drvdata(pdev, hp680_backlight_device); - platform_set_drvdata(pdev, bd); - - bd->props.max_brightness = HP680_MAX_INTENSITY; - bd->props.brightness = HP680_DEFAULT_INTENSITY; - hp680bl_send_intensity(bd); + hp680_backlight_device->props.max_brightness = HP680_MAX_INTENSITY; + hp680_backlight_device->props.brightness = HP680_DEFAULT_INTENSITY; + hp680bl_send_intensity(hp680_backlight_device); return 0; } @@ -144,22 +146,20 @@ static struct platform_driver hp680bl_driver = { }, }; -static struct platform_device *hp680bl_device; - static int __init hp680bl_init(void) { int ret; ret = platform_driver_register(&hp680bl_driver); if (!ret) { - hp680bl_device = platform_device_alloc("hp680-bl", -1); - if (!hp680bl_device) + hp680_platform_device = platform_device_alloc("hp680-bl", -1); + if (!hp680_platform_device) return -ENOMEM; - ret = platform_device_add(hp680bl_device); + ret = platform_device_add(hp680_platform_device); if (ret) { - platform_device_put(hp680bl_device); + platform_device_put(hp680_platform_device); platform_driver_unregister(&hp680bl_driver); } } @@ -168,7 +168,7 @@ static int __init hp680bl_init(void) static void __exit hp680bl_exit(void) { - platform_device_unregister(hp680bl_device); + platform_device_unregister(hp680_platform_device); platform_driver_unregister(&hp680bl_driver); } |