All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ajith Anandhan <ajithanandhan0406@gmail.com>
To: David Lechner <dlechner@baylibre.com>, jic23@kernel.org
Cc: nuno.sa@analog.com, andy@kernel.org, robh@kernel.org,
	krzk+dt@kernel.org, conor+dt@kernel.org,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] iio: adc: Add support for TI ADS1120
Date: Mon, 15 Dec 2025 23:20:37 +0530	[thread overview]
Message-ID: <37d8b0fc-db25-4ce6-89e1-3cd4e447e005@gmail.com> (raw)
In-Reply-To: <5926ca19-c204-4abc-9e59-86a797b63b5c@baylibre.com>

>>
>>
>> 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.



  reply	other threads:[~2025-12-15 17:50 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-09 14:11 [PATCH v2 0/2] iio: adc: ti-ads1120: Add driver and dt-binding Ajith Anandhan
2025-11-09 14:11 ` [PATCH v2 1/2] dt-bindings: iio: adc: Add TI ADS1120 binding Ajith Anandhan
2025-11-10  7:59   ` Krzysztof Kozlowski
2025-11-15 18:31   ` Jonathan Cameron
2025-11-18  0:19     ` David Lechner
2025-12-15 14:49       ` Ajith Anandhan
2025-12-15 15:58         ` David Lechner
2025-11-09 14:11 ` [PATCH v2 2/2] iio: adc: Add support for TI ADS1120 Ajith Anandhan
2025-11-09 17:03   ` Andy Shevchenko
2025-11-09 17:05     ` Andy Shevchenko
2025-11-10 10:17   ` kernel test robot
2025-11-15 18:45   ` Jonathan Cameron
2025-11-18 14:04   ` David Lechner
2025-12-15 16:13     ` Ajith Anandhan
2025-12-15 16:36       ` David Lechner
2025-12-15 16:49         ` Ajith Anandhan
2025-12-15 17:00           ` Andy Shevchenko
2025-12-15 17:38             ` Ajith Anandhan
2025-12-15 17:42           ` David Lechner
2025-12-15 17:50             ` Ajith Anandhan [this message]
2025-12-21 18:57             ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=37d8b0fc-db25-4ce6-89e1-3cd4e447e005@gmail.com \
    --to=ajithanandhan0406@gmail.com \
    --cc=andy@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.