Skip to content

Commit

Permalink
Device tree overlay for INA238
Browse files Browse the repository at this point in the history
This commit adds support for the TI INA238 power monitor IC via I2C.  It also builds the driver as a module by default
  • Loading branch information
jsarrett committed Jan 24, 2025
1 parent fed8a09 commit 1854848
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
71 changes: 71 additions & 0 deletions arch/arm/boot/dts/overlays/ina238.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
* TI INA238 Power monitor
*/

/dts-v1/;
/plugin/;

/ {
fragment@0 {
target = <&i2cbus>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";

ina238: ina238@48 {
compatible = "ti,ina238";
status = "okay";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x40>;
/* uOhms, uint32_t */
shunt-resistor = <1000>;
/* 1 or 4, (±40.96 mV or ±163.84 mV) */
ti,shunt-gain = <1>;
};
};
};

frag100: fragment@100 {
target = <&i2c1>;
i2cbus: __overlay__ {
status = "okay";
};
};

fragment@101 {
target = <&i2c0if>;
__dormant__ {
status = "okay";
};
};

fragment@102 {
target = <&i2c0mux>;
__dormant__ {
status = "okay";
};
};

__overrides__ {
addr = <&ina238>,"reg:0";
shunt_resistor = <&ina238>,"shunt-resistor:0";
gain = <&ina238>,"ti,shunt-gain:0";
i2c0 = <&frag100>, "target:0=",<&i2c0>;
i2c_csi_dsi = <&frag100>, "target:0=",<&i2c_csi_dsi>,
<0>,"+101+102";
i2c_csi_dsi0 = <&frag100>, "target:0=",<&i2c_csi_dsi0>,
<0>,"+101+102";
i2c3 = <&frag100>, "target?=0",
<&frag100>, "target-path=i2c3";
i2c4 = <&frag100>, "target?=0",
<&frag100>, "target-path=i2c4";
i2c5 = <&frag100>, "target?=0",
<&frag100>, "target-path=i2c5";
i2c6 = <&frag100>, "target?=0",
<&frag100>, "target-path=i2c6";
i2c-path = <&frag100>, "target?=0",
<&frag100>, "target-path";
};
};
1 change: 1 addition & 0 deletions arch/arm/configs/bcmrpi_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,7 @@ CONFIG_SENSORS_SHT4x=m
CONFIG_SENSORS_SHTC1=m
CONFIG_SENSORS_EMC2305=m
CONFIG_SENSORS_INA2XX=m
CONFIG_SENSORS_INA238=m
CONFIG_SENSORS_TMP102=m
CONFIG_BCM2835_THERMAL=y
CONFIG_WATCHDOG=y
Expand Down

0 comments on commit 1854848

Please sign in to comment.