linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] iio: adc: Add a current from voltage driver
@ 2020-05-16  2:26 Jonathan Bakker
  2020-05-16  6:28 ` Lars-Peter Clausen
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Bakker @ 2020-05-16  2:26 UTC (permalink / raw)
  To: jic23, knaack.h, lars, pmeerw, robh+dt, linux-iio, linux-kernel,
	devicetree
  Cc: linus.walleij, Jonathan Bakker

In the discussion around adding the GP2A002 light driver, there came
up the question of what to do when a system emulates a current ADC
by using a voltage ADC and a resistor.  Rather than adding it on
a per-driver basis, it was suggested(1) to add a minimal IIO driver
to support this situation.

The new driver is fairly simple - it simply takes a voltage ADC and
a resistor value in ohms exposed as the scale and outputs a current.

It has been tested on a first-gen Galaxy S device which has the above
mentioned GP2A002 chip connected to the voltage ADC resistor complex.

1) https://lore.kernel.org/linux-iio/20200202150843.762c6897@archlinux/

Jonathan Bakker (2):
  dt-bindings: iio: adc: Add binding for current-from-voltage
  iio: adc: Add current-from-voltage driver

 .../iio/adc/linux,current-from-voltage.yaml   |  47 +++++++
 MAINTAINERS                                   |   8 ++
 drivers/iio/adc/Kconfig                       |   9 ++
 drivers/iio/adc/Makefile                      |   1 +
 drivers/iio/adc/current-from-voltage.c        | 123 ++++++++++++++++++
 5 files changed, 188 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/adc/linux,current-from-voltage.yaml
 create mode 100644 drivers/iio/adc/current-from-voltage.c

-- 
2.20.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 0/2] iio: adc: Add a current from voltage driver
  2020-05-16  2:26 [PATCH 0/2] iio: adc: Add a current from voltage driver Jonathan Bakker
@ 2020-05-16  6:28 ` Lars-Peter Clausen
  2020-05-16 15:01   ` Jonathan Bakker
  0 siblings, 1 reply; 3+ messages in thread
From: Lars-Peter Clausen @ 2020-05-16  6:28 UTC (permalink / raw)
  To: Jonathan Bakker, jic23, knaack.h, pmeerw, robh+dt, linux-iio,
	linux-kernel, devicetree
  Cc: linus.walleij

On 5/16/20 4:26 AM, Jonathan Bakker wrote:
> In the discussion around adding the GP2A002 light driver, there came
> up the question of what to do when a system emulates a current ADC
> by using a voltage ADC and a resistor.  Rather than adding it on
> a per-driver basis, it was suggested(1) to add a minimal IIO driver
> to support this situation.
>
> The new driver is fairly simple - it simply takes a voltage ADC and
> a resistor value in ohms exposed as the scale and outputs a current.
>
> It has been tested on a first-gen Galaxy S device which has the above
> mentioned GP2A002 chip connected to the voltage ADC resistor complex.
>
> 1) https://lore.kernel.org/linux-iio/20200202150843.762c6897@archlinux/

Hi,

There is afe/iio-rescale.c, which I think already implements this 
functionality.

- Lars



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 0/2] iio: adc: Add a current from voltage driver
  2020-05-16  6:28 ` Lars-Peter Clausen
@ 2020-05-16 15:01   ` Jonathan Bakker
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Bakker @ 2020-05-16 15:01 UTC (permalink / raw)
  To: Lars-Peter Clausen, jic23, knaack.h, pmeerw, robh+dt, linux-iio,
	linux-kernel, devicetree
  Cc: linus.walleij

Oops, sorry about that, you're absolutely right.  The current-sense-shunt part
of iio-rescale is exactly what I was looking for.

Thanks,
Jonathan

On 2020-05-15 11:28 p.m., Lars-Peter Clausen wrote:
> On 5/16/20 4:26 AM, Jonathan Bakker wrote:
>> In the discussion around adding the GP2A002 light driver, there came
>> up the question of what to do when a system emulates a current ADC
>> by using a voltage ADC and a resistor.  Rather than adding it on
>> a per-driver basis, it was suggested(1) to add a minimal IIO driver
>> to support this situation.
>>
>> The new driver is fairly simple - it simply takes a voltage ADC and
>> a resistor value in ohms exposed as the scale and outputs a current.
>>
>> It has been tested on a first-gen Galaxy S device which has the above
>> mentioned GP2A002 chip connected to the voltage ADC resistor complex.
>>
>> 1) https://lore.kernel.org/linux-iio/20200202150843.762c6897@archlinux/
> 
> Hi,
> 
> There is afe/iio-rescale.c, which I think already implements this functionality.
> 
> - Lars
> 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-05-16 15:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-16  2:26 [PATCH 0/2] iio: adc: Add a current from voltage driver Jonathan Bakker
2020-05-16  6:28 ` Lars-Peter Clausen
2020-05-16 15:01   ` Jonathan Bakker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).