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

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
Loading
Loading
Loading
Loading
+16 −12
Original line number Diff line number Diff line
@@ -998,10 +998,13 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device)
		pr_err("Couldn't retrieve BIOS data\n");
		goto out_input;
	}

	if (acpi_video_get_backlight_type() == acpi_backlight_vendor) {
		/* initialize backlight */
		memset(&props, 0, sizeof(struct backlight_properties));
		props.type = BACKLIGHT_PLATFORM;
		props.max_brightness = pcc->sinf[SINF_AC_MAX_BRIGHT];

		pcc->backlight = backlight_device_register("panasonic", NULL, pcc,
							   &pcc_backlight_ops, &props);
		if (IS_ERR(pcc->backlight)) {
@@ -1011,6 +1014,7 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device)

		/* read the initial brightness setting from the hardware */
		pcc->backlight->props.brightness = pcc->sinf[SINF_AC_CUR_BRIGHT];
	}

	/* Reset initial sticky key mode since the hardware register state is not consistent */
	acpi_pcc_write_sset(pcc, SINF_STICKY_KEY, 0);