Skip to content

Commit

Permalink
arm64: dts: qcom: msm8916-samsung-a2015: Add sound and modem
Browse files Browse the repository at this point in the history
Enable sound and modem for the Samsung A2015 based devices (A3, A5, E5,
E7, Grand Max). The setup is similar to most MSM8916 devices, i.e.:

 - QDSP6 audio
 - Earpiece/headphones/microphones via digital/analog codec in
   MSM8916/PM8916
 - WWAN Internet via BAM-DMUX

except:

 - NXP TFA9895 codec for speaker on Quaternary MI2S
 - Samsung-specific audio jack detection (not supported yet)

[Lin: Add e2015 and grandmax]

Co-developed-by: "Lin, Meng-Bo" <[email protected]>
Signed-off-by: "Lin, Meng-Bo" <[email protected]>
Signed-off-by: Stephan Gerhold <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Bjorn Andersson <[email protected]>
  • Loading branch information
stephan-gh authored and andersson committed Oct 21, 2023
1 parent 8abbd23 commit f276411
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 0 deletions.
71 changes: 71 additions & 0 deletions arch/arm64/boot/dts/qcom/msm8916-samsung-a2015-common.dtsi
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
// SPDX-License-Identifier: GPL-2.0-only

#include "msm8916-pm8916.dtsi"
#include "msm8916-modem-qdsp6.dtsi"

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/interrupt-controller/irq.h>
#include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
#include <dt-bindings/sound/apq8016-lpass.h>

/ {
aliases {
Expand Down Expand Up @@ -196,6 +199,18 @@
};
};

&blsp_i2c1 {
status = "okay";

speaker_codec: audio-codec@34 {
compatible = "nxp,tfa9895";
reg = <0x34>;
vddd-supply = <&pm8916_l5>;
sound-name-prefix = "Speaker";
#sound-dai-cells = <0>;
};
};

&blsp_i2c2 {
status = "okay";

Expand Down Expand Up @@ -243,6 +258,25 @@
status = "okay";
};

/*
* For some reason the speaker amplifier is connected to the second SD line
* (MI2S_2_D1) instead of the first (MI2S_2_D0). This must be configured in the
* device tree, otherwise audio will seemingly play fine on the wrong SD line
* but the speaker stays silent.
*
* When routing audio via QDSP6 (the default) the &lpass node is reserved and
* the definitions from &q6afedai are used. When the modem is disabled audio can
* be alternatively routed directly to the LPASS hardware with reduced latency.
* The definitions for &lpass are here for completeness to simplify changing the
* setup with minor changes to the DT (either manually or with DT overlays).
*/
&lpass {
dai-link@3 {
reg = <MI2S_QUATERNARY>;
qcom,playback-sd-lines = <1>;
};
};

&mdss {
status = "okay";
};
Expand All @@ -253,6 +287,10 @@
pinctrl-1 = <&mdss_sleep>;
};

&mpss_mem {
reg = <0x0 0x86800000 0x0 0x5400000>;
};

&pm8916_resin {
status = "okay";
linux,code = <KEY_VOLUMEDOWN>;
Expand All @@ -265,6 +303,13 @@
};
};

&q6afedai {
dai@22 {
reg = <QUATERNARY_MI2S_RX>;
qcom,sd-lines = <1>;
};
};

&sdhc_1 {
status = "okay";
};
Expand All @@ -279,6 +324,32 @@
cd-gpios = <&tlmm 38 GPIO_ACTIVE_LOW>;
};

&sound {
model = "samsung-a2015";
audio-routing =
"AMIC1", "MIC BIAS External1",
"AMIC2", "MIC BIAS Internal2",
"AMIC3", "MIC BIAS External1";

pinctrl-0 = <&cdc_pdm_default &sec_mi2s_default>;
pinctrl-1 = <&cdc_pdm_sleep &sec_mi2s_sleep>;
pinctrl-names = "default", "sleep";

sound_link_backend2: backend2-dai-link {
link-name = "Quaternary MI2S";

cpu {
sound-dai = <&q6afedai QUATERNARY_MI2S_RX>;
};
platform {
sound-dai = <&q6routing>;
};
codec {
sound-dai = <&speaker_codec>;
};
};
};

&usb {
status = "okay";
extcon = <&muic>, <&muic>;
Expand Down
4 changes: 4 additions & 0 deletions arch/arm64/boot/dts/qcom/msm8916-samsung-e2015-common.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@
};
};

&mpss_mem {
reg = <0x0 0x86800000 0x0 0x5a00000>;
};

&reg_motor_vdd {
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
Expand Down
4 changes: 4 additions & 0 deletions arch/arm64/boot/dts/qcom/msm8916-samsung-grandmax.dts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@
status = "disabled";
};

&sound {
model = "samsung-gmax"; /* No secondary microphone */
};

&tlmm {
gpio_leds_default: gpio-led-default-state {
pins = "gpio60";
Expand Down

0 comments on commit f276411

Please sign in to comment.