Changeset 2135

Show
Ignore:
Timestamp:
12/03/03 07:06:22 (9 years ago)
Author:
mmh
Message:

Use lm75.h temp to/from reg conversions.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/kernel/chips/asb100.c

    r2056 r2135  
    5050#include "version.h" 
    5151#include "sensors_vid.h" 
     52#include "lm75.h" 
    5253 
    5354/* I2C addresses to scan */ 
     
    171172{ 
    172173        return (s8)reg * 10; 
    173 } 
    174  
    175 /* These constants are a guess, consistent w/ LM75 */ 
    176 #define LM75_TEMP_MIN (-550) 
    177 #define LM75_TEMP_MAX (1250) 
    178  
    179 /* TEMP: 1/10 degrees C (-55C to 125C) 
    180    REG: (0.5C/bit, two's complement) << 7 */ 
    181 static u16 LM75_TEMP_TO_REG(int temp) 
    182 { 
    183         int ntemp = SENSORS_LIMIT(temp, LM75_TEMP_MIN, LM75_TEMP_MAX); 
    184         ntemp += (ntemp<0 ? -2 : 2); 
    185         return (u16)((ntemp / 5) << 7); 
    186 } 
    187  
    188 static int LM75_TEMP_FROM_REG(u16 reg) 
    189 { 
    190         /* use integer division instead of equivalent right shift  
    191            in order to guarantee arithmetic shift */ 
    192         return ((s16)reg / 128) * 5; 
    193174} 
    194175