Re: [PATCH v2 2/2] iio: adc: add Nuvoton NCT720x ADC driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

> Dear Andy Shevchenko,
> 
> Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> 於 2024年12月4日 週三 下午12:27寫道:
> >
> > On Wed, Dec 04, 2024 at 11:20:20AM +0800, Yu-Hsian Yang wrote:  
> > > Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> 於 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
> >
> >  






[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux