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/riva | |
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/riva')
-rw-r--r-- | drivers/video/riva/fbdev.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/video/riva/fbdev.c b/drivers/video/riva/fbdev.c index d94c57ffbdb1..618f36bec10d 100644 --- a/drivers/video/riva/fbdev.c +++ b/drivers/video/riva/fbdev.c | |||
@@ -338,6 +338,7 @@ static struct backlight_ops riva_bl_ops = { | |||
338 | 338 | ||
339 | static void riva_bl_init(struct riva_par *par) | 339 | static void riva_bl_init(struct riva_par *par) |
340 | { | 340 | { |
341 | struct backlight_properties props; | ||
341 | struct fb_info *info = pci_get_drvdata(par->pdev); | 342 | struct fb_info *info = pci_get_drvdata(par->pdev); |
342 | struct backlight_device *bd; | 343 | struct backlight_device *bd; |
343 | char name[12]; | 344 | char name[12]; |
@@ -353,7 +354,10 @@ static void riva_bl_init(struct riva_par *par) | |||
353 | 354 | ||
354 | snprintf(name, sizeof(name), "rivabl%d", info->node); | 355 | snprintf(name, sizeof(name), "rivabl%d", info->node); |
355 | 356 | ||
356 | bd = backlight_device_register(name, info->dev, par, &riva_bl_ops); | 357 | memset(&props, 0, sizeof(struct backlight_properties)); |
358 | props.max_brightness = FB_BACKLIGHT_LEVELS - 1; | ||
359 | bd = backlight_device_register(name, info->dev, par, &riva_bl_ops, | ||
360 | &props); | ||
357 | if (IS_ERR(bd)) { | 361 | if (IS_ERR(bd)) { |
358 | info->bl_dev = NULL; | 362 | info->bl_dev = NULL; |
359 | printk(KERN_WARNING "riva: Backlight registration failed\n"); | 363 | printk(KERN_WARNING "riva: Backlight registration failed\n"); |
@@ -365,7 +369,6 @@ static void riva_bl_init(struct riva_par *par) | |||
365 | MIN_LEVEL * FB_BACKLIGHT_MAX / MAX_LEVEL, | 369 | MIN_LEVEL * FB_BACKLIGHT_MAX / MAX_LEVEL, |
366 | FB_BACKLIGHT_MAX); | 370 | FB_BACKLIGHT_MAX); |
367 | 371 | ||
368 | bd->props.max_brightness = FB_BACKLIGHT_LEVELS - 1; | ||
369 | bd->props.brightness = bd->props.max_brightness; | 372 | bd->props.brightness = bd->props.max_brightness; |
370 | bd->props.power = FB_BLANK_UNBLANK; | 373 | bd->props.power = FB_BLANK_UNBLANK; |
371 | backlight_update_status(bd); | 374 | backlight_update_status(bd); |