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
@@ -202,6 +202,7 @@ static void appledisplay_work(struct work_struct *work)
|
||||
static int appledisplay_probe(struct usb_interface *iface,
|
||||
const struct usb_device_id *id)
|
||||
{
|
||||
struct backlight_properties props;
|
||||
struct appledisplay *pdata;
|
||||
struct usb_device *udev = interface_to_usbdev(iface);
|
||||
struct usb_host_interface *iface_desc;
|
||||
@@ -279,16 +280,16 @@ static int appledisplay_probe(struct usb_interface *iface,
|
||||
/* Register backlight device */
|
||||
snprintf(bl_name, sizeof(bl_name), "appledisplay%d",
|
||||
atomic_inc_return(&count_displays) - 1);
|
||||
memset(&props, 0, sizeof(struct backlight_properties));
|
||||
props.max_brightness = 0xff;
|
||||
pdata->bd = backlight_device_register(bl_name, NULL, pdata,
|
||||
&appledisplay_bl_data);
|
||||
&appledisplay_bl_data, &props);
|
||||
if (IS_ERR(pdata->bd)) {
|
||||
dev_err(&iface->dev, "Backlight registration failed\n");
|
||||
retval = PTR_ERR(pdata->bd);
|
||||
goto error;
|
||||
}
|
||||
|
||||
pdata->bd->props.max_brightness = 0xff;
|
||||
|
||||
/* Try to get brightness */
|
||||
brightness = appledisplay_bl_get_brightness(pdata->bd);
|
||||
|
||||
|
Reference in New Issue
Block a user