Samsung Laptop driver patches
Subsystems (2)
cover Samsung Laptop driver patches
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
PATCH 1/8 platform: samsung_laptop: add dmi information for Samsung R700 laptops
My DMI model is this:
Quoted 1 line
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.
--- drivers/platform/x86/samsung-laptop.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/platform/x86/samsung-laptop.c +9 -0
@@ -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."),
PATCH 2/8 Platform: samsung_laptop: add support for X520 machines.
In reply to [email protected]From: Tommaso Massimi <[email protected]>
my samsung laptop would be very happy if you add these lines to the file drivers/platform/x86/samsung-laptop.c
--- drivers/platform/x86/samsung-laptop.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/platform/x86/samsung-laptop.c +9 -0
@@ -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);
PATCH 3/8 Platform: samsung_laptop: samsung backlight for R528/R728
In reply to [email protected]patch works for me, but I need to add "acpi_backlight=vendor" to kernel params
--- drivers/platform/x86/samsung-laptop.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/platform/x86/samsung-laptop.c +9 -0
@@ -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);
PATCH 4/8 platform: samsung_laptop: fix samsung brightness min/max calculations
In reply to [email protected]From: Jason Stubbs <[email protected]>
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.
--- drivers/platform/x86/samsung-laptop.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/platform/x86/samsung-laptop.c +6 -3
@@ -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);
PATCH 5/8 Platform: Fix error path in samsung-laptop init
In reply to [email protected]samsung_init() should not return success if not all devices are initialized. Otherwise, samsung_exit() will dereference sdev NULL pointers and others.
--- drivers/platform/x86/samsung-laptop.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/platform/x86/samsung-laptop.c +1 -2
@@ -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:
Re: [patch 5/8] Platform: Fix error path in samsung-laptop init
Hi Greg
Quoted 28 lines · On Fri, Sep 2, 2011 at 12:50 AM, <[email protected]> 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 <[email protected]>Cc stable <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>---
drivers/platform/x86/samsung-laptop.c | 3 +--1 file changed, 1 insertion(+), 2 deletions(-)drivers/platform/x86/samsung-laptop.c +1
-2@@ -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;
Quoted 4 lines
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
Re: [patch 5/8] Platform: Fix error path in samsung-laptop init
Quoted 31 lines · David Herrmann
Hi Greg
Quoted 28 lines · On Fri, Sep 2, 2011 at 12:50 AM, <[email protected]> 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 <[email protected]>Cc stable <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>---
drivers/platform/x86/samsung-laptop.c | 3 +--1 file changed, 1 insertion(+), 2 deletions(-)drivers/platform/x86/samsung-laptop.c +1
-2@@ -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;
Quoted 9 lines
Quoted 4 lines
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
PATCH 6/8 Platform: Brightness quirk for samsung laptop driver
In reply to [email protected]From: Jason Stubbs <[email protected]>
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.
--- drivers/platform/x86/samsung-laptop.c | 43 ++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+)
drivers/platform/x86/samsung-laptop.c +43 -0
@@ -226,6 +226,7 @@ static struct backlight_device *backlighstatic 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 backligreturn (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))
PATCH 7/8 Platform: Samsung laptop DMI info for NC210/NC110
In reply to [email protected]From: Jason Stubbs <[email protected]>
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.
--- drivers/platform/x86/samsung-laptop.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/platform/x86/samsung-laptop.c +9 -0
@@ -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);
PATCH 8/8 Platform: fix samsung-laptop DMI identification for N220 model
In reply to [email protected]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.
--- drivers/platform/x86/samsung-laptop.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/platform/x86/samsung-laptop.c +10 -0
@@ -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,