mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-11-12 16:50:15 +00:00
Use lm75.h temp to/from reg conversions.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@2135 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
1 parent
1b58fb19d9
commit
87738febe9
1 file changed
+1
-20
+1
-20
@@ -49,6 +49,7 @@
|
||||
#include <asm/io.h>
|
||||
#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)
|
||||
|
||||
Reference in new issue
Block a user