Skip to contentSkip to conversation

ideapad-laptop: Use intel_backlight only on Lenovo B470e

PATCH In review Edward Lin 4 participants 5 messages Aug 18, 2014 – Jan 27, 2015 x86 platform drivers

lore
Share & tools
lore

Edward Lin

author
#0 lore raw

PATCH 1/1 ideapad-laptop: Use intel_backlight only on Lenovo B470e

ACPI video is not functional on Lenovo B470e. The brightness control is also broken with vendor mode. The brightness control only works with intel_backlight.

So, blacklist this machine for unregistering ACPI video driver and not using vendor backlight driver.

---
 drivers/platform/x86/ideapad-laptop.c |   28 +++++++++++++++++++++++++---
 1 file changed, 25 insertions(+), 3 deletions(-)
drivers/platform/x86/ideapad-laptop.c +25 -3
index fc468a3..6ee7c20 100644
@@ -38,6 +38,7 @@
 #include <linux/i8042.h>
 #include <linux/dmi.h>
 #include <linux/device.h>
+#include <acpi/video.h>
 
 #define IDEAPAD_RFKILL_DEV_NUM	(3)
 
@@ -89,6 +90,7 @@ struct ideapad_private {
 	unsigned long cfg;
 	bool has_hw_rfkill_switch;
 	bool has_touchpad_control;
+	bool has_broken_backlight;
 };
 
 static bool no_bt_rfkill;
@@ -866,6 +868,17 @@ static struct dmi_system_id no_touchpad_ctrl_list[] = {
 	{}
 };
 
+static struct dmi_system_id broken_backlight_list[] = {
+	{
+	 .ident = "Lenovo B470e",
+	 .matches = {
+		DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
+		DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo B470e"),
+		},
+	},
+	{},
+};
+
 static int ideapad_acpi_add(struct platform_device *pdev)
 {
 	int ret, i;
@@ -890,6 +903,7 @@ static int ideapad_acpi_add(struct platform_device *pdev)
 	priv->platform_device = pdev;
 	priv->has_hw_rfkill_switch = !dmi_check_system(no_hw_rfkill_list);
 	priv->has_touchpad_control = !dmi_check_system(no_touchpad_ctrl_list);
+	priv->has_broken_backlight = dmi_check_system(broken_backlight_list);
 
 	ret = ideapad_sysfs_init(priv);
 	if (ret)
@@ -917,10 +931,18 @@ static int ideapad_acpi_add(struct platform_device *pdev)
 	ideapad_sync_rfk_state(priv);
 	ideapad_sync_touchpad_state(priv);
 
+	if (priv->has_broken_backlight)
+		acpi_video_dmi_promote_vendor();
+
 	if (!acpi_video_backlight_support()) {
-		ret = ideapad_backlight_init(priv);
-		if (ret && ret != -ENODEV)
-			goto backlight_failed;
+		pr_info("Disabling ACPI video driver\n");
+		acpi_video_unregister();
+
+		if (!priv->has_broken_backlight) {
+			ret = ideapad_backlight_init(priv);
+			if (ret && ret != -ENODEV)
+				goto backlight_failed;
+		}
 	}
 	ret = acpi_install_notify_handler(adev->handle,
 		ACPI_DEVICE_NOTIFY, ideapad_acpi_notify, priv);
Signature · 1 line
1.7.9.5
#1 lore raw

Hi Edward Lin,

Am 18.08.2014 um 08:09 schrieb Edward Lin:

Quoted 3 lines

ACPI video is not functional on Lenovo B470e. The brightness control is also broken with vendor mode. The brightness control only works with intel_backlight.

By looking at your description (and your patch) I'm wondering how exactly this problem made itself apparent? I'm having a similar (the same?) issue with my Sony Vaio VPCS12C5E. The backlight interface registered by ACPI does not work and I have to boot with the command line option "acpi_backlight=vendor". Even then two interfaces get registered "nv_backlight" and "sony", only one of which (nv_backlight) works.

Desktop environments (GNOME in particular) seem to be confused by this, so I always have to change the brightness by writing directly into the "actual_brightness" file. I've reported this back in 2012 [1], but was told that it is an ACPI issue and so it never was fixed.

Couldn't a similar patch be applied to the sony-laptop module? I've added Mattia Dongili to the discussion, hopefully he doesn't mind to take a look at this again. I'm glad to test any patches, but am not familiar enough with all of the internal structs to mess around with them for myself without breaking support for other users of this module, especially since my model was shipped with in two different versions:
One with the internal Intel GPU and another with a dedicated Nvidia GPU. I'm afraid a simple DMI match might not be good enough in this case?

Best regards,
Karol Babioch

[1]: http://www.spinics.net/lists/platform-driver-x86/msg03406.html

author
#2 lore raw

Hi Karol Babioch,

Quoted 8 lines · Karol Babioch

By looking at your description (and your patch) I'm wondering how exactly this problem made itself apparent? I'm having a similar (the same?) issue with my Sony Vaio VPCS12C5E. The backlight interface registered by ACPI does not work and I have to boot with the command line option "acpi_backlight=vendor". Even then two interfaces get registered "nv_backlight" and "sony", only one of which (nv_backlight) works.

My situation is that the brightness control on Lenovo B470e is broken on Ubuntu 12.04.5 but 12.04.2. Neither "acpi_backlight=vendor " nor "video.use_native_backlight=1" works for the brightness control.

After bisecting, the regression happens in 3.10-rc1.

Before 3.10-rc1, acpi/video.c fails to register backlight interface due to acpi_video_device_lcd_set_level() returns -EINVAL in acpi_video_init_brightness().
Only "intel_backlight" is registered under /sys/class/backlight. So the brightness can be adjusted from UI.

In 3.10-rc1, some changes make acpi/video.c able to register backlight for Lenovo B470e. "acpi_video0" is used as the default backlight interface.

There is no BIOS update since 2012. And the vendor is unlikely to fix this bug. So I propose the patch for fixing the brightness control on Lenovo B470e.

Quoted 5 lines

Desktop environments (GNOME in particular) seem to be confused by this, so I always have to change the brightness by writing directly into the "actual_brightness" file. I've reported this back in 2012 [1], but was told that it is an ACPI issue and so it never was fixed.

Similar situation on Toshiba T130-15T
https://bugzilla.kernel.org/show_bug.cgi?id=50551

Quoted 9 lines

Couldn't a similar patch be applied to the sony-laptop module? I've added Mattia Dongili to the discussion, hopefully he doesn't mind to take a look at this again. I'm glad to test any patches, but am not familiar enough with all of the internal structs to mess around with them for myself without breaking support for other users of this module, especially since my model was shipped with in two different versions:
One with the internal Intel GPU and another with a dedicated Nvidia GPU. I'm afraid a simple DMI match might not be good enough in this case?

You may use dmidecode to see if there is any extra information which can differentiate between these two versions.

Regards,
Edward Lin

#3 lore raw

Hi all,

I'm wondering are there any concerns that prevent this patch from entering the upstream?

Best regards,
AceLan Kao.

2014-08-22 14:18 GMT+08:00 Yidi Lin <[email protected]>:

Quoted 58 lines

Hi Karol Babioch,

Quoted 8 lines · Karol Babioch

By looking at your description (and your patch) I'm wondering how exactly this problem made itself apparent? I'm having a similar (the same?) issue with my Sony Vaio VPCS12C5E. The backlight interface registered by ACPI does not work and I have to boot with the command line option "acpi_backlight=vendor". Even then two interfaces get registered "nv_backlight" and "sony", only one of which (nv_backlight) works.

My situation is that the brightness control on Lenovo B470e is broken on Ubuntu 12.04.5 but 12.04.2. Neither "acpi_backlight=vendor " nor "video.use_native_backlight=1" works for the brightness control.

After bisecting, the regression happens in 3.10-rc1.

Before 3.10-rc1, acpi/video.c fails to register backlight interface due to acpi_video_device_lcd_set_level() returns -EINVAL in acpi_video_init_brightness().
Only "intel_backlight" is registered under /sys/class/backlight. So the brightness can be adjusted from UI.

In 3.10-rc1, some changes make acpi/video.c able to register backlight for Lenovo B470e. "acpi_video0" is used as the default backlight interface.

There is no BIOS update since 2012. And the vendor is unlikely to fix this bug. So I propose the patch for fixing the brightness control on Lenovo B470e.

Quoted 5 lines

Desktop environments (GNOME in particular) seem to be confused by this, so I always have to change the brightness by writing directly into the "actual_brightness" file. I've reported this back in 2012 [1], but was told that it is an ACPI issue and so it never was fixed.

Similar situation on Toshiba T130-15T
https://bugzilla.kernel.org/show_bug.cgi?id=50551

Quoted 9 lines

Couldn't a similar patch be applied to the sony-laptop module? I've added Mattia Dongili to the discussion, hopefully he doesn't mind to take a look at this again. I'm glad to test any patches, but am not familiar enough with all of the internal structs to mess around with them for myself without breaking support for other users of this module, especially since my model was shipped with in two different versions:
One with the internal Intel GPU and another with a dedicated Nvidia GPU. I'm afraid a simple DMI match might not be good enough in this case?

You may use dmidecode to see if there is any extra information which can differentiate between these two versions.

Regards,
Edward Lin
--
To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 3 lines
Chia-Lin Kao(AceLan)
http://blog.acelan.idv.tw/
E-Mail: acelan.kaoATcanonical.com (s/AT/@/)
#4 lore raw
Quoted 4 lines · AceLan Kao

Hi all,

I'm wondering are there any concerns that prevent this patch from entering the upstream?

I don't see it anywhere in my platform-driver-x86 archives. Please resend the patch with a reference to the original submission being sure to Cc the List and Maintainer as listed in the MAINTAINERS file.

Thanks,

Signature · 2 lines
Darren Hart
Intel Open Source Technology Center