Skip to content

Commit

Permalink
add ina238 to i2c-sensors
Browse files Browse the repository at this point in the history
This patch adds the ina238 device tree parameters to the i2c-sensors
overlay.  The ina238 driver needs 2 configuration parameters, shut_resistor
and ti,shunt-gain in addition to it's address, so they are added as well.
  • Loading branch information
jsarrett committed Jan 26, 2025
1 parent fed8a09 commit 88b6430
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
13 changes: 13 additions & 0 deletions arch/arm/boot/dts/overlays/README
Original file line number Diff line number Diff line change
Expand Up @@ -2486,11 +2486,20 @@ Params: addr Set the address for the ADT7410, BH1750, BME280,
ds1621 Select the Dallas Semiconductors DS1621 temp
sensor. Valid addresses 0x48-0x4f, default 0x48

gain Gain used for measuring shunt resistor current.
Valid values 1 or 4, default 1. (ina238 only,
disabled by default)

hdc100x Select the Texas Instruments HDC100x temp sensor
Valid addresses 0x40-0x43, default 0x40

htu21 Select the HTU21 temperature and humidity sensor

ina238 Select the TI INA238 power monitor. Valid
addresses 0x40-0x4F, default 0x40.
Uses parameters shunt-resistor and
ti,shunt-gain for configuration

int_pin Set the GPIO to use for interrupts (max30102,
mpu6050 and mpu9250 only)

Expand Down Expand Up @@ -2549,6 +2558,10 @@ Params: addr Set the address for the ADT7410, BH1750, BME280,
reset_pin GPIO to be used to reset the device (bno055
only, disabled by default)

shunt_resistor Value of shunt resistor used for current
measurement in uOhms. (ina238 only, disabled
by default)

sht3x Select the Sensirion SHT3x temperature and
humidity sensors. Valid addresses 0x44-0x45,
default 0x44
Expand Down
26 changes: 25 additions & 1 deletion arch/arm/boot/dts/overlays/i2c-sensor-common.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,27 @@
};
};

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

ina238: ina238@48 {
compatible = "ti,ina238";
#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>;
status = "okay";
};
};
};

fragment@99 {
target = <&gpio>;
__dormant__ {
Expand Down Expand Up @@ -573,6 +594,7 @@
bno055 = <0>,"+31";
sht4x = <0>,"+32";
adt7410 = <0>,"+34";
ina238 = <0>,"+35";

addr = <&bme280>,"reg:0", <&bmp280>,"reg:0", <&tmp102>,"reg:0",
<&lm75>,"reg:0", <&hdc100x>,"reg:0", <&sht3x>,"reg:0",
Expand All @@ -582,13 +604,15 @@
<&ms5837>,"reg:0", <&ms8607>,"reg:0",
<&mpu6050>,"reg:0", <&mpu9250>,"reg:0",
<&bno055>,"reg:0", <&sht4x>,"reg:0",
<&bmp380>,"reg:0", <&adt7410>,"reg:0";
<&bmp380>,"reg:0", <&adt7410>,"reg:0", <&ina238>,"reg:0";
int_pin = <&int_pins>, "brcm,pins:0",
<&int_pins>, "reg:0",
<&max30102>, "interrupts:0",
<&mpu6050>, "interrupts:0",
<&mpu9250>, "interrupts:0";
no_timeout = <&jc42>, "smbus-timeout-disable?";
reset_pin = <&bno055>,"reset-gpios:4", <0>,"+30";
shunt_resistor = <&ina238>,"shunt-resistor:0";
gain = <&ina238>,"ti,shunt-gain:0";
};
};

0 comments on commit 88b6430

Please sign in to comment.