Skip to contentSkip to conversation

ACPI: video: Fix backlight regressions in 6.1

PATCH In review Hans de Goede 3 participants 7 messages Nov 4, 2022 – Nov 7, 2022 ACPI

lore
Share & tools
lore
#0 lore raw

cover ACPI: video: Fix backlight regressions in 6.1

Hi Rafael,

Here is a series of patches to fix known (and likely also unknown) regressions caused by the backlight-detect refactor landing in 6.1.

This builds on top of the earlier Chromebook fix which went upstream through platform-drivers-x86.git/fixes. as such I believe it would be best for this series to go upstream through the pdx86 tree.

Can you please give your Ack for merging this through the pdx86 git tree?

Regards,

Hans

Hans de Goede (3):
ACPI: video: Improve Chromebook checks
ACPI: video: Make acpi_video_backlight_use_native() always return true
ACPI: video: Add backlight=native DMI quirk for Dell G15 5515

 drivers/acpi/video_detect.c | 41 +++++++++++++++++++++++++++++--------
 1 file changed, 32 insertions(+), 9 deletions(-)
Signature · 1 line
2.37.3
#1 lore raw

PATCH 1/3 ACPI: video: Improve Chromebook checks

2 improvements for the Chromebook handling in
acpi_video_get_backlight_type():

1. Also check for the "GOOG000C" ACPI HID used on some models
2. Move the Chromebook check to above the ACPI-video check normally Chromebooks don't have ACPI video backlight support, but when flashed with upstream coreboot builds they may have ACPI video backlight support, but native should still be used/preferred then.

---
 drivers/acpi/video_detect.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)
drivers/acpi/video_detect.c +5 -8
index 9cd8797d12bb..06aaec2e378b 100644
@@ -670,7 +670,7 @@ static const struct dmi_system_id video_detect_dmi_table[] = {
 
 static bool google_cros_ec_present(void)
 {
-	return acpi_dev_found("GOOG0004");
+	return acpi_dev_found("GOOG0004") || acpi_dev_found("GOOG000C");
 }
 
 /*
@@ -718,6 +718,10 @@ static enum acpi_backlight_type __acpi_video_get_backlight_type(bool native)
 	if (apple_gmux_present())
 		return acpi_backlight_apple_gmux;
 
+	/* Chromebooks should always prefer native backlight control. */
+	if (google_cros_ec_present() && native_available)
+		return acpi_backlight_native;
+
 	/* On systems with ACPI video use either native or ACPI video. */
 	if (video_caps & ACPI_VIDEO_BACKLIGHT) {
 		/*
@@ -735,13 +739,6 @@ static enum acpi_backlight_type __acpi_video_get_backlight_type(bool native)
 			return acpi_backlight_video;
 	}
 
-	/*
-	 * Chromebooks that don't have backlight handle in ACPI table
-	 * are supposed to use native backlight if it's available.
-	 */
-	if (google_cros_ec_present() && native_available)
-		return acpi_backlight_native;
-
 	/* No ACPI video (old hw), use vendor specific fw methods. */
 	return acpi_backlight_vendor;
 }
Signature · 1 line
2.37.3
#2 lore raw

PATCH 2/3 ACPI: video: Make acpi_video_backlight_use_native() always return true

In reply to Hans de Goede

Testing has shown that there are quite a few laptop models which rely on native backlight control and which do not support ACPI video bus backlight control, causing __acpi_video_get_backlight_type() to return vendor. Known Windows laptop models affected by this are:

Acer Aspire 1640
HP Compaq nc6120
IBM ThinkPad X40
System76 Starling Star1

and the following MacBook models are affected too:

Apple MacBook 2.1
Apple MacBook 4.1
Apple MacBook Pro 7.1

the list of affected Windows laptop models is likely just the top of the iceberg. So for now lets undo the change to not register native backlight class devices when __acpi_video_get_backlight_type() != native.

Since as part of the backlight-detect refactor the detection code now relies on the GPU drivers calling acpi_video_backlight_use_native() to learn that native backlight support is available we cannot just remove the acpi_video_backlight_use_native() calls from the GPU drivers.

Instead modify acpi_video_backlight_use_native() to always return true for now. This is meant as a temporary work-around, which will be removed again when the heuristics from __acpi_video_get_backlight_type() have been improved so that they will return native on affected models.

---
 drivers/acpi/video_detect.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/acpi/video_detect.c +13 -1
index 06aaec2e378b..c02e960cdbe3 100644
@@ -751,6 +751,18 @@ EXPORT_SYMBOL(acpi_video_get_backlight_type);
 
 bool acpi_video_backlight_use_native(void)
 {
-	return __acpi_video_get_backlight_type(true) == acpi_backlight_native;
+	/*
+	 * Call __acpi_video_get_backlight_type() to let it know that
+	 * a native backlight is available.
+	 */
+	__acpi_video_get_backlight_type(true);
+
+	/*
+	 * For now just always return true. There is a whole bunch of laptop
+	 * models where (video_caps & ACPI_VIDEO_BACKLIGHT) is false causing
+	 * __acpi_video_get_backlight_type() to return vendor, while these
+	 * models only have a native backlight control.
+	 */
+	return true;
 }
 EXPORT_SYMBOL(acpi_video_backlight_use_native);
Signature · 1 line
2.37.3
#3 lore raw

PATCH 3/3 ACPI: video: Add backlight=native DMI quirk for Dell G15 5515

In reply to Hans de Goede

The Dell G15 5515 has the WMI interface (and WMI call returns) expected by the nvidia-wmi-ec-backlight interface. But the backlight class device registered by the nvidia-wmi-ec-backlight driver does not actually work.

The amdgpu_bl0 native GPU backlight class device does actually work, add a backlight=native DMI quirk for this.

---
Changes in v2:
- Add a comment that this needs to be revisited when dynamic-mux support gets added (suggested by: Daniel Dadap)

---
 drivers/acpi/video_detect.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/acpi/video_detect.c +14 -0
index c02e960cdbe3..b2a616287638 100644
@@ -645,6 +645,20 @@ static const struct dmi_system_id video_detect_dmi_table[] = {
 		},
 	},
 
+	/*
+	 * Models which have nvidia-ec-wmi support, but should not use it.
+	 * Note this indicates a likely firmware bug on these models and should
+	 * be revisited if/when Linux gets support for dynamic mux mode.
+	 */
+	{
+	 .callback = video_detect_force_native,
+	 /* Dell G15 5515 */
+	 .matches = {
+		DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
+		DMI_MATCH(DMI_PRODUCT_NAME, "Dell G15 5515"),
+		},
+	},
+
 	/*
 	 * Desktops which falsely report a backlight and which our heuristics
 	 * for this do not catch.
Signature · 1 line
2.37.3
Reviewed-by on v1 3/3
#4 lore raw

Re: [PATCH 3/3] ACPI: video: Add backlight=native DMI quirk for Dell G15 5515

Thanks, Hans:

Quoted 9 lines · Hans de Goede

The Dell G15 5515 has the WMI interface (and WMI call returns) expected by the nvidia-wmi-ec-backlight interface. But the backlight class device registered by the nvidia-wmi-ec-backlight driver does not actually work.

The amdgpu_bl0 native GPU backlight class device does actually work, add a backlight=native DMI quirk for this.

Quoted 36 lines

---
Changes in v2:
- Add a comment that this needs to be revisited when dynamic-mux support gets added (suggested by: Daniel Dadap)

---
 drivers/acpi/video_detect.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
drivers/acpi/video_detect.c +14 -0
index c02e960cdbe3..b2a616287638 100644
@@ -645,6 +645,20 @@ static const struct dmi_system_id video_detect_dmi_table[] = {
 		},
 	},
 
+	/*
+	 * Models which have nvidia-ec-wmi support, but should not use it.
+	 * Note this indicates a likely firmware bug on these models and should
+	 * be revisited if/when Linux gets support for dynamic mux mode.
+	 */
+	{
+	 .callback = video_detect_force_native,
+	 /* Dell G15 5515 */
+	 .matches = {
+		DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
+		DMI_MATCH(DMI_PRODUCT_NAME, "Dell G15 5515"),
+		},
+	},
+
 	/*
 	 * Desktops which falsely report a backlight and which our heuristics
 	 * for this do not catch.
Signature · 1 line
2.37.3
maintainer Acked-by on the v1 series
#5 lore raw
In reply to Hans de Goede
Quoted 6 lines · Hans de Goede

Hi Rafael,

Here is a series of patches to fix known (and likely also unknown) regressions caused by the backlight-detect refactor landing in 6.1.

Quoted 6 lines

This builds on top of the earlier Chromebook fix which went upstream through platform-drivers-x86.git/fixes. as such I believe it would be best for this series to go upstream through the pdx86 tree.

Can you please give your Ack for merging this through the pdx86 git tree?

Sure, feel free to add

to these patches.

Also note that I'm going to drop the previously applied

https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git/commit/?h=bleeding-edge&id=6a377205da554cec45c8fd1cd8395030b448de31

from my tree.

Thanks!

#6 lore raw

Hi,

Quoted 11 lines · Rafael J. Wysocki
Quoted 10 lines · Hans de Goede

Hi Rafael,

Here is a series of patches to fix known (and likely also unknown) regressions caused by the backlight-detect refactor landing in 6.1.

This builds on top of the earlier Chromebook fix which went upstream through platform-drivers-x86.git/fixes. as such I believe it would be best for this series to go upstream through the pdx86 tree.

Quoted 8 lines
Quoted 2 lines

Can you please give your Ack for merging this through the pdx86 git tree?

Sure, feel free to add

to these patches.

Thanks, I'll go and prepare a fixes pull-req for Linus with these patches.

Quoted 3 lines

Also note that I'm going to drop the previously applied

https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git/commit/?h=bleeding-edge&id=6a377205da554cec45c8fd1cd8395030b448de31

Ack, thanks.

Regards,

Hans