diff --git a/kernel/chips/asb100.c b/kernel/chips/asb100.c index 623b5a49..0d349819 100644 --- a/kernel/chips/asb100.c +++ b/kernel/chips/asb100.c @@ -49,6 +49,7 @@ #include #include "version.h" #include "sensors_vid.h" +#include "lm75.h" /* I2C addresses to scan */ static unsigned short normal_i2c[] = { SENSORS_I2C_END }; @@ -172,26 +173,6 @@ static int TEMP_FROM_REG(u8 reg) return (s8)reg * 10; } -/* These constants are a guess, consistent w/ LM75 */ -#define LM75_TEMP_MIN (-550) -#define LM75_TEMP_MAX (1250) - -/* TEMP: 1/10 degrees C (-55C to 125C) - REG: (0.5C/bit, two's complement) << 7 */ -static u16 LM75_TEMP_TO_REG(int temp) -{ - int ntemp = SENSORS_LIMIT(temp, LM75_TEMP_MIN, LM75_TEMP_MAX); - ntemp += (ntemp<0 ? -2 : 2); - return (u16)((ntemp / 5) << 7); -} - -static int LM75_TEMP_FROM_REG(u16 reg) -{ - /* use integer division instead of equivalent right shift - in order to guarantee arithmetic shift */ - return ((s16)reg / 128) * 5; -} - /* PWM: 0 - 255 per sensors documentation REG: (6.25% duty cycle per bit) */ static u8 ASB100_PWM_TO_REG(int pwm)