Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Yu-Hsian Yang <j2anfernee@gmail.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	avifishman70@gmail.com, tmaimon77@gmail.com,
	tali.perry1@gmail.com, venture@google.com, yuenn@google.com,
	benjaminfair@google.com, lars@metafoo.de, robh@kernel.org,
	krzk+dt@kernel.org, conor+dt@kernel.org, nuno.sa@analog.com,
	dlechner@baylibre.com, javier.carrasco.cruz@gmail.com,
	marcelo.schmitt@analog.com, olivier.moysan@foss.st.com,
	mitrutzceclan@gmail.com, tgamblin@baylibre.com,
	matteomartelli3@gmail.com, alisadariana@gmail.com,
	gstols@baylibre.com, thomas.bonnefille@bootlin.com,
	ramona.nechita@analog.com, mike.looijmans@topic.nl,
	chanh@os.amperecomputing.com, KWLIU@nuvoton.com,
	yhyang2@nuvoton.com, openbmc@lists.ozlabs.org,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] iio: adc: add Nuvoton NCT720x ADC driver
Date: Sun, 8 Dec 2024 17:16:42 +0000	[thread overview]
Message-ID: <20241208171642.2bbfa5aa@jic23-huawei> (raw)
In-Reply-To: <CA+4Vgc+HUwbHUWHdCoLVgm7aSMdqOGQZZawU8L8z7hMFop_VxQ@mail.gmail.com>

On Wed, 4 Dec 2024 17:05:19 +0800
Yu-Hsian Yang <j2anfernee@gmail.com> wrote:

> Dear Andy Shevchenko,
> 
> Andy Shevchenko <andriy.shevchenko@linux.intel.com> 於 2024年12月4日 週三 下午12:27寫道:
> >
> > On Wed, Dec 04, 2024 at 11:20:20AM +0800, Yu-Hsian Yang wrote:  
> > > Andy Shevchenko <andriy.shevchenko@linux.intel.com> 於 2024年12月3日 週二 下午9:50寫道:  
> > > > On Tue, Dec 03, 2024 at 05:15:40PM +0800, Eason Yang wrote:  
> >
> > ...
> >  
> > > > Second, why do you need two regmaps? How debugfs is supposed to work on the
> > > > registers that are 16-bit if you access them via 8-bit regmap and vice versa?
> > > >
> > > > Can't you simply use bulk reads/writes when it makes sense and drop 16-bit
> > > > regmap completely?  
> > >
> > > Read VIN info can use word read or byte read, and other registers
> > > should use byte read.
> > >
> > > For a reviewer's comment, If the i2c controller allows word read then the
> > > right thing is to always use it.  
> >
> > But how does this differ to bulk read of two sequential 8-bit offsets?
> > And if there is a difference, shouldn't this be addressed on regmap level for
> > all? Like testing for the supported flags and access registers based on the
> > controller capability and user request.
> >  
> 
> We would explain why we use two regmaps.
> In the beginning, we declare a property read-vin-data-size for user to
> select byte read or word read.
> After discuss with reviewers, we don't need this property.
> So I get rid of this property and take word read vin data first.
> We can't use regmap_bulk_read since the vin data is not sequential.
> 
> For Nuvoton NCT7201/NCT7202 chip,
> Take an example as to Vin1:
> The VIN reading supports Byte read (One Byte) and Word read (Two Byte)
> 
> For Byte read:
> First read Index 00h to get VIN1 MSB, then read Index 0Fh Bit 3~7 to
> get VIN1 LSB.
> Index 0Fh is a shared LSB for all VINs.
> 
> For Word read:
> Read Index 00h and get 2 Byte (VIN1 MSB and VIN1 LSB).

Yeah. This is a really weird device.  2 regmaps is probably
the best option.  The regmap access tables or functions can be used to
avoid the debugfs problem Andy mentioned.

Jonathan

> 
> > --
> > With Best Regards,
> > Andy Shevchenko
> >
> >  


  reply	other threads:[~2024-12-08 17:16 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-03  9:15 [PATCH v2 0/2] iio: adc: add Nuvoton NCT720x ADC driver Eason Yang
2024-12-03  9:15 ` [PATCH v2 1/2] dt-bindings: iio: adc: Add binding for Nuvoton NCT720x ADCs Eason Yang
2024-12-03  9:25   ` Krzysztof Kozlowski
2024-12-04  3:10     ` Yu-Hsian Yang
2024-12-04  7:12       ` Krzysztof Kozlowski
2024-12-04  8:47         ` Yu-Hsian Yang
2024-12-03  9:15 ` [PATCH v2 2/2] iio: adc: add Nuvoton NCT720x ADC driver Eason Yang
2024-12-03 13:50   ` Andy Shevchenko
2024-12-04  3:20     ` Yu-Hsian Yang
2024-12-04  4:27       ` Andy Shevchenko
2024-12-04  9:05         ` Yu-Hsian Yang
2024-12-08 17:16           ` Jonathan Cameron [this message]
2024-12-05 18:22   ` David Lechner
2024-12-05 19:01     ` David Lechner
2024-12-10  5:27       ` Yu-Hsian Yang
2024-12-10  5:20     ` Yu-Hsian Yang
2024-12-08 17:22   ` Jonathan Cameron
2024-12-10  5:38     ` Yu-Hsian Yang
2024-12-10  5:47       ` Yu-Hsian Yang
2024-12-11 18:28         ` Jonathan Cameron
2024-12-11 18:26       ` Jonathan Cameron
2024-12-08 17:47   ` Christophe JAILLET
2024-12-10  5:59     ` Yu-Hsian Yang

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=20241208171642.2bbfa5aa@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=KWLIU@nuvoton.com \
    --cc=alisadariana@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=avifishman70@gmail.com \
    --cc=benjaminfair@google.com \
    --cc=chanh@os.amperecomputing.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=gstols@baylibre.com \
    --cc=j2anfernee@gmail.com \
    --cc=javier.carrasco.cruz@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo.schmitt@analog.com \
    --cc=matteomartelli3@gmail.com \
    --cc=mike.looijmans@topic.nl \
    --cc=mitrutzceclan@gmail.com \
    --cc=nuno.sa@analog.com \
    --cc=olivier.moysan@foss.st.com \
    --cc=openbmc@lists.ozlabs.org \
    --cc=ramona.nechita@analog.com \
    --cc=robh@kernel.org \
    --cc=tali.perry1@gmail.com \
    --cc=tgamblin@baylibre.com \
    --cc=thomas.bonnefille@bootlin.com \
    --cc=tmaimon77@gmail.com \
    --cc=venture@google.com \
    --cc=yhyang2@nuvoton.com \
    --cc=yuenn@google.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