Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b5369025 authored by Aditya Bavanari's avatar Aditya Bavanari
Browse files

ASoC: msm: Add changes to enable TDM feature in APQ8017



Add kernel changes to enable Primary and Secondary
TDM feature in APQ8017 targets.

CRs-fixed: 1099364
Change-Id: If12e6c6940ea2b15895ec2214d0531726257a5e2
Signed-off-by: default avatarAditya Bavanari <abavanar@codeaurora.org>
parent 1a9a4414
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -329,5 +329,5 @@ int afe_send_custom_tdm_header_cfg(
	struct afe_param_id_custom_tdm_header_cfg *custom_tdm_header_cfg,
	u16 port_id);
int afe_tdm_port_start(u16 port_id, struct afe_tdm_port_config *tdm_port,
		u32 rate);
		u32 rate, u16 num_groups);
#endif /* __Q6AFE_V2_H__ */
+2 −2
Original line number Diff line number Diff line
/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -110,7 +110,7 @@ static struct snd_soc_dai_driver msm_fe_dais[] = {
				    SNDRV_PCM_FMTBIT_S24_LE |
				    SNDRV_PCM_FMTBIT_S24_3LE),
			.channels_min = 1,
			.channels_max = 4,
			.channels_max = 8,
			.rate_min =     8000,
			.rate_max =     48000,
		},
+148 −12
Original line number Diff line number Diff line
/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -60,6 +60,12 @@ static struct snd_soc_ops msm8952_slimbus_2_be_ops = {
	.hw_params = msm8952_slimbus_2_hw_params,
};

static struct snd_soc_ops msm_tdm_be_ops = {
	.startup = msm_tdm_startup,
	.hw_params = msm_tdm_snd_hw_params,
	.shutdown = msm_tdm_shutdown,
};

static struct snd_soc_dai_link msm8952_tasha_fe_dai[] = {
	/* tasha_vifeedback for speaker protection */
	{
@@ -1125,6 +1131,70 @@ static struct snd_soc_dai_link msm8952_common_fe_dai[] = {
	},
};

static struct snd_soc_dai_link msm8952_tdm_fe_dai[] = {
	/* FE TDM DAI links */
	{
		.name = "Primary TDM RX 0 Hostless",
		.stream_name = "Primary TDM RX 0 Hostless",
		.cpu_dai_name = "PRI_TDM_RX_0_HOSTLESS",
		.platform_name = "msm-pcm-hostless",
		.dynamic = 1,
		.dpcm_playback = 1,
		.trigger = {SND_SOC_DPCM_TRIGGER_POST,
			SND_SOC_DPCM_TRIGGER_POST},
		.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
		.ignore_suspend = 1,
		.ignore_pmdown_time = 1,
		.codec_dai_name = "snd-soc-dummy-dai",
		.codec_name = "snd-soc-dummy",
	},
	{
		.name = "Primary TDM TX 0 Hostless",
		.stream_name = "Primary TDM TX 0 Hostless",
		.cpu_dai_name = "PRI_TDM_TX_0_HOSTLESS",
		.platform_name = "msm-pcm-hostless",
		.dynamic = 1,
		.dpcm_capture = 1,
		.trigger = {SND_SOC_DPCM_TRIGGER_POST,
			SND_SOC_DPCM_TRIGGER_POST},
		.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
		.ignore_suspend = 1,
		.ignore_pmdown_time = 1,
		.codec_dai_name = "snd-soc-dummy-dai",
		.codec_name = "snd-soc-dummy",
	},
	{
		.name = "Secondary TDM RX 0 Hostless",
		.stream_name = "Secondary TDM RX 0 Hostless",
		.cpu_dai_name = "SEC_TDM_RX_0_HOSTLESS",
		.platform_name = "msm-pcm-hostless",
		.dynamic = 1,
		.dpcm_playback = 1,
		.trigger = {SND_SOC_DPCM_TRIGGER_POST,
			SND_SOC_DPCM_TRIGGER_POST},
		.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
		.ignore_suspend = 1,
		.ignore_pmdown_time = 1,
		.codec_dai_name = "snd-soc-dummy-dai",
		.codec_name = "snd-soc-dummy",
	},
	{
		.name = "Secondary TDM TX 0 Hostless",
		.stream_name = "Secondary TDM TX 0 Hostless",
		.cpu_dai_name = "SEC_TDM_TX_0_HOSTLESS",
		.platform_name = "msm-pcm-hostless",
		.dynamic = 1,
		.dpcm_capture = 1,
		.trigger = {SND_SOC_DPCM_TRIGGER_POST,
			SND_SOC_DPCM_TRIGGER_POST},
		.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
		.ignore_suspend = 1,
		.ignore_pmdown_time = 1,
		.codec_dai_name = "snd-soc-dummy-dai",
		.codec_name = "snd-soc-dummy",
	},
};

static struct snd_soc_dai_link msm8952_common_be_dai[] = {
	/* Backend I2S DAI Links */
	{
@@ -1341,6 +1411,63 @@ static struct snd_soc_dai_link msm8952_common_be_dai[] = {
		.ops = &msm8952_quin_mi2s_be_ops,
		.ignore_suspend = 1,
	},
	/* TDM be dai links */
	{
		.name = LPASS_BE_PRI_TDM_RX_0,
		.stream_name = "Primary TDM0 Playback",
		.cpu_dai_name = "msm-dai-q6-tdm.36864",
		.platform_name = "msm-pcm-routing",
		.codec_name = "msm-stub-codec.1",
		.codec_dai_name = "msm-stub-rx",
		.no_pcm = 1,
		.dpcm_playback = 1,
		.be_id = MSM_BACKEND_DAI_PRI_TDM_RX_0,
		.be_hw_params_fixup = msm_tdm_be_hw_params_fixup,
		.ops = &msm_tdm_be_ops,
		.ignore_suspend = 1,
	},
	{
		.name = LPASS_BE_PRI_TDM_TX_0,
		.stream_name = "Primary TDM0 Capture",
		.cpu_dai_name = "msm-dai-q6-tdm.36865",
		.platform_name = "msm-pcm-routing",
		.codec_name = "msm-stub-codec.1",
		.codec_dai_name = "msm-stub-tx",
		.no_pcm = 1,
		.dpcm_capture = 1,
		.be_id = MSM_BACKEND_DAI_PRI_TDM_TX_0,
		.be_hw_params_fixup = msm_tdm_be_hw_params_fixup,
		.ops = &msm_tdm_be_ops,
		.ignore_suspend = 1,
	},
	{
		.name = LPASS_BE_SEC_TDM_RX_0,
		.stream_name = "Secondary TDM0 Playback",
		.cpu_dai_name = "msm-dai-q6-tdm.36880",
		.platform_name = "msm-pcm-routing",
		.codec_name = "msm-stub-codec.1",
		.codec_dai_name = "msm-stub-rx",
		.no_pcm = 1,
		.dpcm_playback = 1,
		.be_id = MSM_BACKEND_DAI_SEC_TDM_RX_0,
		.be_hw_params_fixup = msm_tdm_be_hw_params_fixup,
		.ops = &msm_tdm_be_ops,
		.ignore_suspend = 1,
	},
	{
		.name = LPASS_BE_SEC_TDM_TX_0,
		.stream_name = "Secondary TDM0 Capture",
		.cpu_dai_name = "msm-dai-q6-tdm.36881",
		.platform_name = "msm-pcm-routing",
		.codec_name = "msm-stub-codec.1",
		.codec_dai_name = "msm-stub-tx",
		.no_pcm = 1,
		.dpcm_capture = 1,
		.be_id = MSM_BACKEND_DAI_SEC_TDM_TX_0,
		.be_hw_params_fixup = msm_tdm_be_hw_params_fixup,
		.ops = &msm_tdm_be_ops,
		.ignore_suspend = 1,
	},
};

static struct snd_soc_dai_link msm8952_hdmi_dba_dai_link[] = {
@@ -1389,6 +1516,7 @@ static struct snd_soc_codec_conf *msm895x_codec_conf;
static struct snd_soc_dai_link msm8952_tomtom_dai_links[
ARRAY_SIZE(msm8952_common_fe_dai) +
ARRAY_SIZE(msm8952_tomtom_fe_dai) +
ARRAY_SIZE(msm8952_tdm_fe_dai) +
ARRAY_SIZE(msm8952_common_be_dai) +
ARRAY_SIZE(msm8952_tomtom_be_dai) +
ARRAY_SIZE(msm8952_quin_dai_link)];
@@ -1396,6 +1524,7 @@ ARRAY_SIZE(msm8952_quin_dai_link)];
static struct snd_soc_dai_link msm8952_tasha_dai_links[
ARRAY_SIZE(msm8952_common_fe_dai) +
ARRAY_SIZE(msm8952_tasha_fe_dai) +
ARRAY_SIZE(msm8952_tdm_fe_dai) +
ARRAY_SIZE(msm8952_common_be_dai) +
ARRAY_SIZE(msm8952_tasha_be_dai) +
ARRAY_SIZE(msm8952_hdmi_dba_dai_link)];
@@ -1567,7 +1696,7 @@ struct snd_soc_card *populate_snd_card_dailinks(struct device *dev)
{
	struct snd_soc_card *card = &snd_soc_card_msm_card;
	struct snd_soc_dai_link *msm8952_dai_links = NULL;
	int num_links, ret, len1, len2, len3, len4 = 0;
	int num_links, ret, len1, len2, len3, len4, len5 = 0;
	enum codec_variant codec_ver = 0;
	const char *tasha_lite[NUM_OF_TASHA_LITE_DEVICE] = {
		"msm8952-tashalite-snd-card",
@@ -1585,7 +1714,9 @@ struct snd_soc_card *populate_snd_card_dailinks(struct device *dev)
	if (!strcmp(card->name, "msm8952-tomtom-snd-card")) {
		len1 = ARRAY_SIZE(msm8952_common_fe_dai);
		len2 = len1 + ARRAY_SIZE(msm8952_tomtom_fe_dai);
		len3 = len2 + ARRAY_SIZE(msm8952_common_be_dai);
		len3 = len2 + ARRAY_SIZE(msm8952_tdm_fe_dai);
		len4 = len3 + ARRAY_SIZE(msm8952_common_be_dai);
		len5 = len4 + ARRAY_SIZE(msm8952_tomtom_be_dai);
		snd_soc_card_msm[TOMTOM_CODEC].name = card->name;
		card = &snd_soc_card_msm[TOMTOM_CODEC];
		num_links = ARRAY_SIZE(msm8952_tomtom_dai_links);
@@ -1594,8 +1725,10 @@ struct snd_soc_card *populate_snd_card_dailinks(struct device *dev)
		memcpy(msm8952_tomtom_dai_links + len1,
			msm8952_tomtom_fe_dai, sizeof(msm8952_tomtom_fe_dai));
		memcpy(msm8952_tomtom_dai_links + len2,
			msm8952_common_be_dai, sizeof(msm8952_common_be_dai));
			msm8952_tdm_fe_dai, sizeof(msm8952_tdm_fe_dai));
		memcpy(msm8952_tomtom_dai_links + len3,
			msm8952_common_be_dai, sizeof(msm8952_common_be_dai));
		memcpy(msm8952_tomtom_dai_links + len4,
			msm8952_tomtom_be_dai, sizeof(msm8952_tomtom_be_dai));
		msm8952_dai_links = msm8952_tomtom_dai_links;
	} else if (strnstr(card->name, "tasha", strlen(card->name))) {
@@ -1609,7 +1742,9 @@ struct snd_soc_card *populate_snd_card_dailinks(struct device *dev)

		len1 = ARRAY_SIZE(msm8952_common_fe_dai);
		len2 = len1 + ARRAY_SIZE(msm8952_tasha_fe_dai);
		len3 = len2 + ARRAY_SIZE(msm8952_common_be_dai);
		len3 = len2 + ARRAY_SIZE(msm8952_tdm_fe_dai);
		len4 = len3 + ARRAY_SIZE(msm8952_common_be_dai);
		len5 = len4 + ARRAY_SIZE(msm8952_tasha_be_dai);
		snd_soc_card_msm[TASHA_CODEC].name = card->name;
		card = &snd_soc_card_msm[TASHA_CODEC];
		num_links = ARRAY_SIZE(msm8952_tasha_dai_links);
@@ -1618,27 +1753,28 @@ struct snd_soc_card *populate_snd_card_dailinks(struct device *dev)
		memcpy(msm8952_tasha_dai_links + len1,
			msm8952_tasha_fe_dai, sizeof(msm8952_tasha_fe_dai));
		memcpy(msm8952_tasha_dai_links + len2,
			msm8952_common_be_dai, sizeof(msm8952_common_be_dai));
			msm8952_tdm_fe_dai, sizeof(msm8952_tdm_fe_dai));
		memcpy(msm8952_tasha_dai_links + len3,
			msm8952_common_be_dai, sizeof(msm8952_common_be_dai));
		memcpy(msm8952_tasha_dai_links + len4,
			msm8952_tasha_be_dai, sizeof(msm8952_tasha_be_dai));
		msm8952_dai_links = msm8952_tasha_dai_links;
		len4 = len3 + ARRAY_SIZE(msm8952_tasha_be_dai);
	}
	if (of_property_read_bool(dev->of_node, "qcom,hdmi-dba-codec-rx")) {
		dev_dbg(dev, "%s(): hdmi dba audio support present\n",
				__func__);
		memcpy(msm8952_dai_links + len4, msm8952_hdmi_dba_dai_link,
		memcpy(msm8952_dai_links + len5, msm8952_hdmi_dba_dai_link,
			sizeof(msm8952_hdmi_dba_dai_link));
		len4 += ARRAY_SIZE(msm8952_hdmi_dba_dai_link);
		len5 += ARRAY_SIZE(msm8952_hdmi_dba_dai_link);
	} else {
		dev_dbg(dev, "%s(): No hdmi dba present, add quin dai\n",
				__func__);
		memcpy(msm8952_dai_links + len4, msm8952_quin_dai_link,
		memcpy(msm8952_dai_links + len5, msm8952_quin_dai_link,
			sizeof(msm8952_quin_dai_link));
		len4 += ARRAY_SIZE(msm8952_quin_dai_link);
		len5 += ARRAY_SIZE(msm8952_quin_dai_link);
	}
	card->dai_link = msm8952_dai_links;
	card->num_links = len4;
	card->num_links = len5;
	card->dev = dev;

	return card;
+955 −5

File changed.

Preview size limit exceeded, changes collapsed.

+8 −1
Original line number Diff line number Diff line
/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -53,11 +53,15 @@ int msm_proxy_rx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
					struct snd_pcm_hw_params *params);
int msm_proxy_tx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
					struct snd_pcm_hw_params *params);
int msm_tdm_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
			       struct snd_pcm_hw_params *params);
int msm_audrx_init(struct snd_soc_pcm_runtime *rtd);
int msm_mi2s_snd_hw_params(struct snd_pcm_substream *substream,
			     struct snd_pcm_hw_params *params);
int msm_snd_cpe_hw_params(struct snd_pcm_substream *substream,
				struct snd_pcm_hw_params *params);
int msm_tdm_snd_hw_params(struct snd_pcm_substream *substream,
			  struct snd_pcm_hw_params *params);
int msm_quat_mi2s_snd_startup(struct snd_pcm_substream *substream);
void msm_quat_mi2s_snd_shutdown(struct snd_pcm_substream *substream);

@@ -69,6 +73,9 @@ int msm_auxpcm_be_params_fixup(struct snd_soc_pcm_runtime *rtd,
int msm_prim_auxpcm_startup(struct snd_pcm_substream *substream);
void msm_prim_auxpcm_shutdown(struct snd_pcm_substream *substream);

int msm_tdm_startup(struct snd_pcm_substream *substream);
void msm_tdm_shutdown(struct snd_pcm_substream *substream);

struct snd_soc_card *populate_snd_card_dailinks(struct device *dev);
int msm_slim_4_tx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
					    struct snd_pcm_hw_params *params);
Loading