.../devicetree/bindings/iio/adc/ti,ads1118.yaml | 132 +++ MAINTAINERS | 7 + drivers/iio/adc/Kconfig | 12 + drivers/iio/adc/Makefile | 1 + drivers/iio/adc/ti-ads1x18.c | 919 +++++++++++++++++++++ 5 files changed, 1071 insertions(+)
Hi,
This series adds a new driver for TI ADS1X18 SPI devices.
This is my first time contributing to the IIO subsystem and making
dt-bindings documentation, so (don't) go easy on me :p.
As explained in Patch 2 changelog, the DRDY interrupt line is shared
with the MOSI pin. This awkward quirk is also found on some Analog
Devices sigma-delta SPI ADCs, so the interrupt and trigger design is
inspired by those.
Thank you in advance for your reviews.
Signed-off-by: Kurt Borja <kuurtb@gmail.com>
---
Kurt Borja (2):
dt-bindings: iio: adc: Add TI ADS1018/ADS1118
iio: adc: Add ti-ads1x18 driver
.../devicetree/bindings/iio/adc/ti,ads1118.yaml | 132 +++
MAINTAINERS | 7 +
drivers/iio/adc/Kconfig | 12 +
drivers/iio/adc/Makefile | 1 +
drivers/iio/adc/ti-ads1x18.c | 919 +++++++++++++++++++++
5 files changed, 1071 insertions(+)
---
base-commit: f9e05791642810a0cf6237d39fafd6fec5e0b4bb
change-id: 20251012-ads1x18-0d0779d06690
--
~ Kurt
On 11/21/25 11:16 AM, Kurt Borja wrote: > Hi, > > This series adds a new driver for TI ADS1X18 SPI devices. > > This is my first time contributing to the IIO subsystem and making > dt-bindings documentation, so (don't) go easy on me :p. I actually had these parts on my radar, so happy to help you out. Unfortunately, I don't have the hardware for testing though. The first thing I was going to do was check the existing drivers to make sure that there isn't one already that has a compatible register layout. I have a feeling we won't find one, but would be good to mention that in the cover to justify adding a new driver. There are a couple of similar TI ADCs on the mailing list right now, but they are IMHO just slightly too different to share a driver, but would be good to look at just to make things are consistent on a high level. > > As explained in Patch 2 changelog, the DRDY interrupt line is shared > with the MOSI pin. This awkward quirk is also found on some Analog > Devices sigma-delta SPI ADCs, so the interrupt and trigger design is > inspired by those. Yup, that seems to be the best way we know how to handle this.
Hi David,
On Fri Nov 21, 2025 at 5:32 PM -05, David Lechner wrote:
> On 11/21/25 11:16 AM, Kurt Borja wrote:
>> Hi,
>>
>> This series adds a new driver for TI ADS1X18 SPI devices.
>>
>> This is my first time contributing to the IIO subsystem and making
>> dt-bindings documentation, so (don't) go easy on me :p.
>
> I actually had these parts on my radar, so happy to help you out.
> Unfortunately, I don't have the hardware for testing though.
>
> The first thing I was going to do was check the existing drivers
> to make sure that there isn't one already that has a compatible
> register layout. I have a feeling we won't find one, but would be
> good to mention that in the cover to justify adding a new driver.
The closest driver I could find was the ti-ads1015 I2C driver. It has
the same register map and similar specs. Although I think we can adapt
it to be "compatible", I chose to do a different driver for a few
reasons:
- ads1015 and compatible devices have a separate DRDY interrupt line.
- The ti-ads1015 driver doesn't support the DRDY interrupt (sleeps
until data is ready and it doesn't have an iio_trigger).
- To correctly handle the DOUT/DRDY line we need to manually control
the spi_bus_lock. And we do it differently based on which IIO device
mode we are operating on, so it would be difficult to stuff this
logic into regmap_bus callbacks alone.
- IMO the end result of merging these drivers would be too messy.
This is just my opinion though, so let me know what you think. If do
agree I will add some of this points in the patch changelog!
>
> There are a couple of similar TI ADCs on the mailing list right
> now, but they are IMHO just slightly too different to share a
> driver, but would be good to look at just to make things are
> consistent on a high level.
Yes, the other two TI ADCs, ADS1120 and ADS131M02 are very different
devices.
>
>>
>> As explained in Patch 2 changelog, the DRDY interrupt line is shared
>> with the MOSI pin. This awkward quirk is also found on some Analog
>> Devices sigma-delta SPI ADCs, so the interrupt and trigger design is
>> inspired by those.
>
> Yup, that seems to be the best way we know how to handle this.
--
~ Kurt
On 11/21/25 5:28 PM, Kurt Borja wrote: > Hi David, > > On Fri Nov 21, 2025 at 5:32 PM -05, David Lechner wrote: >> On 11/21/25 11:16 AM, Kurt Borja wrote: >>> Hi, >>> >>> This series adds a new driver for TI ADS1X18 SPI devices. >>> >>> This is my first time contributing to the IIO subsystem and making >>> dt-bindings documentation, so (don't) go easy on me :p. >> >> I actually had these parts on my radar, so happy to help you out. >> Unfortunately, I don't have the hardware for testing though. >> >> The first thing I was going to do was check the existing drivers >> to make sure that there isn't one already that has a compatible >> register layout. I have a feeling we won't find one, but would be >> good to mention that in the cover to justify adding a new driver. > > The closest driver I could find was the ti-ads1015 I2C driver. It has > the same register map and similar specs. Although I think we can adapt > it to be "compatible", I chose to do a different driver for a few > reasons: > > - ads1015 and compatible devices have a separate DRDY interrupt line. > > - The ti-ads1015 driver doesn't support the DRDY interrupt (sleeps > until data is ready and it doesn't have an iio_trigger). I don't think this one is a big deal. Ideally, eventually both drivers would support operating both with and without interrupts. > > - To correctly handle the DOUT/DRDY line we need to manually control > the spi_bus_lock. And we do it differently based on which IIO device > mode we are operating on, so it would be difficult to stuff this > logic into regmap_bus callbacks alone. > > - IMO the end result of merging these drivers would be too messy. This one I agree with 100%, but for different reasons. ads1015 is I2C and ads1018 is SPI _and_ regmap is not a good fit for either of these. Mostly because when reading sample data, we need a custom SPI message to read the data and write the setup for the next conversion at the same time. And ads1018 only has 1 register anyway that isn't 100% identical to the same register in ads1015. > > This is just my opinion though, so let me know what you think. If do > agree I will add some of this points in the patch changelog! > In the end, we both have the same conclusion.
© 2016 - 2025 Red Hat, Inc.