[PATCH] backlight: do not power off backlight when unregistering
authorHenrique de Moraes Holschuh <hmh@hmh.eng.br>
Fri, 8 Dec 2006 10:40:49 +0000 (02:40 -0800)
committerLinus Torvalds <torvalds@woody.osdl.org>
Fri, 8 Dec 2006 16:29:07 +0000 (08:29 -0800)
ACPI drivers like ibm-acpi are moving to the backlight sysfs
infrastructure.  During ibm-acpi testing, I have noticed that
backlight_device_unregister() sets the display brightness and power to
zero.

This causes the display to be dimmed on ibm-acpi module removal.  It will
affect all other ACPI drivers that are being converted to use the backlight
class, as well.  It also affects a number of framebuffer devices that are
used on desktops and laptops which might also not want such behaviour.

Since working around this behaviour requires undesireable hacks, Richard
Purdie decided that we would be better off reverting the changes in the
sysfs class, and adding the code to dim and power off the backlight device
to the drivers that want it.  This patch is my attempt to do so.

Patch against latest linux-2.6.git.  Changes untested, as I lack the
required hardware.  Still, they are trivial enough that, apart from typos,
there is little chance of getting them wrong.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Acked-by: Richard Purdie <rpurdie@rpsys.net>
Acked-by: Pavel Machek <pavel@ucw.cz>
Acked-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/video/backlight/backlight.c
drivers/video/backlight/corgi_bl.c
drivers/video/backlight/hp680_bl.c
drivers/video/backlight/locomolcd.c

index 1dac9e743427b593113ac62a2607c9f3a24b5c01..db8c191b12013e941c1ab61cea7db7101763bdc0 100644 (file)
@@ -282,12 +282,6 @@ void backlight_device_unregister(struct backlight_device *bd)
                                         &bl_class_device_attributes[i]);
 
        down(&bd->sem);
-       if (likely(bd->props && bd->props->update_status)) {
-               bd->props->brightness = 0;
-               bd->props->power = 0;
-               bd->props->update_status(bd);
-       }
-
        bd->props = NULL;
        up(&bd->sem);
 
index d07ecb53c68b85bad48b7f8fd243105857a5fec9..61587ca2cdbb5f708f3d0f37babec91fa3153163 100644 (file)
@@ -135,6 +135,10 @@ static int corgibl_probe(struct platform_device *pdev)
 
 static int corgibl_remove(struct platform_device *dev)
 {
+       corgibl_data.power = 0;
+       corgibl_data.brightness = 0;
+       corgibl_send_intensity(corgi_backlight_device);
+
        backlight_device_unregister(corgi_backlight_device);
 
        printk("Corgi Backlight Driver Unloaded\n");
index e3993213d10e39cb2e98629dc114775dcc23aa37..1c569fb543ae80f6bef9d6954954398ae358a1c2 100644 (file)
@@ -117,6 +117,10 @@ static int __init hp680bl_probe(struct platform_device *dev)
 
 static int hp680bl_remove(struct platform_device *dev)
 {
+       hp680bl_data.brightness = 0;
+       hp680bl_data.power = 0;
+       hp680bl_send_intensity(hp680_backlight_device);
+
        backlight_device_unregister(hp680_backlight_device);
 
        return 0;
index 628571c63bacc4905517c5563a7fc0fa7848c564..2d7905410b2ac61a11b1a9d83d0f59e42a6b86ba 100644 (file)
@@ -200,6 +200,10 @@ static int locomolcd_remove(struct locomo_dev *dev)
 {
        unsigned long flags;
 
+       locomobl_data.brightness = 0;
+       locomobl_data.power = 0;
+       locomolcd_set_intensity(locomolcd_bl_device);
+
        backlight_device_unregister(locomolcd_bl_device);
        local_irq_save(flags);
        locomolcd_dev = NULL;