Commit 4da47422 authored by Hans de Goede's avatar Hans de Goede

platform/x86: panasonic-laptop: Use acpi_video_get_backlight_type()

Use acpi_video_get_backlight_type() to determine if we should register
the panasonic specific backlight interface. To avoid registering this
on systems where the ACPI or GPU native backlight control methods
should be used instead.
Tested-by: default avatarStefan Seyfried <seife+kernel@b1-systems.com>
Tested-by: default avatarKenneth Chan <kenneth.t.chan@gmail.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220624112340.10130-8-hdegoede@redhat.com
parent 5e24e1ec
...@@ -998,10 +998,13 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device) ...@@ -998,10 +998,13 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device)
pr_err("Couldn't retrieve BIOS data\n"); pr_err("Couldn't retrieve BIOS data\n");
goto out_input; goto out_input;
} }
if (acpi_video_get_backlight_type() == acpi_backlight_vendor) {
/* initialize backlight */ /* initialize backlight */
memset(&props, 0, sizeof(struct backlight_properties)); memset(&props, 0, sizeof(struct backlight_properties));
props.type = BACKLIGHT_PLATFORM; props.type = BACKLIGHT_PLATFORM;
props.max_brightness = pcc->sinf[SINF_AC_MAX_BRIGHT]; props.max_brightness = pcc->sinf[SINF_AC_MAX_BRIGHT];
pcc->backlight = backlight_device_register("panasonic", NULL, pcc, pcc->backlight = backlight_device_register("panasonic", NULL, pcc,
&pcc_backlight_ops, &props); &pcc_backlight_ops, &props);
if (IS_ERR(pcc->backlight)) { if (IS_ERR(pcc->backlight)) {
...@@ -1011,6 +1014,7 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device) ...@@ -1011,6 +1014,7 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device)
/* read the initial brightness setting from the hardware */ /* read the initial brightness setting from the hardware */
pcc->backlight->props.brightness = pcc->sinf[SINF_AC_CUR_BRIGHT]; pcc->backlight->props.brightness = pcc->sinf[SINF_AC_CUR_BRIGHT];
}
/* Reset initial sticky key mode since the hardware register state is not consistent */ /* Reset initial sticky key mode since the hardware register state is not consistent */
acpi_pcc_write_sset(pcc, SINF_STICKY_KEY, 0); acpi_pcc_write_sset(pcc, SINF_STICKY_KEY, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment