Skip to content

Commit 94de192

Browse files
jsarrettpelwell
authored andcommitted
add ina238 to i2c-sensors
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.
1 parent 6d16e47 commit 94de192

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

arch/arm/boot/dts/overlays/README

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2486,11 +2486,20 @@ Params: addr Set the address for the ADT7410, BH1750, BME280,
24862486
ds1621 Select the Dallas Semiconductors DS1621 temp
24872487
sensor. Valid addresses 0x48-0x4f, default 0x48
24882488

2489+
gain Gain used for measuring shunt resistor current.
2490+
Valid values 1 or 4, default 1. (ina238 only,
2491+
disabled by default)
2492+
24892493
hdc100x Select the Texas Instruments HDC100x temp sensor
24902494
Valid addresses 0x40-0x43, default 0x40
24912495

24922496
htu21 Select the HTU21 temperature and humidity sensor
24932497

2498+
ina238 Select the TI INA238 power monitor. Valid
2499+
addresses 0x40-0x4F, default 0x40.
2500+
Uses parameters shunt-resistor and
2501+
ti,shunt-gain for configuration
2502+
24942503
int_pin Set the GPIO to use for interrupts (max30102,
24952504
mpu6050 and mpu9250 only)
24962505

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

2561+
shunt_resistor Value of shunt resistor used for current
2562+
measurement in uOhms. (ina238 only, disabled
2563+
by default)
2564+
25522565
sht3x Select the Sensirion SHT3x temperature and
25532566
humidity sensors. Valid addresses 0x44-0x45,
25542567
default 0x44

arch/arm/boot/dts/overlays/i2c-sensor-common.dtsi

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,27 @@
526526
};
527527
};
528528

529+
fragment@35 {
530+
target = <&i2cbus>;
531+
__dormant__ {
532+
#address-cells = <1>;
533+
#size-cells = <0>;
534+
status = "okay";
535+
536+
ina238: ina238@48 {
537+
compatible = "ti,ina238";
538+
#address-cells = <1>;
539+
#size-cells = <0>;
540+
reg = <0x40>;
541+
/* uOhms, uint32_t */
542+
shunt-resistor = <1000>;
543+
/* 1 or 4, (±40.96 mV or ±163.84 mV) */
544+
ti,shunt-gain = <1>;
545+
status = "okay";
546+
};
547+
};
548+
};
549+
529550
fragment@99 {
530551
target = <&gpio>;
531552
__dormant__ {
@@ -573,6 +594,7 @@
573594
bno055 = <0>,"+31";
574595
sht4x = <0>,"+32";
575596
adt7410 = <0>,"+34";
597+
ina238 = <0>,"+35";
576598

577599
addr = <&bme280>,"reg:0", <&bmp280>,"reg:0", <&tmp102>,"reg:0",
578600
<&lm75>,"reg:0", <&hdc100x>,"reg:0", <&sht3x>,"reg:0",
@@ -582,13 +604,15 @@
582604
<&ms5837>,"reg:0", <&ms8607>,"reg:0",
583605
<&mpu6050>,"reg:0", <&mpu9250>,"reg:0",
584606
<&bno055>,"reg:0", <&sht4x>,"reg:0",
585-
<&bmp380>,"reg:0", <&adt7410>,"reg:0";
607+
<&bmp380>,"reg:0", <&adt7410>,"reg:0", <&ina238>,"reg:0";
586608
int_pin = <&int_pins>, "brcm,pins:0",
587609
<&int_pins>, "reg:0",
588610
<&max30102>, "interrupts:0",
589611
<&mpu6050>, "interrupts:0",
590612
<&mpu9250>, "interrupts:0";
591613
no_timeout = <&jc42>, "smbus-timeout-disable?";
592614
reset_pin = <&bno055>,"reset-gpios:4", <0>,"+30";
615+
shunt_resistor = <&ina238>,"shunt-resistor:0";
616+
gain = <&ina238>,"ti,shunt-gain:0";
593617
};
594618
};

0 commit comments

Comments
 (0)