Skip to content

Commit c3cafca

Browse files
committed
Device tree overlay for INA238
This commit adds support for the TI INA238 power monitor IC via I2C. Also it enables the driver as a module by default
1 parent fed8a09 commit c3cafca

File tree

7 files changed

+77
-0
lines changed

7 files changed

+77
-0
lines changed

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

Lines changed: 71 additions & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 0 deletions
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

arch/arm64/configs/bcm2711_defconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -806,6 +806,7 @@ CONFIG_SENSORS_SHT4x=m
806806
CONFIG_SENSORS_SHTC1=m
807807
CONFIG_SENSORS_EMC2305=m
808808
CONFIG_SENSORS_INA2XX=m
809+
CONFIG_SENSORS_INA238=m
809810
CONFIG_SENSORS_TMP102=m
810811
CONFIG_SENSORS_RP1_ADC=m
811812
CONFIG_BCM2711_THERMAL=y

arch/arm64/configs/bcm2712_defconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,6 +808,7 @@ CONFIG_SENSORS_SHT4x=m
808808
CONFIG_SENSORS_SHTC1=m
809809
CONFIG_SENSORS_EMC2305=m
810810
CONFIG_SENSORS_INA2XX=m
811+
CONFIG_SENSORS_INA238=m
811812
CONFIG_SENSORS_TMP102=m
812813
CONFIG_SENSORS_RP1_ADC=m
813814
CONFIG_BCM2711_THERMAL=y

arch/arm64/configs/bcmrpi3_defconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,7 @@ CONFIG_SENSORS_SHT4x=m
746746
CONFIG_SENSORS_SHTC1=m
747747
CONFIG_SENSORS_EMC2305=m
748748
CONFIG_SENSORS_INA2XX=m
749+
CONFIG_SENSORS_INA238=m
749750
CONFIG_SENSORS_TMP102=m
750751
CONFIG_BCM2835_THERMAL=y
751752
CONFIG_WATCHDOG=y

0 commit comments

Comments
 (0)