Add Richtek RT5739 switching voltage regulator support
Subsystems (2)
cover Add Richtek RT5739 switching voltage regulator support
From: ChiYuan Huang <[email protected]>
This patch set is to add Richtek RT5739 regulator support.
The RT5739 is a step-down switching voltage regulator that delivers a digitally programmable output from an input voltage supply from 2.5V to 5.5V. The output voltage is programmed through an I2C interface capable of operating up to 3.4MHz.
ChiYuan Huang (2):
dt-bindings: regulator: Add bindings for Richtek RT5739
regulator: Add support for Richtek RT5739 voltage regulator
.../bindings/regulator/richtek,rt5739.yaml | 80 ++++++ drivers/regulator/Kconfig | 13 + drivers/regulator/Makefile | 1 + drivers/regulator/rt5739.c | 290 +++++++++++++++++++++ 4 files changed, 384 insertions(+) create mode 100644 Documentation/devicetree/bindings/regulator/richtek,rt5739.yaml create mode 100644 drivers/regulator/rt5739.c
Signature · 1 line
2.7.4
PATCH 1/2 dt-bindings: regulator: Add bindings for Richtek RT5739
From: ChiYuan Huang <[email protected]>
Add the binding document for Richtek RT5739.
--- .../bindings/regulator/richtek,rt5739.yaml | 80 ++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 Documentation/devicetree/bindings/regulator/richtek,rt5739.yaml
Documentation/devicetree/bindings/regulator/richtek,rt5739.yaml new file +80 -0
@@ -0,0 +1,80 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/regulator/richtek,rt5739.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Richtek RT5739 2.4MHz 3.5A Step-Down Converter + +maintainers: + - ChiYuan Huang <[email protected]> + +description: | + The RT5739 is a step-down switching voltage regulator that delivers a + digitally programmable output from an input voltage supply of 2.5V to 5.5V. + The output voltage is programmed through an I2C interface capable of + operating up to 3.4MHz. + + Using a proprietary architecture with synchronous rectification, the RT5739 + is capable of delivering 3.5A continuously at over 80% efficiency, + maintaining that efficiency at load current as low as 10mA. The regulator + operates at a normal fixed frequency of 2.4MHz, which reduces the value of + the external components. Additional output capacitance can be added to + improve regulation during load transients without affecting stability. + +allOf: + - $ref: regulator.yaml# + +properties: + compatible: + enum: + - richtek,rt5739 + + reg: + maxItems: 1 + + enable-gpios: + maxItems: 1 + + richtek,vsel-active-high: + description: | + If property is present, use the 'VSEL1' register group for buck control. + Else, use the 'VSEL0' register group. This depends on external hardware + 'VSEL' pin connecton. + type: boolean + + regulator-allowed-modes: + description: | + buck allowed operating mode + 0: Auto PFM/PWM mode + 1: Forced PWM mode + maxItems: 2 + items: + enum: [0, 1] + +required: + - compatible + - reg + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + + i2c { + #address-cells = <1>; + #size-cells = <0>; + + regulator@50 { + compatible = "richtek,rt5739"; + reg = <0x50>; + enable-gpios = <&gpio26 1 GPIO_ACTIVE_HIGH>; + richtek,vsel-active-high; + regulator-name = "richtek,rt5739-buck"; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <13000000>; + regulator-allowed-modes = <0 1>; + regulator-boot-on; + }; + };
Signature · 1 line
2.7.4
Mark Brown
maintainerRe: [PATCH 1/2] dt-bindings: regulator: Add bindings for Richtek RT5739
Documentation/devicetree/bindings/regulator/richtek,rt5739.yaml line 44
Quoted 6 lines · On Wed, Feb 15, 2023 at 10:00:56AM +0800, [email protected] wrote:
Documentation/devicetree/bindings/regulator/richtek,rt5739.yaml new file +6
-0+ richtek,vsel-active-high: + description: | + If property is present, use the 'VSEL1' register group for buck control. + Else, use the 'VSEL0' register group. This depends on external hardware + 'VSEL' pin connecton. + type: boolean
I would expect this to be GPIO controlled rather than fixed in the design, at least for some systems? The name suggests it's supposed to control the polarity of a GPIO too. Sadly we don't really have good infrastructure for fixed GPIOs AFAIK... ideally this would be a GPIO and then if we need to hold it high then there would be some binding we could connect to the GPIO that says that. We don't have that though so for now a fixed property might be OK.
Re: [PATCH 1/2] dt-bindings: regulator: Add bindings for Richtek RT5739
Hi,
Mark Brown <[email protected]> 於 2023年2月15日 週三 下午9:03寫道:
Quoted 10 lines · On Wed, Feb 15, 2023 at 10:00:56AM +0800, [email protected] wrote:
Documentation/devicetree/bindings/regulator/richtek,rt5739.yaml line 44
Quoted 7 lines
Documentation/devicetree/bindings/regulator/richtek,rt5739.yaml new file +6
-0+ richtek,vsel-active-high: + description: | + If property is present, use the 'VSEL1' register group for buck control. + Else, use the 'VSEL0' register group. This depends on external hardware + 'VSEL' pin connecton. + type: boolean
Quoted 8 lines
I would expect this to be GPIO controlled rather than fixed in the design, at least for some systems? The name suggests it's supposed to control the polarity of a GPIO too. Sadly we don't really have good infrastructure for fixed GPIOs AFAIK... ideally this would be a GPIO and then if we need to hold it high then there would be some binding we could connect to the GPIO that says that. We don't have that though so for now a fixed property might be OK.
It's most like two phase buck controllers internally. 'Vsel' to control which buck output.
Each phase has its registers (voltage/enable/mode).
The common usage of 'vsel' pin is to connect the pin by SoC suspend/resume pin. This can be used to implement system low power design (like as system awake 0.6V, sleep 0.3V or sleep buck off).
I haven't seen the usage to connect it directly by GPIO.
Re: [PATCH 1/2] dt-bindings: regulator: Add bindings for Richtek RT5739
In reply to [email protected]Quoted 3 lines · On 15/02/2023 03:00, [email protected] wrote:
From: ChiYuan Huang <[email protected]>
Add the binding document for Richtek RT5739.
Subject: drop second/last, redundant "bindings for". The "dt-bindings" prefix is already stating that these are bindings.
Quoted 25 lines
Signed-off-by ChiYuan Huang <[email protected]>--- .../bindings/regulator/richtek,rt5739.yaml | 80 ++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 Documentation/devicetree/bindings/regulator/richtek,rt5739.yamlDocumentation/devicetree/bindings/regulator/richtek,rt5739.yaml new file +12
-0@@ -0,0 +1,80 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/regulator/richtek,rt5739.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Richtek RT5739 2.4MHz 3.5A Step-Down Converter + +maintainers: + - ChiYuan Huang <[email protected]> + +description: |
Documentation/devicetree/bindings/regulator/richtek,rt5739.yaml line 22
Quoted 10 lines
Documentation/devicetree/bindings/regulator/richtek,rt5739.yaml new file +10
-0+ The RT5739 is a step-down switching voltage regulator that delivers a + digitally programmable output from an input voltage supply of 2.5V to 5.5V. + The output voltage is programmed through an I2C interface capable of + operating up to 3.4MHz. + + Using a proprietary architecture with synchronous rectification, the RT5739 + is capable of delivering 3.5A continuously at over 80% efficiency, + maintaining that efficiency at load current as low as 10mA. The regulator + operates at a normal fixed frequency of 2.4MHz, which reduces the value of + the external components.
Can we drop the marketing from kernel? Last part of sentence is not related to this submission at all. The internal frequency also looks unrelated to the topic...
Quoted 22 lines
Additional output capacitance can be added to
Documentation/devicetree/bindings/regulator/richtek,rt5739.yaml new file +21
-0+ improve regulation during load transients without affecting stability. + +allOf: + - $ref: regulator.yaml# + +properties: + compatible: + enum: + - richtek,rt5739 + + reg: + maxItems: 1 + + enable-gpios: + maxItems: 1 + + richtek,vsel-active-high: + description: | + If property is present, use the 'VSEL1' register group for buck control. + Else, use the 'VSEL0' register group. This depends on external hardware + 'VSEL' pin connecton.
Documentation/devicetree/bindings/regulator/richtek,rt5739.yaml line 53
Quoted 10 lines
Documentation/devicetree/bindings/regulator/richtek,rt5739.yaml new file +10
-0+ type: boolean + + regulator-allowed-modes: + description: | + buck allowed operating mode + 0: Auto PFM/PWM mode + 1: Forced PWM mode + maxItems: 2 + items: + enum: [0, 1]
So you always require two items? Thus I wonder what's the point of having it in DT? To skip the property entirely if none of the modes are allowed?
Best regards,
Krzysztof
Re: [PATCH 1/2] dt-bindings: regulator: Add bindings for Richtek RT5739
Quoted 8 lines · Krzysztof Kozlowski
Quoted 3 lines · On 15/02/2023 03:00, [email protected] wrote:
From: ChiYuan Huang <[email protected]>
Add the binding document for Richtek RT5739.
Subject: drop second/last, redundant "bindings for". The "dt-bindings" prefix is already stating that these are bindings.
Then, refine it to "dt-bindings: regulator: Add Richtek RT5739 document"
Quoted 31 lines
Quoted 31 lines
Signed-off-by ChiYuan Huang <[email protected]>--- .../bindings/regulator/richtek,rt5739.yaml | 80 ++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 Documentation/devicetree/bindings/regulator/richtek,rt5739.yamlDocumentation/devicetree/bindings/regulator/richtek,rt5739.yaml new file +18
-0@@ -0,0 +1,80 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/regulator/richtek,rt5739.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Richtek RT5739 2.4MHz 3.5A Step-Down Converter + +maintainers: + - ChiYuan Huang <[email protected]> + +description: | + The RT5739 is a step-down switching voltage regulator that delivers a + digitally programmable output from an input voltage supply of 2.5V to 5.5V. + The output voltage is programmed through an I2C interface capable of + operating up to 3.4MHz. + + Using a proprietary architecture with synchronous rectification, the RT5739
Quoted 9 lines
Documentation/devicetree/bindings/regulator/richtek,rt5739.yaml
Quoted 4 lines
Documentation/devicetree/bindings/regulator/richtek,rt5739.yaml new file +4
-0+ is capable of delivering 3.5A continuously at over 80% efficiency, + maintaining that efficiency at load current as low as 10mA. The regulator + operates at a normal fixed frequency of 2.4MHz, which reduces the value of + the external components.Can we drop the marketing from kernel? Last part of sentence is not related to this submission at all. The internal frequency also looks unrelated to the topic...
Okay, too much marketing text. I'll shorten it and simply describe the function or voltage range only.
Quoted 28 lines
Quoted 28 lines
Additional output capacitance can be added to
Documentation/devicetree/bindings/regulator/richtek,rt5739.yaml new file +27
-0+ improve regulation during load transients without affecting stability. + +allOf: + - $ref: regulator.yaml# + +properties: + compatible: + enum: + - richtek,rt5739 + + reg: + maxItems: 1 + + enable-gpios: + maxItems: 1 + + richtek,vsel-active-high: + description: | + If property is present, use the 'VSEL1' register group for buck control. + Else, use the 'VSEL0' register group. This depends on external hardware + 'VSEL' pin connecton. + type: boolean + + regulator-allowed-modes: + description: | + buck allowed operating mode + 0: Auto PFM/PWM mode
Quoted 9 lines
Documentation/devicetree/bindings/regulator/richtek,rt5739.yaml line 53
Quoted 4 lines
Documentation/devicetree/bindings/regulator/richtek,rt5739.yaml new file +4
-0+ 1: Forced PWM mode + maxItems: 2 + items: + enum: [0, 1]So you always require two items? Thus I wonder what's the point of having it in DT? To skip the property entirely if none of the modes are allowed?
Not always need two. So does it mean no need to describe the 'maxItems' and 'Items'. Keep the description of 'regulator-allowed-modes' to tell the user what the valid value is.
Quoted 4 lines
Best regards,
Krzysztof
Re: [PATCH 1/2] dt-bindings: regulator: Add bindings for Richtek RT5739
Quoted 10 lines · ChiYuan Huang
Quoted 8 lines · Krzysztof Kozlowski
Quoted 3 lines · On 15/02/2023 03:00, [email protected] wrote:
From: ChiYuan Huang <[email protected]>
Add the binding document for Richtek RT5739.
Subject: drop second/last, redundant "bindings for". The "dt-bindings" prefix is already stating that these are bindings.
Then, refine it to "dt-bindings: regulator: Add Richtek RT5739 document"
I propose also to drop "document" - it is also redundant. Can bindings be something else than document?
Quoted 79 lines
Quoted 31 lines
Quoted 31 lines
Signed-off-by ChiYuan Huang <[email protected]>--- .../bindings/regulator/richtek,rt5739.yaml | 80 ++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 Documentation/devicetree/bindings/regulator/richtek,rt5739.yamlDocumentation/devicetree/bindings/regulator/richtek,rt5739.yaml new file +18
-0@@ -0,0 +1,80 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/regulator/richtek,rt5739.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Richtek RT5739 2.4MHz 3.5A Step-Down Converter + +maintainers: + - ChiYuan Huang <[email protected]> + +description: | + The RT5739 is a step-down switching voltage regulator that delivers a + digitally programmable output from an input voltage supply of 2.5V to 5.5V. + The output voltage is programmed through an I2C interface capable of + operating up to 3.4MHz. + + Using a proprietary architecture with synchronous rectification, the RT5739Quoted 9 lines
Documentation/devicetree/bindings/regulator/richtek,rt5739.yaml
Quoted 4 lines
Documentation/devicetree/bindings/regulator/richtek,rt5739.yaml new file +4
-0+ is capable of delivering 3.5A continuously at over 80% efficiency, + maintaining that efficiency at load current as low as 10mA. The regulator + operates at a normal fixed frequency of 2.4MHz, which reduces the value of + the external components.Can we drop the marketing from kernel? Last part of sentence is not related to this submission at all. The internal frequency also looks unrelated to the topic...
Okay, too much marketing text. I'll shorten it and simply describe the function or voltage range only.
Quoted 28 lines
Quoted 28 lines
Additional output capacitance can be added to
Documentation/devicetree/bindings/regulator/richtek,rt5739.yaml new file +27
-0+ improve regulation during load transients without affecting stability. + +allOf: + - $ref: regulator.yaml# + +properties: + compatible: + enum: + - richtek,rt5739 + + reg: + maxItems: 1 + + enable-gpios: + maxItems: 1 + + richtek,vsel-active-high: + description: | + If property is present, use the 'VSEL1' register group for buck control. + Else, use the 'VSEL0' register group. This depends on external hardware + 'VSEL' pin connecton. + type: boolean + + regulator-allowed-modes: + description: | + buck allowed operating mode + 0: Auto PFM/PWM modeQuoted 9 lines
Documentation/devicetree/bindings/regulator/richtek,rt5739.yaml line 53
Quoted 4 lines
Documentation/devicetree/bindings/regulator/richtek,rt5739.yaml new file +4
-0+ 1: Forced PWM mode + maxItems: 2 + items: + enum: [0, 1]So you always require two items? Thus I wonder what's the point of having it in DT? To skip the property entirely if none of the modes are allowed?
Quoted 1 line
Not always need two. So does it mean no need to describe the 'maxItems' and 'Items'.
Your minItems is 2, so you always need two. If you accept one, the add
minItems: 1.
Best regards,
Krzysztof
Re: [PATCH 1/2] dt-bindings: regulator: Add bindings for Richtek RT5739
Quoted 7 lines · Krzysztof Kozlowski
Quoted 6 lines · ChiYuan Huang
Quoted 5 lines · Krzysztof Kozlowski
Quoted 3 lines · On 15/02/2023 03:00, [email protected] wrote:
From: ChiYuan Huang <[email protected]>
Add the binding document for Richtek RT5739.
Quoted 8 lines
Quoted 4 lines
Quoted 3 lines
Subject: drop second/last, redundant "bindings for". The "dt-bindings" prefix is already stating that these are bindings.
Then, refine it to "dt-bindings: regulator: Add Richtek RT5739 document"
I propose also to drop "document" - it is also redundant. Can bindings be something else than document?
Yes, you'r right.
Quoted 80 lines
Quoted 80 lines
Quoted 32 lines
Quoted 32 lines
Signed-off-by ChiYuan Huang <[email protected]>--- .../bindings/regulator/richtek,rt5739.yaml | 80 ++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 Documentation/devicetree/bindings/regulator/richtek,rt5739.yamlDocumentation/devicetree/bindings/regulator/richtek,rt5739.yaml new file +18
-0@@ -0,0 +1,80 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/regulator/richtek,rt5739.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Richtek RT5739 2.4MHz 3.5A Step-Down Converter + +maintainers: + - ChiYuan Huang <[email protected]> + +description: | + The RT5739 is a step-down switching voltage regulator that delivers a + digitally programmable output from an input voltage supply of 2.5V to 5.5V. + The output voltage is programmed through an I2C interface capable of + operating up to 3.4MHz. + + Using a proprietary architecture with synchronous rectification, the RT5739Quoted 9 lines
Documentation/devicetree/bindings/regulator/richtek,rt5739.yaml
Quoted 4 lines
Documentation/devicetree/bindings/regulator/richtek,rt5739.yaml new file +4
-0+ is capable of delivering 3.5A continuously at over 80% efficiency, + maintaining that efficiency at load current as low as 10mA. The regulator + operates at a normal fixed frequency of 2.4MHz, which reduces the value of + the external components.Can we drop the marketing from kernel? Last part of sentence is not related to this submission at all. The internal frequency also looks unrelated to the topic...
Okay, too much marketing text. I'll shorten it and simply describe the function or voltage range only.
Quoted 37 lines
Quoted 22 lines
Additional output capacitance can be added to
Documentation/devicetree/bindings/regulator/richtek,rt5739.yaml new file +21
-0+ improve regulation during load transients without affecting stability. + +allOf: + - $ref: regulator.yaml# + +properties: + compatible: + enum: + - richtek,rt5739 + + reg: + maxItems: 1 + + enable-gpios: + maxItems: 1 + + richtek,vsel-active-high: + description: | + If property is present, use the 'VSEL1' register group for buck control. + Else, use the 'VSEL0' register group. This depends on external hardware + 'VSEL' pin connecton.Documentation/devicetree/bindings/regulator/richtek,rt5739.yaml line 53
Quoted 10 lines
Documentation/devicetree/bindings/regulator/richtek,rt5739.yaml new file +10
-0+ type: boolean + + regulator-allowed-modes: + description: | + buck allowed operating mode + 0: Auto PFM/PWM mode + 1: Forced PWM mode + maxItems: 2 + items: + enum: [0, 1]So you always require two items? Thus I wonder what's the point of having it in DT? To skip the property entirely if none of the modes are allowed?
Quoted 5 lines
Quoted 1 line
Not always need two. So does it mean no need to describe the 'maxItems' and 'Items'.
Your minItems is 2, so you always need two. If you accept one, the add
minItems: 1.
https://elixir.bootlin.com/linux/v6.2-rc8/source/drivers/regulator/of_regulator.c#L198
It seems no need to limit the maxItems. Regulator core will call 'of_map_mode' to check the value. Even the value is repeat.
And for minItems, 'regulator.yaml' already said it's uint32-array. Must be lager than zero, right?
So how about just keep 'items' and remove the 'maxItems'?
Quoted 5 lines
Best regards,
Krzysztof
Re: [PATCH 1/2] dt-bindings: regulator: Add bindings for Richtek RT5739
Quoted 7 lines · ChiYuan Huang
https://elixir.bootlin.com/linux/v6.2-rc8/source/drivers/regulator/of_regulator.c#L198
It seems no need to limit the maxItems. Regulator core will call 'of_map_mode' to check the value. Even the value is repeat.And for minItems, '
regulator.yaml' already said it's uint32-array. Must be lager than zero, right?So how about just keep 'items' and remove the 'maxItems'?
Yeah, go ahead, with that enum, it should be correct..
Best regards,
Krzysztof
PATCH 2/2 regulator: Add support for Richtek RT5739 voltage regulator
In reply to [email protected]From: ChiYuan Huang <[email protected]>
The RT5739 is a step-down switching voltage regulator that supports output voltage ragne from 300mV to 1300mV with the wide input supply voltage range from 2.5V to 5.5V.
--- drivers/regulator/Kconfig | 13 ++ drivers/regulator/Makefile | 1 + drivers/regulator/rt5739.c | 290 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 304 insertions(+) create mode 100644 drivers/regulator/rt5739.c
drivers/regulator/Kconfig +13 -0
@@ -1112,6 +1112,19 @@ config REGULATOR_RT5190A buck converters, 1 LDO, mute AC OFF depop function, with the general I2C control interface. +config REGULATOR_RT5739 + tristate "Rcihtek RT5739 Regulator" + depends on I2C + select REGMAP_I2C + help + This adds support for voltage regulator in Richtek RT5739. + It's a step-down switching voltage regulator. Using a proprietary + architecture with synchronous rectification, it is capable of + delivering 3.5A continuously at over 80% efficiency. + + This driver can also be built as a module. If so, the module + will be called rt5739. + config REGULATOR_RT5759 tristate "Richtek RT5759 Regulator" depends on I2C
drivers/regulator/Makefile +1 -0
@@ -133,6 +133,7 @@ obj-$(CONFIG_REGULATOR_RT4831) += rt4831-regulator.o obj-$(CONFIG_REGULATOR_RT5033) += rt5033-regulator.o obj-$(CONFIG_REGULATOR_RT5120) += rt5120-regulator.o obj-$(CONFIG_REGULATOR_RT5190A) += rt5190a-regulator.o +obj-$(CONFIG_REGULATOR_RT5739) += rt5739.o obj-$(CONFIG_REGULATOR_RT5759) += rt5759-regulator.o obj-$(CONFIG_REGULATOR_RT6160) += rt6160-regulator.o obj-$(CONFIG_REGULATOR_RT6190) += rt6190-regulator.o
drivers/regulator/rt5739.c new file +290 -0
290 lines not on this page · raw message
Signature · 1 line
2.7.4