Remove CFG_EEPROM_PAGE* dependencies for temperature sensors
[platform/kernel/u-boot.git] / drivers / hwmon / lm75.c
index e29b294..6770cdd 100644 (file)
  */
 
 #include <common.h>
-
-#ifdef CONFIG_DTT_LM75
-#if !defined(CFG_EEPROM_PAGE_WRITE_ENABLE) || \
-       (CFG_EEPROM_PAGE_WRITE_BITS < 1)
-# error "CFG_EEPROM_PAGE_WRITE_ENABLE must be defined and CFG_EEPROM_PAGE_WRITE_BITS must be greater than  1 to use CONFIG_DTT_LM75"
-#endif
-
 #include <i2c.h>
 #include <dtt.h>
 
-
 /*
  * Device code
  */
+#if defined(CFG_I2C_DTT_ADDR)
+#define DTT_I2C_DEV_CODE CFG_I2C_DTT_ADDR
+#else
 #define DTT_I2C_DEV_CODE 0x48                  /* ON Semi's LM75 device */
+#endif
+#define DTT_READ_TEMP          0x0
+#define DTT_CONFIG             0x1
+#define DTT_TEMP_HYST          0x2
+#define DTT_TEMP_SET           0x3
 
 int dtt_read(int sensor, int reg)
 {
     int dlen;
     uchar data[2];
 
+#ifdef CONFIG_DTT_AD7414
+    /*
+     * On AD7414 the first value upon bootup is not read correctly.
+     * This is most likely because of the 800ms update time of the
+     * temp register in normal update mode. To get current values
+     * each time we issue the "dtt" command including upon powerup
+     * we switch into one-short mode.
+     *
+     * Issue one-shot mode command
+     */
+    dtt_write(sensor, DTT_CONFIG, 0x64);
+#endif
+
     /*
      * Validate 'reg' param
      */
@@ -187,5 +200,3 @@ int dtt_get_temp(int sensor)
     }
     return (int)((int16_t) ret / 256);
 } /* dtt_get_temp() */
-
-#endif /* CONFIG_DTT_LM75 */