Linux-IIO Archive on lore.kernel.org
 help / color / Atom feed
From: Couret Charles-Antoine <charles-antoine.couret@essensium.com>
To: "Ardelean, Alexandru" <alexandru.Ardelean@analog.com>,
	"andrea.merello@gmail.com" <andrea.merello@gmail.com>,
	"Hennerich, Michael" <Michael.Hennerich@analog.com>,
	"lars@metafoo.de" <lars@metafoo.de>,
	"jic23@kernel.org" <jic23@kernel.org>,
	"pmeerw@pmeerw.net" <pmeerw@pmeerw.net>,
	"knaack.h@gmx.de" <knaack.h@gmx.de>
Cc: "linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>
Subject: Re: [PATCH 0/4] Fixes for ad7949
Date: Fri, 13 Sep 2019 16:00:29 +0200
Message-ID: <2b7ab6c3-6ff6-69b5-bbd4-f8a1966b6b57@essensium.com> (raw)
In-Reply-To: <1f13820761bbdb4db685a90e9bcf35a388b246cf.camel@analog.com>


Le 13/09/2019 à 09:24, Ardelean, Alexandru a écrit :
> On Thu, 2019-09-12 at 16:43 +0200, Andrea Merello wrote:
>> [External]
>>
>> This patch series fixes ad7949 driver incorrectly read data, simplify the
>> code, and enforces device timing constraints.
>>
>> This has been tested on a UltraZed SOM + a custom carrier equipped with
>> several AD7689 A/Ds. Patches have been developed on a Xilinx upstream
>> kernel and then rebased on linux-next kernel.
>>
> Thanks for the patches.
> Added Charles-Antoine to also take a look.
> Apologies for not thinking of adding him sooner.
>
> I typically try to review changes for ADI parts, but he wrote it, so he may have more input than I do.
> Jonathan will likely also take a look.
>
> If it's agreed, I would say to at least take the first patch ("iio: ad7949: kill pointless "readback"-handling code")
> now and see about the rest.
> The rest are a bit more open to discussion, so a v2 may happen.

Hi,

Don't worry. Due to the fact I don't have on my mail client access to 
the whole discussions, I'm making a complete answer there based on the 
archive of the mailing list. Sorry for that.


For the patch 1, I approve it too. This part of code is useless because 
the feature was removed. RIP my code. :D

For the patch 2, the cache information was added due to comment from 
Jonathan Cameron when I developed the driver. The comment was:

> Look very carefully at the requirements for a buffer being passed
> to spi_sync.  It needs to be DMA safe.  This one is not.  The usual
> way to do that easily is to put a cacheline aligned buffer in your
> ad7949_adc_chip structure.
>
> Lots of examples to copy, but it's also worth making sure you understand
> why this is necessary.

For the endianess thing, it shouldn't be required to make an explicit 
conversion into the driver. According to the spi.h documentation:

> * In-memory data values are always in native CPU byte order, translated
> * from the wire byte order (big-endian except with SPI_LSB_FIRST). So
> * for example when bits_per_word is sixteen, buffers are 2N bytes long
> * (@len = 2N) and hold N sixteen bit words in CPU byte order.
So from my point of view the SPI subsystem always converts to the right 
endianess. We don't have to take care about it.


For patch 3, I didn't use delay_usecs fiels due to the timings 
definition in the datasheet in "READ/WRITE SPANNING CONVERSION WITHOUT A 
BUSY INDICATOR" mode. During the delay, the chip select line must be 
released which is not the case when we use delay_usecs field. So I add 
the delay instruction after the write step to be compliant with these 
timings.


For patch 4, I explained a bit in the other thread. Maybe we have a 
difference of behaviour due to the choice of the timings "modes"?


BTW, from my point of view the datasheet is not totally clear about the 
timings and what is mandatory or not in the expected behaviour.

Regards,

Charles-Antoine Couret


  reply index

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-12 14:43 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-09-13  7:24 ` [PATCH 0/4] Fixes for ad7949 Ardelean, Alexandru
2019-09-13 14:00   ` Couret Charles-Antoine [this message]
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 publically 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=2b7ab6c3-6ff6-69b5-bbd4-f8a1966b6b57@essensium.com \
    --to=charles-antoine.couret@essensium.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 \
    /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

Linux-IIO Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-iio/0 linux-iio/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-iio linux-iio/ https://lore.kernel.org/linux-iio \
		linux-iio@vger.kernel.org linux-iio@archiver.kernel.org
	public-inbox-index linux-iio

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-iio


AGPL code for this site: git clone https://public-inbox.org/ public-inbox