Skip to content

Commit 4ce331c

Browse files
Jeppe Odgaardkartben
authored andcommitted
drivers: sensor: add tmp119 support
Add support for TMP119. Its registers are compatible with TMP117 except for device id register. Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
1 parent 9588726 commit 4ce331c

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

drivers/sensor/ti/tmp116/Kconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
# SPDX-License-Identifier: Apache-2.0
55

66
config TMP116
7-
bool "TMP116 and TMP117 Temperature Sensors"
7+
bool "TMP116, TMP117 and TMP119 Temperature Sensors"
88
default y
99
depends on DT_HAS_TI_TMP116_ENABLED
1010
select I2C
1111
help
12-
Enable driver for TMP116 and TMP117 temperature sensors.
12+
Enable driver for TMP116, TMP117 and TMP119 temperature sensors.

drivers/sensor/ti/tmp116/tmp116.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,9 @@ static bool check_eeprom_bounds(const struct device *dev, off_t offset,
7777
return false;
7878
}
7979

80-
/* TMP117 uses EEPROM[2] as temperature offset register */
81-
if (drv_data->id == TMP117_DEVICE_ID &&
82-
offset <= EEPROM_TMP117_RESERVED &&
83-
(offset + len) > EEPROM_TMP117_RESERVED) {
80+
/* TMP117 and TMP119 uses EEPROM[2] as temperature offset register */
81+
if ((drv_data->id == TMP117_DEVICE_ID || drv_data->id == TMP119_DEVICE_ID) &&
82+
offset <= EEPROM_TMP117_RESERVED && (offset + len) > EEPROM_TMP117_RESERVED) {
8483
return false;
8584
}
8685

@@ -171,7 +170,7 @@ static inline int tmp116_device_id_check(const struct device *dev, uint16_t *id)
171170
return -EIO;
172171
}
173172

174-
if ((*id != TMP116_DEVICE_ID) && (*id != TMP117_DEVICE_ID)) {
173+
if ((*id != TMP116_DEVICE_ID) && (*id != TMP117_DEVICE_ID) && (*id != TMP119_DEVICE_ID)) {
175174
LOG_ERR("%s: Failed to match the device IDs!",
176175
dev->name);
177176
return -EINVAL;
@@ -293,8 +292,8 @@ static int tmp116_attr_set(const struct device *dev,
293292
return tmp116_write_config(dev, TMP116_CFGR_CONV, value);
294293

295294
case SENSOR_ATTR_OFFSET:
296-
if (drv_data->id != TMP117_DEVICE_ID) {
297-
LOG_ERR("%s: Offset is only supported by TMP117",
295+
if (drv_data->id != TMP117_DEVICE_ID && drv_data->id != TMP119_DEVICE_ID) {
296+
LOG_ERR("%s: Offset is only supported by TMP117 and TMP119",
298297
dev->name);
299298
return -EINVAL;
300299
}

drivers/sensor/ti/tmp116/tmp116.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
#define TMP116_DEVICE_ID 0x1116
2828
#define TMP117_DEVICE_ID 0x0117
29+
#define TMP119_DEVICE_ID 0x2117
2930

3031
#define TMP116_CFGR_AVG (BIT(5) | BIT(6))
3132
#define TMP116_CFGR_CONV (BIT(7) | BIT(8) | BIT(9))

0 commit comments

Comments
 (0)