From: Couret Charles-Antoine <charles-antoine.couret@essensium.com>
To: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
Cc: Andrea Merello <andrea.merello@gmail.com>,
jic23@kernel.org,
Alexandru Ardelean <alexandru.Ardelean@analog.com>,
Michael Hennerich <Michael.Hennerich@analog.com>,
Lars-Peter Clausen <lars@metafoo.de>,
Stefan Popa <stefan.popa@analog.com>,
Hartmut Knaack <knaack.h@gmx.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
linux-iio@vger.kernel.org
Subject: Re: [v2] iio: ad7949: fix channels mixups
Date: Wed, 4 Dec 2019 12:13:03 +0100 [thread overview]
Message-ID: <13a71c7e-678c-cffa-ae43-104918f88265@essensium.com> (raw)
In-Reply-To: <20191204110659.00004987@Huawei.com>
Le 04/12/2019 à 12:06, Jonathan Cameron a écrit :
> On Mon, 2 Dec 2019 16:36:19 +0100
> Couret Charles-Antoine <charles-antoine.couret@essensium.com> wrote:
>
>> Le 02/12/2019 à 15:13, Andrea Merello a écrit :
>>> drivers/iio/adc/ad7949.c | 22 +++++++++++++++++-----
>>> 1 file changed, 17 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/drivers/iio/adc/ad7949.c b/drivers/iio/adc/ad7949.c
>>> index 5c2b3446fa4a..2c6f60edb7ce 100644
>>> --- a/drivers/iio/adc/ad7949.c
>>> +++ b/drivers/iio/adc/ad7949.c
>>> @@ -89,6 +89,7 @@ static int ad7949_spi_read_channel(struct ad7949_adc_chip *ad7949_adc, int *val,
>>> unsigned int channel)
>>> {
>>> int ret;
>>> + int i;
>>> int bits_per_word = ad7949_adc->resolution;
>>> int mask = GENMASK(ad7949_adc->resolution, 0);
>>> struct spi_message msg;
>>> @@ -100,12 +101,23 @@ static int ad7949_spi_read_channel(struct ad7949_adc_chip *ad7949_adc, int *val,
>>> },
>>> };
>>>
>>> - ret = ad7949_spi_write_cfg(ad7949_adc,
>>> - channel << AD7949_OFFSET_CHANNEL_SEL,
>>> - AD7949_MASK_CHANNEL_SEL);
>>> - if (ret)
>>> - return ret;
>>> + /*
>>> + * 1: write CFG for sample N and read old data (sample N-2)
>>> + * 2: if CFG was not changed since sample N-1 then we'll get good data
>>> + * at the next xfer, so we bail out now, otherwise we write something
>>> + * and we read garbage (sample N-1 configuration).
>>> + */
>>> + for (i = 0; i < 2; i++) {
>>> + ret = ad7949_spi_write_cfg(ad7949_adc,
>>> + channel << AD7949_OFFSET_CHANNEL_SEL,
>>> + AD7949_MASK_CHANNEL_SEL);
>>> + if (ret)
>>> + return ret;
>>> + if (channel == ad7949_adc->current_channel)
>>> + break;
>>> + }
>>>
>>> + /* 3: write something and read actual data */
>>> ad7949_adc->buffer = 0;
>>> spi_message_init_with_transfers(&msg, tx, 1);
>>> ret = spi_sync(ad7949_adc->spi, &msg);
>> Signed-off-by: Charles-Antoine Couret <charles-antoine.couret@essensium.com>
> Hi Charles-Antoine,
>
> Why a signed-off-by as opposed to a reviewed-by or similar?
>
> signed-off-by brings some very specific legal implications around Developer
> Certificate of Origin, so is normally just the author plus people involved in
> the path to upstream (maintainers).
Ah sorry, I made the mistake, I wanted to add:
Reviewed-by: Charles-Antoine Couret <charles-antoine.couret@essensium.com>
Regards,
Charles-Antoine COuret
next prev parent reply other threads:[~2019-12-04 11:13 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-12 14:43 [PATCH 0/4] Fixes for ad7949 Andrea Merello
2019-09-12 14:43 ` [PATCH 1/4] iio: ad7949: kill pointless "readback"-handling code Andrea Merello
2019-09-13 6:37 ` Ardelean, Alexandru
2019-09-15 10:26 ` Jonathan Cameron
2019-09-12 14:43 ` [PATCH 2/4] iio: ad7949: fix incorrect SPI xfer len Andrea Merello
2019-09-13 6:46 ` Ardelean, Alexandru
2019-09-13 7:56 ` Andrea Merello
2019-09-13 8:28 ` Ardelean, Alexandru
2019-09-15 10:36 ` Jonathan Cameron
2019-09-16 7:51 ` Ardelean, Alexandru
2019-09-21 17:16 ` Jonathan Cameron
2019-09-12 14:43 ` [PATCH 3/4] iio: ad7949: fix SPI xfer delays Andrea Merello
2019-09-13 6:59 ` Ardelean, Alexandru
2019-09-13 8:23 ` Andrea Merello
2019-09-13 8:43 ` Ardelean, Alexandru
2019-09-12 14:43 ` [PATCH 4/4] iio: ad7949: fix channels mixups Andrea Merello
2019-09-13 7:19 ` Ardelean, Alexandru
2019-09-13 8:30 ` Andrea Merello
2019-09-13 11:30 ` Couret Charles-Antoine
2019-09-13 11:40 ` Andrea Merello
2019-09-20 7:45 ` Andrea Merello
2019-09-21 17:12 ` Jonathan Cameron
2019-09-23 8:21 ` Andrea Merello
2019-10-05 9:55 ` Jonathan Cameron
[not found] ` <CAN8YU5PRO5Y5EeEj2SZGm5XfuKSB1rtS7nKdu6wWxXYDOfexqw@mail.gmail.com>
2019-10-22 8:56 ` Jonathan Cameron
2019-11-04 14:12 ` Andrea Merello
2019-11-09 11:58 ` Jonathan Cameron
2019-11-12 15:09 ` Couret Charles-Antoine
2019-12-02 14:13 ` [v2] " Andrea Merello
2019-12-02 15:36 ` Couret Charles-Antoine
2019-12-04 11:06 ` Jonathan Cameron
2019-12-04 11:13 ` Couret Charles-Antoine [this message]
2019-12-06 16:45 ` Jonathan Cameron
2019-09-13 7:24 ` [PATCH 0/4] Fixes for ad7949 Ardelean, Alexandru
2019-09-13 14:00 ` Couret Charles-Antoine
2019-09-15 10:49 ` Jonathan Cameron
2019-09-16 7:39 ` Andrea Merello
2019-09-16 7:48 ` Ardelean, Alexandru
2019-09-16 7:50 ` Ardelean, Alexandru
2019-09-16 7:34 ` Andrea Merello
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=13a71c7e-678c-cffa-ae43-104918f88265@essensium.com \
--to=charles-antoine.couret@essensium.com \
--cc=Jonathan.Cameron@Huawei.com \
--cc=Michael.Hennerich@analog.com \
--cc=alexandru.Ardelean@analog.com \
--cc=andrea.merello@gmail.com \
--cc=jic23@kernel.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
--cc=stefan.popa@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).