alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/7] Update Lpass digital codec macro drivers
@ 2021-09-20  7:35 Srinivasa Rao Mandadapu
  2021-09-20  7:35 ` [PATCH 1/7] ASoC: qcom: Add compatible names in va, wsa, rx, tx codec drivers for sc7280 Srinivasa Rao Mandadapu
                   ` (6 more replies)
  0 siblings, 7 replies; 20+ messages in thread
From: Srinivasa Rao Mandadapu @ 2021-09-20  7:35 UTC (permalink / raw)
  To: agross, bjorn.andersson, lgirdwood, broonie, robh+dt, plai,
	bgoswami, perex, tiwai, srinivas.kandagatla, rohitkr,
	linux-arm-msm, alsa-devel, devicetree, linux-kernel, swboyd,
	judyhsiao
  Cc: Srinivasa Rao Mandadapu

This patch set is to add support for lpass sc7280 based targets.
Upadate compatible name and change of bulk clock voting to individual
clock voting in digital codec va, rx, tx macro drivers.

Srinivasa Rao Mandadapu (7):
  ASoC: qcom: Add compatible names in va,wsa,rx,tx codec drivers for
    sc7280
  ASoC: qcom: dt-bindings: Add compatible names for lpass sc7280 digital
    codecs
  ASoC: codecs: tx-macro: Change mic control registers to volatile
  ASoC: codecs: lpass-va-macro: Change bulk voting to individual clock
    voting
  ASoC: codecs: lpass-rx-macro: Change bulk voting to individual clock
    voting
  ASoC: codecs: lpass-tx-macro: Change bulk voting to individual clock
    voting
  ASoC: codecs: lpass-va-macro: set mclk clock rate correctly

 .../bindings/sound/qcom,lpass-rx-macro.yaml        |  4 +-
 .../bindings/sound/qcom,lpass-tx-macro.yaml        |  4 +-
 .../bindings/sound/qcom,lpass-va-macro.yaml        |  4 +-
 .../bindings/sound/qcom,lpass-wsa-macro.yaml       |  4 +-
 sound/soc/codecs/lpass-rx-macro.c                  | 69 ++++++++++++------
 sound/soc/codecs/lpass-tx-macro.c                  | 81 ++++++++++++++++------
 sound/soc/codecs/lpass-va-macro.c                  | 49 ++++++++-----
 sound/soc/codecs/lpass-wsa-macro.c                 |  1 +
 8 files changed, 153 insertions(+), 63 deletions(-)

-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.


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

* [PATCH 1/7] ASoC: qcom: Add compatible names in va, wsa, rx, tx codec drivers for sc7280
  2021-09-20  7:35 [PATCH 0/7] Update Lpass digital codec macro drivers Srinivasa Rao Mandadapu
@ 2021-09-20  7:35 ` Srinivasa Rao Mandadapu
  2021-09-20 18:17   ` [PATCH 1/7] ASoC: qcom: Add compatible names in va,wsa,rx,tx " Stephen Boyd
  2021-09-20  7:35 ` [PATCH 2/7] ASoC: qcom: dt-bindings: Add compatible names for lpass sc7280 digital codecs Srinivasa Rao Mandadapu
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 20+ messages in thread
From: Srinivasa Rao Mandadapu @ 2021-09-20  7:35 UTC (permalink / raw)
  To: agross, bjorn.andersson, lgirdwood, broonie, robh+dt, plai,
	bgoswami, perex, tiwai, srinivas.kandagatla, rohitkr,
	linux-arm-msm, alsa-devel, devicetree, linux-kernel, swboyd,
	judyhsiao
  Cc: Venkata Prasad Potturu, Srinivasa Rao Mandadapu

Add compatible names for sc7280 based targets in digital codec drivers
va,wsa,rx and tx.

Signed-off-by: Venkata Prasad Potturu <potturu@codeaurora.org>
Signed-off-by: Srinivasa Rao Mandadapu <srivasam@codeaurora.org>
---
 sound/soc/codecs/lpass-rx-macro.c  | 1 +
 sound/soc/codecs/lpass-tx-macro.c  | 1 +
 sound/soc/codecs/lpass-va-macro.c  | 1 +
 sound/soc/codecs/lpass-wsa-macro.c | 1 +
 4 files changed, 4 insertions(+)

diff --git a/sound/soc/codecs/lpass-rx-macro.c b/sound/soc/codecs/lpass-rx-macro.c
index 196b068..520c760 100644
--- a/sound/soc/codecs/lpass-rx-macro.c
+++ b/sound/soc/codecs/lpass-rx-macro.c
@@ -3578,6 +3578,7 @@ static int rx_macro_remove(struct platform_device *pdev)
 
 static const struct of_device_id rx_macro_dt_match[] = {
 	{ .compatible = "qcom,sm8250-lpass-rx-macro" },
+	{ .compatible = "qcom,sc7280-lpass-rx-macro" },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, rx_macro_dt_match);
diff --git a/sound/soc/codecs/lpass-tx-macro.c b/sound/soc/codecs/lpass-tx-macro.c
index 27a0d5d..9273724 100644
--- a/sound/soc/codecs/lpass-tx-macro.c
+++ b/sound/soc/codecs/lpass-tx-macro.c
@@ -1844,6 +1844,7 @@ static int tx_macro_remove(struct platform_device *pdev)
 
 static const struct of_device_id tx_macro_dt_match[] = {
 	{ .compatible = "qcom,sm8250-lpass-tx-macro" },
+	{ .compatible = "qcom,sc7280-lpass-tx-macro" },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, tx_macro_dt_match);
diff --git a/sound/soc/codecs/lpass-va-macro.c b/sound/soc/codecs/lpass-va-macro.c
index 56c93f4..d312a14 100644
--- a/sound/soc/codecs/lpass-va-macro.c
+++ b/sound/soc/codecs/lpass-va-macro.c
@@ -1473,6 +1473,7 @@ static int va_macro_remove(struct platform_device *pdev)
 
 static const struct of_device_id va_macro_dt_match[] = {
 	{ .compatible = "qcom,sm8250-lpass-va-macro" },
+	{ .compatible = "qcom,sc7280-lpass-va-macro" },
 	{}
 };
 MODULE_DEVICE_TABLE(of, va_macro_dt_match);
diff --git a/sound/soc/codecs/lpass-wsa-macro.c b/sound/soc/codecs/lpass-wsa-macro.c
index d3ac318..cc0071e 100644
--- a/sound/soc/codecs/lpass-wsa-macro.c
+++ b/sound/soc/codecs/lpass-wsa-macro.c
@@ -2446,6 +2446,7 @@ static int wsa_macro_remove(struct platform_device *pdev)
 
 static const struct of_device_id wsa_macro_dt_match[] = {
 	{.compatible = "qcom,sm8250-lpass-wsa-macro"},
+	{.compatible = "qcom,sc7280-lpass-wsa-macro"},
 	{}
 };
 MODULE_DEVICE_TABLE(of, wsa_macro_dt_match);
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.


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

* [PATCH 2/7] ASoC: qcom: dt-bindings: Add compatible names for lpass sc7280 digital codecs
  2021-09-20  7:35 [PATCH 0/7] Update Lpass digital codec macro drivers Srinivasa Rao Mandadapu
  2021-09-20  7:35 ` [PATCH 1/7] ASoC: qcom: Add compatible names in va, wsa, rx, tx codec drivers for sc7280 Srinivasa Rao Mandadapu
@ 2021-09-20  7:35 ` Srinivasa Rao Mandadapu
  2021-09-20 13:24   ` Srinivas Kandagatla
  2021-09-20  7:35 ` [PATCH 3/7] ASoC: codecs: tx-macro: Change mic control registers to volatile Srinivasa Rao Mandadapu
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 20+ messages in thread
From: Srinivasa Rao Mandadapu @ 2021-09-20  7:35 UTC (permalink / raw)
  To: agross, bjorn.andersson, lgirdwood, broonie, robh+dt, plai,
	bgoswami, perex, tiwai, srinivas.kandagatla, rohitkr,
	linux-arm-msm, alsa-devel, devicetree, linux-kernel, swboyd,
	judyhsiao
  Cc: Venkata Prasad Potturu, Srinivasa Rao Mandadapu

Update compatible names in va, wsa, rx and tx macro codes for lpass sc7280

Signed-off-by: Venkata Prasad Potturu <potturu@codeaurora.org>
Signed-off-by: Srinivasa Rao Mandadapu <srivasam@codeaurora.org>
---
 Documentation/devicetree/bindings/sound/qcom,lpass-rx-macro.yaml  | 4 +++-
 Documentation/devicetree/bindings/sound/qcom,lpass-tx-macro.yaml  | 4 +++-
 Documentation/devicetree/bindings/sound/qcom,lpass-va-macro.yaml  | 4 +++-
 Documentation/devicetree/bindings/sound/qcom,lpass-wsa-macro.yaml | 4 +++-
 4 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/qcom,lpass-rx-macro.yaml b/Documentation/devicetree/bindings/sound/qcom,lpass-rx-macro.yaml
index 443d556..a4e767e 100644
--- a/Documentation/devicetree/bindings/sound/qcom,lpass-rx-macro.yaml
+++ b/Documentation/devicetree/bindings/sound/qcom,lpass-rx-macro.yaml
@@ -11,7 +11,9 @@ maintainers:
 
 properties:
   compatible:
-    const: qcom,sm8250-lpass-rx-macro
+    oneOf:
+      - const: qcom,sm8250-lpass-rx-macro
+      - const: qcom,sc7280-lpass-rx-macro
 
   reg:
     maxItems: 1
diff --git a/Documentation/devicetree/bindings/sound/qcom,lpass-tx-macro.yaml b/Documentation/devicetree/bindings/sound/qcom,lpass-tx-macro.yaml
index 6b5ca02..cdec478 100644
--- a/Documentation/devicetree/bindings/sound/qcom,lpass-tx-macro.yaml
+++ b/Documentation/devicetree/bindings/sound/qcom,lpass-tx-macro.yaml
@@ -11,7 +11,9 @@ maintainers:
 
 properties:
   compatible:
-    const: qcom,sm8250-lpass-tx-macro
+    oneOf:
+      - const: qcom,sm8250-lpass-tx-macro
+      - const: qcom,sc7280-lpass-tx-macro
 
   reg:
     maxItems: 1
diff --git a/Documentation/devicetree/bindings/sound/qcom,lpass-va-macro.yaml b/Documentation/devicetree/bindings/sound/qcom,lpass-va-macro.yaml
index 679b49c..e15bc05 100644
--- a/Documentation/devicetree/bindings/sound/qcom,lpass-va-macro.yaml
+++ b/Documentation/devicetree/bindings/sound/qcom,lpass-va-macro.yaml
@@ -11,7 +11,9 @@ maintainers:
 
 properties:
   compatible:
-    const: qcom,sm8250-lpass-va-macro
+    oneOf:
+      - const: qcom,sm8250-lpass-va-macro
+      - const: qcom,sc7280-lpass-va-macro
 
   reg:
     maxItems: 1
diff --git a/Documentation/devicetree/bindings/sound/qcom,lpass-wsa-macro.yaml b/Documentation/devicetree/bindings/sound/qcom,lpass-wsa-macro.yaml
index 435b019..2dcccb5 100644
--- a/Documentation/devicetree/bindings/sound/qcom,lpass-wsa-macro.yaml
+++ b/Documentation/devicetree/bindings/sound/qcom,lpass-wsa-macro.yaml
@@ -11,7 +11,9 @@ maintainers:
 
 properties:
   compatible:
-    const: qcom,sm8250-lpass-wsa-macro
+    oneOf:
+      - const: qcom,sm8250-lpass-wsa-macro
+      - const: qcom,sc7280-lpass-wsa-macro
 
   reg:
     maxItems: 1
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.


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

* [PATCH 3/7] ASoC: codecs: tx-macro: Change mic control registers to volatile
  2021-09-20  7:35 [PATCH 0/7] Update Lpass digital codec macro drivers Srinivasa Rao Mandadapu
  2021-09-20  7:35 ` [PATCH 1/7] ASoC: qcom: Add compatible names in va, wsa, rx, tx codec drivers for sc7280 Srinivasa Rao Mandadapu
  2021-09-20  7:35 ` [PATCH 2/7] ASoC: qcom: dt-bindings: Add compatible names for lpass sc7280 digital codecs Srinivasa Rao Mandadapu
@ 2021-09-20  7:35 ` Srinivasa Rao Mandadapu
  2021-09-20 13:24   ` Srinivas Kandagatla
  2021-09-20  7:35 ` [PATCH 4/7] ASoC: codecs: lpass-va-macro: Change bulk voting to individual clock voting Srinivasa Rao Mandadapu
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 20+ messages in thread
From: Srinivasa Rao Mandadapu @ 2021-09-20  7:35 UTC (permalink / raw)
  To: agross, bjorn.andersson, lgirdwood, broonie, robh+dt, plai,
	bgoswami, perex, tiwai, srinivas.kandagatla, rohitkr,
	linux-arm-msm, alsa-devel, devicetree, linux-kernel, swboyd,
	judyhsiao
  Cc: Venkata Prasad Potturu, Srinivasa Rao Mandadapu

Update amic and dmic related tx macro control registers to volatile

Fixes: c39667ddcfc5 (ASoC: codecs: lpass-tx-macro: add support for lpass tx macro)

Signed-off-by: Venkata Prasad Potturu <potturu@codeaurora.org>
Signed-off-by: Srinivasa Rao Mandadapu <srivasam@codeaurora.org>
---
 sound/soc/codecs/lpass-tx-macro.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/sound/soc/codecs/lpass-tx-macro.c b/sound/soc/codecs/lpass-tx-macro.c
index 9273724..e65b592 100644
--- a/sound/soc/codecs/lpass-tx-macro.c
+++ b/sound/soc/codecs/lpass-tx-macro.c
@@ -423,6 +423,13 @@ static bool tx_is_volatile_register(struct device *dev, unsigned int reg)
 	case CDC_TX_TOP_CSR_SWR_DMIC1_CTL:
 	case CDC_TX_TOP_CSR_SWR_DMIC2_CTL:
 	case CDC_TX_TOP_CSR_SWR_DMIC3_CTL:
+	case CDC_TX_TOP_CSR_SWR_AMIC0_CTL:
+	case CDC_TX_TOP_CSR_SWR_AMIC1_CTL:
+	case CDC_TX_CLK_RST_CTRL_MCLK_CONTROL:
+	case CDC_TX_CLK_RST_CTRL_FS_CNT_CONTROL:
+	case CDC_TX_CLK_RST_CTRL_SWR_CONTROL:
+	case CDC_TX_TOP_CSR_SWR_CTRL:
+	case CDC_TX0_TX_PATH_SEC7:
 		return true;
 	}
 	return false;
@@ -1674,6 +1681,12 @@ static int tx_macro_component_probe(struct snd_soc_component *comp)
 
 	snd_soc_component_update_bits(comp, CDC_TX0_TX_PATH_SEC7, 0x3F,
 				      0x0A);
+	snd_soc_component_update_bits(comp, CDC_TX_TOP_CSR_SWR_AMIC0_CTL, 0xFF, 0x00);
+	snd_soc_component_update_bits(comp, CDC_TX_TOP_CSR_SWR_AMIC1_CTL, 0xFF, 0x00);
+	snd_soc_component_update_bits(comp, CDC_TX_TOP_CSR_SWR_DMIC0_CTL, 0xFF, 0x00);
+	snd_soc_component_update_bits(comp, CDC_TX_TOP_CSR_SWR_DMIC1_CTL, 0xFF, 0x00);
+	snd_soc_component_update_bits(comp, CDC_TX_TOP_CSR_SWR_DMIC2_CTL, 0xFF, 0x00);
+	snd_soc_component_update_bits(comp, CDC_TX_TOP_CSR_SWR_DMIC3_CTL, 0xFF, 0x00);
 
 	return 0;
 }
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.


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

* [PATCH 4/7] ASoC: codecs: lpass-va-macro: Change bulk voting to individual clock voting
  2021-09-20  7:35 [PATCH 0/7] Update Lpass digital codec macro drivers Srinivasa Rao Mandadapu
                   ` (2 preceding siblings ...)
  2021-09-20  7:35 ` [PATCH 3/7] ASoC: codecs: tx-macro: Change mic control registers to volatile Srinivasa Rao Mandadapu
@ 2021-09-20  7:35 ` Srinivasa Rao Mandadapu
  2021-09-20 13:25   ` Srinivas Kandagatla
  2021-09-20  7:35 ` [PATCH 5/7] ASoC: codecs: lpass-rx-macro: " Srinivasa Rao Mandadapu
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 20+ messages in thread
From: Srinivasa Rao Mandadapu @ 2021-09-20  7:35 UTC (permalink / raw)
  To: agross, bjorn.andersson, lgirdwood, broonie, robh+dt, plai,
	bgoswami, perex, tiwai, srinivas.kandagatla, rohitkr,
	linux-arm-msm, alsa-devel, devicetree, linux-kernel, swboyd,
	judyhsiao
  Cc: Venkata Prasad Potturu, Srinivasa Rao Mandadapu

Change bulk clock frequency voting to individual voting.

Fixes: 908e6b1df26e (ASoC: codecs: lpass-va-macro: Add support to VA Macro)

Signed-off-by: Venkata Prasad Potturu <potturu@codeaurora.org>
Signed-off-by: Srinivasa Rao Mandadapu <srivasam@codeaurora.org>
---
 sound/soc/codecs/lpass-va-macro.c | 46 ++++++++++++++++++++++++---------------
 1 file changed, 28 insertions(+), 18 deletions(-)

diff --git a/sound/soc/codecs/lpass-va-macro.c b/sound/soc/codecs/lpass-va-macro.c
index d312a14..0ea39ae 100644
--- a/sound/soc/codecs/lpass-va-macro.c
+++ b/sound/soc/codecs/lpass-va-macro.c
@@ -193,7 +193,10 @@ struct va_macro {
 
 	int dec_mode[VA_MACRO_NUM_DECIMATORS];
 	struct regmap *regmap;
-	struct clk_bulk_data clks[VA_NUM_CLKS_MAX];
+	struct clk *mclk;
+	struct clk *macro;
+	struct clk *dcodec;
+
 	struct clk_hw hw;
 
 	s32 dmic_0_1_clk_cnt;
@@ -1321,7 +1324,7 @@ static const struct clk_ops fsgen_gate_ops = {
 
 static int va_macro_register_fsgen_output(struct va_macro *va)
 {
-	struct clk *parent = va->clks[2].clk;
+	struct clk *parent = va->mclk;
 	struct device *dev = va->dev;
 	struct device_node *np = dev->of_node;
 	const char *parent_clk_name;
@@ -1404,15 +1407,18 @@ static int va_macro_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	va->dev = dev;
-	va->clks[0].id = "macro";
-	va->clks[1].id = "dcodec";
-	va->clks[2].id = "mclk";
 
-	ret = devm_clk_bulk_get(dev, VA_NUM_CLKS_MAX, va->clks);
-	if (ret) {
-		dev_err(dev, "Error getting VA Clocks (%d)\n", ret);
-		return ret;
-	}
+	va->macro = devm_clk_get_optional(dev, "macro");
+	if (IS_ERR(va->macro))
+		return PTR_ERR(va->macro);
+
+	va->dcodec = devm_clk_get_optional(dev, "dcodec");
+	if (IS_ERR(va->dcodec))
+		return PTR_ERR(va->dcodec);
+
+	va->mclk = devm_clk_get(dev, "mclk");
+	if (IS_ERR(va->mclk))
+		return PTR_ERR(va->mclk);
 
 	ret = of_property_read_u32(dev->of_node, "qcom,dmic-sample-rate",
 				   &sample_rate);
@@ -1426,10 +1432,11 @@ static int va_macro_probe(struct platform_device *pdev)
 	}
 
 	/* mclk rate */
-	clk_set_rate(va->clks[1].clk, VA_MACRO_MCLK_FREQ);
-	ret = clk_bulk_prepare_enable(VA_NUM_CLKS_MAX, va->clks);
-	if (ret)
-		return ret;
+	clk_set_rate(va->mclk, VA_MACRO_MCLK_FREQ);
+
+	clk_prepare_enable(va->mclk);
+	clk_prepare_enable(va->macro);
+	clk_prepare_enable(va->dcodec);
 
 	base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(base)) {
@@ -1457,8 +1464,9 @@ static int va_macro_probe(struct platform_device *pdev)
 	return ret;
 
 err:
-	clk_bulk_disable_unprepare(VA_NUM_CLKS_MAX, va->clks);
-
+	clk_disable_unprepare(va->mclk);
+	clk_disable_unprepare(va->macro);
+	clk_disable_unprepare(va->dcodec);
 	return ret;
 }
 
@@ -1466,8 +1474,10 @@ static int va_macro_remove(struct platform_device *pdev)
 {
 	struct va_macro *va = dev_get_drvdata(&pdev->dev);
 
-	clk_bulk_disable_unprepare(VA_NUM_CLKS_MAX, va->clks);
-
+	of_clk_del_provider(pdev->dev.of_node);
+	clk_disable_unprepare(va->mclk);
+	clk_disable_unprepare(va->macro);
+	clk_disable_unprepare(va->dcodec);
 	return 0;
 }
 
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.


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

* [PATCH 5/7] ASoC: codecs: lpass-rx-macro: Change bulk voting to individual clock voting
  2021-09-20  7:35 [PATCH 0/7] Update Lpass digital codec macro drivers Srinivasa Rao Mandadapu
                   ` (3 preceding siblings ...)
  2021-09-20  7:35 ` [PATCH 4/7] ASoC: codecs: lpass-va-macro: Change bulk voting to individual clock voting Srinivasa Rao Mandadapu
@ 2021-09-20  7:35 ` Srinivasa Rao Mandadapu
  2021-09-20  7:35 ` [PATCH 6/7] ASoC: codecs: lpass-tx-macro: " Srinivasa Rao Mandadapu
  2021-09-20  7:35 ` [PATCH 7/7] ASoC: codecs: lpass-va-macro: set mclk clock rate correctly Srinivasa Rao Mandadapu
  6 siblings, 0 replies; 20+ messages in thread
From: Srinivasa Rao Mandadapu @ 2021-09-20  7:35 UTC (permalink / raw)
  To: agross, bjorn.andersson, lgirdwood, broonie, robh+dt, plai,
	bgoswami, perex, tiwai, srinivas.kandagatla, rohitkr,
	linux-arm-msm, alsa-devel, devicetree, linux-kernel, swboyd,
	judyhsiao
  Cc: Venkata Prasad Potturu, Srinivasa Rao Mandadapu

Change bulk clock frequency voting to individual voting.

Fixes: af3d54b99764 (ASoC: codecs: lpass-rx-macro: add support for lpass rx macro)

Signed-off-by: Venkata Prasad Potturu <potturu@codeaurora.org>
Signed-off-by: Srinivasa Rao Mandadapu <srivasam@codeaurora.org>
---
 sound/soc/codecs/lpass-rx-macro.c | 68 +++++++++++++++++++++++++++------------
 1 file changed, 48 insertions(+), 20 deletions(-)

diff --git a/sound/soc/codecs/lpass-rx-macro.c b/sound/soc/codecs/lpass-rx-macro.c
index 520c760..349d879 100644
--- a/sound/soc/codecs/lpass-rx-macro.c
+++ b/sound/soc/codecs/lpass-rx-macro.c
@@ -608,7 +608,11 @@ struct rx_macro {
 	int softclip_clk_users;
 
 	struct regmap *regmap;
-	struct clk_bulk_data clks[RX_NUM_CLKS_MAX];
+	struct clk *mclk;
+	struct clk *npl;
+	struct clk *macro;
+	struct clk *dcodec;
+	struct clk *fsgen;
 	struct clk_hw hw;
 };
 #define to_rx_macro(_hw) container_of(_hw, struct rx_macro, hw)
@@ -3423,6 +3427,8 @@ static int swclk_gate_enable(struct clk_hw *hw)
 {
 	struct rx_macro *rx = to_rx_macro(hw);
 
+	clk_set_rate(rx->npl, MCLK_FREQ);
+	clk_prepare_enable(rx->npl);
 	rx_macro_mclk_enable(rx, true);
 	if (rx->reset_swr)
 		regmap_update_bits(rx->regmap, CDC_RX_CLK_RST_CTRL_SWR_CONTROL,
@@ -3448,6 +3454,7 @@ static void swclk_gate_disable(struct clk_hw *hw)
 			   CDC_RX_SWR_CLK_EN_MASK, 0);
 
 	rx_macro_mclk_enable(rx, false);
+	clk_disable_unprepare(rx->npl);
 }
 
 static int swclk_gate_is_enabled(struct clk_hw *hw)
@@ -3485,7 +3492,7 @@ static struct clk *rx_macro_register_mclk_output(struct rx_macro *rx)
 	struct clk_init_data init;
 	int ret;
 
-	parent_clk_name = __clk_get_name(rx->clks[2].clk);
+	parent_clk_name = __clk_get_name(rx->mclk);
 
 	init.name = clk_name;
 	init.ops = &swclk_gate_ops;
@@ -3525,17 +3532,25 @@ static int rx_macro_probe(struct platform_device *pdev)
 	if (!rx)
 		return -ENOMEM;
 
-	rx->clks[0].id = "macro";
-	rx->clks[1].id = "dcodec";
-	rx->clks[2].id = "mclk";
-	rx->clks[3].id = "npl";
-	rx->clks[4].id = "fsgen";
+	rx->mclk = devm_clk_get(dev, "mclk");
+	if (IS_ERR(rx->mclk))
+		return PTR_ERR(rx->mclk);
+	rx->npl = devm_clk_get(dev, "npl");
+	if (IS_ERR(rx->npl))
+		return PTR_ERR(rx->npl);
 
-	ret = devm_clk_bulk_get(dev, RX_NUM_CLKS_MAX, rx->clks);
-	if (ret) {
-		dev_err(dev, "Error getting RX Clocks (%d)\n", ret);
-		return ret;
-	}
+
+	rx->macro = devm_clk_get_optional(dev, "macro");
+	if (IS_ERR(rx->macro))
+		return PTR_ERR(rx->macro);
+
+	rx->dcodec = devm_clk_get_optional(dev, "dcodec");
+	if (IS_ERR(rx->dcodec))
+		return PTR_ERR(rx->dcodec);
+
+	rx->fsgen = devm_clk_get(dev, "fsgen");
+	if (IS_ERR(rx->fsgen))
+		return PTR_ERR(rx->fsgen);
 
 	base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(base))
@@ -3549,21 +3564,28 @@ static int rx_macro_probe(struct platform_device *pdev)
 	rx->dev = dev;
 
 	/* set MCLK and NPL rates */
-	clk_set_rate(rx->clks[2].clk, MCLK_FREQ);
-	clk_set_rate(rx->clks[3].clk, 2 * MCLK_FREQ);
+	clk_set_rate(rx->mclk, MCLK_FREQ);
+	clk_set_rate(rx->npl, 2 * MCLK_FREQ);
 
-	ret = clk_bulk_prepare_enable(RX_NUM_CLKS_MAX, rx->clks);
-	if (ret)
-		return ret;
+	clk_prepare_enable(rx->macro);
+	clk_prepare_enable(rx->dcodec);
+	clk_prepare_enable(rx->mclk);
+	clk_prepare_enable(rx->npl);
+	clk_prepare_enable(rx->fsgen);
 
 	rx_macro_register_mclk_output(rx);
 
 	ret = devm_snd_soc_register_component(dev, &rx_macro_component_drv,
 					      rx_macro_dai,
 					      ARRAY_SIZE(rx_macro_dai));
-	if (ret)
-		clk_bulk_disable_unprepare(RX_NUM_CLKS_MAX, rx->clks);
+	if (ret) {
+		clk_disable_unprepare(rx->mclk);
+		clk_disable_unprepare(rx->npl);
+		clk_disable_unprepare(rx->macro);
+		clk_disable_unprepare(rx->dcodec);
+		clk_disable_unprepare(rx->fsgen);
 
+	}
 	return ret;
 }
 
@@ -3572,7 +3594,13 @@ static int rx_macro_remove(struct platform_device *pdev)
 	struct rx_macro *rx = dev_get_drvdata(&pdev->dev);
 
 	of_clk_del_provider(pdev->dev.of_node);
-	clk_bulk_disable_unprepare(RX_NUM_CLKS_MAX, rx->clks);
+
+	clk_disable_unprepare(rx->mclk);
+	clk_disable_unprepare(rx->npl);
+	clk_disable_unprepare(rx->macro);
+	clk_disable_unprepare(rx->dcodec);
+	clk_disable_unprepare(rx->fsgen);
+
 	return 0;
 }
 
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.


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

* [PATCH 6/7] ASoC: codecs: lpass-tx-macro: Change bulk voting to individual clock voting
  2021-09-20  7:35 [PATCH 0/7] Update Lpass digital codec macro drivers Srinivasa Rao Mandadapu
                   ` (4 preceding siblings ...)
  2021-09-20  7:35 ` [PATCH 5/7] ASoC: codecs: lpass-rx-macro: " Srinivasa Rao Mandadapu
@ 2021-09-20  7:35 ` Srinivasa Rao Mandadapu
  2021-09-20  7:35 ` [PATCH 7/7] ASoC: codecs: lpass-va-macro: set mclk clock rate correctly Srinivasa Rao Mandadapu
  6 siblings, 0 replies; 20+ messages in thread
From: Srinivasa Rao Mandadapu @ 2021-09-20  7:35 UTC (permalink / raw)
  To: agross, bjorn.andersson, lgirdwood, broonie, robh+dt, plai,
	bgoswami, perex, tiwai, srinivas.kandagatla, rohitkr,
	linux-arm-msm, alsa-devel, devicetree, linux-kernel, swboyd,
	judyhsiao
  Cc: Venkata Prasad Potturu, Srinivasa Rao Mandadapu

Change bulk clock frequency voting to individual voting.

Fixes: c39667ddcfc5 (ASoC: codecs: lpass-tx-macro: add support for lpass tx macro)

Signed-off-by: Venkata Prasad Potturu <potturu@codeaurora.org>
Signed-off-by: Srinivasa Rao Mandadapu <srivasam@codeaurora.org>
---
 sound/soc/codecs/lpass-tx-macro.c | 67 +++++++++++++++++++++++++++------------
 1 file changed, 47 insertions(+), 20 deletions(-)

diff --git a/sound/soc/codecs/lpass-tx-macro.c b/sound/soc/codecs/lpass-tx-macro.c
index e65b592..78e5e0b 100644
--- a/sound/soc/codecs/lpass-tx-macro.c
+++ b/sound/soc/codecs/lpass-tx-macro.c
@@ -6,6 +6,7 @@
 #include <linux/clk.h>
 #include <linux/io.h>
 #include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
 #include <linux/regmap.h>
 #include <sound/soc.h>
 #include <sound/soc-dapm.h>
@@ -258,7 +259,11 @@ struct tx_macro {
 	unsigned long active_ch_cnt[TX_MACRO_MAX_DAIS];
 	unsigned long active_decimator[TX_MACRO_MAX_DAIS];
 	struct regmap *regmap;
-	struct clk_bulk_data clks[TX_NUM_CLKS_MAX];
+	struct clk *mclk;
+	struct clk *npl;
+	struct clk *macro;
+	struct clk *dcodec;
+	struct clk *fsgen;
 	struct clk_hw hw;
 	bool dec_active[NUM_DECIMATORS];
 	bool reset_swr;
@@ -1695,7 +1700,9 @@ static int swclk_gate_enable(struct clk_hw *hw)
 {
 	struct tx_macro *tx = to_tx_macro(hw);
 	struct regmap *regmap = tx->regmap;
-
+	pm_runtime_get_sync(tx->dev);
+	clk_set_rate(tx->npl, 2 * MCLK_FREQ);
+	clk_prepare_enable(tx->npl);
 	tx_macro_mclk_enable(tx, true);
 	if (tx->reset_swr)
 		regmap_update_bits(regmap, CDC_TX_CLK_RST_CTRL_SWR_CONTROL,
@@ -1722,6 +1729,7 @@ static void swclk_gate_disable(struct clk_hw *hw)
 			   CDC_TX_SWR_CLK_EN_MASK, 0x0);
 
 	tx_macro_mclk_enable(tx, false);
+	clk_disable_unprepare(tx->npl);
 }
 
 static int swclk_gate_is_enabled(struct clk_hw *hw)
@@ -1759,7 +1767,7 @@ static struct clk *tx_macro_register_mclk_output(struct tx_macro *tx)
 	struct clk_init_data init;
 	int ret;
 
-	parent_clk_name = __clk_get_name(tx->clks[2].clk);
+	parent_clk_name = __clk_get_name(tx->mclk);
 
 	init.name = clk_name;
 	init.ops = &swclk_gate_ops;
@@ -1799,17 +1807,25 @@ static int tx_macro_probe(struct platform_device *pdev)
 	if (!tx)
 		return -ENOMEM;
 
-	tx->clks[0].id = "macro";
-	tx->clks[1].id = "dcodec";
-	tx->clks[2].id = "mclk";
-	tx->clks[3].id = "npl";
-	tx->clks[4].id = "fsgen";
+	tx->mclk = devm_clk_get(dev, "mclk");
+	if (IS_ERR(tx->mclk))
+		return PTR_ERR(tx->mclk);
 
-	ret = devm_clk_bulk_get(dev, TX_NUM_CLKS_MAX, tx->clks);
-	if (ret) {
-		dev_err(dev, "Error getting RX Clocks (%d)\n", ret);
-		return ret;
-	}
+	tx->npl = devm_clk_get(dev, "npl");
+	if (IS_ERR(tx->npl))
+		return PTR_ERR(tx->npl);
+
+	tx->macro = devm_clk_get_optional(dev, "macro");
+	if (IS_ERR(tx->macro))
+		return PTR_ERR(tx->macro);
+
+	tx->dcodec = devm_clk_get_optional(dev, "dcodec");
+	if (IS_ERR(tx->dcodec))
+		return PTR_ERR(tx->dcodec);
+
+	tx->fsgen = devm_clk_get(dev, "fsgen");
+	if (IS_ERR(tx->fsgen))
+		return PTR_ERR(tx->fsgen);
 
 	base = devm_platform_ioremap_resource(pdev, 0);
 	if (IS_ERR(base))
@@ -1823,12 +1839,15 @@ static int tx_macro_probe(struct platform_device *pdev)
 	tx->dev = dev;
 
 	/* set MCLK and NPL rates */
-	clk_set_rate(tx->clks[2].clk, MCLK_FREQ);
-	clk_set_rate(tx->clks[3].clk, 2 * MCLK_FREQ);
+	clk_set_rate(tx->mclk, MCLK_FREQ);
+	clk_set_rate(tx->npl, 2 * MCLK_FREQ);
 
-	ret = clk_bulk_prepare_enable(TX_NUM_CLKS_MAX, tx->clks);
-	if (ret)
-		return ret;
+	clk_prepare_enable(tx->macro);
+	clk_prepare_enable(tx->dcodec);
+
+	clk_prepare_enable(tx->mclk);
+	clk_prepare_enable(tx->npl);
+	clk_prepare_enable(tx->fsgen);
 
 	tx_macro_register_mclk_output(tx);
 
@@ -1839,7 +1858,11 @@ static int tx_macro_probe(struct platform_device *pdev)
 		goto err;
 	return ret;
 err:
-	clk_bulk_disable_unprepare(TX_NUM_CLKS_MAX, tx->clks);
+	clk_disable_unprepare(tx->mclk);
+	clk_disable_unprepare(tx->npl);
+	clk_disable_unprepare(tx->macro);
+	clk_disable_unprepare(tx->dcodec);
+	clk_disable_unprepare(tx->fsgen);
 
 	return ret;
 }
@@ -1850,7 +1873,11 @@ static int tx_macro_remove(struct platform_device *pdev)
 
 	of_clk_del_provider(pdev->dev.of_node);
 
-	clk_bulk_disable_unprepare(TX_NUM_CLKS_MAX, tx->clks);
+	clk_disable_unprepare(tx->mclk);
+	clk_disable_unprepare(tx->npl);
+	clk_disable_unprepare(tx->macro);
+	clk_disable_unprepare(tx->dcodec);
+	clk_disable_unprepare(tx->fsgen);
 
 	return 0;
 }
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.


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

* [PATCH 7/7] ASoC: codecs: lpass-va-macro: set mclk clock rate correctly
  2021-09-20  7:35 [PATCH 0/7] Update Lpass digital codec macro drivers Srinivasa Rao Mandadapu
                   ` (5 preceding siblings ...)
  2021-09-20  7:35 ` [PATCH 6/7] ASoC: codecs: lpass-tx-macro: " Srinivasa Rao Mandadapu
@ 2021-09-20  7:35 ` Srinivasa Rao Mandadapu
  6 siblings, 0 replies; 20+ messages in thread
From: Srinivasa Rao Mandadapu @ 2021-09-20  7:35 UTC (permalink / raw)
  To: agross, bjorn.andersson, lgirdwood, broonie, robh+dt, plai,
	bgoswami, perex, tiwai, srinivas.kandagatla, rohitkr,
	linux-arm-msm, alsa-devel, devicetree, linux-kernel, swboyd,
	judyhsiao
  Cc: Venkata Prasad Potturu, Srinivasa Rao Mandadapu

Update mclk clock frequency from 9.6MHz to 19.2MHz.

Fixes: 908e6b1df26e (ASoC: codecs: lpass-va-macro: Add support to VA Macro)

Signed-off-by: Venkata Prasad Potturu <potturu@codeaurora.org>
Signed-off-by: Srinivasa Rao Mandadapu <srivasam@codeaurora.org>
---
 sound/soc/codecs/lpass-va-macro.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/lpass-va-macro.c b/sound/soc/codecs/lpass-va-macro.c
index 0ea39ae..f2ab09b 100644
--- a/sound/soc/codecs/lpass-va-macro.c
+++ b/sound/soc/codecs/lpass-va-macro.c
@@ -1353,7 +1353,7 @@ static int va_macro_validate_dmic_sample_rate(u32 dmic_sample_rate,
 					      struct va_macro *va)
 {
 	u32 div_factor;
-	u32 mclk_rate = VA_MACRO_MCLK_FREQ;
+	u32 mclk_rate = 2 * VA_MACRO_MCLK_FREQ;
 
 	if (!dmic_sample_rate || mclk_rate % dmic_sample_rate != 0)
 		goto undefined_rate;
@@ -1432,7 +1432,7 @@ static int va_macro_probe(struct platform_device *pdev)
 	}
 
 	/* mclk rate */
-	clk_set_rate(va->mclk, VA_MACRO_MCLK_FREQ);
+	clk_set_rate(va->mclk, 2 * VA_MACRO_MCLK_FREQ);
 
 	clk_prepare_enable(va->mclk);
 	clk_prepare_enable(va->macro);
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.


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

* Re: [PATCH 2/7] ASoC: qcom: dt-bindings: Add compatible names for lpass sc7280 digital codecs
  2021-09-20  7:35 ` [PATCH 2/7] ASoC: qcom: dt-bindings: Add compatible names for lpass sc7280 digital codecs Srinivasa Rao Mandadapu
@ 2021-09-20 13:24   ` Srinivas Kandagatla
  2021-09-21  6:59     ` Srinivasa Rao Mandadapu
  0 siblings, 1 reply; 20+ messages in thread
From: Srinivas Kandagatla @ 2021-09-20 13:24 UTC (permalink / raw)
  To: Srinivasa Rao Mandadapu, agross, bjorn.andersson, lgirdwood,
	broonie, robh+dt, plai, bgoswami, perex, tiwai, rohitkr,
	linux-arm-msm, alsa-devel, devicetree, linux-kernel, swboyd,
	judyhsiao
  Cc: Venkata Prasad Potturu



On 20/09/2021 08:35, Srinivasa Rao Mandadapu wrote:
> Update compatible names in va, wsa, rx and tx macro codes for lpass sc7280
> 
> Signed-off-by: Venkata Prasad Potturu <potturu@codeaurora.org>
> Signed-off-by: Srinivasa Rao Mandadapu <srivasam@codeaurora.org>
> ---
>   Documentation/devicetree/bindings/sound/qcom,lpass-rx-macro.yaml  | 4 +++-
>   Documentation/devicetree/bindings/sound/qcom,lpass-tx-macro.yaml  | 4 +++-
>   Documentation/devicetree/bindings/sound/qcom,lpass-va-macro.yaml  | 4 +++-
>   Documentation/devicetree/bindings/sound/qcom,lpass-wsa-macro.yaml | 4 +++-
>   4 files changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/sound/qcom,lpass-rx-macro.yaml b/Documentation/devicetree/bindings/sound/qcom,lpass-rx-macro.yaml
> index 443d556..a4e767e 100644
> --- a/Documentation/devicetree/bindings/sound/qcom,lpass-rx-macro.yaml
> +++ b/Documentation/devicetree/bindings/sound/qcom,lpass-rx-macro.yaml
> @@ -11,7 +11,9 @@ maintainers:
>   
>   properties:
>     compatible:
> -    const: qcom,sm8250-lpass-rx-macro
> +    oneOf:
> +      - const: qcom,sm8250-lpass-rx-macro
> +      - const: qcom,sc7280-lpass-rx-macro
>   
Recently Rob did tree wide change to use enum instead of oneOf for below 
reason
"
'enum' is equivalent to 'oneOf' with a list of 'const' entries, but 
'enum' is more concise and yields better error messages."

So, can you move these to enums like:

enum:
   - qcom,sm8250-lpass-rx-macro
   - qcom,sc7280-lpass-rx-macro

--srini

>     reg:
>       maxItems: 1
> diff --git a/Documentation/devicetree/bindings/sound/qcom,lpass-tx-macro.yaml b/Documentation/devicetree/bindings/sound/qcom,lpass-tx-macro.yaml
> index 6b5ca02..cdec478 100644
> --- a/Documentation/devicetree/bindings/sound/qcom,lpass-tx-macro.yaml
> +++ b/Documentation/devicetree/bindings/sound/qcom,lpass-tx-macro.yaml
> @@ -11,7 +11,9 @@ maintainers:
>   
>   properties:
>     compatible:
> -    const: qcom,sm8250-lpass-tx-macro
> +    oneOf:
> +      - const: qcom,sm8250-lpass-tx-macro
> +      - const: qcom,sc7280-lpass-tx-macro
>   
>     reg:
>       maxItems: 1
> diff --git a/Documentation/devicetree/bindings/sound/qcom,lpass-va-macro.yaml b/Documentation/devicetree/bindings/sound/qcom,lpass-va-macro.yaml
> index 679b49c..e15bc05 100644
> --- a/Documentation/devicetree/bindings/sound/qcom,lpass-va-macro.yaml
> +++ b/Documentation/devicetree/bindings/sound/qcom,lpass-va-macro.yaml
> @@ -11,7 +11,9 @@ maintainers:
>   
>   properties:
>     compatible:
> -    const: qcom,sm8250-lpass-va-macro
> +    oneOf:
> +      - const: qcom,sm8250-lpass-va-macro
> +      - const: qcom,sc7280-lpass-va-macro
>   
>     reg:
>       maxItems: 1
> diff --git a/Documentation/devicetree/bindings/sound/qcom,lpass-wsa-macro.yaml b/Documentation/devicetree/bindings/sound/qcom,lpass-wsa-macro.yaml
> index 435b019..2dcccb5 100644
> --- a/Documentation/devicetree/bindings/sound/qcom,lpass-wsa-macro.yaml
> +++ b/Documentation/devicetree/bindings/sound/qcom,lpass-wsa-macro.yaml
> @@ -11,7 +11,9 @@ maintainers:
>   
>   properties:
>     compatible:
> -    const: qcom,sm8250-lpass-wsa-macro
> +    oneOf:
> +      - const: qcom,sm8250-lpass-wsa-macro
> +      - const: qcom,sc7280-lpass-wsa-macro
>   
>     reg:
>       maxItems: 1
> 

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

* Re: [PATCH 3/7] ASoC: codecs: tx-macro: Change mic control registers to volatile
  2021-09-20  7:35 ` [PATCH 3/7] ASoC: codecs: tx-macro: Change mic control registers to volatile Srinivasa Rao Mandadapu
@ 2021-09-20 13:24   ` Srinivas Kandagatla
  2021-09-21  7:30     ` Srinivasa Rao Mandadapu
  0 siblings, 1 reply; 20+ messages in thread
From: Srinivas Kandagatla @ 2021-09-20 13:24 UTC (permalink / raw)
  To: Srinivasa Rao Mandadapu, agross, bjorn.andersson, lgirdwood,
	broonie, robh+dt, plai, bgoswami, perex, tiwai, rohitkr,
	linux-arm-msm, alsa-devel, devicetree, linux-kernel, swboyd,
	judyhsiao
  Cc: Venkata Prasad Potturu



On 20/09/2021 08:35, Srinivasa Rao Mandadapu wrote:
> Update amic and dmic related tx macro control registers to volatile
> 
> Fixes: c39667ddcfc5 (ASoC: codecs: lpass-tx-macro: add support for lpass tx macro)
> 
> Signed-off-by: Venkata Prasad Potturu <potturu@codeaurora.org>
> Signed-off-by: Srinivasa Rao Mandadapu <srivasam@codeaurora.org>
> ---
>   sound/soc/codecs/lpass-tx-macro.c | 13 +++++++++++++
>   1 file changed, 13 insertions(+)
> 
> diff --git a/sound/soc/codecs/lpass-tx-macro.c b/sound/soc/codecs/lpass-tx-macro.c
> index 9273724..e65b592 100644
> --- a/sound/soc/codecs/lpass-tx-macro.c
> +++ b/sound/soc/codecs/lpass-tx-macro.c
> @@ -423,6 +423,13 @@ static bool tx_is_volatile_register(struct device *dev, unsigned int reg)
>   	case CDC_TX_TOP_CSR_SWR_DMIC1_CTL:
>   	case CDC_TX_TOP_CSR_SWR_DMIC2_CTL:
>   	case CDC_TX_TOP_CSR_SWR_DMIC3_CTL:
> +	case CDC_TX_TOP_CSR_SWR_AMIC0_CTL:
> +	case CDC_TX_TOP_CSR_SWR_AMIC1_CTL:
> +	case CDC_TX_CLK_RST_CTRL_MCLK_CONTROL:
> +	case CDC_TX_CLK_RST_CTRL_FS_CNT_CONTROL:
> +	case CDC_TX_CLK_RST_CTRL_SWR_CONTROL:
> +	case CDC_TX_TOP_CSR_SWR_CTRL:
> +	case CDC_TX0_TX_PATH_SEC7:

Why are these marked as Volatile?
Can you provide some details on the issue that you are seeing?

--srini


>   		return true;
>   	}
>   	return false;
> @@ -1674,6 +1681,12 @@ static int tx_macro_component_probe(struct snd_soc_component *comp)
>   
>   	snd_soc_component_update_bits(comp, CDC_TX0_TX_PATH_SEC7, 0x3F,
>   				      0x0A);
> +	snd_soc_component_update_bits(comp, CDC_TX_TOP_CSR_SWR_AMIC0_CTL, 0xFF, 0x00);
> +	snd_soc_component_update_bits(comp, CDC_TX_TOP_CSR_SWR_AMIC1_CTL, 0xFF, 0x00);
> +	snd_soc_component_update_bits(comp, CDC_TX_TOP_CSR_SWR_DMIC0_CTL, 0xFF, 0x00);
> +	snd_soc_component_update_bits(comp, CDC_TX_TOP_CSR_SWR_DMIC1_CTL, 0xFF, 0x00);
> +	snd_soc_component_update_bits(comp, CDC_TX_TOP_CSR_SWR_DMIC2_CTL, 0xFF, 0x00);
> +	snd_soc_component_update_bits(comp, CDC_TX_TOP_CSR_SWR_DMIC3_CTL, 0xFF, 0x00);
>   
>   	return 0;
>   }
> 

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

* Re: [PATCH 4/7] ASoC: codecs: lpass-va-macro: Change bulk voting to individual clock voting
  2021-09-20  7:35 ` [PATCH 4/7] ASoC: codecs: lpass-va-macro: Change bulk voting to individual clock voting Srinivasa Rao Mandadapu
@ 2021-09-20 13:25   ` Srinivas Kandagatla
  2021-09-21  8:14     ` Srinivasa Rao Mandadapu
  0 siblings, 1 reply; 20+ messages in thread
From: Srinivas Kandagatla @ 2021-09-20 13:25 UTC (permalink / raw)
  To: Srinivasa Rao Mandadapu, agross, bjorn.andersson, lgirdwood,
	broonie, robh+dt, plai, bgoswami, perex, tiwai, rohitkr,
	linux-arm-msm, alsa-devel, devicetree, linux-kernel, swboyd,
	judyhsiao
  Cc: Venkata Prasad Potturu



On 20/09/2021 08:35, Srinivasa Rao Mandadapu wrote:
> Change bulk clock frequency voting to individual voting.
> 
Can you please explain why do we need to move out using clk bulk apis?

Am not seeing any thing obvious behavior changing as part of this patch, 
more details please..
> Fixes: 908e6b1df26e (ASoC: codecs: lpass-va-macro: Add support to VA Macro)

Why this has Fixes tag? Are we fixing any bug with this patch?

> 
> Signed-off-by: Venkata Prasad Potturu <potturu@codeaurora.org>
> Signed-off-by: Srinivasa Rao Mandadapu <srivasam@codeaurora.org>
> ---
>   sound/soc/codecs/lpass-va-macro.c | 46 ++++++++++++++++++++++++---------------
>   1 file changed, 28 insertions(+), 18 deletions(-)
> 
> diff --git a/sound/soc/codecs/lpass-va-macro.c b/sound/soc/codecs/lpass-va-macro.c
> index d312a14..0ea39ae 100644
> --- a/sound/soc/codecs/lpass-va-macro.c
> +++ b/sound/soc/codecs/lpass-va-macro.c
> @@ -193,7 +193,10 @@ struct va_macro {
>   
>   	int dec_mode[VA_MACRO_NUM_DECIMATORS];
>   	struct regmap *regmap;
> -	struct clk_bulk_data clks[VA_NUM_CLKS_MAX];
> +	struct clk *mclk;
> +	struct clk *macro;
> +	struct clk *dcodec;
> +
>   	struct clk_hw hw;
>   
>   	s32 dmic_0_1_clk_cnt;
> @@ -1321,7 +1324,7 @@ static const struct clk_ops fsgen_gate_ops = {
>   
>   static int va_macro_register_fsgen_output(struct va_macro *va)
>   {
> -	struct clk *parent = va->clks[2].clk;
> +	struct clk *parent = va->mclk;
>   	struct device *dev = va->dev;
>   	struct device_node *np = dev->of_node;
>   	const char *parent_clk_name;
> @@ -1404,15 +1407,18 @@ static int va_macro_probe(struct platform_device *pdev)
>   		return -ENOMEM;
>   
>   	va->dev = dev;
> -	va->clks[0].id = "macro";
> -	va->clks[1].id = "dcodec";
> -	va->clks[2].id = "mclk";
>   
> -	ret = devm_clk_bulk_get(dev, VA_NUM_CLKS_MAX, va->clks);
> -	if (ret) {
> -		dev_err(dev, "Error getting VA Clocks (%d)\n", ret);
> -		return ret;
> -	}
> +	va->macro = devm_clk_get_optional(dev, "macro");
> +	if (IS_ERR(va->macro))
> +		return PTR_ERR(va->macro);
> +
> +	va->dcodec = devm_clk_get_optional(dev, "dcodec");
> +	if (IS_ERR(va->dcodec))
> +		return PTR_ERR(va->dcodec);
> +
> +	va->mclk = devm_clk_get(dev, "mclk");
> +	if (IS_ERR(va->mclk))
> +		return PTR_ERR(va->mclk);
>   
>   	ret = of_property_read_u32(dev->of_node, "qcom,dmic-sample-rate",
>   				   &sample_rate);
> @@ -1426,10 +1432,11 @@ static int va_macro_probe(struct platform_device *pdev)
>   	}
>   
>   	/* mclk rate */
> -	clk_set_rate(va->clks[1].clk, VA_MACRO_MCLK_FREQ);
> -	ret = clk_bulk_prepare_enable(VA_NUM_CLKS_MAX, va->clks);
> -	if (ret)
> -		return ret;
> +	clk_set_rate(va->mclk, VA_MACRO_MCLK_FREQ);
> +
> +	clk_prepare_enable(va->mclk);
> +	clk_prepare_enable(va->macro);
> +	clk_prepare_enable(va->dcodec);
>   
>   	base = devm_platform_ioremap_resource(pdev, 0);
>   	if (IS_ERR(base)) {
> @@ -1457,8 +1464,9 @@ static int va_macro_probe(struct platform_device *pdev)
>   	return ret;
>   
>   err:
> -	clk_bulk_disable_unprepare(VA_NUM_CLKS_MAX, va->clks);
> -
> +	clk_disable_unprepare(va->mclk);
> +	clk_disable_unprepare(va->macro);
> +	clk_disable_unprepare(va->dcodec);
>   	return ret;
>   }
>   
> @@ -1466,8 +1474,10 @@ static int va_macro_remove(struct platform_device *pdev)
>   {
>   	struct va_macro *va = dev_get_drvdata(&pdev->dev);
>   
> -	clk_bulk_disable_unprepare(VA_NUM_CLKS_MAX, va->clks);
> -
> +	of_clk_del_provider(pdev->dev.of_node);

fsgen clk is registered using devm_* variant of clk apis, so why do we 
need this here?


--srini
> +	clk_disable_unprepare(va->mclk);
> +	clk_disable_unprepare(va->macro);
> +	clk_disable_unprepare(va->dcodec);
>   	return 0;
>   }
>   
> 

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

* Re: [PATCH 1/7] ASoC: qcom: Add compatible names in va,wsa,rx,tx codec drivers for sc7280
  2021-09-20  7:35 ` [PATCH 1/7] ASoC: qcom: Add compatible names in va, wsa, rx, tx codec drivers for sc7280 Srinivasa Rao Mandadapu
@ 2021-09-20 18:17   ` Stephen Boyd
  2021-09-21  8:42     ` Srinivasa Rao Mandadapu
  0 siblings, 1 reply; 20+ messages in thread
From: Stephen Boyd @ 2021-09-20 18:17 UTC (permalink / raw)
  To: Srinivasa Rao Mandadapu, agross, alsa-devel, bgoswami,
	bjorn.andersson, broonie, devicetree, judyhsiao, lgirdwood,
	linux-arm-msm, linux-kernel, perex, plai, robh+dt, rohitkr,
	srinivas.kandagatla, tiwai
  Cc: Venkata Prasad Potturu

Quoting Srinivasa Rao Mandadapu (2021-09-20 00:35:25)
> Add compatible names for sc7280 based targets in digital codec drivers
> va,wsa,rx and tx.
>
> Signed-off-by: Venkata Prasad Potturu <potturu@codeaurora.org>
> Signed-off-by: Srinivasa Rao Mandadapu <srivasam@codeaurora.org>
> ---
>  sound/soc/codecs/lpass-rx-macro.c  | 1 +
>  sound/soc/codecs/lpass-tx-macro.c  | 1 +
>  sound/soc/codecs/lpass-va-macro.c  | 1 +
>  sound/soc/codecs/lpass-wsa-macro.c | 1 +
>  4 files changed, 4 insertions(+)
>
> diff --git a/sound/soc/codecs/lpass-rx-macro.c b/sound/soc/codecs/lpass-rx-macro.c
> index 196b068..520c760 100644
> --- a/sound/soc/codecs/lpass-rx-macro.c
> +++ b/sound/soc/codecs/lpass-rx-macro.c
> @@ -3578,6 +3578,7 @@ static int rx_macro_remove(struct platform_device *pdev)
>
>  static const struct of_device_id rx_macro_dt_match[] = {
>         { .compatible = "qcom,sm8250-lpass-rx-macro" },
> +       { .compatible = "qcom,sc7280-lpass-rx-macro" },

Please sort alphabetically on compatible string.

>         { }
>  };
>  MODULE_DEVICE_TABLE(of, rx_macro_dt_match);

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

* Re: [PATCH 2/7] ASoC: qcom: dt-bindings: Add compatible names for lpass sc7280 digital codecs
  2021-09-20 13:24   ` Srinivas Kandagatla
@ 2021-09-21  6:59     ` Srinivasa Rao Mandadapu
  0 siblings, 0 replies; 20+ messages in thread
From: Srinivasa Rao Mandadapu @ 2021-09-21  6:59 UTC (permalink / raw)
  To: Srinivas Kandagatla, agross, bjorn.andersson, lgirdwood, broonie,
	robh+dt, plai, bgoswami, perex, tiwai, rohitkr, linux-arm-msm,
	alsa-devel, devicetree, linux-kernel, swboyd, judyhsiao
  Cc: Venkata Prasad Potturu


On 9/20/2021 6:54 PM, Srinivas Kandagatla wrote:
Thanks for your time Srini!!
>
> On 20/09/2021 08:35, Srinivasa Rao Mandadapu wrote:
>> Update compatible names in va, wsa, rx and tx macro codes for lpass 
>> sc7280
>>
>> Signed-off-by: Venkata Prasad Potturu <potturu@codeaurora.org>
>> Signed-off-by: Srinivasa Rao Mandadapu <srivasam@codeaurora.org>
>> ---
>> Documentation/devicetree/bindings/sound/qcom,lpass-rx-macro.yaml | 4 
>> +++-
>> Documentation/devicetree/bindings/sound/qcom,lpass-tx-macro.yaml | 4 
>> +++-
>> Documentation/devicetree/bindings/sound/qcom,lpass-va-macro.yaml | 4 
>> +++-
>> Documentation/devicetree/bindings/sound/qcom,lpass-wsa-macro.yaml | 4 
>> +++-
>>   4 files changed, 12 insertions(+), 4 deletions(-)
>>
>> diff --git 
>> a/Documentation/devicetree/bindings/sound/qcom,lpass-rx-macro.yaml 
>> b/Documentation/devicetree/bindings/sound/qcom,lpass-rx-macro.yaml
>> index 443d556..a4e767e 100644
>> --- a/Documentation/devicetree/bindings/sound/qcom,lpass-rx-macro.yaml
>> +++ b/Documentation/devicetree/bindings/sound/qcom,lpass-rx-macro.yaml
>> @@ -11,7 +11,9 @@ maintainers:
>>     properties:
>>     compatible:
>> -    const: qcom,sm8250-lpass-rx-macro
>> +    oneOf:
>> +      - const: qcom,sm8250-lpass-rx-macro
>> +      - const: qcom,sc7280-lpass-rx-macro
> Recently Rob did tree wide change to use enum instead of oneOf for 
> below reason
> "
> 'enum' is equivalent to 'oneOf' with a list of 'const' entries, but 
> 'enum' is more concise and yields better error messages."
>
> So, can you move these to enums like:
>
> enum:
>   - qcom,sm8250-lpass-rx-macro
>   - qcom,sc7280-lpass-rx-macro
>
> --srini
Okay. will change accordingly and post it.
>
>>     reg:
>>       maxItems: 1
>> diff --git 
>> a/Documentation/devicetree/bindings/sound/qcom,lpass-tx-macro.yaml 
>> b/Documentation/devicetree/bindings/sound/qcom,lpass-tx-macro.yaml
>> index 6b5ca02..cdec478 100644
>> --- a/Documentation/devicetree/bindings/sound/qcom,lpass-tx-macro.yaml
>> +++ b/Documentation/devicetree/bindings/sound/qcom,lpass-tx-macro.yaml
>> @@ -11,7 +11,9 @@ maintainers:
>>     properties:
>>     compatible:
>> -    const: qcom,sm8250-lpass-tx-macro
>> +    oneOf:
>> +      - const: qcom,sm8250-lpass-tx-macro
>> +      - const: qcom,sc7280-lpass-tx-macro
>>       reg:
>>       maxItems: 1
>> diff --git 
>> a/Documentation/devicetree/bindings/sound/qcom,lpass-va-macro.yaml 
>> b/Documentation/devicetree/bindings/sound/qcom,lpass-va-macro.yaml
>> index 679b49c..e15bc05 100644
>> --- a/Documentation/devicetree/bindings/sound/qcom,lpass-va-macro.yaml
>> +++ b/Documentation/devicetree/bindings/sound/qcom,lpass-va-macro.yaml
>> @@ -11,7 +11,9 @@ maintainers:
>>     properties:
>>     compatible:
>> -    const: qcom,sm8250-lpass-va-macro
>> +    oneOf:
>> +      - const: qcom,sm8250-lpass-va-macro
>> +      - const: qcom,sc7280-lpass-va-macro
>>       reg:
>>       maxItems: 1
>> diff --git 
>> a/Documentation/devicetree/bindings/sound/qcom,lpass-wsa-macro.yaml 
>> b/Documentation/devicetree/bindings/sound/qcom,lpass-wsa-macro.yaml
>> index 435b019..2dcccb5 100644
>> --- a/Documentation/devicetree/bindings/sound/qcom,lpass-wsa-macro.yaml
>> +++ b/Documentation/devicetree/bindings/sound/qcom,lpass-wsa-macro.yaml
>> @@ -11,7 +11,9 @@ maintainers:
>>     properties:
>>     compatible:
>> -    const: qcom,sm8250-lpass-wsa-macro
>> +    oneOf:
>> +      - const: qcom,sm8250-lpass-wsa-macro
>> +      - const: qcom,sc7280-lpass-wsa-macro
>>       reg:
>>       maxItems: 1
>>
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.


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

* Re: [PATCH 3/7] ASoC: codecs: tx-macro: Change mic control registers to volatile
  2021-09-20 13:24   ` Srinivas Kandagatla
@ 2021-09-21  7:30     ` Srinivasa Rao Mandadapu
  2021-09-21  8:48       ` Srinivas Kandagatla
  0 siblings, 1 reply; 20+ messages in thread
From: Srinivasa Rao Mandadapu @ 2021-09-21  7:30 UTC (permalink / raw)
  To: Srinivas Kandagatla, agross, bjorn.andersson, lgirdwood, broonie,
	robh+dt, plai, bgoswami, perex, tiwai, rohitkr, linux-arm-msm,
	alsa-devel, devicetree, linux-kernel, swboyd, judyhsiao
  Cc: Venkata Prasad Potturu


On 9/20/2021 6:54 PM, Srinivas Kandagatla wrote:
Thanks for your time Srini!!
>
> On 20/09/2021 08:35, Srinivasa Rao Mandadapu wrote:
>> Update amic and dmic related tx macro control registers to volatile
>>
>> Fixes: c39667ddcfc5 (ASoC: codecs: lpass-tx-macro: add support for 
>> lpass tx macro)
>>
>> Signed-off-by: Venkata Prasad Potturu <potturu@codeaurora.org>
>> Signed-off-by: Srinivasa Rao Mandadapu <srivasam@codeaurora.org>
>> ---
>>   sound/soc/codecs/lpass-tx-macro.c | 13 +++++++++++++
>>   1 file changed, 13 insertions(+)
>>
>> diff --git a/sound/soc/codecs/lpass-tx-macro.c 
>> b/sound/soc/codecs/lpass-tx-macro.c
>> index 9273724..e65b592 100644
>> --- a/sound/soc/codecs/lpass-tx-macro.c
>> +++ b/sound/soc/codecs/lpass-tx-macro.c
>> @@ -423,6 +423,13 @@ static bool tx_is_volatile_register(struct 
>> device *dev, unsigned int reg)
>>       case CDC_TX_TOP_CSR_SWR_DMIC1_CTL:
>>       case CDC_TX_TOP_CSR_SWR_DMIC2_CTL:
>>       case CDC_TX_TOP_CSR_SWR_DMIC3_CTL:
>> +    case CDC_TX_TOP_CSR_SWR_AMIC0_CTL:
>> +    case CDC_TX_TOP_CSR_SWR_AMIC1_CTL:
>> +    case CDC_TX_CLK_RST_CTRL_MCLK_CONTROL:
>> +    case CDC_TX_CLK_RST_CTRL_FS_CNT_CONTROL:
>> +    case CDC_TX_CLK_RST_CTRL_SWR_CONTROL:
>> +    case CDC_TX_TOP_CSR_SWR_CTRL:
>> +    case CDC_TX0_TX_PATH_SEC7:
>
> Why are these marked as Volatile?
> Can you provide some details on the issue that you are seeing?
>
> --srini

Without volatile these registers are not reflecting in Hardware and 
playback and capture is not working.

Will do recheck and keep only required registers as volatile.

>
>
>>           return true;
>>       }
>>       return false;
>> @@ -1674,6 +1681,12 @@ static int tx_macro_component_probe(struct 
>> snd_soc_component *comp)
>>         snd_soc_component_update_bits(comp, CDC_TX0_TX_PATH_SEC7, 0x3F,
>>                         0x0A);
>> +    snd_soc_component_update_bits(comp, 
>> CDC_TX_TOP_CSR_SWR_AMIC0_CTL, 0xFF, 0x00);
>> +    snd_soc_component_update_bits(comp, 
>> CDC_TX_TOP_CSR_SWR_AMIC1_CTL, 0xFF, 0x00);
>> +    snd_soc_component_update_bits(comp, 
>> CDC_TX_TOP_CSR_SWR_DMIC0_CTL, 0xFF, 0x00);
>> +    snd_soc_component_update_bits(comp, 
>> CDC_TX_TOP_CSR_SWR_DMIC1_CTL, 0xFF, 0x00);
>> +    snd_soc_component_update_bits(comp, 
>> CDC_TX_TOP_CSR_SWR_DMIC2_CTL, 0xFF, 0x00);
>> +    snd_soc_component_update_bits(comp, 
>> CDC_TX_TOP_CSR_SWR_DMIC3_CTL, 0xFF, 0x00);
>>         return 0;
>>   }
>>
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.


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

* Re: [PATCH 4/7] ASoC: codecs: lpass-va-macro: Change bulk voting to individual clock voting
  2021-09-20 13:25   ` Srinivas Kandagatla
@ 2021-09-21  8:14     ` Srinivasa Rao Mandadapu
  2021-09-21  8:50       ` Srinivas Kandagatla
  0 siblings, 1 reply; 20+ messages in thread
From: Srinivasa Rao Mandadapu @ 2021-09-21  8:14 UTC (permalink / raw)
  To: Srinivas Kandagatla, agross, bjorn.andersson, lgirdwood, broonie,
	robh+dt, plai, bgoswami, perex, tiwai, rohitkr, linux-arm-msm,
	alsa-devel, devicetree, linux-kernel, swboyd, judyhsiao
  Cc: Venkata Prasad Potturu


On 9/20/2021 6:55 PM, Srinivas Kandagatla wrote:
>
>
Thanks for Your time Srini!!!
> On 20/09/2021 08:35, Srinivasa Rao Mandadapu wrote:
>> Change bulk clock frequency voting to individual voting.
>>
> Can you please explain why do we need to move out using clk bulk apis?
>
> Am not seeing any thing obvious behavior changing as part of this 
> patch, more details please..

In ADSP bypass use case, few clocks like macro and decode, are optional. 
So is the main reason for move out.

And sometimes we are seeing bulk voting failed in Kodiak setup.

>> Fixes: 908e6b1df26e (ASoC: codecs: lpass-va-macro: Add support to VA 
>> Macro)
>
> Why this has Fixes tag? Are we fixing any bug with this patch?
Okay. As such we are not fixing any bug. Will remove this fixes tag on 
your suggestion.
>
>>
>> Signed-off-by: Venkata Prasad Potturu <potturu@codeaurora.org>
>> Signed-off-by: Srinivasa Rao Mandadapu <srivasam@codeaurora.org>
>> ---
>>   sound/soc/codecs/lpass-va-macro.c | 46 
>> ++++++++++++++++++++++++---------------
>>   1 file changed, 28 insertions(+), 18 deletions(-)
>>
>> diff --git a/sound/soc/codecs/lpass-va-macro.c 
>> b/sound/soc/codecs/lpass-va-macro.c
>> index d312a14..0ea39ae 100644
>> --- a/sound/soc/codecs/lpass-va-macro.c
>> +++ b/sound/soc/codecs/lpass-va-macro.c
>> @@ -193,7 +193,10 @@ struct va_macro {
>>         int dec_mode[VA_MACRO_NUM_DECIMATORS];
>>       struct regmap *regmap;
>> -    struct clk_bulk_data clks[VA_NUM_CLKS_MAX];
>> +    struct clk *mclk;
>> +    struct clk *macro;
>> +    struct clk *dcodec;
>> +
>>       struct clk_hw hw;
>>         s32 dmic_0_1_clk_cnt;
>> @@ -1321,7 +1324,7 @@ static const struct clk_ops fsgen_gate_ops = {
>>     static int va_macro_register_fsgen_output(struct va_macro *va)
>>   {
>> -    struct clk *parent = va->clks[2].clk;
>> +    struct clk *parent = va->mclk;
>>       struct device *dev = va->dev;
>>       struct device_node *np = dev->of_node;
>>       const char *parent_clk_name;
>> @@ -1404,15 +1407,18 @@ static int va_macro_probe(struct 
>> platform_device *pdev)
>>           return -ENOMEM;
>>         va->dev = dev;
>> -    va->clks[0].id = "macro";
>> -    va->clks[1].id = "dcodec";
>> -    va->clks[2].id = "mclk";
>>   -    ret = devm_clk_bulk_get(dev, VA_NUM_CLKS_MAX, va->clks);
>> -    if (ret) {
>> -        dev_err(dev, "Error getting VA Clocks (%d)\n", ret);
>> -        return ret;
>> -    }
>> +    va->macro = devm_clk_get_optional(dev, "macro");
>> +    if (IS_ERR(va->macro))
>> +        return PTR_ERR(va->macro);
>> +
>> +    va->dcodec = devm_clk_get_optional(dev, "dcodec");
>> +    if (IS_ERR(va->dcodec))
>> +        return PTR_ERR(va->dcodec);
>> +
>> +    va->mclk = devm_clk_get(dev, "mclk");
>> +    if (IS_ERR(va->mclk))
>> +        return PTR_ERR(va->mclk);
>>         ret = of_property_read_u32(dev->of_node, 
>> "qcom,dmic-sample-rate",
>>                      &sample_rate);
>> @@ -1426,10 +1432,11 @@ static int va_macro_probe(struct 
>> platform_device *pdev)
>>       }
>>         /* mclk rate */
>> -    clk_set_rate(va->clks[1].clk, VA_MACRO_MCLK_FREQ);
>> -    ret = clk_bulk_prepare_enable(VA_NUM_CLKS_MAX, va->clks);
>> -    if (ret)
>> -        return ret;
>> +    clk_set_rate(va->mclk, VA_MACRO_MCLK_FREQ);
>> +
>> +    clk_prepare_enable(va->mclk);
>> +    clk_prepare_enable(va->macro);
>> +    clk_prepare_enable(va->dcodec);
>>         base = devm_platform_ioremap_resource(pdev, 0);
>>       if (IS_ERR(base)) {
>> @@ -1457,8 +1464,9 @@ static int va_macro_probe(struct 
>> platform_device *pdev)
>>       return ret;
>>     err:
>> -    clk_bulk_disable_unprepare(VA_NUM_CLKS_MAX, va->clks);
>> -
>> +    clk_disable_unprepare(va->mclk);
>> +    clk_disable_unprepare(va->macro);
>> +    clk_disable_unprepare(va->dcodec);
>>       return ret;
>>   }
>>   @@ -1466,8 +1474,10 @@ static int va_macro_remove(struct 
>> platform_device *pdev)
>>   {
>>       struct va_macro *va = dev_get_drvdata(&pdev->dev);
>>   -    clk_bulk_disable_unprepare(VA_NUM_CLKS_MAX, va->clks);
>> -
>> +    of_clk_del_provider(pdev->dev.of_node);
>
> fsgen clk is registered using devm_* variant of clk apis, so why do we 
> need this here?
>
Okay. Will remove it and post new patch.
>
> --srini
>> +    clk_disable_unprepare(va->mclk);
>> +    clk_disable_unprepare(va->macro);
>> +    clk_disable_unprepare(va->dcodec);
>>       return 0;
>>   }
>>
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.


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

* Re: [PATCH 1/7] ASoC: qcom: Add compatible names in va,wsa,rx,tx codec drivers for sc7280
  2021-09-20 18:17   ` [PATCH 1/7] ASoC: qcom: Add compatible names in va,wsa,rx,tx " Stephen Boyd
@ 2021-09-21  8:42     ` Srinivasa Rao Mandadapu
  0 siblings, 0 replies; 20+ messages in thread
From: Srinivasa Rao Mandadapu @ 2021-09-21  8:42 UTC (permalink / raw)
  To: Stephen Boyd, agross, alsa-devel, bgoswami, bjorn.andersson,
	broonie, devicetree, judyhsiao, lgirdwood, linux-arm-msm,
	linux-kernel, perex, plai, robh+dt, rohitkr, srinivas.kandagatla,
	tiwai
  Cc: Venkata Prasad Potturu


On 9/20/2021 11:47 PM, Stephen Boyd wrote:
Thanks for Your time Stephen!!!
> Quoting Srinivasa Rao Mandadapu (2021-09-20 00:35:25)
>> Add compatible names for sc7280 based targets in digital codec drivers
>> va,wsa,rx and tx.
>>
>> Signed-off-by: Venkata Prasad Potturu <potturu@codeaurora.org>
>> Signed-off-by: Srinivasa Rao Mandadapu <srivasam@codeaurora.org>
>> ---
>>   sound/soc/codecs/lpass-rx-macro.c  | 1 +
>>   sound/soc/codecs/lpass-tx-macro.c  | 1 +
>>   sound/soc/codecs/lpass-va-macro.c  | 1 +
>>   sound/soc/codecs/lpass-wsa-macro.c | 1 +
>>   4 files changed, 4 insertions(+)
>>
>> diff --git a/sound/soc/codecs/lpass-rx-macro.c b/sound/soc/codecs/lpass-rx-macro.c
>> index 196b068..520c760 100644
>> --- a/sound/soc/codecs/lpass-rx-macro.c
>> +++ b/sound/soc/codecs/lpass-rx-macro.c
>> @@ -3578,6 +3578,7 @@ static int rx_macro_remove(struct platform_device *pdev)
>>
>>   static const struct of_device_id rx_macro_dt_match[] = {
>>          { .compatible = "qcom,sm8250-lpass-rx-macro" },
>> +       { .compatible = "qcom,sc7280-lpass-rx-macro" },
> Please sort alphabetically on compatible string.
Okay. will change and post new patch.
>>          { }
>>   };
>>   MODULE_DEVICE_TABLE(of, rx_macro_dt_match);

-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.


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

* Re: [PATCH 3/7] ASoC: codecs: tx-macro: Change mic control registers to volatile
  2021-09-21  7:30     ` Srinivasa Rao Mandadapu
@ 2021-09-21  8:48       ` Srinivas Kandagatla
  2021-09-21 13:02         ` Srinivasa Rao Mandadapu
  0 siblings, 1 reply; 20+ messages in thread
From: Srinivas Kandagatla @ 2021-09-21  8:48 UTC (permalink / raw)
  To: Srinivasa Rao Mandadapu, agross, bjorn.andersson, lgirdwood,
	broonie, robh+dt, plai, bgoswami, perex, tiwai, rohitkr,
	linux-arm-msm, alsa-devel, devicetree, linux-kernel, swboyd,
	judyhsiao
  Cc: Venkata Prasad Potturu



On 21/09/2021 08:30, Srinivasa Rao Mandadapu wrote:
> 
> On 9/20/2021 6:54 PM, Srinivas Kandagatla wrote:
> Thanks for your time Srini!!
>>
>> On 20/09/2021 08:35, Srinivasa Rao Mandadapu wrote:
>>> Update amic and dmic related tx macro control registers to volatile
>>>
>>> Fixes: c39667ddcfc5 (ASoC: codecs: lpass-tx-macro: add support for 
>>> lpass tx macro)
>>>
>>> Signed-off-by: Venkata Prasad Potturu <potturu@codeaurora.org>
>>> Signed-off-by: Srinivasa Rao Mandadapu <srivasam@codeaurora.org>
>>> ---
>>>   sound/soc/codecs/lpass-tx-macro.c | 13 +++++++++++++
>>>   1 file changed, 13 insertions(+)
>>>
>>> diff --git a/sound/soc/codecs/lpass-tx-macro.c 
>>> b/sound/soc/codecs/lpass-tx-macro.c
>>> index 9273724..e65b592 100644
>>> --- a/sound/soc/codecs/lpass-tx-macro.c
>>> +++ b/sound/soc/codecs/lpass-tx-macro.c
>>> @@ -423,6 +423,13 @@ static bool tx_is_volatile_register(struct 
>>> device *dev, unsigned int reg)
>>>       case CDC_TX_TOP_CSR_SWR_DMIC1_CTL:
>>>       case CDC_TX_TOP_CSR_SWR_DMIC2_CTL:
>>>       case CDC_TX_TOP_CSR_SWR_DMIC3_CTL:
>>> +    case CDC_TX_TOP_CSR_SWR_AMIC0_CTL:
>>> +    case CDC_TX_TOP_CSR_SWR_AMIC1_CTL:
>>> +    case CDC_TX_CLK_RST_CTRL_MCLK_CONTROL:
>>> +    case CDC_TX_CLK_RST_CTRL_FS_CNT_CONTROL:
>>> +    case CDC_TX_CLK_RST_CTRL_SWR_CONTROL:
>>> +    case CDC_TX_TOP_CSR_SWR_CTRL:
>>> +    case CDC_TX0_TX_PATH_SEC7:
>>
>> Why are these marked as Volatile?
>> Can you provide some details on the issue that you are seeing?
>>
>> --srini
> 
> Without volatile these registers are not reflecting in Hardware and 
> playback and capture is not working.
> 
> Will do recheck and keep only required registers as volatile.

This sounds like a total hack to me,

this might be happening in your case:

The default values for this register are different to actual defaults.
Ex: CDC_TX_TOP_CSR_SWR_AMIC0_CTL default is 0x00
so writing 0x0 to this register will be no-op as there is no change in 
the register value as compared to default value as per regmap.

In you case make sure the hardware default values are correctly 
reflected in tx_defaults array.

Then setting the desired value should work.


--srini



> 
>>
>>
>>>           return true;
>>>       }
>>>       return false;
>>> @@ -1674,6 +1681,12 @@ static int tx_macro_component_probe(struct 
>>> snd_soc_component *comp)
>>>         snd_soc_component_update_bits(comp, CDC_TX0_TX_PATH_SEC7, 0x3F,
>>>                         0x0A);
>>> +    snd_soc_component_update_bits(comp, 
>>> CDC_TX_TOP_CSR_SWR_AMIC0_CTL, 0xFF, 0x00);
>>> +    snd_soc_component_update_bits(comp, 
>>> CDC_TX_TOP_CSR_SWR_AMIC1_CTL, 0xFF, 0x00);
>>> +    snd_soc_component_update_bits(comp, 
>>> CDC_TX_TOP_CSR_SWR_DMIC0_CTL, 0xFF, 0x00);
>>> +    snd_soc_component_update_bits(comp, 
>>> CDC_TX_TOP_CSR_SWR_DMIC1_CTL, 0xFF, 0x00);
>>> +    snd_soc_component_update_bits(comp, 
>>> CDC_TX_TOP_CSR_SWR_DMIC2_CTL, 0xFF, 0x00);
>>> +    snd_soc_component_update_bits(comp, 
>>> CDC_TX_TOP_CSR_SWR_DMIC3_CTL, 0xFF, 0x00);
>>>         return 0;
>>>   }
>>>

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

* Re: [PATCH 4/7] ASoC: codecs: lpass-va-macro: Change bulk voting to individual clock voting
  2021-09-21  8:14     ` Srinivasa Rao Mandadapu
@ 2021-09-21  8:50       ` Srinivas Kandagatla
  2021-09-21 12:25         ` Srinivasa Rao Mandadapu
  0 siblings, 1 reply; 20+ messages in thread
From: Srinivas Kandagatla @ 2021-09-21  8:50 UTC (permalink / raw)
  To: Srinivasa Rao Mandadapu, agross, bjorn.andersson, lgirdwood,
	broonie, robh+dt, plai, bgoswami, perex, tiwai, rohitkr,
	linux-arm-msm, alsa-devel, devicetree, linux-kernel, swboyd,
	judyhsiao
  Cc: Venkata Prasad Potturu



On 21/09/2021 09:14, Srinivasa Rao Mandadapu wrote:
> 
> On 9/20/2021 6:55 PM, Srinivas Kandagatla wrote:
>>
>>
> Thanks for Your time Srini!!!
>> On 20/09/2021 08:35, Srinivasa Rao Mandadapu wrote:
>>> Change bulk clock frequency voting to individual voting.
>>>
>> Can you please explain why do we need to move out using clk bulk apis?
>>
>> Am not seeing any thing obvious behavior changing as part of this 
>> patch, more details please..
> 
> In ADSP bypass use case, few clocks like macro and decode, are optional. 
> So is the main reason for move out.


Have you tried using clk_bulk_get_optional()

--srini
> 
> And sometimes we are seeing bulk voting failed in Kodiak setup.
> 
>>> Fixes: 908e6b1df26e (ASoC: codecs: lpass-va-macro: Add support to VA 
>>> Macro)
>>
>> Why this has Fixes tag? Are we fixing any bug with this patch?
> Okay. As such we are not fixing any bug. Will remove this fixes tag on 
> your suggestion.
>>
>>>
>>> Signed-off-by: Venkata Prasad Potturu <potturu@codeaurora.org>
>>> Signed-off-by: Srinivasa Rao Mandadapu <srivasam@codeaurora.org>
>>> ---
>>>   sound/soc/codecs/lpass-va-macro.c | 46 
>>> ++++++++++++++++++++++++---------------
>>>   1 file changed, 28 insertions(+), 18 deletions(-)
>>>
>>> diff --git a/sound/soc/codecs/lpass-va-macro.c 
>>> b/sound/soc/codecs/lpass-va-macro.c
>>> index d312a14..0ea39ae 100644
>>> --- a/sound/soc/codecs/lpass-va-macro.c
>>> +++ b/sound/soc/codecs/lpass-va-macro.c
>>> @@ -193,7 +193,10 @@ struct va_macro {
>>>         int dec_mode[VA_MACRO_NUM_DECIMATORS];
>>>       struct regmap *regmap;
>>> -    struct clk_bulk_data clks[VA_NUM_CLKS_MAX];
>>> +    struct clk *mclk;
>>> +    struct clk *macro;
>>> +    struct clk *dcodec;
>>> +
>>>       struct clk_hw hw;
>>>         s32 dmic_0_1_clk_cnt;
>>> @@ -1321,7 +1324,7 @@ static const struct clk_ops fsgen_gate_ops = {
>>>     static int va_macro_register_fsgen_output(struct va_macro *va)
>>>   {
>>> -    struct clk *parent = va->clks[2].clk;
>>> +    struct clk *parent = va->mclk;
>>>       struct device *dev = va->dev;
>>>       struct device_node *np = dev->of_node;
>>>       const char *parent_clk_name;
>>> @@ -1404,15 +1407,18 @@ static int va_macro_probe(struct 
>>> platform_device *pdev)
>>>           return -ENOMEM;
>>>         va->dev = dev;
>>> -    va->clks[0].id = "macro";
>>> -    va->clks[1].id = "dcodec";
>>> -    va->clks[2].id = "mclk";
>>>   -    ret = devm_clk_bulk_get(dev, VA_NUM_CLKS_MAX, va->clks);
>>> -    if (ret) {
>>> -        dev_err(dev, "Error getting VA Clocks (%d)\n", ret);
>>> -        return ret;
>>> -    }
>>> +    va->macro = devm_clk_get_optional(dev, "macro");
>>> +    if (IS_ERR(va->macro))
>>> +        return PTR_ERR(va->macro);
>>> +
>>> +    va->dcodec = devm_clk_get_optional(dev, "dcodec");
>>> +    if (IS_ERR(va->dcodec))
>>> +        return PTR_ERR(va->dcodec);
>>> +
>>> +    va->mclk = devm_clk_get(dev, "mclk");
>>> +    if (IS_ERR(va->mclk))
>>> +        return PTR_ERR(va->mclk);
>>>         ret = of_property_read_u32(dev->of_node, 
>>> "qcom,dmic-sample-rate",
>>>                      &sample_rate);
>>> @@ -1426,10 +1432,11 @@ static int va_macro_probe(struct 
>>> platform_device *pdev)
>>>       }
>>>         /* mclk rate */
>>> -    clk_set_rate(va->clks[1].clk, VA_MACRO_MCLK_FREQ);
>>> -    ret = clk_bulk_prepare_enable(VA_NUM_CLKS_MAX, va->clks);
>>> -    if (ret)
>>> -        return ret;
>>> +    clk_set_rate(va->mclk, VA_MACRO_MCLK_FREQ);
>>> +
>>> +    clk_prepare_enable(va->mclk);
>>> +    clk_prepare_enable(va->macro);
>>> +    clk_prepare_enable(va->dcodec);
>>>         base = devm_platform_ioremap_resource(pdev, 0);
>>>       if (IS_ERR(base)) {
>>> @@ -1457,8 +1464,9 @@ static int va_macro_probe(struct 
>>> platform_device *pdev)
>>>       return ret;
>>>     err:
>>> -    clk_bulk_disable_unprepare(VA_NUM_CLKS_MAX, va->clks);
>>> -
>>> +    clk_disable_unprepare(va->mclk);
>>> +    clk_disable_unprepare(va->macro);
>>> +    clk_disable_unprepare(va->dcodec);
>>>       return ret;
>>>   }
>>>   @@ -1466,8 +1474,10 @@ static int va_macro_remove(struct 
>>> platform_device *pdev)
>>>   {
>>>       struct va_macro *va = dev_get_drvdata(&pdev->dev);
>>>   -    clk_bulk_disable_unprepare(VA_NUM_CLKS_MAX, va->clks);
>>> -
>>> +    of_clk_del_provider(pdev->dev.of_node);
>>
>> fsgen clk is registered using devm_* variant of clk apis, so why do we 
>> need this here?
>>
> Okay. Will remove it and post new patch.
>>
>> --srini
>>> +    clk_disable_unprepare(va->mclk);
>>> +    clk_disable_unprepare(va->macro);
>>> +    clk_disable_unprepare(va->dcodec);
>>>       return 0;
>>>   }
>>>

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

* Re: [PATCH 4/7] ASoC: codecs: lpass-va-macro: Change bulk voting to individual clock voting
  2021-09-21  8:50       ` Srinivas Kandagatla
@ 2021-09-21 12:25         ` Srinivasa Rao Mandadapu
  0 siblings, 0 replies; 20+ messages in thread
From: Srinivasa Rao Mandadapu @ 2021-09-21 12:25 UTC (permalink / raw)
  To: Srinivas Kandagatla, agross, bjorn.andersson, lgirdwood, broonie,
	robh+dt, plai, bgoswami, perex, tiwai, rohitkr, linux-arm-msm,
	alsa-devel, devicetree, linux-kernel, swboyd, judyhsiao
  Cc: Venkata Prasad Potturu


On 9/21/2021 2:20 PM, Srinivas Kandagatla wrote:
>
>
> On 21/09/2021 09:14, Srinivasa Rao Mandadapu wrote:
>>
>> On 9/20/2021 6:55 PM, Srinivas Kandagatla wrote:
>>>
>>>
>> Thanks for Your time Srini!!!
>>> On 20/09/2021 08:35, Srinivasa Rao Mandadapu wrote:
>>>> Change bulk clock frequency voting to individual voting.
>>>>
>>> Can you please explain why do we need to move out using clk bulk apis?
>>>
>>> Am not seeing any thing obvious behavior changing as part of this 
>>> patch, more details please..
>>
>> In ADSP bypass use case, few clocks like macro and decode, are 
>> optional. So is the main reason for move out.
>
>
> Have you tried using clk_bulk_get_optional()
Tried with above API. It's working fine. Do you suggest to use this 
optional API?
>
> --srini
>>
>> And sometimes we are seeing bulk voting failed in Kodiak setup.
>>
>>>> Fixes: 908e6b1df26e (ASoC: codecs: lpass-va-macro: Add support to 
>>>> VA Macro)
>>>
>>> Why this has Fixes tag? Are we fixing any bug with this patch?
>> Okay. As such we are not fixing any bug. Will remove this fixes tag 
>> on your suggestion.
>>>
>>>>
>>>> Signed-off-by: Venkata Prasad Potturu <potturu@codeaurora.org>
>>>> Signed-off-by: Srinivasa Rao Mandadapu <srivasam@codeaurora.org>
>>>> ---
>>>>   sound/soc/codecs/lpass-va-macro.c | 46 
>>>> ++++++++++++++++++++++++---------------
>>>>   1 file changed, 28 insertions(+), 18 deletions(-)
>>>>
>>>> diff --git a/sound/soc/codecs/lpass-va-macro.c 
>>>> b/sound/soc/codecs/lpass-va-macro.c
>>>> index d312a14..0ea39ae 100644
>>>> --- a/sound/soc/codecs/lpass-va-macro.c
>>>> +++ b/sound/soc/codecs/lpass-va-macro.c
>>>> @@ -193,7 +193,10 @@ struct va_macro {
>>>>         int dec_mode[VA_MACRO_NUM_DECIMATORS];
>>>>       struct regmap *regmap;
>>>> -    struct clk_bulk_data clks[VA_NUM_CLKS_MAX];
>>>> +    struct clk *mclk;
>>>> +    struct clk *macro;
>>>> +    struct clk *dcodec;
>>>> +
>>>>       struct clk_hw hw;
>>>>         s32 dmic_0_1_clk_cnt;
>>>> @@ -1321,7 +1324,7 @@ static const struct clk_ops fsgen_gate_ops = {
>>>>     static int va_macro_register_fsgen_output(struct va_macro *va)
>>>>   {
>>>> -    struct clk *parent = va->clks[2].clk;
>>>> +    struct clk *parent = va->mclk;
>>>>       struct device *dev = va->dev;
>>>>       struct device_node *np = dev->of_node;
>>>>       const char *parent_clk_name;
>>>> @@ -1404,15 +1407,18 @@ static int va_macro_probe(struct 
>>>> platform_device *pdev)
>>>>           return -ENOMEM;
>>>>         va->dev = dev;
>>>> -    va->clks[0].id = "macro";
>>>> -    va->clks[1].id = "dcodec";
>>>> -    va->clks[2].id = "mclk";
>>>>   -    ret = devm_clk_bulk_get(dev, VA_NUM_CLKS_MAX, va->clks);
>>>> -    if (ret) {
>>>> -        dev_err(dev, "Error getting VA Clocks (%d)\n", ret);
>>>> -        return ret;
>>>> -    }
>>>> +    va->macro = devm_clk_get_optional(dev, "macro");
>>>> +    if (IS_ERR(va->macro))
>>>> +        return PTR_ERR(va->macro);
>>>> +
>>>> +    va->dcodec = devm_clk_get_optional(dev, "dcodec");
>>>> +    if (IS_ERR(va->dcodec))
>>>> +        return PTR_ERR(va->dcodec);
>>>> +
>>>> +    va->mclk = devm_clk_get(dev, "mclk");
>>>> +    if (IS_ERR(va->mclk))
>>>> +        return PTR_ERR(va->mclk);
>>>>         ret = of_property_read_u32(dev->of_node, 
>>>> "qcom,dmic-sample-rate",
>>>>                      &sample_rate);
>>>> @@ -1426,10 +1432,11 @@ static int va_macro_probe(struct 
>>>> platform_device *pdev)
>>>>       }
>>>>         /* mclk rate */
>>>> -    clk_set_rate(va->clks[1].clk, VA_MACRO_MCLK_FREQ);
>>>> -    ret = clk_bulk_prepare_enable(VA_NUM_CLKS_MAX, va->clks);
>>>> -    if (ret)
>>>> -        return ret;
>>>> +    clk_set_rate(va->mclk, VA_MACRO_MCLK_FREQ);
>>>> +
>>>> +    clk_prepare_enable(va->mclk);
>>>> +    clk_prepare_enable(va->macro);
>>>> +    clk_prepare_enable(va->dcodec);
>>>>         base = devm_platform_ioremap_resource(pdev, 0);
>>>>       if (IS_ERR(base)) {
>>>> @@ -1457,8 +1464,9 @@ static int va_macro_probe(struct 
>>>> platform_device *pdev)
>>>>       return ret;
>>>>     err:
>>>> -    clk_bulk_disable_unprepare(VA_NUM_CLKS_MAX, va->clks);
>>>> -
>>>> +    clk_disable_unprepare(va->mclk);
>>>> +    clk_disable_unprepare(va->macro);
>>>> +    clk_disable_unprepare(va->dcodec);
>>>>       return ret;
>>>>   }
>>>>   @@ -1466,8 +1474,10 @@ static int va_macro_remove(struct 
>>>> platform_device *pdev)
>>>>   {
>>>>       struct va_macro *va = dev_get_drvdata(&pdev->dev);
>>>>   -    clk_bulk_disable_unprepare(VA_NUM_CLKS_MAX, va->clks);
>>>> -
>>>> +    of_clk_del_provider(pdev->dev.of_node);
>>>
>>> fsgen clk is registered using devm_* variant of clk apis, so why do 
>>> we need this here?
>>>
>> Okay. Will remove it and post new patch.
>>>
>>> --srini
>>>> + clk_disable_unprepare(va->mclk);
>>>> +    clk_disable_unprepare(va->macro);
>>>> +    clk_disable_unprepare(va->dcodec);
>>>>       return 0;
>>>>   }
>>>>
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.


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

* Re: [PATCH 3/7] ASoC: codecs: tx-macro: Change mic control registers to volatile
  2021-09-21  8:48       ` Srinivas Kandagatla
@ 2021-09-21 13:02         ` Srinivasa Rao Mandadapu
  0 siblings, 0 replies; 20+ messages in thread
From: Srinivasa Rao Mandadapu @ 2021-09-21 13:02 UTC (permalink / raw)
  To: Srinivas Kandagatla, agross, bjorn.andersson, lgirdwood, broonie,
	robh+dt, plai, bgoswami, perex, tiwai, rohitkr, linux-arm-msm,
	alsa-devel, devicetree, linux-kernel, swboyd, judyhsiao
  Cc: Venkata Prasad Potturu


On 9/21/2021 2:18 PM, Srinivas Kandagatla wrote:
>
>
> On 21/09/2021 08:30, Srinivasa Rao Mandadapu wrote:
>>
>> On 9/20/2021 6:54 PM, Srinivas Kandagatla wrote:
>> Thanks for your time Srini!!
>>>
>>> On 20/09/2021 08:35, Srinivasa Rao Mandadapu wrote:
>>>> Update amic and dmic related tx macro control registers to volatile
>>>>
>>>> Fixes: c39667ddcfc5 (ASoC: codecs: lpass-tx-macro: add support for 
>>>> lpass tx macro)
>>>>
>>>> Signed-off-by: Venkata Prasad Potturu <potturu@codeaurora.org>
>>>> Signed-off-by: Srinivasa Rao Mandadapu <srivasam@codeaurora.org>
>>>> ---
>>>>   sound/soc/codecs/lpass-tx-macro.c | 13 +++++++++++++
>>>>   1 file changed, 13 insertions(+)
>>>>
>>>> diff --git a/sound/soc/codecs/lpass-tx-macro.c 
>>>> b/sound/soc/codecs/lpass-tx-macro.c
>>>> index 9273724..e65b592 100644
>>>> --- a/sound/soc/codecs/lpass-tx-macro.c
>>>> +++ b/sound/soc/codecs/lpass-tx-macro.c
>>>> @@ -423,6 +423,13 @@ static bool tx_is_volatile_register(struct 
>>>> device *dev, unsigned int reg)
>>>>       case CDC_TX_TOP_CSR_SWR_DMIC1_CTL:
>>>>       case CDC_TX_TOP_CSR_SWR_DMIC2_CTL:
>>>>       case CDC_TX_TOP_CSR_SWR_DMIC3_CTL:
>>>> +    case CDC_TX_TOP_CSR_SWR_AMIC0_CTL:
>>>> +    case CDC_TX_TOP_CSR_SWR_AMIC1_CTL:
>>>> +    case CDC_TX_CLK_RST_CTRL_MCLK_CONTROL:
>>>> +    case CDC_TX_CLK_RST_CTRL_FS_CNT_CONTROL:
>>>> +    case CDC_TX_CLK_RST_CTRL_SWR_CONTROL:
>>>> +    case CDC_TX_TOP_CSR_SWR_CTRL:
>>>> +    case CDC_TX0_TX_PATH_SEC7:
>>>
>>> Why are these marked as Volatile?
>>> Can you provide some details on the issue that you are seeing?
>>>
>>> --srini
>>
>> Without volatile these registers are not reflecting in Hardware and 
>> playback and capture is not working.
>>
>> Will do recheck and keep only required registers as volatile.
>
> This sounds like a total hack to me,
>
> this might be happening in your case:
>
> The default values for this register are different to actual defaults.
> Ex: CDC_TX_TOP_CSR_SWR_AMIC0_CTL default is 0x00
> so writing 0x0 to this register will be no-op as there is no change in 
> the register value as compared to default value as per regmap.
>
> In you case make sure the hardware default values are correctly 
> reflected in tx_defaults array.

The default values in tx_defaults are proper. But same value is not 
reflecting in Hardware, but In Cache it's reflecting set value.

>
> Then setting the desired value should work.
>
>
> --srini
>
>
>
>>
>>>
>>>
>>>>           return true;
>>>>       }
>>>>       return false;
>>>> @@ -1674,6 +1681,12 @@ static int tx_macro_component_probe(struct 
>>>> snd_soc_component *comp)
>>>>         snd_soc_component_update_bits(comp, CDC_TX0_TX_PATH_SEC7, 
>>>> 0x3F,
>>>>                         0x0A);
>>>> +    snd_soc_component_update_bits(comp, 
>>>> CDC_TX_TOP_CSR_SWR_AMIC0_CTL, 0xFF, 0x00);
>>>> +    snd_soc_component_update_bits(comp, 
>>>> CDC_TX_TOP_CSR_SWR_AMIC1_CTL, 0xFF, 0x00);
>>>> +    snd_soc_component_update_bits(comp, 
>>>> CDC_TX_TOP_CSR_SWR_DMIC0_CTL, 0xFF, 0x00);
>>>> +    snd_soc_component_update_bits(comp, 
>>>> CDC_TX_TOP_CSR_SWR_DMIC1_CTL, 0xFF, 0x00);
>>>> +    snd_soc_component_update_bits(comp, 
>>>> CDC_TX_TOP_CSR_SWR_DMIC2_CTL, 0xFF, 0x00);
>>>> +    snd_soc_component_update_bits(comp, 
>>>> CDC_TX_TOP_CSR_SWR_DMIC3_CTL, 0xFF, 0x00);
>>>>         return 0;
>>>>   }
>>>>
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.


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

end of thread, other threads:[~2021-09-21 13:04 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-20  7:35 [PATCH 0/7] Update Lpass digital codec macro drivers Srinivasa Rao Mandadapu
2021-09-20  7:35 ` [PATCH 1/7] ASoC: qcom: Add compatible names in va, wsa, rx, tx codec drivers for sc7280 Srinivasa Rao Mandadapu
2021-09-20 18:17   ` [PATCH 1/7] ASoC: qcom: Add compatible names in va,wsa,rx,tx " Stephen Boyd
2021-09-21  8:42     ` Srinivasa Rao Mandadapu
2021-09-20  7:35 ` [PATCH 2/7] ASoC: qcom: dt-bindings: Add compatible names for lpass sc7280 digital codecs Srinivasa Rao Mandadapu
2021-09-20 13:24   ` Srinivas Kandagatla
2021-09-21  6:59     ` Srinivasa Rao Mandadapu
2021-09-20  7:35 ` [PATCH 3/7] ASoC: codecs: tx-macro: Change mic control registers to volatile Srinivasa Rao Mandadapu
2021-09-20 13:24   ` Srinivas Kandagatla
2021-09-21  7:30     ` Srinivasa Rao Mandadapu
2021-09-21  8:48       ` Srinivas Kandagatla
2021-09-21 13:02         ` Srinivasa Rao Mandadapu
2021-09-20  7:35 ` [PATCH 4/7] ASoC: codecs: lpass-va-macro: Change bulk voting to individual clock voting Srinivasa Rao Mandadapu
2021-09-20 13:25   ` Srinivas Kandagatla
2021-09-21  8:14     ` Srinivasa Rao Mandadapu
2021-09-21  8:50       ` Srinivas Kandagatla
2021-09-21 12:25         ` Srinivasa Rao Mandadapu
2021-09-20  7:35 ` [PATCH 5/7] ASoC: codecs: lpass-rx-macro: " Srinivasa Rao Mandadapu
2021-09-20  7:35 ` [PATCH 6/7] ASoC: codecs: lpass-tx-macro: " Srinivasa Rao Mandadapu
2021-09-20  7:35 ` [PATCH 7/7] ASoC: codecs: lpass-va-macro: set mclk clock rate correctly Srinivasa Rao Mandadapu

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).