5ef0eab
From: Hans de Goede <hdegoede@redhat.com>
5ef0eab
Date: Fri, 9 Jan 2015 14:51:21 +0100
5ef0eab
Subject: [PATCH] samsung-laptop: Add use_native_backlight quirk, and enable it
5ef0eab
 on some models
5ef0eab
5ef0eab
Since kernel 3.14 the backlight control has been broken on various Samsung
5ef0eab
Atom based netbooks. This has been bisected and this problem happens since
5ef0eab
commit b35684b8fa94 ("drm/i915: do full backlight setup at enable time")
5ef0eab
5ef0eab
This has been reported and discussed in detail here:
5ef0eab
http://lists.freedesktop.org/archives/intel-gfx/2014-July/049395.html
5ef0eab
5ef0eab
Unfortunately no-one has been able to fix this. This only affects Samsung
5ef0eab
Atom netbooks, and the Linux kernel and the BIOS of those laptops have never
5ef0eab
worked well together. All affected laptops already have a quirk to avoid using
5ef0eab
the standard acpi-video interface and instead use the samsung specific SABI
5ef0eab
interface which samsung-laptop uses. It seems that recent fixes to the i915
5ef0eab
driver have also broken backlight control through the SABI interface.
5ef0eab
5ef0eab
The intel_backlight driver OTOH works fine, and also allows for finer grained
5ef0eab
backlight control. So add a new use_native_backlight quirk, and replace the
5ef0eab
broken_acpi_video quirk with this quirk for affected models. This new quirk
5ef0eab
disables acpi-video as before and also stops samsung-laptop from registering
5ef0eab
the SABI based samsung_laptop backlight interface, leaving only the working
5ef0eab
intel_backlight interface.
5ef0eab
5ef0eab
This commit enables this new quirk for 3 models which are known to be affected,
5ef0eab
chances are that it needs to be used on other models too.
5ef0eab
5ef0eab
BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1094948 # N145P
5ef0eab
BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1115713 # N250P
5ef0eab
Reported-by: Bertrik Sikken <bertrik@sikken.nl> # N150P
5ef0eab
Cc: stable@vger.kernel.org # 3.16
5ef0eab
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
5ef0eab
---
5ef0eab
 drivers/platform/x86/samsung-laptop.c | 20 +++++++++++++++++---
5ef0eab
 1 file changed, 17 insertions(+), 3 deletions(-)
5ef0eab
5ef0eab
diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c
5ef0eab
index 864290243e46..477de0a9e1ee 100644
5ef0eab
--- a/drivers/platform/x86/samsung-laptop.c
5ef0eab
+++ b/drivers/platform/x86/samsung-laptop.c
5ef0eab
@@ -353,6 +353,7 @@ struct samsung_quirks {
5ef0eab
 	bool broken_acpi_video;
5ef0eab
 	bool four_kbd_backlight_levels;
5ef0eab
 	bool enable_kbd_backlight;
5ef0eab
+	bool use_native_backlight;
5ef0eab
 };
5ef0eab
 
5ef0eab
 static struct samsung_quirks samsung_unknown = {};
5ef0eab
@@ -361,6 +362,10 @@ static struct samsung_quirks samsung_broken_acpi_video = {
5ef0eab
 	.broken_acpi_video = true,
5ef0eab
 };
5ef0eab
 
5ef0eab
+static struct samsung_quirks samsung_use_native_backlight = {
5ef0eab
+	.use_native_backlight = true,
5ef0eab
+};
5ef0eab
+
5ef0eab
 static struct samsung_quirks samsung_np740u3e = {
5ef0eab
 	.four_kbd_backlight_levels = true,
5ef0eab
 	.enable_kbd_backlight = true,
5ef0eab
@@ -1507,7 +1512,7 @@ static struct dmi_system_id __initdata samsung_dmi_table[] = {
5ef0eab
 		DMI_MATCH(DMI_PRODUCT_NAME, "N150P"),
5ef0eab
 		DMI_MATCH(DMI_BOARD_NAME, "N150P"),
5ef0eab
 		},
5ef0eab
-	 .driver_data = &samsung_broken_acpi_video,
5ef0eab
+	 .driver_data = &samsung_use_native_backlight,
5ef0eab
 	},
5ef0eab
 	{
5ef0eab
 	 .callback = samsung_dmi_matched,
5ef0eab
@@ -1517,7 +1522,7 @@ static struct dmi_system_id __initdata samsung_dmi_table[] = {
5ef0eab
 		DMI_MATCH(DMI_PRODUCT_NAME, "N145P/N250P/N260P"),
5ef0eab
 		DMI_MATCH(DMI_BOARD_NAME, "N145P/N250P/N260P"),
5ef0eab
 		},
5ef0eab
-	 .driver_data = &samsung_broken_acpi_video,
5ef0eab
+	 .driver_data = &samsung_use_native_backlight,
5ef0eab
 	},
5ef0eab
 	{
5ef0eab
 	 .callback = samsung_dmi_matched,
5ef0eab
@@ -1557,7 +1562,7 @@ static struct dmi_system_id __initdata samsung_dmi_table[] = {
5ef0eab
 		DMI_MATCH(DMI_PRODUCT_NAME, "N250P"),
5ef0eab
 		DMI_MATCH(DMI_BOARD_NAME, "N250P"),
5ef0eab
 		},
5ef0eab
-	 .driver_data = &samsung_broken_acpi_video,
5ef0eab
+	 .driver_data = &samsung_use_native_backlight,
5ef0eab
 	},
5ef0eab
 	{
5ef0eab
 	 .callback = samsung_dmi_matched,
5ef0eab
@@ -1626,6 +1631,15 @@ static int __init samsung_init(void)
5ef0eab
 		pr_info("Disabling ACPI video driver\n");
5ef0eab
 		acpi_video_unregister();
5ef0eab
 	}
5ef0eab
+
5ef0eab
+	if (samsung->quirks->use_native_backlight) {
5ef0eab
+		pr_info("Using native backlight driver\n");
5ef0eab
+		/* Tell acpi-video to not handle the backlight */
5ef0eab
+		acpi_video_dmi_promote_vendor();
5ef0eab
+		acpi_video_unregister();
5ef0eab
+		/* And also do not handle it ourselves */
5ef0eab
+		samsung->handle_backlight = false;
5ef0eab
+	}
5ef0eab
 #endif
5ef0eab
 
5ef0eab
 	ret = samsung_platform_init(samsung);
5ef0eab
-- 
5ef0eab
2.1.0
5ef0eab