From: Jonathan Cameron <jic23@kernel.org>
To: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Cc: David Lechner <dlechner@baylibre.com>,
Jonathan Santos <Jonathan.Santos@analog.com>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, lars@metafoo.de,
Michael.Hennerich@analog.com, robh@kernel.org,
krzk+dt@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v1 05/15] iio: adc: ad7768-1: set MOSI idle state to high
Date: Sat, 18 Jan 2025 12:09:27 +0000 [thread overview]
Message-ID: <20250118120927.08f21fbc@jic23-huawei> (raw)
In-Reply-To: <Z4UE3p6HCsD8PiGh@debian-BULLSEYE-live-builder-AMD64>
On Mon, 13 Jan 2025 09:19:42 -0300
Marcelo Schmitt <marcelo.schmitt1@gmail.com> wrote:
> On 01/12, Jonathan Cameron wrote:
> > On Fri, 10 Jan 2025 18:56:26 -0300
> > Marcelo Schmitt <marcelo.schmitt1@gmail.com> wrote:
> >
> > > On 01/07, David Lechner wrote:
> > > > On 1/7/25 9:25 AM, Jonathan Santos wrote:
> > > > > All supported parts require that the MOSI line stays high
> > > > > while in idle.
> > > > >
> > > > > Configure SPI controller to set MOSI idle state to high.
> > > > >
> > > > > Fixes: a5f8c7da3dbe ("iio: adc: Add AD7768-1 ADC basic support")
> > > > > Signed-off-by: Jonathan Santos <Jonathan.Santos@analog.com>
> > > > > ---
> > > ...
> > > > > @@ -574,6 +574,15 @@ static int ad7768_probe(struct spi_device *spi)
> > > > > return -ENOMEM;
> > > > >
> > > > > st = iio_priv(indio_dev);
> > > > > + /*
> > > > > + * The ADC SDI line must be kept high when
> > > > > + * data is not being clocked out of the controller.
> > > > > + * Request the SPI controller to make MOSI idle high.
> > > > > + */
> > > > > + spi->mode |= SPI_MOSI_IDLE_HIGH;
> > > > > + ret = spi_setup(spi);
> > > > > + if (ret < 0)
> > > > > + return ret;
> > > > > st->spi = spi;
> > > > >
> > > > > st->vref = devm_regulator_get(&spi->dev, "vref");
> > > >
> > > > Very few SPI controllers currently have the SPI_MOSI_IDLE_HIGH capability flag
> > > > set in Linux right now (whether they actually support it or not), so this could
> > > > break existing users.
> > >
> > > Good point. Maybe only dev_warn() if SPI_MOSI_IDLE_HIGH is not supported?
> > >
> > > >
> > > ...
> > > >
> > > > If we ever do implement a data read of more than 64 bits without toggling CS,
> > > > then we could just set the TX data to be all 0xFF and have the same effect
> > > > without requiring the SPI controller to support SPI_MOSI_IDLE_HIGH.
> > >
> > > One point of having SPI_MOSI_IDLE_HIGH is that the controller may bring MOSI low
> > > between data words of a transfer. I think all transfer words are going to be
> > > either 16 or 24 with the new patches setting bits_per_word in all transfers but
> > > that might still not be enough if eventually the controller is unable to support
> > > those word sizes.
> >
> > Can we make the use of SPI_MOSI_IDLE_HIGH only apply if controller doesn't support
> > what is required to do the transfers in one go?
>
> I think so, but that would require tweaking spi controller drivers since we
> don't know at spi_setup() what transfers will ask for their bits_per_word.
> Not excited with this idea but may try something if that makes it easier to
> support these unusual SPI devices.
I'm confused. Here it is a client driver question I think. That driver knows what
it is asking for. It can query if that word length is supported, if not query
if SPI_MOSI_IDLE_HIGH is possible and if neither fail to probe with suitable
error message.
Jonathan
>
> >
> > > Plus you would have the complication of filling the tx_buf for
> > > all transfers.
> >
> > Wrap that up in a regmap, or read and write functions and that should be easy enough.
> >
> > >
> > > For the part that instigated the development of SPI_MOSI_IDLE_HIGH, the MOSI line
> > > also had to be high in between transfers. The diagrams at AD7768-1 datasheet
> > > page 51 suggest the same would be needed for this chip too.
> >
> > Whilst the datasheet indeed draws lines for that, i doubt it notices except on
> > clock transitions and between transfers the clock won't do anything.
> > If we confirm that the device does notice, then I don't mind limiting the controllers
> > to those with that can ensure it doesn't get set wrong.
> >
> > Jonathan
> >
> >
next prev parent reply other threads:[~2025-01-18 12:09 UTC|newest]
Thread overview: 77+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-07 15:23 [PATCH v1 00/15] iio: adc: ad7768-1: Add features, improvements, and fixes Jonathan Santos
2025-01-07 15:24 ` [PATCH v1 01/15] dt-bindings: iio: adc: ad7768-1: add synchronization over SPI property Jonathan Santos
2025-01-07 23:35 ` David Lechner
2025-01-11 22:34 ` Jonathan Santos
2025-01-12 12:12 ` Jonathan Cameron
2025-01-14 0:18 ` Jonathan Santos
2025-01-14 16:05 ` David Lechner
2025-01-18 11:58 ` Jonathan Cameron
2025-01-12 17:14 ` David Lechner
2025-01-10 21:51 ` Marcelo Schmitt
2025-01-12 12:05 ` Jonathan Cameron
2025-01-14 0:41 ` Jonathan Santos
2025-01-18 12:00 ` Jonathan Cameron
2025-01-07 15:24 ` [PATCH v1 02/15] Documentation: ABI: add wideband filter type to sysfs-bus-iio Jonathan Santos
2025-01-07 23:38 ` David Lechner
2025-01-11 22:50 ` Jonathan Santos
2025-01-12 12:16 ` Jonathan Cameron
2025-01-14 0:44 ` Jonathan Santos
2025-01-12 17:39 ` David Lechner
2025-01-12 17:41 ` David Lechner
2025-01-07 15:24 ` [PATCH v1 03/15] Documentation: ABI: testing: ad7768-1: Add device specific ABI documentation Jonathan Santos
2025-01-07 23:38 ` David Lechner
2025-01-11 23:22 ` Jonathan Santos
2025-01-12 12:20 ` Jonathan Cameron
2025-01-12 13:10 ` Jonathan Cameron
2025-01-14 1:06 ` Jonathan Santos
2025-01-07 15:25 ` [PATCH v1 04/15] iio: adc: ad7768-1: Fix conversion result sign Jonathan Santos
2025-01-07 23:39 ` David Lechner
2025-01-10 21:52 ` Marcelo Schmitt
2025-01-12 0:00 ` Jonathan Santos
2025-01-12 12:22 ` Jonathan Cameron
2025-01-07 15:25 ` [PATCH v1 05/15] iio: adc: ad7768-1: set MOSI idle state to high Jonathan Santos
2025-01-07 23:40 ` David Lechner
2025-01-10 21:56 ` Marcelo Schmitt
2025-01-12 12:30 ` Jonathan Cameron
2025-01-13 12:19 ` Marcelo Schmitt
2025-01-18 12:09 ` Jonathan Cameron [this message]
2025-01-18 13:17 ` Marcelo Schmitt
2025-01-07 15:25 ` [PATCH v1 06/15] iio: adc: ad7768-1: Update reg_read function Jonathan Santos
2025-01-10 21:57 ` Marcelo Schmitt
2025-01-07 15:25 ` [PATCH v1 07/15] iio: adc: ad7768-1: Add reset gpio Jonathan Santos
2025-01-07 23:40 ` David Lechner
2025-01-12 12:35 ` Jonathan Cameron
2025-01-07 15:25 ` [PATCH v1 08/15] iio: adc: ad7768-1: use guard(mutex) to simplify code Jonathan Santos
2025-01-07 23:42 ` David Lechner
2025-01-12 0:26 ` Jonathan Santos
2025-01-07 15:26 ` [PATCH v1 09/15] iio: adc: ad7768-1: Move buffer allocation to a separate function Jonathan Santos
2025-01-10 22:01 ` Marcelo Schmitt
2025-01-12 12:39 ` Jonathan Cameron
2025-01-12 12:40 ` Jonathan Cameron
2025-01-14 1:14 ` Jonathan Santos
2025-01-07 15:26 ` [PATCH v1 10/15] iio: adc: ad7768-1: Add support for variable VCM Jonathan Santos
2025-01-07 23:46 ` David Lechner
2025-01-12 2:37 ` Jonathan Santos
2025-01-12 12:45 ` Jonathan Cameron
2025-01-07 15:26 ` [PATCH v1 11/15] iio: adc: ad7768-1: Add reg_write_masked function Jonathan Santos
2025-01-07 23:46 ` David Lechner
2025-01-10 22:34 ` Marcelo Schmitt
2025-01-12 2:42 ` Jonathan Santos
2025-01-07 15:26 ` [PATCH v1 12/15] iio: adc: ad7768-1: Add GPIO controller support Jonathan Santos
2025-01-07 23:48 ` David Lechner
2025-01-07 15:26 ` [PATCH v1 13/15] iio: adc: ad7768-1: add multiple scan types to support 16-bits mode Jonathan Santos
2025-01-07 23:49 ` David Lechner
2025-01-12 3:21 ` Jonathan Santos
2025-01-12 12:50 ` Jonathan Cameron
2025-01-12 17:51 ` David Lechner
2025-01-07 15:27 ` [PATCH v1 14/15] iio: adc: ad7768-1: add support for Synchronization over SPI Jonathan Santos
2025-01-07 23:50 ` David Lechner
2025-01-12 12:59 ` Jonathan Cameron
2025-01-14 1:27 ` Jonathan Santos
2025-01-07 15:27 ` [PATCH v1 15/15] iio: adc: ad7768-1: add filter type and decimation rate attributes Jonathan Santos
2025-01-07 23:50 ` David Lechner
2025-01-12 13:04 ` Jonathan Cameron
2025-01-14 1:39 ` Jonathan Santos
2025-01-10 22:32 ` Marcelo Schmitt
2025-01-07 23:33 ` [PATCH v1 00/15] iio: adc: ad7768-1: Add features, improvements, and fixes David Lechner
2025-01-11 21:56 ` Jonathan Santos
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=20250118120927.08f21fbc@jic23-huawei \
--to=jic23@kernel.org \
--cc=Jonathan.Santos@analog.com \
--cc=Michael.Hennerich@analog.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=krzk+dt@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo.schmitt1@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox