aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/acpi/asus_acpi.c2
-rw-r--r--drivers/acpi/ibm_acpi.c5
-rw-r--r--drivers/acpi/toshiba_acpi.c3
-rw-r--r--drivers/acpi/video.c41
-rw-r--r--drivers/misc/msi-laptop.c3
-rw-r--r--drivers/usb/misc/appledisplay.c2
-rw-r--r--drivers/video/aty/aty128fb.c2
-rw-r--r--drivers/video/aty/atyfb_base.c2
-rw-r--r--drivers/video/aty/radeon_backlight.c2
-rw-r--r--drivers/video/backlight/backlight.c7
-rw-r--r--drivers/video/nvidia/nv_backlight.c2
-rw-r--r--drivers/video/riva/fbdev.c2
-rw-r--r--include/linux/backlight.h2
13 files changed, 53 insertions, 22 deletions
diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c
index bfae3ffff13c..7cc54aacd4c0 100644
--- a/drivers/acpi/asus_acpi.c
+++ b/drivers/acpi/asus_acpi.c
@@ -1401,7 +1401,7 @@ static int __init asus_acpi_init(void)
1401 return result; 1401 return result;
1402 } 1402 }
1403 1403
1404 asus_backlight_device = backlight_device_register("asus", NULL, 1404 asus_backlight_device = backlight_device_register("asus",NULL,NULL,
1405 &asus_backlight_data); 1405 &asus_backlight_data);
1406 if (IS_ERR(asus_backlight_device)) { 1406 if (IS_ERR(asus_backlight_device)) {
1407 printk(KERN_ERR "Could not register asus backlight device\n"); 1407 printk(KERN_ERR "Could not register asus backlight device\n");
diff --git a/drivers/acpi/ibm_acpi.c b/drivers/acpi/ibm_acpi.c
index 1e7abef404b0..130cc8c37e22 100644
--- a/drivers/acpi/ibm_acpi.c
+++ b/drivers/acpi/ibm_acpi.c
@@ -1714,7 +1714,7 @@ static struct backlight_properties ibm_backlight_data = {
1714 1714
1715static int brightness_init(void) 1715static int brightness_init(void)
1716{ 1716{
1717 ibm_backlight_device = backlight_device_register("ibm", NULL, 1717 ibm_backlight_device = backlight_device_register("ibm", NULL, NULL,
1718 &ibm_backlight_data); 1718 &ibm_backlight_data);
1719 if (IS_ERR(ibm_backlight_device)) { 1719 if (IS_ERR(ibm_backlight_device)) {
1720 printk(IBM_ERR "Could not register backlight device\n"); 1720 printk(IBM_ERR "Could not register backlight device\n");
@@ -2503,7 +2503,7 @@ static int __init setup_notify(struct ibm_struct *ibm)
2503 ibm->name, status); 2503 ibm->name, status);
2504 return -ENODEV; 2504 return -ENODEV;
2505 } 2505 }
2506 2506 ibm->notify_installed = 1;
2507 return 0; 2507 return 0;
2508} 2508}
2509 2509
@@ -2580,7 +2580,6 @@ static int __init ibm_init(struct ibm_struct *ibm)
2580 ret = setup_notify(ibm); 2580 ret = setup_notify(ibm);
2581 if (ret < 0) 2581 if (ret < 0)
2582 return ret; 2582 return ret;
2583 ibm->notify_installed = 1;
2584 } 2583 }
2585 2584
2586 return 0; 2585 return 0;
diff --git a/drivers/acpi/toshiba_acpi.c b/drivers/acpi/toshiba_acpi.c
index 2f35f891593f..88aeccbafaaf 100644
--- a/drivers/acpi/toshiba_acpi.c
+++ b/drivers/acpi/toshiba_acpi.c
@@ -590,7 +590,8 @@ static int __init toshiba_acpi_init(void)
590 remove_proc_entry(PROC_TOSHIBA, acpi_root_dir); 590 remove_proc_entry(PROC_TOSHIBA, acpi_root_dir);
591 } 591 }
592 592
593 toshiba_backlight_device = backlight_device_register("toshiba", NULL, 593 toshiba_backlight_device = backlight_device_register("toshiba",NULL,
594 NULL,
594 &toshiba_backlight_data); 595 &toshiba_backlight_data);
595 if (IS_ERR(toshiba_backlight_device)) { 596 if (IS_ERR(toshiba_backlight_device)) {
596 printk(KERN_ERR "Could not register toshiba backlight device\n"); 597 printk(KERN_ERR "Could not register toshiba backlight device\n");
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 53a9eb015d6b..eb5141f9ef8f 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -3,6 +3,7 @@
3 * 3 *
4 * Copyright (C) 2004 Luming Yu <luming.yu@intel.com> 4 * Copyright (C) 2004 Luming Yu <luming.yu@intel.com>
5 * Copyright (C) 2004 Bruno Ducrot <ducrot@poupinou.org> 5 * Copyright (C) 2004 Bruno Ducrot <ducrot@poupinou.org>
6 * Copyright (C) 2006 Thomas Tuttle <linux-kernel@ttuttle.net>
6 * 7 *
7 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 8 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8 * 9 *
@@ -47,11 +48,11 @@
47#define ACPI_VIDEO_NOTIFY_NEXT_OUTPUT 0x83 48#define ACPI_VIDEO_NOTIFY_NEXT_OUTPUT 0x83
48#define ACPI_VIDEO_NOTIFY_PREV_OUTPUT 0x84 49#define ACPI_VIDEO_NOTIFY_PREV_OUTPUT 0x84
49 50
50#define ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS 0x82 51#define ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS 0x85
51#define ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS 0x83 52#define ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS 0x86
52#define ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS 0x84 53#define ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS 0x87
53#define ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS 0x85 54#define ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS 0x88
54#define ACPI_VIDEO_NOTIFY_DISPLAY_OFF 0x86 55#define ACPI_VIDEO_NOTIFY_DISPLAY_OFF 0x89
55 56
56#define ACPI_VIDEO_HEAD_INVALID (~0u - 1) 57#define ACPI_VIDEO_HEAD_INVALID (~0u - 1)
57#define ACPI_VIDEO_HEAD_END (~0u) 58#define ACPI_VIDEO_HEAD_END (~0u)
@@ -1505,8 +1506,34 @@ static int
1505acpi_video_get_next_level(struct acpi_video_device *device, 1506acpi_video_get_next_level(struct acpi_video_device *device,
1506 u32 level_current, u32 event) 1507 u32 level_current, u32 event)
1507{ 1508{
1508 /*Fix me */ 1509 int min, max, min_above, max_below, i, l;
1509 return level_current; 1510 max = max_below = 0;
1511 min = min_above = 255;
1512 for (i = 0; i < device->brightness->count; i++) {
1513 l = device->brightness->levels[i];
1514 if (l < min)
1515 min = l;
1516 if (l > max)
1517 max = l;
1518 if (l < min_above && l > level_current)
1519 min_above = l;
1520 if (l > max_below && l < level_current)
1521 max_below = l;
1522 }
1523
1524 switch (event) {
1525 case ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS:
1526 return (level_current < max) ? min_above : min;
1527 case ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS:
1528 return (level_current < max) ? min_above : max;
1529 case ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS:
1530 return (level_current > min) ? max_below : min;
1531 case ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS:
1532 case ACPI_VIDEO_NOTIFY_DISPLAY_OFF:
1533 return 0;
1534 default:
1535 return level_current;
1536 }
1510} 1537}
1511 1538
1512static void 1539static void
diff --git a/drivers/misc/msi-laptop.c b/drivers/misc/msi-laptop.c
index fdb7153f4426..8e5e07e4c1cf 100644
--- a/drivers/misc/msi-laptop.c
+++ b/drivers/misc/msi-laptop.c
@@ -317,7 +317,8 @@ static int __init msi_init(void)
317 317
318 /* Register backlight stuff */ 318 /* Register backlight stuff */
319 319
320 msibl_device = backlight_device_register("msi-laptop-bl", NULL, &msibl_props); 320 msibl_device = backlight_device_register("msi-laptop-bl", NULL, NULL,
321 &msibl_props);
321 if (IS_ERR(msibl_device)) 322 if (IS_ERR(msibl_device))
322 return PTR_ERR(msibl_device); 323 return PTR_ERR(msibl_device);
323 324
diff --git a/drivers/usb/misc/appledisplay.c b/drivers/usb/misc/appledisplay.c
index 02cbb7fff24f..a7932a72d298 100644
--- a/drivers/usb/misc/appledisplay.c
+++ b/drivers/usb/misc/appledisplay.c
@@ -281,7 +281,7 @@ static int appledisplay_probe(struct usb_interface *iface,
281 /* Register backlight device */ 281 /* Register backlight device */
282 snprintf(bl_name, sizeof(bl_name), "appledisplay%d", 282 snprintf(bl_name, sizeof(bl_name), "appledisplay%d",
283 atomic_inc_return(&count_displays) - 1); 283 atomic_inc_return(&count_displays) - 1);
284 pdata->bd = backlight_device_register(bl_name, pdata, 284 pdata->bd = backlight_device_register(bl_name, NULL, NULL,
285 &appledisplay_bl_data); 285 &appledisplay_bl_data);
286 if (IS_ERR(pdata->bd)) { 286 if (IS_ERR(pdata->bd)) {
287 err("appledisplay: Backlight registration failed"); 287 err("appledisplay: Backlight registration failed");
diff --git a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c
index 3feddf89d100..2e976ffcde0f 100644
--- a/drivers/video/aty/aty128fb.c
+++ b/drivers/video/aty/aty128fb.c
@@ -1834,7 +1834,7 @@ static void aty128_bl_init(struct aty128fb_par *par)
1834 1834
1835 snprintf(name, sizeof(name), "aty128bl%d", info->node); 1835 snprintf(name, sizeof(name), "aty128bl%d", info->node);
1836 1836
1837 bd = backlight_device_register(name, par, &aty128_bl_data); 1837 bd = backlight_device_register(name, info->dev, par, &aty128_bl_data);
1838 if (IS_ERR(bd)) { 1838 if (IS_ERR(bd)) {
1839 info->bl_dev = NULL; 1839 info->bl_dev = NULL;
1840 printk(KERN_WARNING "aty128: Backlight registration failed\n"); 1840 printk(KERN_WARNING "aty128: Backlight registration failed\n");
diff --git a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c
index 09684d7a7ce9..f2ebdd880085 100644
--- a/drivers/video/aty/atyfb_base.c
+++ b/drivers/video/aty/atyfb_base.c
@@ -2211,7 +2211,7 @@ static void aty_bl_init(struct atyfb_par *par)
2211 2211
2212 snprintf(name, sizeof(name), "atybl%d", info->node); 2212 snprintf(name, sizeof(name), "atybl%d", info->node);
2213 2213
2214 bd = backlight_device_register(name, par, &aty_bl_data); 2214 bd = backlight_device_register(name, info->dev, par, &aty_bl_data);
2215 if (IS_ERR(bd)) { 2215 if (IS_ERR(bd)) {
2216 info->bl_dev = NULL; 2216 info->bl_dev = NULL;
2217 printk(KERN_WARNING "aty: Backlight registration failed\n"); 2217 printk(KERN_WARNING "aty: Backlight registration failed\n");
diff --git a/drivers/video/aty/radeon_backlight.c b/drivers/video/aty/radeon_backlight.c
index 585eb7b9e636..3abfd4a380cc 100644
--- a/drivers/video/aty/radeon_backlight.c
+++ b/drivers/video/aty/radeon_backlight.c
@@ -163,7 +163,7 @@ void radeonfb_bl_init(struct radeonfb_info *rinfo)
163 163
164 snprintf(name, sizeof(name), "radeonbl%d", rinfo->info->node); 164 snprintf(name, sizeof(name), "radeonbl%d", rinfo->info->node);
165 165
166 bd = backlight_device_register(name, pdata, &radeon_bl_data); 166 bd = backlight_device_register(name, rinfo->info->dev, pdata, &radeon_bl_data);
167 if (IS_ERR(bd)) { 167 if (IS_ERR(bd)) {
168 rinfo->info->bl_dev = NULL; 168 rinfo->info->bl_dev = NULL;
169 printk("radeonfb: Backlight registration failed\n"); 169 printk("radeonfb: Backlight registration failed\n");
diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c
index db8c191b1201..9601bfe309ac 100644
--- a/drivers/video/backlight/backlight.c
+++ b/drivers/video/backlight/backlight.c
@@ -216,8 +216,10 @@ static const struct class_device_attribute bl_class_device_attributes[] = {
216 * Creates and registers new backlight class_device. Returns either an 216 * Creates and registers new backlight class_device. Returns either an
217 * ERR_PTR() or a pointer to the newly allocated device. 217 * ERR_PTR() or a pointer to the newly allocated device.
218 */ 218 */
219struct backlight_device *backlight_device_register(const char *name, void *devdata, 219struct backlight_device *backlight_device_register(const char *name,
220 struct backlight_properties *bp) 220 struct device *dev,
221 void *devdata,
222 struct backlight_properties *bp)
221{ 223{
222 int i, rc; 224 int i, rc;
223 struct backlight_device *new_bd; 225 struct backlight_device *new_bd;
@@ -232,6 +234,7 @@ struct backlight_device *backlight_device_register(const char *name, void *devda
232 new_bd->props = bp; 234 new_bd->props = bp;
233 memset(&new_bd->class_dev, 0, sizeof(new_bd->class_dev)); 235 memset(&new_bd->class_dev, 0, sizeof(new_bd->class_dev));
234 new_bd->class_dev.class = &backlight_class; 236 new_bd->class_dev.class = &backlight_class;
237 new_bd->class_dev.dev = dev;
235 strlcpy(new_bd->class_dev.class_id, name, KOBJ_NAME_LEN); 238 strlcpy(new_bd->class_dev.class_id, name, KOBJ_NAME_LEN);
236 class_set_devdata(&new_bd->class_dev, devdata); 239 class_set_devdata(&new_bd->class_dev, devdata);
237 240
diff --git a/drivers/video/nvidia/nv_backlight.c b/drivers/video/nvidia/nv_backlight.c
index 5b75ae4e9457..df934bd21899 100644
--- a/drivers/video/nvidia/nv_backlight.c
+++ b/drivers/video/nvidia/nv_backlight.c
@@ -141,7 +141,7 @@ void nvidia_bl_init(struct nvidia_par *par)
141 141
142 snprintf(name, sizeof(name), "nvidiabl%d", info->node); 142 snprintf(name, sizeof(name), "nvidiabl%d", info->node);
143 143
144 bd = backlight_device_register(name, par, &nvidia_bl_data); 144 bd = backlight_device_register(name, info->dev, par, &nvidia_bl_data);
145 if (IS_ERR(bd)) { 145 if (IS_ERR(bd)) {
146 info->bl_dev = NULL; 146 info->bl_dev = NULL;
147 printk(KERN_WARNING "nvidia: Backlight registration failed\n"); 147 printk(KERN_WARNING "nvidia: Backlight registration failed\n");
diff --git a/drivers/video/riva/fbdev.c b/drivers/video/riva/fbdev.c
index 345e8b1c1af8..1a13966b7d5b 100644
--- a/drivers/video/riva/fbdev.c
+++ b/drivers/video/riva/fbdev.c
@@ -384,7 +384,7 @@ static void riva_bl_init(struct riva_par *par)
384 384
385 snprintf(name, sizeof(name), "rivabl%d", info->node); 385 snprintf(name, sizeof(name), "rivabl%d", info->node);
386 386
387 bd = backlight_device_register(name, par, &riva_bl_data); 387 bd = backlight_device_register(name, info->dev, par, &riva_bl_data);
388 if (IS_ERR(bd)) { 388 if (IS_ERR(bd)) {
389 info->bl_dev = NULL; 389 info->bl_dev = NULL;
390 printk(KERN_WARNING "riva: Backlight registration failed\n"); 390 printk(KERN_WARNING "riva: Backlight registration failed\n");
diff --git a/include/linux/backlight.h b/include/linux/backlight.h
index 75e91f5b6a04..a5cf1beacb44 100644
--- a/include/linux/backlight.h
+++ b/include/linux/backlight.h
@@ -54,7 +54,7 @@ struct backlight_device {
54}; 54};
55 55
56extern struct backlight_device *backlight_device_register(const char *name, 56extern struct backlight_device *backlight_device_register(const char *name,
57 void *devdata, struct backlight_properties *bp); 57 struct device *dev,void *devdata,struct backlight_properties *bp);
58extern void backlight_device_unregister(struct backlight_device *bd); 58extern void backlight_device_unregister(struct backlight_device *bd);
59 59
60#define to_backlight_device(obj) container_of(obj, struct backlight_device, class_dev) 60#define to_backlight_device(obj) container_of(obj, struct backlight_device, class_dev)