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
@@ -6170,6 +6170,7 @@ static const struct tpacpi_quirk brightness_quirk_table[] __initconst = {
|
||||
|
||||
static int __init brightness_init(struct ibm_init_struct *iibm)
|
||||
{
|
||||
struct backlight_properties props;
|
||||
int b;
|
||||
unsigned long quirks;
|
||||
|
||||
@@ -6259,9 +6260,12 @@ static int __init brightness_init(struct ibm_init_struct *iibm)
|
||||
printk(TPACPI_INFO
|
||||
"detected a 16-level brightness capable ThinkPad\n");
|
||||
|
||||
ibm_backlight_device = backlight_device_register(
|
||||
TPACPI_BACKLIGHT_DEV_NAME, NULL, NULL,
|
||||
&ibm_backlight_data);
|
||||
memset(&props, 0, sizeof(struct backlight_properties));
|
||||
props.max_brightness = (tp_features.bright_16levels) ? 15 : 7;
|
||||
ibm_backlight_device = backlight_device_register(TPACPI_BACKLIGHT_DEV_NAME,
|
||||
NULL, NULL,
|
||||
&ibm_backlight_data,
|
||||
&props);
|
||||
if (IS_ERR(ibm_backlight_device)) {
|
||||
int rc = PTR_ERR(ibm_backlight_device);
|
||||
ibm_backlight_device = NULL;
|
||||
@@ -6280,8 +6284,6 @@ static int __init brightness_init(struct ibm_init_struct *iibm)
|
||||
"or not on your ThinkPad\n", TPACPI_MAIL);
|
||||
}
|
||||
|
||||
ibm_backlight_device->props.max_brightness =
|
||||
(tp_features.bright_16levels)? 15 : 7;
|
||||
ibm_backlight_device->props.brightness = b & TP_EC_BACKLIGHT_LVLMSK;
|
||||
backlight_update_status(ibm_backlight_device);
|
||||
|
||||
|
Reference in New Issue
Block a user