Update Lpass digital codec macro drivers
Subsystems (5)
cover Update Lpass digital codec macro drivers
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(-)
Signature · 2 lines
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc., is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
PATCH 1/7 ASoC: qcom: Add compatible names in va,wsa,rx,tx codec drivers for sc7280
Add compatible names for sc7280 based targets in digital codec drivers va,wsa,rx and tx.
--- 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(+)
sound/soc/codecs/lpass-rx-macro.c +1 -0
@@ -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);
sound/soc/codecs/lpass-tx-macro.c +1 -0
@@ -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);
sound/soc/codecs/lpass-va-macro.c +1 -0
@@ -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);
sound/soc/codecs/lpass-wsa-macro.c +1 -0
@@ -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);
Signature · 2 lines
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc., is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
Re: [PATCH 1/7] ASoC: qcom: Add compatible names in va,wsa,rx,tx codec drivers for sc7280
Quoting Srinivasa Rao Mandadapu (2021-09-20 00:35:25)
Quoted 17 lines
Add compatible names for sc7280 based targets in digital codec drivers va,wsa,rx and tx.
Signed-off-by Venkata Prasad Potturu <[email protected]>Signed-off-by Srinivasa Rao Mandadapu <[email protected]>--- 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(+)sound/soc/codecs/lpass-rx-macro.c +0
-0
sound/soc/codecs/lpass-rx-macro.c static int rx_macro_remove(struct platform_device *pdev) · line 3581
Quoted 4 lines
sound/soc/codecs/lpass-rx-macro.c +1
-0@@ -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.
Quoted 3 lines
sound/soc/codecs/lpass-rx-macro.c +0
-0{ } };MODULE_DEVICE_TABLE (of, rx_macro_dt_match);
Re: [PATCH 1/7] ASoC: qcom: Add compatible names in va,wsa,rx,tx codec drivers for sc7280
On 9/20/2021 11:47 PM, Stephen Boyd wrote:
Thanks for Your time Stephen!!!
Quoted 19 lines
Quoting Srinivasa Rao Mandadapu (2021-09-20 00:35:25)
Quoted 18 lines
Add compatible names for sc7280 based targets in digital codec drivers va,wsa,rx and tx.
Signed-off-by Venkata Prasad Potturu <[email protected]>Signed-off-by Srinivasa Rao Mandadapu <[email protected]>--- 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(+)sound/soc/codecs/lpass-rx-macro.c +0
-0@@ -3578,6 +3578,7 @@ static int rx_macro_remove(struct platform_device *pdev)
Quoted 4 lines
sound/soc/codecs/lpass-rx-macro.c static int rx_macro_remove(struct platform_device *pdev) · line 3581
Quoted 3 lines
sound/soc/codecs/lpass-rx-macro.c +1
-0static 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.
Quoted 3 lines
Quoted 3 lines
sound/soc/codecs/lpass-rx-macro.c +0
-0{ } };MODULE_DEVICE_TABLE (of, rx_macro_dt_match);
Signature · 2 lines
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc., is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
PATCH 2/7 ASoC: qcom: dt-bindings: Add compatible names for lpass sc7280 digital codecs
In reply to Srinivasa Rao MandadapuUpdate compatible names in va, wsa, rx and tx macro codes for lpass sc7280
--- 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(-)
Documentation/devicetree/bindings/sound/qcom,lpass-rx-macro.yaml +3 -1
@@ -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
Documentation/devicetree/bindings/sound/qcom,lpass-tx-macro.yaml +3 -1
@@ -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
Documentation/devicetree/bindings/sound/qcom,lpass-va-macro.yaml +3 -1
@@ -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
Documentation/devicetree/bindings/sound/qcom,lpass-wsa-macro.yaml +3 -1
@@ -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
Signature · 2 lines
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc., is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
Re: [PATCH 2/7] ASoC: qcom: dt-bindings: Add compatible names for lpass sc7280 digital codecs
Quoted 16 lines · Srinivasa Rao Mandadapu
Update compatible names in va, wsa, rx and tx macro codes for lpass sc7280
Signed-off-by Venkata Prasad Potturu <[email protected]>Signed-off-by Srinivasa Rao Mandadapu <[email protected]>--- 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(-)Documentation/devicetree/bindings/sound/qcom,lpass-rx-macro.yaml +0
-0
Documentation/devicetree/bindings/sound/qcom,lpass-rx-macro.yaml maintainers: · line 17
Quoted 8 lines
Documentation/devicetree/bindings/sound/qcom,lpass-rx-macro.yaml +3
-1@@ -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
Quoted 48 lines
Documentation/devicetree/bindings/sound/qcom,lpass-rx-macro.yaml +0
-0reg: maxItems: 1Documentation/devicetree/bindings/sound/qcom,lpass-tx-macro.yaml +3
-1@@ -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: 1Documentation/devicetree/bindings/sound/qcom,lpass-va-macro.yaml +3
-1@@ -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: 1Documentation/devicetree/bindings/sound/qcom,lpass-wsa-macro.yaml +3
-1@@ -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
Re: [PATCH 2/7] ASoC: qcom: dt-bindings: Add compatible names for lpass sc7280 digital codecs
On 9/20/2021 6:54 PM, Srinivas Kandagatla wrote:
Thanks for your time Srini!!
Quoted 32 lines · Srinivasa Rao Mandadapu
Quoted 20 lines
Update compatible names in va, wsa, rx and tx macro codes for lpass sc7280
Signed-off-by Venkata Prasad Potturu <[email protected]>Signed-off-by Srinivasa Rao Mandadapu <[email protected]>---
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(-)Documentation/devicetree/bindings/sound/qcom,lpass-rx-macro.yaml +0
-0@@ -11,7 +11,9 @@ maintainers:Quoted 6 lines
properties:
compatible:
- const: qcom,sm8250-lpass-rx-macro
+ oneOf:
+ - const: qcom,sm8250-lpass-rx-macro
+ - const: qcom,sc7280-lpass-rx-macroRecently 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."
Quoted 7 lines
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.
Quoted 43 lines
Quoted 43 lines
reg:
maxItems: 1Documentation/devicetree/bindings/sound/qcom,lpass-tx-macro.yaml +0
-0@@ -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: 1Documentation/devicetree/bindings/sound/qcom,lpass-va-macro.yaml +0
-0@@ -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: 1Documentation/devicetree/bindings/sound/qcom,lpass-wsa-macro.yaml +0
-0@@ -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
Signature · 2 lines
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc., is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
PATCH 3/7 ASoC: codecs: tx-macro: Change mic control registers to volatile
In reply to Srinivasa Rao MandadapuUpdate amic and dmic related tx macro control registers to volatile
--- sound/soc/codecs/lpass-tx-macro.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
sound/soc/codecs/lpass-tx-macro.c +13 -0
@@ -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 ; }
Signature · 2 lines
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc., is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
Re: [PATCH 3/7] ASoC: codecs: tx-macro: Change mic control registers to volatile
Quoted 15 lines · 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 <[email protected]>Signed-off-by Srinivasa Rao Mandadapu <[email protected]>--- sound/soc/codecs/lpass-tx-macro.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)sound/soc/codecs/lpass-tx-macro.c +0
-0
sound/soc/codecs/lpass-tx-macro.c static bool tx_is_volatile_register(struct device *dev, unsigned int reg) · line 432
Quoted 10 lines
sound/soc/codecs/lpass-tx-macro.c +7
-0@@ -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
Quoted 17 lines
sound/soc/codecs/lpass-tx-macro.c +6
-0return 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 ; }
Re: [PATCH 3/7] ASoC: codecs: tx-macro: Change mic control registers to volatile
On 9/20/2021 6:54 PM, Srinivas Kandagatla wrote:
Thanks for your time Srini!!
Quoted 32 lines · Srinivasa Rao Mandadapu
Quoted 18 lines
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 <[email protected]>Signed-off-by Srinivasa Rao Mandadapu <[email protected]>---
sound/soc/codecs/lpass-tx-macro.c| 13 +++++++++++++1 file changed, 13 insertions(+)sound/soc/codecs/lpass-tx-macro.c +0
-0@@ -423,6 +423,13 @@ static bool tx_is_volatile_register(struct device *dev, unsigned int reg)case
CDC_TX_TOP_CSR_SWR_DMIC1_CTL:
caseCDC_TX_TOP_CSR_SWR_DMIC2_CTL:Quoted 8 lines
case
CDC_TX_TOP_CSR_SWR_DMIC3_CTL:
+ caseCDC_TX_TOP_CSR_SWR_AMIC0_CTL:
+ caseCDC_TX_TOP_CSR_SWR_AMIC1_CTL:
+ caseCDC_TX_CLK_RST_CTRL_MCLK_CONTROL:
+ caseCDC_TX_CLK_RST_CTRL_FS_CNT_CONTROL:
+ caseCDC_TX_CLK_RST_CTRL_SWR_CONTROL:
+ caseCDC_TX_TOP_CSR_SWR_CTRL:
+ caseCDC_TX0_TX_PATH_SEC7:Why are these marked as Volatile?
Can you provide some details on the issue that you are seeing?
Quoted 1 line
--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.
Quoted 24 lines
Quoted 24 lines
return true;
}
return false;sound/soc/codecs/lpass-tx-macro.c +4
-0@@ -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;
}
Signature · 2 lines
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc., is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
Re: [PATCH 3/7] ASoC: codecs: tx-macro: Change mic control registers to volatile
Quoted 35 lines · Srinivasa Rao Mandadapu
On 9/20/2021 6:54 PM, Srinivas Kandagatla wrote:
Thanks for your time Srini!!Quoted 32 lines · Srinivasa Rao Mandadapu
Quoted 18 lines
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 <[email protected]>Signed-off-by Srinivasa Rao Mandadapu <[email protected]>---
sound/soc/codecs/lpass-tx-macro.c| 13 +++++++++++++1 file changed, 13 insertions(+)sound/soc/codecs/lpass-tx-macro.c +0
-0@@ -423,6 +423,13 @@ static bool tx_is_volatile_register(struct device *dev, unsigned int reg)case
CDC_TX_TOP_CSR_SWR_DMIC1_CTL:
caseCDC_TX_TOP_CSR_SWR_DMIC2_CTL:Quoted 8 lines
case
CDC_TX_TOP_CSR_SWR_DMIC3_CTL:
+ caseCDC_TX_TOP_CSR_SWR_AMIC0_CTL:
+ caseCDC_TX_TOP_CSR_SWR_AMIC1_CTL:
+ caseCDC_TX_CLK_RST_CTRL_MCLK_CONTROL:
+ caseCDC_TX_CLK_RST_CTRL_FS_CNT_CONTROL:
+ caseCDC_TX_CLK_RST_CTRL_SWR_CONTROL:
+ caseCDC_TX_TOP_CSR_SWR_CTRL:
+ caseCDC_TX0_TX_PATH_SEC7:Why are these marked as Volatile?
Can you provide some details on the issue that you are seeing?
Quoted 5 lines
Quoted 1 line
--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
Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
return true;
}
return false;sound/soc/codecs/lpass-tx-macro.c +4
-0@@ -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;
}
Re: [PATCH 3/7] ASoC: codecs: tx-macro: Change mic control registers to volatile
Quoted 46 lines · Srinivas Kandagatla
Quoted 35 lines · Srinivasa Rao Mandadapu
On 9/20/2021 6:54 PM, Srinivas Kandagatla wrote:
Thanks for your time Srini!!Quoted 32 lines · Srinivasa Rao Mandadapu
Quoted 18 lines
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 <[email protected]>Signed-off-by Srinivasa Rao Mandadapu <[email protected]>---
sound/soc/codecs/lpass-tx-macro.c| 13 +++++++++++++1 file changed, 13 insertions(+)sound/soc/codecs/lpass-tx-macro.c +0
-0@@ -423,6 +423,13 @@ static bool tx_is_volatile_register(struct device *dev, unsigned int reg)case
CDC_TX_TOP_CSR_SWR_DMIC1_CTL:
caseCDC_TX_TOP_CSR_SWR_DMIC2_CTL:Quoted 8 lines
case
CDC_TX_TOP_CSR_SWR_DMIC3_CTL:
+ caseCDC_TX_TOP_CSR_SWR_AMIC0_CTL:
+ caseCDC_TX_TOP_CSR_SWR_AMIC1_CTL:
+ caseCDC_TX_CLK_RST_CTRL_MCLK_CONTROL:
+ caseCDC_TX_CLK_RST_CTRL_FS_CNT_CONTROL:
+ caseCDC_TX_CLK_RST_CTRL_SWR_CONTROL:
+ caseCDC_TX_TOP_CSR_SWR_CTRL:
+ caseCDC_TX0_TX_PATH_SEC7:Why are these marked as Volatile?
Can you provide some details on the issue that you are seeing?Quoted 5 lines
Quoted 1 line
--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,
Quoted 7 lines
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_CTLdefault is0x00
so writing0x0to 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_defaultsarray.
The default values in tx_defaults are proper. But same value is not reflecting in Hardware, but In Cache it's reflecting set value.
Quoted 33 lines
Then setting the desired value should work.
--srini
Quoted 25 lines
Quoted 25 lines
Quoted 25 lines
return true;
}
return false;sound/soc/codecs/lpass-tx-macro.c +4
-0@@ -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;
}
Signature · 2 lines
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc., is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
PATCH 4/7 ASoC: codecs: lpass-va-macro: Change bulk voting to individual clock voting
In reply to Srinivasa Rao MandadapuChange bulk clock frequency voting to individual voting.
--- sound/soc/codecs/lpass-va-macro.c | 46 ++++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 18 deletions(-)
sound/soc/codecs/lpass-va-macro.c +28 -18
@@ -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 ; }
Signature · 2 lines
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc., is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
Re: [PATCH 4/7] ASoC: codecs: lpass-va-macro: Change bulk voting to individual clock voting
Quoted 2 lines · Srinivasa Rao Mandadapu
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..
Quoted 1 line
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?
Quoted 88 lines
Signed-off-by Venkata Prasad Potturu <[email protected]>Signed-off-by Srinivasa Rao Mandadapu <[email protected]>--- sound/soc/codecs/lpass-va-macro.c | 46 ++++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 18 deletions(-)sound/soc/codecs/lpass-va-macro.c +24
-16@@ -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; }
sound/soc/codecs/lpass-va-macro.c static int va_macro_remove(struct platform_device *pdev) · line 1477
Quoted 6 lines
sound/soc/codecs/lpass-va-macro.c +1
-2@@ -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
Quoted 7 lines
sound/soc/codecs/lpass-va-macro.c +3
-0+clk_disable_unprepare (va->mclk); +clk_disable_unprepare (va->macro); +clk_disable_unprepare (va->dcodec);return 0 ; }
Re: [PATCH 4/7] ASoC: codecs: lpass-va-macro: Change bulk voting to individual clock voting
Quoted 2 lines · Srinivas Kandagatla
Thanks for Your time Srini!!!
Quoted 6 lines · Srinivasa Rao Mandadapu
Quoted 2 lines
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.
Quoted 3 lines
Quoted 1 line
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.
Quoted 82 lines
Quoted 82 lines
Signed-off-by Venkata Prasad Potturu <[email protected]>Signed-off-by Srinivasa Rao Mandadapu <[email protected]>---
sound/soc/codecs/lpass-va-macro.c| 46
++++++++++++++++++++++++---------------1 file changed, 28 insertions(+), 18 deletions(-)sound/soc/codecs/lpass-va-macro.c +21
-13@@ -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;
}
Quoted 9 lines
Quoted 6 lines
@@ -1466,8 +1474,10 @@ static int
va_macro_remove(struct platform_device *pdev){
structva_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.
Quoted 8 lines
--srini
Quoted 6 lines
+
clk_disable_unprepare(va->mclk);
+clk_disable_unprepare(va->macro);
+clk_disable_unprepare(va->dcodec);
return 0;
}
Signature · 2 lines
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc., is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
Re: [PATCH 4/7] ASoC: codecs: lpass-va-macro: Change bulk voting to individual clock voting
Quoted 5 lines · Srinivasa Rao Mandadapu
Quoted 2 lines · Srinivas Kandagatla
Thanks for Your time Srini!!!
Quoted 8 lines
Quoted 6 lines · Srinivasa Rao Mandadapu
Quoted 2 lines
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
Quoted 107 lines
And sometimes we are seeing bulk voting failed in Kodiak setup.
Quoted 3 lines
Quoted 1 line
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.
Quoted 82 lines
Quoted 82 lines
Signed-off-by Venkata Prasad Potturu <[email protected]>Signed-off-by Srinivasa Rao Mandadapu <[email protected]>---
sound/soc/codecs/lpass-va-macro.c| 46
++++++++++++++++++++++++---------------1 file changed, 28 insertions(+), 18 deletions(-)sound/soc/codecs/lpass-va-macro.c +21
-13@@ -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;
}Quoted 9 lines
Quoted 6 lines
@@ -1466,8 +1474,10 @@ static int
va_macro_remove(struct platform_device *pdev){
structva_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.
Quoted 8 lines
--srini
Quoted 6 lines
+
clk_disable_unprepare(va->mclk);
+clk_disable_unprepare(va->macro);
+clk_disable_unprepare(va->dcodec);
return 0;
}
Re: [PATCH 4/7] ASoC: codecs: lpass-va-macro: Change bulk voting to individual clock voting
Quoted 11 lines · Srinivas Kandagatla
Quoted 8 lines · Srinivasa Rao Mandadapu
Quoted 2 lines · Srinivas Kandagatla
Thanks for Your time Srini!!!
Quoted 3 lines · Srinivasa Rao Mandadapu
Quoted 2 lines
Change bulk clock frequency voting to individual voting.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
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?
Quoted 109 lines
--srini
Quoted 107 lines
And sometimes we are seeing bulk voting failed in Kodiak setup.
Quoted 3 lines
Quoted 1 line
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.
Quoted 82 lines
Quoted 82 lines
Signed-off-by Venkata Prasad Potturu <[email protected]>Signed-off-by Srinivasa Rao Mandadapu <[email protected]>---
sound/soc/codecs/lpass-va-macro.c| 46
++++++++++++++++++++++++---------------1 file changed, 28 insertions(+), 18 deletions(-)sound/soc/codecs/lpass-va-macro.c +21
-13@@ -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;
}Quoted 9 lines
Quoted 6 lines
@@ -1466,8 +1474,10 @@ static int
va_macro_remove(struct platform_device *pdev){
structva_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.
Quoted 8 lines
--srini
Quoted 6 lines
+
clk_disable_unprepare(va->mclk);
+clk_disable_unprepare(va->macro);
+clk_disable_unprepare(va->dcodec);
return 0;
}
Signature · 2 lines
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc., is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
PATCH 5/7 ASoC: codecs: lpass-rx-macro: Change bulk voting to individual clock voting
In reply to Srinivasa Rao MandadapuChange bulk clock frequency voting to individual voting.
--- sound/soc/codecs/lpass-rx-macro.c | 68 +++++++++++++++++++++++++++------------ 1 file changed, 48 insertions(+), 20 deletions(-)
sound/soc/codecs/lpass-rx-macro.c +48 -20
@@ -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 ; }
Signature · 2 lines
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc., is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
PATCH 6/7 ASoC: codecs: lpass-tx-macro: Change bulk voting to individual clock voting
In reply to Srinivasa Rao MandadapuChange bulk clock frequency voting to individual voting.
--- sound/soc/codecs/lpass-tx-macro.c | 67 +++++++++++++++++++++++++++------------ 1 file changed, 47 insertions(+), 20 deletions(-)
sound/soc/codecs/lpass-tx-macro.c +47 -20
@@ -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 ; }
Signature · 2 lines
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc., is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
PATCH 7/7 ASoC: codecs: lpass-va-macro: set mclk clock rate correctly
In reply to Srinivasa Rao MandadapuUpdate mclk clock frequency from 9.6MHz to 19.2MHz.
--- sound/soc/codecs/lpass-va-macro.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/lpass-va-macro.c +2 -2
@@ -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);
Signature · 2 lines
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc., is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.