* [PATCH 1/3] MAINTAINERS: Fix up entry for Dell laptop SMM driver
@ 2014-11-30 21:00 Guenter Roeck
2014-11-30 21:00 ` [PATCH 2/3] i8k: Rework error retries Guenter Roeck
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Guenter Roeck @ 2014-11-30 21:00 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: Arnd Bergmann, lm-sensors, linux-kernel, Guenter Roeck
Mark driver as maintained.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
MAINTAINERS | 1 +
1 file changed, 1 insertion(+)
diff --git a/MAINTAINERS b/MAINTAINERS
index 0ff630d..a67e223 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2918,6 +2918,7 @@ F: drivers/platform/x86/dell-laptop.c
DELL LAPTOP SMM DRIVER
M: Guenter Roeck <linux@roeck-us.net>
+S: Maintained
F: drivers/char/i8k.c
F: include/uapi/linux/i8k.h
--
1.9.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 2/3] i8k: Rework error retries 2014-11-30 21:00 [PATCH 1/3] MAINTAINERS: Fix up entry for Dell laptop SMM driver Guenter Roeck @ 2014-11-30 21:00 ` Guenter Roeck 2014-12-01 19:45 ` Pali Rohár 2014-11-30 21:00 ` [PATCH 3/3] i8k: Add support for Dell XPS 13 Guenter Roeck 2014-12-01 11:34 ` [lm-sensors] [PATCH 1/3] MAINTAINERS: Fix up entry for Dell laptop SMM driver Jean Delvare 2 siblings, 1 reply; 8+ messages in thread From: Guenter Roeck @ 2014-11-30 21:00 UTC (permalink / raw) To: Greg Kroah-Hartman Cc: Arnd Bergmann, lm-sensors, linux-kernel, Guenter Roeck, Pali Rohár Instead of returning a previous value if the SMM code returns an error when trying to read a temperature, retry once. If that fails again, return -ENODATA. Also return -ENODATA if an attempt is made to read the GPU temperature but the GPU is currently turned off. Drop the I8K_TEMPERATURE_BUG definition and handle the related bug unconditionally. Cc: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net> --- Applies on top of Pali's patch series. drivers/char/i8k.c | 47 ++++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/drivers/char/i8k.c b/drivers/char/i8k.c index 3464192..cdb2dc7 100644 --- a/drivers/char/i8k.c +++ b/drivers/char/i8k.c @@ -5,7 +5,7 @@ * * Hwmon integration: * Copyright (C) 2011 Jean Delvare <jdelvare@suse.de> - * Copyright (C) 2013 Guenter Roeck <linux@roeck-us.net> + * Copyright (C) 2013, 2014 Guenter Roeck <linux@roeck-us.net> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -20,6 +20,7 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +#include <linux/delay.h> #include <linux/module.h> #include <linux/types.h> #include <linux/init.h> @@ -59,8 +60,6 @@ #define I8K_POWER_AC 0x05 #define I8K_POWER_BATTERY 0x01 -#define I8K_TEMPERATURE_BUG 1 - static DEFINE_MUTEX(i8k_mutex); static char bios_version[4]; static struct device *i8k_hwmon_dev; @@ -300,39 +299,41 @@ static int i8k_get_temp_type(int sensor) /* * Read the cpu temperature. */ -static int i8k_get_temp(int sensor) +static int _i8k_get_temp(int sensor) { - struct smm_regs regs = { .eax = I8K_SMM_GET_TEMP, }; - int rc; - int temp; + struct smm_regs regs = { + .eax = I8K_SMM_GET_TEMP, + .ebx = sensor & 0xff, + }; -#ifdef I8K_TEMPERATURE_BUG - static int prev[4] = { I8K_MAX_TEMP+1, I8K_MAX_TEMP+1, I8K_MAX_TEMP+1, I8K_MAX_TEMP+1 }; -#endif - regs.ebx = sensor & 0xff; - rc = i8k_smm(®s); - if (rc < 0) - return rc; + return i8k_smm(®s) ? : regs.eax & 0xff; +} - temp = regs.eax & 0xff; +static int i8k_get_temp(int sensor) +{ + int temp = _i8k_get_temp(sensor); -#ifdef I8K_TEMPERATURE_BUG /* * Sometimes the temperature sensor returns 0x99, which is out of range. - * In this case we return (once) the previous cached value. For example: + * In this case we retry (once) before returning an error. # 1003655137 00000058 00005a4b # 1003655138 00000099 00003a80 <--- 0x99 = 153 degrees # 1003655139 00000054 00005c52 */ - if (temp > I8K_MAX_TEMP) { - temp = prev[sensor]; - prev[sensor] = I8K_MAX_TEMP+1; - } else { - prev[sensor] = temp; + if (temp == 0x99) { + msleep(100); + temp = _i8k_get_temp(sensor); } + /* + * Return -ENODATA for all invalid temperatures. + * + * Known instances are the 0x99 value as seen above as well as + * 0xc1 (193), which may be returned when trying to read the GPU + * temperature if the system supports a GPU and it is currently + * turned off. + */ if (temp > I8K_MAX_TEMP) return -ENODATA; -#endif return temp; } -- 1.9.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3] i8k: Rework error retries 2014-11-30 21:00 ` [PATCH 2/3] i8k: Rework error retries Guenter Roeck @ 2014-12-01 19:45 ` Pali Rohár 2014-12-01 20:15 ` Guenter Roeck 0 siblings, 1 reply; 8+ messages in thread From: Pali Rohár @ 2014-12-01 19:45 UTC (permalink / raw) To: Guenter Roeck; +Cc: Greg Kroah-Hartman, Arnd Bergmann, lm-sensors, linux-kernel [-- Attachment #1: Type: Text/Plain, Size: 855 bytes --] On Sunday 30 November 2014 22:00:39 Guenter Roeck wrote: > Instead of returning a previous value if the SMM code returns > an error when trying to read a temperature, retry once. > If that fails again, return -ENODATA. Also return -ENODATA if > an attempt is made to read the GPU temperature but the GPU is > currently turned off. > > Drop the I8K_TEMPERATURE_BUG definition and handle the related > bug unconditionally. > > Cc: Pali Rohár <pali.rohar@gmail.com> > Signed-off-by: Guenter Roeck <linux@roeck-us.net> > --- > Applies on top of Pali's patch series. > > drivers/char/i8k.c | 47 > ++++++++++++++++++++++++----------------------- 1 file > changed, 24 insertions(+), 23 deletions(-) > Working fine GPU temp (turned on or off). Tested-by: Pali Rohár <pali.rohar@gmail.com> -- Pali Rohár pali.rohar@gmail.com [-- Attachment #2: This is a digitally signed message part. --] [-- Type: application/pgp-signature, Size: 198 bytes --] ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3] i8k: Rework error retries 2014-12-01 19:45 ` Pali Rohár @ 2014-12-01 20:15 ` Guenter Roeck 0 siblings, 0 replies; 8+ messages in thread From: Guenter Roeck @ 2014-12-01 20:15 UTC (permalink / raw) To: Pali Rohár Cc: Greg Kroah-Hartman, Arnd Bergmann, lm-sensors, linux-kernel On Mon, Dec 01, 2014 at 08:45:59PM +0100, Pali Rohár wrote: > On Sunday 30 November 2014 22:00:39 Guenter Roeck wrote: > > Instead of returning a previous value if the SMM code returns > > an error when trying to read a temperature, retry once. > > If that fails again, return -ENODATA. Also return -ENODATA if > > an attempt is made to read the GPU temperature but the GPU is > > currently turned off. > > > > Drop the I8K_TEMPERATURE_BUG definition and handle the related > > bug unconditionally. > > > > Cc: Pali Rohár <pali.rohar@gmail.com> > > Signed-off-by: Guenter Roeck <linux@roeck-us.net> > > --- > > Applies on top of Pali's patch series. > > > > drivers/char/i8k.c | 47 > > ++++++++++++++++++++++++----------------------- 1 file > > changed, 24 insertions(+), 23 deletions(-) > > > > Working fine GPU temp (turned on or off). > > Tested-by: Pali Rohár <pali.rohar@gmail.com> > Thanks a lot for testing! Guenter ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 3/3] i8k: Add support for Dell XPS 13 2014-11-30 21:00 [PATCH 1/3] MAINTAINERS: Fix up entry for Dell laptop SMM driver Guenter Roeck 2014-11-30 21:00 ` [PATCH 2/3] i8k: Rework error retries Guenter Roeck @ 2014-11-30 21:00 ` Guenter Roeck 2014-12-01 12:36 ` [lm-sensors] " Jean Delvare 2014-12-01 11:34 ` [lm-sensors] [PATCH 1/3] MAINTAINERS: Fix up entry for Dell laptop SMM driver Jean Delvare 2 siblings, 1 reply; 8+ messages in thread From: Guenter Roeck @ 2014-11-30 21:00 UTC (permalink / raw) To: Greg Kroah-Hartman Cc: Arnd Bergmann, lm-sensors, linux-kernel, Guenter Roeck, Pali Rohár XPS 13 does not support turbo speed, so its initialization data matches that of XPS M140. Make XPS initialization data generic, and add support for XPS 13. Cc: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net> --- Applies on top of Pali's patch series. drivers/char/i8k.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/char/i8k.c b/drivers/char/i8k.c index cdb2dc7..6d2caa9 100644 --- a/drivers/char/i8k.c +++ b/drivers/char/i8k.c @@ -705,7 +705,7 @@ enum i8k_configs { DELL_LATITUDE_E6540, DELL_PRECISION_490, DELL_STUDIO, - DELL_XPS_M140, + DELL_XPS, }; static const struct i8k_config_data i8k_config_data[] = { @@ -725,7 +725,7 @@ static const struct i8k_config_data i8k_config_data[] = { .fan_mult = 1, .fan_max = I8K_FAN_HIGH, }, - [DELL_XPS_M140] = { + [DELL_XPS] = { .fan_mult = 1, .fan_max = I8K_FAN_HIGH, }, @@ -829,12 +829,20 @@ static struct dmi_system_id i8k_dmi_table[] __initdata = { .driver_data = (void *)&i8k_config_data[DELL_STUDIO], }, { + .ident = "Dell XPS 13", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "XPS13"), + }, + .driver_data = (void *)&i8k_config_data[DELL_XPS], + }, + { .ident = "Dell XPS M140", .matches = { DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), DMI_MATCH(DMI_PRODUCT_NAME, "MXC051"), }, - .driver_data = (void *)&i8k_config_data[DELL_XPS_M140], + .driver_data = (void *)&i8k_config_data[DELL_XPS], }, { } }; -- 1.9.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [lm-sensors] [PATCH 3/3] i8k: Add support for Dell XPS 13 2014-11-30 21:00 ` [PATCH 3/3] i8k: Add support for Dell XPS 13 Guenter Roeck @ 2014-12-01 12:36 ` Jean Delvare 2014-12-01 16:22 ` Guenter Roeck 0 siblings, 1 reply; 8+ messages in thread From: Jean Delvare @ 2014-12-01 12:36 UTC (permalink / raw) To: Guenter Roeck Cc: Greg Kroah-Hartman, Pali Rohár, linux-kernel, Arnd Bergmann, lm-sensors On Sun, 30 Nov 2014 13:00:40 -0800, Guenter Roeck wrote: > XPS 13 does not support turbo speed, so its initialization data > matches that of XPS M140. Make XPS initialization data generic, > and add support for XPS 13. > > Cc: Pali Rohár <pali.rohar@gmail.com> > Signed-off-by: Guenter Roeck <linux@roeck-us.net> > --- > Applies on top of Pali's patch series. > > drivers/char/i8k.c | 14 +++++++++++--- > 1 file changed, 11 insertions(+), 3 deletions(-) > > diff --git a/drivers/char/i8k.c b/drivers/char/i8k.c > index cdb2dc7..6d2caa9 100644 > --- a/drivers/char/i8k.c > +++ b/drivers/char/i8k.c > @@ -705,7 +705,7 @@ enum i8k_configs { > DELL_LATITUDE_E6540, > DELL_PRECISION_490, > DELL_STUDIO, > - DELL_XPS_M140, > + DELL_XPS, > }; > > static const struct i8k_config_data i8k_config_data[] = { > @@ -725,7 +725,7 @@ static const struct i8k_config_data i8k_config_data[] = { > .fan_mult = 1, > .fan_max = I8K_FAN_HIGH, > }, > - [DELL_XPS_M140] = { > + [DELL_XPS] = { > .fan_mult = 1, > .fan_max = I8K_FAN_HIGH, > }, > @@ -829,12 +829,20 @@ static struct dmi_system_id i8k_dmi_table[] __initdata = { > .driver_data = (void *)&i8k_config_data[DELL_STUDIO], > }, > { > + .ident = "Dell XPS 13", > + .matches = { > + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), > + DMI_MATCH(DMI_PRODUCT_NAME, "XPS13"), > + }, > + .driver_data = (void *)&i8k_config_data[DELL_XPS], > + }, > + { > .ident = "Dell XPS M140", > .matches = { > DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), > DMI_MATCH(DMI_PRODUCT_NAME, "MXC051"), > }, > - .driver_data = (void *)&i8k_config_data[DELL_XPS_M140], > + .driver_data = (void *)&i8k_config_data[DELL_XPS], > }, > { } > }; Looks reasonable. Reviewed-by: Jean Delvare <jdelvare@suse.de> -- Jean Delvare SUSE L3 Support ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [lm-sensors] [PATCH 3/3] i8k: Add support for Dell XPS 13 2014-12-01 12:36 ` [lm-sensors] " Jean Delvare @ 2014-12-01 16:22 ` Guenter Roeck 0 siblings, 0 replies; 8+ messages in thread From: Guenter Roeck @ 2014-12-01 16:22 UTC (permalink / raw) To: Jean Delvare Cc: Greg Kroah-Hartman, Pali Rohár, linux-kernel, Arnd Bergmann, lm-sensors On Mon, Dec 01, 2014 at 01:36:45PM +0100, Jean Delvare wrote: > On Sun, 30 Nov 2014 13:00:40 -0800, Guenter Roeck wrote: > > XPS 13 does not support turbo speed, so its initialization data > > matches that of XPS M140. Make XPS initialization data generic, > > and add support for XPS 13. > > > > Cc: Pali Rohár <pali.rohar@gmail.com> > > Signed-off-by: Guenter Roeck <linux@roeck-us.net> > > --- [ ... ] > > Looks reasonable. > > Reviewed-by: Jean Delvare <jdelvare@suse.de> > Thanks a lot for the reviews! Guenter ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [lm-sensors] [PATCH 1/3] MAINTAINERS: Fix up entry for Dell laptop SMM driver 2014-11-30 21:00 [PATCH 1/3] MAINTAINERS: Fix up entry for Dell laptop SMM driver Guenter Roeck 2014-11-30 21:00 ` [PATCH 2/3] i8k: Rework error retries Guenter Roeck 2014-11-30 21:00 ` [PATCH 3/3] i8k: Add support for Dell XPS 13 Guenter Roeck @ 2014-12-01 11:34 ` Jean Delvare 2 siblings, 0 replies; 8+ messages in thread From: Jean Delvare @ 2014-12-01 11:34 UTC (permalink / raw) To: Guenter Roeck; +Cc: Greg Kroah-Hartman, linux-kernel, Arnd Bergmann, lm-sensors On Sun, 30 Nov 2014 13:00:38 -0800, Guenter Roeck wrote: > Mark driver as maintained. > > Signed-off-by: Guenter Roeck <linux@roeck-us.net> > --- > MAINTAINERS | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/MAINTAINERS b/MAINTAINERS > index 0ff630d..a67e223 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -2918,6 +2918,7 @@ F: drivers/platform/x86/dell-laptop.c > > DELL LAPTOP SMM DRIVER > M: Guenter Roeck <linux@roeck-us.net> > +S: Maintained > F: drivers/char/i8k.c > F: include/uapi/linux/i8k.h > Reviewed-by: Jean Delvare <jdelvare@suse.de> -- Jean Delvare SUSE L3 Support ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-12-01 20:17 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-11-30 21:00 [PATCH 1/3] MAINTAINERS: Fix up entry for Dell laptop SMM driver Guenter Roeck 2014-11-30 21:00 ` [PATCH 2/3] i8k: Rework error retries Guenter Roeck 2014-12-01 19:45 ` Pali Rohár 2014-12-01 20:15 ` Guenter Roeck 2014-11-30 21:00 ` [PATCH 3/3] i8k: Add support for Dell XPS 13 Guenter Roeck 2014-12-01 12:36 ` [lm-sensors] " Jean Delvare 2014-12-01 16:22 ` Guenter Roeck 2014-12-01 11:34 ` [lm-sensors] [PATCH 1/3] MAINTAINERS: Fix up entry for Dell laptop SMM driver Jean Delvare
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox