[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <37d8b0fc-db25-4ce6-89e1-3cd4e447e005@gmail.com>
Date: Mon, 15 Dec 2025 23:20:37 +0530
From: Ajith Anandhan <ajithanandhan0406@...il.com>
To: David Lechner <dlechner@...libre.com>, jic23@...nel.org
Cc: nuno.sa@...log.com, andy@...nel.org, robh@...nel.org, krzk+dt@...nel.org,
conor+dt@...nel.org, linux-iio@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/2] iio: adc: Add support for TI ADS1120
>>
>>
>> Thanks for the pointer.
>>
>> I did look at reg_shift, but it doesn’t fit this device. With .reg_shift = 2, regmap would send only (reg << 2) (e.g. 0x0c for reg 3).
>>
>> The ADS1120 requires the command byte to be CMD | (reg << 2) (e.g. 0x20 | 0x0c = 0x2c for an RREG of reg 3).
>>
>> Similarly,
>>
>> .read_flag_mask would produce reg | mask (e.g. 0x03 | 0x20 = 0x23), which is also not the required format.
>>
>> Unless I’m missing a regmap configuration that can generate (reg << 2) | CMD as a single byte,
>>
>> a custom regmap bus seems necessary here. Please let me know if there is a way to express this with standard regmap-spi.
>>
>>
>>
> Sorry, I didn't read carefully enough. Wouldn't this work though?
>
> .reg_bits = 2,
> .reg_shift = 2,
> .read_flag_mask = 0x20,
> .write_flag_mask = 0x40,
>
>
> Then a read should be 0x20 | ((reg & 0x3) << 2) and a write should be 0x40 | ((reg & 0x3) << 2).
Yes, that works thanks for spelling it out.
I missed the reg_bits interaction earlier.
I’ll drop the custom regmap bus and switch to standard regmap-spi.
Powered by blists - more mailing lists