enabling a regulator before doing an ADC measurement

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

 



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/ |



[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