summaryrefslogtreecommitdiff
path: root/driver/temp_sensor
diff options
context:
space:
mode:
Diffstat (limited to 'driver/temp_sensor')
-rw-r--r--driver/temp_sensor/adt7481.c6
-rw-r--r--driver/temp_sensor/adt7481.h2
-rw-r--r--driver/temp_sensor/bd99992gw.c6
-rw-r--r--driver/temp_sensor/bd99992gw.h2
-rw-r--r--driver/temp_sensor/f75303.c3
-rw-r--r--driver/temp_sensor/f75303.h2
-rw-r--r--driver/temp_sensor/g78x.c6
-rw-r--r--driver/temp_sensor/g78x.h2
-rw-r--r--driver/temp_sensor/sb_tsi.c3
-rw-r--r--driver/temp_sensor/sb_tsi.h2
-rw-r--r--driver/temp_sensor/tmp006.c32
-rw-r--r--driver/temp_sensor/tmp006.h10
-rw-r--r--driver/temp_sensor/tmp112.c6
-rw-r--r--driver/temp_sensor/tmp112.h2
-rw-r--r--driver/temp_sensor/tmp411.h2
-rw-r--r--driver/temp_sensor/tmp432.c6
-rw-r--r--driver/temp_sensor/tmp432.h2
-rw-r--r--driver/temp_sensor/tmp468.c6
-rw-r--r--driver/temp_sensor/tmp468.h2
19 files changed, 62 insertions, 40 deletions
diff --git a/driver/temp_sensor/adt7481.c b/driver/temp_sensor/adt7481.c
index 22d7cc5f9a..c724e958e1 100644
--- a/driver/temp_sensor/adt7481.c
+++ b/driver/temp_sensor/adt7481.c
@@ -34,12 +34,14 @@ static int has_power(void)
static int raw_read8(const int offset, int *data_ptr)
{
- return i2c_read8(I2C_PORT_THERMAL, ADT7481_I2C_ADDR, offset, data_ptr);
+ return i2c_read8__7bf(I2C_PORT_THERMAL, ADT7481_I2C_ADDR__7bf,
+ offset, data_ptr);
}
static int raw_write8(const int offset, int data)
{
- return i2c_write8(I2C_PORT_THERMAL, ADT7481_I2C_ADDR, offset, data);
+ return i2c_write8__7bf(I2C_PORT_THERMAL, ADT7481_I2C_ADDR__7bf,
+ offset, data);
}
static int get_temp(const int offset, int *temp_ptr)
diff --git a/driver/temp_sensor/adt7481.h b/driver/temp_sensor/adt7481.h
index 45da88560e..17f3c20056 100644
--- a/driver/temp_sensor/adt7481.h
+++ b/driver/temp_sensor/adt7481.h
@@ -8,7 +8,7 @@
#ifndef __CROS_EC_ADT7481_H
#define __CROS_EC_ADT7481_H
-#define ADT7481_I2C_ADDR 0x96 /* 7-bit address is 0x4B */
+#define ADT7481_I2C_ADDR__7bf 0x4B
#define ADT7481_IDX_LOCAL 0
#define ADT7481_IDX_REMOTE1 1
diff --git a/driver/temp_sensor/bd99992gw.c b/driver/temp_sensor/bd99992gw.c
index 291ce32479..9ccbde6d8e 100644
--- a/driver/temp_sensor/bd99992gw.c
+++ b/driver/temp_sensor/bd99992gw.c
@@ -39,7 +39,8 @@ static enum bd99992gw_adc_channel
static int raw_read8(const int offset, int *data_ptr)
{
int ret;
- ret = i2c_read8(I2C_PORT_THERMAL, BD99992GW_I2C_ADDR, offset, data_ptr);
+ ret = i2c_read8__7bf(I2C_PORT_THERMAL, BD99992GW_I2C_ADDR__7bf,
+ offset, data_ptr);
if (ret != EC_SUCCESS)
CPRINTS("bd99992gw read fail %d", ret);
return ret;
@@ -48,7 +49,8 @@ static int raw_read8(const int offset, int *data_ptr)
static int raw_write8(const int offset, int data)
{
int ret;
- ret = i2c_write8(I2C_PORT_THERMAL, BD99992GW_I2C_ADDR, offset, data);
+ ret = i2c_write8__7bf(I2C_PORT_THERMAL, BD99992GW_I2C_ADDR__7bf,
+ offset, data);
if (ret != EC_SUCCESS)
CPRINTS("bd99992gw write fail %d", ret);
return ret;
diff --git a/driver/temp_sensor/bd99992gw.h b/driver/temp_sensor/bd99992gw.h
index 7db3990e07..1d5aff7287 100644
--- a/driver/temp_sensor/bd99992gw.h
+++ b/driver/temp_sensor/bd99992gw.h
@@ -8,7 +8,7 @@
#ifndef __CROS_EC_TEMP_SENSOR_BD99992GW_H
#define __CROS_EC_TEMP_SENSOR_BD99992GW_H
-#define BD99992GW_I2C_ADDR 0x60
+#define BD99992GW_I2C_ADDR__7bf 0x30
/* ADC channels */
enum bd99992gw_adc_channel {
diff --git a/driver/temp_sensor/f75303.c b/driver/temp_sensor/f75303.c
index e2a324f0fb..794d2e865a 100644
--- a/driver/temp_sensor/f75303.c
+++ b/driver/temp_sensor/f75303.c
@@ -20,7 +20,8 @@ static int8_t fake_temp[F75303_IDX_COUNT] = {-1, -1, -1};
*/
static int raw_read8(const int offset, int *data)
{
- return i2c_read8(I2C_PORT_THERMAL, F75303_I2C_ADDR, offset, data);
+ return i2c_read8__7bf(I2C_PORT_THERMAL, F75303_I2C_ADDR__7bf,
+ offset, data);
}
static int get_temp(const int offset, int *temp)
diff --git a/driver/temp_sensor/f75303.h b/driver/temp_sensor/f75303.h
index ada32e75e7..ea2dcdbd79 100644
--- a/driver/temp_sensor/f75303.h
+++ b/driver/temp_sensor/f75303.h
@@ -8,7 +8,7 @@
#ifndef __CROS_EC_F75303_H
#define __CROS_EC_F75303_H
-#define F75303_I2C_ADDR 0x9A /* 7-bit address is 0x4C */
+#define F75303_I2C_ADDR__7bf 0x4C
enum f75303_index {
F75303_IDX_LOCAL = 0,
diff --git a/driver/temp_sensor/g78x.c b/driver/temp_sensor/g78x.c
index 948569da1c..0a71556b27 100644
--- a/driver/temp_sensor/g78x.c
+++ b/driver/temp_sensor/g78x.c
@@ -35,13 +35,15 @@ static int has_power(void)
static int raw_read8(const int offset, int *data_ptr)
{
- return i2c_read8(I2C_PORT_THERMAL, G78X_I2C_ADDR, offset, data_ptr);
+ return i2c_read8__7bf(I2C_PORT_THERMAL, G78X_I2C_ADDR__7bf,
+ offset, data_ptr);
}
#ifdef CONFIG_CMD_TEMP_SENSOR
static int raw_write8(const int offset, int data)
{
- return i2c_write8(I2C_PORT_THERMAL, G78X_I2C_ADDR, offset, data);
+ return i2c_write8__7bf(I2C_PORT_THERMAL, G78X_I2C_ADDR__7bf,
+ offset, data);
}
#endif
diff --git a/driver/temp_sensor/g78x.h b/driver/temp_sensor/g78x.h
index 2ef75f1da9..6d656610d9 100644
--- a/driver/temp_sensor/g78x.h
+++ b/driver/temp_sensor/g78x.h
@@ -12,7 +12,7 @@
#error Cannot support both G781 and G782 together!
#endif
-#define G78X_I2C_ADDR 0x98 /* 7-bit address is 0x4C */
+#define G78X_I2C_ADDR__7bf 0x4C
#define G78X_IDX_INTERNAL 0
#define G78X_IDX_EXTERNAL1 1
diff --git a/driver/temp_sensor/sb_tsi.c b/driver/temp_sensor/sb_tsi.c
index 9cf42d983f..3de816e1dc 100644
--- a/driver/temp_sensor/sb_tsi.c
+++ b/driver/temp_sensor/sb_tsi.c
@@ -19,7 +19,8 @@
static int raw_read8(const int offset, int *data_ptr)
{
- return i2c_read8(I2C_PORT_THERMAL, SB_TSI_I2C_ADDR, offset, data_ptr);
+ return i2c_read8__7bf(I2C_PORT_THERMAL, SB_TSI_I2C_ADDR__7bf,
+ offset, data_ptr);
}
int sb_tsi_get_val(int idx, int *temp_ptr)
diff --git a/driver/temp_sensor/sb_tsi.h b/driver/temp_sensor/sb_tsi.h
index 3ae11c5dbd..afed1d206f 100644
--- a/driver/temp_sensor/sb_tsi.h
+++ b/driver/temp_sensor/sb_tsi.h
@@ -11,7 +11,7 @@
#ifndef __CROS_EC_SB_TSI_H
#define __CROS_EC_SB_TSI_H
-#define SB_TSI_I2C_ADDR 0x98 /* 7-bit address is 0x4C */
+#define SB_TSI_I2C_ADDR__7bf 0x4C
/* G781 register */
#define SB_TSI_TEMP_H 0x01
diff --git a/driver/temp_sensor/tmp006.c b/driver/temp_sensor/tmp006.c
index b33ab67a6c..b615dbd4cc 100644
--- a/driver/temp_sensor/tmp006.c
+++ b/driver/temp_sensor/tmp006.c
@@ -86,7 +86,7 @@ static void tmp006_poll_sensor(int sensor_id)
{
struct tmp006_data_t *tdata = tmp006_data + sensor_id;
int t, v, rv;
- int addr = tmp006_sensors[sensor_id].addr;
+ int addr__7bf = tmp006_sensors__7bf[sensor_id].addr__7bf;
/* Invalidate the filter history if there is any error */
if (tdata->fail) {
@@ -104,7 +104,8 @@ static void tmp006_poll_sensor(int sensor_id)
* data ready; otherwise, we read garbage data.
*/
if (tdata->fail & (FAIL_POWER | FAIL_INIT)) {
- rv = i2c_read16(TMP006_PORT(addr), TMP006_REG(addr),
+ rv = i2c_read16__7bf(TMP006_PORT(addr__7bf),
+ TMP006_REG__7bf(addr__7bf),
TMP006_REG_CONFIG, &v);
if (rv) {
tdata->fail |= FAIL_I2C;
@@ -116,14 +117,16 @@ static void tmp006_poll_sensor(int sensor_id)
}
}
- rv = i2c_read16(TMP006_PORT(addr), TMP006_REG(addr),
+ rv = i2c_read16__7bf(TMP006_PORT(addr__7bf),
+ TMP006_REG__7bf(addr__7bf),
TMP006_REG_TDIE, &t);
if (rv) {
tdata->fail |= FAIL_I2C;
return;
}
- rv = i2c_read16(TMP006_PORT(addr), TMP006_REG(addr),
+ rv = i2c_read16__7bf(TMP006_PORT(addr__7bf),
+ TMP006_REG__7bf(addr__7bf),
TMP006_REG_VOBJ, &v);
if (rv) {
tdata->fail |= FAIL_I2C;
@@ -370,37 +373,42 @@ static int tmp006_print(int idx)
int traw, t;
int rv;
int d;
- int addr = tmp006_sensors[idx].addr;
+ int addr__7bf = tmp006_sensors__7bf[idx].addr__7bf;
- ccprintf("Debug data from %s:\n", tmp006_sensors[idx].name);
+ ccprintf("Debug data from %s:\n", tmp006_sensors__7bf[idx].name);
if (!tmp006_has_power(idx)) {
ccputs("Sensor powered off.\n");
return EC_ERROR_UNKNOWN;
}
- rv = i2c_read16(TMP006_PORT(addr), TMP006_REG(addr),
+ rv = i2c_read16__7bf(TMP006_PORT(addr__7bf),
+ TMP006_REG__7bf(addr__7bf),
TMP006_REG_MANUFACTURER_ID, &d);
if (rv)
return rv;
ccprintf(" Manufacturer ID: 0x%04x\n", d);
- rv = i2c_read16(TMP006_PORT(addr), TMP006_REG(addr),
+ rv = i2c_read16__7bf(TMP006_PORT(addr__7bf),
+ TMP006_REG__7bf(addr__7bf),
TMP006_REG_DEVICE_ID, &d);
ccprintf(" Device ID: 0x%04x\n", d);
- rv = i2c_read16(TMP006_PORT(addr), TMP006_REG(addr),
+ rv = i2c_read16__7bf(TMP006_PORT(addr__7bf),
+ TMP006_REG__7bf(addr__7bf),
TMP006_REG_CONFIG, &d);
ccprintf(" Config: 0x%04x\n", d);
- rv = i2c_read16(TMP006_PORT(addr), TMP006_REG(addr),
+ rv = i2c_read16__7bf(TMP006_PORT(addr__7bf),
+ TMP006_REG__7bf(addr__7bf),
TMP006_REG_VOBJ, &vraw);
v = ((int)vraw * 15625) / 100;
ccprintf(" Voltage: 0x%04x = %d nV\n", vraw, v);
- rv = i2c_read16(TMP006_PORT(addr), TMP006_REG(addr),
+ rv = i2c_read16__7bf(TMP006_PORT(addr__7bf),
+ TMP006_REG__7bf(addr__7bf),
TMP006_REG_TDIE, &traw);
t = (int)traw;
ccprintf(" Temperature: 0x%04x = %d.%02d C\n",
@@ -455,7 +463,7 @@ static int command_t6cal(int argc, char **argv)
tdata = tmp006_data + i;
ccprintf("%d %-11s"
"%7de-17 %7de-8 %7de-10 %7de-12\n",
- i, tmp006_sensors[i].name,
+ i, tmp006_sensors__7bf[i].name,
(int)(tdata->s0 * 1e17f),
(int)(tdata->b0 * 1e8f),
(int)(tdata->b1 * 1e10f),
diff --git a/driver/temp_sensor/tmp006.h b/driver/temp_sensor/tmp006.h
index 28204829a2..98f8e31ee0 100644
--- a/driver/temp_sensor/tmp006.h
+++ b/driver/temp_sensor/tmp006.h
@@ -16,17 +16,17 @@
#define TMP006_REG_DEVICE_ID 0xff
/* I2C address components */
-#define TMP006_ADDR(PORT,REG) ((PORT << 16) + REG)
-#define TMP006_PORT(ADDR) (ADDR >> 16)
-#define TMP006_REG(ADDR) (ADDR & 0xffff)
+#define TMP006_ADDR__7bf(PORT, REG) ((PORT << 16) + REG)
+#define TMP006_PORT(ADDR__7bf) (ADDR__7bf >> 16)
+#define TMP006_REG__7bf(ADDR__7bf) (ADDR__7bf & 0xffff)
struct tmp006_t {
const char *name;
- int addr; /* I2C address formed by TMP006_ADDR macro. */
+ int addr__7bf; /* I2C address formed by TMP006_ADDR macro. */
};
/* Names and addresses of the sensors we have */
-extern const struct tmp006_t tmp006_sensors[];
+extern const struct tmp006_t tmp006_sensors__7bf[];
/**
* Get the last polled value of a sensor.
diff --git a/driver/temp_sensor/tmp112.c b/driver/temp_sensor/tmp112.c
index f61cf23784..b80fc4bb61 100644
--- a/driver/temp_sensor/tmp112.c
+++ b/driver/temp_sensor/tmp112.c
@@ -20,12 +20,14 @@ static int temp_val_local;
static int raw_read16(const int offset, int *data_ptr)
{
- return i2c_read16(I2C_PORT_THERMAL, TMP112_I2C_ADDR, offset, data_ptr);
+ return i2c_read16__7bf(I2C_PORT_THERMAL, TMP112_I2C_ADDR__7bf,
+ offset, data_ptr);
}
static int raw_write16(const int offset, int data)
{
- return i2c_write16(I2C_PORT_THERMAL, TMP112_I2C_ADDR, offset, data);
+ return i2c_write16__7bf(I2C_PORT_THERMAL, TMP112_I2C_ADDR__7bf,
+ offset, data);
}
static int get_temp(int *temp_ptr)
diff --git a/driver/temp_sensor/tmp112.h b/driver/temp_sensor/tmp112.h
index 63bf4bfab4..f1c5725741 100644
--- a/driver/temp_sensor/tmp112.h
+++ b/driver/temp_sensor/tmp112.h
@@ -8,7 +8,7 @@
#include "i2c.h"
-#define TMP112_I2C_ADDR 0x90 | I2C_FLAG_BIG_ENDIAN
+#define TMP112_I2C_ADDR__7bf (0x48 | I2C_FLAG_BIG_ENDIAN)
#define TMP112_REG_TEMP 0x00
#define TMP112_REG_CONF 0x01
diff --git a/driver/temp_sensor/tmp411.h b/driver/temp_sensor/tmp411.h
index e5fd37b5c8..6e15f52c3e 100644
--- a/driver/temp_sensor/tmp411.h
+++ b/driver/temp_sensor/tmp411.h
@@ -8,7 +8,7 @@
#ifndef __CROS_EC_TMP411_H
#define __CROS_EC_TMP411_H
-#define TMP411_I2C_ADDR 0x98 /* 7-bit address is 0x4C */
+#define TMP411_I2C_ADDR__7bf 0x4C
#define TMP411_IDX_LOCAL 0
#define TMP411_IDX_REMOTE1 1
diff --git a/driver/temp_sensor/tmp432.c b/driver/temp_sensor/tmp432.c
index c0e04a84ad..6325547ace 100644
--- a/driver/temp_sensor/tmp432.c
+++ b/driver/temp_sensor/tmp432.c
@@ -35,12 +35,14 @@ static int has_power(void)
static int raw_read8(const int offset, int *data_ptr)
{
- return i2c_read8(I2C_PORT_THERMAL, TMP432_I2C_ADDR, offset, data_ptr);
+ return i2c_read8__7bf(I2C_PORT_THERMAL, TMP432_I2C_ADDR__7bf,
+ offset, data_ptr);
}
static int raw_write8(const int offset, int data)
{
- return i2c_write8(I2C_PORT_THERMAL, TMP432_I2C_ADDR, offset, data);
+ return i2c_write8__7bf(I2C_PORT_THERMAL, TMP432_I2C_ADDR__7bf,
+ offset, data);
}
static int get_temp(const int offset, int *temp_ptr)
diff --git a/driver/temp_sensor/tmp432.h b/driver/temp_sensor/tmp432.h
index bcdc83d926..638cde91e1 100644
--- a/driver/temp_sensor/tmp432.h
+++ b/driver/temp_sensor/tmp432.h
@@ -8,7 +8,7 @@
#ifndef __CROS_EC_TMP432_H
#define __CROS_EC_TMP432_H
-#define TMP432_I2C_ADDR 0x98 /* 7-bit address is 0x4C */
+#define TMP432_I2C_ADDR__7bf 0x4C
#define TMP432_IDX_LOCAL 0
#define TMP432_IDX_REMOTE1 1
diff --git a/driver/temp_sensor/tmp468.c b/driver/temp_sensor/tmp468.c
index 09a3faa80e..444a1d5dc8 100644
--- a/driver/temp_sensor/tmp468.c
+++ b/driver/temp_sensor/tmp468.c
@@ -27,12 +27,14 @@ static int has_power(void)
static int raw_read16(const int offset, int *data_ptr)
{
- return i2c_read16(I2C_PORT_THERMAL, TMP468_I2C_ADDR, offset, data_ptr);
+ return i2c_read16__7bf(I2C_PORT_THERMAL, TMP468_I2C_ADDR__7bf,
+ offset, data_ptr);
}
static int raw_write16(const int offset, int data_ptr)
{
- return i2c_write16(I2C_PORT_THERMAL, TMP468_I2C_ADDR, offset, data_ptr);
+ return i2c_write16__7bf(I2C_PORT_THERMAL, TMP468_I2C_ADDR__7bf,
+ offset, data_ptr);
}
static int tmp468_shutdown(uint8_t want_shutdown)
diff --git a/driver/temp_sensor/tmp468.h b/driver/temp_sensor/tmp468.h
index 70d772f097..f8f4337d8a 100644
--- a/driver/temp_sensor/tmp468.h
+++ b/driver/temp_sensor/tmp468.h
@@ -8,7 +8,7 @@
#ifndef __CROS_EC_TMP468_H
#define __CROS_EC_TMP468_H
-#define TMP468_I2C_ADDR (0x90 | I2C_FLAG_BIG_ENDIAN)
+#define TMP468_I2C_ADDR__7bf (0x48 | I2C_FLAG_BIG_ENDIAN)
#define TMP468_SHIFT1 7
#define TMP468_LOCAL 0x00