Skip to contentSkip to conversation

Qualcomm's lpass device tree changes for I2s dai

PATCH Superseded Srinivasa Rao Mandadapu 2 participants 8 messages Mar 11, 2021 – Mar 12, 2021

Subsystems (4)

v4 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v4 cover Qualcomm's lpass device tree changes for I2s dai

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(+)
Signature · 2 lines
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
#1 lore raw

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

From: Ajit Pandey <[email protected]>

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

---
 arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi | 58 ++++++++++++++++++++
 1 file changed, 58 insertions(+)
arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi +58 -0
index 436582279dad..501e3d4c9097 100644
@@ -9,6 +9,7 @@
 #include <dt-bindings/input/gpio-keys.h>
 #include <dt-bindings/input/input.h>
 #include <dt-bindings/regulator/qcom,rpmh-regulator.h>
+#include <dt-bindings/sound/qcom,lpass.h>
 
 /* 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 = <MI2S_PRIMARY>;
+			cpu {
+				sound-dai = <&lpass_cpu MI2S_PRIMARY>;
+			};
+
+			codec {
+				sound-dai = <&alc5682 MI2S_PRIMARY>;
+			};
+		};
+
+		dai-link@1 {
+			link-name = "MultiMedia1";
+			reg = <MI2S_SECONDARY>;
+			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 = <MI2S_PRIMARY>;
+		qcom,playback-sd-lines = <1>;
+		qcom,capture-sd-lines = <0>;
+	};
+
+	mi2s-secondary@1 {
+		reg = <MI2S_SECONDARY>;
+		qcom,playback-sd-lines = <0>;
+	};
+};
+
 &mdp {
 	status = "okay";
 };
Signature · 2 lines
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
#2 lore raw

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

Hi,

Quoted 20 lines · Srinivasa Rao Mandadapu

From: Ajit Pandey <[email protected]>

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

---
 arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi | 58 ++++++++++++++++++++
 1 file changed, 58 insertions(+)
arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi +0 -0
index 436582279dad..501e3d4c9097 100644

arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi line 12

Quoted 4 lines
arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi +1 -0
@@ -9,6 +9,7 @@
 #include <dt-bindings/input/gpio-keys.h>
 #include <dt-bindings/input/input.h>
 #include <dt-bindings/regulator/qcom,rpmh-regulator.h>
+#include <dt-bindings/sound/qcom,lpass.h>

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?

Quoted 17 lines
arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi +11 -0
 /* 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>;

arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi keyboard_backlight: keyboard-backlight { · line 307

Quoted 10 lines
arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi +10 -0
+
+               dai-link@0 {
+                       link-name = "MultiMedia0";
+                       reg = <MI2S_PRIMARY>;
+                       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...

-Doug

#3 lore raw

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

Hi Doug,

Thanks for your time!!!

Quoted 18 lines · Doug Anderson

Hi,

Quoted 14 lines · Srinivasa Rao Mandadapu

From: Ajit Pandey <[email protected]>

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

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

arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi line 12

Quoted 9 lines
arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi +1 -0
index 436582279dad..501e3d4c9097 100644
@@ -9,6 +9,7 @@
  #include <dt-bindings/input/gpio-keys.h>
  #include <dt-bindings/input/input.h>
  #include <dt-bindings/regulator/qcom,rpmh-regulator.h>
+#include <dt-bindings/sound/qcom,lpass.h>

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:

Quoted 32 lines
Quoted 19 lines
arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi +11 -0
  /* 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>;

arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi keyboard_backlight: keyboard-backlight { · line 307

Quoted 10 lines
arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi +10 -0
+
+               dai-link@0 {
+                       link-name = "MultiMedia0";
+                       reg = <MI2S_PRIMARY>;
+                       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" ?

Quoted 3 lines

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.

Quoted 2 lines

-Doug

Signature · 2 lines
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
#4 lore raw

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

Hi Doug,

Quoted 79 lines · Srinivasa Rao Mandadapu

Hi Doug,

Thanks for your time!!!

Quoted 19 lines · Doug Anderson

Hi,

Quoted 15 lines · Srinivasa Rao Mandadapu

From: Ajit Pandey <[email protected]>

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

---
  arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi | 58
++++++++++++++++++++

  1 file changed, 58 insertions(+)
Quoted 13 lines

arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi line 12

Quoted 9 lines
arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi +1 -0
index 436582279dad..501e3d4c9097 100644
@@ -9,6 +9,7 @@
   #include <dt-bindings/input/gpio-keys.h>
   #include <dt-bindings/input/input.h>
   #include <dt-bindings/regulator/qcom,rpmh-regulator.h>
+#include <dt-bindings/sound/qcom,lpass.h>

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:

Quoted 32 lines
Quoted 19 lines
arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi +11 -0
   /* 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>;

arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi keyboard_backlight: keyboard-backlight { · line 307

Quoted 10 lines
arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi +10 -0
+
+               dai-link@0 {
+                       link-name = "MultiMedia0";
+                       reg = <MI2S_PRIMARY>;
+                       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" ?

Quoted 4 lines
Quoted 3 lines

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.

Quoted 3 lines
Quoted 2 lines

-Doug

Signature · 2 lines
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
#5 lore raw

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

In reply to Srinivasa Rao Mandadapu

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

---
 .../boot/dts/qcom/sc7180-trogdor-coachz.dtsi   | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi +18 -0
index 4ad520f00485..7623a30a64c7 100644
@@ -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>;
+		};
+	};
+};
Signature · 2 lines
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.,
is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.
#6 lore raw

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

Hi,

Quoted 14 lines · Srinivasa Rao Mandadapu

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

---
 .../boot/dts/qcom/sc7180-trogdor-coachz.dtsi   | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi +0 -0
index 4ad520f00485..7623a30a64c7 100644

arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi &tlmm { · line 243

Quoted 6 lines
arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi +3 -0
@@ -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.

arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi &tlmm { · line 251

Quoted 8 lines
arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi +8 -0
+       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?

arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi &tlmm { · line 257

Quoted 6 lines
arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi +6 -0
+               };
+
+               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 = <MI2S_PRIMARY>;

  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 = <MI2S_PRIMARY>;

  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 = <MI2S_PRIMARY>;

  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>;
};

#7 lore raw

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

Hi Doug,

Thanks for time and valuable inputs!!!

Quoted 36 lines · Doug Anderson

Hi,

Quoted 13 lines · Srinivasa Rao Mandadapu

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

---
  .../boot/dts/qcom/sc7180-trogdor-coachz.dtsi   | 18 ++++++++++++++++++
  1 file changed, 18 insertions(+)
arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi +0 -0
index 4ad520f00485..7623a30a64c7 100644

arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi &tlmm { · line 243

Quoted 6 lines
arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi +3 -0
@@ -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.

arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi &tlmm { · line 251

Quoted 8 lines
arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi +8 -0
+       model = "sc7180-adau7002-max98357a";
+       audio-routing = "PDM_DAT", "DMIC";
+
+       dai-link@0 {
+               link-name = "MultiMedia0";
+               reg = <0>;
+               cpu {
+                       sound-dai = <&lpass_cpu 0>;
Quoted 1 line

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

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

Quoted 68 lines

arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi &tlmm { · line 257

Quoted 8 lines
arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi +6 -0
+               };
+
+               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 = <MI2S_PRIMARY>;
   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 = <MI2S_PRIMARY>;
   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 = <MI2S_PRIMARY>;
   cpu {
     sound-dai = <&lpass_cpu MI2S_PRIMARY>;
   };

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

...and then in coachz you override like:

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

Okay. Will change accordingly and re-post.

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