[PATCH v2 0/2] iio: adc: ti-ads1120: Add driver and dt-binding

Ajith Anandhan posted 2 patches 1 month, 1 week ago
.../bindings/iio/adc/ti,ads1120.yaml          | 110 +++
MAINTAINERS                                   |   7 +
drivers/iio/adc/Kconfig                       |  10 +
drivers/iio/adc/Makefile                      |   1 +
drivers/iio/adc/ti-ads1120.c                  | 631 ++++++++++++++++++
5 files changed, 759 insertions(+)
create mode 100644 Documentation/devicetree/bindings/iio/adc/ti,ads1120.yaml
create mode 100644 drivers/iio/adc/ti-ads1120.c
[PATCH v2 0/2] iio: adc: ti-ads1120: Add driver and dt-binding
Posted by Ajith Anandhan 1 month, 1 week ago
This patch adds support for the Texas Instruments ADS1120, a precision 
16-bit delta-sigma ADC with SPI interface.

Why a new driver?
=================
The ADS1120 requires a dedicated driver rather than extending existing 
TI ADC drivers for the following reasons:

ads124s08.c - TI ADS124S08
 
 - This is the closest match (both are delta-sigma, SPI-based)
 
 - However, significant differences exist:
 
    * Different register layout (ADS124S08 has more registers)
 
    * Different command set ADS124S08 has built-in MUX for differential
inputs
     * Different register addressing and bit fields and conversion 
timing and data retrieval.
 
would require extensive conditional code paths that might reduce
maintainability for both devices. A separate, focused driver 
seemed cleaner.

Changes in v2
=============
Driver improvements:
- Fixed all register bit definitions to use field values with FIELD_PREP/FIELD_GET
- Moved DMA buffer to end of struct with proper alignment
- Added comprehensive comments for mutex protection
- Used regmap framework for register access
- Added all 15 channels (differential, single-ended, diagnostic)
- Used guard(mutex) and cleanup.h for lock management
- Used devm_mutex_init() for proper resource management
- Fixed error handling with dev_err_probe() throughout
- Removed redundant state variables (gain, datarate cached in regmap)
- Used sign_extend32() and get_unaligned_be16() for data parsing
- Split SPI transfers for cleaner command/data separation
- Added GPL-2.0-only license identifier

Device tree binding improvements:
- Added required avdd-supply property
- Added optional vref-supply for external reference
- Added interrupts and interrupt-names for DRDY pins
- Added optional clocks property for external clock
- Added ti,avdd-is-ref boolean flag for AVDD reference selection
- Added complete example with all optional properties
- Added datasheet link in binding description

Changes in v1 (RFC)
===================
- Initial RFC submission

Ajith Anandhan (2):
  dt-bindings: iio: adc: Add TI ADS1120 binding
  iio: adc: Add support for TI ADS1120

 .../bindings/iio/adc/ti,ads1120.yaml          | 110 +++
 MAINTAINERS                                   |   7 +
 drivers/iio/adc/Kconfig                       |  10 +
 drivers/iio/adc/Makefile                      |   1 +
 drivers/iio/adc/ti-ads1120.c                  | 631 ++++++++++++++++++
 5 files changed, 759 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/adc/ti,ads1120.yaml
 create mode 100644 drivers/iio/adc/ti-ads1120.c

-- 
2.34.1