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
@@ -249,12 +249,15 @@ static int __init msi_wmi_init(void)
|
||||
goto err_uninstall_notifier;
|
||||
|
||||
if (!acpi_video_backlight_support()) {
|
||||
backlight = backlight_device_register(DRV_NAME,
|
||||
NULL, NULL, &msi_backlight_ops);
|
||||
struct backlight_properties props;
|
||||
memset(&props, 0, sizeof(struct backlight_properties));
|
||||
props.max_brightness = ARRAY_SIZE(backlight_map) - 1;
|
||||
backlight = backlight_device_register(DRV_NAME, NULL, NULL,
|
||||
&msi_backlight_ops,
|
||||
&props);
|
||||
if (IS_ERR(backlight))
|
||||
goto err_free_input;
|
||||
|
||||
backlight->props.max_brightness = ARRAY_SIZE(backlight_map) - 1;
|
||||
err = bl_get(NULL);
|
||||
if (err < 0)
|
||||
goto err_free_backlight;
|
||||
|
Reference in New Issue
Block a user