Skip to content

Commit 0637ed8

Browse files
committed
Device tree overlay for INA238
This commit adds support for the TI INA238 power monitor IC via I2C. It also builds the driver as a module by default
1 parent fed8a09 commit 0637ed8

File tree

4 files changed

+74
-0
lines changed

4 files changed

+74
-0
lines changed

arch/arm/boot/dts/overlays/ina238.dts

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/*
2+
* TI INA238 Power monitor
3+
*/
4+
5+
/dts-v1/;
6+
/plugin/;
7+
8+
/ {
9+
fragment@0 {
10+
target = <&i2cbus>;
11+
__overlay__ {
12+
#address-cells = <1>;
13+
#size-cells = <0>;
14+
status = "okay";
15+
16+
ina238: ina238@48 {
17+
compatible = "ti,ina238";
18+
status = "okay";
19+
#address-cells = <1>;
20+
#size-cells = <0>;
21+
reg = <0x40>;
22+
/* uOhms, uint32_t */
23+
shunt-resistor = <1000>;
24+
/* 1 or 4, (±40.96 mV or ±163.84 mV) */
25+
ti,shunt-gain = <1>;
26+
};
27+
};
28+
};
29+
30+
frag100: fragment@100 {
31+
target = <&i2c1>;
32+
i2cbus: __overlay__ {
33+
status = "okay";
34+
};
35+
};
36+
37+
fragment@101 {
38+
target = <&i2c0if>;
39+
__dormant__ {
40+
status = "okay";
41+
};
42+
};
43+
44+
fragment@102 {
45+
target = <&i2c0mux>;
46+
__dormant__ {
47+
status = "okay";
48+
};
49+
};
50+
51+
__overrides__ {
52+
addr = <&ina238>,"reg:0";
53+
shunt_resistor = <&ina238>,"shunt-resistor:0";
54+
gain = <&ina238>,"ti,shunt-gain:0";
55+
i2c0 = <&frag100>, "target:0=",<&i2c0>;
56+
i2c_csi_dsi = <&frag100>, "target:0=",<&i2c_csi_dsi>,
57+
<0>,"+101+102";
58+
i2c_csi_dsi0 = <&frag100>, "target:0=",<&i2c_csi_dsi0>,
59+
<0>,"+101+102";
60+
i2c3 = <&frag100>, "target?=0",
61+
<&frag100>, "target-path=i2c3";
62+
i2c4 = <&frag100>, "target?=0",
63+
<&frag100>, "target-path=i2c4";
64+
i2c5 = <&frag100>, "target?=0",
65+
<&frag100>, "target-path=i2c5";
66+
i2c6 = <&frag100>, "target?=0",
67+
<&frag100>, "target-path=i2c6";
68+
i2c-path = <&frag100>, "target?=0",
69+
<&frag100>, "target-path";
70+
};
71+
};

arch/arm/configs/bcm2709_defconfig

+1
Original file line numberDiff line numberDiff line change
@@ -751,6 +751,7 @@ CONFIG_SENSORS_SHT4x=m
751751
CONFIG_SENSORS_SHTC1=m
752752
CONFIG_SENSORS_EMC2305=m
753753
CONFIG_SENSORS_INA2XX=m
754+
CONFIG_SENSORS_INA238=m
754755
CONFIG_SENSORS_TMP102=m
755756
CONFIG_BCM2835_THERMAL=y
756757
CONFIG_WATCHDOG=y

arch/arm/configs/bcm2711_defconfig

+1
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,7 @@ CONFIG_SENSORS_SHT4x=m
775775
CONFIG_SENSORS_SHTC1=m
776776
CONFIG_SENSORS_EMC2305=m
777777
CONFIG_SENSORS_INA2XX=m
778+
CONFIG_SENSORS_INA238=m
778779
CONFIG_SENSORS_TMP102=m
779780
CONFIG_BCM2711_THERMAL=y
780781
CONFIG_WATCHDOG=y

arch/arm/configs/bcmrpi_defconfig

+1
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,7 @@ CONFIG_SENSORS_SHT4x=m
745745
CONFIG_SENSORS_SHTC1=m
746746
CONFIG_SENSORS_EMC2305=m
747747
CONFIG_SENSORS_INA2XX=m
748+
CONFIG_SENSORS_INA238=m
748749
CONFIG_SENSORS_TMP102=m
749750
CONFIG_BCM2835_THERMAL=y
750751
CONFIG_WATCHDOG=y

0 commit comments

Comments
 (0)