[PATCH v2] ASoC: codecs: wcd937x: Add conditional regulator control for wcd937x

karthik.s posted 1 patch 2 months, 1 week ago
.../devicetree/bindings/sound/qcom,wcd937x.yaml     |  8 ++++++++
sound/soc/codecs/wcd937x.c                          | 13 +++++++++----
2 files changed, 17 insertions(+), 4 deletions(-)
[PATCH v2] ASoC: codecs: wcd937x: Add conditional regulator control for wcd937x
Posted by karthik.s 2 months, 1 week ago
Add has_always_on_supplies for managing regulators. Indicates that the
codec power supplies are provided by the board as always-on rails and
are not switchable by the codec or its associated regulators. This implies
that the codec supply regulators are always enabled by the system and
must not be requested or enabled by the codec driver.

Signed-off-by: karthik.s <karthik.s@oss.qualcomm.com>
---
 .../devicetree/bindings/sound/qcom,wcd937x.yaml     |  8 ++++++++
 sound/soc/codecs/wcd937x.c                          | 13 +++++++++----
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/qcom,wcd937x.yaml b/Documentation/devicetree/bindings/sound/qcom,wcd937x.yaml
index f94203798f24..38b3452788e9 100644
--- a/Documentation/devicetree/bindings/sound/qcom,wcd937x.yaml
+++ b/Documentation/devicetree/bindings/sound/qcom,wcd937x.yaml
@@ -28,6 +28,14 @@ properties:
   vdd-px-supply:
     description: A reference to the 1.8V I/O supply
 
+  qcom,always-on-supply:
+    type: boolean
+    description: Indicates that the codec power supplies are provided by the board
+                 as always-on rails and are not switchable by the codec or its
+                 associated regulators. This implies that the codec supply regulators
+                 are always enabled by the system and must not be requested or enabled
+                 by the codec driver.
+
 required:
   - compatible
   - vdd-px-supply
diff --git a/sound/soc/codecs/wcd937x.c b/sound/soc/codecs/wcd937x.c
index 10a2d598caa7..1514ceb7d790 100644
--- a/sound/soc/codecs/wcd937x.c
+++ b/sound/soc/codecs/wcd937x.c
@@ -100,6 +100,7 @@ struct wcd937x_priv {
 	int aux_pdm_wd_int;
 	bool comp1_enable;
 	bool comp2_enable;
+	bool has_always_on_supplies;
 
 	struct gpio_desc *us_euro_gpio;
 	struct gpio_desc *reset_gpio;
@@ -2907,10 +2908,14 @@ static int wcd937x_probe(struct platform_device *pdev)
 	cfg = &wcd937x->mbhc_cfg;
 	cfg->swap_gnd_mic = wcd937x_swap_gnd_mic;
 
-	ret = devm_regulator_bulk_get_enable(dev, ARRAY_SIZE(wcd937x_supplies),
-					     wcd937x_supplies);
-	if (ret)
-		return dev_err_probe(dev, ret, "Failed to get and enable supplies\n");
+	wcd937x->has_always_on_supplies = of_property_read_bool(dev->of_node,
+							"qcom,always-on-supply");
+	if (!wcd937x->has_always_on_supplies) {
+		ret = devm_regulator_bulk_get_enable(dev, ARRAY_SIZE(wcd937x_supplies),
+						wcd937x_supplies);
+		if (ret)
+			return dev_err_probe(dev, ret, "Failed to get and enable supplies\n");
+	}
 
 	ret = wcd_dt_parse_micbias_info(&wcd937x->common);
 	if (ret)
-- 
2.34.1
Re: [PATCH v2] ASoC: codecs: wcd937x: Add conditional regulator control for wcd937x
Posted by Mark Brown 2 months, 1 week ago
On Thu, Apr 02, 2026 at 12:52:56PM +0530, karthik.s wrote:
> Add has_always_on_supplies for managing regulators. Indicates that the
> codec power supplies are provided by the board as always-on rails and
> are not switchable by the codec or its associated regulators. This implies
> that the codec supply regulators are always enabled by the system and
> must not be requested or enabled by the codec driver.

Same issue, why would we want this?
Re: [PATCH v2] ASoC: codecs: wcd937x: Add conditional regulator control for wcd937x
Posted by Karthik S 2 months ago
Hi @Mark ,

On the indus mezz skew, The codec rails are distributed through fixed 
Vdd (3.3V supply). These rails are Board‑controlled , not switched by 
the codec and not power‑cycled dynamically. There is no per‑codec 
enable/disable control exposed to software.The codec is wired to rails 
that are always powered when the board is powered. Hence this justifies 
it being handled as a board dt property.

On 4/2/2026 4:53 PM, Mark Brown wrote:
> On Thu, Apr 02, 2026 at 12:52:56PM +0530, karthik.s wrote:
>> Add has_always_on_supplies for managing regulators. Indicates that the
>> codec power supplies are provided by the board as always-on rails and
>> are not switchable by the codec or its associated regulators. This implies
>> that the codec supply regulators are always enabled by the system and
>> must not be requested or enabled by the codec driver.
> Same issue, why would we want this?

Thanks and regards,
Karthik S

Re: [PATCH v2] ASoC: codecs: wcd937x: Add conditional regulator control for wcd937x
Posted by Mark Brown 2 months ago
On Fri, Apr 10, 2026 at 11:10:22AM +0530, Karthik S wrote:
> Hi @Mark ,

Please don't add random characters to my name.

Please don't top post, reply in line with needed context.  This allows
readers to readily follow the flow of conversation and understand what
you are talking about and also helps ensure that everything in the
discussion is being addressed.

> On the indus mezz skew, The codec rails are distributed through fixed Vdd
> (3.3V supply). These rails are Board‑controlled , not switched by the codec
> and not power‑cycled dynamically. There is no per‑codec enable/disable
> control exposed to software.The codec is wired to rails that are always
> powered when the board is powered. Hence this justifies it being handled as
> a board dt property.

This is a compltely normal situation for regulators, probably true for
the majority of current systems with regulators in use.  Why would this
board be different?
Re: [PATCH v2] ASoC: codecs: wcd937x: Add conditional regulator control for wcd937x
Posted by Rob Herring (Arm) 2 months, 1 week ago
On Thu, 02 Apr 2026 12:52:56 +0530, karthik.s wrote:
> Add has_always_on_supplies for managing regulators. Indicates that the
> codec power supplies are provided by the board as always-on rails and
> are not switchable by the codec or its associated regulators. This implies
> that the codec supply regulators are always enabled by the system and
> must not be requested or enabled by the codec driver.
> 
> Signed-off-by: karthik.s <karthik.s@oss.qualcomm.com>
> ---
>  .../devicetree/bindings/sound/qcom,wcd937x.yaml     |  8 ++++++++
>  sound/soc/codecs/wcd937x.c                          | 13 +++++++++----
>  2 files changed, 17 insertions(+), 4 deletions(-)
> 

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/sound/qcom,wcd937x.yaml: properties:qcom,always-on-supply: 'type' is not one of ['description', 'deprecated']
	from schema $id: http://devicetree.org/meta-schemas/core.yaml

doc reference errors (make refcheckdocs):

See https://patchwork.kernel.org/project/devicetree/patch/20260402072256.2811085-1-karthik.s@oss.qualcomm.com

The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.
Re: [PATCH v2] ASoC: codecs: wcd937x: Add conditional regulator control for wcd937x
Posted by Karthik S 2 months, 1 week ago
Hi Rob,

Yes, I was able to run the script as you suggested and find the error 
indicated. To address the error I have removed 'type' from the 
dt-binding property "qcom,always-on-supply".

Thanks and Regards,
Karthik S

On 4/2/2026 1:59 PM, Rob Herring (Arm) wrote:
> My bot found errors running 'make dt_binding_check' on your patch:
> 
> yamllint warnings/errors:
> 
> dtschema/dtc warnings/errors:
> /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/sound/qcom,wcd937x.yaml: properties:qcom,always-on-supply: 'type' is not one of ['description', 'deprecated']
> 	from schema $id:http://devicetree.org/meta-schemas/core.yaml
> 
> doc reference errors (make refcheckdocs):
> 
> Seehttps://patchwork.kernel.org/project/devicetree/ 
> patch/20260402072256.2811085-1-karthik.s@oss.qualcomm.com
> 
> The base for the series is generally the latest rc1. A different dependency
> should be noted in*this* patch.
> 
> If you already ran 'make dt_binding_check' and didn't see the above
> error(s), then make sure 'yamllint' is installed and dt-schema is up to
> date:
> 
> pip3 install dtschema --upgrade
> 
> Please check and re-submit after running the above command yourself. Note
> that DT_SCHEMA_FILES can be set to your schema file to speed up checking
> your schema. However, it must be unset to test all examples with your schema.
Re: [PATCH v2] ASoC: codecs: wcd937x: Add conditional regulator control for wcd937x
Posted by Krzysztof Kozlowski 2 months, 1 week ago
On 02/04/2026 09:22, karthik.s wrote:
> Add has_always_on_supplies for managing regulators. Indicates that the
> codec power supplies are provided by the board as always-on rails and
> are not switchable by the codec or its associated regulators. This implies
> that the codec supply regulators are always enabled by the system and
> must not be requested or enabled by the codec driver.
> 
> Signed-off-by: karthik.s <karthik.s@oss.qualcomm.com>
> ---
>  .../devicetree/bindings/sound/qcom,wcd937x.yaml     |  8 ++++++++
>  sound/soc/codecs/wcd937x.c                          | 13 +++++++++----
>  2 files changed, 17 insertions(+), 4 deletions(-)
> 

I gave you review within 5 minutes and you send exactly the same after.
Without any changelog or explanations or response.

NAK

Best regards,
Krzysztof
Re: [PATCH v2] ASoC: codecs: wcd937x: Add conditional regulator control for wcd937x
Posted by Karthik S 2 months, 1 week ago
Hi Krzysztof,

Sorry, I won't repeat this again. will take care in future.

Thanks and Regards,
Karthik S

On 4/2/2026 1:00 PM, Krzysztof Kozlowski wrote:
> I gave you review within 5 minutes and you send exactly the same after.
> Without any changelog or explanations or response.