This patch adds support of AFE DAI for PCM port.
Signed-off-by: Adam Serbinski <adam@xxxxxxxxxxxxx>
CC: Andy Gross <agross@xxxxxxxxxx>
CC: Mark Rutland <mark.rutland@xxxxxxx>
CC: Liam Girdwood <lgirdwood@xxxxxxxxx>
CC: Patrick Lai <plai@xxxxxxxxxxxxxx>
CC: Banajit Goswami <bgoswami@xxxxxxxxxxxxxx>
CC: Jaroslav Kysela <perex@xxxxxxxx>
CC: Takashi Iwai <tiwai@xxxxxxxx>
CC: alsa-devel@xxxxxxxxxxxxxxxx
CC: linux-arm-msm@xxxxxxxxxxxxxxx
CC: devicetree@xxxxxxxxxxxxxxx
CC: linux-kernel@xxxxxxxxxxxxxxx
---
sound/soc/qcom/qdsp6/q6afe-dai.c | 198 ++++++++++++++++++++++++++++++-
1 file changed, 197 insertions(+), 1 deletion(-)
diff --git a/sound/soc/qcom/qdsp6/q6afe-dai.c b/sound/soc/qcom/qdsp6/q6afe-dai.c
index c1a7624eaf17..23b29591ef47 100644
--- a/sound/soc/qcom/qdsp6/q6afe-dai.c
+++ b/sound/soc/qcom/qdsp6/q6afe-dai.c
+static int q6afe_tdm_set_sysclk(struct snd_soc_dai *dai,
+ int clk_id, unsigned int freq, int dir)
+{
+ struct q6afe_dai_data *dai_data = dev_get_drvdata(dai->dev);
+ struct q6afe_port *port = dai_data->port[dai->id];
+
+ switch (clk_id) {
+ case LPAIF_DIG_CLK:
+ return q6afe_port_set_sysclk(port, clk_id, 0, 5, freq, dir);
+ case LPAIF_BIT_CLK:
+ case LPAIF_OSR_CLK:
+ return q6afe_port_set_sysclk(port, clk_id,
+ Q6AFE_LPASS_CLK_SRC_INTERNAL,
+ Q6AFE_LPASS_CLK_ROOT_DEFAULT,
+ freq, dir);
case Q6AFE_LPASS_CLK_ID_PRI_TDM_IBIT ... Q6AFE_LPASS_CLK_ID_QUIN_TDM_EBIT:
return q6afe_port_set_sysclk(port, clk_id,
Q6AFE_LPASS_CLK_ATTRIBUTE_INVERT_COUPLE_NO,
@@ -468,6 +520,11 @@ static const struct snd_soc_dapm_route q6afe_dapm_routes[] = {
{"Tertiary MI2S Playback", NULL, "TERT_MI2S_RX"},
{"Quaternary MI2S Playback", NULL, "QUAT_MI2S_RX"},
+ {"Primary PCM Playback", NULL, "PRI_PCM_RX"},
+ {"Secondary PCM Playback", NULL, "SEC_PCM_RX"},
+ {"Tertiary PCM Playback", NULL, "TERT_PCM_RX"},
+ {"Quaternary PCM Playback", NULL, "QUAT_PCM_RX"},
+
{"Primary TDM0 Playback", NULL, "PRIMARY_TDM_RX_0"},
{"Primary TDM1 Playback", NULL, "PRIMARY_TDM_RX_1"},
{"Primary TDM2 Playback", NULL, "PRIMARY_TDM_RX_2"},
@@ -562,6 +619,11 @@ static const struct snd_soc_dapm_route q6afe_dapm_routes[] = {
{"PRI_MI2S_TX", NULL, "Primary MI2S Capture"},
{"SEC_MI2S_TX", NULL, "Secondary MI2S Capture"},
{"QUAT_MI2S_TX", NULL, "Quaternary MI2S Capture"},
+
+ {"PRI_PCM_TX", NULL, "Primary PCM Capture"},
+ {"SEC_PCM_TX", NULL, "Secondary PCM Capture"},
+ {"TERT_PCM_TX", NULL, "Tertiary PCM Capture"},
+ {"QUAT_PCM_TX", NULL, "Quaternary PCM Capture"},
};
+ SND_SOC_DAPM_AIF_IN("QUAT_PCM_RX", NULL,
+ 0, 0, 0, 0),
+ SND_SOC_DAPM_AIF_OUT("QUAT_PCM_TX", NULL,
+ 0, 0, 0, 0),
+ SND_SOC_DAPM_AIF_IN("TERT_PCM_RX", NULL,
+ 0, 0, 0, 0),
+ SND_SOC_DAPM_AIF_OUT("TERT_PCM_TX", NULL,
+ 0, 0, 0, 0),
+ SND_SOC_DAPM_AIF_IN("SEC_PCM_RX", NULL,
+ 0, 0, 0, 0),
+ SND_SOC_DAPM_AIF_OUT("SEC_PCM_TX", NULL,
+ 0, 0, 0, 0),
+ SND_SOC_DAPM_AIF_IN("PRI_PCM_RX", NULL,
+ 0, 0, 0, 0),
+ SND_SOC_DAPM_AIF_OUT("PRI_PCM_TX", NULL,
+ 0, 0, 0, 0),
+