Skip to content

Commit 231b2a0

Browse files
Jeppe Odgaardkartben
authored andcommitted
drivers: sensor: rename tmp116 to tmp11x
The tmp116 sensor driver also supports tmp117 and tmp119. Therefore rename to indicate that is supports a range of tmp devices. Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
1 parent 4ce331c commit 231b2a0

File tree

29 files changed

+357
-357
lines changed

29 files changed

+357
-357
lines changed

boards/bytesatwork/bytesensi_l/bytesensi_l.dts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,15 @@
9393
int-gpios = <&gpio0 25 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
9494
};
9595

96-
temperature_sensor: tmp116@4a {
96+
temperature_sensor: tmp11x@4a {
9797
status = "okay";
98-
compatible = "ti,tmp116";
98+
compatible = "ti,tmp11x";
9999
reg = <0x4a>;
100100
#address-cells = <1>;
101101
#size-cells = <0>;
102102

103-
eeprom: ti_tmp116_eeprom@0 {
104-
compatible = "ti,tmp116-eeprom";
103+
eeprom: ti_tmp11x_eeprom@0 {
104+
compatible = "ti,tmp11x-eeprom";
105105
reg = <0x0>;
106106
read-only;
107107
};

drivers/eeprom/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ if(CONFIG_EEPROM_SIMULATOR)
1919
endif()
2020
endif()
2121
zephyr_library_sources_ifdef(CONFIG_EEPROM_EMULATOR eeprom_emulator.c)
22-
zephyr_library_sources_ifdef(CONFIG_EEPROM_TMP116 eeprom_tmp116.c)
22+
zephyr_library_sources_ifdef(CONFIG_EEPROM_TMP11X eeprom_tmp11x.c)
2323
zephyr_library_sources_ifdef(CONFIG_EEPROM_XEC eeprom_mchp_xec.c)
2424
zephyr_library_sources_ifdef(CONFIG_EEPROM_FAKE eeprom_fake.c)
2525

drivers/eeprom/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ config EEPROM_AT2X_INIT_PRIORITY
9696
source "drivers/eeprom/Kconfig.lpc11u6x"
9797
source "drivers/eeprom/Kconfig.stm32"
9898
source "drivers/eeprom/Kconfig.eeprom_emu"
99-
source "drivers/eeprom/Kconfig.tmp116"
99+
source "drivers/eeprom/Kconfig.tmp11x"
100100
source "drivers/eeprom/Kconfig.xec"
101101
source "drivers/eeprom/Kconfig.mb85rcxx"
102102
source "drivers/eeprom/Kconfig.mb85rsxx"

drivers/eeprom/Kconfig.tmp116

Lines changed: 0 additions & 11 deletions
This file was deleted.

drivers/eeprom/Kconfig.tmp11x

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Copyright (c) 2021 Innoseis B.V.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config EEPROM_TMP11X
5+
bool "TMP116, TMP117 and TMP119 EEPROM driver"
6+
default y
7+
depends on DT_HAS_TI_TMP11X_EEPROM_ENABLED
8+
depends on TMP11X
9+
help
10+
Enable support for the on-chip EEPROM found on
11+
Texas instrument TMP116, TMP117 and TMP119 temperature sensor

drivers/eeprom/eeprom_tmp116.c

Lines changed: 0 additions & 70 deletions
This file was deleted.

drivers/eeprom/eeprom_tmp11x.c

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/*
2+
* Copyright (c) 2020 Innoseis B.V
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <errno.h>
8+
9+
#include <zephyr/devicetree.h>
10+
#include <zephyr/drivers/eeprom.h>
11+
#include <zephyr/drivers/sensor/tmp11x.h>
12+
13+
#define DT_DRV_COMPAT ti_tmp11x_eeprom
14+
15+
struct eeprom_tmp11x_config {
16+
const struct device *parent;
17+
};
18+
19+
BUILD_ASSERT(CONFIG_EEPROM_INIT_PRIORITY >
20+
CONFIG_SENSOR_INIT_PRIORITY,
21+
"TMP11X eeprom driver must be initialized after TMP11X sensor "
22+
"driver");
23+
24+
static size_t eeprom_tmp11x_size(const struct device *dev)
25+
{
26+
return EEPROM_TMP11X_SIZE;
27+
}
28+
29+
static int eeprom_tmp11x_write(const struct device *dev, off_t offset,
30+
const void *data, size_t len)
31+
{
32+
const struct eeprom_tmp11x_config *config = dev->config;
33+
34+
return tmp11x_eeprom_write(config->parent, offset, data, len);
35+
}
36+
37+
static int eeprom_tmp11x_read(const struct device *dev, off_t offset, void *data,
38+
size_t len)
39+
{
40+
const struct eeprom_tmp11x_config *config = dev->config;
41+
42+
return tmp11x_eeprom_read(config->parent, offset, data, len);
43+
}
44+
45+
static int eeprom_tmp11x_init(const struct device *dev)
46+
{
47+
const struct eeprom_tmp11x_config *config = dev->config;
48+
49+
if (!device_is_ready(config->parent)) {
50+
return -ENODEV;
51+
}
52+
53+
return 0;
54+
}
55+
56+
static DEVICE_API(eeprom, eeprom_tmp11x_api) = {
57+
.read = eeprom_tmp11x_read,
58+
.write = eeprom_tmp11x_write,
59+
.size = eeprom_tmp11x_size,
60+
};
61+
62+
#define DEFINE_TMP11X(_num) \
63+
static const struct eeprom_tmp11x_config eeprom_tmp11x_config##_num = { \
64+
.parent = DEVICE_DT_GET(DT_INST_BUS(_num)) \
65+
}; \
66+
DEVICE_DT_INST_DEFINE(_num, eeprom_tmp11x_init, NULL, \
67+
NULL, &eeprom_tmp11x_config##_num, POST_KERNEL, \
68+
CONFIG_EEPROM_INIT_PRIORITY, &eeprom_tmp11x_api);
69+
70+
DT_INST_FOREACH_STATUS_OKAY(DEFINE_TMP11X);

drivers/sensor/ti/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ add_subdirectory_ifdef(CONFIG_TMP1075 tmp1075)
1919
add_subdirectory_ifdef(CONFIG_TMP108 tmp108)
2020
add_subdirectory_ifdef(CONFIG_TMP112 tmp112)
2121
add_subdirectory_ifdef(CONFIG_TMP114 tmp114)
22-
add_subdirectory_ifdef(CONFIG_TMP116 tmp116)
22+
add_subdirectory_ifdef(CONFIG_TMP11X tmp11x)
2323
add_subdirectory_ifdef(CONFIG_TMP435 tmp435)
2424
# zephyr-keep-sorted-stop

drivers/sensor/ti/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ source "drivers/sensor/ti/tmp1075/Kconfig"
1919
source "drivers/sensor/ti/tmp108/Kconfig"
2020
source "drivers/sensor/ti/tmp112/Kconfig"
2121
source "drivers/sensor/ti/tmp114/Kconfig"
22-
source "drivers/sensor/ti/tmp116/Kconfig"
22+
source "drivers/sensor/ti/tmp11x/Kconfig"
2323
source "drivers/sensor/ti/tmp435/Kconfig"
2424
# zephyr-keep-sorted-stop

drivers/sensor/ti/tmp116/tmp116.h

Lines changed: 0 additions & 57 deletions
This file was deleted.

0 commit comments

Comments
 (0)