From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Petre Rodan <petre.rodan@subdimension.ro>
Cc: Jonathan Cameron <jic23@kernel.org>,
David Lechner <dlechner@baylibre.com>,
Nuno S? <nuno.sa@analog.com>, Andy Shevchenko <andy@kernel.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] iio: pressure: add Honeywell ABP2 driver
Date: Thu, 27 Nov 2025 10:37:13 +0200 [thread overview]
Message-ID: <aSgNuVyyA6AtxtKs@smile.fi.intel.com> (raw)
In-Reply-To: <aSf3RUeghPcC80VG@sunspire.home.arpa>
On Thu, Nov 27, 2025 at 09:01:25AM +0200, Petre Rodan wrote:
> On Tue, Nov 25, 2025 at 12:54:15AM +0200, Andy Shevchenko wrote:
...
> > > > > > So, why can't regmap SPI be used?
> > > > >
> > > > > there are no registers, no memory map, just a 'start conversion' and the
> > > > > equivalent of a 'read conversion' command.
> > > > > any reason one would use the regmap API in this case?
> > > >
> > > > At bare minimum the commit message should have a justification for the choice
> > > > explaining all this.
> > >
> > > I had the justification in the cover letter instead, my bad, will include it in
> > > the commit message instead.
> >
> > It's good to have in both.
> >
> > > > Ideally, try to find a way how to use regmap API. We have several weeks of
> > > > time for this exercise.
> > >
> > > you did not mention why use an API designed for devices with registers and a
> > > memory map on an IC that has neither.
> >
> > The regmap provides several facilities that we would like to use in the drivers:
> > - the generic interface to access to the HW
>
> in general I agree that having bus functions behind an abstraction layer can lead
> to cleaner and less duplicated code in the driver.
>
> however, afaict in this case I still have to use the exact same low level i2c/spi
> accesses and hide them behind a regmap_bus instead of an _ops struct.
> plus there seems to be duct tape to make things seem to be what they are not.
> so the complexity would just go up a notch.
>
> sorry but I feel that this regmap iayer would not be a clean implementation.
> I might change my mind in the future of course.
OK.
> > - the common locking schema that allows to share the same regmap among
> > different drivers (depends on the functionality of the parts of the HW)
>
> is it a good idea for anything external expecting a real regmap to interact with
> a driver that was made to mascarade using one, lock notwithstanding?
> everything about this particular driver is standalone.
>
> > - debugging facilities are available out-of-the-box
>
> in these cases I just use a signal analyzer and compare with the driver's output.
> just out of curiosity, you got any pointers on a non-blocking (asynchronous) bus
> transfer debug facility?
I am not sure I got the question right. The regmap has a trace events for read
and write, so it dumps all data goes on the bus. This is done synchronously and
it blocks for a few microseconds to collect the necessary (binary) date in the
trace buffer. I don't think this affects the timings of the real transfers on
the slow busses like SPI or especially I²C.
> > We have drivers in the kernel with two buffers in the same structure.
>
> yup. some __align twice just like in my example, some __align just once, some use
> a simple buffer placed on the stack with no apparent alignment when sending the
> data.
>
> I've been told during an older review that both buffers need to be aligned due to
> DMA-related requirements.
Correct, and this should be done for the buffers that are subject to DMA, PIO is
fine without that. Consideration of Tx/Rx split varies, indeed. And I'm not sure
that the authors of the drivers fully understand when and what alignment is
required. Jonathan once explained to me why only a single alignment is good and
second is not needed, but I forgot that, can't reproduce right now. It's
available on lore archive somewhere.
> as I mentioned before, in my case the SoC's spi driver always uses PIO mode even
> if DMA is also implemented. so testing my code always works no matter the alignment.
[..]
> > > struct {
> > > u32 chan[2];
> > > aligned_s64 timestamp;
> > > } scan;
> > > + u8 spi_tx_buffer[ABP2_MEASUREMENT_RD_SIZE] __aligned(IIO_DMA_MINALIGN);
> > > u8 buffer[ABP2_MEASUREMENT_RD_SIZE] __aligned(IIO_DMA_MINALIGN);
> > > };
> > You told you read books about C language...
> >
> > Alignment is a property of a single member and a data type in general. Each
> > field of each data type may have it's own (non-default) alignment along with
> > the object alignment.
>
> I have a hard time following this paragraph so I'm forced to use my 'sorry
> English ain't one of my first languages' excuse.
OK. I forgot the context of the above, TBH.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2025-11-27 8:37 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-22 21:42 [PATCH 0/2] iio: pressure: add Honeywell ABP2 driver Petre Rodan
2025-11-22 21:42 ` [PATCH 1/2] dt-bindings: iio: pressure: add honeywell,abp2030pa Petre Rodan
2025-11-23 10:25 ` Krzysztof Kozlowski
2025-11-22 21:42 ` [PATCH 2/2] iio: pressure: add Honeywell ABP2 driver Petre Rodan
2025-11-24 11:48 ` Andy Shevchenko
2025-11-24 17:29 ` Petre Rodan
2025-11-24 18:41 ` Andy Shevchenko
2025-11-24 21:08 ` Petre Rodan
2025-11-24 22:54 ` Andy Shevchenko
2025-11-27 7:01 ` Petre Rodan
2025-11-27 8:37 ` Andy Shevchenko [this message]
2025-12-06 20:29 ` Jonathan Cameron
2025-12-06 20:13 ` 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=aSgNuVyyA6AtxtKs@smile.fi.intel.com \
--to=andriy.shevchenko@intel.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=petre.rodan@subdimension.ro \
--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.