dt-bindings: sensor: ina230: add configuration properties

Add properties to replace the configuration register value.

Signed-off-by: Eric Holmberg <eric.holmberg@northriversystems.co.nz>
This commit is contained in:
Eric Holmberg 2023-08-16 16:42:34 +12:00 committed by Maureen Helm
commit f0f7f8b146
3 changed files with 51 additions and 7 deletions

View file

@ -261,7 +261,11 @@ static const struct sensor_driver_api ina230_driver_api = {
static struct ina230_data drv_data_##inst; \
static const struct ina230_config drv_config_##inst = { \
.bus = I2C_DT_SPEC_INST_GET(inst), \
.config = DT_INST_PROP(inst, config), \
.config = DT_INST_PROP(inst, config) | \
(DT_INST_ENUM_IDX(inst, avg_count) << 9) | \
(DT_INST_ENUM_IDX(inst, vbus_conversion_time_us) << 6) | \
(DT_INST_ENUM_IDX(inst, vshunt_conversion_time_us) << 3) | \
DT_INST_ENUM_IDX(inst, adc_mode), \
.current_lsb = DT_INST_PROP(inst, current_lsb_microamps), \
.cal = (uint16_t)((INA230_CAL_SCALING * 10000000ULL) / \
((uint64_t)DT_INST_PROP(inst, current_lsb_microamps) * \

View file

@ -18,13 +18,55 @@ include: ti,ina23x-common.yaml
properties:
config:
type: int
required: true
deprecated: true
default: 0x0000
description: |
Value of the configuration register
e.g shunt voltage and bus voltage ADC conversion
times and averaging, operating mode for INA230 or
delay for initial ADC conversion, shunt full scale range
for INA237.
times, ADC and averaging, and ADC operating mode.
alert-config:
type: int
description: Diag alert register, default matches the power-on reset value
adc-mode:
type: string
description: |
ADC channel conversion configuration.
Default is the power-on reset value.
default: "Bus and shunt voltage continuous"
enum:
- "Shutdown single shot"
- "Shunt Voltage single shot"
- "Bus Voltage single shot"
- "Bus and Shunt Voltage single shot"
- "Shutdown continuous"
- "Shunt voltage continuous"
- "Bus voltage continuous"
- "Bus and shunt voltage continuous"
vbus-conversion-time-us:
type: int
description: |
Vbus conversion time in microseconds.
Default is the power-on reset value.
default: 1100
enum: [140, 204, 332, 588, 1100, 2116, 4156, 8244]
vshunt-conversion-time-us:
type: int
description: |
Vshunt conversion time in microseconds.
Default is the power-on reset value.
default: 1100
enum: [140, 204, 332, 588, 1100, 2116, 4156, 8244]
avg-count:
type: int
description: |
Number of samples to average (applies to all inputs).
Default is the power-on reset value.
default: 1
enum: [1, 4, 16, 64, 128, 256, 512, 1024]
mask:
type: int

View file

@ -560,7 +560,6 @@ test_i2c_lm75: lm75@56 {
test_i2c_ina230: ina230@57 {
compatible = "ti,ina230";
reg = <0x57>;
config = <0>;
current-lsb-microamps = <1000>;
rshunt-micro-ohms = <1000>;
mask = <0>;
@ -577,7 +576,6 @@ test_i2c_lm77: lm77@58 {
test_i2c_ina231: ina231@59 {
compatible = "ti,ina230";
reg = <0x59>;
config = <0>;
current-lsb-microamps = <1000>;
rshunt-micro-ohms = <1000>;
mask = <0>;