<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">On Sunday, 7 December 2025 19:48:18 CET Jonathan Cameron wrote:</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> On Tue, 25 Nov 2025 08:37:20 -0800</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> </p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> Guenter Roeck <linux@roeck-us.net> wrote:</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> > On 11/25/25 02:25, H. Nikolaus Schaller wrote:</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> > ...</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> > </p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> > > Another suggestion: what extending the "regulator-fixed",</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> > > "regulator-gpio",</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> > > "regulator-fixed-clock" pattern by some</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> > > "regulator-gpio-iio-dac-current-limiter" driver to make it independent</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> > > of your specific chip?</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> > </p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> > The name is terrible ;-), but that is what I would have suggested as well.</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> > I don't see anything chip specific in this code. If there is a need for</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> > a regulator driver which uses gpio to enable it and a DAC for current</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> > limiting, it should be made generic.</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> </p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> Agreed - something generic is the ideal way to go.</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> </p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> However, before going too far it is worth exploring what are common circuits</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> with these things to identify what parameters we need to describe how the</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> DAC channel is used - e.g is linear scaling enough?  You'll need to that to</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> define a DT binding. If it turns out to be too complex, then fallback to</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> specific compatibles in a generic driver to cover the ones that don't fit</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> with a common scheme.  A similar case we already have is discrete</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> components as analog front ends for ADCs - mostly they fall into a few</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> categories and we have drivers covering those, but some are very odd indeed</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> and for those ones we do have a driver even though they don't have anything</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> to control as such - most extreme case being when it's a non linear analog</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> sensor.</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">> </p>
<br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">I actually did use a modified version of iio-rescale in my downstream code. My </p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">use case includes an OpAmp inverter circuit placed in front of a DAC, and it's </p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">useful for me to be able to describe this in a modular fashion, as two IIO </p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">device tree nodes representing respectively the DAC and the OpAmp circuit </p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">front-end.</p>
<br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">Moreover, the LTM8054 takes a voltage on its CTL pin and infers a current </p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">limit from it. This is also something which could be represented as a sort of </p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">AFE node.</p>
<br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;"> LTM8054 output voltage control:           </p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">+---+ +------------+ +--------------------+</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">|DAC+->Inverter AFE+->Feedback circuit AFE|</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">+---+ +------------+ +--------------------+</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">                                           </p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;"> LTM8054 output current limit control:     </p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">+---+ +--------------------+               </p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">|DAC+->Voltage-controller  |               </p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">+---+ |current limiter AFE |               </p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">      +--------------------+               </p>
<br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">Thanks,</p>
<br /><p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">-- </p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">Romain Gantois, Bootlin</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">Embedded Linux and Kernel engineering</p>
<p style="margin-top:0;margin-bottom:0;margin-left:0;margin-right:0;">https://bootlin.com</p>
<br /></body>
</html>