[PATCH] platform/x86: nvidia-wmi-ec-backlight: Add force module parameter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


On models with the Nvidia WMI EC backlight interface, when the laptop is
configured in dynamic mux mode in the BIOS the backlight should always be
controlled by the Nvidia WMI EC backlight interface.

But it turns out that on some laptop models, E.g. Some Lenovo Legion models
/sys/class/backlight/nvidia_wmi_ec_backlight only works when the LCD panel
is muxed to the Nvidia GPU and when muxed to the AMD iGPU amdgpu_bl0
controls the backlight.

This appears to be a firmware bug on these laptops, but prior to 6.1.4
users would have both nvidia_wmi_ec_backlight and amdgpu_bl0 and could
work around this in userspace.

Add a force module parameter which can be used with acpi_backlight=native
to restore the old behavior as a workound (for now):

"acpi_backlight=native nvidia-wmi-ec-backlight.force=1"

Fixes: 8d0ca287fd8c ("platform/x86: nvidia-wmi-ec-backlight: Use acpi_video_get_backlight_type()")
Link: https://bugzilla.kernel.org/show_bug.cgi?id=217026
Signed-off-by: Hans de Goede <hdegoede@xxxxxxxxxx>
 drivers/platform/x86/nvidia-wmi-ec-backlight.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/nvidia-wmi-ec-backlight.c b/drivers/platform/x86/nvidia-wmi-ec-backlight.c
index baccdf658538..1b572c90c76e 100644
--- a/drivers/platform/x86/nvidia-wmi-ec-backlight.c
+++ b/drivers/platform/x86/nvidia-wmi-ec-backlight.c
@@ -12,6 +12,10 @@
 #include <linux/wmi.h>
 #include <acpi/video.h>
+static bool force;
+module_param(force, bool, 0444);
+MODULE_PARM_DESC(force, "Force loading (disable acpi_backlight=xxx checks");
  * wmi_brightness_notify() - helper function for calling WMI-wrapped ACPI method
  * @w:    Pointer to the struct wmi_device identified by %WMI_BRIGHTNESS_GUID
@@ -91,7 +95,7 @@ static int nvidia_wmi_ec_backlight_probe(struct wmi_device *wdev, const void *ct
 	int ret;
 	/* drivers/acpi/video_detect.c also checks that SOURCE == EC */
-	if (acpi_video_get_backlight_type() != acpi_backlight_nvidia_wmi_ec)
+	if (!force && acpi_video_get_backlight_type() != acpi_backlight_nvidia_wmi_ec)
 		return -ENODEV;

[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux