Commit 40b20c25 authored by Len Brown's avatar Len Brown

Pull platform-drivers into test branch

parents cece9014 a8274d57
...@@ -1401,7 +1401,7 @@ static int __init asus_acpi_init(void) ...@@ -1401,7 +1401,7 @@ static int __init asus_acpi_init(void)
return result; return result;
} }
asus_backlight_device = backlight_device_register("asus", NULL, asus_backlight_device = backlight_device_register("asus",NULL,NULL,
&asus_backlight_data); &asus_backlight_data);
if (IS_ERR(asus_backlight_device)) { if (IS_ERR(asus_backlight_device)) {
printk(KERN_ERR "Could not register asus backlight device\n"); printk(KERN_ERR "Could not register asus backlight device\n");
......
...@@ -1714,7 +1714,7 @@ static struct backlight_properties ibm_backlight_data = { ...@@ -1714,7 +1714,7 @@ static struct backlight_properties ibm_backlight_data = {
static int brightness_init(void) static int brightness_init(void)
{ {
ibm_backlight_device = backlight_device_register("ibm", NULL, ibm_backlight_device = backlight_device_register("ibm", NULL, NULL,
&ibm_backlight_data); &ibm_backlight_data);
if (IS_ERR(ibm_backlight_device)) { if (IS_ERR(ibm_backlight_device)) {
printk(IBM_ERR "Could not register backlight device\n"); printk(IBM_ERR "Could not register backlight device\n");
...@@ -2503,7 +2503,7 @@ static int __init setup_notify(struct ibm_struct *ibm) ...@@ -2503,7 +2503,7 @@ static int __init setup_notify(struct ibm_struct *ibm)
ibm->name, status); ibm->name, status);
return -ENODEV; return -ENODEV;
} }
ibm->notify_installed = 1;
return 0; return 0;
} }
...@@ -2580,7 +2580,6 @@ static int __init ibm_init(struct ibm_struct *ibm) ...@@ -2580,7 +2580,6 @@ static int __init ibm_init(struct ibm_struct *ibm)
ret = setup_notify(ibm); ret = setup_notify(ibm);
if (ret < 0) if (ret < 0)
return ret; return ret;
ibm->notify_installed = 1;
} }
return 0; return 0;
......
...@@ -590,7 +590,8 @@ static int __init toshiba_acpi_init(void) ...@@ -590,7 +590,8 @@ static int __init toshiba_acpi_init(void)
remove_proc_entry(PROC_TOSHIBA, acpi_root_dir); remove_proc_entry(PROC_TOSHIBA, acpi_root_dir);
} }
toshiba_backlight_device = backlight_device_register("toshiba", NULL, toshiba_backlight_device = backlight_device_register("toshiba",NULL,
NULL,
&toshiba_backlight_data); &toshiba_backlight_data);
if (IS_ERR(toshiba_backlight_device)) { if (IS_ERR(toshiba_backlight_device)) {
printk(KERN_ERR "Could not register toshiba backlight device\n"); printk(KERN_ERR "Could not register toshiba backlight device\n");
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
* *
* Copyright (C) 2004 Luming Yu <luming.yu@intel.com> * Copyright (C) 2004 Luming Yu <luming.yu@intel.com>
* Copyright (C) 2004 Bruno Ducrot <ducrot@poupinou.org> * Copyright (C) 2004 Bruno Ducrot <ducrot@poupinou.org>
* Copyright (C) 2006 Thomas Tuttle <linux-kernel@ttuttle.net>
* *
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* *
...@@ -47,11 +48,11 @@ ...@@ -47,11 +48,11 @@
#define ACPI_VIDEO_NOTIFY_NEXT_OUTPUT 0x83 #define ACPI_VIDEO_NOTIFY_NEXT_OUTPUT 0x83
#define ACPI_VIDEO_NOTIFY_PREV_OUTPUT 0x84 #define ACPI_VIDEO_NOTIFY_PREV_OUTPUT 0x84
#define ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS 0x82 #define ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS 0x85
#define ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS 0x83 #define ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS 0x86
#define ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS 0x84 #define ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS 0x87
#define ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS 0x85 #define ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS 0x88
#define ACPI_VIDEO_NOTIFY_DISPLAY_OFF 0x86 #define ACPI_VIDEO_NOTIFY_DISPLAY_OFF 0x89
#define ACPI_VIDEO_HEAD_INVALID (~0u - 1) #define ACPI_VIDEO_HEAD_INVALID (~0u - 1)
#define ACPI_VIDEO_HEAD_END (~0u) #define ACPI_VIDEO_HEAD_END (~0u)
...@@ -1505,8 +1506,34 @@ static int ...@@ -1505,8 +1506,34 @@ static int
acpi_video_get_next_level(struct acpi_video_device *device, acpi_video_get_next_level(struct acpi_video_device *device,
u32 level_current, u32 event) u32 level_current, u32 event)
{ {
/*Fix me */ int min, max, min_above, max_below, i, l;
max = max_below = 0;
min = min_above = 255;
for (i = 0; i < device->brightness->count; i++) {
l = device->brightness->levels[i];
if (l < min)
min = l;
if (l > max)
max = l;
if (l < min_above && l > level_current)
min_above = l;
if (l > max_below && l < level_current)
max_below = l;
}
switch (event) {
case ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS:
return (level_current < max) ? min_above : min;
case ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS:
return (level_current < max) ? min_above : max;
case ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS:
return (level_current > min) ? max_below : min;
case ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS:
case ACPI_VIDEO_NOTIFY_DISPLAY_OFF:
return 0;
default:
return level_current; return level_current;
}
} }
static void static void
......
...@@ -317,7 +317,8 @@ static int __init msi_init(void) ...@@ -317,7 +317,8 @@ static int __init msi_init(void)
/* Register backlight stuff */ /* Register backlight stuff */
msibl_device = backlight_device_register("msi-laptop-bl", NULL, &msibl_props); msibl_device = backlight_device_register("msi-laptop-bl", NULL, NULL,
&msibl_props);
if (IS_ERR(msibl_device)) if (IS_ERR(msibl_device))
return PTR_ERR(msibl_device); return PTR_ERR(msibl_device);
......
...@@ -281,7 +281,7 @@ static int appledisplay_probe(struct usb_interface *iface, ...@@ -281,7 +281,7 @@ static int appledisplay_probe(struct usb_interface *iface,
/* Register backlight device */ /* Register backlight device */
snprintf(bl_name, sizeof(bl_name), "appledisplay%d", snprintf(bl_name, sizeof(bl_name), "appledisplay%d",
atomic_inc_return(&count_displays) - 1); atomic_inc_return(&count_displays) - 1);
pdata->bd = backlight_device_register(bl_name, pdata, pdata->bd = backlight_device_register(bl_name, NULL, NULL,
&appledisplay_bl_data); &appledisplay_bl_data);
if (IS_ERR(pdata->bd)) { if (IS_ERR(pdata->bd)) {
err("appledisplay: Backlight registration failed"); err("appledisplay: Backlight registration failed");
......
...@@ -1834,7 +1834,7 @@ static void aty128_bl_init(struct aty128fb_par *par) ...@@ -1834,7 +1834,7 @@ static void aty128_bl_init(struct aty128fb_par *par)
snprintf(name, sizeof(name), "aty128bl%d", info->node); snprintf(name, sizeof(name), "aty128bl%d", info->node);
bd = backlight_device_register(name, par, &aty128_bl_data); bd = backlight_device_register(name, info->dev, par, &aty128_bl_data);
if (IS_ERR(bd)) { if (IS_ERR(bd)) {
info->bl_dev = NULL; info->bl_dev = NULL;
printk(KERN_WARNING "aty128: Backlight registration failed\n"); printk(KERN_WARNING "aty128: Backlight registration failed\n");
......
...@@ -2211,7 +2211,7 @@ static void aty_bl_init(struct atyfb_par *par) ...@@ -2211,7 +2211,7 @@ static void aty_bl_init(struct atyfb_par *par)
snprintf(name, sizeof(name), "atybl%d", info->node); snprintf(name, sizeof(name), "atybl%d", info->node);
bd = backlight_device_register(name, par, &aty_bl_data); bd = backlight_device_register(name, info->dev, par, &aty_bl_data);
if (IS_ERR(bd)) { if (IS_ERR(bd)) {
info->bl_dev = NULL; info->bl_dev = NULL;
printk(KERN_WARNING "aty: Backlight registration failed\n"); printk(KERN_WARNING "aty: Backlight registration failed\n");
......
...@@ -163,7 +163,7 @@ void radeonfb_bl_init(struct radeonfb_info *rinfo) ...@@ -163,7 +163,7 @@ void radeonfb_bl_init(struct radeonfb_info *rinfo)
snprintf(name, sizeof(name), "radeonbl%d", rinfo->info->node); snprintf(name, sizeof(name), "radeonbl%d", rinfo->info->node);
bd = backlight_device_register(name, pdata, &radeon_bl_data); bd = backlight_device_register(name, rinfo->info->dev, pdata, &radeon_bl_data);
if (IS_ERR(bd)) { if (IS_ERR(bd)) {
rinfo->info->bl_dev = NULL; rinfo->info->bl_dev = NULL;
printk("radeonfb: Backlight registration failed\n"); printk("radeonfb: Backlight registration failed\n");
......
...@@ -216,7 +216,9 @@ static const struct class_device_attribute bl_class_device_attributes[] = { ...@@ -216,7 +216,9 @@ static const struct class_device_attribute bl_class_device_attributes[] = {
* Creates and registers new backlight class_device. Returns either an * Creates and registers new backlight class_device. Returns either an
* ERR_PTR() or a pointer to the newly allocated device. * ERR_PTR() or a pointer to the newly allocated device.
*/ */
struct backlight_device *backlight_device_register(const char *name, void *devdata, struct backlight_device *backlight_device_register(const char *name,
struct device *dev,
void *devdata,
struct backlight_properties *bp) struct backlight_properties *bp)
{ {
int i, rc; int i, rc;
...@@ -232,6 +234,7 @@ struct backlight_device *backlight_device_register(const char *name, void *devda ...@@ -232,6 +234,7 @@ struct backlight_device *backlight_device_register(const char *name, void *devda
new_bd->props = bp; new_bd->props = bp;
memset(&new_bd->class_dev, 0, sizeof(new_bd->class_dev)); memset(&new_bd->class_dev, 0, sizeof(new_bd->class_dev));
new_bd->class_dev.class = &backlight_class; new_bd->class_dev.class = &backlight_class;
new_bd->class_dev.dev = dev;
strlcpy(new_bd->class_dev.class_id, name, KOBJ_NAME_LEN); strlcpy(new_bd->class_dev.class_id, name, KOBJ_NAME_LEN);
class_set_devdata(&new_bd->class_dev, devdata); class_set_devdata(&new_bd->class_dev, devdata);
......
...@@ -141,7 +141,7 @@ void nvidia_bl_init(struct nvidia_par *par) ...@@ -141,7 +141,7 @@ void nvidia_bl_init(struct nvidia_par *par)
snprintf(name, sizeof(name), "nvidiabl%d", info->node); snprintf(name, sizeof(name), "nvidiabl%d", info->node);
bd = backlight_device_register(name, par, &nvidia_bl_data); bd = backlight_device_register(name, info->dev, par, &nvidia_bl_data);
if (IS_ERR(bd)) { if (IS_ERR(bd)) {
info->bl_dev = NULL; info->bl_dev = NULL;
printk(KERN_WARNING "nvidia: Backlight registration failed\n"); printk(KERN_WARNING "nvidia: Backlight registration failed\n");
......
...@@ -384,7 +384,7 @@ static void riva_bl_init(struct riva_par *par) ...@@ -384,7 +384,7 @@ static void riva_bl_init(struct riva_par *par)
snprintf(name, sizeof(name), "rivabl%d", info->node); snprintf(name, sizeof(name), "rivabl%d", info->node);
bd = backlight_device_register(name, par, &riva_bl_data); bd = backlight_device_register(name, info->dev, par, &riva_bl_data);
if (IS_ERR(bd)) { if (IS_ERR(bd)) {
info->bl_dev = NULL; info->bl_dev = NULL;
printk(KERN_WARNING "riva: Backlight registration failed\n"); printk(KERN_WARNING "riva: Backlight registration failed\n");
......
...@@ -54,7 +54,7 @@ struct backlight_device { ...@@ -54,7 +54,7 @@ struct backlight_device {
}; };
extern struct backlight_device *backlight_device_register(const char *name, extern struct backlight_device *backlight_device_register(const char *name,
void *devdata, struct backlight_properties *bp); struct device *dev,void *devdata,struct backlight_properties *bp);
extern void backlight_device_unregister(struct backlight_device *bd); extern void backlight_device_unregister(struct backlight_device *bd);
#define to_backlight_device(obj) container_of(obj, struct backlight_device, class_dev) #define to_backlight_device(obj) container_of(obj, struct backlight_device, class_dev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment