* [RFT PATCH 0/2] regulator: richtek,rt4801: use existing ena_gpiod feature
@ 2022-04-01 15:42 Krzysztof Kozlowski
2022-04-01 15:42 ` [RFT PATCH 1/2] regulator: dt-bindings: " Krzysztof Kozlowski
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2022-04-01 15:42 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
ChiYuan Huang, linux-kernel, devicetree
Cc: Krzysztof Kozlowski
Hi,
Not tested.
Follow up of discussion:
https://lore.kernel.org/all/2d124d53-1f36-5315-3877-af8f8ad5f824@linaro.org/#t
Best regards,
Krzysztof
Krzysztof Kozlowski (2):
regulator: dt-bindings: richtek,rt4801: use existing ena_gpiod feature
regulator: richtek,rt4801: use existing ena_gpiod feature
.../regulator/richtek,rt4801-regulator.yaml | 14 ++++++++++-
drivers/regulator/rt4801-regulator.c | 24 +++++++++++++++++++
2 files changed, 37 insertions(+), 1 deletion(-)
--
2.32.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [RFT PATCH 1/2] regulator: dt-bindings: richtek,rt4801: use existing ena_gpiod feature
2022-04-01 15:42 [RFT PATCH 0/2] regulator: richtek,rt4801: use existing ena_gpiod feature Krzysztof Kozlowski
@ 2022-04-01 15:42 ` Krzysztof Kozlowski
2022-04-04 21:42 ` Rob Herring
2022-04-01 15:42 ` [RFT PATCH 2/2] regulator: " Krzysztof Kozlowski
[not found] ` <1648831895.12596.6.camel@richtek.com>
2 siblings, 1 reply; 5+ messages in thread
From: Krzysztof Kozlowski @ 2022-04-01 15:42 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
ChiYuan Huang, linux-kernel, devicetree
Cc: Krzysztof Kozlowski
The binding and driver duplicated regulator core feature of controlling
regulators with GPIOs (of_parse_cb + ena_gpiod) and created its own
enable-gpios property with multiple GPIOs.
This is a less preferred way, because enable-gpios should enable only one
element, not multiple. It also duplicates existing solution.
Deprecate the original 'enable-gpios' and add per-regulator property.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
.../regulator/richtek,rt4801-regulator.yaml | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/regulator/richtek,rt4801-regulator.yaml b/Documentation/devicetree/bindings/regulator/richtek,rt4801-regulator.yaml
index 4a4dfa7d9d09..091150c4e579 100644
--- a/Documentation/devicetree/bindings/regulator/richtek,rt4801-regulator.yaml
+++ b/Documentation/devicetree/bindings/regulator/richtek,rt4801-regulator.yaml
@@ -32,8 +32,11 @@ properties:
If only one gpio is specified, only one gpio used to control ENP/ENM.
Else if both are specified, DSVP/DSVN could be controlled individually.
If this property not specified, treat both as always-on regulators.
+
+ Property is deprecated. Use enable-gpios in each regulator.
minItems: 1
maxItems: 2
+ deprecated: true
patternProperties:
"^DSV(P|N)$":
@@ -42,6 +45,14 @@ patternProperties:
description:
Properties for single display bias regulator.
+ properties:
+ enable-gpios:
+ description:
+ GPIO to use to enable DSVP/DSVN regulator. One GPIO can be configured
+ for controlling both regulators. If this property not specified for
+ any regulator, treat both as always-on regulators.
+ maxItems: 1
+
required:
- compatible
- reg
@@ -57,19 +68,20 @@ examples:
rt4801@73 {
compatible = "richtek,rt4801";
reg = <0x73>;
- enable-gpios = <&gpio26 2 0>, <&gpio26 3 0>;
dsvp: DSVP {
regulator-name = "rt4801,dsvp";
regulator-min-microvolt = <4000000>;
regulator-max-microvolt = <6000000>;
regulator-boot-on;
+ enable-gpios = <&gpio26 2 0>;
};
dsvn: DSVN {
regulator-name = "rt4801,dsvn";
regulator-min-microvolt = <4000000>;
regulator-max-microvolt = <6000000>;
regulator-boot-on;
+ enable-gpios = <&gpio26 3 0>;
};
};
--
2.32.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [RFT PATCH 2/2] regulator: richtek,rt4801: use existing ena_gpiod feature
2022-04-01 15:42 [RFT PATCH 0/2] regulator: richtek,rt4801: use existing ena_gpiod feature Krzysztof Kozlowski
2022-04-01 15:42 ` [RFT PATCH 1/2] regulator: dt-bindings: " Krzysztof Kozlowski
@ 2022-04-01 15:42 ` Krzysztof Kozlowski
[not found] ` <1648831895.12596.6.camel@richtek.com>
2 siblings, 0 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2022-04-01 15:42 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
ChiYuan Huang, linux-kernel, devicetree
Cc: Krzysztof Kozlowski
The driver duplicated regulator core feature of controlling
regulators with GPIOs (of_parse_cb + ena_gpiod) and created its own
enable-gpios property with multiple GPIOs.
The core already does it. Keep old method for backwards compatibility.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
drivers/regulator/rt4801-regulator.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/drivers/regulator/rt4801-regulator.c b/drivers/regulator/rt4801-regulator.c
index 7a87788d3f09..9d88b7858a21 100644
--- a/drivers/regulator/rt4801-regulator.c
+++ b/drivers/regulator/rt4801-regulator.c
@@ -34,6 +34,28 @@ struct rt4801_priv {
unsigned int volt_sel[DSV_OUT_MAX];
};
+static int rt4801_of_parse_cb(struct device_node *np,
+ const struct regulator_desc *desc,
+ struct regulator_config *config)
+{
+ struct rt4801_priv *priv = config->driver_data;
+
+ if (priv->enable_gpios) {
+ dev_warn(priv->dev, "duplicated enable-gpios property\n");
+ return 0;
+ }
+ config->ena_gpiod = fwnode_gpiod_get_index(of_fwnode_handle(np),
+ "enable-gpios",
+ 0,
+ GPIOD_OUT_HIGH |
+ GPIOD_FLAGS_BIT_NONEXCLUSIVE,
+ "rt4801");
+ if (IS_ERR(config->ena_gpiod))
+ config->ena_gpiod = NULL;
+
+ return 0;
+}
+
static int rt4801_set_voltage_sel(struct regulator_dev *rdev, unsigned int selector)
{
struct rt4801_priv *priv = rdev_get_drvdata(rdev);
@@ -122,6 +144,7 @@ static const struct regulator_desc rt4801_regulator_descs[] = {
.name = "DSVP",
.ops = &rt4801_regulator_ops,
.of_match = of_match_ptr("DSVP"),
+ .of_parse_cb = rt4801_of_parse_cb,
.type = REGULATOR_VOLTAGE,
.id = DSV_OUT_POS,
.min_uV = MIN_UV,
@@ -135,6 +158,7 @@ static const struct regulator_desc rt4801_regulator_descs[] = {
.name = "DSVN",
.ops = &rt4801_regulator_ops,
.of_match = of_match_ptr("DSVN"),
+ .of_parse_cb = rt4801_of_parse_cb,
.type = REGULATOR_VOLTAGE,
.id = DSV_OUT_NEG,
.min_uV = MIN_UV,
--
2.32.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [RFT PATCH 0/2] regulator: richtek,rt4801: use existing ena_gpiod feature
[not found] ` <1648831895.12596.6.camel@richtek.com>
@ 2022-04-01 20:36 ` Krzysztof Kozlowski
0 siblings, 0 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2022-04-01 20:36 UTC (permalink / raw)
To: cy_huang(黃啟原),
lgirdwood, linux-kernel, krzk+dt, broonie, robh+dt, devicetree
On 01/04/2022 18:51, cy_huang(黃啟原) wrote:
>
> 於 五,2022-04-01 於 17:42 +0200,Krzysztof Kozlowski 提到:
>> Hi,
>>
>> Not tested.
>>
>> Follow up of discussion:
>> https://lore.kernel.org/all/2d124d53-1f36-5315-3877-af8f8ad5f824@linaro.org/#t
>> <https://lore.kernel.org/all/2d124d53-1f36-5315-3877-af8f8ad5f824@linaro.org/#t
>> >
>
> If RT4801 enable-gpio both go from high to low, the voltage reg will be
> reset, and I2C cannot be accessibele.
> This patch can be used to individually control enable for DSVP and DSVN,
> but the above i2c behavior is not considered.
> You can check rt4801_enable/rt4801_disable for the details.
Ah, so this is why this custom enable methods is there (pus bitmap etc).
Then the core ena_gpiod cannot be used, although still we want to move
on from two GPIOs in one enable-gpios property.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFT PATCH 1/2] regulator: dt-bindings: richtek,rt4801: use existing ena_gpiod feature
2022-04-01 15:42 ` [RFT PATCH 1/2] regulator: dt-bindings: " Krzysztof Kozlowski
@ 2022-04-04 21:42 ` Rob Herring
0 siblings, 0 replies; 5+ messages in thread
From: Rob Herring @ 2022-04-04 21:42 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: Mark Brown, Rob Herring, ChiYuan Huang, linux-kernel,
Krzysztof Kozlowski, Liam Girdwood, devicetree
On Fri, 01 Apr 2022 17:42:36 +0200, Krzysztof Kozlowski wrote:
> The binding and driver duplicated regulator core feature of controlling
> regulators with GPIOs (of_parse_cb + ena_gpiod) and created its own
> enable-gpios property with multiple GPIOs.
>
> This is a less preferred way, because enable-gpios should enable only one
> element, not multiple. It also duplicates existing solution.
>
> Deprecate the original 'enable-gpios' and add per-regulator property.
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> ---
> .../regulator/richtek,rt4801-regulator.yaml | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
Reviewed-by: Rob Herring <robh@kernel.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-04-04 22:01 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-01 15:42 [RFT PATCH 0/2] regulator: richtek,rt4801: use existing ena_gpiod feature Krzysztof Kozlowski
2022-04-01 15:42 ` [RFT PATCH 1/2] regulator: dt-bindings: " Krzysztof Kozlowski
2022-04-04 21:42 ` Rob Herring
2022-04-01 15:42 ` [RFT PATCH 2/2] regulator: " Krzysztof Kozlowski
[not found] ` <1648831895.12596.6.camel@richtek.com>
2022-04-01 20:36 ` [RFT PATCH 0/2] " Krzysztof Kozlowski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).