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>
This commit is contained in:

committed by
Richard Purdie

parent
57e148b6a9
commit
a19a6ee6ca
@@ -117,6 +117,7 @@ static struct backlight_ops atmel_lcdc_bl_ops = {
|
||||
|
||||
static void init_backlight(struct atmel_lcdfb_info *sinfo)
|
||||
{
|
||||
struct backlight_properties props;
|
||||
struct backlight_device *bl;
|
||||
|
||||
sinfo->bl_power = FB_BLANK_UNBLANK;
|
||||
@@ -124,8 +125,10 @@ static void init_backlight(struct atmel_lcdfb_info *sinfo)
|
||||
if (sinfo->backlight)
|
||||
return;
|
||||
|
||||
bl = backlight_device_register("backlight", &sinfo->pdev->dev,
|
||||
sinfo, &atmel_lcdc_bl_ops);
|
||||
memset(&props, 0, sizeof(struct backlight_properties));
|
||||
props.max_brightness = 0xff;
|
||||
bl = backlight_device_register("backlight", &sinfo->pdev->dev, sinfo,
|
||||
&atmel_lcdc_bl_ops, &props);
|
||||
if (IS_ERR(bl)) {
|
||||
dev_err(&sinfo->pdev->dev, "error %ld on backlight register\n",
|
||||
PTR_ERR(bl));
|
||||
@@ -135,7 +138,6 @@ static void init_backlight(struct atmel_lcdfb_info *sinfo)
|
||||
|
||||
bl->props.power = FB_BLANK_UNBLANK;
|
||||
bl->props.fb_blank = FB_BLANK_UNBLANK;
|
||||
bl->props.max_brightness = 0xff;
|
||||
bl->props.brightness = atmel_bl_get_brightness(bl);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user