239 lines
8.1 KiB
Diff
239 lines
8.1 KiB
Diff
From: Jason Stubbs <jasonbstubbs@gmail.com>
|
|
Date: Tue, 20 Sep 2011 16:16:13 +0000 (-0700)
|
|
Subject: Platform: Brightness quirk for samsung laptop driver
|
|
X-Git-Tag: v3.2-rc1~111^2~41
|
|
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=ac080523141d5bfa5f60ef2436480f645f915e9c
|
|
|
|
Platform: Brightness quirk for samsung laptop driver
|
|
|
|
On some Samsung laptops the brightness regulation works slightly different.
|
|
All SABI commands except for set_brightness work as expected. The behaviour
|
|
of set_brightness is as follows:
|
|
|
|
- Setting a new brightness will only step one level toward the new brightness
|
|
level. For example, setting a level of 5 when the current level is 2 will
|
|
result in a brightness level of 3.
|
|
- A spurious KEY_BRIGHTNESS_UP or KEY_BRIGHTNESS_DOWN event is also generated
|
|
along with the change in brightness.
|
|
- Neither of the above two issues occur when changing from/to brightness
|
|
level 0.
|
|
|
|
This patch adds detection and a non-intrusive workaround for the above issues.
|
|
|
|
Signed-off-by: Jason Stubbs <jasonbstubbs@gmail.com>
|
|
Tested-by: David Herrmann <dh.herrmann@googlemail.com>
|
|
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
|
|
Signed-off-by: Matthew Garrett <mjg@redhat.com>
|
|
---
|
|
|
|
diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c
|
|
index 4d3bed4..6474e42 100644
|
|
--- a/drivers/platform/x86/samsung-laptop.c
|
|
+++ b/drivers/platform/x86/samsung-laptop.c
|
|
@@ -226,6 +226,7 @@ static struct backlight_device *backlight_device;
|
|
static struct mutex sabi_mutex;
|
|
static struct platform_device *sdev;
|
|
static struct rfkill *rfk;
|
|
+static bool has_stepping_quirk;
|
|
|
|
static int force;
|
|
module_param(force, bool, 0);
|
|
@@ -382,6 +383,17 @@ static void set_brightness(u8 user_brightness)
|
|
{
|
|
u8 user_level = user_brightness + sabi_config->min_brightness;
|
|
|
|
+ if (has_stepping_quirk && user_level != 0) {
|
|
+ /*
|
|
+ * short circuit if the specified level is what's already set
|
|
+ * to prevent the screen from flickering needlessly
|
|
+ */
|
|
+ if (user_brightness == read_brightness())
|
|
+ return;
|
|
+
|
|
+ sabi_set_command(sabi_config->commands.set_brightness, 0);
|
|
+ }
|
|
+
|
|
sabi_set_command(sabi_config->commands.set_brightness, user_level);
|
|
}
|
|
|
|
@@ -390,6 +402,34 @@ static int get_brightness(struct backlight_device *bd)
|
|
return (int)read_brightness();
|
|
}
|
|
|
|
+static void check_for_stepping_quirk(void)
|
|
+{
|
|
+ u8 initial_level = read_brightness();
|
|
+ u8 check_level;
|
|
+
|
|
+ /*
|
|
+ * Some laptops exhibit the strange behaviour of stepping toward
|
|
+ * (rather than setting) the brightness except when changing to/from
|
|
+ * brightness level 0. This behaviour is checked for here and worked
|
|
+ * around in set_brightness.
|
|
+ */
|
|
+
|
|
+ if (initial_level <= 2)
|
|
+ check_level = initial_level + 2;
|
|
+ else
|
|
+ check_level = initial_level - 2;
|
|
+
|
|
+ has_stepping_quirk = false;
|
|
+ set_brightness(check_level);
|
|
+
|
|
+ if (read_brightness() != check_level) {
|
|
+ has_stepping_quirk = true;
|
|
+ pr_info("enabled workaround for brightness stepping quirk\n");
|
|
+ }
|
|
+
|
|
+ set_brightness(initial_level);
|
|
+}
|
|
+
|
|
static int update_status(struct backlight_device *bd)
|
|
{
|
|
set_brightness(bd->props.brightness);
|
|
@@ -805,6 +845,9 @@ static int __init samsung_init(void)
|
|
}
|
|
}
|
|
|
|
+ /* Check for stepping quirk */
|
|
+ check_for_stepping_quirk();
|
|
+
|
|
/* knock up a platform device to hang stuff off of */
|
|
sdev = platform_device_register_simple("samsung", -1, NULL, 0);
|
|
if (IS_ERR(sdev))
|
|
From: Jason Stubbs <jasonbstubbs@gmail.com>
|
|
Date: Tue, 20 Sep 2011 16:16:14 +0000 (-0700)
|
|
Subject: Platform: Samsung laptop DMI info for NC210/NC110
|
|
X-Git-Tag: v3.2-rc1~111^2~40
|
|
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=7b3c257ce4267e004a7c7e68c05d1eb70da8c972
|
|
|
|
Platform: Samsung laptop DMI info for NC210/NC110
|
|
|
|
This patch just adds the DMI info for the samsung laptop driver to work with
|
|
the NC210/NC110. It needs the brightness quirk patch for proper support.
|
|
|
|
Signed-off-by: Jason Stubbs <jasonbstubbs@gmail.com>
|
|
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
|
|
Signed-off-by: Matthew Garrett <mjg@redhat.com>
|
|
---
|
|
|
|
diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c
|
|
index 6474e42..8ffab50 100644
|
|
--- a/drivers/platform/x86/samsung-laptop.c
|
|
+++ b/drivers/platform/x86/samsung-laptop.c
|
|
@@ -737,6 +737,15 @@ static struct dmi_system_id __initdata samsung_dmi_table[] = {
|
|
},
|
|
.callback = dmi_check_cb,
|
|
},
|
|
+ {
|
|
+ .ident = "NC210/NC110",
|
|
+ .matches = {
|
|
+ DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
|
|
+ DMI_MATCH(DMI_PRODUCT_NAME, "NC210/NC110"),
|
|
+ DMI_MATCH(DMI_BOARD_NAME, "NC210/NC110"),
|
|
+ },
|
|
+ .callback = dmi_check_cb,
|
|
+ },
|
|
{ },
|
|
};
|
|
MODULE_DEVICE_TABLE(dmi, samsung_dmi_table);
|
|
From: Raul Gutierrez Segales <rgs@collabora.co.uk>
|
|
Date: Tue, 20 Sep 2011 16:16:15 +0000 (-0700)
|
|
Subject: Platform: fix samsung-laptop DMI identification for N220 model
|
|
X-Git-Tag: v3.2-rc1~111^2~39
|
|
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=f689c875c13c9d62b3c4de09cd5dad66549f700d
|
|
|
|
Platform: fix samsung-laptop DMI identification for N220 model
|
|
|
|
This is a follow-up for commit 78a7539b, which didn't cover the
|
|
Samsung N220 laptop. With this backlight brightness works nicely
|
|
on the N220 netbook.
|
|
|
|
Signed-off-by: Raul Gutierrez Segales <rgs@collabora.co.uk>
|
|
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
|
|
Signed-off-by: Matthew Garrett <mjg@redhat.com>
|
|
---
|
|
|
|
diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c
|
|
index 8ffab50..1e436eb 100644
|
|
--- a/drivers/platform/x86/samsung-laptop.c
|
|
+++ b/drivers/platform/x86/samsung-laptop.c
|
|
@@ -663,6 +663,16 @@ static struct dmi_system_id __initdata samsung_dmi_table[] = {
|
|
.callback = dmi_check_cb,
|
|
},
|
|
{
|
|
+ .ident = "N220",
|
|
+ .matches = {
|
|
+ DMI_MATCH(DMI_SYS_VENDOR,
|
|
+ "SAMSUNG ELECTRONICS CO., LTD."),
|
|
+ DMI_MATCH(DMI_PRODUCT_NAME, "N220"),
|
|
+ DMI_MATCH(DMI_BOARD_NAME, "N220"),
|
|
+ },
|
|
+ .callback = dmi_check_cb,
|
|
+ },
|
|
+ {
|
|
.ident = "N150/N210/N220/N230",
|
|
.matches = {
|
|
DMI_MATCH(DMI_SYS_VENDOR,
|
|
From: John Serock <john.serock@gmail.com>
|
|
Date: Thu, 13 Oct 2011 10:42:01 +0000 (-0400)
|
|
Subject: Platform: Detect samsung laptop quirk when initial level is zero
|
|
X-Git-Tag: v3.2-rc1~111^2~29
|
|
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=ba05b237372bad82533d1f717569d1d817ff3c27
|
|
|
|
Platform: Detect samsung laptop quirk when initial level is zero
|
|
|
|
This patch depends on the "Platform: Brightness quirk for samsung
|
|
laptop driver" patch from Jason Stubbs. This patch adds a check for an
|
|
initial brightness level of 0; if the level is 0, this patch changes
|
|
the brightness level to 1 before the driver attempts to detect the
|
|
brightness quirk.
|
|
|
|
The Samsung N150 netbook experiences the brightness quirk. Without
|
|
Jason's patch, the only brightness levels available on the N150 are 0,
|
|
1, and 8. This patch ensures that, when the initial brightness level
|
|
is 0, the samsang-laptop driver detects the brightness quirk on the
|
|
N150, thereby making brightness levels 0 through 8 available.
|
|
|
|
Signed-off-by: John Serock <john.serock@gmail.com>
|
|
Acked-by: Jason Stubbs <jasonbstubbs@gmail.com>
|
|
Signed-off-by: Matthew Garrett <mjg@redhat.com>
|
|
---
|
|
|
|
diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c
|
|
index 1e436eb..31ddd57 100644
|
|
--- a/drivers/platform/x86/samsung-laptop.c
|
|
+++ b/drivers/platform/x86/samsung-laptop.c
|
|
@@ -404,8 +404,9 @@ static int get_brightness(struct backlight_device *bd)
|
|
|
|
static void check_for_stepping_quirk(void)
|
|
{
|
|
- u8 initial_level = read_brightness();
|
|
+ u8 initial_level;
|
|
u8 check_level;
|
|
+ u8 orig_level = read_brightness();
|
|
|
|
/*
|
|
* Some laptops exhibit the strange behaviour of stepping toward
|
|
@@ -414,6 +415,11 @@ static void check_for_stepping_quirk(void)
|
|
* around in set_brightness.
|
|
*/
|
|
|
|
+ if (orig_level == 0)
|
|
+ set_brightness(1);
|
|
+
|
|
+ initial_level = read_brightness();
|
|
+
|
|
if (initial_level <= 2)
|
|
check_level = initial_level + 2;
|
|
else
|
|
@@ -427,7 +433,7 @@ static void check_for_stepping_quirk(void)
|
|
pr_info("enabled workaround for brightness stepping quirk\n");
|
|
}
|
|
|
|
- set_brightness(initial_level);
|
|
+ set_brightness(orig_level);
|
|
}
|
|
|
|
static int update_status(struct backlight_device *bd)
|