Re: 回复: [DMARC error] [PATCH v3 3/3] arm64: dts: meson-s4-s905y4-khadas-vim1s: add initial device tree

From: George Stark

Date: Thu Jan 29 2026 - 09:48:43 EST




On 1/26/26 12:35, Nick Xie wrote:
Thanks for the patch. Since you have khadas mail I'm pretty sure you've
had the possibility to test it on the real vim board and I just don't
get it how it works with the voltage table above. The problem is that
pwm is calculated incorrectly in the upstream pwm-meson driver. That
voltage table appeared to be used in early amlogic bl loader and
appropriate pwm is initialized from a table's record. Duty cycle value
is translated to pwm regs correctly. Later when kernel start running
pwm-regulator driver is probed. It reads the pwm regs, calculates back
duty-cyle and search it in the table. Since calculation algos are not
match and the table doesn't contain full range of 0-100% values
regulator driver doesn't find current voltage. In such case regulator
core sets the minimum voltage from the table [1] and the SoC may hang
(depending on board) due to minimum voltage may be too low for the
current frequency SoC uses.

I'm not sure about the PWM issues, but I checked on the real S905Y4 hardware
and it works.

To prove my point: run the kernel with the next patch:

diff --git a/drivers/regulator/pwm-regulator.c b/drivers/regulator/pwm-regulator.c
index 7434b6b22d32..14d2730b21e8 100644
--- a/drivers/regulator/pwm-regulator.c
+++ b/drivers/regulator/pwm-regulator.c
@@ -86,6 +86,9 @@ static int pwm_regulator_set_voltage_sel(struct regulator_dev *rdev,
struct pwm_state pstate;
int ret;

+ dev_info(&rdev->dev, "setting voltage from table: index: %u, uV: %u\n",
+ selector, drvdata->duty_cycle_table[selector].uV);
+
pwm_init_state(drvdata->pwm, &pstate);
pwm_set_relative_duty_cycle(&pstate,
drvdata->duty_cycle_table[selector].dutycycle, 100);

In dmesg there must be a message like "setting voltage from table: index: 36, uV: 689000"
If to take a look at operation points table for s4 in vendor kernels the lowest voltage is 0.769V for 100Mhz
so setting 689000uV even temporary may lead to problems depending on particular hardware.

Or I'm missing something?


There's not-yet-reviewed patch that fixes pwm algo [2]. There's
calculation example in the cover letter.
[1] https://elixir.bootlin.com/linux/v6.19-rc5/source/drivers/regulator/core.c#L1227
[2] https://lkml.iu.edu/2412.3/00826.html

What's the status of such patches?

the patch is ready for review. It's seems like nobody is interested

--

Best regards

George


--
Best regards
George