diff options
author | Matthew Garrett <mjg@redhat.com> | 2010-02-17 16:39:44 -0500 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-03-16 15:47:54 -0400 |
commit | a19a6ee6cad2b20292a774c2f56ba8039b0fac9c (patch) | |
tree | 631916ce6181336c5c28eb0cf5484c40c92986b6 /drivers/video/backlight/mbp_nvidia_bl.c | |
parent | 57e148b6a975980944f4466ccb669b1d02dfc6a1 (diff) |
backlight: Allow properties to be passed at registration
Values such as max_brightness should be set before backlights are
registered, but the current API doesn't allow that. Add a parameter to
backlight_device_register and update drivers to ensure that they
set this correctly.
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'drivers/video/backlight/mbp_nvidia_bl.c')
-rw-r--r-- | drivers/video/backlight/mbp_nvidia_bl.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/video/backlight/mbp_nvidia_bl.c b/drivers/video/backlight/mbp_nvidia_bl.c index 2e78b0784bdc..0881358eeace 100644 --- a/drivers/video/backlight/mbp_nvidia_bl.c +++ b/drivers/video/backlight/mbp_nvidia_bl.c | |||
@@ -250,6 +250,7 @@ static const struct dmi_system_id __initdata mbp_device_table[] = { | |||
250 | 250 | ||
251 | static int __init mbp_init(void) | 251 | static int __init mbp_init(void) |
252 | { | 252 | { |
253 | struct backlight_properties props; | ||
253 | if (!dmi_check_system(mbp_device_table)) | 254 | if (!dmi_check_system(mbp_device_table)) |
254 | return -ENODEV; | 255 | return -ENODEV; |
255 | 256 | ||
@@ -257,14 +258,17 @@ static int __init mbp_init(void) | |||
257 | "Macbook Pro backlight")) | 258 | "Macbook Pro backlight")) |
258 | return -ENXIO; | 259 | return -ENXIO; |
259 | 260 | ||
260 | mbp_backlight_device = backlight_device_register("mbp_backlight", | 261 | memset(&props, 0, sizeof(struct backlight_properties)); |
261 | NULL, NULL, &driver_data->backlight_ops); | 262 | props.max_brightness = 15; |
263 | mbp_backlight_device = backlight_device_register("mbp_backlight", NULL, | ||
264 | NULL, | ||
265 | &driver_data->backlight_ops, | ||
266 | &props); | ||
262 | if (IS_ERR(mbp_backlight_device)) { | 267 | if (IS_ERR(mbp_backlight_device)) { |
263 | release_region(driver_data->iostart, driver_data->iolen); | 268 | release_region(driver_data->iostart, driver_data->iolen); |
264 | return PTR_ERR(mbp_backlight_device); | 269 | return PTR_ERR(mbp_backlight_device); |
265 | } | 270 | } |
266 | 271 | ||
267 | mbp_backlight_device->props.max_brightness = 15; | ||
268 | mbp_backlight_device->props.brightness = | 272 | mbp_backlight_device->props.brightness = |
269 | driver_data->backlight_ops.get_brightness(mbp_backlight_device); | 273 | driver_data->backlight_ops.get_brightness(mbp_backlight_device); |
270 | backlight_update_status(mbp_backlight_device); | 274 | backlight_update_status(mbp_backlight_device); |