feat: Add ADC sensor device tree bindings and configuration

Introduces device tree bindings for custom ADC voltage and current sensors,
allowing for flexible configuration of sensor inputs and associated GPIOs.
This enables proper hardware abstraction for ADC measurements.

The example overlay file
has been removed as its content is now integrated or superseded by the new
binding definitions.
This commit is contained in:
2025-07-08 16:43:27 +02:00
parent 2e8a86bc54
commit b11f844415
7 changed files with 333 additions and 7 deletions

View File

@@ -0,0 +1,48 @@
description: Custom motor current measurement with GPIO control
compatible: "custom,motor-current"
properties:
io-channels:
type: phandle-array
required: true
description: ADC channel for current measurement
io-channel-names:
type: string-array
description: Names for the ADC channels
current-sense-resistor-mohm:
type: int
required: true
description: Current sense resistor value in milliohms
amplifier-gain:
type: int
default: 1
description: Current sense amplifier gain
reference-mv:
type: int
default: 3300
description: ADC reference voltage in millivolts
sen-gpios:
type: phandle-array
required: true
description: GPIO to enable/disable the current measurement sensor
s0-gpios:
type: phandle-array
required: true
description: GPIO for multiplexer control bit 0
s1-gpios:
type: phandle-array
required: true
description: GPIO for multiplexer control bit 1
measurement-delay-ms:
type: int
default: 10
description: Delay in milliseconds after setting GPIOs before ADC measurement

View File

@@ -0,0 +1,63 @@
description: Custom supply voltage measurement with GPIO control
compatible: "custom,supply-voltage"
properties:
io-channels:
type: phandle-array
required: true
description: ADC channel for voltage measurement
io-channel-names:
type: string-array
description: Names for the ADC channels
voltage-divider-ratio:
type: int
required: true
description: Voltage divider ratio for scaling
reference-mv:
type: int
default: 3300
description: ADC reference voltage in millivolts
sen-gpios:
type: phandle-array
required: true
description: GPIO to enable/disable the voltage measurement sensor
s0-gpios:
type: phandle-array
required: true
description: GPIO for multiplexer control bit 0
s1-gpios:
type: phandle-array
required: true
description: GPIO for multiplexer control bit 1
measurement-delay-ms:
type: int
default: 10
description: Delay in milliseconds after setting GPIOs before ADC measurement
sen-gpios:
type: phandle-array
required: true
description: GPIO for SEN (Sense Enable) pin
s0-gpios:
type: phandle-array
required: true
description: GPIO for S0 (Select 0) pin
s1-gpios:
type: phandle-array
required: true
description: GPIO for S1 (Select 1) pin
measurement-delay-ms:
type: int
default: 10
description: Delay in milliseconds after setting control pins before ADC reading