devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* enabling a regulator before doing an ADC measurement
@ 2020-02-19 10:32 Uwe Kleine-König
  2020-02-21 10:15 ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: Uwe Kleine-König @ 2020-02-19 10:32 UTC (permalink / raw)
  To: Jonathan Cameron, Rob Herring, Frank Rowand
  Cc: kernel, Geert Uytterhoeven, linux-iio, devicetree

Hello,

I have a hardware setup that looks as follows:

                                ,-------------------.
 ,---------.       ,---/ -------| current-regulator |
 |  ADC    |       |            `-------------------'
 |      CH0--------+
 |         |       |
 `.........'    ,-----.
                |PT100|
		`-----'
		   |
		   ⏚

So the idea is that I enable the regulator and then measure the adc's
input to determine the resistance of the PT100 and so its temperature.

I wonder if/how I should represent that in my device's device tree. I
discussed this already a bit with Geert on irc and he came up with
something like:

	adc {
		...
		channel@0 {
			reg = <0>;
			supply = <&myregulator>;
		};
	};

with the intention that the adc driver enables myregulator before
starting a measurement on channel 0.

Does this sound sensible? Does something like this maybe even already
exist and I missed it?

What is a bit special here is that usually a regulator is used to supply
a device and it's just enabled at probe time (or when the device is
started to be used) and disabled when done. Here the regulator is
supposed to be enabled only during a measurement[1] to yield the reference
current and doesn't supply a device. So maybe better use another
property name instead of plain "supply", maybe "reference-supply"?

Best regards
Uwe

[1] When the current measurement is done, the regulator must be swiched
off again to not warm up the PT100 and so fudge future measurements.

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

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

end of thread, other threads:[~2020-02-21 10:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-19 10:32 enabling a regulator before doing an ADC measurement Uwe Kleine-König
2020-02-21 10:15 ` Jonathan Cameron

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).