Commit 4e46aa08 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.o-hand.com/linux-rpurdie-backlight

* 'for-linus' of git://git.o-hand.com/linux-rpurdie-backlight:
  backlight: mbp_nvidia_bl - add two more MacBookPro variants
  backlight: Pass device through notify callback in the pwm driver
  backlight: PTR_ERR return of wrong pointer in cr_backlight_probe()
  backlight: Constify struct backlight_ops
  backlight/thinkpad-acpi: issue backlight class events

Fix up trivial conflicts in thinkpad-acpi support (backlight support
already merged earlier).
parents 9209e4bd f7a297af
...@@ -85,7 +85,7 @@ static int adp5520_bl_get_brightness(struct backlight_device *bl) ...@@ -85,7 +85,7 @@ static int adp5520_bl_get_brightness(struct backlight_device *bl)
return error ? data->current_brightness : reg_val; return error ? data->current_brightness : reg_val;
} }
static struct backlight_ops adp5520_bl_ops = { static const struct backlight_ops adp5520_bl_ops = {
.update_status = adp5520_bl_update_status, .update_status = adp5520_bl_update_status,
.get_brightness = adp5520_bl_get_brightness, .get_brightness = adp5520_bl_get_brightness,
}; };
......
...@@ -61,7 +61,7 @@ static int adx_backlight_check_fb(struct fb_info *fb) ...@@ -61,7 +61,7 @@ static int adx_backlight_check_fb(struct fb_info *fb)
return 1; return 1;
} }
static struct backlight_ops adx_backlight_ops = { static const struct backlight_ops adx_backlight_ops = {
.options = 0, .options = 0,
.update_status = adx_backlight_update_status, .update_status = adx_backlight_update_status,
.get_brightness = adx_backlight_get_brightness, .get_brightness = adx_backlight_get_brightness,
......
...@@ -113,7 +113,7 @@ static int atmel_pwm_bl_init_pwm(struct atmel_pwm_bl *pwmbl) ...@@ -113,7 +113,7 @@ static int atmel_pwm_bl_init_pwm(struct atmel_pwm_bl *pwmbl)
return pwm_channel_enable(&pwmbl->pwmc); return pwm_channel_enable(&pwmbl->pwmc);
} }
static struct backlight_ops atmel_pwm_bl_ops = { static const struct backlight_ops atmel_pwm_bl_ops = {
.get_brightness = atmel_pwm_bl_get_intensity, .get_brightness = atmel_pwm_bl_get_intensity,
.update_status = atmel_pwm_bl_set_intensity, .update_status = atmel_pwm_bl_set_intensity,
}; };
......
...@@ -269,7 +269,7 @@ EXPORT_SYMBOL(backlight_force_update); ...@@ -269,7 +269,7 @@ EXPORT_SYMBOL(backlight_force_update);
* 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, struct backlight_device *backlight_device_register(const char *name,
struct device *parent, void *devdata, struct backlight_ops *ops) struct device *parent, void *devdata, const struct backlight_ops *ops)
{ {
struct backlight_device *new_bd; struct backlight_device *new_bd;
int rc; int rc;
......
...@@ -451,7 +451,7 @@ void corgi_lcd_limit_intensity(int limit) ...@@ -451,7 +451,7 @@ void corgi_lcd_limit_intensity(int limit)
} }
EXPORT_SYMBOL(corgi_lcd_limit_intensity); EXPORT_SYMBOL(corgi_lcd_limit_intensity);
static struct backlight_ops corgi_bl_ops = { static const struct backlight_ops corgi_bl_ops = {
.get_brightness = corgi_bl_get_intensity, .get_brightness = corgi_bl_get_intensity,
.update_status = corgi_bl_update_status, .update_status = corgi_bl_update_status,
}; };
......
...@@ -108,7 +108,7 @@ static int cr_backlight_get_intensity(struct backlight_device *bd) ...@@ -108,7 +108,7 @@ static int cr_backlight_get_intensity(struct backlight_device *bd)
return intensity; return intensity;
} }
static struct backlight_ops cr_backlight_ops = { static const struct backlight_ops cr_backlight_ops = {
.get_brightness = cr_backlight_get_intensity, .get_brightness = cr_backlight_get_intensity,
.update_status = cr_backlight_set_intensity, .update_status = cr_backlight_set_intensity,
}; };
...@@ -201,7 +201,7 @@ static int cr_backlight_probe(struct platform_device *pdev) ...@@ -201,7 +201,7 @@ static int cr_backlight_probe(struct platform_device *pdev)
if (IS_ERR(ldp)) { if (IS_ERR(ldp)) {
backlight_device_unregister(bdp); backlight_device_unregister(bdp);
pci_dev_put(lpc_dev); pci_dev_put(lpc_dev);
return PTR_ERR(bdp); return PTR_ERR(ldp);
} }
pci_read_config_dword(lpc_dev, CRVML_REG_GPIOBAR, pci_read_config_dword(lpc_dev, CRVML_REG_GPIOBAR,
......
...@@ -95,7 +95,7 @@ static int da903x_backlight_get_brightness(struct backlight_device *bl) ...@@ -95,7 +95,7 @@ static int da903x_backlight_get_brightness(struct backlight_device *bl)
return data->current_brightness; return data->current_brightness;
} }
static struct backlight_ops da903x_backlight_ops = { static const struct backlight_ops da903x_backlight_ops = {
.update_status = da903x_backlight_update_status, .update_status = da903x_backlight_update_status,
.get_brightness = da903x_backlight_get_brightness, .get_brightness = da903x_backlight_get_brightness,
}; };
......
...@@ -70,7 +70,7 @@ void corgibl_limit_intensity(int limit) ...@@ -70,7 +70,7 @@ void corgibl_limit_intensity(int limit)
} }
EXPORT_SYMBOL(corgibl_limit_intensity); EXPORT_SYMBOL(corgibl_limit_intensity);
static struct backlight_ops genericbl_ops = { static const struct backlight_ops genericbl_ops = {
.options = BL_CORE_SUSPENDRESUME, .options = BL_CORE_SUSPENDRESUME,
.get_brightness = genericbl_get_intensity, .get_brightness = genericbl_get_intensity,
.update_status = genericbl_send_intensity, .update_status = genericbl_send_intensity,
......
...@@ -98,7 +98,7 @@ static int hp680bl_get_intensity(struct backlight_device *bd) ...@@ -98,7 +98,7 @@ static int hp680bl_get_intensity(struct backlight_device *bd)
return current_intensity; return current_intensity;
} }
static struct backlight_ops hp680bl_ops = { static const struct backlight_ops hp680bl_ops = {
.get_brightness = hp680bl_get_intensity, .get_brightness = hp680bl_get_intensity,
.update_status = hp680bl_set_intensity, .update_status = hp680bl_set_intensity,
}; };
......
...@@ -93,7 +93,7 @@ out: ...@@ -93,7 +93,7 @@ out:
return ret; return ret;
} }
static struct backlight_ops jornada_bl_ops = { static const struct backlight_ops jornada_bl_ops = {
.get_brightness = jornada_bl_get_brightness, .get_brightness = jornada_bl_get_brightness,
.update_status = jornada_bl_update_status, .update_status = jornada_bl_update_status,
.options = BL_CORE_SUSPENDRESUME, .options = BL_CORE_SUSPENDRESUME,
......
...@@ -134,7 +134,7 @@ static int kb3886bl_get_intensity(struct backlight_device *bd) ...@@ -134,7 +134,7 @@ static int kb3886bl_get_intensity(struct backlight_device *bd)
return kb3886bl_intensity; return kb3886bl_intensity;
} }
static struct backlight_ops kb3886bl_ops = { static const struct backlight_ops kb3886bl_ops = {
.get_brightness = kb3886bl_get_intensity, .get_brightness = kb3886bl_get_intensity,
.update_status = kb3886bl_send_intensity, .update_status = kb3886bl_send_intensity,
}; };
......
...@@ -141,7 +141,7 @@ static int locomolcd_get_intensity(struct backlight_device *bd) ...@@ -141,7 +141,7 @@ static int locomolcd_get_intensity(struct backlight_device *bd)
return current_intensity; return current_intensity;
} }
static struct backlight_ops locomobl_data = { static const struct backlight_ops locomobl_data = {
.get_brightness = locomolcd_get_intensity, .get_brightness = locomolcd_get_intensity,
.update_status = locomolcd_set_intensity, .update_status = locomolcd_set_intensity,
}; };
......
...@@ -33,7 +33,7 @@ struct dmi_match_data { ...@@ -33,7 +33,7 @@ struct dmi_match_data {
unsigned long iostart; unsigned long iostart;
unsigned long iolen; unsigned long iolen;
/* Backlight operations structure. */ /* Backlight operations structure. */
struct backlight_ops backlight_ops; const struct backlight_ops backlight_ops;
}; };
/* Module parameters. */ /* Module parameters. */
...@@ -218,6 +218,24 @@ static const struct dmi_system_id __initdata mbp_device_table[] = { ...@@ -218,6 +218,24 @@ static const struct dmi_system_id __initdata mbp_device_table[] = {
}, },
.driver_data = (void *)&nvidia_chipset_data, .driver_data = (void *)&nvidia_chipset_data,
}, },
{
.callback = mbp_dmi_match,
.ident = "MacBookPro 5,3",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."),
DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro5,3"),
},
.driver_data = (void *)&nvidia_chipset_data,
},
{
.callback = mbp_dmi_match,
.ident = "MacBookPro 5,4",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."),
DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro5,4"),
},
.driver_data = (void *)&nvidia_chipset_data,
},
{ {
.callback = mbp_dmi_match, .callback = mbp_dmi_match,
.ident = "MacBookPro 5,5", .ident = "MacBookPro 5,5",
......
...@@ -125,7 +125,7 @@ static int omapbl_get_intensity(struct backlight_device *dev) ...@@ -125,7 +125,7 @@ static int omapbl_get_intensity(struct backlight_device *dev)
return bl->current_intensity; return bl->current_intensity;
} }
static struct backlight_ops omapbl_ops = { static const struct backlight_ops omapbl_ops = {
.get_brightness = omapbl_get_intensity, .get_brightness = omapbl_get_intensity,
.update_status = omapbl_update_status, .update_status = omapbl_update_status,
}; };
......
...@@ -54,7 +54,7 @@ static int progearbl_get_intensity(struct backlight_device *bd) ...@@ -54,7 +54,7 @@ static int progearbl_get_intensity(struct backlight_device *bd)
return intensity - HW_LEVEL_MIN; return intensity - HW_LEVEL_MIN;
} }
static struct backlight_ops progearbl_ops = { static const struct backlight_ops progearbl_ops = {
.get_brightness = progearbl_get_intensity, .get_brightness = progearbl_get_intensity,
.update_status = progearbl_set_intensity, .update_status = progearbl_set_intensity,
}; };
......
...@@ -22,8 +22,10 @@ ...@@ -22,8 +22,10 @@
struct pwm_bl_data { struct pwm_bl_data {
struct pwm_device *pwm; struct pwm_device *pwm;
struct device *dev;
unsigned int period; unsigned int period;
int (*notify)(int brightness); int (*notify)(struct device *,
int brightness);
}; };
static int pwm_backlight_update_status(struct backlight_device *bl) static int pwm_backlight_update_status(struct backlight_device *bl)
...@@ -39,7 +41,7 @@ static int pwm_backlight_update_status(struct backlight_device *bl) ...@@ -39,7 +41,7 @@ static int pwm_backlight_update_status(struct backlight_device *bl)
brightness = 0; brightness = 0;
if (pb->notify) if (pb->notify)
brightness = pb->notify(brightness); brightness = pb->notify(pb->dev, brightness);
if (brightness == 0) { if (brightness == 0) {
pwm_config(pb->pwm, 0, pb->period); pwm_config(pb->pwm, 0, pb->period);
...@@ -56,7 +58,7 @@ static int pwm_backlight_get_brightness(struct backlight_device *bl) ...@@ -56,7 +58,7 @@ static int pwm_backlight_get_brightness(struct backlight_device *bl)
return bl->props.brightness; return bl->props.brightness;
} }
static struct backlight_ops pwm_backlight_ops = { static const struct backlight_ops pwm_backlight_ops = {
.update_status = pwm_backlight_update_status, .update_status = pwm_backlight_update_status,
.get_brightness = pwm_backlight_get_brightness, .get_brightness = pwm_backlight_get_brightness,
}; };
...@@ -88,6 +90,7 @@ static int pwm_backlight_probe(struct platform_device *pdev) ...@@ -88,6 +90,7 @@ static int pwm_backlight_probe(struct platform_device *pdev)
pb->period = data->pwm_period_ns; pb->period = data->pwm_period_ns;
pb->notify = data->notify; pb->notify = data->notify;
pb->dev = &pdev->dev;
pb->pwm = pwm_request(data->pwm_id, "backlight"); pb->pwm = pwm_request(data->pwm_id, "backlight");
if (IS_ERR(pb->pwm)) { if (IS_ERR(pb->pwm)) {
...@@ -146,7 +149,7 @@ static int pwm_backlight_suspend(struct platform_device *pdev, ...@@ -146,7 +149,7 @@ static int pwm_backlight_suspend(struct platform_device *pdev,
struct pwm_bl_data *pb = dev_get_drvdata(&bl->dev); struct pwm_bl_data *pb = dev_get_drvdata(&bl->dev);
if (pb->notify) if (pb->notify)
pb->notify(0); pb->notify(pb->dev, 0);
pwm_config(pb->pwm, 0, pb->period); pwm_config(pb->pwm, 0, pb->period);
pwm_disable(pb->pwm); pwm_disable(pb->pwm);
return 0; return 0;
......
...@@ -72,7 +72,7 @@ static int tosa_bl_get_brightness(struct backlight_device *dev) ...@@ -72,7 +72,7 @@ static int tosa_bl_get_brightness(struct backlight_device *dev)
return props->brightness; return props->brightness;
} }
static struct backlight_ops bl_ops = { static const struct backlight_ops bl_ops = {
.get_brightness = tosa_bl_get_brightness, .get_brightness = tosa_bl_get_brightness,
.update_status = tosa_bl_update_status, .update_status = tosa_bl_update_status,
}; };
......
...@@ -112,7 +112,7 @@ static int wm831x_backlight_get_brightness(struct backlight_device *bl) ...@@ -112,7 +112,7 @@ static int wm831x_backlight_get_brightness(struct backlight_device *bl)
return data->current_brightness; return data->current_brightness;
} }
static struct backlight_ops wm831x_backlight_ops = { static const struct backlight_ops wm831x_backlight_ops = {
.options = BL_CORE_SUSPENDRESUME, .options = BL_CORE_SUSPENDRESUME,
.update_status = wm831x_backlight_update_status, .update_status = wm831x_backlight_update_status,
.get_brightness = wm831x_backlight_get_brightness, .get_brightness = wm831x_backlight_get_brightness,
......
...@@ -36,18 +36,18 @@ struct backlight_device; ...@@ -36,18 +36,18 @@ struct backlight_device;
struct fb_info; struct fb_info;
struct backlight_ops { struct backlight_ops {
unsigned int options; const unsigned int options;
#define BL_CORE_SUSPENDRESUME (1 << 0) #define BL_CORE_SUSPENDRESUME (1 << 0)
/* Notify the backlight driver some property has changed */ /* Notify the backlight driver some property has changed */
int (*update_status)(struct backlight_device *); int (* const update_status)(struct backlight_device *);
/* Return the current backlight brightness (accounting for power, /* Return the current backlight brightness (accounting for power,
fb_blank etc.) */ fb_blank etc.) */
int (*get_brightness)(struct backlight_device *); int (* const get_brightness)(struct backlight_device *);
/* Check if given framebuffer device is the one bound to this backlight; /* Check if given framebuffer device is the one bound to this backlight;
return 0 if not, !=0 if it is. If NULL, backlight always matches the fb. */ return 0 if not, !=0 if it is. If NULL, backlight always matches the fb. */
int (*check_fb)(struct fb_info *); int (* const check_fb)(struct fb_info *);
}; };
/* This structure defines all the properties of a backlight */ /* This structure defines all the properties of a backlight */
...@@ -86,7 +86,7 @@ struct backlight_device { ...@@ -86,7 +86,7 @@ struct backlight_device {
registered this device has been unloaded, and if class_get_devdata() registered this device has been unloaded, and if class_get_devdata()
points to something in the body of that driver, it is also invalid. */ points to something in the body of that driver, it is also invalid. */
struct mutex ops_lock; struct mutex ops_lock;
struct backlight_ops *ops; const struct backlight_ops *ops;
/* The framebuffer notifier block */ /* The framebuffer notifier block */
struct notifier_block fb_notif; struct notifier_block fb_notif;
...@@ -103,7 +103,7 @@ static inline void backlight_update_status(struct backlight_device *bd) ...@@ -103,7 +103,7 @@ static inline void backlight_update_status(struct backlight_device *bd)
} }
extern struct backlight_device *backlight_device_register(const char *name, extern struct backlight_device *backlight_device_register(const char *name,
struct device *dev, void *devdata, struct backlight_ops *ops); struct device *dev, void *devdata, const struct backlight_ops *ops);
extern void backlight_device_unregister(struct backlight_device *bd); extern void backlight_device_unregister(struct backlight_device *bd);
extern void backlight_force_update(struct backlight_device *bd, extern void backlight_force_update(struct backlight_device *bd,
enum backlight_update_reason reason); enum backlight_update_reason reason);
......
...@@ -10,7 +10,7 @@ struct platform_pwm_backlight_data { ...@@ -10,7 +10,7 @@ struct platform_pwm_backlight_data {
unsigned int dft_brightness; unsigned int dft_brightness;
unsigned int pwm_period_ns; unsigned int pwm_period_ns;
int (*init)(struct device *dev); int (*init)(struct device *dev);
int (*notify)(int brightness); int (*notify)(struct device *dev, int brightness);
void (*exit)(struct device *dev); void (*exit)(struct device *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