[kernel/f15] Add patch from LKML to fix Samsung notebook brightness flicker (rhbz 737108)

Chuck Ebbert cebbert at fedoraproject.org
Tue Oct 25 02:40:30 UTC 2011


commit 5d467e53f1ec1ebb822dcc62583b82524745b187
Author: Chuck Ebbert <cebbert at redhat.com>
Date:   Mon Oct 24 22:40:46 2011 -0400

    Add patch from LKML to fix Samsung notebook brightness flicker (rhbz 737108)

 kernel.spec                                        |    9 +++
 ...x-samsung-brightness-min-max-calculations.patch |   56 ++++++++++++++++++++
 2 files changed, 65 insertions(+), 0 deletions(-)
---
diff --git a/kernel.spec b/kernel.spec
index 48efc6a..589acc3 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -720,6 +720,9 @@ Patch21019: fuse-fix-memory-leak.patch
 Patch21020: 0001-mm-vmscan-Limit-direct-reclaim-for-higher-order-allo.patch
 Patch21021: 0002-mm-Abort-reclaim-compaction-if-compaction-can-procee.patch
 
+#rhbz 737108
+Patch21030: platform-fix-samsung-brightness-min-max-calculations.patch
+
 %endif
 
 BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root
@@ -1309,6 +1312,9 @@ ApplyPatch fuse-fix-memory-leak.patch
 ApplyPatch 0001-mm-vmscan-Limit-direct-reclaim-for-higher-order-allo.patch
 ApplyPatch 0002-mm-Abort-reclaim-compaction-if-compaction-can-procee.patch
 
+#rhbz 737108
+ApplyPatch platform-fix-samsung-brightness-min-max-calculations.patch
+
 # END OF PATCH APPLICATIONS
 
 %endif
@@ -1929,6 +1935,9 @@ fi
 # and build.
 
 %changelog
+* Mon Oct 24 2011 Chuck Ebbert <cebbert at redhat.com>
+- Add patch from LKML to fix Samsung notebook brightness flicker (rhbz 737108)
+
 * Mon Oct 24 2011 Dave Jones <davej at redhat.com>
 - Print modules list from bad_page()
 
diff --git a/platform-fix-samsung-brightness-min-max-calculations.patch b/platform-fix-samsung-brightness-min-max-calculations.patch
new file mode 100644
index 0000000..6a2c3b8
--- /dev/null
+++ b/platform-fix-samsung-brightness-min-max-calculations.patch
@@ -0,0 +1,56 @@
+From: Jason Stubbs <jasonbstubbs at gmail.com>
+Subject: [PATCH] platform: fix samsung brightness min/max calculations
+
+For one of the SABI configs, the valid brightness levels are 1 through 8 with
+0 being reserved for the BIOS. To make the range 0-based, the driver is meant
+to offset values to/from userspace by 1 giving valid levels of 0 through 7.
+
+Currently, the driver is reporting a max brightness of 8 and doing the offset
+the wrong way such that setting a brightness of 8 will set as 7 in hardware
+while setting a brightness of 0 will attempt (and fail) to set as -1 in
+hardware.
+
+This patch fixes these calculations as well as a potential miscalculation due
+to an assumption of min_brightness being either 0 or 1.
+
+Signed-off-by: Jason Stubbs <jasonbstubbs at gmail.com>
+Signed-off-by: Chuck Ebbert <cebbert at redhat.com>
+
+---
+Originally posted here, context fixed to apply to 3.0/3.1:
+[ https://lkml.org/lkml/2011/5/11/548 ]
+
+diff a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c
+--- a/drivers/platform/x86/samsung-laptop.c
++++ b/drivers/platform/x86/samsung-laptop.c
+@@ -370,15 +370,17 @@ static u8 read_brightness(void)
+ 				  &sretval);
+ 	if (!retval) {
+ 		user_brightness = sretval.retval[0];
+-		if (user_brightness != 0)
++		if (user_brightness > sabi_config->min_brightness)
+ 			user_brightness -= sabi_config->min_brightness;
++		else
++			user_brightness = 0;
+ 	}
+ 	return user_brightness;
+ }
+ 
+ static void set_brightness(u8 user_brightness)
+ {
+-	u8 user_level = user_brightness - sabi_config->min_brightness;
++	u8 user_level = user_brightness + sabi_config->min_brightness;
+ 
+ 	sabi_set_command(sabi_config->commands.set_brightness, user_level);
+ }
+@@ -802,7 +804,8 @@ static int __init samsung_init(void)
+ 	/* create a backlight device to talk to this one */
+ 	memset(&props, 0, sizeof(struct backlight_properties));
+ 	props.type = BACKLIGHT_PLATFORM;
+-	props.max_brightness = sabi_config->max_brightness;
++	props.max_brightness = sabi_config->max_brightness -
++				sabi_config->min_brightness;
+ 	backlight_device = backlight_device_register("samsung", &sdev->dev,
+ 						     NULL, &backlight_ops,
+ 						     &props);
+_


More information about the scm-commits mailing list