Patchwork [1/1,Oneiric,SRU] Platform: Detect samsung laptop quirk when initial level is zero

login
register
mail settings
Submitter Seth Forshee
Date Dec. 2, 2011, 9:17 p.m.
Message ID <1322860644-8536-2-git-send-email-seth.forshee@canonical.com>
Download mbox | patch
Permalink /patch/128982/
State New
Headers show

Comments

Seth Forshee - Dec. 2, 2011, 9:17 p.m.
From: John Serock <john.serock@gmail.com>

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>

(cherry picked from commit ba05b237372bad82533d1f717569d1d817ff3c27)
BugLink: http://bugs.launchpad.net/bugs/810093
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
---
 drivers/platform/x86/samsung-laptop.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
Tim Gardner - Dec. 2, 2011, 9:23 p.m.
On 12/02/2011 02:17 PM, Seth Forshee wrote:
> From: John Serock<john.serock@gmail.com>
>
> 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>
>
> (cherry picked from commit ba05b237372bad82533d1f717569d1d817ff3c27)
> BugLink: http://bugs.launchpad.net/bugs/810093
> Signed-off-by: Seth Forshee<seth.forshee@canonical.com>
> ---
>   drivers/platform/x86/samsung-laptop.c |   10 ++++++++--
>   1 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c
> index c32dc39..e553486 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)
Herton Ronaldo Krzesinski - Dec. 2, 2011, 10:03 p.m.
On Fri, Dec 02, 2011 at 03:17:24PM -0600, Seth Forshee wrote:
> From: John Serock <john.serock@gmail.com>
> 
> 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>
> 
> (cherry picked from commit ba05b237372bad82533d1f717569d1d817ff3c27)
> BugLink: http://bugs.launchpad.net/bugs/810093
> Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
> ---
>  drivers/platform/x86/samsung-laptop.c |   10 ++++++++--
>  1 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c
> index c32dc39..e553486 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();
> +

He could have avoid calling read_brightness() twice in the case of
orig_level !=0, minor/harmless thing anyway...

Acked-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>

>  	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)
> -- 
> 1.7.5.4
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
>

Patch

diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c
index c32dc39..e553486 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)