summaryrefslogtreecommitdiff
path: root/dtt/lm81.c
diff options
context:
space:
mode:
authorHeiko Schocher <hs@pollux.denx.de>2007-01-14 13:35:31 +0100
committerHeiko Schocher <hs@pollux.denx.de>2007-01-14 13:35:31 +0100
commita443d31410c571ee8f970da819a44d698fdd6b1f (patch)
treebe48d52398af25cbfab47bb3fbab912dac60d410 /dtt/lm81.c
parent6dedf3d49dd14c3bf541c8ecee7ffaac5f0e1d6c (diff)
downloadu-boot-imx-a443d31410c571ee8f970da819a44d698fdd6b1f.zip
u-boot-imx-a443d31410c571ee8f970da819a44d698fdd6b1f.tar.gz
u-boot-imx-a443d31410c571ee8f970da819a44d698fdd6b1f.tar.bz2
[FIX] correct I2C Writes for the LM81 Sensor.
Signed-off-by: Heiko Schocher <hs@denx.de>
Diffstat (limited to 'dtt/lm81.c')
-rw-r--r--dtt/lm81.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/dtt/lm81.c b/dtt/lm81.c
index 2c225f1..c83a3cd 100644
--- a/dtt/lm81.c
+++ b/dtt/lm81.c
@@ -80,7 +80,7 @@ int dtt_write(int sensor, int reg, int val)
/*
* Write value to register.
*/
- if (i2c_write(sensor, reg, 1, data, 1) != 0)
+ if (i2c_write(sensor, reg, 1, &data, 1) != 0)
return 1;
return 0;
@@ -88,6 +88,7 @@ int dtt_write(int sensor, int reg, int val)
#define DTT_MANU 0x3e
#define DTT_REV 0x3f
+#define DTT_CONFIG 0x40
#define DTT_ADR 0x48
static int _dtt_init(int sensor)
@@ -98,6 +99,8 @@ static int _dtt_init(int sensor)
if (dtt_write (sensor, DTT_CONFIG, 0x01) < 0)
return 1;
+ /* The LM81 needs 400ms to get the correct values ... */
+ udelay (400000);
man = dtt_read (sensor, DTT_MANU);
if (man != 0x01)
return 1;
@@ -109,8 +112,6 @@ static int _dtt_init(int sensor)
return 1;
printf ("DTT: Found LM81@%x Rev: %d\n", adr, rev);
- /* The LM81 needs 400ms to get the correct values ... */
- udelay (400000);
return 0;
} /* _dtt_init() */