Re: [PATCH v2] arm64: dts: qcom: Update iommu property for simultaneous playback

2021-04-09 Thread Srinivasa Rao Mandadapu

Hi Stephen.

Thanks for your time!!!


On 4/9/2021 10:31 PM, Stephen Boyd wrote:

Quoting Srinivasa Rao Mandadapu (2021-04-06 09:33:30)

From: V Sujith Kumar Reddy 

Update iommu property in lpass cpu node for supporting
simultaneous playback on headset and speaker.

Signed-off-by: V Sujith Kumar Reddy 
Signed-off-by: Srinivasa Rao Mandadapu 
---
Changes since v1:
-- Commit messge header change

  arch/arm64/boot/dts/qcom/sc7180.dtsi | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/qcom/sc7180.dtsi 
b/arch/arm64/boot/dts/qcom/sc7180.dtsi
index a6da78d31fdd..6228ba2d8513 100644
--- a/arch/arm64/boot/dts/qcom/sc7180.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180.dtsi
@@ -3566,7 +3566,8 @@ lpass_cpu: lpass@62f0 {
 reg = <0 0x62f0 0 0x29000>;
 reg-names = "lpass-lpaif";
  
-   iommus = <&apps_smmu 0x1020 0>;

+   iommus = <&apps_smmu 0x1020 0>,
+   <&apps_smmu 0x1021 0>;

The stream ID 0x1032 was also dropped in this version but there's no
mention of that in the changelog. Why?

That is ID is for HDMI Stream, so as part of DP patches that will be added.


  
 power-domains = <&lpass_hm LPASS_CORE_HM_GDSCR>;



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



[PATCH v2] arm64: dts: qcom: Update iommu property for simultaneous playback

2021-04-06 Thread Srinivasa Rao Mandadapu
From: V Sujith Kumar Reddy 

Update iommu property in lpass cpu node for supporting
simultaneous playback on headset and speaker.

Signed-off-by: V Sujith Kumar Reddy 
Signed-off-by: Srinivasa Rao Mandadapu 
---
Changes since v1:
   -- Commit messge header change

 arch/arm64/boot/dts/qcom/sc7180.dtsi | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/qcom/sc7180.dtsi 
b/arch/arm64/boot/dts/qcom/sc7180.dtsi
index a6da78d31fdd..6228ba2d8513 100644
--- a/arch/arm64/boot/dts/qcom/sc7180.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180.dtsi
@@ -3566,7 +3566,8 @@ lpass_cpu: lpass@62f0 {
reg = <0 0x62f0 0 0x29000>;
reg-names = "lpass-lpaif";
 
-   iommus = <&apps_smmu 0x1020 0>;
+   iommus = <&apps_smmu 0x1020 0>,
+   <&apps_smmu 0x1021 0>;
 
power-domains = <&lpass_hm LPASS_CORE_HM_GDSCR>;
 
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH v7 2/2] arm64: dts: qcom: Add sound node for sc7180-trogdor-coachz

2021-03-13 Thread Srinivasa Rao Mandadapu
This is a trgodor variant, required to have sound node variable
for coachz specific platform.

Signed-off-by: Srinivasa Rao Mandadapu 
Reviewed-by: Stephen Boyd 
---
 arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi
index 4ad520f00485..e2ffe71c2d52 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi
@@ -89,6 +89,16 @@ &sn65dsi86_out {
data-lanes = <0 1 2 3>;
 };
 
+&sound {
+   compatible = "google,sc7180-coachz";
+   model = "sc7180-adau7002-max98357a";
+   audio-routing = "PDM_DAT", "DMIC";
+};
+
+&sound_multimedia0_codec {
+   sound-dai = <&adau7002>;
+};
+
 /* PINCTRL - modifications to sc7180-trogdor.dtsi */
 
 &en_pp3300_dx_edp {
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH v7 1/2] arm64: dts: qcom: sc7180-trogdor: Add lpass dai link for I2S driver

2021-03-13 Thread Srinivasa Rao Mandadapu
From: Ajit Pandey 

Add dai link for supporting lpass I2S driver, which is used
for audio capture and playback.
Add lpass-cpu node with  pin controls and i2s primary
and secondary dai-links

Signed-off-by: Ajit Pandey 
Signed-off-by: V Sujith Kumar Reddy 
Signed-off-by: Srinivasa Rao Mandadapu 
---
 arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi | 58 
 1 file changed, 58 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
index 436582279dad..fd345972a361 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
@@ -9,6 +9,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /* PMICs depend on spmi_bus label and so must come after SoC */
 #include "pm6150.dtsi"
@@ -283,6 +284,42 @@ keyboard_backlight: keyboard-backlight {
max-brightness = <1023>;
};
};
+
+   sound: sound {
+   compatible = "google,sc7180-trogdor";
+   model = "sc7180-rt5682-max98357a-1mic";
+
+   audio-routing =
+   "Headphone Jack", "HPOL",
+   "Headphone Jack", "HPOR";
+
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   dai-link@0 {
+   link-name = "MultiMedia0";
+   reg = ;
+   cpu {
+   sound-dai = <&lpass_cpu MI2S_PRIMARY>;
+   };
+
+   sound_multimedia0_codec: codec {
+   sound-dai = <&alc5682 0 /* aif1 */>;
+   };
+   };
+
+   dai-link@1 {
+   link-name = "MultiMedia1";
+   reg = ;
+   cpu {
+   sound-dai = <&lpass_cpu MI2S_SECONDARY>;
+   };
+
+   sound_multimedia1_codec: codec {
+   sound-dai = <&max98357a>;
+   };
+   };
+   };
 };
 
 &qfprom {
@@ -720,6 +757,27 @@ &ipa {
modem-init;
 };
 
+&lpass_cpu {
+   status = "okay";
+
+   pinctrl-names = "default";
+   pinctrl-0 = <&sec_mi2s_active>, <&pri_mi2s_active>, 
<&pri_mi2s_mclk_active>;
+
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   mi2s@0 {
+   reg = ;
+   qcom,playback-sd-lines = <1>;
+   qcom,capture-sd-lines = <0>;
+   };
+
+   mi2s@1 {
+   reg = ;
+   qcom,playback-sd-lines = <0>;
+   };
+};
+
 &mdp {
status = "okay";
 };
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH v7 0/2] Qualcomm's lpass device tree changes for I2s dai

2021-03-13 Thread Srinivasa Rao Mandadapu
These patches are device tree changes to support audio over I2S.
Changes Since v6:
  -- Changed mi2s node names
Changes Since v5:
  -- Removed lpass macro in codec dai cell
  -- Renamed multimedia dai codec alias name
Changes Since v4:
  -- Removed duplication of dai-link in sound node.
  -- Replaced reg values with common dt-bindings macros in coachz dtsi
  -- Included sc7180-lpass.h instead of qcom,lpass.h
  -- Sound node placement change in coachz dtsi.
Changes Since v3:
  -- Compatible name changed as per trogdor 
Changes Since v2:
  -- Sound node variable is added in sc7180-trogdor-coachz.dtsi.
  -- Audio-jack property is removed, as it may create conflicts with the boards 
 having different codecs.
  -- Replaced reg values with common dt-bindings macros
Changes Since v1:
  -- Ajith's Certification is added.
  -- Alias name added for sound dai link node

Ajit Pandey (1):
  arm64: dts: qcom: sc7180-trogdor: Add lpass dai link for I2S driver

Srinivasa Rao Mandadapu (1):
  arm64: dts: qcom: Add sound node for sc7180-trogdor-coachz

 .../boot/dts/qcom/sc7180-trogdor-coachz.dtsi  | 10 
 arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi  | 58 +++
 2 files changed, 68 insertions(+)

-- 
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 v6 1/2] arm64: dts: qcom: sc7180-trogdor: Add lpass dai link for I2S driver

2021-03-13 Thread Srinivasa Rao Mandadapu

Hi Stephen,

Thanks for Your Time and Inputs!!!

On 3/14/2021 2:26 AM, Stephen Boyd wrote:

Quoting Srinivasa Rao Mandadapu (2021-03-12 21:46:53)

From: Ajit Pandey 

Add dai link for supporting lpass I2S driver, which is used
for audio capture and playback.
Add lpass-cpu node with  pin controls and i2s primary

Why two spaces before 'pin'?


and secondary dai-links

Please end sentence with a period.


Signed-off-by: Ajit Pandey 
Signed-off-by: V Sujith Kumar Reddy 
Signed-off-by: Srinivasa Rao Mandadapu 
---
  arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi | 58 
  1 file changed, 58 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
index 436582279dad..3a24383247db 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
@@ -283,6 +284,42 @@ keyboard_backlight: keyboard-backlight {
 max-brightness = <1023>;
 };
 };
+
+   sound: sound {
+   compatible = "google,sc7180-trogdor";
+   model = "sc7180-rt5682-max98357a-1mic";
+
+   audio-routing =
+   "Headphone Jack", "HPOL",
+   "Headphone Jack", "HPOR";
+
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   dai-link@0 {
+   link-name = "MultiMedia0";
+   reg = ;
+   cpu {
+   sound-dai = <&lpass_cpu MI2S_PRIMARY>;
+   };
+
+   sound_multimedia0_codec: codec {
+   sound-dai = <&alc5682 0 /*aif1*/>;

Nitpick, add a space for comment

sound-dai = <&alc5682 0 /* aif1 */>;

Okay. Will re post with Fix.



+   };
+   };
+
+   dai-link@1 {
+   link-name = "MultiMedia1";
+   reg = ;
+   cpu {
+   sound-dai = <&lpass_cpu MI2S_SECONDARY>;
+   };
+
+   sound_multimedia1_codec: codec {
+   sound-dai = <&max98357a>;
+   };
+   };
+   };
  };
  
  &qfprom {

@@ -720,6 +757,27 @@ &ipa {
 modem-init;
  };
  
+&lpass_cpu {

+   status = "okay";
+
+   pinctrl-names = "default";
+   pinctrl-0 = <&sec_mi2s_active &pri_mi2s_active &pri_mi2s_mclk_active>;

Super nitpick: I prefer this style

pinctrl-0 = <&sec_mi2s_active>, <&pri_mi2s_active>, 
<&pri_mi2s_mclk_active>;

It's effectively the same but the brackets help us see that these are
the end of the phandle specifier instead of having to figure out that
the first phandle isn't specifying the second phandle as an argument.

Okay. Will change accordingly.



+
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   mi2s-primary@0 {

Should the node name just be mi2s instead of mi2s-primary? We have reg
property so I think 'mi2s' should be sufficient to differentiate.

Okay. I will change it as mi2s@0 instead of mi2s-primary@0



+   reg = ;
+   qcom,playback-sd-lines = <1>;
+   qcom,capture-sd-lines = <0>;
+   };
+
+   mi2s-secondary@1 {
+   reg = ;
+   qcom,playback-sd-lines = <0>;
+   };
+};
+
  &mdp {
 status = "okay";
  };


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



[PATCH v6 1/2] arm64: dts: qcom: sc7180-trogdor: Add lpass dai link for I2S driver

2021-03-12 Thread Srinivasa Rao Mandadapu
From: Ajit Pandey 

Add dai link for supporting lpass I2S driver, which is used
for audio capture and playback.
Add lpass-cpu node with  pin controls and i2s primary
and secondary dai-links

Signed-off-by: Ajit Pandey 
Signed-off-by: V Sujith Kumar Reddy 
Signed-off-by: Srinivasa Rao Mandadapu 
---
 arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi | 58 
 1 file changed, 58 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
index 436582279dad..3a24383247db 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
@@ -9,6 +9,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /* PMICs depend on spmi_bus label and so must come after SoC */
 #include "pm6150.dtsi"
@@ -283,6 +284,42 @@ keyboard_backlight: keyboard-backlight {
max-brightness = <1023>;
};
};
+
+   sound: sound {
+   compatible = "google,sc7180-trogdor";
+   model = "sc7180-rt5682-max98357a-1mic";
+
+   audio-routing =
+   "Headphone Jack", "HPOL",
+   "Headphone Jack", "HPOR";
+
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   dai-link@0 {
+   link-name = "MultiMedia0";
+   reg = ;
+   cpu {
+   sound-dai = <&lpass_cpu MI2S_PRIMARY>;
+   };
+
+   sound_multimedia0_codec: codec {
+   sound-dai = <&alc5682 0 /*aif1*/>;
+   };
+   };
+
+   dai-link@1 {
+   link-name = "MultiMedia1";
+   reg = ;
+   cpu {
+   sound-dai = <&lpass_cpu MI2S_SECONDARY>;
+   };
+
+   sound_multimedia1_codec: codec {
+   sound-dai = <&max98357a>;
+   };
+   };
+   };
 };
 
 &qfprom {
@@ -720,6 +757,27 @@ &ipa {
modem-init;
 };
 
+&lpass_cpu {
+   status = "okay";
+
+   pinctrl-names = "default";
+   pinctrl-0 = <&sec_mi2s_active &pri_mi2s_active &pri_mi2s_mclk_active>;
+
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   mi2s-primary@0 {
+   reg = ;
+   qcom,playback-sd-lines = <1>;
+   qcom,capture-sd-lines = <0>;
+   };
+
+   mi2s-secondary@1 {
+   reg = ;
+   qcom,playback-sd-lines = <0>;
+   };
+};
+
 &mdp {
status = "okay";
 };
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH v6 2/2] arm64: dts: qcom: Add sound node for sc7180-trogdor-coachz

2021-03-12 Thread Srinivasa Rao Mandadapu
This is a trgodor variant, required to have sound node variable
for coachz specific platform.

Signed-off-by: Srinivasa Rao Mandadapu 
---
 arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi
index 4ad520f00485..e2ffe71c2d52 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi
@@ -89,6 +89,16 @@ &sn65dsi86_out {
data-lanes = <0 1 2 3>;
 };
 
+&sound {
+   compatible = "google,sc7180-coachz";
+   model = "sc7180-adau7002-max98357a";
+   audio-routing = "PDM_DAT", "DMIC";
+};
+
+&sound_multimedia0_codec {
+   sound-dai = <&adau7002>;
+};
+
 /* PINCTRL - modifications to sc7180-trogdor.dtsi */
 
 &en_pp3300_dx_edp {
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH v6 0/2] Qualcomm's lpass device tree changes for I2s dai

2021-03-12 Thread Srinivasa Rao Mandadapu
These patches are device tree changes to support audio over I2S.
Changes Since v4:
  -- Removed lpass macro in codec dai cell
  -- Renamed multimedia dai codec alias name
Changes Since v4:
  -- Removed duplication of dai-link in sound node.
  -- Replaced reg values with common dt-bindings macros in coachz dtsi
  -- Included sc7180-lpass.h instead of qcom,lpass.h
  -- Sound node placement change in coachz dtsi.
Changes Since v3:
  -- Compatible name changed as per trogdor 
Changes Since v2:
  -- Sound node variable is added in sc7180-trogdor-coachz.dtsi.
  -- Audio-jack property is removed, as it may create conflicts with the boards 
 having different codecs.
  -- Replaced reg values with common dt-bindings macros
Changes Since v1:
  -- Ajith's Certification is added.
  -- Alias name added for sound dai link node

Ajit Pandey (1):
  arm64: dts: qcom: sc7180-trogdor: Add lpass dai link for I2S driver

Srinivasa Rao Mandadapu (1):
  arm64: dts: qcom: Add sound node for sc7180-trogdor-coachz

 .../boot/dts/qcom/sc7180-trogdor-coachz.dtsi  | 10 
 arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi  | 58 +++
 2 files changed, 68 insertions(+)

-- 
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 v5 2/2] arm64: dts: qcom: Add sound node for sc7180-trogdor-coachz

2021-03-12 Thread Srinivasa Rao Mandadapu

Hi Doug,

Thanks for your time and inputs!!!

On 3/13/2021 2:58 AM, Doug Anderson wrote:

Hi,

On Fri, Mar 12, 2021 at 8:07 AM Srinivasa Rao Mandadapu
 wrote:

This is a trgodor variant, required to have sound node variable
for coachz specific platform.

Signed-off-by: Srinivasa Rao Mandadapu 
---
  arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi | 10 ++
  1 file changed, 10 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi
index 4ad520f00485..7eaad739b6f9 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi
@@ -89,6 +89,16 @@ &sn65dsi86_out {
 data-lanes = <0 1 2 3>;
  };

+&sound {
+   compatible = "google,sc7180-coachz";
+   model = "sc7180-adau7002-max98357a";
+   audio-routing = "PDM_DAT", "DMIC";
+};
+
+&multimedia0_codec {
+   sound-dai = <&adau7002>;
+};
+

Much nicer! The last nit is that "multimedia0_codec" is now sorted
incorrectly. It starts with "m" so it shouldn't come after "s". Yes, I
know that this rule means that these two things are no longer next to
each other, but that's the rule we have right now.

If it's important for you for them to sort together, I suppose you
could change the label to "sound_multimedia0_codec" though that's a
bit of a mouthful. I'll leave it up to you whether to rename (and keep
the current ordering) or keep the name (and move the node).



-Doug


I feel it's good to keep them together by changing name as you suggested.

I will change accordingly and re post it.

--
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 v5 1/2] arm64: dts: qcom: sc7180-trogdor: Add lpass dai link for I2S driver

2021-03-12 Thread Srinivasa Rao Mandadapu

Hi Doug,

Thanks for your time and inputs!!!

On 3/13/2021 2:58 AM, Doug Anderson wrote:

Hi,

On Fri, Mar 12, 2021 at 8:06 AM Srinivasa Rao Mandadapu
 wrote:

+   dai-link@0 {
+   link-name = "MultiMedia0";
+   reg = ;
+   cpu {
+   sound-dai = <&lpass_cpu MI2S_PRIMARY>;
+   };
+
+   multimedia0_codec: codec {
+   sound-dai = <&alc5682 MI2S_PRIMARY>;

Please change "MI2S_PRIMARY" to "0". "MI2S_PRIMARY" is a numbering
system for "lpass_cpu" not for "alc5682". I'm not aware of symbolic
names for the alc5682's DAIs.

 From digging through the code and testing, it appears that for alc5682:
0 - aif1
1 - aif2

Thus you could be a little more documenting by doing:

sound-dai = <&alc5682 0 /*aif1*/>;

-Doug

Okay, I will change accordingly.

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



[PATCH v5 1/2] arm64: dts: qcom: sc7180-trogdor: Add lpass dai link for I2S driver

2021-03-12 Thread Srinivasa Rao Mandadapu
From: Ajit Pandey 

Add dai link for supporting lpass I2S driver, which is used
for audio capture and playback.
Add lpass-cpu node with  pin controls and i2s primary
and secondary dai-links

Signed-off-by: Ajit Pandey 
Signed-off-by: V Sujith Kumar Reddy 
Signed-off-by: Srinivasa Rao Mandadapu 
---
 arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi | 58 
 1 file changed, 58 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
index 436582279dad..397b564964d5 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
@@ -9,6 +9,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /* PMICs depend on spmi_bus label and so must come after SoC */
 #include "pm6150.dtsi"
@@ -283,6 +284,42 @@ keyboard_backlight: keyboard-backlight {
max-brightness = <1023>;
};
};
+
+   sound: sound {
+   compatible = "google,sc7180-trogdor";
+   model = "sc7180-rt5682-max98357a-1mic";
+
+   audio-routing =
+   "Headphone Jack", "HPOL",
+   "Headphone Jack", "HPOR";
+
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   dai-link@0 {
+   link-name = "MultiMedia0";
+   reg = ;
+   cpu {
+   sound-dai = <&lpass_cpu MI2S_PRIMARY>;
+   };
+
+   multimedia0_codec: codec {
+   sound-dai = <&alc5682 MI2S_PRIMARY>;
+   };
+   };
+
+   dai-link@1 {
+   link-name = "MultiMedia1";
+   reg = ;
+   cpu {
+   sound-dai = <&lpass_cpu MI2S_SECONDARY>;
+   };
+
+   multimedia1_codec: codec {
+   sound-dai = <&max98357a>;
+   };
+   };
+   };
 };
 
 &qfprom {
@@ -720,6 +757,27 @@ &ipa {
modem-init;
 };
 
+&lpass_cpu {
+   status = "okay";
+
+   pinctrl-names = "default";
+   pinctrl-0 = <&sec_mi2s_active &pri_mi2s_active &pri_mi2s_mclk_active>;
+
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   mi2s-primary@0 {
+   reg = ;
+   qcom,playback-sd-lines = <1>;
+   qcom,capture-sd-lines = <0>;
+   };
+
+   mi2s-secondary@1 {
+   reg = ;
+   qcom,playback-sd-lines = <0>;
+   };
+};
+
 &mdp {
status = "okay";
 };
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH v5 0/2] Qualcomm's lpass device tree changes for I2s dai

2021-03-12 Thread Srinivasa Rao Mandadapu
These patches are device tree changes to support audio over I2S.

Changes Since v4:
  -- Removed duplication of dai-link in sound node.
  -- Replaced reg values with common dt-bindings macros in coachz dtsi
  -- Included sc7180-lpass.h instead of qcom,lpass.h
  -- Sound node placement change in coachz dtsi.
Changes Since v3:
  -- Compatible name changed as per trogdor 
Changes Since v2:
  -- sound node variable is added in sc7180-trogdor-coachz.dtsi.
  -- Audio-jack property is removed, as it may create conflicts with the boards 
 having different codecs.
  -- Replaced reg values with common dt-bindings macros
Changes Since v1:
  -- Ajith's Certification is added.
  -- Alias name added for sound dai link node

Ajit Pandey (1):
  arm64: dts: qcom: sc7180-trogdor: Add lpass dai link for I2S driver

Srinivasa Rao Mandadapu (1):
  arm64: dts: qcom: Add sound node for sc7180-trogdor-coachz

 .../boot/dts/qcom/sc7180-trogdor-coachz.dtsi  | 10 
 arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi  | 58 +++
 2 files changed, 68 insertions(+)

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



[PATCH v5 2/2] arm64: dts: qcom: Add sound node for sc7180-trogdor-coachz

2021-03-12 Thread Srinivasa Rao Mandadapu
This is a trgodor variant, required to have sound node variable
for coachz specific platform.

Signed-off-by: Srinivasa Rao Mandadapu 
---
 arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi
index 4ad520f00485..7eaad739b6f9 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi
@@ -89,6 +89,16 @@ &sn65dsi86_out {
data-lanes = <0 1 2 3>;
 };
 
+&sound {
+   compatible = "google,sc7180-coachz";
+   model = "sc7180-adau7002-max98357a";
+   audio-routing = "PDM_DAT", "DMIC";
+};
+
+&multimedia0_codec {
+   sound-dai = <&adau7002>;
+};
+
 /* PINCTRL - modifications to sc7180-trogdor.dtsi */
 
 &en_pp3300_dx_edp {
-- 
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 v4 1/2] arm64: dts: qcom: sc7180-trogdor: Add lpass dai link for I2S driver

2021-03-12 Thread Srinivasa Rao Mandadapu

Hi Doug,

On 3/12/2021 6:32 PM, Srinivasa Rao Mandadapu wrote:

Hi Doug,

Thanks for your time!!!

On 3/12/2021 1:26 AM, Doug Anderson wrote:

Hi,

On Thu, Mar 11, 2021 at 8:49 AM Srinivasa Rao Mandadapu
 wrote:

From: Ajit Pandey 

Add dai link for supporting lpass I2S driver, which is used
for audio capture and playback.
Add lpass-cpu node with  pin controls and i2s primary
and secondary dai-links

Signed-off-by: Ajit Pandey 
Signed-off-by: V Sujith Kumar Reddy 
Signed-off-by: Srinivasa Rao Mandadapu 
---
  arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi | 58 


  1 file changed, 58 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi

index 436582279dad..501e3d4c9097 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
@@ -9,6 +9,7 @@
  #include 
  #include 
  #include 
+#include 

It seems marginally better to include "sc7180-lpass.h" to get this? I
don't really know the difference between the two but since unless
we're planning to delete the sc7180 version it seems like you might as
well include that one?


Yes, I agree.

Recently, all Quallcomm variant headers are combined and created 
"qcom,lpass.h".


"sc7180-lpass.h" still includes "qcom,lpass.h". So I will change and 
repost the patch.



Here is the reference commit:





  /* PMICs depend on spmi_bus label and so must come after SoC */
  #include "pm6150.dtsi"
@@ -283,6 +284,42 @@ keyboard_backlight: keyboard-backlight {
 max-brightness = <1023>;
 };
 };
+
+   sound: sound {
+   compatible = "google,sc7180-trogdor";
+   model = "sc7180-rt5682-max98357a-1mic";
+
+   audio-routing =
+   "Headphone Jack", "HPOL",
+   "Headphone Jack", "HPOR";
+
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   dai-link@0 {
+   link-name = "MultiMedia0";
+   reg = ;
+   cpu {
+   sound-dai = <&lpass_cpu MI2S_PRIMARY>;
+   };
+
+   codec {
+   sound-dai = <&alc5682 MI2S_PRIMARY>;

I'm an audio noob but isn't "MI2S_PRIMARY" something to be used with
"lpass_cpu", not with "alc5682" ?

I have no idea what the IDs correspond to on "alc5682". Are you sure
we even need an extra ID there? The "alc5682" bindings upstream don't
talk anything about dai-cells, but maybe they're just wrong...

Yes. I will change and re-post.
Actually, without dai-cells getting compilation issues. So I think it's 
necessary here.


-Doug



--
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 v4 2/2] arm64: dts: qcom: Add sound node for sc7180-trogdor-coachz

2021-03-12 Thread Srinivasa Rao Mandadapu

Hi Doug,

Thanks for time and valuable inputs!!!

On 3/12/2021 1:24 AM, Doug Anderson wrote:

Hi,

On Thu, Mar 11, 2021 at 8:48 AM Srinivasa Rao Mandadapu
 wrote:

This is a trgodor variant, required to have sound node variable
for coachz specific platform.

Signed-off-by: Srinivasa Rao Mandadapu 
---
  .../boot/dts/qcom/sc7180-trogdor-coachz.dtsi   | 18 ++
  1 file changed, 18 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi
index 4ad520f00485..7623a30a64c7 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi
@@ -238,3 +238,21 @@ &tlmm {
   "DP_HOT_PLUG_DET",
   "EC_IN_RW_ODL";
  };
+
+&sound {
+   compatible = "google,sc7180-coachz";

You're placing this in the wrong place. Pay attention to the section
headings. Your patch is putting this in the section "PINCTRL -
board-specific pinctrl". That's not right.



+   model = "sc7180-adau7002-max98357a";
+   audio-routing = "PDM_DAT", "DMIC";
+
+   dai-link@0 {
+   link-name = "MultiMedia0";
+   reg = <0>;
+   cpu {
+   sound-dai = <&lpass_cpu 0>;

Shouldn't the 0 above be "MI2S_PRIMARY" ?  ...and the "reg" as well?

Yes, It's required. Will change, and re-post.




+   };
+
+   codec {
+   sound-dai = <&adau7002>;
+   };
+   };

Some overall notes, though:

1. You don't actually need to duplicate everything that you have
above. Whether you realize it or not the way devicetree works is that
it _merges_ the node in the "coachz" devicetree with the one from the
trogdor one (it doesn't replace it). So in trogdor you have:

dai-link@0 {
   link-name = "MultiMedia0";
   reg = ;
   cpu {
 sound-dai = <&lpass_cpu MI2S_PRIMARY>;
   };

   codec {
 sound-dai = <&alc5682 MI2S_PRIMARY>;
   };
};

...and in coachz you have:

dai-link@0 {
   link-name = "MultiMedia0";
   reg = ;
   cpu {
 sound-dai = <&lpass_cpu MI2S_PRIMARY>;
   };

   codec {
 sound-dai = <&adau7002>;
   };
};

Almost all of that is duplication. It's best not to duplicate. Thus,
one step better than what you have would be to just have this in
coachz to override what you need:

dai-link@0 {
   codec {
 sound-dai = <&adau7002>;
   };
};


2. In general it's discouraged (and error prone) to try to replicate
hierarchies from your parent. So the best would be to change trogdor's
device tree to something like this:

dai-link@0 {
   link-name = "MultiMedia0";
   reg = ;
   cpu {
 sound-dai = <&lpass_cpu MI2S_PRIMARY>;
   };

   multimedia0_codec: codec {
 sound-dai = <&alc5682 MI2S_PRIMARY>;
   };
};

...and then in coachz you override like:

&multimedia0_codec {
sound-dai = <&alc5682 MI2S_PRIMARY>;
};

Okay. Will change accordingly and re-post.

--
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 v4 1/2] arm64: dts: qcom: sc7180-trogdor: Add lpass dai link for I2S driver

2021-03-12 Thread Srinivasa Rao Mandadapu

Hi Doug,

Thanks for your time!!!

On 3/12/2021 1:26 AM, Doug Anderson wrote:

Hi,

On Thu, Mar 11, 2021 at 8:49 AM Srinivasa Rao Mandadapu
 wrote:

From: Ajit Pandey 

Add dai link for supporting lpass I2S driver, which is used
for audio capture and playback.
Add lpass-cpu node with  pin controls and i2s primary
and secondary dai-links

Signed-off-by: Ajit Pandey 
Signed-off-by: V Sujith Kumar Reddy 
Signed-off-by: Srinivasa Rao Mandadapu 
---
  arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi | 58 
  1 file changed, 58 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
index 436582279dad..501e3d4c9097 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
@@ -9,6 +9,7 @@
  #include 
  #include 
  #include 
+#include 

It seems marginally better to include "sc7180-lpass.h" to get this? I
don't really know the difference between the two but since unless
we're planning to delete the sc7180 version it seems like you might as
well include that one?


Yes, I agree.

Recently, all Quallcomm variant headers are combined and created 
"qcom,lpass.h".


"sc7180-lpass.h" still includes "qcom,lpass.h". So I will change and 
repost the patch.



Here is the reference commit:





  /* PMICs depend on spmi_bus label and so must come after SoC */
  #include "pm6150.dtsi"
@@ -283,6 +284,42 @@ keyboard_backlight: keyboard-backlight {
 max-brightness = <1023>;
 };
 };
+
+   sound: sound {
+   compatible = "google,sc7180-trogdor";
+   model = "sc7180-rt5682-max98357a-1mic";
+
+   audio-routing =
+   "Headphone Jack", "HPOL",
+   "Headphone Jack", "HPOR";
+
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   dai-link@0 {
+   link-name = "MultiMedia0";
+   reg = ;
+   cpu {
+   sound-dai = <&lpass_cpu MI2S_PRIMARY>;
+   };
+
+   codec {
+   sound-dai = <&alc5682 MI2S_PRIMARY>;

I'm an audio noob but isn't "MI2S_PRIMARY" something to be used with
"lpass_cpu", not with "alc5682" ?

I have no idea what the IDs correspond to on "alc5682". Are you sure
we even need an extra ID there? The "alc5682" bindings upstream don't
talk anything about dai-cells, but maybe they're just wrong...

Yes. I will change and re-post.


-Doug


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



[PATCH v4 2/2] arm64: dts: qcom: Add sound node for sc7180-trogdor-coachz

2021-03-11 Thread Srinivasa Rao Mandadapu
This is a trgodor variant, required to have sound node variable
for coachz specific platform.

Signed-off-by: Srinivasa Rao Mandadapu 
---
 .../boot/dts/qcom/sc7180-trogdor-coachz.dtsi   | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi
index 4ad520f00485..7623a30a64c7 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi
@@ -238,3 +238,21 @@ &tlmm {
  "DP_HOT_PLUG_DET",
  "EC_IN_RW_ODL";
 };
+
+&sound {
+   compatible = "google,sc7180-coachz";
+   model = "sc7180-adau7002-max98357a";
+   audio-routing = "PDM_DAT", "DMIC";
+
+   dai-link@0 {
+   link-name = "MultiMedia0";
+   reg = <0>;
+   cpu {
+   sound-dai = <&lpass_cpu 0>;
+   };
+
+   codec {
+   sound-dai = <&adau7002>;
+   };
+   };
+};
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH v4 1/2] arm64: dts: qcom: sc7180-trogdor: Add lpass dai link for I2S driver

2021-03-11 Thread Srinivasa Rao Mandadapu
From: Ajit Pandey 

Add dai link for supporting lpass I2S driver, which is used
for audio capture and playback.
Add lpass-cpu node with  pin controls and i2s primary
and secondary dai-links

Signed-off-by: Ajit Pandey 
Signed-off-by: V Sujith Kumar Reddy 
Signed-off-by: Srinivasa Rao Mandadapu 
---
 arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi | 58 
 1 file changed, 58 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
index 436582279dad..501e3d4c9097 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
@@ -9,6 +9,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /* PMICs depend on spmi_bus label and so must come after SoC */
 #include "pm6150.dtsi"
@@ -283,6 +284,42 @@ keyboard_backlight: keyboard-backlight {
max-brightness = <1023>;
};
};
+
+   sound: sound {
+   compatible = "google,sc7180-trogdor";
+   model = "sc7180-rt5682-max98357a-1mic";
+
+   audio-routing =
+   "Headphone Jack", "HPOL",
+   "Headphone Jack", "HPOR";
+
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   dai-link@0 {
+   link-name = "MultiMedia0";
+   reg = ;
+   cpu {
+   sound-dai = <&lpass_cpu MI2S_PRIMARY>;
+   };
+
+   codec {
+   sound-dai = <&alc5682 MI2S_PRIMARY>;
+   };
+   };
+
+   dai-link@1 {
+   link-name = "MultiMedia1";
+   reg = ;
+   cpu {
+   sound-dai = <&lpass_cpu MI2S_SECONDARY>;
+   };
+
+   codec {
+   sound-dai = <&max98357a>;
+   };
+   };
+   };
 };
 
 &qfprom {
@@ -720,6 +757,27 @@ &ipa {
modem-init;
 };
 
+&lpass_cpu {
+   status = "okay";
+
+   pinctrl-names = "default";
+   pinctrl-0 = <&sec_mi2s_active &pri_mi2s_active &pri_mi2s_mclk_active>;
+
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   mi2s-primary@0 {
+   reg = ;
+   qcom,playback-sd-lines = <1>;
+   qcom,capture-sd-lines = <0>;
+   };
+
+   mi2s-secondary@1 {
+   reg = ;
+   qcom,playback-sd-lines = <0>;
+   };
+};
+
 &mdp {
status = "okay";
 };
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH v4 0/2] Qualcomm's lpass device tree changes for I2s dai

2021-03-11 Thread Srinivasa Rao Mandadapu
These patches are device tree changes to support audio over I2S.

Changes Since v3:
  -- Compatible name changed as per trogdor 
Changes Since v2:
  -- sound node variable is added in sc7180-trogdor-coachz.dtsi.
  -- Audio-jack property is removed, as it may create conflicts with the boards 
 having different codecs.
  -- Replaced reg values with common dt-bindings macros
Changes Since v1:
  -- Ajith's Certification is added.
  -- Alias name added for sound dai link node

Ajit Pandey (1):
  arm64: dts: qcom: sc7180-trogdor: Add lpass dai link for I2S driver

Srinivasa Rao Mandadapu (1):
  arm64: dts: qcom: Add sound node for sc7180-trogdor-coachz

 .../boot/dts/qcom/sc7180-trogdor-coachz.dtsi  | 18 ++
 arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi  | 58 +++
 2 files changed, 76 insertions(+)

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



[PATCH v2] ASoC: qcom: lpass-cpu: Fix lpass dai ids parse

2021-03-11 Thread Srinivasa Rao Mandadapu
The max boundary check while parsing dai ids makes
sound card registration fail after common up dai ids.

Fixes: cd3484f7f138 ("ASoC: qcom: Fix broken support to MI2S TERTIARY and 
QUATERNARY")

Signed-off-by: Srinivasa Rao Mandadapu 
---
Changes since v1:
  -- Fixes commit message chnaged.

 sound/soc/qcom/lpass-cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
index 4762286b33fe..c62d2612e8f5 100644
--- a/sound/soc/qcom/lpass-cpu.c
+++ b/sound/soc/qcom/lpass-cpu.c
@@ -739,7 +739,7 @@ static void of_lpass_cpu_parse_dai_data(struct device *dev,
 
for_each_child_of_node(dev->of_node, node) {
ret = of_property_read_u32(node, "reg", &id);
-   if (ret || id < 0 || id >= data->variant->num_dai) {
+   if (ret || id < 0) {
dev_err(dev, "valid dai id not found: %d\n", ret);
continue;
}
-- 
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] ASoC: qcom: lpass-cpu: Fix lpass dai ids parse

2021-03-11 Thread Srinivasa Rao Mandadapu

Thanks for the info Mark!!

Sorry for the typo mistake. Will re-post with proper subject.

On 3/11/2021 6:52 PM, Mark Brown wrote:

git log -1 --format='Fixes: %h ("%s")'


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



[PATCH] ASoC: qcom: lpass-cpu: Fix lpass dai ids parse

2021-03-11 Thread Srinivasa Rao Mandadapu
The max boundary check while parsing dai ids makes
sound card registration fail after common up dai ids.

Fixes: cd3484f7f1386 (ASoC: dt-bindings: lpass: Fix and common up lpass dai ids)

Signed-off-by: Srinivasa Rao Mandadapu 
---
 sound/soc/qcom/lpass-cpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
index 4762286b33fe..c62d2612e8f5 100644
--- a/sound/soc/qcom/lpass-cpu.c
+++ b/sound/soc/qcom/lpass-cpu.c
@@ -739,7 +739,7 @@ static void of_lpass_cpu_parse_dai_data(struct device *dev,
 
for_each_child_of_node(dev->of_node, node) {
ret = of_property_read_u32(node, "reg", &id);
-   if (ret || id < 0 || id >= data->variant->num_dai) {
+   if (ret || id < 0) {
dev_err(dev, "valid dai id not found: %d\n", ret);
continue;
}
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH v3 2/2] arm64: dts: qcom: Add sound node for sc7180-trogdor-coachz

2021-03-10 Thread Srinivasa Rao Mandadapu
This is a trgodor variant, required to have sound node variable
for coachz specific platform.

Signed-off-by: Srinivasa Rao Mandadapu 
---
 .../boot/dts/qcom/sc7180-trogdor-coachz.dtsi   | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi
index 4ad520f00485..7623a30a64c7 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi
@@ -238,3 +238,21 @@ &tlmm {
  "DP_HOT_PLUG_DET",
  "EC_IN_RW_ODL";
 };
+
+&sound {
+   compatible = "google,sc7180-coachz";
+   model = "sc7180-adau7002-max98357a";
+   audio-routing = "PDM_DAT", "DMIC";
+
+   dai-link@0 {
+   link-name = "MultiMedia0";
+   reg = <0>;
+   cpu {
+   sound-dai = <&lpass_cpu 0>;
+   };
+
+   codec {
+   sound-dai = <&adau7002>;
+   };
+   };
+};
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH v3 0/2] Qualcomm's lpass device tree changes for I2s dai

2021-03-10 Thread Srinivasa Rao Mandadapu
These patches are device tree changes to support audio over I2S.

Changes Since v1:
  -- Ajith's Certification is added.
  -- Alias name added for sound dai link node
Changes Since v2:
  -- sound node variable is added in sc7180-trogdor-coachz.dtsi.
  -- Audio-jack property is removed, as it may create conflicts with the boards 
 having different codecs.
Ajit Pandey (1):
  arm64: dts: qcom: sc7180-trogdor: Add lpass dai link for I2S driver

Srinivasa Rao Mandadapu (1):
  arm64: dts: qcom: Add sound node for sc7180-trogdor-coachz

 .../boot/dts/qcom/sc7180-trogdor-coachz.dtsi  | 18 ++
 arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi  | 58 +++
 2 files changed, 76 insertions(+)

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



[PATCH v3 1/2] arm64: dts: qcom: sc7180-trogdor: Add lpass dai link for I2S driver

2021-03-10 Thread Srinivasa Rao Mandadapu
From: Ajit Pandey 

Add dai link for supporting lpass I2S driver, which is used
for audio capture and playback.
Add lpass-cpu node with  pin controls and i2s primary
and secondary dai-links

Signed-off-by: Ajit Pandey 
Signed-off-by: V Sujith Kumar Reddy 
Signed-off-by: Srinivasa Rao Mandadapu 
---
 arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi | 58 
 1 file changed, 58 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
index 436582279dad..7dfae22d4b43 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
@@ -9,6 +9,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /* PMICs depend on spmi_bus label and so must come after SoC */
 #include "pm6150.dtsi"
@@ -283,6 +284,42 @@ keyboard_backlight: keyboard-backlight {
max-brightness = <1023>;
};
};
+
+   sound: sound {
+   compatible = "qcom,sc7180-sndcard";
+   model = "sc7180-snd-card";
+
+   audio-routing =
+   "Headphone Jack", "HPOL",
+   "Headphone Jack", "HPOR";
+
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   dai-link@0 {
+   link-name = "MultiMedia0";
+   reg = ;
+   cpu {
+   sound-dai = <&lpass_cpu MI2S_PRIMARY>;
+   };
+
+   codec {
+   sound-dai = <&alc5682 MI2S_PRIMARY>;
+   };
+   };
+
+   dai-link@1 {
+   link-name = "MultiMedia1";
+   reg = ;
+   cpu {
+   sound-dai = <&lpass_cpu MI2S_SECONDARY>;
+   };
+
+   codec {
+   sound-dai = <&max98357a>;
+   };
+   };
+   };
 };
 
 &qfprom {
@@ -720,6 +757,27 @@ &ipa {
modem-init;
 };
 
+&lpass_cpu {
+   status = "okay";
+
+   pinctrl-names = "default";
+   pinctrl-0 = <&sec_mi2s_active &pri_mi2s_active &pri_mi2s_mclk_active>;
+
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   mi2s-primary@0 {
+   reg = ;
+   qcom,playback-sd-lines = <1>;
+   qcom,capture-sd-lines = <0>;
+   };
+
+   mi2s-secondary@1 {
+   reg = ;
+   qcom,playback-sd-lines = <0>;
+   };
+};
+
 &mdp {
status = "okay";
 };
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH] ASoC: qcom: Fix typo error in HDMI regmap config callbacks

2021-02-01 Thread Srinivasa Rao Mandadapu
Had a typo in lpass platform driver that resulted in crash
during suspend/resume with an HDMI dongle connected.

The regmap read/write/volatile regesters validation callbacks in lpass-cpu
were using MI2S rdma_channels count instead of hdmi_rdma_channels.

This typo error causing to read registers from the regmap beyond the length
of the mapping created by ioremap().

This fix avoids the need for reducing number hdmi_rdma_channels,
which is done in
commit 7dfe20ee92f6 ("ASoC: qcom: Fix number of HDMI RDMA channels on sc7180").
So reverting the same.

Fixes: 7cb37b7bd0d3c ("ASoC: qcom: Add support for lpass hdmi driver")

Signed-off-by: Srinivasa Rao Mandadapu 
---
 sound/soc/qcom/lpass-cpu.c| 8 
 sound/soc/qcom/lpass-sc7180.c | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
index a669202e0001..c642e5f8f28c 100644
--- a/sound/soc/qcom/lpass-cpu.c
+++ b/sound/soc/qcom/lpass-cpu.c
@@ -595,7 +595,7 @@ static bool lpass_hdmi_regmap_writeable(struct device *dev, 
unsigned int reg)
return true;
}
 
-   for (i = 0; i < v->rdma_channels; ++i) {
+   for (i = 0; i < v->hdmi_rdma_channels; ++i) {
if (reg == LPAIF_HDMI_RDMACTL_REG(v, i))
return true;
if (reg == LPAIF_HDMI_RDMABASE_REG(v, i))
@@ -641,7 +641,7 @@ static bool lpass_hdmi_regmap_readable(struct device *dev, 
unsigned int reg)
if (reg == LPASS_HDMITX_APP_IRQSTAT_REG(v))
return true;
 
-   for (i = 0; i < v->rdma_channels; ++i) {
+   for (i = 0; i < v->hdmi_rdma_channels; ++i) {
if (reg == LPAIF_HDMI_RDMACTL_REG(v, i))
return true;
if (reg == LPAIF_HDMI_RDMABASE_REG(v, i))
@@ -668,7 +668,7 @@ static bool lpass_hdmi_regmap_volatile(struct device *dev, 
unsigned int reg)
if (reg == LPASS_HDMI_TX_LEGACY_ADDR(v))
return true;
 
-   for (i = 0; i < v->rdma_channels; ++i) {
+   for (i = 0; i < v->hdmi_rdma_channels; ++i) {
if (reg == LPAIF_HDMI_RDMACURR_REG(v, i))
return true;
}
@@ -812,7 +812,7 @@ int asoc_qcom_lpass_cpu_platform_probe(struct 
platform_device *pdev)
return PTR_ERR(drvdata->hdmiif);
 
lpass_hdmi_regmap_config.max_register = 
LPAIF_HDMI_RDMAPER_REG(variant,
-   variant->hdmi_rdma_channels);
+   variant->hdmi_rdma_channels - 1);
drvdata->hdmiif_map = devm_regmap_init_mmio(dev, 
drvdata->hdmiif,
&lpass_hdmi_regmap_config);
if (IS_ERR(drvdata->hdmiif_map)) {
diff --git a/sound/soc/qcom/lpass-sc7180.c b/sound/soc/qcom/lpass-sc7180.c
index 735c9dac28f2..8c168d3c589e 100644
--- a/sound/soc/qcom/lpass-sc7180.c
+++ b/sound/soc/qcom/lpass-sc7180.c
@@ -171,7 +171,7 @@ static struct lpass_variant sc7180_data = {
.rdma_channels  = 5,
.hdmi_rdma_reg_base = 0x64000,
.hdmi_rdma_reg_stride   = 0x1000,
-   .hdmi_rdma_channels = 3,
+   .hdmi_rdma_channels = 4,
.dmactl_audif_start = 1,
.wrdma_reg_base = 0x18000,
.wrdma_reg_stride   = 0x1000,
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH v2] ASoC: qcom: lpass-cpu: Remove bit clock state check

2021-01-27 Thread Srinivasa Rao Mandadapu
No need of BCLK state maintenance from driver side as
clock_enable and clk_disable API's maintaing state counter.

One of the major issue was spotted when Headset jack inserted
while playback continues, due to same PCM device node opens twice
for playaback/capture and closes once for capture and playback continues.

It can resolve the errors in such scenarios.

Fixes: b1824968221c ("ASoC: qcom: Fix enabling BCLK and LRCLK in LPAIF invalid 
state")

Signed-off-by: Srinivasa Rao Mandadapu 
---
Changes since v1: 
   -- Commit message changed

 sound/soc/qcom/lpass-cpu.c   | 22 --
 sound/soc/qcom/lpass-lpaif-reg.h |  3 ---
 sound/soc/qcom/lpass.h   |  1 -
 3 files changed, 8 insertions(+), 18 deletions(-)

diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
index ae8efbc89af2..a669202e0001 100644
--- a/sound/soc/qcom/lpass-cpu.c
+++ b/sound/soc/qcom/lpass-cpu.c
@@ -286,16 +286,12 @@ static int lpass_cpu_daiops_trigger(struct 
snd_pcm_substream *substream,
dev_err(dai->dev, "error writing to i2sctl reg: %d\n",
ret);
 
-   if (drvdata->bit_clk_state[id] == LPAIF_BIT_CLK_DISABLE) {
-   ret = clk_enable(drvdata->mi2s_bit_clk[id]);
-   if (ret) {
-   dev_err(dai->dev, "error in enabling mi2s bit 
clk: %d\n", ret);
-   clk_disable(drvdata->mi2s_osr_clk[id]);
-   return ret;
-   }
-   drvdata->bit_clk_state[id] = LPAIF_BIT_CLK_ENABLE;
+   ret = clk_enable(drvdata->mi2s_bit_clk[id]);
+   if (ret) {
+   dev_err(dai->dev, "error in enabling mi2s bit clk: 
%d\n", ret);
+   clk_disable(drvdata->mi2s_osr_clk[id]);
+   return ret;
}
-
break;
case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_SUSPEND:
@@ -310,10 +306,9 @@ static int lpass_cpu_daiops_trigger(struct 
snd_pcm_substream *substream,
if (ret)
dev_err(dai->dev, "error writing to i2sctl reg: %d\n",
ret);
-   if (drvdata->bit_clk_state[id] == LPAIF_BIT_CLK_ENABLE) {
-   clk_disable(drvdata->mi2s_bit_clk[dai->driver->id]);
-   drvdata->bit_clk_state[id] = LPAIF_BIT_CLK_DISABLE;
-   }
+
+   clk_disable(drvdata->mi2s_bit_clk[dai->driver->id]);
+
break;
}
 
@@ -861,7 +856,6 @@ int asoc_qcom_lpass_cpu_platform_probe(struct 
platform_device *pdev)
PTR_ERR(drvdata->mi2s_bit_clk[dai_id]));
return PTR_ERR(drvdata->mi2s_bit_clk[dai_id]);
}
-   drvdata->bit_clk_state[dai_id] = LPAIF_BIT_CLK_DISABLE;
}
 
/* Allocation for i2sctl regmap fields */
diff --git a/sound/soc/qcom/lpass-lpaif-reg.h b/sound/soc/qcom/lpass-lpaif-reg.h
index 405542832e99..c8e1d75340b2 100644
--- a/sound/soc/qcom/lpass-lpaif-reg.h
+++ b/sound/soc/qcom/lpass-lpaif-reg.h
@@ -60,9 +60,6 @@
 #define LPAIF_I2SCTL_BITWIDTH_24   1
 #define LPAIF_I2SCTL_BITWIDTH_32   2
 
-#define LPAIF_BIT_CLK_DISABLE  0
-#define LPAIF_BIT_CLK_ENABLE   1
-
 #define LPAIF_I2SCTL_RESET_STATE   0x003C0004
 #define LPAIF_DMACTL_RESET_STATE   0x0020
 
diff --git a/sound/soc/qcom/lpass.h b/sound/soc/qcom/lpass.h
index 2d68af0da34d..83b2e08ade06 100644
--- a/sound/soc/qcom/lpass.h
+++ b/sound/soc/qcom/lpass.h
@@ -68,7 +68,6 @@ struct lpass_data {
unsigned int mi2s_playback_sd_mode[LPASS_MAX_MI2S_PORTS];
unsigned int mi2s_capture_sd_mode[LPASS_MAX_MI2S_PORTS];
int hdmi_port_enable;
-   int bit_clk_state[LPASS_MAX_MI2S_PORTS];
 
/* low-power audio interface (LPAIF) registers */
void __iomem *lpaif;
-- 
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] ASoC: qcom: lpass-cpu: Remove bit clock state check

2021-01-27 Thread Srinivasa Rao Mandadapu

Thanks Srinivas For Your time!!!

On 1/27/2021 3:21 PM, Srinivas Kandagatla wrote:



On 27/01/2021 06:30, Srinivasa Rao Mandadapu wrote:

No need of BCLK state maintenance from driver side as
clock_enable and clk_disable API's maintaing state counter.

One of the major issue was spotted when Headset jack inserted
while playback continues, due to same PCM device node opens twice
for playaback/capture and closes once for capture and playback 
continues.


It can resolve the errors in such scenarios.

Signed-off-by: Srinivasa Rao Mandadapu 


Thanks for the cleanup, yes clk core will take care of this by 
enable_count check!


You should add

Fixes: b1824968221c ("ASoC: qcom: Fix enabling BCLK and LRCLK in LPAIF 
invalid state")



Okay. I will do in next patch.



---
  sound/soc/qcom/lpass-cpu.c   | 22 --
  sound/soc/qcom/lpass-lpaif-reg.h |  3 ---
  sound/soc/qcom/lpass.h   |  1 -
  3 files changed, 8 insertions(+), 18 deletions(-)

diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
index ae8efbc89af2..a669202e0001 100644
--- a/sound/soc/qcom/lpass-cpu.c
+++ b/sound/soc/qcom/lpass-cpu.c
@@ -286,16 +286,12 @@ static int lpass_cpu_daiops_trigger(struct 
snd_pcm_substream *substream,

  dev_err(dai->dev, "error writing to i2sctl reg: %d\n",
  ret);
  -    if (drvdata->bit_clk_state[id] == LPAIF_BIT_CLK_DISABLE) {
-    ret = clk_enable(drvdata->mi2s_bit_clk[id]);
-    if (ret) {
-    dev_err(dai->dev, "error in enabling mi2s bit clk: 
%d\n", ret);

-    clk_disable(drvdata->mi2s_osr_clk[id]);
-    return ret;
-    }
-    drvdata->bit_clk_state[id] = LPAIF_BIT_CLK_ENABLE;
+    ret = clk_enable(drvdata->mi2s_bit_clk[id]);
+    if (ret) {
+    dev_err(dai->dev, "error in enabling mi2s bit clk: 
%d\n", ret);

+    clk_disable(drvdata->mi2s_osr_clk[id]);


Can you also remove this unnecessary disable here!



Actually this is MI2S OSR clock disable on failure of bit clock enable.

Do You think it's redundant?


-srini


+    return ret;
  }
-
  break;
  case SNDRV_PCM_TRIGGER_STOP:
  case SNDRV_PCM_TRIGGER_SUSPEND:
@@ -310,10 +306,9 @@ static int lpass_cpu_daiops_trigger(struct 
snd_pcm_substream *substream,

  if (ret)
  dev_err(dai->dev, "error writing to i2sctl reg: %d\n",
  ret);
-    if (drvdata->bit_clk_state[id] == LPAIF_BIT_CLK_ENABLE) {
- clk_disable(drvdata->mi2s_bit_clk[dai->driver->id]);
-    drvdata->bit_clk_state[id] = LPAIF_BIT_CLK_DISABLE;
-    }
+
+ clk_disable(drvdata->mi2s_bit_clk[dai->driver->id]);
+
  break;
  }
  @@ -861,7 +856,6 @@ int asoc_qcom_lpass_cpu_platform_probe(struct 
platform_device *pdev)

  PTR_ERR(drvdata->mi2s_bit_clk[dai_id]));
  return PTR_ERR(drvdata->mi2s_bit_clk[dai_id]);
  }
-    drvdata->bit_clk_state[dai_id] = LPAIF_BIT_CLK_DISABLE;
  }
    /* Allocation for i2sctl regmap fields */
diff --git a/sound/soc/qcom/lpass-lpaif-reg.h 
b/sound/soc/qcom/lpass-lpaif-reg.h

index 405542832e99..c8e1d75340b2 100644
--- a/sound/soc/qcom/lpass-lpaif-reg.h
+++ b/sound/soc/qcom/lpass-lpaif-reg.h
@@ -60,9 +60,6 @@
  #define LPAIF_I2SCTL_BITWIDTH_24    1
  #define LPAIF_I2SCTL_BITWIDTH_32    2
  -#define LPAIF_BIT_CLK_DISABLE    0
-#define LPAIF_BIT_CLK_ENABLE    1
-
  #define LPAIF_I2SCTL_RESET_STATE    0x003C0004
  #define LPAIF_DMACTL_RESET_STATE    0x0020
  diff --git a/sound/soc/qcom/lpass.h b/sound/soc/qcom/lpass.h
index 2d68af0da34d..83b2e08ade06 100644
--- a/sound/soc/qcom/lpass.h
+++ b/sound/soc/qcom/lpass.h
@@ -68,7 +68,6 @@ struct lpass_data {
  unsigned int mi2s_playback_sd_mode[LPASS_MAX_MI2S_PORTS];
  unsigned int mi2s_capture_sd_mode[LPASS_MAX_MI2S_PORTS];
  int hdmi_port_enable;
-    int bit_clk_state[LPASS_MAX_MI2S_PORTS];
    /* low-power audio interface (LPAIF) registers */
  void __iomem *lpaif;


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



[PATCH] ASoC: qcom: lpass-cpu: Remove bit clock state check

2021-01-26 Thread Srinivasa Rao Mandadapu
No need of BCLK state maintenance from driver side as
clock_enable and clk_disable API's maintaing state counter.

One of the major issue was spotted when Headset jack inserted
while playback continues, due to same PCM device node opens twice
for playaback/capture and closes once for capture and playback continues.

It can resolve the errors in such scenarios.

Signed-off-by: Srinivasa Rao Mandadapu 
---
 sound/soc/qcom/lpass-cpu.c   | 22 --
 sound/soc/qcom/lpass-lpaif-reg.h |  3 ---
 sound/soc/qcom/lpass.h   |  1 -
 3 files changed, 8 insertions(+), 18 deletions(-)

diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
index ae8efbc89af2..a669202e0001 100644
--- a/sound/soc/qcom/lpass-cpu.c
+++ b/sound/soc/qcom/lpass-cpu.c
@@ -286,16 +286,12 @@ static int lpass_cpu_daiops_trigger(struct 
snd_pcm_substream *substream,
dev_err(dai->dev, "error writing to i2sctl reg: %d\n",
ret);
 
-   if (drvdata->bit_clk_state[id] == LPAIF_BIT_CLK_DISABLE) {
-   ret = clk_enable(drvdata->mi2s_bit_clk[id]);
-   if (ret) {
-   dev_err(dai->dev, "error in enabling mi2s bit 
clk: %d\n", ret);
-   clk_disable(drvdata->mi2s_osr_clk[id]);
-   return ret;
-   }
-   drvdata->bit_clk_state[id] = LPAIF_BIT_CLK_ENABLE;
+   ret = clk_enable(drvdata->mi2s_bit_clk[id]);
+   if (ret) {
+   dev_err(dai->dev, "error in enabling mi2s bit clk: 
%d\n", ret);
+   clk_disable(drvdata->mi2s_osr_clk[id]);
+   return ret;
}
-
break;
case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_SUSPEND:
@@ -310,10 +306,9 @@ static int lpass_cpu_daiops_trigger(struct 
snd_pcm_substream *substream,
if (ret)
dev_err(dai->dev, "error writing to i2sctl reg: %d\n",
ret);
-   if (drvdata->bit_clk_state[id] == LPAIF_BIT_CLK_ENABLE) {
-   clk_disable(drvdata->mi2s_bit_clk[dai->driver->id]);
-   drvdata->bit_clk_state[id] = LPAIF_BIT_CLK_DISABLE;
-   }
+
+   clk_disable(drvdata->mi2s_bit_clk[dai->driver->id]);
+
break;
}
 
@@ -861,7 +856,6 @@ int asoc_qcom_lpass_cpu_platform_probe(struct 
platform_device *pdev)
PTR_ERR(drvdata->mi2s_bit_clk[dai_id]));
return PTR_ERR(drvdata->mi2s_bit_clk[dai_id]);
}
-   drvdata->bit_clk_state[dai_id] = LPAIF_BIT_CLK_DISABLE;
}
 
/* Allocation for i2sctl regmap fields */
diff --git a/sound/soc/qcom/lpass-lpaif-reg.h b/sound/soc/qcom/lpass-lpaif-reg.h
index 405542832e99..c8e1d75340b2 100644
--- a/sound/soc/qcom/lpass-lpaif-reg.h
+++ b/sound/soc/qcom/lpass-lpaif-reg.h
@@ -60,9 +60,6 @@
 #define LPAIF_I2SCTL_BITWIDTH_24   1
 #define LPAIF_I2SCTL_BITWIDTH_32   2
 
-#define LPAIF_BIT_CLK_DISABLE  0
-#define LPAIF_BIT_CLK_ENABLE   1
-
 #define LPAIF_I2SCTL_RESET_STATE   0x003C0004
 #define LPAIF_DMACTL_RESET_STATE   0x0020
 
diff --git a/sound/soc/qcom/lpass.h b/sound/soc/qcom/lpass.h
index 2d68af0da34d..83b2e08ade06 100644
--- a/sound/soc/qcom/lpass.h
+++ b/sound/soc/qcom/lpass.h
@@ -68,7 +68,6 @@ struct lpass_data {
unsigned int mi2s_playback_sd_mode[LPASS_MAX_MI2S_PORTS];
unsigned int mi2s_capture_sd_mode[LPASS_MAX_MI2S_PORTS];
int hdmi_port_enable;
-   int bit_clk_state[LPASS_MAX_MI2S_PORTS];
 
/* low-power audio interface (LPAIF) registers */
void __iomem *lpaif;
-- 
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] ASoC: qcom: Fix number of HDMI RDMA channels on sc7180

2021-01-22 Thread Srinivasa Rao Mandadapu

Hi Mark and Boyd,

Thanks for your time on this issue.

In my opinion, It 's better not to apply this patch.

I will post patch with changing size in sc7180.dtsi file.


On 1/22/2021 1:09 AM, Mark Brown wrote:

On Fri, 15 Jan 2021 12:33:29 -0800, Stephen Boyd wrote:

Suspending/resuming with an HDMI dongle attached leads to crashes from
an audio regmap.

  Unable to handle kernel paging request at virtual address ffc018068000
  Mem abort info:
ESR = 0x9647
EC = 0x25: DABT (current EL), IL = 32 bits
SET = 0, FnV = 0
EA = 0, S1PTW = 0
  Data abort info:
ISV = 0, ISS = 0x0047
CM = 0, WnR = 1
  swapper pgtable: 4k pages, 39-bit VAs, pgdp=81b12000
  [ffc018068000] pgd=000275d14003, pud=000275d14003, 
pmd=00026365d003, pte=
  Internal error: Oops: 9647 [#1] PREEMPT SMP
  Call trace:
   regmap_mmio_write32le+0x2c/0x40
   regmap_mmio_write+0x48/0x6c
   _regmap_bus_reg_write+0x34/0x44
   _regmap_write+0x100/0x150
   regcache_default_sync+0xc0/0x138
   regcache_sync+0x188/0x26c
   lpass_platform_pcmops_resume+0x48/0x54 [snd_soc_lpass_platform]
   snd_soc_component_resume+0x28/0x40
   soc_resume_deferred+0x6c/0x178
   process_one_work+0x208/0x3c8
   worker_thread+0x23c/0x3e8
   kthread+0x144/0x178
   ret_from_fork+0x10/0x18
  Code: d503201f d50332bf f94002a8 8b344108 (b9000113)

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: qcom: Fix number of HDMI RDMA channels on sc7180
   commit: 7dfe20ee92f681ab1342015254ddb77a18f40cdb

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


--
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 v4 1/2] Partially revert ASoC: qcom: Fix enabling BCLK and LRCLK in LPAIF invalid state

2020-12-17 Thread Srinivasa Rao Mandadapu

Thanks Mark for your Time!!!

On 12/14/2020 11:20 PM, Mark Brown wrote:

On Mon, Dec 14, 2020 at 06:13:22PM +0530, Srinivasa Rao Mandadapu wrote:

On 12/1/2020 11:21 PM, Mark Brown wrote:

Later from review comments by Srinivas kandagatla, I got to know

about regcache sync APIs, which can be used  to sync cache after resume and

HW registers can be updated with  original values. With that playback can be
continued.
So is the reason, I am reverting partial changes in the commit b1824968221c.

I don't understand why a fix for the register cache not being in sync
with the hardware doesn't involve syncing the register cache with the
hardware.

I am sorry I couldn't understand your point. Could you please elaborate your
query?

Your changelog talks about syncing the cache but neither the driver nor
your change actually does that.


Okay. Now I posted v6 patch 
(https://lore.kernel.org/patchwork/patch/1354638/)


with subject lines explaining actual changes.

could you please check  the same.

--
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 v4 1/2] Partially revert ASoC: qcom: Fix enabling BCLK and LRCLK in LPAIF invalid state

2020-12-17 Thread Srinivasa Rao Mandadapu

Thanks Mark for your Time!!!

On 12/14/2020 11:20 PM, Mark Brown wrote:

On Mon, Dec 14, 2020 at 06:13:22PM +0530, Srinivasa Rao Mandadapu wrote:

On 12/1/2020 11:21 PM, Mark Brown wrote:

Later from review comments by Srinivas kandagatla, I got to know

about regcache sync APIs, which can be used  to sync cache after resume and

HW registers can be updated with  original values. With that playback can be
continued.
So is the reason, I am reverting partial changes in the commit b1824968221c.

I don't understand why a fix for the register cache not being in sync
with the hardware doesn't involve syncing the register cache with the
hardware.

I am sorry I couldn't understand your point. Could you please elaborate your
query?

Your changelog talks about syncing the cache but neither the driver nor
your change actually does that.


Yeah.. Now I posted v6 patch 
(https://lore.kernel.org/patchwork/patch/1354638/)


with subject lines explaining actual changes.

could you please check  the same.

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



[PATCH v6 2/2] ASoC: qcom: Add support for playback recover after resume

2020-12-17 Thread Srinivasa Rao Mandadapu
To support playback continuation after hard suspend(bypass powerd)
and resume do regcache sync with component driver pm ops.

Signed-off-by: V Sujith Kumar Reddy 
Signed-off-by: Srinivasa Rao Mandadapu 
Reviewed-by: Srinivas Kandagatla 
Tested-by: Steev Klimaszewski 
---
 sound/soc/qcom/lpass-platform.c | 35 +++
 1 file changed, 35 insertions(+)

diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c
index 232deee..d1c2485 100644
--- a/sound/soc/qcom/lpass-platform.c
+++ b/sound/soc/qcom/lpass-platform.c
@@ -823,6 +823,39 @@ static void lpass_platform_pcm_free(struct 
snd_soc_component *component,
}
 }
 
+static int lpass_platform_pcmops_suspend(struct snd_soc_component *component)
+{
+   struct lpass_data *drvdata = snd_soc_component_get_drvdata(component);
+   struct regmap *map;
+   unsigned int dai_id = component->id;
+
+   if (dai_id == LPASS_DP_RX)
+   map = drvdata->hdmiif_map;
+   else
+   map = drvdata->lpaif_map;
+
+   regcache_cache_only(map, true);
+   regcache_mark_dirty(map);
+
+   return 0;
+}
+
+static int lpass_platform_pcmops_resume(struct snd_soc_component *component)
+{
+   struct lpass_data *drvdata = snd_soc_component_get_drvdata(component);
+   struct regmap *map;
+   unsigned int dai_id = component->id;
+
+   if (dai_id == LPASS_DP_RX)
+   map = drvdata->hdmiif_map;
+   else
+   map = drvdata->lpaif_map;
+
+   regcache_cache_only(map, false);
+   return regcache_sync(map);
+}
+
+
 static const struct snd_soc_component_driver lpass_component_driver = {
.name   = DRV_NAME,
.open   = lpass_platform_pcmops_open,
@@ -835,6 +868,8 @@ static const struct snd_soc_component_driver 
lpass_component_driver = {
.mmap   = lpass_platform_pcmops_mmap,
.pcm_construct  = lpass_platform_pcm_new,
.pcm_destruct   = lpass_platform_pcm_free,
+   .suspend= lpass_platform_pcmops_suspend,
+   .resume = lpass_platform_pcmops_resume,
 
 };
 
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH v6 1/2] ASoC: qcom: Fix incorrect volatile registers

2020-12-17 Thread Srinivasa Rao Mandadapu
MI2S and DMA control registers are not volatile, so remove these from volatile 
registers list.
Registers reset state check by reading non volatile registers makes no use,
so remove error check from cpu and platform trigger callbacks.
Initialized map variable two times in lpass platform trigger API,
so remove redundant initialization.

Fixes commit b1824968221cc ("ASoC: qcom: Fix enabling BCLK and LRCLK in LPAIF 
invalid state")

Signed-off-by: V Sujith Kumar Reddy 
Signed-off-by: Srinivasa Rao Mandadapu 
---
 sound/soc/qcom/lpass-cpu.c  | 20 ++--
 sound/soc/qcom/lpass-platform.c | 15 ---
 2 files changed, 2 insertions(+), 33 deletions(-)

diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
index af684fd..c5e99c2 100644
--- a/sound/soc/qcom/lpass-cpu.c
+++ b/sound/soc/qcom/lpass-cpu.c
@@ -270,18 +270,6 @@ static int lpass_cpu_daiops_trigger(struct 
snd_pcm_substream *substream,
struct lpaif_i2sctl *i2sctl = drvdata->i2sctl;
unsigned int id = dai->driver->id;
int ret = -EINVAL;
-   unsigned int val = 0;
-
-   ret = regmap_read(drvdata->lpaif_map,
-   LPAIF_I2SCTL_REG(drvdata->variant, 
dai->driver->id), &val);
-   if (ret) {
-   dev_err(dai->dev, "error reading from i2sctl reg: %d\n", ret);
-   return ret;
-   }
-   if (val == LPAIF_I2SCTL_RESET_STATE) {
-   dev_err(dai->dev, "error in i2sctl register state\n");
-   return -ENOTRECOVERABLE;
-   }
 
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
@@ -454,20 +442,16 @@ static bool lpass_cpu_regmap_volatile(struct device *dev, 
unsigned int reg)
struct lpass_variant *v = drvdata->variant;
int i;
 
-   for (i = 0; i < v->i2s_ports; ++i)
-   if (reg == LPAIF_I2SCTL_REG(v, i))
-   return true;
for (i = 0; i < v->irq_ports; ++i)
if (reg == LPAIF_IRQSTAT_REG(v, i))
return true;
 
for (i = 0; i < v->rdma_channels; ++i)
-   if (reg == LPAIF_RDMACURR_REG(v, i) || reg == 
LPAIF_RDMACTL_REG(v, i))
+   if (reg == LPAIF_RDMACURR_REG(v, i))
return true;
 
for (i = 0; i < v->wrdma_channels; ++i)
-   if (reg == LPAIF_WRDMACURR_REG(v, i + v->wrdma_channel_start) ||
-   reg == LPAIF_WRDMACTL_REG(v, i + 
v->wrdma_channel_start))
+   if (reg == LPAIF_WRDMACURR_REG(v, i + v->wrdma_channel_start))
return true;
 
return false;
diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c
index 80b09de..232deee 100644
--- a/sound/soc/qcom/lpass-platform.c
+++ b/sound/soc/qcom/lpass-platform.c
@@ -452,7 +452,6 @@ static int lpass_platform_pcmops_trigger(struct 
snd_soc_component *component,
unsigned int reg_irqclr = 0, val_irqclr = 0;
unsigned int  reg_irqen = 0, val_irqen = 0, val_mask = 0;
unsigned int dai_id = cpu_dai->driver->id;
-   unsigned int dma_ctrl_reg = 0;
 
ch = pcm_data->dma_ch;
if (dir ==  SNDRV_PCM_STREAM_PLAYBACK) {
@@ -469,17 +468,7 @@ static int lpass_platform_pcmops_trigger(struct 
snd_soc_component *component,
id = pcm_data->dma_ch - v->wrdma_channel_start;
map = drvdata->lpaif_map;
}
-   ret = regmap_read(map, LPAIF_DMACTL_REG(v, ch, dir, dai_id), 
&dma_ctrl_reg);
-   if (ret) {
-   dev_err(soc_runtime->dev, "error reading from rdmactl reg: 
%d\n", ret);
-   return ret;
-   }
 
-   if (dma_ctrl_reg == LPAIF_DMACTL_RESET_STATE ||
-   dma_ctrl_reg == LPAIF_DMACTL_RESET_STATE + 1) {
-   dev_err(soc_runtime->dev, "error in rdmactl register state\n");
-   return -ENOTRECOVERABLE;
-   }
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_RESUME:
@@ -500,7 +489,6 @@ static int lpass_platform_pcmops_trigger(struct 
snd_soc_component *component,
"error writing to rdmactl reg: %d\n", 
ret);
return ret;
}
-   map = drvdata->hdmiif_map;
reg_irqclr = LPASS_HDMITX_APP_IRQCLEAR_REG(v);
val_irqclr = (LPAIF_IRQ_ALL(ch) |
LPAIF_IRQ_HDMI_REQ_ON_PRELOAD(ch) |
@@ -519,7 +507,6 @@ static int lpass_platform_pcmops_trigger(struct 
snd_soc_component *component,
break;
case MI2S_PRIMARY:
case MI2S_SECONDARY:
-   map = drvdata->lpaif_map;
reg_irqclr = LPAIF_IRQCLEAR_REG(v, LPAIF_IRQ_PORT_H

[PATCH v6 0/2] Platform driver update to support playback recover after resume

2020-12-17 Thread Srinivasa Rao Mandadapu
This patch set is to add support for playback recover after hard suspend and 
resume.
It includes:
1. Reverting part of previous commit, which is for handling registers invalid 
state
after hard suspend.
2. Adding pm ops in component driver and do regcache sync.
Changes Since v1 and v2:
  -- Subject lines changed
Changes Since v3:
  -- Patch is splitted into 2 patches
Changes Since v4:
  -- Subject lines changed
Changes Since v5:
  -- Removed redundant initialization of map variable in lpass-platform.c

Srinivasa Rao Mandadapu (2):
  ASoC: qcom: Fix incorrect volatile registers
  ASoC: qcom: Add support for playback recover after resume

 sound/soc/qcom/lpass-cpu.c  | 20 ++---
 sound/soc/qcom/lpass-platform.c | 50 -
 2 files changed, 37 insertions(+), 33 deletions(-)

-- 
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 v4 1/2] Partially revert ASoC: qcom: Fix enabling BCLK and LRCLK in LPAIF invalid state

2020-12-14 Thread Srinivasa Rao Mandadapu

Thanks Mark for Your time!!!

On 12/1/2020 11:21 PM, Mark Brown wrote:

On Tue, Dec 01, 2020 at 11:01:21PM +0530, Srinivasa Rao Mandadapu wrote:

On 11/30/2020 6:16 PM, Mark Brown wrote:

Part of this commit message says that the problem was making the registers
non-volatile but both the change and the rest of the commit message say
that the issue was that the registers were made volatile.  I'm also
still unclear as to what the issue is either way - how does reading the
state of the registers from the hardware instead of the cache affect
things?

Initial problem was, during playback if device suspended, I2S and DMA
control registers
are getting reset and unable to recover playback after resume.
As these registers were non volatile registers, driver is not getting actual
register value
and unable to report error state to application. Due to this application
keeps on polling for HW current pointer state and not exited from PCM
running state.
Later from review comments by Srinivas kandagatla, I got to know

about regcache sync APIs, which can be used  to sync cache after resume and

HW registers can be updated with  original values. With that playback can be
continued.

So is the reason, I am reverting partial changes in the commit b1824968221c.

I don't understand why a fix for the register cache not being in sync
with the hardware doesn't involve syncing the register cache with the
hardware.


I am sorry I couldn't understand your point. Could you please elaborate 
your query?


Actually I posted V5 version based on review comments.

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



[PATCH v5 2/2] ASoC: qcom: Add support for playback recover after resume

2020-12-02 Thread Srinivasa Rao Mandadapu
To support playback continuation after hard suspend(bypass powerd)
and resume do regcache sync with component driver pm ops.

Signed-off-by: V Sujith Kumar Reddy 
Signed-off-by: Srinivasa Rao Mandadapu 
Reviewed-by: Srinivas Kandagatla 
Tested-by: Steev Klimaszewski 
---
 sound/soc/qcom/lpass-platform.c | 35 +++
 1 file changed, 35 insertions(+)

diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c
index 0e71899..12764a8 100644
--- a/sound/soc/qcom/lpass-platform.c
+++ b/sound/soc/qcom/lpass-platform.c
@@ -827,6 +827,39 @@ static void lpass_platform_pcm_free(struct 
snd_soc_component *component,
}
 }
 
+static int lpass_platform_pcmops_suspend(struct snd_soc_component *component)
+{
+   struct lpass_data *drvdata = snd_soc_component_get_drvdata(component);
+   struct regmap *map;
+   unsigned int dai_id = component->id;
+
+   if (dai_id == LPASS_DP_RX)
+   map = drvdata->hdmiif_map;
+   else
+   map = drvdata->lpaif_map;
+
+   regcache_cache_only(map, true);
+   regcache_mark_dirty(map);
+
+   return 0;
+}
+
+static int lpass_platform_pcmops_resume(struct snd_soc_component *component)
+{
+   struct lpass_data *drvdata = snd_soc_component_get_drvdata(component);
+   struct regmap *map;
+   unsigned int dai_id = component->id;
+
+   if (dai_id == LPASS_DP_RX)
+   map = drvdata->hdmiif_map;
+   else
+   map = drvdata->lpaif_map;
+
+   regcache_cache_only(map, false);
+   return regcache_sync(map);
+}
+
+
 static const struct snd_soc_component_driver lpass_component_driver = {
.name   = DRV_NAME,
.open   = lpass_platform_pcmops_open,
@@ -839,6 +872,8 @@ static const struct snd_soc_component_driver 
lpass_component_driver = {
.mmap   = lpass_platform_pcmops_mmap,
.pcm_construct  = lpass_platform_pcm_new,
.pcm_destruct   = lpass_platform_pcm_free,
+   .suspend= lpass_platform_pcmops_suspend,
+   .resume = lpass_platform_pcmops_resume,
 
 };
 
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH v5 1/2] ASoC: qcom: Fix incorrect volatile registers

2020-12-02 Thread Srinivasa Rao Mandadapu
MI2S and DMA control registers are not volatile,
so remove these from volatile registers list.
Registers reset state check by reading non volatile registers
makes no use, so remove error check from cpu and platform
trigger callbacks.

Fixes commit b1824968221cc ("ASoC: qcom: Fix enabling BCLK and LRCLK in LPAIF 
invalid state")

Signed-off-by: V Sujith Kumar Reddy 
Signed-off-by: Srinivasa Rao Mandadapu 
---
 sound/soc/qcom/lpass-cpu.c  | 20 ++--
 sound/soc/qcom/lpass-platform.c | 11 ---
 2 files changed, 2 insertions(+), 29 deletions(-)

diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
index af684fd..c5e99c2 100644
--- a/sound/soc/qcom/lpass-cpu.c
+++ b/sound/soc/qcom/lpass-cpu.c
@@ -270,18 +270,6 @@ static int lpass_cpu_daiops_trigger(struct 
snd_pcm_substream *substream,
struct lpaif_i2sctl *i2sctl = drvdata->i2sctl;
unsigned int id = dai->driver->id;
int ret = -EINVAL;
-   unsigned int val = 0;
-
-   ret = regmap_read(drvdata->lpaif_map,
-   LPAIF_I2SCTL_REG(drvdata->variant, 
dai->driver->id), &val);
-   if (ret) {
-   dev_err(dai->dev, "error reading from i2sctl reg: %d\n", ret);
-   return ret;
-   }
-   if (val == LPAIF_I2SCTL_RESET_STATE) {
-   dev_err(dai->dev, "error in i2sctl register state\n");
-   return -ENOTRECOVERABLE;
-   }
 
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
@@ -454,20 +442,16 @@ static bool lpass_cpu_regmap_volatile(struct device *dev, 
unsigned int reg)
struct lpass_variant *v = drvdata->variant;
int i;
 
-   for (i = 0; i < v->i2s_ports; ++i)
-   if (reg == LPAIF_I2SCTL_REG(v, i))
-   return true;
for (i = 0; i < v->irq_ports; ++i)
if (reg == LPAIF_IRQSTAT_REG(v, i))
return true;
 
for (i = 0; i < v->rdma_channels; ++i)
-   if (reg == LPAIF_RDMACURR_REG(v, i) || reg == 
LPAIF_RDMACTL_REG(v, i))
+   if (reg == LPAIF_RDMACURR_REG(v, i))
return true;
 
for (i = 0; i < v->wrdma_channels; ++i)
-   if (reg == LPAIF_WRDMACURR_REG(v, i + v->wrdma_channel_start) ||
-   reg == LPAIF_WRDMACTL_REG(v, i + 
v->wrdma_channel_start))
+   if (reg == LPAIF_WRDMACURR_REG(v, i + v->wrdma_channel_start))
return true;
 
return false;
diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c
index 80b09de..0e71899 100644
--- a/sound/soc/qcom/lpass-platform.c
+++ b/sound/soc/qcom/lpass-platform.c
@@ -452,7 +452,6 @@ static int lpass_platform_pcmops_trigger(struct 
snd_soc_component *component,
unsigned int reg_irqclr = 0, val_irqclr = 0;
unsigned int  reg_irqen = 0, val_irqen = 0, val_mask = 0;
unsigned int dai_id = cpu_dai->driver->id;
-   unsigned int dma_ctrl_reg = 0;
 
ch = pcm_data->dma_ch;
if (dir ==  SNDRV_PCM_STREAM_PLAYBACK) {
@@ -469,17 +468,7 @@ static int lpass_platform_pcmops_trigger(struct 
snd_soc_component *component,
id = pcm_data->dma_ch - v->wrdma_channel_start;
map = drvdata->lpaif_map;
}
-   ret = regmap_read(map, LPAIF_DMACTL_REG(v, ch, dir, dai_id), 
&dma_ctrl_reg);
-   if (ret) {
-   dev_err(soc_runtime->dev, "error reading from rdmactl reg: 
%d\n", ret);
-   return ret;
-   }
 
-   if (dma_ctrl_reg == LPAIF_DMACTL_RESET_STATE ||
-   dma_ctrl_reg == LPAIF_DMACTL_RESET_STATE + 1) {
-   dev_err(soc_runtime->dev, "error in rdmactl register state\n");
-   return -ENOTRECOVERABLE;
-   }
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_RESUME:
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH v5 0/2] Platform driver update to support playback recover after resume

2020-12-02 Thread Srinivasa Rao Mandadapu
This patch set is to add support for playback recover after hard suspend and 
resume.
It includes:
1. Reverting part of previous commit, which is for handling registers invalid 
state
after hard suspend.
2. Adding pm ops in component driver and do regcache sync.
Changes Since v1 and v2:
  -- Subject lines changed
Changes Since v3:
  -- Patch is splitted into 2 patches
Changes Since v4:
  -- Subject lines changed

Srinivasa Rao Mandadapu (2):
  ASoC: qcom: Fix incorrect volatile registers
  ASoC: qcom: Add support for playback recover after resume

 sound/soc/qcom/lpass-cpu.c  | 20 ++
 sound/soc/qcom/lpass-platform.c | 46 +++--
 2 files changed, 37 insertions(+), 29 deletions(-)

-- 
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 v4 1/2] Partially revert ASoC: qcom: Fix enabling BCLK and LRCLK in LPAIF invalid state

2020-12-01 Thread Srinivasa Rao Mandadapu

Thanks Mark for your time!!!

On 11/30/2020 6:16 PM, Mark Brown wrote:

On Sat, Nov 28, 2020 at 10:29:18AM +0530, Srinivasa Rao Mandadapu wrote:

This reverts part of commit b1824968221c
("ASoC: qcom: Fix enabling BCLK and LRCLK in LPAIF invalid state")

To identify LPAIF invalid state after device suspend and resume,
made I2S and DMA control registers not volatile, which is not necessary.
Instead invalid reg state can be handled with regcache APIs.
The BCLK ref count is necessary to enable clock only it's in disable state.

Part of this commit message says that the problem was making the registers
non-volatile but both the change and the rest of the commit message say
that the issue was that the registers were made volatile.  I'm also
still unclear as to what the issue is either way - how does reading the
state of the registers from the hardware instead of the cache affect
things?


Initial problem was, during playback if device suspended, I2S and DMA 
control registers


are getting reset and unable to recover playback after resume.

As these registers were non volatile registers, driver is not getting 
actual register value


and unable to report error state to application. Due to this application

keeps on polling for HW current pointer state and not exited from PCM 
running state.


To handle this scenario I made registers volatile and if they are in 
reset state, reported error


to application(commit b1824968221c).

Later from review comments by Srinivas kandagatla, I got to know

about regcache sync APIs, which can be used  to sync cache after resume and

HW registers can be updated with  original values. With that playback 
can be continued.


So is the reason, I am reverting partial changes in the commit b1824968221c.



Please submit patches using subject lines reflecting the style for the
subsystem, this makes it easier for people to identify relevant patches.
Look at what existing commits in the area you're changing are doing and
make sure your subject lines visually resemble what they're doing.
There's no need to resubmit to fix this alone.


--
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] arm64: dts: qcom: sc7180-trogdor: Add lpass dai link for I2S driver

2020-11-30 Thread Srinivasa Rao Mandadapu

Thanks Bjorn For your comments!!!

On 11/30/2020 10:22 PM, Bjorn Andersson wrote:

On Fri 18 Sep 09:51 CDT 2020, Srinivasa Rao Mandadapu wrote:


From: Ajit Pandey 

Add dai link for supporting lpass I2S driver, which is used
for audio capture and playback.
Add lpass-cpu node with  pin controls and i2s primary
and secondary dai-links

Signed-off-by: Srinivasa Rao Mandadapu 
Signed-off-by: V Sujith Kumar Reddy 

Ajit needs to certify the origin of the patch, with his signed-off-by
and as you are the last to touch it your signed-off-by should be last.

Also, please advice on the dependencies of this patch, because the tree
doesn't build after applying this patch.

Regards,
Bjorn


After this patch v2 patch is posted.

https://lore.kernel.org/patchwork/patch/1317796/


---
  arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi | 59 
  1 file changed, 59 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
index bf87558..5724982 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
@@ -220,6 +220,44 @@
max-brightness = <1023>;
};
};
+
+   sound {
+   compatible = "qcom,sc7180-sndcard";
+   model = "sc7180-snd-card";
+
+   audio-routing =
+   "Headphone Jack", "HPOL",
+   "Headphone Jack", "HPOR";
+
+   audio-jack = <&alc5682>;
+
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   dai-link@0 {
+   link-name = "MultiMedia0";
+   reg = <0>;
+   cpu {
+   sound-dai = <&lpass_cpu 0>;
+   };
+
+   codec {
+   sound-dai = <&alc5682 0>;
+   };
+   };
+
+   dai-link@1 {
+   link-name = "MultiMedia1";
+   reg = <1>;
+   cpu {
+   sound-dai = <&lpass_cpu 1>;
+   };
+
+   codec {
+   sound-dai = <&max98357a>;
+   };
+   };
+   };
  };
  
  &qfprom {

@@ -725,6 +763,27 @@ hp_i2c: &i2c9 {
modem-init;
  };
  
+&lpass_cpu {

+   status = "okay";
+
+   pinctrl-names = "default";
+   pinctrl-0 = <&sec_mi2s_active &pri_mi2s_active &pri_mi2s_mclk_active>;
+
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   mi2s-primary@0 {
+   reg = ;
+   qcom,playback-sd-lines = <1>;
+   qcom,capture-sd-lines = <0>;
+   };
+
+   mi2s-secondary@1 {
+   reg = ;
+   qcom,playback-sd-lines = <0>;
+   };
+};
+
  &mdp {
status = "okay";
  };
--
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.


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



[PATCH v4 1/2] Partially revert ASoC: qcom: Fix enabling BCLK and LRCLK in LPAIF invalid state

2020-11-28 Thread Srinivasa Rao Mandadapu
This reverts part of commit b1824968221c
("ASoC: qcom: Fix enabling BCLK and LRCLK in LPAIF invalid state")

To identify LPAIF invalid state after device suspend and resume,
made I2S and DMA control registers not volatile, which is not necessary.
Instead invalid reg state can be handled with regcache APIs.
The BCLK ref count is necessary to enable clock only it's in disable state.

Signed-off-by: V Sujith Kumar Reddy 
Signed-off-by: Srinivasa Rao Mandadapu 
---
 sound/soc/qcom/lpass-cpu.c  | 20 ++--
 sound/soc/qcom/lpass-platform.c | 11 ---
 2 files changed, 2 insertions(+), 29 deletions(-)

diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
index af684fd..c5e99c2 100644
--- a/sound/soc/qcom/lpass-cpu.c
+++ b/sound/soc/qcom/lpass-cpu.c
@@ -270,18 +270,6 @@ static int lpass_cpu_daiops_trigger(struct 
snd_pcm_substream *substream,
struct lpaif_i2sctl *i2sctl = drvdata->i2sctl;
unsigned int id = dai->driver->id;
int ret = -EINVAL;
-   unsigned int val = 0;
-
-   ret = regmap_read(drvdata->lpaif_map,
-   LPAIF_I2SCTL_REG(drvdata->variant, 
dai->driver->id), &val);
-   if (ret) {
-   dev_err(dai->dev, "error reading from i2sctl reg: %d\n", ret);
-   return ret;
-   }
-   if (val == LPAIF_I2SCTL_RESET_STATE) {
-   dev_err(dai->dev, "error in i2sctl register state\n");
-   return -ENOTRECOVERABLE;
-   }
 
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
@@ -454,20 +442,16 @@ static bool lpass_cpu_regmap_volatile(struct device *dev, 
unsigned int reg)
struct lpass_variant *v = drvdata->variant;
int i;
 
-   for (i = 0; i < v->i2s_ports; ++i)
-   if (reg == LPAIF_I2SCTL_REG(v, i))
-   return true;
for (i = 0; i < v->irq_ports; ++i)
if (reg == LPAIF_IRQSTAT_REG(v, i))
return true;
 
for (i = 0; i < v->rdma_channels; ++i)
-   if (reg == LPAIF_RDMACURR_REG(v, i) || reg == 
LPAIF_RDMACTL_REG(v, i))
+   if (reg == LPAIF_RDMACURR_REG(v, i))
return true;
 
for (i = 0; i < v->wrdma_channels; ++i)
-   if (reg == LPAIF_WRDMACURR_REG(v, i + v->wrdma_channel_start) ||
-   reg == LPAIF_WRDMACTL_REG(v, i + 
v->wrdma_channel_start))
+   if (reg == LPAIF_WRDMACURR_REG(v, i + v->wrdma_channel_start))
return true;
 
return false;
diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c
index 80b09de..0e71899 100644
--- a/sound/soc/qcom/lpass-platform.c
+++ b/sound/soc/qcom/lpass-platform.c
@@ -452,7 +452,6 @@ static int lpass_platform_pcmops_trigger(struct 
snd_soc_component *component,
unsigned int reg_irqclr = 0, val_irqclr = 0;
unsigned int  reg_irqen = 0, val_irqen = 0, val_mask = 0;
unsigned int dai_id = cpu_dai->driver->id;
-   unsigned int dma_ctrl_reg = 0;
 
ch = pcm_data->dma_ch;
if (dir ==  SNDRV_PCM_STREAM_PLAYBACK) {
@@ -469,17 +468,7 @@ static int lpass_platform_pcmops_trigger(struct 
snd_soc_component *component,
id = pcm_data->dma_ch - v->wrdma_channel_start;
map = drvdata->lpaif_map;
}
-   ret = regmap_read(map, LPAIF_DMACTL_REG(v, ch, dir, dai_id), 
&dma_ctrl_reg);
-   if (ret) {
-   dev_err(soc_runtime->dev, "error reading from rdmactl reg: 
%d\n", ret);
-   return ret;
-   }
 
-   if (dma_ctrl_reg == LPAIF_DMACTL_RESET_STATE ||
-   dma_ctrl_reg == LPAIF_DMACTL_RESET_STATE + 1) {
-   dev_err(soc_runtime->dev, "error in rdmactl register state\n");
-   return -ENOTRECOVERABLE;
-   }
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_RESUME:
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH v4 0/2] Platform driver update to support playback recover after resume

2020-11-28 Thread Srinivasa Rao Mandadapu
This patch set is to add support for playback recover after hard suspend and 
resume.
It includes:
1. Reverting part of previous commit, which is for handling registers invalid 
state
after hard suspend.
2. Adding pm ops in component driver and do regcache sync.

Srinivasa Rao Mandadapu (2):
  Partially revert ASoC: qcom: Fix enabling BCLK and LRCLK in LPAIF
invalid state
  ASoC: qcom: Add support for playback recover after resume

 sound/soc/qcom/lpass-cpu.c  | 20 ++
 sound/soc/qcom/lpass-platform.c | 46 +++--
 2 files changed, 37 insertions(+), 29 deletions(-)

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



[PATCH v4 2/2] ASoC: qcom: Add support for playback recover after resume

2020-11-28 Thread Srinivasa Rao Mandadapu
To support playback continuation after hard suspend(bypass powerd)
and resume add component driver ops and do regcache sync.

Signed-off-by: V Sujith Kumar Reddy 
Signed-off-by: Srinivasa Rao Mandadapu 
---
 sound/soc/qcom/lpass-platform.c | 35 +++
 1 file changed, 35 insertions(+)

diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c
index 0e71899..12764a8 100644
--- a/sound/soc/qcom/lpass-platform.c
+++ b/sound/soc/qcom/lpass-platform.c
@@ -827,6 +827,39 @@ static void lpass_platform_pcm_free(struct 
snd_soc_component *component,
}
 }
 
+static int lpass_platform_pcmops_suspend(struct snd_soc_component *component)
+{
+   struct lpass_data *drvdata = snd_soc_component_get_drvdata(component);
+   struct regmap *map;
+   unsigned int dai_id = component->id;
+
+   if (dai_id == LPASS_DP_RX)
+   map = drvdata->hdmiif_map;
+   else
+   map = drvdata->lpaif_map;
+
+   regcache_cache_only(map, true);
+   regcache_mark_dirty(map);
+
+   return 0;
+}
+
+static int lpass_platform_pcmops_resume(struct snd_soc_component *component)
+{
+   struct lpass_data *drvdata = snd_soc_component_get_drvdata(component);
+   struct regmap *map;
+   unsigned int dai_id = component->id;
+
+   if (dai_id == LPASS_DP_RX)
+   map = drvdata->hdmiif_map;
+   else
+   map = drvdata->lpaif_map;
+
+   regcache_cache_only(map, false);
+   return regcache_sync(map);
+}
+
+
 static const struct snd_soc_component_driver lpass_component_driver = {
.name   = DRV_NAME,
.open   = lpass_platform_pcmops_open,
@@ -839,6 +872,8 @@ static const struct snd_soc_component_driver 
lpass_component_driver = {
.mmap   = lpass_platform_pcmops_mmap,
.pcm_construct  = lpass_platform_pcm_new,
.pcm_destruct   = lpass_platform_pcm_free,
+   .suspend= lpass_platform_pcmops_suspend,
+   .resume = lpass_platform_pcmops_resume,
 
 };
 
-- 
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] Asoc: qcom: Fix for problem in resume with CRAS

2020-11-27 Thread Srinivasa Rao Mandadapu

Thanks Mark  for your time!!!

On 11/27/2020 6:08 PM, Mark Brown wrote:

On Fri, Nov 27, 2020 at 09:42:03AM +0530, Srinivasa Rao Mandadapu wrote:

To support playback continuation after resume problem in chrome
audio server:
Prepare device in  platform trigger callback.
Make I2s and DMA control registers as non volatile.

What is the actual issue this is fixing?
Please ignore this patch. Posted new version of patch( [PATCH v3] ASoC: 
qcom: Fix playback recover problem in suspend resume) instead of this.


As I have previously said please submit patches using subject lines
reflecting the style for the subsystem, this makes it easier for people
to identify relevant patches.  Look at what existing commits in the area
you're changing are doing and make sure your subject lines visually
resemble what they're doing.  There's no need to resubmit to fix this
alone.


Previously I could not understand what is the mistake in subject line. 
Now I understood


the mistake and will take care of it next time.

--
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 v3] ASoC: qcom: Fix playback recover problem in suspend resume

2020-11-27 Thread Srinivasa Rao Mandadapu
Thanks a lot  Srinivas for your valuable review comments and for your 
time!!!


On 11/27/2020 5:39 PM, Srinivas Kandagatla wrote:



On 27/11/2020 09:56, Srinivasa Rao Mandadapu wrote:

To support playback continuation after hard suspend(bypass powerd)
  and resume:
Prepare device in  platform trigger callback.
Make I2s and DMA control registers as non volatile.
Looks like there are two changes here, One is fixing the volatile 
registers!



Other is preparing device after suspend!

Consider splitting them!


Okay will split and share.




Fixes tag is missing here?

Actually fixing volatile registers is just partial reversal of commit 
b1824968221c ("ASoC: qcom: Fix enabling BCLK and LRCLK in LPAIF invalid 
state")


Will revert and share the patch separately.


Signed-off-by: V Sujith Kumar Reddy 
Signed-off-by: Srinivasa Rao Mandadapu 
---
Changes Since v1 and v2:
   -- Subject lines changed

  sound/soc/qcom/lpass-cpu.c  | 8 ++--
  sound/soc/qcom/lpass-platform.c | 5 +++--
  2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
index af684fd..c99be03 100644
--- a/sound/soc/qcom/lpass-cpu.c
+++ b/sound/soc/qcom/lpass-cpu.c
@@ -454,20 +454,16 @@ static bool lpass_cpu_regmap_volatile(struct 
device *dev, unsigned int reg)

  struct lpass_variant *v = drvdata->variant;
  int i;
  -    for (i = 0; i < v->i2s_ports; ++i)
-    if (reg == LPAIF_I2SCTL_REG(v, i))
-    return true;
  for (i = 0; i < v->irq_ports; ++i)
  if (reg == LPAIF_IRQSTAT_REG(v, i))
  return true;
    for (i = 0; i < v->rdma_channels; ++i)
-    if (reg == LPAIF_RDMACURR_REG(v, i) || reg == 
LPAIF_RDMACTL_REG(v, i))

+    if (reg == LPAIF_RDMACURR_REG(v, i))
  return true;
    for (i = 0; i < v->wrdma_channels; ++i)
-    if (reg == LPAIF_WRDMACURR_REG(v, i + 
v->wrdma_channel_start) ||

-    reg == LPAIF_WRDMACTL_REG(v, i + v->wrdma_channel_start))
+    if (reg == LPAIF_WRDMACURR_REG(v, i + v->wrdma_channel_start))
  return true;
    return false;
diff --git a/sound/soc/qcom/lpass-platform.c 
b/sound/soc/qcom/lpass-platform.c

index 80b09de..2b0a7c1 100644
--- a/sound/soc/qcom/lpass-platform.c
+++ b/sound/soc/qcom/lpass-platform.c
@@ -481,8 +481,9 @@ static int lpass_platform_pcmops_trigger(struct 
snd_soc_component *component,

  return -ENOTRECOVERABLE;
  }
  switch (cmd) {
-    case SNDRV_PCM_TRIGGER_START:
  case SNDRV_PCM_TRIGGER_RESUME:
+    lpass_platform_pcmops_prepare(component, substream);


Can you elaborate the actual issue here?

Are any other registers needs to re-programmed??

Does it make sense to use
regcache_mark_dirty()
regcache_sync() in pm suspend resume path,
instead of calling prepare explicitly?


--srini


Yes it's working fine with regcache APIs. will update the patch.



+    case SNDRV_PCM_TRIGGER_START:
  case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
  ret = regmap_fields_write(dmactl->enable, id,
   LPAIF_DMACTL_ENABLE_ON);
@@ -592,7 +593,7 @@ static int lpass_platform_pcmops_trigger(struct 
snd_soc_component *component,

  break;
  }
  -    return 0;
+    return ret;
  }
    static snd_pcm_uframes_t lpass_platform_pcmops_pointer(


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



[PATCH v3] ASoC: qcom: Fix playback recover problem in suspend resume

2020-11-27 Thread Srinivasa Rao Mandadapu
To support playback continuation after hard suspend(bypass powerd)
 and resume:
Prepare device in  platform trigger callback.
Make I2s and DMA control registers as non volatile.

Signed-off-by: V Sujith Kumar Reddy 
Signed-off-by: Srinivasa Rao Mandadapu 
---
Changes Since v1 and v2:
  -- Subject lines changed

 sound/soc/qcom/lpass-cpu.c  | 8 ++--
 sound/soc/qcom/lpass-platform.c | 5 +++--
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
index af684fd..c99be03 100644
--- a/sound/soc/qcom/lpass-cpu.c
+++ b/sound/soc/qcom/lpass-cpu.c
@@ -454,20 +454,16 @@ static bool lpass_cpu_regmap_volatile(struct device *dev, 
unsigned int reg)
struct lpass_variant *v = drvdata->variant;
int i;
 
-   for (i = 0; i < v->i2s_ports; ++i)
-   if (reg == LPAIF_I2SCTL_REG(v, i))
-   return true;
for (i = 0; i < v->irq_ports; ++i)
if (reg == LPAIF_IRQSTAT_REG(v, i))
return true;
 
for (i = 0; i < v->rdma_channels; ++i)
-   if (reg == LPAIF_RDMACURR_REG(v, i) || reg == 
LPAIF_RDMACTL_REG(v, i))
+   if (reg == LPAIF_RDMACURR_REG(v, i))
return true;
 
for (i = 0; i < v->wrdma_channels; ++i)
-   if (reg == LPAIF_WRDMACURR_REG(v, i + v->wrdma_channel_start) ||
-   reg == LPAIF_WRDMACTL_REG(v, i + 
v->wrdma_channel_start))
+   if (reg == LPAIF_WRDMACURR_REG(v, i + v->wrdma_channel_start))
return true;
 
return false;
diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c
index 80b09de..2b0a7c1 100644
--- a/sound/soc/qcom/lpass-platform.c
+++ b/sound/soc/qcom/lpass-platform.c
@@ -481,8 +481,9 @@ static int lpass_platform_pcmops_trigger(struct 
snd_soc_component *component,
return -ENOTRECOVERABLE;
}
switch (cmd) {
-   case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_RESUME:
+   lpass_platform_pcmops_prepare(component, substream);
+   case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
ret = regmap_fields_write(dmactl->enable, id,
 LPAIF_DMACTL_ENABLE_ON);
@@ -592,7 +593,7 @@ static int lpass_platform_pcmops_trigger(struct 
snd_soc_component *component,
break;
}
 
-   return 0;
+   return ret;
 }
 
 static snd_pcm_uframes_t lpass_platform_pcmops_pointer(
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH v2] Asoc: qcom: Fix plaback recover problem in suspend resume

2020-11-27 Thread Srinivasa Rao Mandadapu
To support playback continuation after hard suspend(bypass powerd)
 and resume:
Prepare device in  platform trigger callback.
Make I2s and DMA control registers as non volatile.

Signed-off-by: V Sujith Kumar Reddy 
Signed-off-by: Srinivasa Rao Mandadapu 
---
Changes Since v1:
  -- Subject lines changed

 sound/soc/qcom/lpass-cpu.c  | 8 ++--
 sound/soc/qcom/lpass-platform.c | 5 +++--
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
index af684fd..c99be03 100644
--- a/sound/soc/qcom/lpass-cpu.c
+++ b/sound/soc/qcom/lpass-cpu.c
@@ -454,20 +454,16 @@ static bool lpass_cpu_regmap_volatile(struct device *dev, 
unsigned int reg)
struct lpass_variant *v = drvdata->variant;
int i;
 
-   for (i = 0; i < v->i2s_ports; ++i)
-   if (reg == LPAIF_I2SCTL_REG(v, i))
-   return true;
for (i = 0; i < v->irq_ports; ++i)
if (reg == LPAIF_IRQSTAT_REG(v, i))
return true;
 
for (i = 0; i < v->rdma_channels; ++i)
-   if (reg == LPAIF_RDMACURR_REG(v, i) || reg == 
LPAIF_RDMACTL_REG(v, i))
+   if (reg == LPAIF_RDMACURR_REG(v, i))
return true;
 
for (i = 0; i < v->wrdma_channels; ++i)
-   if (reg == LPAIF_WRDMACURR_REG(v, i + v->wrdma_channel_start) ||
-   reg == LPAIF_WRDMACTL_REG(v, i + 
v->wrdma_channel_start))
+   if (reg == LPAIF_WRDMACURR_REG(v, i + v->wrdma_channel_start))
return true;
 
return false;
diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c
index 80b09de..2b0a7c1 100644
--- a/sound/soc/qcom/lpass-platform.c
+++ b/sound/soc/qcom/lpass-platform.c
@@ -481,8 +481,9 @@ static int lpass_platform_pcmops_trigger(struct 
snd_soc_component *component,
return -ENOTRECOVERABLE;
}
switch (cmd) {
-   case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_RESUME:
+   lpass_platform_pcmops_prepare(component, substream);
+   case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
ret = regmap_fields_write(dmactl->enable, id,
 LPAIF_DMACTL_ENABLE_ON);
@@ -592,7 +593,7 @@ static int lpass_platform_pcmops_trigger(struct 
snd_soc_component *component,
break;
}
 
-   return 0;
+   return ret;
 }
 
 static snd_pcm_uframes_t lpass_platform_pcmops_pointer(
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH] Asoc: qcom: Fix for problem in resume with CRAS

2020-11-26 Thread Srinivasa Rao Mandadapu
To support playback continuation after resume problem in chrome
audio server:
Prepare device in  platform trigger callback.
Make I2s and DMA control registers as non volatile.

Signed-off-by: V Sujith Kumar Reddy 
Signed-off-by: Srinivasa Rao Mandadapu 
---
 sound/soc/qcom/lpass-cpu.c  | 8 ++--
 sound/soc/qcom/lpass-platform.c | 5 +++--
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
index af684fd..c99be03 100644
--- a/sound/soc/qcom/lpass-cpu.c
+++ b/sound/soc/qcom/lpass-cpu.c
@@ -454,20 +454,16 @@ static bool lpass_cpu_regmap_volatile(struct device *dev, 
unsigned int reg)
struct lpass_variant *v = drvdata->variant;
int i;
 
-   for (i = 0; i < v->i2s_ports; ++i)
-   if (reg == LPAIF_I2SCTL_REG(v, i))
-   return true;
for (i = 0; i < v->irq_ports; ++i)
if (reg == LPAIF_IRQSTAT_REG(v, i))
return true;
 
for (i = 0; i < v->rdma_channels; ++i)
-   if (reg == LPAIF_RDMACURR_REG(v, i) || reg == 
LPAIF_RDMACTL_REG(v, i))
+   if (reg == LPAIF_RDMACURR_REG(v, i))
return true;
 
for (i = 0; i < v->wrdma_channels; ++i)
-   if (reg == LPAIF_WRDMACURR_REG(v, i + v->wrdma_channel_start) ||
-   reg == LPAIF_WRDMACTL_REG(v, i + 
v->wrdma_channel_start))
+   if (reg == LPAIF_WRDMACURR_REG(v, i + v->wrdma_channel_start))
return true;
 
return false;
diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c
index 80b09de..2b0a7c1 100644
--- a/sound/soc/qcom/lpass-platform.c
+++ b/sound/soc/qcom/lpass-platform.c
@@ -481,8 +481,9 @@ static int lpass_platform_pcmops_trigger(struct 
snd_soc_component *component,
return -ENOTRECOVERABLE;
}
switch (cmd) {
-   case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_RESUME:
+   lpass_platform_pcmops_prepare(component, substream);
+   case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
ret = regmap_fields_write(dmactl->enable, id,
 LPAIF_DMACTL_ENABLE_ON);
@@ -592,7 +593,7 @@ static int lpass_platform_pcmops_trigger(struct 
snd_soc_component *component,
break;
}
 
-   return 0;
+   return ret;
 }
 
 static snd_pcm_uframes_t lpass_platform_pcmops_pointer(
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH] Asoc: qcom: Fix enabling BCLK and LRCLK in LPAIF invalid state

2020-11-23 Thread Srinivasa Rao Mandadapu
Fix enabling BCLK and LRCLK only when LPAIF is invalid state and
bit clock in enable state.
In device suspend/resume scenario LPAIF is going to reset state.
which is causing LRCLK disable and BCLK enable.
Avoid such inconsitency by removing unnecessary cpu dai prepare API,
which is doing LRCLK enable, and by maintaining BLCK  state information.

Fixes: 7e6799d8f87d ("ASoC: qcom: lpass-cpu: Enable MI2S BCLK and LRCLK 
together")

Signed-off-by: V Sujith Kumar Reddy 
Signed-off-by: Srinivasa Rao Mandadapu 
---
 sound/soc/qcom/lpass-cpu.c   | 62 
 sound/soc/qcom/lpass-lpaif-reg.h |  7 +
 sound/soc/qcom/lpass-platform.c  | 20 +++--
 sound/soc/qcom/lpass.h   |  1 +
 4 files changed, 57 insertions(+), 33 deletions(-)

diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
index d33eae6..af684fd 100644
--- a/sound/soc/qcom/lpass-cpu.c
+++ b/sound/soc/qcom/lpass-cpu.c
@@ -263,28 +263,6 @@ static int lpass_cpu_daiops_hw_params(struct 
snd_pcm_substream *substream,
return 0;
 }
 
-static int lpass_cpu_daiops_prepare(struct snd_pcm_substream *substream,
-   struct snd_soc_dai *dai)
-{
-   struct lpass_data *drvdata = snd_soc_dai_get_drvdata(dai);
-   struct lpaif_i2sctl *i2sctl = drvdata->i2sctl;
-   unsigned int id = dai->driver->id;
-   int ret;
-
-   if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
-   ret = regmap_fields_write(i2sctl->spken, id,
-LPAIF_I2SCTL_SPKEN_ENABLE);
-   } else {
-   ret = regmap_fields_write(i2sctl->micen, id,
-LPAIF_I2SCTL_MICEN_ENABLE);
-   }
-
-   if (ret)
-   dev_err(dai->dev, "error writing to i2sctl enable: %d\n", ret);
-
-   return ret;
-}
-
 static int lpass_cpu_daiops_trigger(struct snd_pcm_substream *substream,
int cmd, struct snd_soc_dai *dai)
 {
@@ -292,6 +270,18 @@ static int lpass_cpu_daiops_trigger(struct 
snd_pcm_substream *substream,
struct lpaif_i2sctl *i2sctl = drvdata->i2sctl;
unsigned int id = dai->driver->id;
int ret = -EINVAL;
+   unsigned int val = 0;
+
+   ret = regmap_read(drvdata->lpaif_map,
+   LPAIF_I2SCTL_REG(drvdata->variant, 
dai->driver->id), &val);
+   if (ret) {
+   dev_err(dai->dev, "error reading from i2sctl reg: %d\n", ret);
+   return ret;
+   }
+   if (val == LPAIF_I2SCTL_RESET_STATE) {
+   dev_err(dai->dev, "error in i2sctl register state\n");
+   return -ENOTRECOVERABLE;
+   }
 
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
@@ -308,11 +298,14 @@ static int lpass_cpu_daiops_trigger(struct 
snd_pcm_substream *substream,
dev_err(dai->dev, "error writing to i2sctl reg: %d\n",
ret);
 
-   ret = clk_enable(drvdata->mi2s_bit_clk[id]);
-   if (ret) {
-   dev_err(dai->dev, "error in enabling mi2s bit clk: 
%d\n", ret);
-   clk_disable(drvdata->mi2s_osr_clk[id]);
-   return ret;
+   if (drvdata->bit_clk_state[id] == LPAIF_BIT_CLK_DISABLE) {
+   ret = clk_enable(drvdata->mi2s_bit_clk[id]);
+   if (ret) {
+   dev_err(dai->dev, "error in enabling mi2s bit 
clk: %d\n", ret);
+   clk_disable(drvdata->mi2s_osr_clk[id]);
+   return ret;
+   }
+   drvdata->bit_clk_state[id] = LPAIF_BIT_CLK_ENABLE;
}
 
break;
@@ -329,7 +322,10 @@ static int lpass_cpu_daiops_trigger(struct 
snd_pcm_substream *substream,
if (ret)
dev_err(dai->dev, "error writing to i2sctl reg: %d\n",
ret);
-   clk_disable(drvdata->mi2s_bit_clk[dai->driver->id]);
+   if (drvdata->bit_clk_state[id] == LPAIF_BIT_CLK_ENABLE) {
+   clk_disable(drvdata->mi2s_bit_clk[dai->driver->id]);
+   drvdata->bit_clk_state[id] = LPAIF_BIT_CLK_DISABLE;
+   }
break;
}
 
@@ -341,7 +337,6 @@ const struct snd_soc_dai_ops asoc_qcom_lpass_cpu_dai_ops = {
.startup= lpass_cpu_daiops_startup,
.shutdown   = lpass_cpu_daiops_shutdown,
.hw_params  = lpass_cpu_daiops_hw_params,
-   .prepare= lpass_cpu_daiops_prepare,
.trigger= lpass_cpu_daiops_trigger,
 };
 EXPORT_SYMBOL_GPL(asoc_qcom_lpass_cpu_dai_ops);
@@ -459,16 +454,20 @@ static bool lpass_cpu_regm

[PATCH] Asoc: qcom: dts: Change MI2S GPIO configuration to pulldown

2020-11-16 Thread Srinivasa Rao Mandadapu
From: V Sujith Kumar Reddy 

Change LPASS MI2S gpio configuration to pull down from pull up.

Fixes: 9b72f4e6a3f8 (arm64: dts: qcom: sc7180: Add lpass cpu node for I2S 
driver)

Signed-off-by: V Sujith Kumar Reddy 
Signed-off-by: Srinivasa Rao Mandadapu 
---
 arch/arm64/boot/dts/qcom/sc7180.dtsi | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/sc7180.dtsi 
b/arch/arm64/boot/dts/qcom/sc7180.dtsi
index 802ea0a..b0419e0 100644
--- a/arch/arm64/boot/dts/qcom/sc7180.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180.dtsi
@@ -1751,8 +1751,8 @@
 
pinconf {
pins = "gpio49", "gpio50", "gpio51";
-   drive-strength = <8>;
-   bias-pull-up;
+   drive-strength = <2>;
+   bias-pull-down;
};
};
 
@@ -1764,8 +1764,8 @@
 
pinconf {
pins = "gpio53", "gpio54", "gpio55", 
"gpio56";
-   drive-strength = <8>;
-   bias-pull-up;
+   drive-strength = <2>;
+   bias-pull-down;
};
};
 
@@ -1777,8 +1777,8 @@
 
pinconf {
pins = "gpio57";
-   drive-strength = <8>;
-   bias-pull-up;
+   drive-strength = <2>;
+   bias-pull-down;
};
};
 
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH] Asoc: qcom: lpass-sc7180: Add 32 bit format support for capture

2020-11-15 Thread Srinivasa Rao Mandadapu
From: V Sujith Kumar Reddy 

Add 32 bit format support for capture in lpass-sc7180
snd_soc_dai_driver capabilities. Need to add contstraints
in machine driver so that only specific format allowed.

Signed-off-by: V Sujith Kumar Reddy 
Signed-off-by: Srinivasa Rao Manidadapu 
---
 sound/soc/qcom/lpass-sc7180.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/soc/qcom/lpass-sc7180.c b/sound/soc/qcom/lpass-sc7180.c
index 61b51b5..3dc80fc 100644
--- a/sound/soc/qcom/lpass-sc7180.c
+++ b/sound/soc/qcom/lpass-sc7180.c
@@ -34,7 +34,8 @@ static struct snd_soc_dai_driver 
sc7180_lpass_cpu_dai_driver[] = {
},
.capture = {
.stream_name = "Primary Capture",
-   .formats = SNDRV_PCM_FMTBIT_S16,
+   .formats = SNDRV_PCM_FMTBIT_S16 |
+   SNDRV_PCM_FMTBIT_S32,
.rates = SNDRV_PCM_RATE_48000,
.rate_min   = 48000,
.rate_max   = 48000,
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH] Asoc: qcom: lpass-platform: Fix memory leak

2020-11-14 Thread Srinivasa Rao Mandadapu
lpass_pcm_data is not freed in error paths. Free it in
error paths to avoid memory leak.

Fixes: 022d00ee0b55 ("ASoC: lpass-platform: Fix broken pcm data usage")

Signed-off-by: Pavel Machek 
Signed-off-by: V Sujith Kumar Reddy 
Signed-off-by: Srinivasa Rao Mandadapu 
---
 sound/soc/qcom/lpass-platform.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c
index 36d1512..7a3fdf8 100644
--- a/sound/soc/qcom/lpass-platform.c
+++ b/sound/soc/qcom/lpass-platform.c
@@ -122,8 +122,10 @@ static int lpass_platform_pcmops_open(struct 
snd_soc_component *component,
else
dma_ch = 0;
 
-   if (dma_ch < 0)
+   if (dma_ch < 0) {
+   kfree(data);
return dma_ch;
+   }
 
if (cpu_dai->driver->id == LPASS_DP_RX) {
map = drvdata->hdmiif_map;
@@ -147,6 +149,7 @@ static int lpass_platform_pcmops_open(struct 
snd_soc_component *component,
ret = snd_pcm_hw_constraint_integer(runtime,
SNDRV_PCM_HW_PARAM_PERIODS);
if (ret < 0) {
+   kfree(data);
dev_err(soc_runtime->dev, "setting constraints failed: %d\n",
ret);
return -EINVAL;
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH] Asoc: qcom: sc7180: Register shutdown handler for lpass platform

2020-11-13 Thread Srinivasa Rao Mandadapu
From: V Sujith Kumar Reddy 

Register shutdown handler to stop sc7180 lpass platform driver
and to disable audio clocks.

Signed-off-by: V Sujith Kumar Reddy 
Signed-off-by: Srinivasa Rao Mandadapu 
---
 sound/soc/qcom/lpass-cpu.c| 10 ++
 sound/soc/qcom/lpass-sc7180.c |  1 +
 sound/soc/qcom/lpass.h|  1 +
 3 files changed, 12 insertions(+)

diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
index 1fd862e..d33eae6 100644
--- a/sound/soc/qcom/lpass-cpu.c
+++ b/sound/soc/qcom/lpass-cpu.c
@@ -914,5 +914,15 @@ int asoc_qcom_lpass_cpu_platform_remove(struct 
platform_device *pdev)
 }
 EXPORT_SYMBOL_GPL(asoc_qcom_lpass_cpu_platform_remove);
 
+void asoc_qcom_lpass_cpu_platform_shutdown(struct platform_device *pdev)
+{
+   struct lpass_data *drvdata = platform_get_drvdata(pdev);
+
+   if (drvdata->variant->exit)
+   drvdata->variant->exit(pdev);
+
+}
+EXPORT_SYMBOL_GPL(asoc_qcom_lpass_cpu_platform_shutdown);
+
 MODULE_DESCRIPTION("QTi LPASS CPU Driver");
 MODULE_LICENSE("GPL v2");
diff --git a/sound/soc/qcom/lpass-sc7180.c b/sound/soc/qcom/lpass-sc7180.c
index f619590..61b51b5 100644
--- a/sound/soc/qcom/lpass-sc7180.c
+++ b/sound/soc/qcom/lpass-sc7180.c
@@ -297,6 +297,7 @@ static struct platform_driver 
sc7180_lpass_cpu_platform_driver = {
},
.probe = asoc_qcom_lpass_cpu_platform_probe,
.remove = asoc_qcom_lpass_cpu_platform_remove,
+   .shutdown = asoc_qcom_lpass_cpu_platform_shutdown,
 };
 
 module_platform_driver(sc7180_lpass_cpu_platform_driver);
diff --git a/sound/soc/qcom/lpass.h b/sound/soc/qcom/lpass.h
index b4830f3..32a68c4 100644
--- a/sound/soc/qcom/lpass.h
+++ b/sound/soc/qcom/lpass.h
@@ -255,6 +255,7 @@ struct lpass_variant {
 /* register the platform driver from the CPU DAI driver */
 int asoc_qcom_lpass_platform_register(struct platform_device *);
 int asoc_qcom_lpass_cpu_platform_remove(struct platform_device *pdev);
+void asoc_qcom_lpass_cpu_platform_shutdown(struct platform_device *pdev);
 int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev);
 int asoc_qcom_lpass_cpu_dai_probe(struct snd_soc_dai *dai);
 extern const struct snd_soc_dai_ops asoc_qcom_lpass_cpu_dai_ops;
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH] Asoc: qcom: dts: Update iommu property for simultaneous playback

2020-11-13 Thread Srinivasa Rao Mandadapu
From: V Sujith Kumar Reddy 

Update iommu property in lpass cpu node for supporting
simultaneous playback on headset and speaker.

Signed-off-by: V Sujith Kumar Reddy 
Signed-off-by: Srinivasa Rao Mandadapu 
---
 arch/arm64/boot/dts/qcom/sc7180.dtsi | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/qcom/sc7180.dtsi 
b/arch/arm64/boot/dts/qcom/sc7180.dtsi
index 84e0315..af09e80 100644
--- a/arch/arm64/boot/dts/qcom/sc7180.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180.dtsi
@@ -3473,7 +3473,9 @@
reg = <0 0x62d87000 0 0x68000>, <0 0x62f0 0 
0x29000>;
reg-names =  "lpass-hdmiif", "lpass-lpaif";
 
-   iommus = <&apps_smmu 0x1020 0>, <&apps_smmu 0x1032 0>;
+   iommus = <&apps_smmu 0x1020 0>,
+   <&apps_smmu 0x1021 0>,
+   <&apps_smmu 0x1032 0>;
 
power-domains = <&lpass_hm LPASS_CORE_HM_GDSCR>;
 
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH v2] Asoc: qcom: lpass-sc7180: Fix MI2S bitwidth field bit positions

2020-10-27 Thread Srinivasa Rao Mandadapu
From: V Sujith Kumar Reddy 

Update SC7180 lpass_variant structure with proper I2S bitwidth
field bit positions, as bitwidth denotes 0 to 1 bits,
but previously used only 0 bit.

Fixes: cba62c8b49be ("ASoC: qcom: Add support for SC7180 lpass variant")
Signed-off-by: V Sujith Kumar Reddy 
Signed-off-by: Srinivasa Rao Mandadapu 
---
Changes Since v1:
-- Commit message is changed

 sound/soc/qcom/lpass-sc7180.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/qcom/lpass-sc7180.c b/sound/soc/qcom/lpass-sc7180.c
index c6292f9e..bc998d5 100644
--- a/sound/soc/qcom/lpass-sc7180.c
+++ b/sound/soc/qcom/lpass-sc7180.c
@@ -188,7 +188,7 @@ static struct lpass_variant sc7180_data = {
.micmode= REG_FIELD_ID(0x1000, 4, 8, 3, 0x1000),
.micmono= REG_FIELD_ID(0x1000, 3, 3, 3, 0x1000),
.wssrc  = REG_FIELD_ID(0x1000, 2, 2, 3, 0x1000),
-   .bitwidth   = REG_FIELD_ID(0x1000, 0, 0, 3, 0x1000),
+   .bitwidth   = REG_FIELD_ID(0x1000, 0, 1, 3, 0x1000),
 
.rdma_dyncclk   = REG_FIELD_ID(0xC000, 21, 21, 5, 0x1000),
.rdma_bursten   = REG_FIELD_ID(0xC000, 20, 20, 5, 0x1000),
-- 
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] Asoc: qcom: lpass-sc7180: Fix MI2S bitwidth field bit positions

2020-10-26 Thread Srinivasa Rao Mandadapu

Thanks for your time srinivas!!!

On 10/26/2020 8:31 PM, Srinivas Kandagatla wrote:



On 22/10/2020 14:26, Srinivasa Rao Mandadapu wrote:

From: V Sujith Kumar Reddy 

Update SC7180 lpass_variant structure with proper I2S bitwidth
field bit positions, as bitwidth denotes 0 to 1 bits,
but previously used only 0 bit.

Fixes: commit cba62c8b49bead ("Merge series "ASoC: qcom: Add support 
for SC7180 lpass variant" from Rohit kumar :")

this should be 12 chars long, for this particular fix it should be!

Fixes: 24caf8d9eb108 ("ASoC: qcom: lpass-sc7180: Add platform driver 
for lpass audio")




No empty line after Fixes tag!

Will coorect it in next patch.



Signed-off-by: V Sujith Kumar Reddy 
Signed-off-by: Srinivasa Rao Mandadapu 
---
  sound/soc/qcom/lpass-sc7180.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/qcom/lpass-sc7180.c 
b/sound/soc/qcom/lpass-sc7180.c

index c6292f9e..bc998d5 100644
--- a/sound/soc/qcom/lpass-sc7180.c
+++ b/sound/soc/qcom/lpass-sc7180.c
@@ -188,7 +188,7 @@ static struct lpass_variant sc7180_data = {
  .micmode    = REG_FIELD_ID(0x1000, 4, 8, 3, 0x1000),
  .micmono    = REG_FIELD_ID(0x1000, 3, 3, 3, 0x1000),
  .wssrc    = REG_FIELD_ID(0x1000, 2, 2, 3, 0x1000),
-    .bitwidth    = REG_FIELD_ID(0x1000, 0, 0, 3, 0x1000),
+    .bitwidth    = REG_FIELD_ID(0x1000, 0, 1, 3, 0x1000),
    .rdma_dyncclk    = REG_FIELD_ID(0xC000, 21, 21, 5, 0x1000),
  .rdma_bursten    = REG_FIELD_ID(0xC000, 20, 20, 5, 0x1000),


--srini


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



[PATCH] Asoc: qcom: lpass-sc7180: Fix MI2S bitwidth field bit positions

2020-10-22 Thread Srinivasa Rao Mandadapu
From: V Sujith Kumar Reddy 

Update SC7180 lpass_variant structure with proper I2S bitwidth
field bit positions, as bitwidth denotes 0 to 1 bits,
but previously used only 0 bit.

Fixes: commit cba62c8b49bead ("Merge series "ASoC: qcom: Add support for SC7180 
lpass variant" from Rohit kumar :")

Signed-off-by: V Sujith Kumar Reddy 
Signed-off-by: Srinivasa Rao Mandadapu 
---
 sound/soc/qcom/lpass-sc7180.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/qcom/lpass-sc7180.c b/sound/soc/qcom/lpass-sc7180.c
index c6292f9e..bc998d5 100644
--- a/sound/soc/qcom/lpass-sc7180.c
+++ b/sound/soc/qcom/lpass-sc7180.c
@@ -188,7 +188,7 @@ static struct lpass_variant sc7180_data = {
.micmode= REG_FIELD_ID(0x1000, 4, 8, 3, 0x1000),
.micmono= REG_FIELD_ID(0x1000, 3, 3, 3, 0x1000),
.wssrc  = REG_FIELD_ID(0x1000, 2, 2, 3, 0x1000),
-   .bitwidth   = REG_FIELD_ID(0x1000, 0, 0, 3, 0x1000),
+   .bitwidth   = REG_FIELD_ID(0x1000, 0, 1, 3, 0x1000),
 
.rdma_dyncclk   = REG_FIELD_ID(0xC000, 21, 21, 5, 0x1000),
.rdma_bursten   = REG_FIELD_ID(0xC000, 20, 20, 5, 0x1000),
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH v2] Asoc: qcom: lpass-cpu: Fix clock disable failure

2020-10-19 Thread Srinivasa Rao Mandadapu
From: V Sujith Kumar Reddy 

Disable MI2S bit clock from PAUSE/STOP/SUSPEND usecase instead of
shutdown time. Acheive this by invoking clk_disable API from
cpu daiops trigger instead of cpu daiops shutdown.
Change non-atomic API "clk_prepare_enable" to atomic API
"clk_enable" in trigger, as trigger is being called from atomic context.

Fixes: commit 7e6799d8f87d ("ASoC: qcom: lpass-cpu: Enable MI2S BCLK and LRCLK 
together")

Signed-off-by: V Sujith Kumar Reddy 
Signed-off-by: Srinivasa Rao Mandadapu 
---
 sound/soc/qcom/lpass-cpu.c | 14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
index 78de888..6001049 100644
--- a/sound/soc/qcom/lpass-cpu.c
+++ b/sound/soc/qcom/lpass-cpu.c
@@ -80,6 +80,12 @@ static int lpass_cpu_daiops_startup(struct snd_pcm_substream 
*substream,
dev_err(dai->dev, "error in enabling mi2s osr clk: %d\n", ret);
return ret;
}
+   ret = clk_prepare(drvdata->mi2s_bit_clk[dai->driver->id]);
+   if (ret) {
+   dev_err(dai->dev, "error in enabling mi2s bit clk: %d\n", ret);
+   clk_disable_unprepare(drvdata->mi2s_osr_clk[dai->driver->id]);
+   return ret;
+   }
return 0;
 }
 
@@ -88,9 +94,8 @@ static void lpass_cpu_daiops_shutdown(struct 
snd_pcm_substream *substream,
 {
struct lpass_data *drvdata = snd_soc_dai_get_drvdata(dai);
 
-   clk_disable_unprepare(drvdata->mi2s_bit_clk[dai->driver->id]);
-
clk_disable_unprepare(drvdata->mi2s_osr_clk[dai->driver->id]);
+   clk_unprepare(drvdata->mi2s_bit_clk[dai->driver->id]);
 }
 
 static int lpass_cpu_daiops_hw_params(struct snd_pcm_substream *substream,
@@ -303,10 +308,10 @@ static int lpass_cpu_daiops_trigger(struct 
snd_pcm_substream *substream,
dev_err(dai->dev, "error writing to i2sctl reg: %d\n",
ret);
 
-   ret = clk_prepare_enable(drvdata->mi2s_bit_clk[id]);
+   ret = clk_enable(drvdata->mi2s_bit_clk[id]);
if (ret) {
dev_err(dai->dev, "error in enabling mi2s bit clk: 
%d\n", ret);
-   clk_disable_unprepare(drvdata->mi2s_osr_clk[id]);
+   clk_disable(drvdata->mi2s_osr_clk[id]);
return ret;
}
 
@@ -324,6 +329,7 @@ static int lpass_cpu_daiops_trigger(struct 
snd_pcm_substream *substream,
if (ret)
dev_err(dai->dev, "error writing to i2sctl reg: %d\n",
ret);
+   clk_disable(drvdata->mi2s_bit_clk[dai->driver->id]);
break;
}
 
-- 
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/2] Asoc: qcom: lpass-cpu: Fix clock disable failure

2020-10-13 Thread Srinivasa Rao Mandadapu

Thanks  Mark Brown for your time !!!

On 10/13/2020 8:45 PM, Mark Brown wrote:

On Tue, Oct 13, 2020 at 07:09:46PM +0530, Srinivasa Rao Mandadapu wrote:

From: V Sujith Kumar Reddy 

Disable MI2S bit clock from PAUSE/STOP/SUSPEND usecase
instead of shutdown time. Acheive this by invoking
clk_disable_unprepare API from cpu daiops shutdown to
cpu daiops trigger.

I'm missing patch 2 here?

No.. It's a single patch. By mistake I sent with wrong header.



This Fix is update to the below patch.
https://lore.kernel.org/patchwork/patch/1308101/

Fixes should be specified using tags like this:

   Fixes: commit 30fb9454ab23 ("selftests/vm: hmm-tests: remove the libhugetlbfs 
dependency")

in the changelog.

Thanks for your guidance. I will take care of it next time.


Please submit patches using subject lines reflecting the style for the
subsystem, this makes it easier for people to identify relevant patches.
Look at what existing commits in the area you're changing are doing and
make sure your subject lines visually resemble what they're doing.
There's no need to resubmit to fix this alone.


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



[PATCH] Asoc: qcom: lpass-cpu: Fix dp audio failure on monitors

2020-10-13 Thread Srinivasa Rao Mandadapu
From: V Sujith Kumar Reddy 

Make LPASS_HDMI_TX_PARITY_ADDR reg as volatile to fix
dp audio failure with external monitors.
This patch is upgrade to below patch series.
https://lore.kernel.org/patchwork/project/lkml/list/?series=466460

Signed-off-by: V Sujith Kumar Reddy 
Signed-off-by: Srinivasa Rao Mandadapu 
---
 sound/soc/qcom/lpass-cpu.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
index ba2aca3..78de888 100644
--- a/sound/soc/qcom/lpass-cpu.c
+++ b/sound/soc/qcom/lpass-cpu.c
@@ -660,6 +660,8 @@ static bool lpass_hdmi_regmap_volatile(struct device *dev, 
unsigned int reg)
return true;
if (reg == LPASS_HDMI_TX_LEGACY_ADDR(v))
return true;
+   if (reg == LPASS_HDMI_TX_PARITY_ADDR(v))
+   return true;
 
for (i = 0; i < v->rdma_channels; ++i) {
if (reg == LPAIF_HDMI_RDMACURR_REG(v, i))
-- 
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/2] Asoc: qcom: lpass-cpu: Fix clock disable failure

2020-10-13 Thread Srinivasa Rao Mandadapu
From: V Sujith Kumar Reddy 

Disable MI2S bit clock from PAUSE/STOP/SUSPEND usecase
instead of shutdown time. Acheive this by invoking
clk_disable_unprepare API from cpu daiops shutdown to
cpu daiops trigger.
This Fix is update to the below patch.
https://lore.kernel.org/patchwork/patch/1308101/

Signed-off-by: V Sujith Kumar Reddy 
Signed-off-by: Srinivasa Rao Mandadapu 
---
 sound/soc/qcom/lpass-cpu.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
index ba2aca3..2dfb921 100644
--- a/sound/soc/qcom/lpass-cpu.c
+++ b/sound/soc/qcom/lpass-cpu.c
@@ -88,8 +88,6 @@ static void lpass_cpu_daiops_shutdown(struct 
snd_pcm_substream *substream,
 {
struct lpass_data *drvdata = snd_soc_dai_get_drvdata(dai);
 
-   clk_disable_unprepare(drvdata->mi2s_bit_clk[dai->driver->id]);
-
clk_disable_unprepare(drvdata->mi2s_osr_clk[dai->driver->id]);
 }
 
@@ -324,6 +322,7 @@ static int lpass_cpu_daiops_trigger(struct 
snd_pcm_substream *substream,
if (ret)
dev_err(dai->dev, "error writing to i2sctl reg: %d\n",
ret);
+   clk_disable_unprepare(drvdata->mi2s_bit_clk[dai->driver->id]);
break;
}
 
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH v11 6/7] Asoc: qcom: lpass-platform : Increase buffer size

2020-10-07 Thread Srinivasa Rao Mandadapu
From: V Sujith Kumar Reddy 

Increase buffer size to support audio over DP.

Signed-off-by: V Sujith Kumar Reddy 
Signed-off-by: Srinivasa Rao Mandadapu 
---
 sound/soc/qcom/lpass-platform.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c
index 49abbb2..36d1512 100644
--- a/sound/soc/qcom/lpass-platform.c
+++ b/sound/soc/qcom/lpass-platform.c
@@ -23,7 +23,7 @@ struct lpass_pcm_data {
int i2s_port;
 };
 
-#define LPASS_PLATFORM_BUFFER_SIZE (16 * 1024)
+#define LPASS_PLATFORM_BUFFER_SIZE (24 *  2 * 1024)
 #define LPASS_PLATFORM_PERIODS 2
 
 static const struct snd_pcm_hardware lpass_platform_pcm_hardware = {
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH v11 5/7] ASoC: qcom: Add support for lpass hdmi driver

2020-10-07 Thread Srinivasa Rao Mandadapu
From: V Sujith Kumar Reddy 

Upadate lpass cpu and platform driver to support audio over dp.
Also add lpass-hdmi.c and lpass-hdmi.h.

Signed-off-by: V Sujith Kumar Reddy 
Signed-off-by: Srinivasa Rao 
---
 sound/soc/qcom/Kconfig   |   5 +
 sound/soc/qcom/Makefile  |   2 +
 sound/soc/qcom/lpass-apq8016.c   |   4 +-
 sound/soc/qcom/lpass-cpu.c   | 247 -
 sound/soc/qcom/lpass-hdmi.c  | 258 ++
 sound/soc/qcom/lpass-hdmi.h  | 102 +++
 sound/soc/qcom/lpass-ipq806x.c   |   4 +-
 sound/soc/qcom/lpass-lpaif-reg.h |  49 +++--
 sound/soc/qcom/lpass-platform.c  | 383 ---
 sound/soc/qcom/lpass.h   | 118 +++-
 10 files changed, 1075 insertions(+), 97 deletions(-)
 create mode 100644 sound/soc/qcom/lpass-hdmi.c
 create mode 100644 sound/soc/qcom/lpass-hdmi.h

diff --git a/sound/soc/qcom/Kconfig b/sound/soc/qcom/Kconfig
index a7ef626..28e775f 100644
--- a/sound/soc/qcom/Kconfig
+++ b/sound/soc/qcom/Kconfig
@@ -12,6 +12,10 @@ config SND_SOC_LPASS_CPU
tristate
select REGMAP_MMIO
 
+config SND_SOC_LPASS_HDMI
+   tristate
+   select REGMAP_MMIO
+
 config SND_SOC_LPASS_PLATFORM
tristate
select REGMAP_MMIO
@@ -30,6 +34,7 @@ config SND_SOC_LPASS_SC7180
tristate
select SND_SOC_LPASS_CPU
select SND_SOC_LPASS_PLATFORM
+   select SND_SOC_LPASS_HDMI
 
 config SND_SOC_STORM
tristate "ASoC I2S support for Storm boards"
diff --git a/sound/soc/qcom/Makefile b/sound/soc/qcom/Makefile
index 7972c94..0bd90d7 100644
--- a/sound/soc/qcom/Makefile
+++ b/sound/soc/qcom/Makefile
@@ -1,12 +1,14 @@
 # SPDX-License-Identifier: GPL-2.0
 # Platform
 snd-soc-lpass-cpu-objs := lpass-cpu.o
+snd-soc-lpass-hdmi-objs := lpass-hdmi.o
 snd-soc-lpass-platform-objs := lpass-platform.o
 snd-soc-lpass-ipq806x-objs := lpass-ipq806x.o
 snd-soc-lpass-apq8016-objs := lpass-apq8016.o
 snd-soc-lpass-sc7180-objs := lpass-sc7180.o
 
 obj-$(CONFIG_SND_SOC_LPASS_CPU) += snd-soc-lpass-cpu.o
+obj-$(CONFIG_SND_SOC_LPASS_HDMI) += snd-soc-lpass-hdmi.o
 obj-$(CONFIG_SND_SOC_LPASS_PLATFORM) += snd-soc-lpass-platform.o
 obj-$(CONFIG_SND_SOC_LPASS_IPQ806X) += snd-soc-lpass-ipq806x.o
 obj-$(CONFIG_SND_SOC_LPASS_APQ8016) += snd-soc-lpass-apq8016.o
diff --git a/sound/soc/qcom/lpass-apq8016.c b/sound/soc/qcom/lpass-apq8016.c
index 5c8ae22..0aedb3a 100644
--- a/sound/soc/qcom/lpass-apq8016.c
+++ b/sound/soc/qcom/lpass-apq8016.c
@@ -125,7 +125,7 @@ static struct snd_soc_dai_driver 
apq8016_lpass_cpu_dai_driver[] = {
 };
 
 static int apq8016_lpass_alloc_dma_channel(struct lpass_data *drvdata,
-  int direction)
+  int direction, unsigned int dai_id)
 {
struct lpass_variant *v = drvdata->variant;
int chan = 0;
@@ -151,7 +151,7 @@ static int apq8016_lpass_alloc_dma_channel(struct 
lpass_data *drvdata,
return chan;
 }
 
-static int apq8016_lpass_free_dma_channel(struct lpass_data *drvdata, int chan)
+static int apq8016_lpass_free_dma_channel(struct lpass_data *drvdata, int 
chan, unsigned int dai_id)
 {
clear_bit(chan, &drvdata->dma_ch_bit_map);
 
diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
index 12950d2..ba2aca3 100644
--- a/sound/soc/qcom/lpass-cpu.c
+++ b/sound/soc/qcom/lpass-cpu.c
@@ -478,6 +478,206 @@ static struct regmap_config lpass_cpu_regmap_config = {
.cache_type = REGCACHE_FLAT,
 };
 
+static int lpass_hdmi_init_bitfields(struct device *dev, struct regmap *map)
+{
+   struct lpass_data *drvdata = dev_get_drvdata(dev);
+   struct lpass_variant *v = drvdata->variant;
+   unsigned int i;
+   struct lpass_hdmi_tx_ctl *tx_ctl;
+   struct regmap_field *legacy_en;
+   struct lpass_vbit_ctrl *vbit_ctl;
+   struct regmap_field *tx_parity;
+   struct lpass_dp_metadata_ctl *meta_ctl;
+   struct lpass_sstream_ctl *sstream_ctl;
+   struct regmap_field *ch_msb;
+   struct regmap_field *ch_lsb;
+   struct lpass_hdmitx_dmactl *tx_dmactl;
+   int rval;
+
+   tx_ctl = devm_kzalloc(dev, sizeof(*tx_ctl), GFP_KERNEL);
+   if (!tx_ctl)
+   return -ENOMEM;
+
+   QCOM_REGMAP_FIELD_ALLOC(dev, map, v->soft_reset, tx_ctl->soft_reset);
+   QCOM_REGMAP_FIELD_ALLOC(dev, map, v->force_reset, tx_ctl->force_reset);
+   drvdata->tx_ctl = tx_ctl;
+
+   QCOM_REGMAP_FIELD_ALLOC(dev, map, v->legacy_en, legacy_en);
+   drvdata->hdmitx_legacy_en = legacy_en;
+
+   vbit_ctl = devm_kzalloc(dev, sizeof(*vbit_ctl), GFP_KERNEL);
+   if (!vbit_ctl)
+   return -ENOMEM;
+
+   QCOM_REGMAP_FIELD_ALLOC(dev, map, v->replace_vbit, 
vbit_ctl->replace_vbit);
+   QCOM_REGMAP_FIELD_ALLOC(dev, map, v->vbit_stream, 
vbit_ctl->vbit_stream);
+   drvdata->vbit_ctl = vbit_ctl;
+
+
+   QCOM_REGMAP_FIELD_ALLOC(dev, map, v->calc_en, tx_parity);
+   drvdata->hdmitx_

[PATCH v11 1/7] ASoC: Add sc7180-lpass binding header hdmi define

2020-10-07 Thread Srinivasa Rao Mandadapu
From: V Sujith Kumar Reddy 

Add header defining hdmi dai-id for SC7180 lpass soc
in dt bindings.

Signed-off-by: V Sujith Kumar Reddy 
Acked-by: Rob Herring 
Signed-off-by: Srinivasa Rao 
---
 include/dt-bindings/sound/sc7180-lpass.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/dt-bindings/sound/sc7180-lpass.h 
b/include/dt-bindings/sound/sc7180-lpass.h
index 7d988f6..56ecaaf 100644
--- a/include/dt-bindings/sound/sc7180-lpass.h
+++ b/include/dt-bindings/sound/sc7180-lpass.h
@@ -4,6 +4,7 @@
 
 #define MI2S_PRIMARY   0
 #define MI2S_SECONDARY 1
+#define LPASS_DP_RX2
 
 #define LPASS_MCLK00
 
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH v11 0/7] Qualcomm's lpass-hdmi ASoC driver to support audio over dp port

2020-10-07 Thread Srinivasa Rao Mandadapu
These patches are to support audio over DP port on Qualcomm's SC7180 LPASS
Asoc. It includes machine driver, cpu driver, platform driver updates for 
HDMI path support, device tree documention, lpass variant structure 
optimization and configuration changes.
These patches depends on the DP patch series
https://patchwork.kernel.org/project/dri-devel/list/?series=332029
https://lore.kernel.org/patchwork/project/lkml/list/?series=464856

changes since V10:
-- Moved hdmi regmap functions from lpass-hdmi.c to lpass-cpu.c
-- Moved QCOM_REGMAP_FIELD_ALLOC macro from lpass-hdmi.c to lpass.h
changes since V9:
-- Removed unused structures lpass_hdmi.h
changes since V8:
-- Removed redundant structure wrapper for reg map field memebrs
-- Updated lpass_hdmi_regmap_volatile API with appropriate registers as true
   and others as false.
changes since V7:
-- Fixed typo errors
-- Created Separate patch for buffer size change 
changes since V6:
-- Removed compile time define flag, which used for enabling
 HDMI code, based on corresponding config param is included.
-- Updated reg map alloc API with reg map bulk API.
-- Removed unnecessary line splits
changes since V5:
-- Removed unused struct regmap *map in 
lpass_platform_alloc_hdmidmactl_fields.
-- DMA alloc and free API signature change in lpass-apq8016.c, 
lpass-ipq806x.c 
-- Keeping API "irqreturn_t lpass_platform_hdmiif_irq" under ifdef macro
Changes Since v4:
-- Updated with single compatible node for both I2S and HDMI.
Changes Since v3:
-- Removed id in lpass variant structure and used snd_soc_dai_driver id.
Changes Since v2:
-- Audio buffer size(i.e. LPASS_PLATFORM_BUFFER_SIZE) in lpass-platform.c 
increased.
Changes Since v1:
-- Commit messages are updated
-- Addressed Rob Herring review comments

V Sujith Kumar Reddy (7):
  ASoC: Add sc7180-lpass binding header hdmi define
  ASoC: dt-bindings: Add dt binding for lpass hdmi
  Asoc:qcom:lpass-cpu:Update dts property read API
  Asoc: qcom: lpass:Update lpaif_dmactl members order
  ASoC: qcom: Add support for lpass hdmi driver
  Asoc: qcom: lpass-platform : Increase buffer size
  ASoC: qcom: sc7180: Add support for audio over DP

 .../devicetree/bindings/sound/qcom,lpass-cpu.yaml  |  74 ++--
 include/dt-bindings/sound/sc7180-lpass.h   |   1 +
 sound/soc/qcom/Kconfig |   5 +
 sound/soc/qcom/Makefile|   2 +
 sound/soc/qcom/lpass-apq8016.c |   4 +-
 sound/soc/qcom/lpass-cpu.c | 249 -
 sound/soc/qcom/lpass-hdmi.c| 258 ++
 sound/soc/qcom/lpass-hdmi.h| 102 ++
 sound/soc/qcom/lpass-ipq806x.c |   4 +-
 sound/soc/qcom/lpass-lpaif-reg.h   |  49 ++-
 sound/soc/qcom/lpass-platform.c| 395 +
 sound/soc/qcom/lpass-sc7180.c  | 116 +-
 sound/soc/qcom/lpass.h | 124 ++-
 13 files changed, 1240 insertions(+), 143 deletions(-)
 create mode 100644 sound/soc/qcom/lpass-hdmi.c
 create mode 100644 sound/soc/qcom/lpass-hdmi.h

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



[PATCH v11 3/7] Asoc:qcom:lpass-cpu:Update dts property read API

2020-10-07 Thread Srinivasa Rao Mandadapu
From: V Sujith Kumar Reddy 

Update dts property read API call with platform get property
by name, as it make code more readable and avoid conflicts
when array of properties to be used.

Signed-off-by: V Sujith Kumar Reddy 
Reviewed-by: Srinivas Kandagatla 
Signed-off-by: Srinivasa Rao 
---
 sound/soc/qcom/lpass-cpu.c  | 2 +-
 sound/soc/qcom/lpass-platform.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
index 0718a0f..12950d2 100644
--- a/sound/soc/qcom/lpass-cpu.c
+++ b/sound/soc/qcom/lpass-cpu.c
@@ -575,7 +575,7 @@ int asoc_qcom_lpass_cpu_platform_probe(struct 
platform_device *pdev)
 
of_lpass_cpu_parse_dai_data(dev, drvdata);
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+   res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "lpass-lpaif");
 
drvdata->lpaif = devm_ioremap_resource(dev, res);
if (IS_ERR((void const __force *)drvdata->lpaif)) {
diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c
index 7ac2629..e7cf4e5 100644
--- a/sound/soc/qcom/lpass-platform.c
+++ b/sound/soc/qcom/lpass-platform.c
@@ -621,7 +621,7 @@ int asoc_qcom_lpass_platform_register(struct 
platform_device *pdev)
struct lpass_variant *v = drvdata->variant;
int ret;
 
-   drvdata->lpaif_irq = platform_get_irq(pdev, 0);
+   drvdata->lpaif_irq = platform_get_irq_byname(pdev, "lpass-irq-lpaif");
if (drvdata->lpaif_irq < 0)
return -ENODEV;
 
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH v11 4/7] Asoc: qcom: lpass:Update lpaif_dmactl members order

2020-10-07 Thread Srinivasa Rao Mandadapu
From: V Sujith Kumar Reddy 

Update the lpaif_dmactl struct members order to match
HDMI reg map members sequence. Separate Interface reg map
as it is used for I2S control but not for HDMI control,
to make use of bulk API, which makes code more readable.

Signed-off-by: V Sujith Kumar Reddy 
Reviewed-by: Srinivas Kandagatla 
Signed-off-by: Srinivasa Rao 
---
 sound/soc/qcom/lpass-platform.c | 8 
 sound/soc/qcom/lpass.h  | 6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c
index e7cf4e5..db0d959 100644
--- a/sound/soc/qcom/lpass-platform.c
+++ b/sound/soc/qcom/lpass-platform.c
@@ -71,13 +71,13 @@ static int lpass_platform_alloc_dmactl_fields(struct device 
*dev,
rd_dmactl = drvdata->rd_dmactl;
wr_dmactl = drvdata->wr_dmactl;
 
-   rval = devm_regmap_field_bulk_alloc(dev, map, &rd_dmactl->bursten,
-   &v->rdma_bursten, 6);
+   rval = devm_regmap_field_bulk_alloc(dev, map, &rd_dmactl->intf,
+   &v->rdma_intf, 6);
if (rval)
return rval;
 
-   return devm_regmap_field_bulk_alloc(dev, map, &wr_dmactl->bursten,
-   &v->wrdma_bursten, 6);
+   return devm_regmap_field_bulk_alloc(dev, map, &wr_dmactl->intf,
+   &v->wrdma_intf, 6);
 }
 
 static int lpass_platform_pcmops_open(struct snd_soc_component *component,
diff --git a/sound/soc/qcom/lpass.h b/sound/soc/qcom/lpass.h
index 51c9991..7089d4c 100644
--- a/sound/soc/qcom/lpass.h
+++ b/sound/soc/qcom/lpass.h
@@ -31,9 +31,9 @@ struct lpaif_i2sctl {
 
 
 struct lpaif_dmactl {
+   struct regmap_field *intf;
struct regmap_field *bursten;
struct regmap_field *wpscnt;
-   struct regmap_field *intf;
struct regmap_field *fifowm;
struct regmap_field *enable;
struct regmap_field *dyncclk;
@@ -110,17 +110,17 @@ struct lpass_variant {
struct reg_field bitwidth;
 
/* RD_DMA Register fields */
+   struct reg_field rdma_intf;
struct reg_field rdma_bursten;
struct reg_field rdma_wpscnt;
-   struct reg_field rdma_intf;
struct reg_field rdma_fifowm;
struct reg_field rdma_enable;
struct reg_field rdma_dyncclk;
 
/* WR_DMA Register fields */
+   struct reg_field wrdma_intf;
struct reg_field wrdma_bursten;
struct reg_field wrdma_wpscnt;
-   struct reg_field wrdma_intf;
struct reg_field wrdma_fifowm;
struct reg_field wrdma_enable;
struct reg_field wrdma_dyncclk;
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH v11 2/7] ASoC: dt-bindings: Add dt binding for lpass hdmi

2020-10-07 Thread Srinivasa Rao Mandadapu
From: V Sujith Kumar Reddy 

Adds bindings for lpass hdmi interface
which can support audio path over dp.

Signed-off-by: V Sujith Kumar Reddy 
Reviewed-by: Rob Herring 
Signed-off-by: Srinivasa Rao 
---
 .../devicetree/bindings/sound/qcom,lpass-cpu.yaml  | 74 +++---
 1 file changed, 52 insertions(+), 22 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/qcom,lpass-cpu.yaml 
b/Documentation/devicetree/bindings/sound/qcom,lpass-cpu.yaml
index 09c9bd2..f6f9fb4 100644
--- a/Documentation/devicetree/bindings/sound/qcom,lpass-cpu.yaml
+++ b/Documentation/devicetree/bindings/sound/qcom,lpass-cpu.yaml
@@ -24,9 +24,10 @@ properties:
   - qcom,sc7180-lpass-cpu
 
   reg:
-maxItems: 1
+maxItems: 2
 description: LPAIF core registers
-
+  reg-names:
+ maxItems: 2
   clocks:
 minItems: 3
 maxItems: 6
@@ -36,15 +37,16 @@ properties:
 maxItems: 6
 
   interrupts:
-maxItems: 1
+maxItems: 2
 description: LPAIF DMA buffer interrupt
-
+  interrupt-names:
+maxItems: 2
   qcom,adsp:
 $ref: /schemas/types.yaml#/definitions/phandle
 description: Phandle for the audio DSP node
 
   iommus:
-maxItems: 1
+maxItems: 2
 description: Phandle to apps_smmu node with sid mask
 
   power-domains:
@@ -60,10 +62,12 @@ properties:
 const: 0
 
 patternProperties:
-  "(^mi2s-[0-9a-f]$|mi2s)":
+  "^dai-link@[0-9a-f]$":
 type: object
-description: Required properties for each DAI
-
+description: |
+  LPASS CPU dai node for each I2S device. Bindings of each node
+  depends on the specific driver providing the functionality and
+  properties.
 properties:
   reg:
 maxItems: 1
@@ -85,9 +89,11 @@ patternProperties:
 required:
   - compatible
   - reg
+  - reg-names
   - clocks
   - clock-names
   - interrupts
+  - interrupt-names
   - '#sound-dai-cells'
 
 additionalProperties: false
@@ -134,13 +140,32 @@ allOf:
 then:
   properties:
 clock-names:
-  items:
-- const: pcnoc-sway-clk
-- const: audio-core
-- const: mclk0
-- const: pcnoc-mport-clk
-- const: mi2s-bit-clk0
-- const: mi2s-bit-clk1
+  oneOf:
+   - items:   #for I2S
+  - const: pcnoc-sway-clk
+  - const: audio-core
+  - const: mclk0
+  - const: pcnoc-mport-clk
+  - const: mi2s-bit-clk0
+  - const: mi2s-bit-clk1
+   - items:   #for HDMI
+  - const: pcnoc-sway-clk
+  - const: audio-core
+  - const: pcnoc-mport-clk
+reg-names:
+  anyOf:
+- items:   #for I2S
+  - const: lpass-lpaif
+- items:   #for I2S and HDMI
+  - const: lpass-hdmiif
+  - const: lpass-lpaif
+interrupt-names:
+  anyOf:
+- items:   #for I2S
+  - const: lpass-irq-lpaif
+- items:   #for I2S and HDMI
+  - const: lpass-irq-lpaif
+  - const: lpass-irq-hdmi
   required:
 - iommus
 - power-domains
@@ -152,12 +177,15 @@ examples:
 soc {
 #address-cells = <2>;
 #size-cells = <2>;
-lpass@62f0 {
+lpass@62d8 {
 compatible = "qcom,sc7180-lpass-cpu";
 
-reg = <0 0x62f0  0 0x29000>;
-
-iommus = <&apps_smmu 0x1020 0>;
+reg = <0 0x62d87000 0 0x68000>,
+  <0 0x62f0 0 0x29000>;
+reg-names = "lpass-hdmiif",
+"lpass-lpaif";
+iommus = <&apps_smmu 0x1020 0>,
+ <&apps_smmu 0x1032 0>;
 power-domains = <&lpass_hm 0>;
 
 clocks = <&gcc 131>,
@@ -171,14 +199,16 @@ examples:
   "mclk0", "pcnoc-mport-clk",
   "mi2s-bit-clk0", "mi2s-bit-clk1";
 
-interrupts = <0 160 1>;
-
+interrupts = <0 160 1>,
+ <0 268 1>;
+interrupt-names = "lpass-irq-lpaif",
+  "lpass-irq-hdmi";
 #sound-dai-cells = <1>;
 
 #address-cells = <1>;
 #size-cells = <0>;
 /* Optional to set different MI2S SD lines */
-mi2s-primary@0 {
+dai-link@0 {
 reg = ;
 qcom,playback-sd-lines = <1>;
 qcom,capture-sd-lines = <0>;
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH v11 7/7] ASoC: qcom: sc7180: Add support for audio over DP

2020-10-07 Thread Srinivasa Rao Mandadapu
From: V Sujith Kumar Reddy 

Add support for audio playback over DP in lpass
sc7180 platform driver. Update lpass_variant
structure for hdmi data configuaration.

Signed-off-by: V Sujith Kumar Reddy 
Signed-off-by: Srinivasa Rao 
---
 sound/soc/qcom/lpass-sc7180.c | 116 +-
 1 file changed, 102 insertions(+), 14 deletions(-)

diff --git a/sound/soc/qcom/lpass-sc7180.c b/sound/soc/qcom/lpass-sc7180.c
index a8a3d8f..c6292f9e 100644
--- a/sound/soc/qcom/lpass-sc7180.c
+++ b/sound/soc/qcom/lpass-sc7180.c
@@ -60,38 +60,65 @@ static struct snd_soc_dai_driver 
sc7180_lpass_cpu_dai_driver[] = {
.probe  = &asoc_qcom_lpass_cpu_dai_probe,
.ops= &asoc_qcom_lpass_cpu_dai_ops,
},
+   [LPASS_DP_RX] = {
+   .id = LPASS_DP_RX,
+   .name = "Hdmi",
+   .playback = {
+   .stream_name = "Hdmi Playback",
+   .formats= SNDRV_PCM_FMTBIT_S24,
+   .rates = SNDRV_PCM_RATE_48000,
+   .rate_min   = 48000,
+   .rate_max   = 48000,
+   .channels_min   = 2,
+   .channels_max   = 2,
+   },
+   .ops= &asoc_qcom_lpass_hdmi_dai_ops,
+   },
 };
 
 static int sc7180_lpass_alloc_dma_channel(struct lpass_data *drvdata,
-  int direction)
+  int direction, unsigned int dai_id)
 {
struct lpass_variant *v = drvdata->variant;
int chan = 0;
 
-   if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
-   chan = find_first_zero_bit(&drvdata->dma_ch_bit_map,
-   v->rdma_channels);
+   if (dai_id == LPASS_DP_RX) {
+   if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+   chan = 
find_first_zero_bit(&drvdata->hdmi_dma_ch_bit_map,
+   v->hdmi_rdma_channels);
+
+   if (chan >= v->hdmi_rdma_channels)
+   return -EBUSY;
+   }
+   set_bit(chan, &drvdata->hdmi_dma_ch_bit_map);
+   } else {
+   if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+   chan = find_first_zero_bit(&drvdata->dma_ch_bit_map,
+   v->rdma_channels);
 
if (chan >= v->rdma_channels)
return -EBUSY;
-   } else {
-   chan = find_next_zero_bit(&drvdata->dma_ch_bit_map,
+   } else {
+   chan = find_next_zero_bit(&drvdata->dma_ch_bit_map,
v->wrdma_channel_start +
v->wrdma_channels,
v->wrdma_channel_start);
 
-   if (chan >=  v->wrdma_channel_start + v->wrdma_channels)
-   return -EBUSY;
-   }
-
-   set_bit(chan, &drvdata->dma_ch_bit_map);
+   if (chan >=  v->wrdma_channel_start + v->wrdma_channels)
+   return -EBUSY;
+   }
 
+   set_bit(chan, &drvdata->dma_ch_bit_map);
+   }
return chan;
 }
 
-static int sc7180_lpass_free_dma_channel(struct lpass_data *drvdata, int chan)
+static int sc7180_lpass_free_dma_channel(struct lpass_data *drvdata, int chan, 
unsigned int dai_id)
 {
-   clear_bit(chan, &drvdata->dma_ch_bit_map);
+   if (dai_id == LPASS_DP_RX)
+   clear_bit(chan, &drvdata->hdmi_dma_ch_bit_map);
+   else
+   clear_bit(chan, &drvdata->dma_ch_bit_map);
 
return 0;
 }
@@ -144,6 +171,9 @@ static struct lpass_variant sc7180_data = {
.rdma_reg_base  = 0xC000,
.rdma_reg_stride= 0x1000,
.rdma_channels  = 5,
+   .hdmi_rdma_reg_base = 0x64000,
+   .hdmi_rdma_reg_stride   = 0x1000,
+   .hdmi_rdma_channels = 4,
.dmactl_audif_start = 1,
.wrdma_reg_base = 0x18000,
.wrdma_reg_stride   = 0x1000,
@@ -163,7 +193,7 @@ static struct lpass_variant sc7180_data = {
.rdma_dyncclk   = REG_FIELD_ID(0xC000, 21, 21, 5, 0x1000),
.rdma_bursten   = REG_FIELD_ID(0xC000, 20, 20, 5, 0x1000),
.rdma_wpscnt= REG_FIELD_ID(0xC000, 16, 19, 5, 0x1000),
-   .rdma_intf  = REG_FIELD_ID(0xC000, 12, 15, 5, 0x1000),
+   .rdma_intf  = REG_FIELD_ID(0xC000, 12, 15, 5, 
0x1000),
.rdma_fifowm= REG_FIELD_ID(0xC000, 1, 5, 5, 0x1000),
.rdma_enable= REG_FIELD_ID(0xC000, 0, 0, 5, 0x1000),
 
@@ -174,6 +204,64 @@ static struct lpass_variant sc7180_data = {
.wrdma_fifowm   = REG_FIELD_ID(0x18000, 1, 5, 4, 0x1000),
.wrdma_enable   = REG_FI

Re: [PATCH v10 5/7] ASoC: qcom: Add support for lpass hdmi driver

2020-10-07 Thread Srinivasa Rao Mandadapu

Thanks for review comments Srinivas!!!

On 10/7/2020 2:00 AM, Srinivas Kandagatla wrote:

On 05/10/2020 05:48, Srinivasa Rao Mandadapu wrote:

From: V Sujith Kumar Reddy 

Upadate lpass cpu and platform driver to support audio over dp.
Also add lpass-hdmi.c and lpass-hdmi.h.

Signed-off-by: V Sujith Kumar Reddy 
Signed-off-by: Srinivasa Rao 
---
  sound/soc/qcom/Kconfig   |   5 +
  sound/soc/qcom/Makefile  |   2 +
  sound/soc/qcom/lpass-apq8016.c   |   4 +-
  sound/soc/qcom/lpass-cpu.c   |  51 -
  sound/soc/qcom/lpass-hdmi.c  | 468 
+++

  sound/soc/qcom/lpass-hdmi.h  | 106 +
  sound/soc/qcom/lpass-ipq806x.c   |   4 +-
  sound/soc/qcom/lpass-lpaif-reg.h |  52 -
  sound/soc/qcom/lpass-platform.c  | 391 
++--

  sound/soc/qcom/lpass.h   | 113 +-
  10 files changed, 1097 insertions(+), 99 deletions(-)
  create mode 100644 sound/soc/qcom/lpass-hdmi.c
  create mode 100644 sound/soc/qcom/lpass-hdmi.h


...


diff --git a/sound/soc/qcom/lpass-hdmi.c b/sound/soc/qcom/lpass-hdmi.c
new file mode 100644
index 000..ee737f0
--- /dev/null
+++ b/sound/soc/qcom/lpass-hdmi.c
@@ -0,0 +1,468 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2020 The Linux Foundation. All rights reserved.
+ *
+ * lpass-hdmi.c -- ALSA SoC HDMI-CPU DAI driver for QTi LPASS HDMI
+ */
+
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "lpass-lpaif-reg.h"
+#include "lpass.h"
+


[

+#define QCOM_REGMAP_FIELD_ALLOC(d, m, f, mf)    \
+    do { \
+    mf = devm_regmap_field_alloc(d, m, f); \
+    if (IS_ERR(mf))    \
+    return -EINVAL; \
+    } while (0)
+
+

]
should go into lpass.h


okay!. will move to lpass.h

[

+int lpass_hdmi_init_bitfields(struct device *dev, struct regmap *map)
+{
+    struct lpass_data *drvdata = dev_get_drvdata(dev);
+    struct lpass_variant *v = drvdata->variant;
+    unsigned int i;
+    struct lpass_hdmi_tx_ctl *tx_ctl;
+    struct regmap_field *legacy_en;
+    struct lpass_vbit_ctrl *vbit_ctl;
+    struct regmap_field *tx_parity;
+    struct lpass_dp_metadata_ctl *meta_ctl;
+    struct lpass_sstream_ctl *sstream_ctl;
+    struct regmap_field *ch_msb;
+    struct regmap_field *ch_lsb;
+    struct lpass_hdmitx_dmactl *tx_dmactl;
+    int rval;
+
+    tx_ctl = devm_kzalloc(dev, sizeof(*tx_ctl), GFP_KERNEL);
+    if (!tx_ctl)
+    return -ENOMEM;
+
+    QCOM_REGMAP_FIELD_ALLOC(dev, map, v->soft_reset, 
tx_ctl->soft_reset);
+    QCOM_REGMAP_FIELD_ALLOC(dev, map, v->force_reset, 
tx_ctl->force_reset);

+    drvdata->tx_ctl = tx_ctl;
+
+    QCOM_REGMAP_FIELD_ALLOC(dev, map, v->legacy_en, legacy_en);
+    drvdata->hdmitx_legacy_en = legacy_en;
+
+    vbit_ctl = devm_kzalloc(dev, sizeof(*vbit_ctl), GFP_KERNEL);
+    if (!vbit_ctl)
+    return -ENOMEM;
+
+    QCOM_REGMAP_FIELD_ALLOC(dev, map, v->replace_vbit, 
vbit_ctl->replace_vbit);
+    QCOM_REGMAP_FIELD_ALLOC(dev, map, v->vbit_stream, 
vbit_ctl->vbit_stream);

+    drvdata->vbit_ctl = vbit_ctl;
+
+
+    QCOM_REGMAP_FIELD_ALLOC(dev, map, v->calc_en, tx_parity);
+    drvdata->hdmitx_parity_calc_en = tx_parity;
+
+    meta_ctl = devm_kzalloc(dev, sizeof(*meta_ctl), GFP_KERNEL);
+    if (!meta_ctl)
+    return -ENOMEM;
+
+    rval = devm_regmap_field_bulk_alloc(dev, map, &meta_ctl->mute, 
&v->mute, 7);

+    if (rval)
+    return rval;
+    drvdata->meta_ctl = meta_ctl;
+
+    sstream_ctl = devm_kzalloc(dev, sizeof(*sstream_ctl), GFP_KERNEL);
+    if (!sstream_ctl)
+    return -ENOMEM;
+
+    rval = devm_regmap_field_bulk_alloc(dev, map, 
&sstream_ctl->sstream_en, &v->sstream_en, 9);

+    if (rval)
+    return rval;
+
+    drvdata->sstream_ctl = sstream_ctl;
+
+    for (i = 0; i < LPASS_MAX_HDMI_DMA_CHANNELS; i++) {
+    QCOM_REGMAP_FIELD_ALLOC(dev, map, v->msb_bits, ch_msb);
+    drvdata->hdmitx_ch_msb[i] = ch_msb;
+
+    QCOM_REGMAP_FIELD_ALLOC(dev, map, v->lsb_bits, ch_lsb);
+    drvdata->hdmitx_ch_lsb[i] = ch_lsb;
+
+    tx_dmactl = devm_kzalloc(dev, sizeof(*tx_dmactl), GFP_KERNEL);
+    if (!tx_dmactl)
+    return -ENOMEM;
+
+    QCOM_REGMAP_FIELD_ALLOC(dev, map, v->use_hw_chs, 
tx_dmactl->use_hw_chs);
+    QCOM_REGMAP_FIELD_ALLOC(dev, map, v->use_hw_usr, 
tx_dmactl->use_hw_usr);
+    QCOM_REGMAP_FIELD_ALLOC(dev, map, v->hw_chs_sel, 
tx_dmactl->hw_chs_sel);
+    QCOM_REGMAP_FIELD_ALLOC(dev, map, v->hw_usr_sel, 
tx_dmactl->hw_usr_sel);

+    drvdata->hdmi_tx_dmactl[i] = tx_dmactl;
+    }
+    return 0;
+}


]
This should go into lpass-cpu.c


Okay!. Will move to lpass-cpu.c



+EXPORT_SYMBOL(lpass_hdmi_init_bitfields);



+
+static int lpass_hdmi_daiops_hw_params(struct snd_pcm_substream 
*substream,

+    struct snd_pc

[PATCH v2] arm64: dts: qcom: sc7180-trogdor: Add lpass dai link for I2S driver

2020-10-06 Thread Srinivasa Rao Mandadapu
From: Ajit Pandey 

Add dai link for supporting lpass I2S driver, which is used
for audio capture and playback.
Add lpass-cpu node with  pin controls and i2s primary
and secondary dai-links

Signed-off-by: Ajit Pandey 
Signed-off-by: V Sujith Kumar Reddy 
Signed-off-by: Srinivasa Rao Mandadapu 
---
Changes since v1:
   -- Alias name added for sound dai link node
   
 arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi | 59 
 1 file changed, 59 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
index bf87558..e5863ad 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
@@ -220,6 +220,44 @@
max-brightness = <1023>;
};
};
+
+   sound: sound {
+   compatible = "qcom,sc7180-sndcard";
+   model = "sc7180-snd-card";
+
+   audio-routing =
+   "Headphone Jack", "HPOL",
+   "Headphone Jack", "HPOR";
+
+   audio-jack = <&alc5682>;
+
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   dai-link@0 {
+   link-name = "MultiMedia0";
+   reg = <0>;
+   cpu {
+   sound-dai = <&lpass_cpu 0>;
+   };
+
+   codec {
+   sound-dai = <&alc5682 0>;
+   };
+   };
+
+   dai-link@1 {
+   link-name = "MultiMedia1";
+   reg = <1>;
+   cpu {
+   sound-dai = <&lpass_cpu 1>;
+   };
+
+   codec {
+   sound-dai = <&max98357a>;
+   };
+   };
+   };
 };
 
 &qfprom {
@@ -725,6 +763,27 @@ hp_i2c: &i2c9 {
modem-init;
 };
 
+&lpass_cpu {
+   status = "okay";
+
+   pinctrl-names = "default";
+   pinctrl-0 = <&sec_mi2s_active &pri_mi2s_active &pri_mi2s_mclk_active>;
+
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   mi2s-primary@0 {
+   reg = ;
+   qcom,playback-sd-lines = <1>;
+   qcom,capture-sd-lines = <0>;
+   };
+
+   mi2s-secondary@1 {
+   reg = ;
+   qcom,playback-sd-lines = <0>;
+   };
+};
+
 &mdp {
status = "okay";
 };
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH v10 6/7] Asoc: qcom: lpass-platform : Increase buffer size

2020-10-04 Thread Srinivasa Rao Mandadapu
From: V Sujith Kumar Reddy 

Increase buffer size to support audio over DP.

Signed-off-by: V Sujith Kumar Reddy 
Signed-off-by: Srinivasa Rao Mandadapu 
---
 sound/soc/qcom/lpass-platform.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c
index a5ab5f1..92ccedb 100644
--- a/sound/soc/qcom/lpass-platform.c
+++ b/sound/soc/qcom/lpass-platform.c
@@ -23,7 +23,7 @@ struct lpass_pcm_data {
int i2s_port;
 };
 
-#define LPASS_PLATFORM_BUFFER_SIZE (16 * 1024)
+#define LPASS_PLATFORM_BUFFER_SIZE (24 *  2 * 1024)
 #define LPASS_PLATFORM_PERIODS 2
 
 static const struct snd_pcm_hardware lpass_platform_pcm_hardware = {
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH v10 7/7] ASoC: qcom: sc7180: Add support for audio over DP

2020-10-04 Thread Srinivasa Rao Mandadapu
From: V Sujith Kumar Reddy 

Add support for audio playback over DP in lpass
sc7180 platform driver. Update lpass_variant
structure for hdmi data configuaration.

Signed-off-by: V Sujith Kumar Reddy 
Signed-off-by: Srinivasa Rao 
---
 sound/soc/qcom/lpass-sc7180.c | 116 +-
 1 file changed, 102 insertions(+), 14 deletions(-)

diff --git a/sound/soc/qcom/lpass-sc7180.c b/sound/soc/qcom/lpass-sc7180.c
index a8a3d8f..c6292f9e 100644
--- a/sound/soc/qcom/lpass-sc7180.c
+++ b/sound/soc/qcom/lpass-sc7180.c
@@ -60,38 +60,65 @@ static struct snd_soc_dai_driver 
sc7180_lpass_cpu_dai_driver[] = {
.probe  = &asoc_qcom_lpass_cpu_dai_probe,
.ops= &asoc_qcom_lpass_cpu_dai_ops,
},
+   [LPASS_DP_RX] = {
+   .id = LPASS_DP_RX,
+   .name = "Hdmi",
+   .playback = {
+   .stream_name = "Hdmi Playback",
+   .formats= SNDRV_PCM_FMTBIT_S24,
+   .rates = SNDRV_PCM_RATE_48000,
+   .rate_min   = 48000,
+   .rate_max   = 48000,
+   .channels_min   = 2,
+   .channels_max   = 2,
+   },
+   .ops= &asoc_qcom_lpass_hdmi_dai_ops,
+   },
 };
 
 static int sc7180_lpass_alloc_dma_channel(struct lpass_data *drvdata,
-  int direction)
+  int direction, unsigned int dai_id)
 {
struct lpass_variant *v = drvdata->variant;
int chan = 0;
 
-   if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
-   chan = find_first_zero_bit(&drvdata->dma_ch_bit_map,
-   v->rdma_channels);
+   if (dai_id == LPASS_DP_RX) {
+   if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+   chan = 
find_first_zero_bit(&drvdata->hdmi_dma_ch_bit_map,
+   v->hdmi_rdma_channels);
+
+   if (chan >= v->hdmi_rdma_channels)
+   return -EBUSY;
+   }
+   set_bit(chan, &drvdata->hdmi_dma_ch_bit_map);
+   } else {
+   if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+   chan = find_first_zero_bit(&drvdata->dma_ch_bit_map,
+   v->rdma_channels);
 
if (chan >= v->rdma_channels)
return -EBUSY;
-   } else {
-   chan = find_next_zero_bit(&drvdata->dma_ch_bit_map,
+   } else {
+   chan = find_next_zero_bit(&drvdata->dma_ch_bit_map,
v->wrdma_channel_start +
v->wrdma_channels,
v->wrdma_channel_start);
 
-   if (chan >=  v->wrdma_channel_start + v->wrdma_channels)
-   return -EBUSY;
-   }
-
-   set_bit(chan, &drvdata->dma_ch_bit_map);
+   if (chan >=  v->wrdma_channel_start + v->wrdma_channels)
+   return -EBUSY;
+   }
 
+   set_bit(chan, &drvdata->dma_ch_bit_map);
+   }
return chan;
 }
 
-static int sc7180_lpass_free_dma_channel(struct lpass_data *drvdata, int chan)
+static int sc7180_lpass_free_dma_channel(struct lpass_data *drvdata, int chan, 
unsigned int dai_id)
 {
-   clear_bit(chan, &drvdata->dma_ch_bit_map);
+   if (dai_id == LPASS_DP_RX)
+   clear_bit(chan, &drvdata->hdmi_dma_ch_bit_map);
+   else
+   clear_bit(chan, &drvdata->dma_ch_bit_map);
 
return 0;
 }
@@ -144,6 +171,9 @@ static struct lpass_variant sc7180_data = {
.rdma_reg_base  = 0xC000,
.rdma_reg_stride= 0x1000,
.rdma_channels  = 5,
+   .hdmi_rdma_reg_base = 0x64000,
+   .hdmi_rdma_reg_stride   = 0x1000,
+   .hdmi_rdma_channels = 4,
.dmactl_audif_start = 1,
.wrdma_reg_base = 0x18000,
.wrdma_reg_stride   = 0x1000,
@@ -163,7 +193,7 @@ static struct lpass_variant sc7180_data = {
.rdma_dyncclk   = REG_FIELD_ID(0xC000, 21, 21, 5, 0x1000),
.rdma_bursten   = REG_FIELD_ID(0xC000, 20, 20, 5, 0x1000),
.rdma_wpscnt= REG_FIELD_ID(0xC000, 16, 19, 5, 0x1000),
-   .rdma_intf  = REG_FIELD_ID(0xC000, 12, 15, 5, 0x1000),
+   .rdma_intf  = REG_FIELD_ID(0xC000, 12, 15, 5, 
0x1000),
.rdma_fifowm= REG_FIELD_ID(0xC000, 1, 5, 5, 0x1000),
.rdma_enable= REG_FIELD_ID(0xC000, 0, 0, 5, 0x1000),
 
@@ -174,6 +204,64 @@ static struct lpass_variant sc7180_data = {
.wrdma_fifowm   = REG_FIELD_ID(0x18000, 1, 5, 4, 0x1000),
.wrdma_enable   = REG_FI

[PATCH v10 5/7] ASoC: qcom: Add support for lpass hdmi driver

2020-10-04 Thread Srinivasa Rao Mandadapu
From: V Sujith Kumar Reddy 

Upadate lpass cpu and platform driver to support audio over dp.
Also add lpass-hdmi.c and lpass-hdmi.h.

Signed-off-by: V Sujith Kumar Reddy 
Signed-off-by: Srinivasa Rao 
---
 sound/soc/qcom/Kconfig   |   5 +
 sound/soc/qcom/Makefile  |   2 +
 sound/soc/qcom/lpass-apq8016.c   |   4 +-
 sound/soc/qcom/lpass-cpu.c   |  51 -
 sound/soc/qcom/lpass-hdmi.c  | 468 +++
 sound/soc/qcom/lpass-hdmi.h  | 106 +
 sound/soc/qcom/lpass-ipq806x.c   |   4 +-
 sound/soc/qcom/lpass-lpaif-reg.h |  52 -
 sound/soc/qcom/lpass-platform.c  | 391 ++--
 sound/soc/qcom/lpass.h   | 113 +-
 10 files changed, 1097 insertions(+), 99 deletions(-)
 create mode 100644 sound/soc/qcom/lpass-hdmi.c
 create mode 100644 sound/soc/qcom/lpass-hdmi.h

diff --git a/sound/soc/qcom/Kconfig b/sound/soc/qcom/Kconfig
index a7ef626..28e775f 100644
--- a/sound/soc/qcom/Kconfig
+++ b/sound/soc/qcom/Kconfig
@@ -12,6 +12,10 @@ config SND_SOC_LPASS_CPU
tristate
select REGMAP_MMIO
 
+config SND_SOC_LPASS_HDMI
+   tristate
+   select REGMAP_MMIO
+
 config SND_SOC_LPASS_PLATFORM
tristate
select REGMAP_MMIO
@@ -30,6 +34,7 @@ config SND_SOC_LPASS_SC7180
tristate
select SND_SOC_LPASS_CPU
select SND_SOC_LPASS_PLATFORM
+   select SND_SOC_LPASS_HDMI
 
 config SND_SOC_STORM
tristate "ASoC I2S support for Storm boards"
diff --git a/sound/soc/qcom/Makefile b/sound/soc/qcom/Makefile
index 7972c94..0bd90d7 100644
--- a/sound/soc/qcom/Makefile
+++ b/sound/soc/qcom/Makefile
@@ -1,12 +1,14 @@
 # SPDX-License-Identifier: GPL-2.0
 # Platform
 snd-soc-lpass-cpu-objs := lpass-cpu.o
+snd-soc-lpass-hdmi-objs := lpass-hdmi.o
 snd-soc-lpass-platform-objs := lpass-platform.o
 snd-soc-lpass-ipq806x-objs := lpass-ipq806x.o
 snd-soc-lpass-apq8016-objs := lpass-apq8016.o
 snd-soc-lpass-sc7180-objs := lpass-sc7180.o
 
 obj-$(CONFIG_SND_SOC_LPASS_CPU) += snd-soc-lpass-cpu.o
+obj-$(CONFIG_SND_SOC_LPASS_HDMI) += snd-soc-lpass-hdmi.o
 obj-$(CONFIG_SND_SOC_LPASS_PLATFORM) += snd-soc-lpass-platform.o
 obj-$(CONFIG_SND_SOC_LPASS_IPQ806X) += snd-soc-lpass-ipq806x.o
 obj-$(CONFIG_SND_SOC_LPASS_APQ8016) += snd-soc-lpass-apq8016.o
diff --git a/sound/soc/qcom/lpass-apq8016.c b/sound/soc/qcom/lpass-apq8016.c
index 5c8ae22..0aedb3a 100644
--- a/sound/soc/qcom/lpass-apq8016.c
+++ b/sound/soc/qcom/lpass-apq8016.c
@@ -125,7 +125,7 @@ static struct snd_soc_dai_driver 
apq8016_lpass_cpu_dai_driver[] = {
 };
 
 static int apq8016_lpass_alloc_dma_channel(struct lpass_data *drvdata,
-  int direction)
+  int direction, unsigned int dai_id)
 {
struct lpass_variant *v = drvdata->variant;
int chan = 0;
@@ -151,7 +151,7 @@ static int apq8016_lpass_alloc_dma_channel(struct 
lpass_data *drvdata,
return chan;
 }
 
-static int apq8016_lpass_free_dma_channel(struct lpass_data *drvdata, int chan)
+static int apq8016_lpass_free_dma_channel(struct lpass_data *drvdata, int 
chan, unsigned int dai_id)
 {
clear_bit(chan, &drvdata->dma_ch_bit_map);
 
diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
index 12950d2..b6d243e 100644
--- a/sound/soc/qcom/lpass-cpu.c
+++ b/sound/soc/qcom/lpass-cpu.c
@@ -535,13 +535,17 @@ static void of_lpass_cpu_parse_dai_data(struct device 
*dev,
dev_err(dev, "valid dai id not found: %d\n", ret);
continue;
}
-
-   data->mi2s_playback_sd_mode[id] =
-   of_lpass_cpu_parse_sd_lines(dev, node,
-   "qcom,playback-sd-lines");
-   data->mi2s_capture_sd_mode[id] =
-   of_lpass_cpu_parse_sd_lines(dev, node,
+   if (id == LPASS_DP_RX) {
+   data->hdmi_port_enable = 1;
+   dev_err(dev, "HDMI Port is enabled: %d\n", id);
+   } else {
+   data->mi2s_playback_sd_mode[id] =
+   of_lpass_cpu_parse_sd_lines(dev, node,
+   
"qcom,playback-sd-lines");
+   data->mi2s_capture_sd_mode[id] =
+   of_lpass_cpu_parse_sd_lines(dev, node,
"qcom,capture-sd-lines");
+   }
}
 }
 
@@ -596,6 +600,27 @@ int asoc_qcom_lpass_cpu_platform_probe(struct 
platform_device *pdev)
return PTR_ERR(drvdata->lpaif_map);
}
 
+   if (drvdata->hdmi_port_enable) {
+   res = platform_get_resource_byname(pdev, IORESOURCE_MEM, 
"lpass-hdmiif");
+
+   drvdata->hdmiif = devm_ioremap_resource(dev, res);
+   if (IS_ERR((void const __force *)drvdata->hdmiif)) {
+   d

[PATCH v10 3/7] Asoc:qcom:lpass-cpu:Update dts property read API

2020-10-04 Thread Srinivasa Rao Mandadapu
From: V Sujith Kumar Reddy 

Update dts property read API call with platform get property
by name, as it make code more readable and avoid conflicts
when array of properties to be used.

Signed-off-by: V Sujith Kumar Reddy 
Reviewed-by: Srinivas Kandagatla 
Signed-off-by: Srinivasa Rao 
---
 sound/soc/qcom/lpass-cpu.c  | 2 +-
 sound/soc/qcom/lpass-platform.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
index 0718a0f..12950d2 100644
--- a/sound/soc/qcom/lpass-cpu.c
+++ b/sound/soc/qcom/lpass-cpu.c
@@ -575,7 +575,7 @@ int asoc_qcom_lpass_cpu_platform_probe(struct 
platform_device *pdev)
 
of_lpass_cpu_parse_dai_data(dev, drvdata);
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+   res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "lpass-lpaif");
 
drvdata->lpaif = devm_ioremap_resource(dev, res);
if (IS_ERR((void const __force *)drvdata->lpaif)) {
diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c
index 7ac2629..e7cf4e5 100644
--- a/sound/soc/qcom/lpass-platform.c
+++ b/sound/soc/qcom/lpass-platform.c
@@ -621,7 +621,7 @@ int asoc_qcom_lpass_platform_register(struct 
platform_device *pdev)
struct lpass_variant *v = drvdata->variant;
int ret;
 
-   drvdata->lpaif_irq = platform_get_irq(pdev, 0);
+   drvdata->lpaif_irq = platform_get_irq_byname(pdev, "lpass-irq-lpaif");
if (drvdata->lpaif_irq < 0)
return -ENODEV;
 
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH v10 4/7] Asoc: qcom: lpass:Update lpaif_dmactl members order

2020-10-04 Thread Srinivasa Rao Mandadapu
From: V Sujith Kumar Reddy 

Update the lpaif_dmactl struct members order to match
HDMI reg map members sequence. Separate Interface reg map
as it is used for I2S control but not for HDMI control,
to make use of bulk API, which makes code more readable.

Signed-off-by: V Sujith Kumar Reddy 
Reviewed-by: Srinivas Kandagatla 
Signed-off-by: Srinivasa Rao 
---
 sound/soc/qcom/lpass-platform.c | 8 
 sound/soc/qcom/lpass.h  | 6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c
index e7cf4e5..db0d959 100644
--- a/sound/soc/qcom/lpass-platform.c
+++ b/sound/soc/qcom/lpass-platform.c
@@ -71,13 +71,13 @@ static int lpass_platform_alloc_dmactl_fields(struct device 
*dev,
rd_dmactl = drvdata->rd_dmactl;
wr_dmactl = drvdata->wr_dmactl;
 
-   rval = devm_regmap_field_bulk_alloc(dev, map, &rd_dmactl->bursten,
-   &v->rdma_bursten, 6);
+   rval = devm_regmap_field_bulk_alloc(dev, map, &rd_dmactl->intf,
+   &v->rdma_intf, 6);
if (rval)
return rval;
 
-   return devm_regmap_field_bulk_alloc(dev, map, &wr_dmactl->bursten,
-   &v->wrdma_bursten, 6);
+   return devm_regmap_field_bulk_alloc(dev, map, &wr_dmactl->intf,
+   &v->wrdma_intf, 6);
 }
 
 static int lpass_platform_pcmops_open(struct snd_soc_component *component,
diff --git a/sound/soc/qcom/lpass.h b/sound/soc/qcom/lpass.h
index 51c9991..7089d4c 100644
--- a/sound/soc/qcom/lpass.h
+++ b/sound/soc/qcom/lpass.h
@@ -31,9 +31,9 @@ struct lpaif_i2sctl {
 
 
 struct lpaif_dmactl {
+   struct regmap_field *intf;
struct regmap_field *bursten;
struct regmap_field *wpscnt;
-   struct regmap_field *intf;
struct regmap_field *fifowm;
struct regmap_field *enable;
struct regmap_field *dyncclk;
@@ -110,17 +110,17 @@ struct lpass_variant {
struct reg_field bitwidth;
 
/* RD_DMA Register fields */
+   struct reg_field rdma_intf;
struct reg_field rdma_bursten;
struct reg_field rdma_wpscnt;
-   struct reg_field rdma_intf;
struct reg_field rdma_fifowm;
struct reg_field rdma_enable;
struct reg_field rdma_dyncclk;
 
/* WR_DMA Register fields */
+   struct reg_field wrdma_intf;
struct reg_field wrdma_bursten;
struct reg_field wrdma_wpscnt;
-   struct reg_field wrdma_intf;
struct reg_field wrdma_fifowm;
struct reg_field wrdma_enable;
struct reg_field wrdma_dyncclk;
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH v10 0/7] Qualcomm's lpass-hdmi ASoC driver to support audio over dp port

2020-10-04 Thread Srinivasa Rao Mandadapu
These patches are to support audio over DP port on Qualcomm's SC7180 LPASS
Asoc. It includes machine driver, cpu driver, platform driver updates for 
HDMI path support, device tree documention, lpass variant structure 
optimization and configuration changes.
These patches depends on the DP patch series
https://patchwork.kernel.org/project/dri-devel/list/?series=332029
https://lore.kernel.org/patchwork/project/lkml/list/?series=464856

changes since V9:
-- Removed unused structures lpass_hdmi.h
changes since V8:
-- Removed redundant structure wrapper for reg map field memebrs
-- Updated lpass_hdmi_regmap_volatile API with appropriate registers as true
   and others as false.
changes since V7:
-- Fixed typo errors
-- Created Separate patch for buffer size change 
changes since V6:
-- Removed compile time define flag, which used for enabling
 HDMI code, based on corresponding config param is included.
-- Updated reg map alloc API with reg map bulk API.
-- Removed unnecessary line splits
changes since V5:
-- Removed unused struct regmap *map in 
lpass_platform_alloc_hdmidmactl_fields.
-- DMA alloc and free API signature change in lpass-apq8016.c, 
lpass-ipq806x.c 
-- Keeping API "irqreturn_t lpass_platform_hdmiif_irq" under ifdef macro
Changes Since v4:
-- Updated with single compatible node for both I2S and HDMI.
Changes Since v3:
-- Removed id in lpass variant structure and used snd_soc_dai_driver id.
Changes Since v2:
-- Audio buffer size(i.e. LPASS_PLATFORM_BUFFER_SIZE) in lpass-platform.c 
increased.
Changes Since v1:
-- Commit messages are updated
-- Addressed Rob Herring review comments

V Sujith Kumar Reddy (8):
  ASoC: Add sc7180-lpass binding header hdmi define
  ASoC: dt-bindings: Add dt binding for lpass hdmi
  Asoc:qcom:lpass-cpu:Update dts property read API
  Asoc: qcom: lpass:Update lpaif_dmactl members order
  ASoC: qcom: Add support for lpass hdmi driver
  Asoc: qcom: lpass-platform : Increase buffer size
  ASoC: qcom: sc7180: Add support for audio over DP

 .../devicetree/bindings/sound/qcom,lpass-cpu.yaml  |  74 +++-
 include/dt-bindings/sound/sc7180-lpass.h   |   1 +
 sound/soc/qcom/Kconfig |   5 +
 sound/soc/qcom/Makefile|   2 +
 sound/soc/qcom/lpass-apq8016.c |   4 +-
 sound/soc/qcom/lpass-cpu.c |  53 ++-
 sound/soc/qcom/lpass-hdmi.c| 468 +
 sound/soc/qcom/lpass-hdmi.h| 106 +
 sound/soc/qcom/lpass-ipq806x.c |   4 +-
 sound/soc/qcom/lpass-lpaif-reg.h   |  52 ++-
 sound/soc/qcom/lpass-platform.c| 403 ++
 sound/soc/qcom/lpass-sc7180.c  | 116 -
 sound/soc/qcom/lpass.h | 119 +-
 13 files changed, 1262 insertions(+), 145 deletions(-)
 create mode 100644 sound/soc/qcom/lpass-hdmi.c
 create mode 100644 sound/soc/qcom/lpass-hdmi.h

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



[PATCH v10 2/7] ASoC: dt-bindings: Add dt binding for lpass hdmi

2020-10-04 Thread Srinivasa Rao Mandadapu
From: V Sujith Kumar Reddy 

Adds bindings for lpass hdmi interface
which can support audio path over dp.

Signed-off-by: V Sujith Kumar Reddy 
Reviewed-by: Rob Herring 
Signed-off-by: Srinivasa Rao 
---
 .../devicetree/bindings/sound/qcom,lpass-cpu.yaml  | 74 +++---
 1 file changed, 52 insertions(+), 22 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/qcom,lpass-cpu.yaml 
b/Documentation/devicetree/bindings/sound/qcom,lpass-cpu.yaml
index 09c9bd2..f6f9fb4 100644
--- a/Documentation/devicetree/bindings/sound/qcom,lpass-cpu.yaml
+++ b/Documentation/devicetree/bindings/sound/qcom,lpass-cpu.yaml
@@ -24,9 +24,10 @@ properties:
   - qcom,sc7180-lpass-cpu
 
   reg:
-maxItems: 1
+maxItems: 2
 description: LPAIF core registers
-
+  reg-names:
+ maxItems: 2
   clocks:
 minItems: 3
 maxItems: 6
@@ -36,15 +37,16 @@ properties:
 maxItems: 6
 
   interrupts:
-maxItems: 1
+maxItems: 2
 description: LPAIF DMA buffer interrupt
-
+  interrupt-names:
+maxItems: 2
   qcom,adsp:
 $ref: /schemas/types.yaml#/definitions/phandle
 description: Phandle for the audio DSP node
 
   iommus:
-maxItems: 1
+maxItems: 2
 description: Phandle to apps_smmu node with sid mask
 
   power-domains:
@@ -60,10 +62,12 @@ properties:
 const: 0
 
 patternProperties:
-  "(^mi2s-[0-9a-f]$|mi2s)":
+  "^dai-link@[0-9a-f]$":
 type: object
-description: Required properties for each DAI
-
+description: |
+  LPASS CPU dai node for each I2S device. Bindings of each node
+  depends on the specific driver providing the functionality and
+  properties.
 properties:
   reg:
 maxItems: 1
@@ -85,9 +89,11 @@ patternProperties:
 required:
   - compatible
   - reg
+  - reg-names
   - clocks
   - clock-names
   - interrupts
+  - interrupt-names
   - '#sound-dai-cells'
 
 additionalProperties: false
@@ -134,13 +140,32 @@ allOf:
 then:
   properties:
 clock-names:
-  items:
-- const: pcnoc-sway-clk
-- const: audio-core
-- const: mclk0
-- const: pcnoc-mport-clk
-- const: mi2s-bit-clk0
-- const: mi2s-bit-clk1
+  oneOf:
+   - items:   #for I2S
+  - const: pcnoc-sway-clk
+  - const: audio-core
+  - const: mclk0
+  - const: pcnoc-mport-clk
+  - const: mi2s-bit-clk0
+  - const: mi2s-bit-clk1
+   - items:   #for HDMI
+  - const: pcnoc-sway-clk
+  - const: audio-core
+  - const: pcnoc-mport-clk
+reg-names:
+  anyOf:
+- items:   #for I2S
+  - const: lpass-lpaif
+- items:   #for I2S and HDMI
+  - const: lpass-hdmiif
+  - const: lpass-lpaif
+interrupt-names:
+  anyOf:
+- items:   #for I2S
+  - const: lpass-irq-lpaif
+- items:   #for I2S and HDMI
+  - const: lpass-irq-lpaif
+  - const: lpass-irq-hdmi
   required:
 - iommus
 - power-domains
@@ -152,12 +177,15 @@ examples:
 soc {
 #address-cells = <2>;
 #size-cells = <2>;
-lpass@62f0 {
+lpass@62d8 {
 compatible = "qcom,sc7180-lpass-cpu";
 
-reg = <0 0x62f0  0 0x29000>;
-
-iommus = <&apps_smmu 0x1020 0>;
+reg = <0 0x62d87000 0 0x68000>,
+  <0 0x62f0 0 0x29000>;
+reg-names = "lpass-hdmiif",
+"lpass-lpaif";
+iommus = <&apps_smmu 0x1020 0>,
+ <&apps_smmu 0x1032 0>;
 power-domains = <&lpass_hm 0>;
 
 clocks = <&gcc 131>,
@@ -171,14 +199,16 @@ examples:
   "mclk0", "pcnoc-mport-clk",
   "mi2s-bit-clk0", "mi2s-bit-clk1";
 
-interrupts = <0 160 1>;
-
+interrupts = <0 160 1>,
+ <0 268 1>;
+interrupt-names = "lpass-irq-lpaif",
+  "lpass-irq-hdmi";
 #sound-dai-cells = <1>;
 
 #address-cells = <1>;
 #size-cells = <0>;
 /* Optional to set different MI2S SD lines */
-mi2s-primary@0 {
+dai-link@0 {
 reg = ;
 qcom,playback-sd-lines = <1>;
 qcom,capture-sd-lines = <0>;
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH v10 1/7] ASoC: Add sc7180-lpass binding header hdmi define

2020-10-04 Thread Srinivasa Rao Mandadapu
From: V Sujith Kumar Reddy 

Add header defining hdmi dai-id for SC7180 lpass soc
in dt bindings.

Signed-off-by: V Sujith Kumar Reddy 
Acked-by: Rob Herring 
Signed-off-by: Srinivasa Rao 
---
 include/dt-bindings/sound/sc7180-lpass.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/dt-bindings/sound/sc7180-lpass.h 
b/include/dt-bindings/sound/sc7180-lpass.h
index 7d988f6..56ecaaf 100644
--- a/include/dt-bindings/sound/sc7180-lpass.h
+++ b/include/dt-bindings/sound/sc7180-lpass.h
@@ -4,6 +4,7 @@
 
 #define MI2S_PRIMARY   0
 #define MI2S_SECONDARY 1
+#define LPASS_DP_RX2
 
 #define LPASS_MCLK00
 
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH v9 0/7] Qualcomm's lpass-hdmi ASoC driver to support audio over dp port

2020-10-04 Thread Srinivasa Rao Mandadapu
These patches are to support audio over DP port on Qualcomm's SC7180 LPASS
Asoc. It includes machine driver, cpu driver, platform driver updates for 
HDMI path support, device tree documention, lpass variant structure 
optimization and configuration changes.
These patches depends on the DP patch series
https://patchwork.kernel.org/project/dri-devel/list/?series=332029
https://lore.kernel.org/patchwork/project/lkml/list/?series=464856

changes since V8:
-- Removed extra structure wrapper for reg map field memebrs
-- Updated lpass_hdmi_regmap_volatile API with appropriate registers as true
   and others as false.
changes since V7:
-- Fixed typo errors
-- Created Separate patch for buffer size change 
changes since V6:
-- Removed compile time define flag, which used for enabling
 HDMI code, based on corresponding config param is included.
-- Updated reg map alloc API with reg map bulk API.
-- Removed unnecessary line splits
changes since V5:
-- Removed unused struct regmap *map in 
lpass_platform_alloc_hdmidmactl_fields.
-- DMA alloc and free API signature change in lpass-apq8016.c, 
lpass-ipq806x.c 
-- Keeping API "irqreturn_t lpass_platform_hdmiif_irq" under ifdef macro
Changes Since v4:
-- Updated with single compatible node for both I2S and HDMI.
Changes Since v3:
-- Removed id in lpass variant structure and used snd_soc_dai_driver id.
Changes Since v2:
-- Audio buffer size(i.e. LPASS_PLATFORM_BUFFER_SIZE) in lpass-platform.c 
increased.
Changes Since v1:
-- Commit messages are updated
-- Addressed Rob Herring review comments

V Sujith Kumar Reddy (8):
  ASoC: Add sc7180-lpass binding header hdmi define
  ASoC: dt-bindings: Add dt binding for lpass hdmi
  Asoc:qcom:lpass-cpu:Update dts property read API
  Asoc: qcom: lpass:Update lpaif_dmactl members order
  ASoC: qcom: Add support for lpass hdmi driver
  Asoc: qcom: lpass-platform : Increase buffer size
  ASoC: qcom: sc7180: Add support for audio over DP

 .../devicetree/bindings/sound/qcom,lpass-cpu.yaml  |  74 +++-
 include/dt-bindings/sound/sc7180-lpass.h   |   1 +
 sound/soc/qcom/Kconfig |   5 +
 sound/soc/qcom/Makefile|   2 +
 sound/soc/qcom/lpass-apq8016.c |   4 +-
 sound/soc/qcom/lpass-cpu.c |  53 ++-
 sound/soc/qcom/lpass-hdmi.c| 469 +
 sound/soc/qcom/lpass-hdmi.h| 122 ++
 sound/soc/qcom/lpass-ipq806x.c |   4 +-
 sound/soc/qcom/lpass-lpaif-reg.h   |  52 ++-
 sound/soc/qcom/lpass-platform.c| 403 ++
 sound/soc/qcom/lpass-sc7180.c  | 116 -
 sound/soc/qcom/lpass.h | 119 +-
 13 files changed, 1279 insertions(+), 145 deletions(-)
 create mode 100644 sound/soc/qcom/lpass-hdmi.c
 create mode 100644 sound/soc/qcom/lpass-hdmi.h

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



[PATCH v9 7/7] ASoC: qcom: sc7180: Add support for audio over DP

2020-10-04 Thread Srinivasa Rao Mandadapu
From: V Sujith Kumar Reddy 

Add support for audio playback over DP in lpass
sc7180 platform driver. Update lpass_variant
structure for hdmi data configuaration.

Signed-off-by: V Sujith Kumar Reddy 
Signed-off-by: Srinivasa Rao 
---
 sound/soc/qcom/lpass-sc7180.c | 116 +-
 1 file changed, 102 insertions(+), 14 deletions(-)

diff --git a/sound/soc/qcom/lpass-sc7180.c b/sound/soc/qcom/lpass-sc7180.c
index a8a3d8f..c6292f9e 100644
--- a/sound/soc/qcom/lpass-sc7180.c
+++ b/sound/soc/qcom/lpass-sc7180.c
@@ -60,38 +60,65 @@ static struct snd_soc_dai_driver 
sc7180_lpass_cpu_dai_driver[] = {
.probe  = &asoc_qcom_lpass_cpu_dai_probe,
.ops= &asoc_qcom_lpass_cpu_dai_ops,
},
+   [LPASS_DP_RX] = {
+   .id = LPASS_DP_RX,
+   .name = "Hdmi",
+   .playback = {
+   .stream_name = "Hdmi Playback",
+   .formats= SNDRV_PCM_FMTBIT_S24,
+   .rates = SNDRV_PCM_RATE_48000,
+   .rate_min   = 48000,
+   .rate_max   = 48000,
+   .channels_min   = 2,
+   .channels_max   = 2,
+   },
+   .ops= &asoc_qcom_lpass_hdmi_dai_ops,
+   },
 };
 
 static int sc7180_lpass_alloc_dma_channel(struct lpass_data *drvdata,
-  int direction)
+  int direction, unsigned int dai_id)
 {
struct lpass_variant *v = drvdata->variant;
int chan = 0;
 
-   if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
-   chan = find_first_zero_bit(&drvdata->dma_ch_bit_map,
-   v->rdma_channels);
+   if (dai_id == LPASS_DP_RX) {
+   if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+   chan = 
find_first_zero_bit(&drvdata->hdmi_dma_ch_bit_map,
+   v->hdmi_rdma_channels);
+
+   if (chan >= v->hdmi_rdma_channels)
+   return -EBUSY;
+   }
+   set_bit(chan, &drvdata->hdmi_dma_ch_bit_map);
+   } else {
+   if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+   chan = find_first_zero_bit(&drvdata->dma_ch_bit_map,
+   v->rdma_channels);
 
if (chan >= v->rdma_channels)
return -EBUSY;
-   } else {
-   chan = find_next_zero_bit(&drvdata->dma_ch_bit_map,
+   } else {
+   chan = find_next_zero_bit(&drvdata->dma_ch_bit_map,
v->wrdma_channel_start +
v->wrdma_channels,
v->wrdma_channel_start);
 
-   if (chan >=  v->wrdma_channel_start + v->wrdma_channels)
-   return -EBUSY;
-   }
-
-   set_bit(chan, &drvdata->dma_ch_bit_map);
+   if (chan >=  v->wrdma_channel_start + v->wrdma_channels)
+   return -EBUSY;
+   }
 
+   set_bit(chan, &drvdata->dma_ch_bit_map);
+   }
return chan;
 }
 
-static int sc7180_lpass_free_dma_channel(struct lpass_data *drvdata, int chan)
+static int sc7180_lpass_free_dma_channel(struct lpass_data *drvdata, int chan, 
unsigned int dai_id)
 {
-   clear_bit(chan, &drvdata->dma_ch_bit_map);
+   if (dai_id == LPASS_DP_RX)
+   clear_bit(chan, &drvdata->hdmi_dma_ch_bit_map);
+   else
+   clear_bit(chan, &drvdata->dma_ch_bit_map);
 
return 0;
 }
@@ -144,6 +171,9 @@ static struct lpass_variant sc7180_data = {
.rdma_reg_base  = 0xC000,
.rdma_reg_stride= 0x1000,
.rdma_channels  = 5,
+   .hdmi_rdma_reg_base = 0x64000,
+   .hdmi_rdma_reg_stride   = 0x1000,
+   .hdmi_rdma_channels = 4,
.dmactl_audif_start = 1,
.wrdma_reg_base = 0x18000,
.wrdma_reg_stride   = 0x1000,
@@ -163,7 +193,7 @@ static struct lpass_variant sc7180_data = {
.rdma_dyncclk   = REG_FIELD_ID(0xC000, 21, 21, 5, 0x1000),
.rdma_bursten   = REG_FIELD_ID(0xC000, 20, 20, 5, 0x1000),
.rdma_wpscnt= REG_FIELD_ID(0xC000, 16, 19, 5, 0x1000),
-   .rdma_intf  = REG_FIELD_ID(0xC000, 12, 15, 5, 0x1000),
+   .rdma_intf  = REG_FIELD_ID(0xC000, 12, 15, 5, 
0x1000),
.rdma_fifowm= REG_FIELD_ID(0xC000, 1, 5, 5, 0x1000),
.rdma_enable= REG_FIELD_ID(0xC000, 0, 0, 5, 0x1000),
 
@@ -174,6 +204,64 @@ static struct lpass_variant sc7180_data = {
.wrdma_fifowm   = REG_FIELD_ID(0x18000, 1, 5, 4, 0x1000),
.wrdma_enable   = REG_FI

[PATCH v9 2/7] ASoC: dt-bindings: Add dt binding for lpass hdmi

2020-10-04 Thread Srinivasa Rao Mandadapu
From: V Sujith Kumar Reddy 

Adds bindings for lpass hdmi interface
which can support audio path over dp.

Signed-off-by: V Sujith Kumar Reddy 
Reviewed-by: Rob Herring 
Signed-off-by: Srinivasa Rao 
---
 .../devicetree/bindings/sound/qcom,lpass-cpu.yaml  | 74 +++---
 1 file changed, 52 insertions(+), 22 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/qcom,lpass-cpu.yaml 
b/Documentation/devicetree/bindings/sound/qcom,lpass-cpu.yaml
index 09c9bd2..f6f9fb4 100644
--- a/Documentation/devicetree/bindings/sound/qcom,lpass-cpu.yaml
+++ b/Documentation/devicetree/bindings/sound/qcom,lpass-cpu.yaml
@@ -24,9 +24,10 @@ properties:
   - qcom,sc7180-lpass-cpu
 
   reg:
-maxItems: 1
+maxItems: 2
 description: LPAIF core registers
-
+  reg-names:
+ maxItems: 2
   clocks:
 minItems: 3
 maxItems: 6
@@ -36,15 +37,16 @@ properties:
 maxItems: 6
 
   interrupts:
-maxItems: 1
+maxItems: 2
 description: LPAIF DMA buffer interrupt
-
+  interrupt-names:
+maxItems: 2
   qcom,adsp:
 $ref: /schemas/types.yaml#/definitions/phandle
 description: Phandle for the audio DSP node
 
   iommus:
-maxItems: 1
+maxItems: 2
 description: Phandle to apps_smmu node with sid mask
 
   power-domains:
@@ -60,10 +62,12 @@ properties:
 const: 0
 
 patternProperties:
-  "(^mi2s-[0-9a-f]$|mi2s)":
+  "^dai-link@[0-9a-f]$":
 type: object
-description: Required properties for each DAI
-
+description: |
+  LPASS CPU dai node for each I2S device. Bindings of each node
+  depends on the specific driver providing the functionality and
+  properties.
 properties:
   reg:
 maxItems: 1
@@ -85,9 +89,11 @@ patternProperties:
 required:
   - compatible
   - reg
+  - reg-names
   - clocks
   - clock-names
   - interrupts
+  - interrupt-names
   - '#sound-dai-cells'
 
 additionalProperties: false
@@ -134,13 +140,32 @@ allOf:
 then:
   properties:
 clock-names:
-  items:
-- const: pcnoc-sway-clk
-- const: audio-core
-- const: mclk0
-- const: pcnoc-mport-clk
-- const: mi2s-bit-clk0
-- const: mi2s-bit-clk1
+  oneOf:
+   - items:   #for I2S
+  - const: pcnoc-sway-clk
+  - const: audio-core
+  - const: mclk0
+  - const: pcnoc-mport-clk
+  - const: mi2s-bit-clk0
+  - const: mi2s-bit-clk1
+   - items:   #for HDMI
+  - const: pcnoc-sway-clk
+  - const: audio-core
+  - const: pcnoc-mport-clk
+reg-names:
+  anyOf:
+- items:   #for I2S
+  - const: lpass-lpaif
+- items:   #for I2S and HDMI
+  - const: lpass-hdmiif
+  - const: lpass-lpaif
+interrupt-names:
+  anyOf:
+- items:   #for I2S
+  - const: lpass-irq-lpaif
+- items:   #for I2S and HDMI
+  - const: lpass-irq-lpaif
+  - const: lpass-irq-hdmi
   required:
 - iommus
 - power-domains
@@ -152,12 +177,15 @@ examples:
 soc {
 #address-cells = <2>;
 #size-cells = <2>;
-lpass@62f0 {
+lpass@62d8 {
 compatible = "qcom,sc7180-lpass-cpu";
 
-reg = <0 0x62f0  0 0x29000>;
-
-iommus = <&apps_smmu 0x1020 0>;
+reg = <0 0x62d87000 0 0x68000>,
+  <0 0x62f0 0 0x29000>;
+reg-names = "lpass-hdmiif",
+"lpass-lpaif";
+iommus = <&apps_smmu 0x1020 0>,
+ <&apps_smmu 0x1032 0>;
 power-domains = <&lpass_hm 0>;
 
 clocks = <&gcc 131>,
@@ -171,14 +199,16 @@ examples:
   "mclk0", "pcnoc-mport-clk",
   "mi2s-bit-clk0", "mi2s-bit-clk1";
 
-interrupts = <0 160 1>;
-
+interrupts = <0 160 1>,
+ <0 268 1>;
+interrupt-names = "lpass-irq-lpaif",
+  "lpass-irq-hdmi";
 #sound-dai-cells = <1>;
 
 #address-cells = <1>;
 #size-cells = <0>;
 /* Optional to set different MI2S SD lines */
-mi2s-primary@0 {
+dai-link@0 {
 reg = ;
 qcom,playback-sd-lines = <1>;
 qcom,capture-sd-lines = <0>;
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH v9 5/7] ASoC: qcom: Add support for lpass hdmi driver

2020-10-04 Thread Srinivasa Rao Mandadapu
From: V Sujith Kumar Reddy 

Upadate lpass cpu and platform driver to support audio over dp.
Also add lpass-hdmi.c and lpass-hdmi.h.

Signed-off-by: V Sujith Kumar Reddy 
Signed-off-by: Srinivasa Rao 
---
 sound/soc/qcom/Kconfig   |   5 +
 sound/soc/qcom/Makefile  |   2 +
 sound/soc/qcom/lpass-apq8016.c   |   4 +-
 sound/soc/qcom/lpass-cpu.c   |  51 -
 sound/soc/qcom/lpass-hdmi.c  | 469 +++
 sound/soc/qcom/lpass-hdmi.h  | 122 ++
 sound/soc/qcom/lpass-ipq806x.c   |   4 +-
 sound/soc/qcom/lpass-lpaif-reg.h |  52 -
 sound/soc/qcom/lpass-platform.c  | 391 ++--
 sound/soc/qcom/lpass.h   | 113 +-
 10 files changed, 1114 insertions(+), 99 deletions(-)
 create mode 100644 sound/soc/qcom/lpass-hdmi.c
 create mode 100644 sound/soc/qcom/lpass-hdmi.h

diff --git a/sound/soc/qcom/Kconfig b/sound/soc/qcom/Kconfig
index a7ef626..28e775f 100644
--- a/sound/soc/qcom/Kconfig
+++ b/sound/soc/qcom/Kconfig
@@ -12,6 +12,10 @@ config SND_SOC_LPASS_CPU
tristate
select REGMAP_MMIO
 
+config SND_SOC_LPASS_HDMI
+   tristate
+   select REGMAP_MMIO
+
 config SND_SOC_LPASS_PLATFORM
tristate
select REGMAP_MMIO
@@ -30,6 +34,7 @@ config SND_SOC_LPASS_SC7180
tristate
select SND_SOC_LPASS_CPU
select SND_SOC_LPASS_PLATFORM
+   select SND_SOC_LPASS_HDMI
 
 config SND_SOC_STORM
tristate "ASoC I2S support for Storm boards"
diff --git a/sound/soc/qcom/Makefile b/sound/soc/qcom/Makefile
index 7972c94..0bd90d7 100644
--- a/sound/soc/qcom/Makefile
+++ b/sound/soc/qcom/Makefile
@@ -1,12 +1,14 @@
 # SPDX-License-Identifier: GPL-2.0
 # Platform
 snd-soc-lpass-cpu-objs := lpass-cpu.o
+snd-soc-lpass-hdmi-objs := lpass-hdmi.o
 snd-soc-lpass-platform-objs := lpass-platform.o
 snd-soc-lpass-ipq806x-objs := lpass-ipq806x.o
 snd-soc-lpass-apq8016-objs := lpass-apq8016.o
 snd-soc-lpass-sc7180-objs := lpass-sc7180.o
 
 obj-$(CONFIG_SND_SOC_LPASS_CPU) += snd-soc-lpass-cpu.o
+obj-$(CONFIG_SND_SOC_LPASS_HDMI) += snd-soc-lpass-hdmi.o
 obj-$(CONFIG_SND_SOC_LPASS_PLATFORM) += snd-soc-lpass-platform.o
 obj-$(CONFIG_SND_SOC_LPASS_IPQ806X) += snd-soc-lpass-ipq806x.o
 obj-$(CONFIG_SND_SOC_LPASS_APQ8016) += snd-soc-lpass-apq8016.o
diff --git a/sound/soc/qcom/lpass-apq8016.c b/sound/soc/qcom/lpass-apq8016.c
index 5c8ae22..0aedb3a 100644
--- a/sound/soc/qcom/lpass-apq8016.c
+++ b/sound/soc/qcom/lpass-apq8016.c
@@ -125,7 +125,7 @@ static struct snd_soc_dai_driver 
apq8016_lpass_cpu_dai_driver[] = {
 };
 
 static int apq8016_lpass_alloc_dma_channel(struct lpass_data *drvdata,
-  int direction)
+  int direction, unsigned int dai_id)
 {
struct lpass_variant *v = drvdata->variant;
int chan = 0;
@@ -151,7 +151,7 @@ static int apq8016_lpass_alloc_dma_channel(struct 
lpass_data *drvdata,
return chan;
 }
 
-static int apq8016_lpass_free_dma_channel(struct lpass_data *drvdata, int chan)
+static int apq8016_lpass_free_dma_channel(struct lpass_data *drvdata, int 
chan, unsigned int dai_id)
 {
clear_bit(chan, &drvdata->dma_ch_bit_map);
 
diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
index 12950d2..b6d243e 100644
--- a/sound/soc/qcom/lpass-cpu.c
+++ b/sound/soc/qcom/lpass-cpu.c
@@ -535,13 +535,17 @@ static void of_lpass_cpu_parse_dai_data(struct device 
*dev,
dev_err(dev, "valid dai id not found: %d\n", ret);
continue;
}
-
-   data->mi2s_playback_sd_mode[id] =
-   of_lpass_cpu_parse_sd_lines(dev, node,
-   "qcom,playback-sd-lines");
-   data->mi2s_capture_sd_mode[id] =
-   of_lpass_cpu_parse_sd_lines(dev, node,
+   if (id == LPASS_DP_RX) {
+   data->hdmi_port_enable = 1;
+   dev_err(dev, "HDMI Port is enabled: %d\n", id);
+   } else {
+   data->mi2s_playback_sd_mode[id] =
+   of_lpass_cpu_parse_sd_lines(dev, node,
+   
"qcom,playback-sd-lines");
+   data->mi2s_capture_sd_mode[id] =
+   of_lpass_cpu_parse_sd_lines(dev, node,
"qcom,capture-sd-lines");
+   }
}
 }
 
@@ -596,6 +600,27 @@ int asoc_qcom_lpass_cpu_platform_probe(struct 
platform_device *pdev)
return PTR_ERR(drvdata->lpaif_map);
}
 
+   if (drvdata->hdmi_port_enable) {
+   res = platform_get_resource_byname(pdev, IORESOURCE_MEM, 
"lpass-hdmiif");
+
+   drvdata->hdmiif = devm_ioremap_resource(dev, res);
+   if (IS_ERR((void const __force *)drvdata->hdmiif)) {
+   

[PATCH v9 6/7] Asoc: qcom: lpass-platform : Increase buffer size

2020-10-04 Thread Srinivasa Rao Mandadapu
From: V Sujith Kumar Reddy 

Increase buffer size to support audio over DP.

Signed-off-by: V Sujith Kumar Reddy 
Signed-off-by: Srinivasa Rao Mandadapu 
---
 sound/soc/qcom/lpass-platform.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c
index a5ab5f1..92ccedb 100644
--- a/sound/soc/qcom/lpass-platform.c
+++ b/sound/soc/qcom/lpass-platform.c
@@ -23,7 +23,7 @@ struct lpass_pcm_data {
int i2s_port;
 };
 
-#define LPASS_PLATFORM_BUFFER_SIZE (16 * 1024)
+#define LPASS_PLATFORM_BUFFER_SIZE (24 *  2 * 1024)
 #define LPASS_PLATFORM_PERIODS 2
 
 static const struct snd_pcm_hardware lpass_platform_pcm_hardware = {
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH v9 4/7] Asoc: qcom: lpass:Update lpaif_dmactl members order

2020-10-04 Thread Srinivasa Rao Mandadapu
From: V Sujith Kumar Reddy 

Update the lpaif_dmactl struct members order to match
HDMI reg map members sequence. Separate Interface reg map
as it is used for I2S control but not for HDMI control,
to make use of bulk API, which makes code more readable.

Signed-off-by: V Sujith Kumar Reddy 
Reviewed-by: Srinivas Kandagatla 
Signed-off-by: Srinivasa Rao 
---
 sound/soc/qcom/lpass-platform.c | 8 
 sound/soc/qcom/lpass.h  | 6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c
index e7cf4e5..db0d959 100644
--- a/sound/soc/qcom/lpass-platform.c
+++ b/sound/soc/qcom/lpass-platform.c
@@ -71,13 +71,13 @@ static int lpass_platform_alloc_dmactl_fields(struct device 
*dev,
rd_dmactl = drvdata->rd_dmactl;
wr_dmactl = drvdata->wr_dmactl;
 
-   rval = devm_regmap_field_bulk_alloc(dev, map, &rd_dmactl->bursten,
-   &v->rdma_bursten, 6);
+   rval = devm_regmap_field_bulk_alloc(dev, map, &rd_dmactl->intf,
+   &v->rdma_intf, 6);
if (rval)
return rval;
 
-   return devm_regmap_field_bulk_alloc(dev, map, &wr_dmactl->bursten,
-   &v->wrdma_bursten, 6);
+   return devm_regmap_field_bulk_alloc(dev, map, &wr_dmactl->intf,
+   &v->wrdma_intf, 6);
 }
 
 static int lpass_platform_pcmops_open(struct snd_soc_component *component,
diff --git a/sound/soc/qcom/lpass.h b/sound/soc/qcom/lpass.h
index 51c9991..7089d4c 100644
--- a/sound/soc/qcom/lpass.h
+++ b/sound/soc/qcom/lpass.h
@@ -31,9 +31,9 @@ struct lpaif_i2sctl {
 
 
 struct lpaif_dmactl {
+   struct regmap_field *intf;
struct regmap_field *bursten;
struct regmap_field *wpscnt;
-   struct regmap_field *intf;
struct regmap_field *fifowm;
struct regmap_field *enable;
struct regmap_field *dyncclk;
@@ -110,17 +110,17 @@ struct lpass_variant {
struct reg_field bitwidth;
 
/* RD_DMA Register fields */
+   struct reg_field rdma_intf;
struct reg_field rdma_bursten;
struct reg_field rdma_wpscnt;
-   struct reg_field rdma_intf;
struct reg_field rdma_fifowm;
struct reg_field rdma_enable;
struct reg_field rdma_dyncclk;
 
/* WR_DMA Register fields */
+   struct reg_field wrdma_intf;
struct reg_field wrdma_bursten;
struct reg_field wrdma_wpscnt;
-   struct reg_field wrdma_intf;
struct reg_field wrdma_fifowm;
struct reg_field wrdma_enable;
struct reg_field wrdma_dyncclk;
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH v9 1/7] ASoC: Add sc7180-lpass binding header hdmi define

2020-10-04 Thread Srinivasa Rao Mandadapu
From: V Sujith Kumar Reddy 

Add header defining hdmi dai-id for SC7180 lpass soc
in dt bindings.

Signed-off-by: V Sujith Kumar Reddy 
Acked-by: Rob Herring 
Signed-off-by: Srinivasa Rao 
---
 include/dt-bindings/sound/sc7180-lpass.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/dt-bindings/sound/sc7180-lpass.h 
b/include/dt-bindings/sound/sc7180-lpass.h
index 7d988f6..56ecaaf 100644
--- a/include/dt-bindings/sound/sc7180-lpass.h
+++ b/include/dt-bindings/sound/sc7180-lpass.h
@@ -4,6 +4,7 @@
 
 #define MI2S_PRIMARY   0
 #define MI2S_SECONDARY 1
+#define LPASS_DP_RX2
 
 #define LPASS_MCLK00
 
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH v9 3/7] Asoc:qcom:lpass-cpu:Update dts property read API

2020-10-04 Thread Srinivasa Rao Mandadapu
From: V Sujith Kumar Reddy 

Update dts property read API call with platform get property
by name, as it make code more readable and avoid conflicts
when array of properties to be used.

Signed-off-by: V Sujith Kumar Reddy 
Reviewed-by: Srinivas Kandagatla 
Signed-off-by: Srinivasa Rao 
---
 sound/soc/qcom/lpass-cpu.c  | 2 +-
 sound/soc/qcom/lpass-platform.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
index 0718a0f..12950d2 100644
--- a/sound/soc/qcom/lpass-cpu.c
+++ b/sound/soc/qcom/lpass-cpu.c
@@ -575,7 +575,7 @@ int asoc_qcom_lpass_cpu_platform_probe(struct 
platform_device *pdev)
 
of_lpass_cpu_parse_dai_data(dev, drvdata);
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+   res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "lpass-lpaif");
 
drvdata->lpaif = devm_ioremap_resource(dev, res);
if (IS_ERR((void const __force *)drvdata->lpaif)) {
diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c
index 7ac2629..e7cf4e5 100644
--- a/sound/soc/qcom/lpass-platform.c
+++ b/sound/soc/qcom/lpass-platform.c
@@ -621,7 +621,7 @@ int asoc_qcom_lpass_platform_register(struct 
platform_device *pdev)
struct lpass_variant *v = drvdata->variant;
int ret;
 
-   drvdata->lpaif_irq = platform_get_irq(pdev, 0);
+   drvdata->lpaif_irq = platform_get_irq_byname(pdev, "lpass-irq-lpaif");
if (drvdata->lpaif_irq < 0)
return -ENODEV;
 
-- 
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 v8 5/7] ASoC: qcom: Add support for lpass hdmi driver

2020-10-03 Thread Srinivasa Rao Mandadapu

Thanks for bringing up this point Srinivas!!!

On 9/30/2020 8:57 PM, Srinivas Kandagatla wrote:



On 30/09/2020 07:39, Srinivasa Rao Mandadapu wrote:

+}
+
+static bool lpass_hdmi_regmap_volatile(struct device *dev, unsigned 
int reg)

+{
+    return true;
+}


I did ask this question in multiple reviews, but never got an answer!
Are all the dp/hdmi port register range really volatile!?


Sorry for incomplete response in last review comment reply.
With making only specific DMA registers and interrupts registers true, 
aplay was stuck.


Now we identified issue causing register and made it volatile.
With that change it seems working fine. After doing all the tests we 
will share v9 series patch.






--srini

+
+struct regmap_config lpass_hdmi_regmap_config = {
+    .reg_bits = 32,
+    .reg_stride = 4,
+    .val_bits = 32,
+    .writeable_reg = lpass_hdmi_regmap_writeable,
+    .readable_reg = lpass_hdmi_regmap_readable,
+    .volatile_reg = lpass_hdmi_regmap_volatile,


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



[PATCH v3 0/2] Qualcomm's lpass device tree changes

2020-09-29 Thread Srinivasa Rao Mandadapu
These patches are device tree changes to support audio over DP.
It includes changes of HDMI reg, interrupt and iommu and 
hdmi dai link.
These patches depends on the lpass I2S patch series
and DP dts node patch series:
  -- https://patchwork.kernel.org/patch/11785073/
  -- https://patchwork.kernel.org/patch/11785235/
  -- https://patchwork.kernel.org/patch/11719511/

Changes Since v2:
  -- Removed obsolete hdmi-jack property.
  -- Updated sound dai cells property
Changes Since v1:
  -- hdmi dai is added in lpass-cpu node.

V Sujith Kumar Reddy (2):
  arm64: dts: qcom: sc7180: Update lpass cpu node for audio over dp
  arm64: dts: qcom: sc7180-trogdor: Add lpass dai link for HDMI

 arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi | 15 +++
 arch/arm64/boot/dts/qcom/sc7180.dtsi | 17 ++---
 2 files changed, 25 insertions(+), 7 deletions(-)

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



[PATCH v3 1/2] arm64: dts: qcom: sc7180: Update lpass cpu node for audio over dp

2020-09-29 Thread Srinivasa Rao Mandadapu
From: V Sujith Kumar Reddy 

Updaate lpass dts node with HDMI reg, interrupt and iommu
for supporting audio over dp.

Signed-off-by: Srinivasa Rao Mandadapu 
Signed-off-by: V Sujith Kumar Reddy 
---
 arch/arm64/boot/dts/qcom/sc7180.dtsi | 17 ++---
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/sc7180.dtsi 
b/arch/arm64/boot/dts/qcom/sc7180.dtsi
index 427a4bf..802ea0a 100644
--- a/arch/arm64/boot/dts/qcom/sc7180.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180.dtsi
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 
 / {
interrupt-parent = <&intc>;
@@ -3428,16 +3429,18 @@
#power-domain-cells = <1>;
};
 
-   lpass_cpu: lpass@62f0 {
+   lpass_cpu: lpass@62d87000 {
compatible = "qcom,sc7180-lpass-cpu";
 
-   reg = <0 0x62f0 0 0x29000>;
-   reg-names = "lpass-lpaif";
+   reg = <0 0x62d87000 0 0x68000>, <0 0x62f0 0 
0x29000>;
+   reg-names =  "lpass-hdmiif", "lpass-lpaif";
 
-   iommus = <&apps_smmu 0x1020 0>;
+   iommus = <&apps_smmu 0x1020 0>, <&apps_smmu 0x1032 0>;
 
power-domains = <&lpass_hm LPASS_CORE_HM_GDSCR>;
 
+   status = "disabled";
+
clocks = <&gcc GCC_LPASS_CFG_NOC_SWAY_CLK>,
 <&lpasscc LPASS_AUDIO_CORE_CORE_CLK>,
 <&lpasscc LPASS_AUDIO_CORE_EXT_MCLK0_CLK>,
@@ -3449,13 +3452,13 @@
"mclk0", "pcnoc-mport-clk",
"mi2s-bit-clk0", "mi2s-bit-clk1";
 
-
#sound-dai-cells = <1>;
#address-cells = <1>;
#size-cells = <0>;
 
-   interrupts = ;
-   interrupt-names = "lpass-irq-lpaif";
+   interrupts = ,
+   ;
+   interrupt-names = "lpass-irq-lpaif", "lpass-irq-hdmi";
};
 
lpass_hm: clock-controller@6300 {
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH v3 2/2] arm64: dts: qcom: sc7180-trogdor: Add lpass dai link for HDMI

2020-09-29 Thread Srinivasa Rao Mandadapu
From: V Sujith Kumar Reddy 

Add dai link in sc7180-trogdor.dtsi for supporting audio over DP

Signed-off-by: V Sujith Kumar Reddy 
Signed-off-by: Srinivasa Rao Mandadapu 
---
 arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi 
b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
index 5724982..850b43e 100644
--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
+++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi
@@ -231,6 +231,7 @@
 
audio-jack = <&alc5682>;
 
+   #sound-dai-cells = <0>;
#address-cells = <1>;
#size-cells = <0>;
 
@@ -257,6 +258,17 @@
sound-dai = <&max98357a>;
};
};
+   dai-link@2 {
+   link-name = "MultiMedia2";
+   reg = <2>;
+   cpu {
+   sound-dai = <&lpass_cpu 2>;
+   };
+
+   codec {
+   sound-dai = <&msm_dp>;
+   };
+   };
};
 };
 
@@ -782,6 +794,9 @@ hp_i2c: &i2c9 {
reg = ;
qcom,playback-sd-lines = <0>;
};
+   hdmi-primary@0 {
+   reg = ;
+   };
 };
 
 &mdp {
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH v8 4/7] Asoc: qcom: lpass:Update lpaif_dmactl members order

2020-09-29 Thread Srinivasa Rao Mandadapu
From: V Sujith Kumar Reddy 

Update the lpaif_dmactl struct members order to match
HDMI reg map members sequence. Separate Interface reg map
as it is used for I2S control but not for HDMI control,
to make use of bulk API, which makes code more readable.

Signed-off-by: V Sujith Kumar Reddy 
Reviewed-by: Srinivas Kandagatla 
Signed-off-by: Srinivasa Rao 
---
 sound/soc/qcom/lpass-platform.c | 8 
 sound/soc/qcom/lpass.h  | 6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c
index e7cf4e5..db0d959 100644
--- a/sound/soc/qcom/lpass-platform.c
+++ b/sound/soc/qcom/lpass-platform.c
@@ -71,13 +71,13 @@ static int lpass_platform_alloc_dmactl_fields(struct device 
*dev,
rd_dmactl = drvdata->rd_dmactl;
wr_dmactl = drvdata->wr_dmactl;
 
-   rval = devm_regmap_field_bulk_alloc(dev, map, &rd_dmactl->bursten,
-   &v->rdma_bursten, 6);
+   rval = devm_regmap_field_bulk_alloc(dev, map, &rd_dmactl->intf,
+   &v->rdma_intf, 6);
if (rval)
return rval;
 
-   return devm_regmap_field_bulk_alloc(dev, map, &wr_dmactl->bursten,
-   &v->wrdma_bursten, 6);
+   return devm_regmap_field_bulk_alloc(dev, map, &wr_dmactl->intf,
+   &v->wrdma_intf, 6);
 }
 
 static int lpass_platform_pcmops_open(struct snd_soc_component *component,
diff --git a/sound/soc/qcom/lpass.h b/sound/soc/qcom/lpass.h
index 51c9991..7089d4c 100644
--- a/sound/soc/qcom/lpass.h
+++ b/sound/soc/qcom/lpass.h
@@ -31,9 +31,9 @@ struct lpaif_i2sctl {
 
 
 struct lpaif_dmactl {
+   struct regmap_field *intf;
struct regmap_field *bursten;
struct regmap_field *wpscnt;
-   struct regmap_field *intf;
struct regmap_field *fifowm;
struct regmap_field *enable;
struct regmap_field *dyncclk;
@@ -110,17 +110,17 @@ struct lpass_variant {
struct reg_field bitwidth;
 
/* RD_DMA Register fields */
+   struct reg_field rdma_intf;
struct reg_field rdma_bursten;
struct reg_field rdma_wpscnt;
-   struct reg_field rdma_intf;
struct reg_field rdma_fifowm;
struct reg_field rdma_enable;
struct reg_field rdma_dyncclk;
 
/* WR_DMA Register fields */
+   struct reg_field wrdma_intf;
struct reg_field wrdma_bursten;
struct reg_field wrdma_wpscnt;
-   struct reg_field wrdma_intf;
struct reg_field wrdma_fifowm;
struct reg_field wrdma_enable;
struct reg_field wrdma_dyncclk;
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH v8 2/7] ASoC: dt-bindings: Add dt binding for lpass hdmi

2020-09-29 Thread Srinivasa Rao Mandadapu
From: V Sujith Kumar Reddy 

Adds bindings for lpass hdmi interface
which can support audio path over dp.

Signed-off-by: V Sujith Kumar Reddy 
Reviewed-by: Rob Herring 
Signed-off-by: Srinivasa Rao 
---
 .../devicetree/bindings/sound/qcom,lpass-cpu.yaml  | 74 +++---
 1 file changed, 52 insertions(+), 22 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/qcom,lpass-cpu.yaml 
b/Documentation/devicetree/bindings/sound/qcom,lpass-cpu.yaml
index 09c9bd2..f6f9fb4 100644
--- a/Documentation/devicetree/bindings/sound/qcom,lpass-cpu.yaml
+++ b/Documentation/devicetree/bindings/sound/qcom,lpass-cpu.yaml
@@ -24,9 +24,10 @@ properties:
   - qcom,sc7180-lpass-cpu
 
   reg:
-maxItems: 1
+maxItems: 2
 description: LPAIF core registers
-
+  reg-names:
+ maxItems: 2
   clocks:
 minItems: 3
 maxItems: 6
@@ -36,15 +37,16 @@ properties:
 maxItems: 6
 
   interrupts:
-maxItems: 1
+maxItems: 2
 description: LPAIF DMA buffer interrupt
-
+  interrupt-names:
+maxItems: 2
   qcom,adsp:
 $ref: /schemas/types.yaml#/definitions/phandle
 description: Phandle for the audio DSP node
 
   iommus:
-maxItems: 1
+maxItems: 2
 description: Phandle to apps_smmu node with sid mask
 
   power-domains:
@@ -60,10 +62,12 @@ properties:
 const: 0
 
 patternProperties:
-  "(^mi2s-[0-9a-f]$|mi2s)":
+  "^dai-link@[0-9a-f]$":
 type: object
-description: Required properties for each DAI
-
+description: |
+  LPASS CPU dai node for each I2S device. Bindings of each node
+  depends on the specific driver providing the functionality and
+  properties.
 properties:
   reg:
 maxItems: 1
@@ -85,9 +89,11 @@ patternProperties:
 required:
   - compatible
   - reg
+  - reg-names
   - clocks
   - clock-names
   - interrupts
+  - interrupt-names
   - '#sound-dai-cells'
 
 additionalProperties: false
@@ -134,13 +140,32 @@ allOf:
 then:
   properties:
 clock-names:
-  items:
-- const: pcnoc-sway-clk
-- const: audio-core
-- const: mclk0
-- const: pcnoc-mport-clk
-- const: mi2s-bit-clk0
-- const: mi2s-bit-clk1
+  oneOf:
+   - items:   #for I2S
+  - const: pcnoc-sway-clk
+  - const: audio-core
+  - const: mclk0
+  - const: pcnoc-mport-clk
+  - const: mi2s-bit-clk0
+  - const: mi2s-bit-clk1
+   - items:   #for HDMI
+  - const: pcnoc-sway-clk
+  - const: audio-core
+  - const: pcnoc-mport-clk
+reg-names:
+  anyOf:
+- items:   #for I2S
+  - const: lpass-lpaif
+- items:   #for I2S and HDMI
+  - const: lpass-hdmiif
+  - const: lpass-lpaif
+interrupt-names:
+  anyOf:
+- items:   #for I2S
+  - const: lpass-irq-lpaif
+- items:   #for I2S and HDMI
+  - const: lpass-irq-lpaif
+  - const: lpass-irq-hdmi
   required:
 - iommus
 - power-domains
@@ -152,12 +177,15 @@ examples:
 soc {
 #address-cells = <2>;
 #size-cells = <2>;
-lpass@62f0 {
+lpass@62d8 {
 compatible = "qcom,sc7180-lpass-cpu";
 
-reg = <0 0x62f0  0 0x29000>;
-
-iommus = <&apps_smmu 0x1020 0>;
+reg = <0 0x62d87000 0 0x68000>,
+  <0 0x62f0 0 0x29000>;
+reg-names = "lpass-hdmiif",
+"lpass-lpaif";
+iommus = <&apps_smmu 0x1020 0>,
+ <&apps_smmu 0x1032 0>;
 power-domains = <&lpass_hm 0>;
 
 clocks = <&gcc 131>,
@@ -171,14 +199,16 @@ examples:
   "mclk0", "pcnoc-mport-clk",
   "mi2s-bit-clk0", "mi2s-bit-clk1";
 
-interrupts = <0 160 1>;
-
+interrupts = <0 160 1>,
+ <0 268 1>;
+interrupt-names = "lpass-irq-lpaif",
+  "lpass-irq-hdmi";
 #sound-dai-cells = <1>;
 
 #address-cells = <1>;
 #size-cells = <0>;
 /* Optional to set different MI2S SD lines */
-mi2s-primary@0 {
+dai-link@0 {
 reg = ;
 qcom,playback-sd-lines = <1>;
 qcom,capture-sd-lines = <0>;
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH v8 5/7] ASoC: qcom: Add support for lpass hdmi driver

2020-09-29 Thread Srinivasa Rao Mandadapu
From: V Sujith Kumar Reddy 

Upadate lpass cpu and platform driver to support audio over dp.
Also add lpass-hdmi.c and lpass-hdmi.h.

Signed-off-by: V Sujith Kumar Reddy 
Signed-off-by: Srinivasa Rao 
---
 sound/soc/qcom/Kconfig   |   5 +
 sound/soc/qcom/Makefile  |   2 +
 sound/soc/qcom/lpass-apq8016.c   |   4 +-
 sound/soc/qcom/lpass-cpu.c   |  51 -
 sound/soc/qcom/lpass-hdmi.c  | 470 +++
 sound/soc/qcom/lpass-hdmi.h  | 122 ++
 sound/soc/qcom/lpass-ipq806x.c   |   4 +-
 sound/soc/qcom/lpass-lpaif-reg.h |  52 -
 sound/soc/qcom/lpass-platform.c  | 391 ++--
 sound/soc/qcom/lpass.h   | 113 +-
 10 files changed, 1115 insertions(+), 99 deletions(-)
 create mode 100644 sound/soc/qcom/lpass-hdmi.c
 create mode 100644 sound/soc/qcom/lpass-hdmi.h

diff --git a/sound/soc/qcom/Kconfig b/sound/soc/qcom/Kconfig
index a7ef626..28e775f 100644
--- a/sound/soc/qcom/Kconfig
+++ b/sound/soc/qcom/Kconfig
@@ -12,6 +12,10 @@ config SND_SOC_LPASS_CPU
tristate
select REGMAP_MMIO
 
+config SND_SOC_LPASS_HDMI
+   tristate
+   select REGMAP_MMIO
+
 config SND_SOC_LPASS_PLATFORM
tristate
select REGMAP_MMIO
@@ -30,6 +34,7 @@ config SND_SOC_LPASS_SC7180
tristate
select SND_SOC_LPASS_CPU
select SND_SOC_LPASS_PLATFORM
+   select SND_SOC_LPASS_HDMI
 
 config SND_SOC_STORM
tristate "ASoC I2S support for Storm boards"
diff --git a/sound/soc/qcom/Makefile b/sound/soc/qcom/Makefile
index 7972c94..0bd90d7 100644
--- a/sound/soc/qcom/Makefile
+++ b/sound/soc/qcom/Makefile
@@ -1,12 +1,14 @@
 # SPDX-License-Identifier: GPL-2.0
 # Platform
 snd-soc-lpass-cpu-objs := lpass-cpu.o
+snd-soc-lpass-hdmi-objs := lpass-hdmi.o
 snd-soc-lpass-platform-objs := lpass-platform.o
 snd-soc-lpass-ipq806x-objs := lpass-ipq806x.o
 snd-soc-lpass-apq8016-objs := lpass-apq8016.o
 snd-soc-lpass-sc7180-objs := lpass-sc7180.o
 
 obj-$(CONFIG_SND_SOC_LPASS_CPU) += snd-soc-lpass-cpu.o
+obj-$(CONFIG_SND_SOC_LPASS_HDMI) += snd-soc-lpass-hdmi.o
 obj-$(CONFIG_SND_SOC_LPASS_PLATFORM) += snd-soc-lpass-platform.o
 obj-$(CONFIG_SND_SOC_LPASS_IPQ806X) += snd-soc-lpass-ipq806x.o
 obj-$(CONFIG_SND_SOC_LPASS_APQ8016) += snd-soc-lpass-apq8016.o
diff --git a/sound/soc/qcom/lpass-apq8016.c b/sound/soc/qcom/lpass-apq8016.c
index 5c8ae22..0aedb3a 100644
--- a/sound/soc/qcom/lpass-apq8016.c
+++ b/sound/soc/qcom/lpass-apq8016.c
@@ -125,7 +125,7 @@ static struct snd_soc_dai_driver 
apq8016_lpass_cpu_dai_driver[] = {
 };
 
 static int apq8016_lpass_alloc_dma_channel(struct lpass_data *drvdata,
-  int direction)
+  int direction, unsigned int dai_id)
 {
struct lpass_variant *v = drvdata->variant;
int chan = 0;
@@ -151,7 +151,7 @@ static int apq8016_lpass_alloc_dma_channel(struct 
lpass_data *drvdata,
return chan;
 }
 
-static int apq8016_lpass_free_dma_channel(struct lpass_data *drvdata, int chan)
+static int apq8016_lpass_free_dma_channel(struct lpass_data *drvdata, int 
chan, unsigned int dai_id)
 {
clear_bit(chan, &drvdata->dma_ch_bit_map);
 
diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
index 12950d2..b6d243e 100644
--- a/sound/soc/qcom/lpass-cpu.c
+++ b/sound/soc/qcom/lpass-cpu.c
@@ -535,13 +535,17 @@ static void of_lpass_cpu_parse_dai_data(struct device 
*dev,
dev_err(dev, "valid dai id not found: %d\n", ret);
continue;
}
-
-   data->mi2s_playback_sd_mode[id] =
-   of_lpass_cpu_parse_sd_lines(dev, node,
-   "qcom,playback-sd-lines");
-   data->mi2s_capture_sd_mode[id] =
-   of_lpass_cpu_parse_sd_lines(dev, node,
+   if (id == LPASS_DP_RX) {
+   data->hdmi_port_enable = 1;
+   dev_err(dev, "HDMI Port is enabled: %d\n", id);
+   } else {
+   data->mi2s_playback_sd_mode[id] =
+   of_lpass_cpu_parse_sd_lines(dev, node,
+   
"qcom,playback-sd-lines");
+   data->mi2s_capture_sd_mode[id] =
+   of_lpass_cpu_parse_sd_lines(dev, node,
"qcom,capture-sd-lines");
+   }
}
 }
 
@@ -596,6 +600,27 @@ int asoc_qcom_lpass_cpu_platform_probe(struct 
platform_device *pdev)
return PTR_ERR(drvdata->lpaif_map);
}
 
+   if (drvdata->hdmi_port_enable) {
+   res = platform_get_resource_byname(pdev, IORESOURCE_MEM, 
"lpass-hdmiif");
+
+   drvdata->hdmiif = devm_ioremap_resource(dev, res);
+   if (IS_ERR((void const __force *)drvdata->hdmiif)) {
+   

[PATCH v8 7/7] ASoC: qcom: sc7180: Add support for audio over DP

2020-09-29 Thread Srinivasa Rao Mandadapu
From: V Sujith Kumar Reddy 

Add support for audio playback over DP in lpass
sc7180 platform driver. Update lpass_variant
structure for hdmi data configuaration.

Signed-off-by: V Sujith Kumar Reddy 
Signed-off-by: Srinivasa Rao 
---
 sound/soc/qcom/lpass-sc7180.c | 116 +-
 1 file changed, 102 insertions(+), 14 deletions(-)

diff --git a/sound/soc/qcom/lpass-sc7180.c b/sound/soc/qcom/lpass-sc7180.c
index a8a3d8f..c6292f9e 100644
--- a/sound/soc/qcom/lpass-sc7180.c
+++ b/sound/soc/qcom/lpass-sc7180.c
@@ -60,38 +60,65 @@ static struct snd_soc_dai_driver 
sc7180_lpass_cpu_dai_driver[] = {
.probe  = &asoc_qcom_lpass_cpu_dai_probe,
.ops= &asoc_qcom_lpass_cpu_dai_ops,
},
+   [LPASS_DP_RX] = {
+   .id = LPASS_DP_RX,
+   .name = "Hdmi",
+   .playback = {
+   .stream_name = "Hdmi Playback",
+   .formats= SNDRV_PCM_FMTBIT_S24,
+   .rates = SNDRV_PCM_RATE_48000,
+   .rate_min   = 48000,
+   .rate_max   = 48000,
+   .channels_min   = 2,
+   .channels_max   = 2,
+   },
+   .ops= &asoc_qcom_lpass_hdmi_dai_ops,
+   },
 };
 
 static int sc7180_lpass_alloc_dma_channel(struct lpass_data *drvdata,
-  int direction)
+  int direction, unsigned int dai_id)
 {
struct lpass_variant *v = drvdata->variant;
int chan = 0;
 
-   if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
-   chan = find_first_zero_bit(&drvdata->dma_ch_bit_map,
-   v->rdma_channels);
+   if (dai_id == LPASS_DP_RX) {
+   if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+   chan = 
find_first_zero_bit(&drvdata->hdmi_dma_ch_bit_map,
+   v->hdmi_rdma_channels);
+
+   if (chan >= v->hdmi_rdma_channels)
+   return -EBUSY;
+   }
+   set_bit(chan, &drvdata->hdmi_dma_ch_bit_map);
+   } else {
+   if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+   chan = find_first_zero_bit(&drvdata->dma_ch_bit_map,
+   v->rdma_channels);
 
if (chan >= v->rdma_channels)
return -EBUSY;
-   } else {
-   chan = find_next_zero_bit(&drvdata->dma_ch_bit_map,
+   } else {
+   chan = find_next_zero_bit(&drvdata->dma_ch_bit_map,
v->wrdma_channel_start +
v->wrdma_channels,
v->wrdma_channel_start);
 
-   if (chan >=  v->wrdma_channel_start + v->wrdma_channels)
-   return -EBUSY;
-   }
-
-   set_bit(chan, &drvdata->dma_ch_bit_map);
+   if (chan >=  v->wrdma_channel_start + v->wrdma_channels)
+   return -EBUSY;
+   }
 
+   set_bit(chan, &drvdata->dma_ch_bit_map);
+   }
return chan;
 }
 
-static int sc7180_lpass_free_dma_channel(struct lpass_data *drvdata, int chan)
+static int sc7180_lpass_free_dma_channel(struct lpass_data *drvdata, int chan, 
unsigned int dai_id)
 {
-   clear_bit(chan, &drvdata->dma_ch_bit_map);
+   if (dai_id == LPASS_DP_RX)
+   clear_bit(chan, &drvdata->hdmi_dma_ch_bit_map);
+   else
+   clear_bit(chan, &drvdata->dma_ch_bit_map);
 
return 0;
 }
@@ -144,6 +171,9 @@ static struct lpass_variant sc7180_data = {
.rdma_reg_base  = 0xC000,
.rdma_reg_stride= 0x1000,
.rdma_channels  = 5,
+   .hdmi_rdma_reg_base = 0x64000,
+   .hdmi_rdma_reg_stride   = 0x1000,
+   .hdmi_rdma_channels = 4,
.dmactl_audif_start = 1,
.wrdma_reg_base = 0x18000,
.wrdma_reg_stride   = 0x1000,
@@ -163,7 +193,7 @@ static struct lpass_variant sc7180_data = {
.rdma_dyncclk   = REG_FIELD_ID(0xC000, 21, 21, 5, 0x1000),
.rdma_bursten   = REG_FIELD_ID(0xC000, 20, 20, 5, 0x1000),
.rdma_wpscnt= REG_FIELD_ID(0xC000, 16, 19, 5, 0x1000),
-   .rdma_intf  = REG_FIELD_ID(0xC000, 12, 15, 5, 0x1000),
+   .rdma_intf  = REG_FIELD_ID(0xC000, 12, 15, 5, 
0x1000),
.rdma_fifowm= REG_FIELD_ID(0xC000, 1, 5, 5, 0x1000),
.rdma_enable= REG_FIELD_ID(0xC000, 0, 0, 5, 0x1000),
 
@@ -174,6 +204,64 @@ static struct lpass_variant sc7180_data = {
.wrdma_fifowm   = REG_FIELD_ID(0x18000, 1, 5, 4, 0x1000),
.wrdma_enable   = REG_FI

[PATCH v8 3/7] Asoc:qcom:lpass-cpu:Update dts property read API

2020-09-29 Thread Srinivasa Rao Mandadapu
From: V Sujith Kumar Reddy 

Update dts property read API call with platform get property
by name, as it make code more readable and avoid conflicts
when array of properties to be used.

Signed-off-by: V Sujith Kumar Reddy 
Reviewed-by: Srinivas Kandagatla 
Signed-off-by: Srinivasa Rao 
---
 sound/soc/qcom/lpass-cpu.c  | 2 +-
 sound/soc/qcom/lpass-platform.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
index 0718a0f..12950d2 100644
--- a/sound/soc/qcom/lpass-cpu.c
+++ b/sound/soc/qcom/lpass-cpu.c
@@ -575,7 +575,7 @@ int asoc_qcom_lpass_cpu_platform_probe(struct 
platform_device *pdev)
 
of_lpass_cpu_parse_dai_data(dev, drvdata);
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+   res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "lpass-lpaif");
 
drvdata->lpaif = devm_ioremap_resource(dev, res);
if (IS_ERR((void const __force *)drvdata->lpaif)) {
diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c
index 7ac2629..e7cf4e5 100644
--- a/sound/soc/qcom/lpass-platform.c
+++ b/sound/soc/qcom/lpass-platform.c
@@ -621,7 +621,7 @@ int asoc_qcom_lpass_platform_register(struct 
platform_device *pdev)
struct lpass_variant *v = drvdata->variant;
int ret;
 
-   drvdata->lpaif_irq = platform_get_irq(pdev, 0);
+   drvdata->lpaif_irq = platform_get_irq_byname(pdev, "lpass-irq-lpaif");
if (drvdata->lpaif_irq < 0)
return -ENODEV;
 
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH v8 6/7] Asoc: qcom: lpass-platform : Increase buffer size

2020-09-29 Thread Srinivasa Rao Mandadapu
From: V Sujith Kumar Reddy 

Increase buffer size to support audio over DP.

Signed-off-by: V Sujith Kumar Reddy 
Signed-off-by: Srinivasa Rao Mandadapu 
---
 sound/soc/qcom/lpass-platform.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c
index a5ab5f1..92ccedb 100644
--- a/sound/soc/qcom/lpass-platform.c
+++ b/sound/soc/qcom/lpass-platform.c
@@ -23,7 +23,7 @@ struct lpass_pcm_data {
int i2s_port;
 };
 
-#define LPASS_PLATFORM_BUFFER_SIZE (16 * 1024)
+#define LPASS_PLATFORM_BUFFER_SIZE (24 *  2 * 1024)
 #define LPASS_PLATFORM_PERIODS 2
 
 static const struct snd_pcm_hardware lpass_platform_pcm_hardware = {
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



[PATCH v8 1/7] ASoC: Add sc7180-lpass binding header hdmi define

2020-09-29 Thread Srinivasa Rao Mandadapu
From: V Sujith Kumar Reddy 

Add header defining hdmi dai-id for SC7180 lpass soc
in dt bindings.

Signed-off-by: V Sujith Kumar Reddy 
Acked-by: Rob Herring 
Signed-off-by: Srinivasa Rao 
---
 include/dt-bindings/sound/sc7180-lpass.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/dt-bindings/sound/sc7180-lpass.h 
b/include/dt-bindings/sound/sc7180-lpass.h
index 7d988f6..56ecaaf 100644
--- a/include/dt-bindings/sound/sc7180-lpass.h
+++ b/include/dt-bindings/sound/sc7180-lpass.h
@@ -4,6 +4,7 @@
 
 #define MI2S_PRIMARY   0
 #define MI2S_SECONDARY 1
+#define LPASS_DP_RX2
 
 #define LPASS_MCLK00
 
-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.



  1   2   >