mbox series

[0/4] mfd: rn5t618: Extend ADC support

Message ID 20210703084224.31623-1-andreas@kemnade.info (mailing list archive)
Headers show
Series mfd: rn5t618: Extend ADC support | expand

Message

Andreas Kemnade July 3, 2021, 8:42 a.m. UTC
Add devicetree support so that consumers can reference the channels
via devicetree, especially the power subdevice can make use of that
to provide voltage_now properties.

Andreas Kemnade (4):
  dt-bindings: mfd: ricoh,rn5t618: ADC related nodes and properties
  mfd: rn5t618: Add of compatibles for ADC and power
  iio: rn5t618: Add devicetree support
  power: supply: rn5t618: Add voltage_now property

 .../bindings/mfd/ricoh,rn5t618.yaml           | 53 ++++++++++++++++++
 drivers/iio/adc/rn5t618-adc.c                 | 14 ++++-
 drivers/mfd/rn5t618.c                         |  6 +-
 drivers/power/supply/rn5t618_power.c          | 56 +++++++++++++++++++
 4 files changed, 126 insertions(+), 3 deletions(-)

Comments

Jonathan Cameron July 3, 2021, 3:59 p.m. UTC | #1
On Sat,  3 Jul 2021 10:42:20 +0200
Andreas Kemnade <andreas@kemnade.info> wrote:

> Add devicetree support so that consumers can reference the channels
> via devicetree, especially the power subdevice can make use of that
> to provide voltage_now properties.

Does the mapping vary from board to board?  Often these mappings are
internal to the chip so might as well be provided hard coded in the
relevant drivers rather than via DT. See drivers that have iio_map
structure arrays.

> 
> Andreas Kemnade (4):
>   dt-bindings: mfd: ricoh,rn5t618: ADC related nodes and properties
>   mfd: rn5t618: Add of compatibles for ADC and power
>   iio: rn5t618: Add devicetree support
>   power: supply: rn5t618: Add voltage_now property
> 
>  .../bindings/mfd/ricoh,rn5t618.yaml           | 53 ++++++++++++++++++
>  drivers/iio/adc/rn5t618-adc.c                 | 14 ++++-
>  drivers/mfd/rn5t618.c                         |  6 +-
>  drivers/power/supply/rn5t618_power.c          | 56 +++++++++++++++++++
>  4 files changed, 126 insertions(+), 3 deletions(-)
>
Andreas Kemnade July 3, 2021, 4:39 p.m. UTC | #2
Hi,

On Sat, 3 Jul 2021 16:59:50 +0100
Jonathan Cameron <jic23@kernel.org> wrote:

> On Sat,  3 Jul 2021 10:42:20 +0200
> Andreas Kemnade <andreas@kemnade.info> wrote:
> 
> > Add devicetree support so that consumers can reference the channels
> > via devicetree, especially the power subdevice can make use of that
> > to provide voltage_now properties.  
> 
> Does the mapping vary from board to board?  Often these mappings are
> internal to the chip so might as well be provided hard coded in the
> relevant drivers rather than via DT. See drivers that have iio_map
> structure arrays.
> 
Most things are internal to the chip, but 
AIN1/AIN0 are external and could be connected to anything.

Regards,
Andreas
Andreas Kemnade July 3, 2021, 4:55 p.m. UTC | #3
On Sat, 3 Jul 2021 18:39:40 +0200
Andreas Kemnade <andreas@kemnade.info> wrote:

> Hi,
> 
> On Sat, 3 Jul 2021 16:59:50 +0100
> Jonathan Cameron <jic23@kernel.org> wrote:
> 
> > On Sat,  3 Jul 2021 10:42:20 +0200
> > Andreas Kemnade <andreas@kemnade.info> wrote:
> >   
> > > Add devicetree support so that consumers can reference the channels
> > > via devicetree, especially the power subdevice can make use of that
> > > to provide voltage_now properties.    
> > 
> > Does the mapping vary from board to board?  Often these mappings are
> > internal to the chip so might as well be provided hard coded in the
> > relevant drivers rather than via DT. See drivers that have iio_map
> > structure arrays.
> >   
> Most things are internal to the chip, but 
> AIN1/AIN0 are external and could be connected to anything.
> 
hmm, iio_map stuff looks nice, so before messing with devicetree,
I could solve 90% of the problem by just using iio_map? For my use
cases it is enough to have the internal stuff at the moment. That would
simplify stuff a lot.

So I could go forward with the iio_map stuff now, and if there is a use
case for AIN1/0, the devicetree stuff can be added later?

Regards,
Andreas
Jonathan Cameron July 4, 2021, 4:10 p.m. UTC | #4
On Sat, 3 Jul 2021 18:55:40 +0200
Andreas Kemnade <andreas@kemnade.info> wrote:

> On Sat, 3 Jul 2021 18:39:40 +0200
> Andreas Kemnade <andreas@kemnade.info> wrote:
> 
> > Hi,
> > 
> > On Sat, 3 Jul 2021 16:59:50 +0100
> > Jonathan Cameron <jic23@kernel.org> wrote:
> >   
> > > On Sat,  3 Jul 2021 10:42:20 +0200
> > > Andreas Kemnade <andreas@kemnade.info> wrote:
> > >     
> > > > Add devicetree support so that consumers can reference the channels
> > > > via devicetree, especially the power subdevice can make use of that
> > > > to provide voltage_now properties.      
> > > 
> > > Does the mapping vary from board to board?  Often these mappings are
> > > internal to the chip so might as well be provided hard coded in the
> > > relevant drivers rather than via DT. See drivers that have iio_map
> > > structure arrays.
> > >     
> > Most things are internal to the chip, but 
> > AIN1/AIN0 are external and could be connected to anything.
> >   
> hmm, iio_map stuff looks nice, so before messing with devicetree,
> I could solve 90% of the problem by just using iio_map? For my use
> cases it is enough to have the internal stuff at the moment. That would
> simplify stuff a lot.
> 
> So I could go forward with the iio_map stuff now, and if there is a use
> case for AIN1/0, the devicetree stuff can be added later?

I was just thinking the same.  I 'think' that it will first try to find
a mapping via device tree and then use the iio_map stuff.

So you can probably get away with a mixture of the two.
Worth testing that works though (hook up iio-hwmon to AIN0 perhaps whilst
also using the iio_map approach).

I might be completely wrong though and am not aware of anyone currently
doing this...

Jonathan

> 
> Regards,
> Andreas
Andreas Kemnade July 5, 2021, 11:18 a.m. UTC | #5
On Sun, 4 Jul 2021 17:10:23 +0100
Jonathan Cameron <jic23@kernel.org> wrote:

> On Sat, 3 Jul 2021 18:55:40 +0200
> Andreas Kemnade <andreas@kemnade.info> wrote:
> 
> > On Sat, 3 Jul 2021 18:39:40 +0200
> > Andreas Kemnade <andreas@kemnade.info> wrote:
> >   
> > > Hi,
> > > 
> > > On Sat, 3 Jul 2021 16:59:50 +0100
> > > Jonathan Cameron <jic23@kernel.org> wrote:
> > >     
> > > > On Sat,  3 Jul 2021 10:42:20 +0200
> > > > Andreas Kemnade <andreas@kemnade.info> wrote:
> > > >       
> > > > > Add devicetree support so that consumers can reference the channels
> > > > > via devicetree, especially the power subdevice can make use of that
> > > > > to provide voltage_now properties.        
> > > > 
> > > > Does the mapping vary from board to board?  Often these mappings are
> > > > internal to the chip so might as well be provided hard coded in the
> > > > relevant drivers rather than via DT. See drivers that have iio_map
> > > > structure arrays.
> > > >       
> > > Most things are internal to the chip, but 
> > > AIN1/AIN0 are external and could be connected to anything.
> > >     
> > hmm, iio_map stuff looks nice, so before messing with devicetree,
> > I could solve 90% of the problem by just using iio_map? For my use
> > cases it is enough to have the internal stuff at the moment. That would
> > simplify stuff a lot.
> > 
> > So I could go forward with the iio_map stuff now, and if there is a use
> > case for AIN1/0, the devicetree stuff can be added later?  
> 
> I was just thinking the same.  I 'think' that it will first try to find
> a mapping via device tree and then use the iio_map stuff.
> 
> So you can probably get away with a mixture of the two.
> Worth testing that works though (hook up iio-hwmon to AIN0 perhaps whilst
> also using the iio_map approach).
> 
> I might be completely wrong though and am not aware of anyone currently
> doing this...
> 
I tested that approach, It works, so I will first post a series with
just the iio_map stuff and later the devicetree stuff.

Regards,
Andreas