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

Commit 75dc7f8d authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "asoc: Update the dai link IDs for MI2S dai links"

parents 8bd92fad 4da866e6
Loading
Loading
Loading
Loading
+17 −14
Original line number Diff line number Diff line
@@ -2098,7 +2098,8 @@ static int msm_mi2s_set_sclk(struct snd_pcm_substream *substream, bool enable)
	struct snd_soc_pcm_runtime *rtd = substream->private_data;
	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
	int port_id = 0;
	int index = cpu_dai->id;
	/* Rx and Tx DAIs should use same clk index */
	int index = (cpu_dai->id) / 2;

	port_id = msm_get_port_id(rtd->dai_link->id);
	if (port_id < 0) {
@@ -3931,7 +3932,8 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
	int ret = 0;
	struct snd_soc_pcm_runtime *rtd = substream->private_data;
	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
	int index = cpu_dai->id;
	/* Rx and Tx DAIs should use same clk index */
	int index = (cpu_dai->id) / 2;
	unsigned int fmt = SND_SOC_DAIFMT_CBS_CFS;
	struct snd_soc_card *card = rtd->card;
	struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
@@ -3955,11 +3957,6 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
	 */
	mutex_lock(&mi2s_intf_conf[index].lock);
	if (++mi2s_intf_conf[index].ref_cnt == 1) {
		/* Check if msm needs to provide the clock to the interface */
		if (!mi2s_intf_conf[index].msm_is_mi2s_master) {
			mi2s_clk[index].clk_id = mi2s_ebit_clk[index];
			fmt = SND_SOC_DAIFMT_CBM_CFM;
		}
		ret = msm_mi2s_set_sclk(substream, true);
		if (ret < 0) {
			dev_err(rtd->card->dev,
@@ -3968,12 +3965,6 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
			goto clean_up;
		}

		ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
		if (ret < 0) {
			pr_err("%s: set fmt cpu dai failed for MI2S (%d), err:%d\n",
				__func__, index, ret);
			goto clk_off;
		}
		if (pdata->mi2s_gpio_p[index]) {
			if (atomic_read(&(pdata->mi2s_gpio_ref_count[index]))
									== 0) {
@@ -3988,6 +3979,17 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
			atomic_inc(&(pdata->mi2s_gpio_ref_count[index]));
		}
	}
	/* Check if msm needs to provide the clock to the interface */
	if (!mi2s_intf_conf[index].msm_is_mi2s_master) {
		mi2s_clk[index].clk_id = mi2s_ebit_clk[index];
		fmt = SND_SOC_DAIFMT_CBM_CFM;
	}
	ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
	if (ret < 0) {
		pr_err("%s: set fmt cpu dai failed for MI2S (%d), err:%d\n",
			__func__, index, ret);
		goto clk_off;
	}
clk_off:
	if (ret < 0)
		msm_mi2s_set_sclk(substream, false);
@@ -4003,7 +4005,8 @@ static void msm_mi2s_snd_shutdown(struct snd_pcm_substream *substream)
{
	int ret = 0;
	struct snd_soc_pcm_runtime *rtd = substream->private_data;
	int index = rtd->cpu_dai->id;
	/* Rx and Tx DAIs should use same clk index */
	int index = (rtd->cpu_dai->id) / 2;
	struct snd_soc_card *card = rtd->card;
	struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);

+20 −16
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
 */

#include <linux/clk.h>
@@ -2432,7 +2432,8 @@ static int msm_mi2s_set_sclk(struct snd_pcm_substream *substream, bool enable)
	struct snd_soc_pcm_runtime *rtd = substream->private_data;
	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
	int port_id = 0;
	int index = cpu_dai->id;
	/* Rx and Tx DAIs should use same clk index */
	int index = (cpu_dai->id) / 2;

	port_id = msm_get_port_id(rtd->dai_link->id);
	if (port_id < 0) {
@@ -4369,7 +4370,8 @@ void mi2s_disable_audio_vote(struct snd_pcm_substream *substream)
{
	struct snd_soc_pcm_runtime *rtd = substream->private_data;
	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
	int index = cpu_dai->id;
	/* Rx and Tx DAIs should use same clk index */
	int index = (cpu_dai->id) / 2;
	struct snd_soc_card *card = rtd->card;
	struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
	int sample_rate = 0;
@@ -4403,7 +4405,8 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
	int ret = 0;
	struct snd_soc_pcm_runtime *rtd = substream->private_data;
	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
	int index = cpu_dai->id;
	/* Rx and Tx DAIs should use same clk index */
	int index = (cpu_dai->id) / 2;
	unsigned int fmt = SND_SOC_DAIFMT_CBS_CFS;
	struct snd_soc_card *card = rtd->card;
	struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
@@ -4456,11 +4459,6 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
	}

	if (++mi2s_intf_conf[index].ref_cnt == 1) {
		/* Check if msm needs to provide the clock to the interface */
		if (!mi2s_intf_conf[index].msm_is_mi2s_master) {
			mi2s_clk[index].clk_id = mi2s_ebit_clk[index];
			fmt = SND_SOC_DAIFMT_CBM_CFM;
		}
		ret = msm_mi2s_set_sclk(substream, true);
		if (ret < 0) {
			dev_err(rtd->card->dev,
@@ -4469,12 +4467,6 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
			goto clean_up;
		}

		ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
		if (ret < 0) {
			pr_err("%s: set fmt cpu dai failed for MI2S (%d), err:%d\n",
				__func__, index, ret);
			goto clk_off;
		}
		if (pdata->mi2s_gpio_p[index]) {
			if (atomic_read(&(pdata->mi2s_gpio_ref_count[index]))
									== 0) {
@@ -4489,6 +4481,17 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
			atomic_inc(&(pdata->mi2s_gpio_ref_count[index]));
		}
	}
	/* Check if msm needs to provide the clock to the interface */
	if (!mi2s_intf_conf[index].msm_is_mi2s_master) {
		mi2s_clk[index].clk_id = mi2s_ebit_clk[index];
		fmt = SND_SOC_DAIFMT_CBM_CFM;
	}
	ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
	if (ret < 0) {
		pr_err("%s: set fmt cpu dai failed for MI2S (%d), err:%d\n",
			__func__, index, ret);
		goto clk_off;
	}
clk_off:
	if (ret < 0)
		msm_mi2s_set_sclk(substream, false);
@@ -4507,7 +4510,8 @@ static void msm_mi2s_snd_shutdown(struct snd_pcm_substream *substream)
{
	int ret = 0;
	struct snd_soc_pcm_runtime *rtd = substream->private_data;
	int index = rtd->cpu_dai->id;
	/* Rx and Tx DAIs should use same clk index */
	int index = (rtd->cpu_dai->id) / 2;
	struct snd_soc_card *card = rtd->card;
	struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);

+20 −16
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
 */

#include <linux/clk.h>
@@ -2750,7 +2750,8 @@ static int msm_mi2s_set_sclk(struct snd_pcm_substream *substream, bool enable)
	struct snd_soc_pcm_runtime *rtd = substream->private_data;
	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
	int port_id = 0;
	int index = cpu_dai->id;
	/* Rx and Tx DAIs should use same clk index */
	int index = (cpu_dai->id) / 2;

	port_id = msm_get_port_id(rtd->dai_link->id);
	if (port_id < 0) {
@@ -5010,7 +5011,8 @@ void mi2s_disable_audio_vote(struct snd_pcm_substream *substream)
{
	struct snd_soc_pcm_runtime *rtd = substream->private_data;
	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
	int index = cpu_dai->id;
	/* Rx and Tx DAIs should use same clk index */
	int index = (cpu_dai->id) / 2;
	struct snd_soc_card *card = rtd->card;
	struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
	int sample_rate = 0;
@@ -5044,7 +5046,8 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
	int ret = 0;
	struct snd_soc_pcm_runtime *rtd = substream->private_data;
	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
	int index = cpu_dai->id;
	/* Rx and Tx DAIs should use same clk index */
	int index = (cpu_dai->id) / 2;
	unsigned int fmt = SND_SOC_DAIFMT_CBS_CFS;
	struct snd_soc_card *card = rtd->card;
	struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
@@ -5097,11 +5100,6 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
	}

	if (++mi2s_intf_conf[index].ref_cnt == 1) {
		/* Check if msm needs to provide the clock to the interface */
		if (!mi2s_intf_conf[index].msm_is_mi2s_master) {
			mi2s_clk[index].clk_id = mi2s_ebit_clk[index];
			fmt = SND_SOC_DAIFMT_CBM_CFM;
		}
		ret = msm_mi2s_set_sclk(substream, true);
		if (ret < 0) {
			dev_err(rtd->card->dev,
@@ -5110,12 +5108,6 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
			goto clean_up;
		}

		ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
		if (ret < 0) {
			pr_err("%s: set fmt cpu dai failed for MI2S (%d), err:%d\n",
				__func__, index, ret);
			goto clk_off;
		}
		if (pdata->mi2s_gpio_p[index]) {
			if (atomic_read(&(pdata->mi2s_gpio_ref_count[index]))
									== 0) {
@@ -5130,6 +5122,17 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
			atomic_inc(&(pdata->mi2s_gpio_ref_count[index]));
		}
	}
	/* Check if msm needs to provide the clock to the interface */
	if (!mi2s_intf_conf[index].msm_is_mi2s_master) {
		mi2s_clk[index].clk_id = mi2s_ebit_clk[index];
		fmt = SND_SOC_DAIFMT_CBM_CFM;
	}
	ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
	if (ret < 0) {
		pr_err("%s: set fmt cpu dai failed for MI2S (%d), err:%d\n",
			__func__, index, ret);
		goto clk_off;
	}
clk_off:
	if (ret < 0)
		msm_mi2s_set_sclk(substream, false);
@@ -5148,7 +5151,8 @@ static void msm_mi2s_snd_shutdown(struct snd_pcm_substream *substream)
{
	int ret = 0;
	struct snd_soc_pcm_runtime *rtd = substream->private_data;
	int index = rtd->cpu_dai->id;
	/* Rx and Tx DAIs should use same clk index */
	int index = (rtd->cpu_dai->id) / 2;
	struct snd_soc_card *card = rtd->card;
	struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);

+20 −16
Original line number Diff line number Diff line
@@ -2874,7 +2874,8 @@ static int msm_mi2s_set_sclk(struct snd_pcm_substream *substream, bool enable)
	struct snd_soc_pcm_runtime *rtd = substream->private_data;
	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
	int port_id = 0;
	int index = cpu_dai->id;
	/* Rx and Tx DAIs should use same clk index */
	int index = (cpu_dai->id) / 2;

	port_id = msm_get_port_id(rtd->dai_link->id);
	if (port_id < 0) {
@@ -5323,7 +5324,8 @@ void mi2s_disable_audio_vote(struct snd_pcm_substream *substream)
{
	struct snd_soc_pcm_runtime *rtd = substream->private_data;
	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
	int index = cpu_dai->id;
	/* Rx and Tx DAIs should use same clk index */
	int index = (cpu_dai->id) / 2;
	struct snd_soc_card *card = rtd->card;
	struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
	int sample_rate = 0;
@@ -5359,7 +5361,8 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
	int ret = 0;
	struct snd_soc_pcm_runtime *rtd = substream->private_data;
	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
	int index = cpu_dai->id;
	/* Rx and Tx DAIs should use same clk index */
	int index = (cpu_dai->id) / 2;
	unsigned int fmt = SND_SOC_DAIFMT_CBS_CFS;
	struct snd_soc_card *card = rtd->card;
	struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
@@ -5418,12 +5421,6 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
			mi2s_intf_conf[index].audio_core_vote = true;
		}

		/* Check if msm needs to provide the clock to the interface */
		if (!mi2s_intf_conf[index].msm_is_mi2s_master) {
			mi2s_clk[index].clk_id = mi2s_ebit_clk[index];
			fmt = SND_SOC_DAIFMT_CBM_CFM;
		}

		mi2s_clk[index].clk_freq_in_hz = (sample_rate *
					MI2S_NUM_CHANNELS * bit_per_sample);
		dev_dbg(rtd->card->dev, "%s: clock rate %ul\n", __func__,
@@ -5437,12 +5434,6 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
			goto clean_up;
		}

		ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
		if (ret < 0) {
			pr_err("%s: set fmt cpu dai failed for MI2S (%d), err:%d\n",
				__func__, index, ret);
			goto clk_off;
		}
		if (pdata->mi2s_gpio_p[index]) {
			if (atomic_read(&(pdata->mi2s_gpio_ref_count[index]))
									== 0) {
@@ -5457,6 +5448,18 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
			atomic_inc(&(pdata->mi2s_gpio_ref_count[index]));
		}
	}
	/* Check if msm needs to provide the clock to the interface */
	if (!mi2s_intf_conf[index].msm_is_mi2s_master) {
		mi2s_clk[index].clk_id = mi2s_ebit_clk[index];
		fmt = SND_SOC_DAIFMT_CBM_CFM;
	}
	ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
	if (ret < 0) {
		pr_err("%s: set fmt cpu dai failed for MI2S (%d), err:%d\n",
			__func__, index, ret);
		goto clk_off;
	}

clk_off:
	if (ret < 0)
		msm_mi2s_set_sclk(substream, false);
@@ -5475,7 +5478,8 @@ static void msm_mi2s_snd_shutdown(struct snd_pcm_substream *substream)
{
	int ret = 0;
	struct snd_soc_pcm_runtime *rtd = substream->private_data;
	int index = rtd->cpu_dai->id;
	/* Rx and Tx DAIs should use same clk index */
	int index = (rtd->cpu_dai->id) / 2;
	struct snd_soc_card *card = rtd->card;
	struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);

+11 −11
Original line number Diff line number Diff line
@@ -920,57 +920,57 @@ SND_SOC_DAILINK_DEFS(pri_mi2s_rx,
	DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));

SND_SOC_DAILINK_DEFS(pri_mi2s_tx,
	DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.0")),
	DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.1")),
	DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")),
	DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));

SND_SOC_DAILINK_DEFS(sec_mi2s_rx,
	DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.1")),
	DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.2")),
	DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")),
	DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));

SND_SOC_DAILINK_DEFS(sec_mi2s_tx,
	DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.1")),
	DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.3")),
	DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")),
	DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));

SND_SOC_DAILINK_DEFS(tert_mi2s_rx,
	DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.2")),
	DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.4")),
	DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")),
	DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));

SND_SOC_DAILINK_DEFS(tert_mi2s_tx,
	DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.2")),
	DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.5")),
	DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")),
	DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));

SND_SOC_DAILINK_DEFS(quat_mi2s_rx,
	DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.3")),
	DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.6")),
	DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")),
	DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));

SND_SOC_DAILINK_DEFS(quat_mi2s_tx,
	DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.3")),
	DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.7")),
	DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")),
	DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));

SND_SOC_DAILINK_DEFS(quin_mi2s_rx,
	DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.4")),
	DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.8")),
	DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")),
	DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));

SND_SOC_DAILINK_DEFS(quin_mi2s_tx,
	DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.4")),
	DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.9")),
	DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")),
	DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));

SND_SOC_DAILINK_DEFS(sen_mi2s_rx,
	DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.5")),
	DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.10")),
	DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-rx")),
	DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));

SND_SOC_DAILINK_DEFS(sen_mi2s_tx,
	DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.5")),
	DAILINK_COMP_ARRAY(COMP_CPU("msm-dai-q6-mi2s.11")),
	DAILINK_COMP_ARRAY(COMP_CODEC("msm-stub-codec.1", "msm-stub-tx")),
	DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));

Loading