public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: "Miclaus, Antoniu" <Antoniu.Miclaus@analog.com>
Cc: "David Lechner" <dlechner@baylibre.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Hennerich, Michael" <Michael.Hennerich@analog.com>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Sa, Nuno" <Nuno.Sa@analog.com>,
	"Olivier Moysan" <olivier.moysan@foss.st.com>,
	"Uwe Kleine-König" <ukleinek@kernel.org>,
	"Schmitt, Marcelo" <Marcelo.Schmitt@analog.com>,
	"João Paulo Gonçalves" <joao.goncalves@toradex.com>,
	"Mike Looijmans" <mike.looijmans@topic.nl>,
	"Dumitru Ceclan" <mitrutzceclan@gmail.com>,
	"AngeloGioacchino Del Regno"
	<angelogioacchino.delregno@collabora.com>,
	"Alisa-Dariana Roman" <alisadariana@gmail.com>,
	"Cuciurean, Sergiu" <Sergiu.Cuciurean@analog.com>,
	"Bogdan, Dragos" <Dragos.Bogdan@analog.com>,
	"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-pwm@vger.kernel.org" <linux-pwm@vger.kernel.org>
Subject: Re: [PATCH 6/7] iio: adc: ad485x: add ad485x driver
Date: Sat, 5 Oct 2024 18:27:29 +0100	[thread overview]
Message-ID: <20241005182729.014819df@jic23-huawei> (raw)
In-Reply-To: <CY4PR03MB33996A380953651B290EC3839B722@CY4PR03MB3399.namprd03.prod.outlook.com>

On Fri, 4 Oct 2024 14:07:37 +0000
"Miclaus, Antoniu" <Antoniu.Miclaus@analog.com> wrote:

> > On 10/3/24 5:14 AM, Miclaus, Antoniu wrote:  
> > >> On 10/1/24 8:51 AM, Miclaus, Antoniu wrote:  
> > >>>>> Regarding the bulk writes/reads, the msb/mid/lsb registers need to be
> > >>>>> read/write in a specific order and the addresses are not incremental,  
> > >>>>
> > >>>> We have _noinc() variants of regmap accessors.  
> > >>> [Miclaus, Antoniu]
> > >>> I think _noinc() functions read from the same register address so it doesn't
> > >>> apply.
> > >>> I am reading values from multiple register addresses that are not reg_addr,
> > >>> reg_addr+1, reg_addr+2.  
> > >>
> > >> I'm confused by the statement that the registers are not incremental.
> > >>
> > >> For example, this patch defines...
> > >>
> > >> +#define AD485X_REG_CHX_OFFSET_LSB(ch)
> > >> 	AD485X_REG_CHX_OFFSET(ch)
> > >> +#define AD485X_REG_CHX_OFFSET_MID(ch)
> > >> 	(AD485X_REG_CHX_OFFSET_LSB(ch) + 0x01)
> > >> +#define AD485X_REG_CHX_OFFSET_MSB(ch)
> > >> 	(AD485X_REG_CHX_OFFSET_MID(ch) + 0x01)
> > >>
> > >> This looks exactly like reg_addr, reg_addr+1, reg_addr+2 to me.  
> > > Yes you are right. Although I tested with hardware and it seems that the  
> > registers  
> > > are not properly written when using bulk operations. My guess is that  
> > holding CS low during  
> > > the entire transaction might be a possible issue. Any suggestions are  
> > appreciated.
> > 
> > Is ADDR_DIR in SPI_CONFIG_A set to the correct value to match how
> > the regmap is configured for bulk writes?
> > 
> > I had to set this bit for AD4695 which has a similar register map
> > (although on that one I used two regmaps, an 8-bit one and a 16-bit
> > one, instead of doing bulk operations on the 8-bit one).
> >   
> Thanks for the input! I tried your suggested approach: set the ADDR_DIR
> to 1 during probe. Unfortunately, this did not fix the issue. I am still not able
> to perform bulk writes properly to the device.
> 
> For now I will keep the only working version in v2, since there will be
> most probably  other iterations of the this patch series 😊.
I'd definitely like to know what is going on here if you can dig into it.
But if we really get stuck then the code at least needs a comment saying
it is necessary and we aren't sure why.  If we know why and can't change
it then the comment should give that reasoning.

Jonathan

> 
> > >  
> > >>>  
> > >>>>> so I am not sure how the bulk functions fit. On this matter, we will need
> > >>>>> unsigned int (not u8) to store the values read via regmap_read, and in  
> > this  
> > >>>>> case we will need extra casts and assignments to use get_unaligned.  
> > >>>>
> > >>>> --
> > >>>> With Best Regards,
> > >>>> Andy Shevchenko
> > >>>>  
> > >>>  
> > >  
> 


  reply	other threads:[~2024-10-05 17:28 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-23 10:10 [PATCH 0/7] *** Add support for AD485x DAS Family *** Antoniu Miclaus
2024-09-23 10:10 ` [PATCH 1/7] iio: backend: add API for interface get Antoniu Miclaus
2024-09-26  8:40   ` David Lechner
2024-09-26 10:52     ` Nuno Sá
2024-09-28 17:23       ` Jonathan Cameron
2024-09-30  6:46         ` Nuno Sá
2024-09-23 10:10 ` [PATCH 2/7] iio: backend: add support for data size set Antoniu Miclaus
2024-09-23 11:17   ` Andy Shevchenko
2024-09-26  9:10   ` David Lechner
2024-09-28 17:24   ` Jonathan Cameron
2024-09-23 10:10 ` [PATCH 3/7] iio: adc: adi-axi-adc: add interface type Antoniu Miclaus
2024-09-23 10:10 ` [PATCH 4/7] iio: adc: adi-axi-adc: set data format Antoniu Miclaus
2024-09-26  9:08   ` David Lechner
2024-09-23 10:10 ` [PATCH 5/7] dt-bindings: iio: adc: add ad458x Antoniu Miclaus
2024-09-23 21:20   ` Conor Dooley
2024-09-24 13:42   ` David Lechner
2024-09-24 22:32   ` Rob Herring
2024-09-23 10:10 ` [PATCH 6/7] iio: adc: ad485x: add ad485x driver Antoniu Miclaus
2024-09-23 11:43   ` Andy Shevchenko
2024-09-24 16:08   ` kernel test robot
2024-09-26 14:39   ` David Lechner
2024-09-26 15:00     ` Andy Shevchenko
2024-09-28 17:30     ` Jonathan Cameron
2024-09-29 19:21       ` Andy Shevchenko
2024-09-30  7:05       ` Nuno Sá
2024-10-05 17:26         ` Jonathan Cameron
2024-10-11 10:23           ` Nuno Sá
2024-10-12 10:31             ` Jonathan Cameron
2024-09-28 17:47   ` Jonathan Cameron
2024-10-01 11:53     ` Miclaus, Antoniu
2024-10-01 12:54       ` Andy Shevchenko
2024-10-01 13:51         ` Miclaus, Antoniu
2024-10-01 14:08           ` David Lechner
2024-10-03 10:14             ` Miclaus, Antoniu
2024-10-03 10:35               ` Andy Shevchenko
2024-10-03 13:08               ` David Lechner
2024-10-04 14:07                 ` Miclaus, Antoniu
2024-10-05 17:27                   ` Jonathan Cameron [this message]
2024-09-23 10:10 ` [PATCH 7/7] Documentation: ABI: testing: ad485x: add ABI docs Antoniu Miclaus
2024-09-23 11:45   ` Andy Shevchenko
2024-09-28 17:32   ` Jonathan Cameron
2024-09-23 11:14 ` [PATCH 0/7] *** Add support for AD485x DAS Family *** Andy Shevchenko

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=20241005182729.014819df@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=Antoniu.Miclaus@analog.com \
    --cc=Dragos.Bogdan@analog.com \
    --cc=Marcelo.Schmitt@analog.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=Nuno.Sa@analog.com \
    --cc=Sergiu.Cuciurean@analog.com \
    --cc=alisadariana@gmail.com \
    --cc=andy@kernel.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=joao.goncalves@toradex.com \
    --cc=krzk+dt@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=mike.looijmans@topic.nl \
    --cc=mitrutzceclan@gmail.com \
    --cc=olivier.moysan@foss.st.com \
    --cc=robh@kernel.org \
    --cc=ukleinek@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