public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Matti Vaittinen <mazziesaccount@gmail.com>
To: "Lothar Waßmann" <LW@KARO-electronics.de>,
	"Maud Spierings" <maudspierings@gocontroll.com>
Cc: Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 3/5] arm64: dts: freescale: add Ka-Ro Electronics tx8m-1610 COM
Date: Thu, 30 Oct 2025 13:01:52 +0200	[thread overview]
Message-ID: <26fc62bb-3484-4812-b576-6640eef72c49@gmail.com> (raw)
In-Reply-To: <20251030095434.1dc06df2@karo-electronics.de>

On 30/10/2025 10:54, Lothar Waßmann wrote:
> Hi,
> 
> On Wed, 29 Oct 2025 16:35:25 +0100 Maud Spierings wrote:
>> Hi Matti,
>>
>> On 10/29/25 11:05, Matti Vaittinen wrote:
>>> On 29/10/2025 11:48, Lothar Waßmann wrote:
>>>> Hi,
>>>>
>>>> On Wed, 29 Oct 2025 10:42:17 +0200 Matti Vaittinen wrote:
>>>>> On 29/10/2025 09:11, Lothar Waßmann wrote:
>>>>>> Hi,
>>>>>>
>>>>>> On Tue, 28 Oct 2025 14:10:04 +0100 Maud Spierings wrote:
>>>>>>> On 10/28/25 13:42, Maud Spierings wrote:
>>>>>>>> On 10/28/25 13:15, Matti Vaittinen wrote:
>>>>>> [...]
>>>>>>>>> Could/Should this be described using the:
>>>>>>>>> 'rohm,feedback-pull-up-r1-ohms' and
>>>>>>>>> 'rohm,feedback-pull-up-r2-ohms'? If I understand the comment
>>>>>>>>> correctly, that might allow the driver to be able to use correctly
>>>>>>>>> scaled voltages.
>>>>>>>>>
>>>>>>>>> https://elixir.bootlin.com/linux/v6.18-rc1/source/Documentation/
>>>>>>>>> devicetree/bindings/regulator/rohm,bd71837-regulator.yaml#L108
>>>>>>>>

// snip

>>>>>
>>>>> If real voltages aren't matching what is calculated by the driver, then
>>>>> the voltages requested by regulator consumers will cause wrong voltages
>>>>> to be applied. Debug interfaces will also show wrong voltages, and the
>>>>> safety limits set in the device-tree will not be really respected.
>>>>>
>>>>> I think this would be well worth fixing.
>>>>>   
>>>> Before doing the real-life test I did the same calculation that's done
>>>> in the driver to be sure that it will generate the correct values:
>>>> bc 1.07.1
>>>> Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006, 2008, 2012-2017
>>>> Free Software Foundation, Inc.
>>>> This is free software with ABSOLUTELY NO WARRANTY.
>>>> For details type `warranty'.
>>>> fb_uv=0
>>>> r1=2200
>>>> r2=499
>>>> min=800000
>>>> step=10000
>>>> # default voltage without divider
>>>> min+30*step
>>>> 1100000
>>>> min=min-(fb_uv-min)*r2/r1
>>>> step=step*(r1+r2)/r1
>>>> min
>>>> 981454
>>>> step
>>>> 12268
>>>> # default voltage with divider
>>>> min+30*step
>>>> 1349494
>>>>
>>>> Probably we need to use this value rather than the nominal 135000 as
>>>> the target voltage in the DTB.
>>>
>>> Yes. When the driver calculates the voltages which match the actual
>>> voltages, then you should also use the actual voltages in the device-tree.
>>>    
>>

// snip

>>
>> Then setting 1349494 as the actual voltage makes it fully work.
>> Otherwise it complains:
>> buck6: failed to apply 1350000-1350000uV constraint: -EINVAL
>>
>> Final debug output now:
>> [    0.327807] rohm-bd718x7 0-004b: buck6: old range min 800000, step 10000
>> [    0.327813] rohm-bd718x7 0-004b: new range min 981454, step 12268
>> [    0.327819] rohm-bd718x7 0-004b: regulator 'buck6' has FB pull-up
>> configured
>>
>> I will add this fix to the next version of this patchset and include
>> your requested change in the dts.
>>
> Does it also work with min/max settings in the DTS that are taken from
> the designated value +/- 5% tolerance margin, so that the DTS contains
> reasonable values determined by the HW requirements, rather than some
> artificial number that is enforced by the SW behaviour?

I am unsure what you mean by "artificial number that is enforced by the 
SW behaviour"?

As far as I understand, the PMIC operation is altered by modifying the 
feedback-pin voltage, right? So, the HW _really_ outputs something else 
but the 'PMIC nominal voltage'? When this hardware connection to the 
feedback-pin is done, the nominal voltage is never really seen anywhere 
else but the PMIC data-sheet, right?

> E.g.:
> 	regulator-min-microvolts = <(135000 - 6750)>;
> 	regulator-min-microvolts = <(135000 + 6750)>;
> Thus, the nominal value of the voltage is explicitly shown in the DTS
> file.

I don't know why there should be two different min values? Assuming the 
latter should be max - I have no problem seeing a range of allowed 
voltages in constrains - if the hardware can tolerate voltages within 
the range.

In my opinion, the values used should however reflect the _actual_ 
output voltage, taking the effect of the feedback-pin modification into 
account. This is also what using the:
'rohm,feedback-pull-up-r1-ohms'
'rohm,feedback-pull-up-r2-ohms'
and the pull-up voltage property allows one to use.

In general, regulator consumers expect to get the _actual_ voltage the 
regulator outputs, via regulator APIs. Think for example of an ADC 
getting reference voltage from a regulator. If it asks for used voltage 
and gets 1350000uV from the regulator subsystem it will use that to 
calculate the scale. If voltage really is something else, altered by a 
feedback-pin connection, the ADC will be having offset. I don't know if 
voltages reported by the framework matter in your specific use-case - 
but it doesn't mean letting the regulator subsystem use bogus voltages 
is right.

Yours,
	-- Matti

-- 
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~

  reply	other threads:[~2025-10-30 11:01 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-22  7:22 [PATCH v2 0/5] arm64: dts: freescale: add support for the GOcontroll Moduline IV/Mini Maud Spierings via B4 Relay
2025-10-22  7:22 ` [PATCH v2 1/5] dt-bindings: arm: fsl: Add " Maud Spierings via B4 Relay
2025-10-22  7:22 ` [PATCH v2 2/5] arm64: dts: imx8mm: Add pinctrl config definitions Maud Spierings via B4 Relay
2025-10-22  7:22 ` [PATCH v2 3/5] arm64: dts: freescale: add Ka-Ro Electronics tx8m-1610 COM Maud Spierings via B4 Relay
2025-10-28 12:15   ` Matti Vaittinen
2025-10-28 12:42     ` Maud Spierings
2025-10-28 13:10       ` Maud Spierings
2025-10-29  7:11         ` Lothar Waßmann
2025-10-29  8:42           ` Matti Vaittinen
2025-10-29  9:00             ` Maud Spierings
2025-10-29  9:33               ` Matti Vaittinen
2025-10-29  9:48             ` Lothar Waßmann
2025-10-29 10:05               ` Matti Vaittinen
2025-10-29 15:35                 ` Maud Spierings
2025-10-29 15:51                   ` Maud Spierings
2025-10-29 19:04                     ` Matti Vaittinen
2025-10-30  8:54                   ` Lothar Waßmann
2025-10-30 11:01                     ` Matti Vaittinen [this message]
2025-10-30 12:00                       ` Lothar Waßmann
2025-10-31 12:07                         ` Matti Vaittinen
2025-10-30 14:45                     ` Maud Spierings
2025-10-31  5:36                       ` Lothar Waßmann
2025-10-31  7:26                         ` Maud Spierings
2025-10-22  7:22 ` [PATCH v2 4/5] arm64: dts: freescale: Add the GOcontroll Moduline IV Maud Spierings via B4 Relay
2025-10-22  7:57   ` Marc Kleine-Budde
2025-10-22  8:23     ` Maud Spierings
2025-10-22 10:18   ` Maud Spierings
2025-10-22  7:22 ` [PATCH v2 5/5] arm64: dts: freescale: Add the GOcontroll Moduline Mini Maud Spierings via B4 Relay

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=26fc62bb-3484-4812-b576-6640eef72c49@gmail.com \
    --to=mazziesaccount@gmail.com \
    --cc=LW@KARO-electronics.de \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=imx@lists.linux.dev \
    --cc=kernel@pengutronix.de \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maudspierings@gocontroll.com \
    --cc=robh@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox