mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3 0/4] Configure SYR82X regulator modes via device tree
@ 2026-07-23  9:39 Victor Krawiec
  2026-07-23  9:39 ` [PATCH v3 1/4] regulator: dt-bindings: Add fan53555 allowed modes Victor Krawiec
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Victor Krawiec @ 2026-07-23  9:39 UTC (permalink / raw)
  To: lgirdwood, broonie, robh, krzk+dt, conor+dt
  Cc: linux-kernel, devicetree, Victor Krawiec

SYR82X is a regulator that supports two modes of operation:
- Auto-PFM: Allow automatic PFM during light load (default mode)
- Forced PWM

Some boards require to configure forced PWM mode from device tree to keep
the supply ripple within acceptable limits under light load conditions.

SYR82X is a clone of FAN53555 regulator and its configuration is handled by
the fcs,fan53555 driver. All clones of FAN53555 regulator share the same
two mode of operation (Auto-PFM / Forced PWM).

However the implementation in the driver is currently restricted to SYR82X
as it is the only tested hardware. 
---
V1 -> V2:
  - Add missing dt binding property description
  - Naming changes since all clones handled by the fan53555 driver share
    the same two modes
      - dt binding header name changed from silergy,syr82x.h to 
        fcs,fan53555-regulator.h - dt binding header constants changed from
        SYR82X_* to FAN53555_* 
      - fan53555_silergy_map_mode() changed to fan53555_map_mode()
  - More detailed commit descriptions

V2 -> V3:
  - Remove garbage in commit description of first commit and duplicated
    SoB line
 
Victor Krawiec (4):
  regulator: dt-bindings: Add fan53555 allowed modes
  arm64: dts: rk3399-rock-4c-plus: Use device tree bindings constants
    for SYR828 regulator initial mode
  arm64: dts: rockchip: rk3399-hugsun-x99: Update SYR828 regulator
    initial mode to use device tree bindings constants
  regulator: fan53555: Add support for mode operations on Silergy
    devices

 .../bindings/regulator/fcs,fan53555.yaml      |  8 +++++
 .../boot/dts/rockchip/rk3399-hugsun-x99.dts   |  3 +-
 .../boot/dts/rockchip/rk3399-rock-4c-plus.dts |  3 +-
 drivers/regulator/fan53555.c                  | 29 ++++++++++++++++++-
 .../regulator/fcs,fan53555-regulator.h        | 20 +++++++++++++
 5 files changed, 60 insertions(+), 3 deletions(-)
 create mode 100644 include/dt-bindings/regulator/fcs,fan53555-regulator.h


base-commit: 62b9452f5fc4d007f1ea31cfdbb53a96d91e3c66
-- 
2.43.0


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

* [PATCH v3 1/4] regulator: dt-bindings: Add fan53555 allowed modes
  2026-07-23  9:39 [PATCH v3 0/4] Configure SYR82X regulator modes via device tree Victor Krawiec
@ 2026-07-23  9:39 ` Victor Krawiec
  2026-07-28  7:28   ` Krzysztof Kozlowski
  2026-07-23  9:39 ` [PATCH v3 2/4] arm64: dts: rk3399-rock-4c-plus: Use device tree bindings constants for SYR828 regulator initial mode Victor Krawiec
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: Victor Krawiec @ 2026-07-23  9:39 UTC (permalink / raw)
  To: lgirdwood, broonie, robh, krzk+dt, conor+dt
  Cc: linux-kernel, devicetree, Victor Krawiec

Fairchild FAN53555 and its clone from Rockchip, Silergy and TCS support
two modes of operation:
- Auto-PFM: Allow automatic PFM during light load (default mode)
- Forced PWM

Some boards require forced PWM mode to keep the supply ripple within
acceptable limits under light load conditions.

Regulator mode indexes are starting from 1 to keep backward compatibility
with existing device trees

Signed-off-by: Victor Krawiec <victor.krawiec@arturia.com>
---
 .../bindings/regulator/fcs,fan53555.yaml      |  8 ++++++++
 .../regulator/fcs,fan53555-regulator.h        | 20 +++++++++++++++++++
 2 files changed, 28 insertions(+)
 create mode 100644 include/dt-bindings/regulator/fcs,fan53555-regulator.h

diff --git a/Documentation/devicetree/bindings/regulator/fcs,fan53555.yaml b/Documentation/devicetree/bindings/regulator/fcs,fan53555.yaml
index 69bae90fc4b2..9a18891f721e 100644
--- a/Documentation/devicetree/bindings/regulator/fcs,fan53555.yaml
+++ b/Documentation/devicetree/bindings/regulator/fcs,fan53555.yaml
@@ -48,6 +48,12 @@ properties:
       VSEL0 register. When this pin is HIGH, VOUT is set by the VSEL1 register.
     maxItems: 1
 
+  regulator-initial-mode:
+    enum:
+      [ 1, 2 ]
+    description:
+      Defined in include/dt-bindings/regulator/fcs,fan53555-regulator.h
+
 required:
   - compatible
   - reg
@@ -56,6 +62,7 @@ unevaluatedProperties: false
 
 examples:
   - |
+    #include <dt-bindings/regulator/fcs,fan53555-regulator.h>
     i2c {
         #address-cells = <1>;
         #size-cells = <0>;
@@ -68,6 +75,7 @@ examples:
             regulator-max-microvolt = <1800000>;
             vin-supply = <&parent_reg>;
             fcs,suspend-voltage-selector = <1>;
+            regulator-initial-mode = <FAN53555_REGULATOR_MODE_FORCE_PWM>;
         };
     };
 ...
diff --git a/include/dt-bindings/regulator/fcs,fan53555-regulator.h b/include/dt-bindings/regulator/fcs,fan53555-regulator.h
new file mode 100644
index 000000000000..ce3d6c63a0f1
--- /dev/null
+++ b/include/dt-bindings/regulator/fcs,fan53555-regulator.h
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
+/*
+ * Copyright (c) 2026 Arturia - All rights reserved.
+ *
+ * Device Tree binding constants for the FAN53555 PMIC regulator
+ */
+
+#ifndef _DT_BINDINGS_REGULATOR_FAN53555_H
+#define _DT_BINDINGS_REGULATOR_FAN53555_H
+
+/*
+ * Constants to specify regulator modes in device tree for SYR82X regulators
+ * FAN53555_REGULATOR_MODE_FORCE_PWM:	Force fixed PWM mode
+ * FAN53555_REGULATOR_MODE_AUTO:	Allow auto-PFM mode during light load
+ */
+
+#define FAN53555_REGULATOR_MODE_FORCE_PWM	1
+#define FAN53555_REGULATOR_MODE_AUTO		2
+
+#endif

base-commit: 62b9452f5fc4d007f1ea31cfdbb53a96d91e3c66
-- 
2.43.0


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

* [PATCH v3 2/4] arm64: dts: rk3399-rock-4c-plus: Use device tree bindings constants for SYR828 regulator initial mode
  2026-07-23  9:39 [PATCH v3 0/4] Configure SYR82X regulator modes via device tree Victor Krawiec
  2026-07-23  9:39 ` [PATCH v3 1/4] regulator: dt-bindings: Add fan53555 allowed modes Victor Krawiec
@ 2026-07-23  9:39 ` Victor Krawiec
  2026-07-23  9:40 ` [PATCH v3 3/4] arm64: dts: rockchip: rk3399-hugsun-x99: Update SYR828 regulator initial mode to use device tree bindings constants Victor Krawiec
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Victor Krawiec @ 2026-07-23  9:39 UTC (permalink / raw)
  To: lgirdwood, broonie, robh, krzk+dt, conor+dt
  Cc: linux-kernel, devicetree, Victor Krawiec

Prefer using a device tree bindings constant over a hardcoded value

Signed-off-by: Victor Krawiec <victor.krawiec@arturia.com>
---
 arch/arm64/boot/dts/rockchip/rk3399-rock-4c-plus.dts | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rock-4c-plus.dts b/arch/arm64/boot/dts/rockchip/rk3399-rock-4c-plus.dts
index d9ff777b4913..0387172cb470 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-rock-4c-plus.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3399-rock-4c-plus.dts
@@ -7,6 +7,7 @@
 
 /dts-v1/;
 #include <dt-bindings/leds/common.h>
+#include <dt-bindings/regulator/fcs,fan53555-regulator.h>
 #include "rk3399-t.dtsi"
 
 / {
@@ -448,7 +449,7 @@ vdd_gpu: regulator@41 {
 		regulator-always-on;
 		regulator-boot-on;
 		vin-supply = <&vcc5v0_sys>;
-		regulator-initial-mode = <1>; /* 1:force PWM 2:auto */
+		regulator-initial-mode = <FAN53555_REGULATOR_MODE_FORCE_PWM>;
 		regulator-state-mem {
 			regulator-off-in-suspend;
 		};
-- 
2.43.0


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

* [PATCH v3 3/4] arm64: dts: rockchip: rk3399-hugsun-x99: Update SYR828 regulator initial mode to use device tree bindings constants
  2026-07-23  9:39 [PATCH v3 0/4] Configure SYR82X regulator modes via device tree Victor Krawiec
  2026-07-23  9:39 ` [PATCH v3 1/4] regulator: dt-bindings: Add fan53555 allowed modes Victor Krawiec
  2026-07-23  9:39 ` [PATCH v3 2/4] arm64: dts: rk3399-rock-4c-plus: Use device tree bindings constants for SYR828 regulator initial mode Victor Krawiec
@ 2026-07-23  9:40 ` Victor Krawiec
  2026-07-23  9:40 ` [PATCH v3 4/4] regulator: fan53555: Add support for mode operations on Silergy devices Victor Krawiec
  2026-07-28 18:27 ` (subset) [PATCH v3 0/4] Configure SYR82X regulator modes via device tree Mark Brown
  4 siblings, 0 replies; 8+ messages in thread
From: Victor Krawiec @ 2026-07-23  9:40 UTC (permalink / raw)
  To: lgirdwood, broonie, robh, krzk+dt, conor+dt
  Cc: linux-kernel, devicetree, Victor Krawiec

Prefer using a device tree bindings constant over a hardcoded value

Signed-off-by: Victor Krawiec <victor.krawiec@arturia.com>
---
 arch/arm64/boot/dts/rockchip/rk3399-hugsun-x99.dts | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/rockchip/rk3399-hugsun-x99.dts b/arch/arm64/boot/dts/rockchip/rk3399-hugsun-x99.dts
index 352c8efb37e0..a2b7bab63553 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-hugsun-x99.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3399-hugsun-x99.dts
@@ -3,6 +3,7 @@
 #include <dt-bindings/pwm/pwm.h>
 #include <dt-bindings/input/input.h>
 #include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/regulator/fcs,fan53555-regulator.h>
 #include "rk3399.dtsi"
 
 / {
@@ -237,7 +238,7 @@ vdd_gpu: syr828@41 {
 		regulator-always-on;
 		regulator-boot-on;
 		vin-supply = <&vcc_sys>;
-		regulator-initial-mode = <1>;
+		regulator-initial-mode = <FAN53555_REGULATOR_MODE_FORCE_PWM>;
 		regulator-state-mem {
 			regulator-off-in-suspend;
 		};
-- 
2.43.0


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

* [PATCH v3 4/4] regulator: fan53555: Add support for mode operations on Silergy devices
  2026-07-23  9:39 [PATCH v3 0/4] Configure SYR82X regulator modes via device tree Victor Krawiec
                   ` (2 preceding siblings ...)
  2026-07-23  9:40 ` [PATCH v3 3/4] arm64: dts: rockchip: rk3399-hugsun-x99: Update SYR828 regulator initial mode to use device tree bindings constants Victor Krawiec
@ 2026-07-23  9:40 ` Victor Krawiec
  2026-07-28 18:27 ` (subset) [PATCH v3 0/4] Configure SYR82X regulator modes via device tree Mark Brown
  4 siblings, 0 replies; 8+ messages in thread
From: Victor Krawiec @ 2026-07-23  9:40 UTC (permalink / raw)
  To: lgirdwood, broonie, robh, krzk+dt, conor+dt
  Cc: linux-kernel, devicetree, Victor Krawiec

Make the PWM mode configurable from devicetree. Some boards require forced
PWM mode to keep the supply ripple within acceptable limits under light
load conditions

Support is restricted to Silergy manufacturer as it is the only one
currently tested.

Signed-off-by: Victor Krawiec <victor.krawiec@arturia.com>
---
 drivers/regulator/fan53555.c | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/drivers/regulator/fan53555.c b/drivers/regulator/fan53555.c
index c282236959b1..85f46874eb49 100644
--- a/drivers/regulator/fan53555.c
+++ b/drivers/regulator/fan53555.c
@@ -21,6 +21,7 @@
 #include <linux/regulator/machine.h>
 #include <linux/regulator/of_regulator.h>
 #include <linux/slab.h>
+#include <dt-bindings/regulator/fcs,fan53555-regulator.h>
 
 /* Voltage setting */
 #define FAN53555_VSEL0		0x00
@@ -389,6 +390,18 @@ static int rk8602_voltages_setup_rockchip(struct fan53555_device_info *di)
 	return 0;
 }
 
+static inline unsigned int fan53555_map_mode(unsigned int mode)
+{
+	switch (mode) {
+	case FAN53555_REGULATOR_MODE_FORCE_PWM:
+		return REGULATOR_MODE_FAST;
+	case FAN53555_REGULATOR_MODE_AUTO:
+		return REGULATOR_MODE_NORMAL;
+	default:
+		return REGULATOR_MODE_INVALID;
+	}
+}
+
 static int fan53555_voltages_setup_silergy(struct fan53555_device_info *di)
 {
 	/* Init voltage range and step */
@@ -586,6 +599,17 @@ static int fan53555_device_setup(struct fan53555_device_info *di,
 	return ret;
 }
 
+static void fan53555_device_mode_map_setup(struct fan53555_device_info *di)
+{
+	switch (di->vendor) {
+	case FAN53555_VENDOR_SILERGY:
+		di->desc.of_map_mode = fan53555_map_mode;
+		break;
+	default:
+		break;
+	}
+}
+
 static int fan53555_regulator_register(struct fan53555_device_info *di,
 			struct regulator_config *config)
 {
@@ -686,6 +710,10 @@ static int fan53555_regulator_probe(struct i2c_client *client)
 	if (!di)
 		return -ENOMEM;
 
+	di->vendor = (uintptr_t)i2c_get_match_data(client);
+
+	fan53555_device_mode_map_setup(di);
+
 	pdata = dev_get_platdata(&client->dev);
 	if (!pdata)
 		pdata = fan53555_parse_dt(&client->dev, np, &di->desc);
@@ -695,7 +723,6 @@ static int fan53555_regulator_probe(struct i2c_client *client)
 				     "Platform data not found!\n");
 
 	di->regulator = pdata->regulator;
-	di->vendor = (uintptr_t)i2c_get_match_data(client);
 	if (!dev_fwnode(&client->dev)) {
 		/* if no ramp constraint set, get the pdata ramp_delay */
 		if (!di->regulator->constraints.ramp_delay) {
-- 
2.43.0


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

* Re: [PATCH v3 1/4] regulator: dt-bindings: Add fan53555 allowed modes
  2026-07-23  9:39 ` [PATCH v3 1/4] regulator: dt-bindings: Add fan53555 allowed modes Victor Krawiec
@ 2026-07-28  7:28   ` Krzysztof Kozlowski
  2026-07-28  8:56     ` Victor Krawiec
  0 siblings, 1 reply; 8+ messages in thread
From: Krzysztof Kozlowski @ 2026-07-28  7:28 UTC (permalink / raw)
  To: Victor Krawiec
  Cc: lgirdwood, broonie, robh, krzk+dt, conor+dt, linux-kernel, devicetree

On Thu, Jul 23, 2026 at 11:39:58AM +0200, Victor Krawiec wrote:
> Fairchild FAN53555 and its clone from Rockchip, Silergy and TCS support
> two modes of operation:
> - Auto-PFM: Allow automatic PFM during light load (default mode)
> - Forced PWM
> 
> Some boards require forced PWM mode to keep the supply ripple within
> acceptable limits under light load conditions.
> 
> Regulator mode indexes are starting from 1 to keep backward compatibility
> with existing device trees
> 
> Signed-off-by: Victor Krawiec <victor.krawiec@arturia.com>
> ---
>  .../bindings/regulator/fcs,fan53555.yaml      |  8 ++++++++
>  .../regulator/fcs,fan53555-regulator.h        | 20 +++++++++++++++++++

Feedback of Sashiko looks unanswered, so dropping this from Patchwork.

Best regards,
Krzysztof


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

* Re: [PATCH v3 1/4] regulator: dt-bindings: Add fan53555 allowed modes
  2026-07-28  7:28   ` Krzysztof Kozlowski
@ 2026-07-28  8:56     ` Victor Krawiec
  0 siblings, 0 replies; 8+ messages in thread
From: Victor Krawiec @ 2026-07-28  8:56 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: lgirdwood, broonie, robh, krzk+dt, conor+dt, linux-kernel, devicetree

On 7/28/26 09:28, Krzysztof Kozlowski wrote:
> 
> Feedback of Sashiko looks unanswered, so dropping this from Patchwork.
> 
> Best regards,
> Krzysztof
> 

Sorry I didn't know I had to answer to the AI bot. Should I send again the
patch series since it is dropped from Patchwork ?

Anyway here are the answers to the Sashiko review

On 7/23/26 11:53, sashiko-bot@kernel.org wrote:
> New issues:
> - [Medium] The device tree binding introduces the `regulator-initial-mode` property, but the corresponding driver lacks the `.of_map_mode` callback required to use it.

This patch serie includes a commit that adds the `.of_map_mode` callback to
the driver. The callback is added at runtime dynamically depending on the
vendor. Maybe that's why the bot did not notice it. Indeed the driver is
used by several devices clone from different vendors. The `.of_map_mode`
was restricted to Silergy vendor as it is the only vendor I am able to
test.

> - [Low] The patch defines constraints for `regulator-initial-mode` but fails to define constraints for `regulator-allowed-modes`.

According to documentation `regulator-allowed-modes` is the list of
operating modes that software is allowed to configure for the regulator at
run-time. No one has expressed the need to be able to change mode by
software on this regulator for now. The need covered here is to change the
initial mode during regulator init.

> Pre-existing issues:
> - [High] A preexisting bug in `fan53555_set_mode()` corrupts the voltage register when setting `REGULATOR_MODE_NORMAL` on certain vendor variants like RK8602.

For Silergy vendor the `fan53555_set_mode()` writes to the correct register
since `di->mode_reg` is the same as `di->vol_reg`.

> For variants like the RK8602 where mode_reg and vol_reg are distinct
> hardware registers, clearing di->mode_mask (e.g. BIT(6)) in di->vol_reg
> could silently drop the output voltage by 64 steps (400mV). Could this lead
> to severe undervolting and system crashes if a consumer attempts to change
> the mode?

It is true that using `di->vol_reg` in this function seems wrong for
vendors that have distinct registers. However I don't have access to those
devices to test such a change. The submitted patch is perfectly safe as it
ignores the mode change for these untested vendors.

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

* Re: (subset) [PATCH v3 0/4] Configure SYR82X regulator modes via device tree
  2026-07-23  9:39 [PATCH v3 0/4] Configure SYR82X regulator modes via device tree Victor Krawiec
                   ` (3 preceding siblings ...)
  2026-07-23  9:40 ` [PATCH v3 4/4] regulator: fan53555: Add support for mode operations on Silergy devices Victor Krawiec
@ 2026-07-28 18:27 ` Mark Brown
  4 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2026-07-28 18:27 UTC (permalink / raw)
  To: lgirdwood, robh, krzk+dt, conor+dt, Victor Krawiec
  Cc: linux-kernel, devicetree

On Thu, 23 Jul 2026 11:39:57 +0200, Victor Krawiec wrote:
> Configure SYR82X regulator modes via device tree
> 
> SYR82X is a regulator that supports two modes of operation:
> - Auto-PFM: Allow automatic PFM during light load (default mode)
> - Forced PWM
> 
> Some boards require to configure forced PWM mode from device tree to keep
> the supply ripple within acceptable limits under light load conditions.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-7.3

Thanks!

[1/4] regulator: dt-bindings: Add fan53555 allowed modes
      https://git.kernel.org/broonie/regulator/c/bde9b2c351c8
[4/4] regulator: fan53555: Add support for mode operations on Silergy devices
      https://git.kernel.org/broonie/regulator/c/99bc5744e966

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


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

end of thread, other threads:[~2026-07-29 13:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-23  9:39 [PATCH v3 0/4] Configure SYR82X regulator modes via device tree Victor Krawiec
2026-07-23  9:39 ` [PATCH v3 1/4] regulator: dt-bindings: Add fan53555 allowed modes Victor Krawiec
2026-07-28  7:28   ` Krzysztof Kozlowski
2026-07-28  8:56     ` Victor Krawiec
2026-07-23  9:39 ` [PATCH v3 2/4] arm64: dts: rk3399-rock-4c-plus: Use device tree bindings constants for SYR828 regulator initial mode Victor Krawiec
2026-07-23  9:40 ` [PATCH v3 3/4] arm64: dts: rockchip: rk3399-hugsun-x99: Update SYR828 regulator initial mode to use device tree bindings constants Victor Krawiec
2026-07-23  9:40 ` [PATCH v3 4/4] regulator: fan53555: Add support for mode operations on Silergy devices Victor Krawiec
2026-07-28 18:27 ` (subset) [PATCH v3 0/4] Configure SYR82X regulator modes via device tree Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®