Skip to content

Commit 14341ef

Browse files
jsarrettpopcornmix
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 920267a commit 14341ef

File tree

2 files changed

+46
-11
lines changed

2 files changed

+46
-11
lines changed

arch/arm/boot/dts/overlays/README

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2514,6 +2514,10 @@ Params: addr Set the address for the ADT7410, AS73211,
25142514
ds1621 Select the Dallas Semiconductors DS1621 temp
25152515
sensor. Valid addresses 0x48-0x4f, default 0x48
25162516

2517+
gain Gain used for measuring shunt resistor current.
2518+
Valid values 1 or 4, default 1. (ina238 only,
2519+
disabled by default)
2520+
25172521
hdc100x Select the Texas Instruments HDC100x temp sensor
25182522
Valid addresses 0x40-0x43, default 0x40
25192523

@@ -2525,6 +2529,11 @@ Params: addr Set the address for the ADT7410, AS73211,
25252529

25262530
htu21 Select the HTU21 temperature and humidity sensor
25272531

2532+
ina238 Select the TI INA238 power monitor. Valid
2533+
addresses 0x40-0x4F, default 0x40.
2534+
Uses parameters shunt-resistor and
2535+
ti,shunt-gain for configuration
2536+
25282537
int_pin Set the GPIO to use for interrupts (as73211,
25292538
as7331, hdc3020, hts221, max30102, mpu6050 and
25302539
mpu9250 only)
@@ -2584,6 +2593,10 @@ Params: addr Set the address for the ADT7410, AS73211,
25842593
reset_pin GPIO to be used to reset the device (bno055
25852594
only, disabled by default)
25862595

2596+
shunt_resistor Value of shunt resistor used for current
2597+
measurement in uOhms. (ina238 only, disabled
2598+
by default)
2599+
25872600
sht3x Select the Sensirion SHT3x temperature and
25882601
humidity sensors. Valid addresses 0x44-0x45,
25892602
default 0x44

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

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,26 @@
528528
};
529529

530530
fragment@35 {
531+
target = <&i2cbus>;
532+
__dormant__ {
533+
#address-cells = <1>;
534+
#size-cells = <0>;
535+
status = "okay";
536+
537+
ina238: ina238@48 {
538+
compatible = "ti,ina238";
539+
#address-cells = <1>;
540+
#size-cells = <0>;
541+
reg = <0x40>;
542+
/* uOhms, uint32_t */
543+
shunt-resistor = <1000>;
544+
/* 1 or 4, (±40.96 mV or ±163.84 mV) */
545+
ti,shunt-gain = <1>;
546+
};
547+
};
548+
};
549+
550+
fragment@36 {
531551
target = <&i2cbus>;
532552
__dormant__ {
533553
#address-cells = <1>;
@@ -545,7 +565,7 @@
545565
};
546566
};
547567

548-
fragment@36 {
568+
fragment@37 {
549569
target = <&i2cbus>;
550570
__dormant__ {
551571
#address-cells = <1>;
@@ -555,12 +575,11 @@
555575
veml6075: veml6075@10 {
556576
compatible = "vishay,veml6075";
557577
reg = <0x10>;
558-
status = "okay";
559578
};
560579
};
561580
};
562581

563-
fragment@37 {
582+
fragment@38 {
564583
target = <&i2cbus>;
565584
__dormant__ {
566585
#address-cells = <1>;
@@ -578,7 +597,7 @@
578597
};
579598
};
580599

581-
fragment@38 {
600+
fragment@39 {
582601
target = <&i2cbus>;
583602
__dormant__ {
584603
#address-cells = <1>;
@@ -596,7 +615,7 @@
596615
};
597616
};
598617

599-
fragment@39 {
618+
fragment@40 {
600619
target = <&i2cbus>;
601620
__dormant__ {
602621
#address-cells = <1>;
@@ -661,11 +680,12 @@
661680
bno055 = <0>,"+31";
662681
sht4x = <0>,"+32";
663682
adt7410 = <0>,"+34";
664-
hts221 = <0>,"+35+99";
665-
veml6075 = <0>,"+36";
666-
hdc3020 = <0>,"+37+99";
667-
as73211 = <0>,"+38+99";
668-
as7331 = <0>,"+39+99";
683+
ina238 = <0>,"+35";
684+
hts221 = <0>,"+36+99";
685+
veml6075 = <0>,"+37";
686+
hdc3020 = <0>,"+38+99";
687+
as73211 = <0>,"+39+99";
688+
as7331 = <0>,"+40+99";
669689

670690
addr = <&bme280>,"reg:0", <&bmp280>,"reg:0", <&tmp102>,"reg:0",
671691
<&lm75>,"reg:0", <&hdc100x>,"reg:0", <&sht3x>,"reg:0",
@@ -675,7 +695,7 @@
675695
<&ms5837>,"reg:0", <&ms8607>,"reg:0",
676696
<&mpu6050>,"reg:0", <&mpu9250>,"reg:0",
677697
<&bno055>,"reg:0", <&sht4x>,"reg:0",
678-
<&bmp380>,"reg:0", <&adt7410>,"reg:0",
698+
<&bmp380>,"reg:0", <&adt7410>,"reg:0", <&ina238>,"reg:0",
679699
<&hdc3020>,"reg:0", <&as73211>,"reg:0",
680700
<&as7331>,"reg:0";
681701
int_pin = <&int_pins>, "brcm,pins:0",
@@ -689,5 +709,7 @@
689709
<&as7331>, "interrupts:0";
690710
no_timeout = <&jc42>, "smbus-timeout-disable?";
691711
reset_pin = <&bno055>,"reset-gpios:4", <0>,"+30";
712+
shunt_resistor = <&ina238>,"shunt-resistor:0";
713+
gain = <&ina238>,"ti,shunt-gain:0";
692714
};
693715
};

0 commit comments

Comments
 (0)