aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/platform/x86/eeepc-laptop.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c
index c1758ec3c61b..e87c1346e1d4 100644
--- a/drivers/platform/x86/eeepc-laptop.c
+++ b/drivers/platform/x86/eeepc-laptop.c
@@ -980,18 +980,28 @@ static struct platform_driver platform_driver = {
980#define EEEPC_EC_SFB0 0xD0 980#define EEEPC_EC_SFB0 0xD0
981#define EEEPC_EC_FAN_CTRL (EEEPC_EC_SFB0 + 3) /* Byte containing SF25 */ 981#define EEEPC_EC_FAN_CTRL (EEEPC_EC_SFB0 + 3) /* Byte containing SF25 */
982 982
983static inline int eeepc_pwm_to_lmsensors(int value)
984{
985 return value * 255 / 100;
986}
987
988static inline int eeepc_lmsensors_to_pwm(int value)
989{
990 value = clamp_val(value, 0, 255);
991 return value * 100 / 255;
992}
993
983static int eeepc_get_fan_pwm(void) 994static int eeepc_get_fan_pwm(void)
984{ 995{
985 u8 value = 0; 996 u8 value = 0;
986 997
987 ec_read(EEEPC_EC_FAN_PWM, &value); 998 ec_read(EEEPC_EC_FAN_PWM, &value);
988 return value * 255 / 100; 999 return eeepc_pwm_to_lmsensors(value);
989} 1000}
990 1001
991static void eeepc_set_fan_pwm(int value) 1002static void eeepc_set_fan_pwm(int value)
992{ 1003{
993 value = clamp_val(value, 0, 255); 1004 value = eeepc_lmsensors_to_pwm(value);
994 value = value * 100 / 255;
995 ec_write(EEEPC_EC_FAN_PWM, value); 1005 ec_write(EEEPC_EC_FAN_PWM, value);
996} 1006}
997 1007