]>
git.ipfire.org Git - people/ms/u-boot.git/blob - drivers/hwmon/adt7460.c
3 * Ricado Ribalda-Universidad Autonoma de Madrid, ricardo.ribalda@uam.es
4 * This work has been supported by: QTechnology http://qtec.com/
5 * SPDX-License-Identifier: GPL-2.0+
12 #define ADT7460_ADDRESS 0x2c
13 #define ADT7460_INVALID 128
14 #define ADT7460_CONFIG 0x40
15 #define ADT7460_REM1_TEMP 0x25
16 #define ADT7460_LOCAL_TEMP 0x26
17 #define ADT7460_REM2_TEMP 0x27
19 int dtt_read(int sensor
, int reg
)
24 if (i2c_read(ADT7460_ADDRESS
, dir
, 1, &data
, 1) == -1)
26 if (data
== ADT7460_INVALID
)
32 int dtt_write(int sensor
, int reg
, int val
)
37 if (i2c_write(ADT7460_ADDRESS
, dir
, 1, &data
, 1) == -1)
43 int dtt_init_one(int sensor
)
45 printf("ADT7460 at I2C address 0x%2x\n", ADT7460_ADDRESS
);
47 if (dtt_write(0, ADT7460_CONFIG
, 1) == -1) {
48 puts("Error initialiting ADT7460\n");
55 int dtt_get_temp(int sensor
)
59 { ADT7460_REM1_TEMP
, ADT7460_LOCAL_TEMP
, ADT7460_REM2_TEMP
};
62 puts("DTT sensor does not exist\n");
66 aux
= dtt_read(0, table
[sensor
]);
68 puts("DTT temperature read failed\n");