All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch 1/8] platform: samsung_laptop: add dmi information for Samsung R700 laptops
  2011-09-01 22:54 [patch 0/8] Samsung Laptop driver patches gregkh
@ 2011-09-01 22:50 ` gregkh
  2011-09-01 22:50 ` [patch 2/8] Platform: samsung_laptop: add support for X520 machines gregkh
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: gregkh @ 2011-09-01 22:50 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: platform-driver-x86, linux-kernel, greg, Stefan Beller, stable

My DMI model is this:
>dmesg |grep DMI
[    0.000000] DMI present.
[    0.000000] DMI: SAMSUNG ELECTRONICS CO., LTD. SR700/SR700, BIOS
04SR 02/20/2008

adding dmi information of Samsung R700 laptops
This adds the dmi information of Samsungs R700 laptops.

Signed-off-by: Stefan Beller <stefanbeller@googlemail.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 drivers/platform/x86/samsung-laptop.c |    9 +++++++++
 1 file changed, 9 insertions(+)

--- a/drivers/platform/x86/samsung-laptop.c
+++ b/drivers/platform/x86/samsung-laptop.c
@@ -641,6 +641,15 @@ static struct dmi_system_id __initdata s
 		.callback = dmi_check_cb,
 	},
 	{
+		.ident = "R700",
+		.matches = {
+		      DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
+		      DMI_MATCH(DMI_PRODUCT_NAME, "SR700"),
+		      DMI_MATCH(DMI_BOARD_NAME, "SR700"),
+		},
+		.callback = dmi_check_cb,
+	},
+	{
 		.ident = "R530/R730",
 		.matches = {
 		      DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),



^ permalink raw reply	[flat|nested] 12+ messages in thread

* [patch 2/8] Platform: samsung_laptop: add support for X520 machines.
  2011-09-01 22:54 [patch 0/8] Samsung Laptop driver patches gregkh
  2011-09-01 22:50 ` [patch 1/8] platform: samsung_laptop: add dmi information for Samsung R700 laptops gregkh
@ 2011-09-01 22:50 ` gregkh
  2011-09-01 22:50 ` [patch 3/8] Platform: samsung_laptop: samsung backlight for R528/R728 gregkh
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: gregkh @ 2011-09-01 22:50 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: platform-driver-x86, linux-kernel, greg, stable

From: Tommaso Massimi <tmassimi@gmail.com>

my samsung laptop would be very happy if you add
these lines to the file drivers/platform/x86/samsung-laptop.c

Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 drivers/platform/x86/samsung-laptop.c |    9 +++++++++
 1 file changed, 9 insertions(+)

--- a/drivers/platform/x86/samsung-laptop.c
+++ b/drivers/platform/x86/samsung-laptop.c
@@ -695,6 +695,15 @@ static struct dmi_system_id __initdata s
 		},
 		.callback = dmi_check_cb,
 	},
+		{
+		.ident = "X520",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "X520"),
+			DMI_MATCH(DMI_BOARD_NAME, "X520"),
+		},
+		.callback = dmi_check_cb,
+	},
 	{ },
 };
 MODULE_DEVICE_TABLE(dmi, samsung_dmi_table);



^ permalink raw reply	[flat|nested] 12+ messages in thread

* [patch 3/8] Platform: samsung_laptop: samsung backlight for R528/R728
  2011-09-01 22:54 [patch 0/8] Samsung Laptop driver patches gregkh
  2011-09-01 22:50 ` [patch 1/8] platform: samsung_laptop: add dmi information for Samsung R700 laptops gregkh
  2011-09-01 22:50 ` [patch 2/8] Platform: samsung_laptop: add support for X520 machines gregkh
@ 2011-09-01 22:50 ` gregkh
  2011-09-01 22:50 ` [patch 4/8] platform: samsung_laptop: fix samsung brightness min/max calculations gregkh
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: gregkh @ 2011-09-01 22:50 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: platform-driver-x86, linux-kernel, greg, Smelov Andrey, stable


patch works for me, but I need to add "acpi_backlight=vendor" to kernel
params

Signed-off-by: Smelov Andrey <xor29a@bk.ru>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


---
 drivers/platform/x86/samsung-laptop.c |    9 +++++++++
 1 file changed, 9 insertions(+)

--- a/drivers/platform/x86/samsung-laptop.c
+++ b/drivers/platform/x86/samsung-laptop.c
@@ -704,6 +704,15 @@ static struct dmi_system_id __initdata s
 		},
 		.callback = dmi_check_cb,
 	},
+	{
+		.ident = "R528/R728",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "R528/R728"),
+			DMI_MATCH(DMI_BOARD_NAME, "R528/R728"),
+		},
+		.callback = dmi_check_cb,
+	},
 	{ },
 };
 MODULE_DEVICE_TABLE(dmi, samsung_dmi_table);



^ permalink raw reply	[flat|nested] 12+ messages in thread

* [patch 4/8] platform: samsung_laptop: fix samsung brightness min/max calculations
  2011-09-01 22:54 [patch 0/8] Samsung Laptop driver patches gregkh
                   ` (2 preceding siblings ...)
  2011-09-01 22:50 ` [patch 3/8] Platform: samsung_laptop: samsung backlight for R528/R728 gregkh
@ 2011-09-01 22:50 ` gregkh
  2011-09-01 22:50 ` [patch 5/8] Platform: Fix error path in samsung-laptop init gregkh
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: gregkh @ 2011-09-01 22:50 UTC (permalink / raw)
  To: Matthew Garrett, Greg KH
  Cc: platform-driver-x86, linux-kernel, Jason Stubbs, stable

From: Jason Stubbs <jasonbstubbs@gmail.com>

The min_brightness value of the sabi_config is incorrectly used in brightness
calculations. For the config where min_brightness = 1 and max_brightness = 8,
the user visible range should be 0 to 7 with hardware being set in the range
of 1 to 8. What is actually happening is that the user visible range is 0 to
8 with hardware being set in the range of -1 to 7.

This patch fixes the above issue as well as a miscalculation that would occur
in the case of min_brightness > 1.

Signed-off-by: Jason Stubbs <jasonbstubbs@gmail.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 drivers/platform/x86/samsung-laptop.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

--- 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);
 }
@@ -829,7 +831,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);



^ permalink raw reply	[flat|nested] 12+ messages in thread

* [patch 5/8] Platform: Fix error path in samsung-laptop init
  2011-09-01 22:54 [patch 0/8] Samsung Laptop driver patches gregkh
                   ` (3 preceding siblings ...)
  2011-09-01 22:50 ` [patch 4/8] platform: samsung_laptop: fix samsung brightness min/max calculations gregkh
@ 2011-09-01 22:50 ` gregkh
  2011-09-20 12:21   ` David Herrmann
  2011-09-01 22:50 ` [patch 6/8] Platform: Brightness quirk for samsung laptop driver gregkh
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 12+ messages in thread
From: gregkh @ 2011-09-01 22:50 UTC (permalink / raw)
  To: Matthew Garrett, platform-driver-x86
  Cc: linux-kernel, greg, David Herrmann, stable

samsung_init() should not return success if not all devices are initialized.
Otherwise, samsung_exit() will dereference sdev NULL pointers and others.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/platform/x86/samsung-laptop.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/drivers/platform/x86/samsung-laptop.c
+++ b/drivers/platform/x86/samsung-laptop.c
@@ -799,7 +799,7 @@ static int __init samsung_init(void)
 	sabi_iface = ioremap_nocache(ifaceP, 16);
 	if (!sabi_iface) {
 		pr_err("Can't remap %x\n", ifaceP);
-		goto exit;
+		goto error_no_signature;
 	}
 	if (debug) {
 		printk(KERN_DEBUG "ifaceP = 0x%08x\n", ifaceP);
@@ -851,7 +851,6 @@ static int __init samsung_init(void)
 	if (retval)
 		goto error_file_create;
 
-exit:
 	return 0;
 
 error_file_create:



^ permalink raw reply	[flat|nested] 12+ messages in thread

* [patch 6/8] Platform: Brightness quirk for samsung laptop driver
  2011-09-01 22:54 [patch 0/8] Samsung Laptop driver patches gregkh
                   ` (4 preceding siblings ...)
  2011-09-01 22:50 ` [patch 5/8] Platform: Fix error path in samsung-laptop init gregkh
@ 2011-09-01 22:50 ` gregkh
  2011-09-01 22:50 ` [patch 7/8] Platform: Samsung laptop DMI info for NC210/NC110 gregkh
  2011-09-01 22:50 ` [patch 8/8] Platform: fix samsung-laptop DMI identification for N220 model gregkh
  7 siblings, 0 replies; 12+ messages in thread
From: gregkh @ 2011-09-01 22:50 UTC (permalink / raw)
  To: Matthew Garrett, Greg KH
  Cc: platform-driver-x86, linux-kernel, David Herrmann, Jason Stubbs

From: Jason Stubbs <jasonbstubbs@gmail.com>

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>

---
 drivers/platform/x86/samsung-laptop.c |   43 ++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

--- a/drivers/platform/x86/samsung-laptop.c
+++ b/drivers/platform/x86/samsung-laptop.c
@@ -226,6 +226,7 @@ static struct backlight_device *backligh
 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_brigh
 {
 	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 backlig
 	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);
@@ -823,6 +863,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))



^ permalink raw reply	[flat|nested] 12+ messages in thread

* [patch 7/8] Platform: Samsung laptop DMI info for NC210/NC110
  2011-09-01 22:54 [patch 0/8] Samsung Laptop driver patches gregkh
                   ` (5 preceding siblings ...)
  2011-09-01 22:50 ` [patch 6/8] Platform: Brightness quirk for samsung laptop driver gregkh
@ 2011-09-01 22:50 ` gregkh
  2011-09-01 22:50 ` [patch 8/8] Platform: fix samsung-laptop DMI identification for N220 model gregkh
  7 siblings, 0 replies; 12+ messages in thread
From: gregkh @ 2011-09-01 22:50 UTC (permalink / raw)
  To: Matthew Garrett, Greg KH
  Cc: platform-driver-x86, linux-kernel, David Herrmann, Jason Stubbs

From: Jason Stubbs <jasonbstubbs@gmail.com>

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>

---
 drivers/platform/x86/samsung-laptop.c |    9 +++++++++
 1 file changed, 9 insertions(+)

--- a/drivers/platform/x86/samsung-laptop.c
+++ b/drivers/platform/x86/samsung-laptop.c
@@ -755,6 +755,15 @@ static struct dmi_system_id __initdata s
 		},
 		.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);



^ permalink raw reply	[flat|nested] 12+ messages in thread

* [patch 8/8] Platform: fix samsung-laptop DMI identification for N220 model
  2011-09-01 22:54 [patch 0/8] Samsung Laptop driver patches gregkh
                   ` (6 preceding siblings ...)
  2011-09-01 22:50 ` [patch 7/8] Platform: Samsung laptop DMI info for NC210/NC110 gregkh
@ 2011-09-01 22:50 ` gregkh
  7 siblings, 0 replies; 12+ messages in thread
From: gregkh @ 2011-09-01 22:50 UTC (permalink / raw)
  To: Matthew Garrett
  Cc: platform-driver-x86, linux-kernel, greg, Raul Gutierrez Segales

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>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 drivers/platform/x86/samsung-laptop.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

--- a/drivers/platform/x86/samsung-laptop.c
+++ b/drivers/platform/x86/samsung-laptop.c
@@ -663,6 +663,16 @@ static struct dmi_system_id __initdata s
 		.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,



^ permalink raw reply	[flat|nested] 12+ messages in thread

* [patch 0/8] Samsung Laptop driver patches
@ 2011-09-01 22:54 gregkh
  2011-09-01 22:50 ` [patch 1/8] platform: samsung_laptop: add dmi information for Samsung R700 laptops gregkh
                   ` (7 more replies)
  0 siblings, 8 replies; 12+ messages in thread
From: gregkh @ 2011-09-01 22:54 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: platform-driver-x86, linux-kernel, greg

Hi Matthew,

Sorry for holding on to these for so long, but here are 8 patches for
the samsung-laptop driver.  The patches are against Linus's current
tree, but should apply just fine to linux-next as well.

If there are any problems with them, please let me know.

Oh, and if anyone wants to take over maintainership of this driver,
please let me know.  I no longer have the hardware to be able to test
any changes for it, which is why this took so long to get pushed out to
you.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [patch 5/8] Platform: Fix error path in samsung-laptop init
  2011-09-01 22:50 ` [patch 5/8] Platform: Fix error path in samsung-laptop init gregkh
@ 2011-09-20 12:21   ` David Herrmann
  2011-09-20 16:15     ` Greg KH
  0 siblings, 1 reply; 12+ messages in thread
From: David Herrmann @ 2011-09-20 12:21 UTC (permalink / raw)
  To: gregkh; +Cc: Matthew Garrett, platform-driver-x86, linux-kernel, greg, stable

Hi Greg

On Fri, Sep 2, 2011 at 12:50 AM,  <gregkh@suse.de> wrote:
> samsung_init() should not return success if not all devices are initialized.
> Otherwise, samsung_exit() will dereference sdev NULL pointers and others.
>
> Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
> Cc: stable <stable@kernel.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
> ---
>  drivers/platform/x86/samsung-laptop.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> --- a/drivers/platform/x86/samsung-laptop.c
> +++ b/drivers/platform/x86/samsung-laptop.c
> @@ -799,7 +799,7 @@ static int __init samsung_init(void)
>        sabi_iface = ioremap_nocache(ifaceP, 16);
>        if (!sabi_iface) {
>                pr_err("Can't remap %x\n", ifaceP);
> -               goto exit;
> +               goto error_no_signature;
>        }
>        if (debug) {
>                printk(KERN_DEBUG "ifaceP = 0x%08x\n", ifaceP);
> @@ -851,7 +851,6 @@ static int __init samsung_init(void)
>        if (retval)
>                goto error_file_create;
>
> -exit:
>        return 0;
>
>  error_file_create:
>
>
>

"From: " line is missing in this patch and several others of this
series. "git am" applies them with an email only so Matthew needs to
fix them when applying them or you could just resend them with
git-format-patch?

Thanks and regards
David

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [patch 5/8] Platform: Fix error path in samsung-laptop init
  2011-09-20 12:21   ` David Herrmann
@ 2011-09-20 16:15     ` Greg KH
  0 siblings, 0 replies; 12+ messages in thread
From: Greg KH @ 2011-09-20 16:15 UTC (permalink / raw)
  To: David Herrmann
  Cc: gregkh, Matthew Garrett, platform-driver-x86, linux-kernel, stable

On Tue, Sep 20, 2011 at 02:21:54PM +0200, David Herrmann wrote:
> Hi Greg
> 
> On Fri, Sep 2, 2011 at 12:50 AM,  <gregkh@suse.de> wrote:
> > samsung_init() should not return success if not all devices are initialized.
> > Otherwise, samsung_exit() will dereference sdev NULL pointers and others.
> >
> > Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
> > Cc: stable <stable@kernel.org>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
> > ---
> >  drivers/platform/x86/samsung-laptop.c |    3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > --- a/drivers/platform/x86/samsung-laptop.c
> > +++ b/drivers/platform/x86/samsung-laptop.c
> > @@ -799,7 +799,7 @@ static int __init samsung_init(void)
> >        sabi_iface = ioremap_nocache(ifaceP, 16);
> >        if (!sabi_iface) {
> >                pr_err("Can't remap %x\n", ifaceP);
> > -               goto exit;
> > +               goto error_no_signature;
> >        }
> >        if (debug) {
> >                printk(KERN_DEBUG "ifaceP = 0x%08x\n", ifaceP);
> > @@ -851,7 +851,6 @@ static int __init samsung_init(void)
> >        if (retval)
> >                goto error_file_create;
> >
> > -exit:
> >        return 0;
> >
> >  error_file_create:
> >
> >
> >
> 
> "From: " line is missing in this patch and several others of this
> series. "git am" applies them with an email only so Matthew needs to
> fix them when applying them or you could just resend them with
> git-format-patch?

Crap I messed this up again, my mistake.  I'll go fix this up right now.
The original patch is correct, 'quilt mail' is the one that drops the
proper "From:" authorship on these messages when sending them out, which
is what I am using here.

I'll resend right now.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [patch 4/8] platform: samsung_laptop: fix samsung brightness min/max calculations
  2011-09-20 16:17 [patch 0/8] Samsung Laptop driver patches - resend Greg KH
@ 2011-09-20 16:16 ` Greg KH
  0 siblings, 0 replies; 12+ messages in thread
From: Greg KH @ 2011-09-20 16:16 UTC (permalink / raw)
  To: Matthew Garrett, Greg KH
  Cc: platform-driver-x86, linux-kernel, Jason Stubbs, stable

From: Jason Stubbs <jasonbstubbs@gmail.com>

The min_brightness value of the sabi_config is incorrectly used in brightness
calculations. For the config where min_brightness = 1 and max_brightness = 8,
the user visible range should be 0 to 7 with hardware being set in the range
of 1 to 8. What is actually happening is that the user visible range is 0 to
8 with hardware being set in the range of -1 to 7.

This patch fixes the above issue as well as a miscalculation that would occur
in the case of min_brightness > 1.

Signed-off-by: Jason Stubbs <jasonbstubbs@gmail.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 drivers/platform/x86/samsung-laptop.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

--- 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);
 }
@@ -829,7 +831,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);



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2011-09-20 16:22 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-01 22:54 [patch 0/8] Samsung Laptop driver patches gregkh
2011-09-01 22:50 ` [patch 1/8] platform: samsung_laptop: add dmi information for Samsung R700 laptops gregkh
2011-09-01 22:50 ` [patch 2/8] Platform: samsung_laptop: add support for X520 machines gregkh
2011-09-01 22:50 ` [patch 3/8] Platform: samsung_laptop: samsung backlight for R528/R728 gregkh
2011-09-01 22:50 ` [patch 4/8] platform: samsung_laptop: fix samsung brightness min/max calculations gregkh
2011-09-01 22:50 ` [patch 5/8] Platform: Fix error path in samsung-laptop init gregkh
2011-09-20 12:21   ` David Herrmann
2011-09-20 16:15     ` Greg KH
2011-09-01 22:50 ` [patch 6/8] Platform: Brightness quirk for samsung laptop driver gregkh
2011-09-01 22:50 ` [patch 7/8] Platform: Samsung laptop DMI info for NC210/NC110 gregkh
2011-09-01 22:50 ` [patch 8/8] Platform: fix samsung-laptop DMI identification for N220 model gregkh
2011-09-20 16:17 [patch 0/8] Samsung Laptop driver patches - resend Greg KH
2011-09-20 16:16 ` [patch 4/8] platform: samsung_laptop: fix samsung brightness min/max calculations Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.