linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: linux-iio@vger.kernel.org
Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	Jan Kiszka <jan.kiszka@siemens.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Nuno Sa <nuno.sa@analog.com>
Subject: [RFC PATCH 0/4] IIO: Alignment fixes part 4 - bounce buffers for the hard cases.
Date: Sat,  1 May 2021 18:25:11 +0100	[thread overview]
Message-ID: <20210501172515.513486-1-jic23@kernel.org> (raw)

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

I finally got around to do a manual audit of all the calls to
iio_push_to_buffers_with_timestamp() which has the somewhat odd requirements
of:
1. 8 byte alignment of the provided buffer.
2. space for an 8 byte naturally aligned timestamp to be inserted at the
   end.

Unfortunately there were rather a lot of these left, but time to bite the bullet
and clean them up.

As discussed previous in
https://lore.kernel.org/linux-iio/20200920112742.170751-1-jic23@kernel.org/
it is not easy to fix the alignment issue without requiring a bounce buffer.
This final part of the 4 sets of fixes is concerned with the cases where
bounce buffers are the proposed solutions.

In these cases we have hardware that reads a prefix that we wish to
drop. That makes it hard to directly read the data into the correct location.

Rather than implementing bouce buffers in each case, this set provides some
magic in the core to handle them via a new function.
iio_push_to_buffers_with_ts_na() - non aligned

Note this is totally untested as I don't have suitable hardware or emulation.
I can fake something up in the dummy driver or via QEMU but I definitely want
both eyes and testing on this series!

Cc: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Nuno Sa <nuno.sa@analog.com>

Jonathan Cameron (4):
  iio: core: Introduce iio_push_to_buffers_with_ts_na() for non aligned
    case.
  iio: adc: ti-adc108s102: Fix alignment of buffer pushed to iio
    buffers.
  iio: gyro: mpu3050: Fix alignment and size issues with buffers.
  iio: imu: adis16400: Fix buffer alignment requirements.

 drivers/iio/adc/ti-adc108s102.c   | 11 +++++-----
 drivers/iio/gyro/mpu3050-core.c   | 24 ++++++++++-----------
 drivers/iio/imu/adis16400.c       | 20 ++++++++++++-----
 drivers/iio/industrialio-buffer.c | 36 +++++++++++++++++++++++++++++++
 include/linux/iio/buffer.h        |  4 ++++
 include/linux/iio/iio-opaque.h    |  4 ++++
 6 files changed, 76 insertions(+), 23 deletions(-)

-- 
2.31.1


             reply	other threads:[~2021-05-01 17:26 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-01 17:25 Jonathan Cameron [this message]
2021-05-01 17:25 ` [RFC PATCH 1/4] iio: core: Introduce iio_push_to_buffers_with_ts_na() for non aligned case Jonathan Cameron
2021-05-01 19:25   ` Andy Shevchenko
2021-05-01 19:27     ` Andy Shevchenko
2021-05-02 15:37       ` Jonathan Cameron
2021-05-02 15:53     ` Jonathan Cameron
2021-05-02  9:10   ` Sa, Nuno
2021-05-02 16:08     ` Jonathan Cameron
2021-05-03  7:15       ` Sa, Nuno
2021-05-03  7:46         ` Sa, Nuno
2021-05-03 10:34           ` Andy Shevchenko
2021-05-03 10:39           ` Jonathan Cameron
2021-05-03 11:20             ` Sa, Nuno
2021-05-01 17:25 ` [RFC PATCH 2/4] iio: adc: ti-adc108s102: Fix alignment of buffer pushed to iio buffers Jonathan Cameron
2021-05-01 17:25 ` [RFC PATCH 3/4] iio: gyro: mpu3050: Fix alignment and size issues with buffers Jonathan Cameron
2021-05-05 12:58   ` Linus Walleij
2021-05-01 17:25 ` [RFC PATCH 4/4] iio: imu: adis16400: Fix buffer alignment requirements Jonathan Cameron
2021-05-02  8:52   ` Sa, Nuno

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=20210501172515.513486-1-jic23@kernel.org \
    --to=jic23@kernel.org \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=jan.kiszka@siemens.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    /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;
as well as URLs for NNTP newsgroup(s).