asoc: Update the dai link IDs for MI2S dai links
DAI IDs are updated for MI2S dai links to use separate cpu dai IDs for Rx and Tx dais. Make respective changes in the machine driver and dai link header files. Change-Id: I9bb114f1dabb954720316dd7b0522c282361e4d5 Signed-off-by: Aditya Bavanari <abavanar@codeaurora.org>
This commit is contained in:
parent
02744ac315
commit
4da866e6de
@ -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_pcm_runtime *rtd = substream->private_data;
|
||||||
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
||||||
int port_id = 0;
|
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);
|
port_id = msm_get_port_id(rtd->dai_link->id);
|
||||||
if (port_id < 0) {
|
if (port_id < 0) {
|
||||||
@ -3931,7 +3932,8 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||||
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
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;
|
unsigned int fmt = SND_SOC_DAIFMT_CBS_CFS;
|
||||||
struct snd_soc_card *card = rtd->card;
|
struct snd_soc_card *card = rtd->card;
|
||||||
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(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);
|
mutex_lock(&mi2s_intf_conf[index].lock);
|
||||||
if (++mi2s_intf_conf[index].ref_cnt == 1) {
|
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);
|
ret = msm_mi2s_set_sclk(substream, true);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(rtd->card->dev,
|
dev_err(rtd->card->dev,
|
||||||
@ -3968,12 +3965,6 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
|
|||||||
goto clean_up;
|
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 (pdata->mi2s_gpio_p[index]) {
|
||||||
if (atomic_read(&(pdata->mi2s_gpio_ref_count[index]))
|
if (atomic_read(&(pdata->mi2s_gpio_ref_count[index]))
|
||||||
== 0) {
|
== 0) {
|
||||||
@ -3988,6 +3979,17 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
|
|||||||
atomic_inc(&(pdata->mi2s_gpio_ref_count[index]));
|
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:
|
clk_off:
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
msm_mi2s_set_sclk(substream, false);
|
msm_mi2s_set_sclk(substream, false);
|
||||||
@ -4003,7 +4005,8 @@ static void msm_mi2s_snd_shutdown(struct snd_pcm_substream *substream)
|
|||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
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 snd_soc_card *card = rtd->card;
|
||||||
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
|
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
|
||||||
|
|
||||||
|
36
asoc/holi.c
36
asoc/holi.c
@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-only
|
// 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>
|
#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_pcm_runtime *rtd = substream->private_data;
|
||||||
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
||||||
int port_id = 0;
|
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);
|
port_id = msm_get_port_id(rtd->dai_link->id);
|
||||||
if (port_id < 0) {
|
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_pcm_runtime *rtd = substream->private_data;
|
||||||
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
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 snd_soc_card *card = rtd->card;
|
||||||
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
|
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
|
||||||
int sample_rate = 0;
|
int sample_rate = 0;
|
||||||
@ -4403,7 +4405,8 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||||
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
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;
|
unsigned int fmt = SND_SOC_DAIFMT_CBS_CFS;
|
||||||
struct snd_soc_card *card = rtd->card;
|
struct snd_soc_card *card = rtd->card;
|
||||||
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(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) {
|
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);
|
ret = msm_mi2s_set_sclk(substream, true);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(rtd->card->dev,
|
dev_err(rtd->card->dev,
|
||||||
@ -4469,12 +4467,6 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
|
|||||||
goto clean_up;
|
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 (pdata->mi2s_gpio_p[index]) {
|
||||||
if (atomic_read(&(pdata->mi2s_gpio_ref_count[index]))
|
if (atomic_read(&(pdata->mi2s_gpio_ref_count[index]))
|
||||||
== 0) {
|
== 0) {
|
||||||
@ -4489,6 +4481,17 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
|
|||||||
atomic_inc(&(pdata->mi2s_gpio_ref_count[index]));
|
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:
|
clk_off:
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
msm_mi2s_set_sclk(substream, false);
|
msm_mi2s_set_sclk(substream, false);
|
||||||
@ -4507,7 +4510,8 @@ static void msm_mi2s_snd_shutdown(struct snd_pcm_substream *substream)
|
|||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
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 snd_soc_card *card = rtd->card;
|
||||||
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
|
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
|
||||||
|
|
||||||
|
36
asoc/kona.c
36
asoc/kona.c
@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-only
|
// 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>
|
#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_pcm_runtime *rtd = substream->private_data;
|
||||||
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
||||||
int port_id = 0;
|
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);
|
port_id = msm_get_port_id(rtd->dai_link->id);
|
||||||
if (port_id < 0) {
|
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_pcm_runtime *rtd = substream->private_data;
|
||||||
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
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 snd_soc_card *card = rtd->card;
|
||||||
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
|
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
|
||||||
int sample_rate = 0;
|
int sample_rate = 0;
|
||||||
@ -5044,7 +5046,8 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||||
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
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;
|
unsigned int fmt = SND_SOC_DAIFMT_CBS_CFS;
|
||||||
struct snd_soc_card *card = rtd->card;
|
struct snd_soc_card *card = rtd->card;
|
||||||
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(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) {
|
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);
|
ret = msm_mi2s_set_sclk(substream, true);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(rtd->card->dev,
|
dev_err(rtd->card->dev,
|
||||||
@ -5110,12 +5108,6 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
|
|||||||
goto clean_up;
|
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 (pdata->mi2s_gpio_p[index]) {
|
||||||
if (atomic_read(&(pdata->mi2s_gpio_ref_count[index]))
|
if (atomic_read(&(pdata->mi2s_gpio_ref_count[index]))
|
||||||
== 0) {
|
== 0) {
|
||||||
@ -5130,6 +5122,17 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
|
|||||||
atomic_inc(&(pdata->mi2s_gpio_ref_count[index]));
|
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:
|
clk_off:
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
msm_mi2s_set_sclk(substream, false);
|
msm_mi2s_set_sclk(substream, false);
|
||||||
@ -5148,7 +5151,8 @@ static void msm_mi2s_snd_shutdown(struct snd_pcm_substream *substream)
|
|||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
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 snd_soc_card *card = rtd->card;
|
||||||
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
|
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
|
||||||
|
|
||||||
|
@ -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_pcm_runtime *rtd = substream->private_data;
|
||||||
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
||||||
int port_id = 0;
|
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);
|
port_id = msm_get_port_id(rtd->dai_link->id);
|
||||||
if (port_id < 0) {
|
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_pcm_runtime *rtd = substream->private_data;
|
||||||
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
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 snd_soc_card *card = rtd->card;
|
||||||
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
|
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
|
||||||
int sample_rate = 0;
|
int sample_rate = 0;
|
||||||
@ -5359,7 +5361,8 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||||
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
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;
|
unsigned int fmt = SND_SOC_DAIFMT_CBS_CFS;
|
||||||
struct snd_soc_card *card = rtd->card;
|
struct snd_soc_card *card = rtd->card;
|
||||||
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(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;
|
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_clk[index].clk_freq_in_hz = (sample_rate *
|
||||||
MI2S_NUM_CHANNELS * bit_per_sample);
|
MI2S_NUM_CHANNELS * bit_per_sample);
|
||||||
dev_dbg(rtd->card->dev, "%s: clock rate %ul\n", __func__,
|
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;
|
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 (pdata->mi2s_gpio_p[index]) {
|
||||||
if (atomic_read(&(pdata->mi2s_gpio_ref_count[index]))
|
if (atomic_read(&(pdata->mi2s_gpio_ref_count[index]))
|
||||||
== 0) {
|
== 0) {
|
||||||
@ -5457,6 +5448,18 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
|
|||||||
atomic_inc(&(pdata->mi2s_gpio_ref_count[index]));
|
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:
|
clk_off:
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
msm_mi2s_set_sclk(substream, false);
|
msm_mi2s_set_sclk(substream, false);
|
||||||
@ -5475,7 +5478,8 @@ static void msm_mi2s_snd_shutdown(struct snd_pcm_substream *substream)
|
|||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
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 snd_soc_card *card = rtd->card;
|
||||||
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
|
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
|
||||||
|
|
||||||
|
@ -920,57 +920,57 @@ SND_SOC_DAILINK_DEFS(pri_mi2s_rx,
|
|||||||
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
|
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
|
||||||
|
|
||||||
SND_SOC_DAILINK_DEFS(pri_mi2s_tx,
|
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_CODEC("msm-stub-codec.1", "msm-stub-tx")),
|
||||||
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
|
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
|
||||||
|
|
||||||
SND_SOC_DAILINK_DEFS(sec_mi2s_rx,
|
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_CODEC("msm-stub-codec.1", "msm-stub-rx")),
|
||||||
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
|
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
|
||||||
|
|
||||||
SND_SOC_DAILINK_DEFS(sec_mi2s_tx,
|
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_CODEC("msm-stub-codec.1", "msm-stub-tx")),
|
||||||
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
|
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
|
||||||
|
|
||||||
SND_SOC_DAILINK_DEFS(tert_mi2s_rx,
|
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_CODEC("msm-stub-codec.1", "msm-stub-rx")),
|
||||||
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
|
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
|
||||||
|
|
||||||
SND_SOC_DAILINK_DEFS(tert_mi2s_tx,
|
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_CODEC("msm-stub-codec.1", "msm-stub-tx")),
|
||||||
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
|
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
|
||||||
|
|
||||||
SND_SOC_DAILINK_DEFS(quat_mi2s_rx,
|
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_CODEC("msm-stub-codec.1", "msm-stub-rx")),
|
||||||
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
|
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
|
||||||
|
|
||||||
SND_SOC_DAILINK_DEFS(quat_mi2s_tx,
|
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_CODEC("msm-stub-codec.1", "msm-stub-tx")),
|
||||||
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
|
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
|
||||||
|
|
||||||
SND_SOC_DAILINK_DEFS(quin_mi2s_rx,
|
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_CODEC("msm-stub-codec.1", "msm-stub-rx")),
|
||||||
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
|
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
|
||||||
|
|
||||||
SND_SOC_DAILINK_DEFS(quin_mi2s_tx,
|
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_CODEC("msm-stub-codec.1", "msm-stub-tx")),
|
||||||
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
|
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
|
||||||
|
|
||||||
SND_SOC_DAILINK_DEFS(sen_mi2s_rx,
|
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_CODEC("msm-stub-codec.1", "msm-stub-rx")),
|
||||||
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
|
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
|
||||||
|
|
||||||
SND_SOC_DAILINK_DEFS(sen_mi2s_tx,
|
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_CODEC("msm-stub-codec.1", "msm-stub-tx")),
|
||||||
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
|
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
|
* Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sound/soc.h>
|
#include <sound/soc.h>
|
||||||
@ -322,37 +322,37 @@ SND_SOC_DAILINK_DEFS(pri_mi2s_rx,
|
|||||||
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
|
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
|
||||||
|
|
||||||
SND_SOC_DAILINK_DEFS(pri_mi2s_tx,
|
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_CODEC("msm-stub-codec.1", "msm-stub-tx")),
|
||||||
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
|
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
|
||||||
|
|
||||||
SND_SOC_DAILINK_DEFS(sec_mi2s_rx,
|
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_CODEC("msm-stub-codec.1", "msm-stub-rx")),
|
||||||
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
|
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
|
||||||
|
|
||||||
SND_SOC_DAILINK_DEFS(sec_mi2s_tx,
|
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_CODEC("msm-stub-codec.1", "msm-stub-tx")),
|
||||||
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
|
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
|
||||||
|
|
||||||
SND_SOC_DAILINK_DEFS(tert_mi2s_rx,
|
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_CODEC("msm-stub-codec.1", "msm-stub-rx")),
|
||||||
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
|
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
|
||||||
|
|
||||||
SND_SOC_DAILINK_DEFS(tert_mi2s_tx,
|
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_CODEC("msm-stub-codec.1", "msm-stub-tx")),
|
||||||
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
|
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
|
||||||
|
|
||||||
SND_SOC_DAILINK_DEFS(quat_mi2s_rx,
|
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_CODEC("msm-stub-codec.1", "msm-stub-rx")),
|
||||||
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
|
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
|
||||||
|
|
||||||
SND_SOC_DAILINK_DEFS(quat_mi2s_tx,
|
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_CODEC("msm-stub-codec.1", "msm-stub-tx")),
|
||||||
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
|
DAILINK_COMP_ARRAY(COMP_PLATFORM("msm-pcm-routing")));
|
||||||
|
|
||||||
|
@ -6607,7 +6607,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_pcm_runtime *rtd = substream->private_data;
|
||||||
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
||||||
int port_id = 0;
|
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);
|
port_id = msm_get_port_id(rtd->dai_link->id);
|
||||||
if (port_id < 0) {
|
if (port_id < 0) {
|
||||||
@ -7031,7 +7032,8 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
|
|||||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||||
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
||||||
struct snd_soc_dai_link *dai_link = rtd->dai_link;
|
struct snd_soc_dai_link *dai_link = rtd->dai_link;
|
||||||
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;
|
unsigned int fmt = SND_SOC_DAIFMT_CBS_CFS;
|
||||||
struct snd_soc_card *card = rtd->card;
|
struct snd_soc_card *card = rtd->card;
|
||||||
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
|
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
|
||||||
@ -7061,12 +7063,6 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
|
|||||||
*/
|
*/
|
||||||
mutex_lock(&mi2s_intf_conf[index].lock);
|
mutex_lock(&mi2s_intf_conf[index].lock);
|
||||||
if (++mi2s_intf_conf[index].ref_cnt == 1) {
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data_format == AFE_DSD_DATA)
|
if (data_format == AFE_DSD_DATA)
|
||||||
fmt = SND_SOC_DAIFMT_CBM_CFS;
|
fmt = SND_SOC_DAIFMT_CBM_CFS;
|
||||||
ret = msm_mi2s_set_sclk(substream, true);
|
ret = msm_mi2s_set_sclk(substream, true);
|
||||||
@ -7077,13 +7073,6 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
|
|||||||
goto clean_up;
|
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 (pdata->mi2s_gpio_p[index]) {
|
||||||
if ((data_format == AFE_DSD_DATA) &&
|
if ((data_format == AFE_DSD_DATA) &&
|
||||||
((index == QUAT_MI2S) ||
|
((index == QUAT_MI2S) ||
|
||||||
@ -7112,7 +7101,17 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* 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;
|
||||||
|
}
|
||||||
ret = qcs405_send_island_vad_config(dai_link->id);
|
ret = qcs405_send_island_vad_config(dai_link->id);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
pr_err("%s: send island/vad cfg failed, err = %d\n",
|
pr_err("%s: send island/vad cfg failed, err = %d\n",
|
||||||
@ -7167,7 +7166,8 @@ static void msm_mi2s_snd_shutdown(struct snd_pcm_substream *substream)
|
|||||||
int val;
|
int val;
|
||||||
int data_format;
|
int data_format;
|
||||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
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 snd_soc_card *card = rtd->card;
|
||||||
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
|
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
|
||||||
|
|
||||||
|
@ -3769,7 +3769,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_pcm_runtime *rtd = substream->private_data;
|
||||||
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
||||||
int port_id = 0;
|
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);
|
port_id = msm_get_port_id(rtd->dai_link->id);
|
||||||
if (port_id < 0) {
|
if (port_id < 0) {
|
||||||
@ -4999,7 +5000,8 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||||
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
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;
|
unsigned int fmt = SND_SOC_DAIFMT_CBS_CFS;
|
||||||
struct snd_soc_card *card = rtd->card;
|
struct snd_soc_card *card = rtd->card;
|
||||||
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
|
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
|
||||||
@ -5027,11 +5029,6 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
|
|||||||
intf_conf = &pdata->mi2s_intf_conf[index];
|
intf_conf = &pdata->mi2s_intf_conf[index];
|
||||||
mutex_lock(&intf_conf->lock);
|
mutex_lock(&intf_conf->lock);
|
||||||
if (++intf_conf->ref_cnt == 1) {
|
if (++intf_conf->ref_cnt == 1) {
|
||||||
/* Check if msm needs to provide the clock to the interface */
|
|
||||||
if (!intf_conf->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);
|
ret = msm_mi2s_set_sclk(substream, true);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(rtd->card->dev,
|
dev_err(rtd->card->dev,
|
||||||
@ -5040,13 +5037,6 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
|
|||||||
goto clean_up;
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
pinctrl_info = &pdata->pinctrl_info[index];
|
pinctrl_info = &pdata->pinctrl_info[index];
|
||||||
if (pinctrl_info->pinctrl) {
|
if (pinctrl_info->pinctrl) {
|
||||||
ret_pinctrl = msm_set_pinctrl(pinctrl_info,
|
ret_pinctrl = msm_set_pinctrl(pinctrl_info,
|
||||||
@ -5056,6 +5046,17 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
|
|||||||
__func__, ret_pinctrl);
|
__func__, ret_pinctrl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* Check if msm needs to provide the clock to the interface */
|
||||||
|
if (!intf_conf->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:
|
clk_off:
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
msm_mi2s_set_sclk(substream, false);
|
msm_mi2s_set_sclk(substream, false);
|
||||||
@ -5071,7 +5072,8 @@ static void msm_mi2s_snd_shutdown(struct snd_pcm_substream *substream)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
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 snd_soc_card *card = rtd->card;
|
||||||
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
|
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
|
||||||
struct msm_pinctrl_info *pinctrl_info = NULL;
|
struct msm_pinctrl_info *pinctrl_info = NULL;
|
||||||
|
@ -5008,7 +5008,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_pcm_runtime *rtd = substream->private_data;
|
||||||
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
||||||
int port_id = 0;
|
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);
|
port_id = msm_get_port_id(rtd->dai_link->id);
|
||||||
if (port_id < 0) {
|
if (port_id < 0) {
|
||||||
@ -7290,7 +7291,8 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||||
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
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;
|
unsigned int fmt = SND_SOC_DAIFMT_CBS_CFS;
|
||||||
struct snd_soc_card *card = rtd->card;
|
struct snd_soc_card *card = rtd->card;
|
||||||
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
|
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
|
||||||
@ -7318,11 +7320,6 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
|
|||||||
intf_conf = &pdata->mi2s_intf_conf[index];
|
intf_conf = &pdata->mi2s_intf_conf[index];
|
||||||
mutex_lock(&intf_conf->lock);
|
mutex_lock(&intf_conf->lock);
|
||||||
if (++intf_conf->ref_cnt == 1) {
|
if (++intf_conf->ref_cnt == 1) {
|
||||||
/* Check if msm needs to provide the clock to the interface */
|
|
||||||
if (!intf_conf->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);
|
ret = msm_mi2s_set_sclk(substream, true);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(rtd->card->dev,
|
dev_err(rtd->card->dev,
|
||||||
@ -7331,13 +7328,6 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
|
|||||||
goto clean_up;
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
pinctrl_info = &pdata->pinctrl_info[index];
|
pinctrl_info = &pdata->pinctrl_info[index];
|
||||||
if (pinctrl_info->pinctrl) {
|
if (pinctrl_info->pinctrl) {
|
||||||
ret_pinctrl = msm_set_pinctrl(pinctrl_info,
|
ret_pinctrl = msm_set_pinctrl(pinctrl_info,
|
||||||
@ -7347,6 +7337,17 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
|
|||||||
__func__, ret_pinctrl);
|
__func__, ret_pinctrl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* Check if msm needs to provide the clock to the interface */
|
||||||
|
if (!intf_conf->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:
|
clk_off:
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
msm_mi2s_set_sclk(substream, false);
|
msm_mi2s_set_sclk(substream, false);
|
||||||
@ -7362,7 +7363,8 @@ static void msm_mi2s_snd_shutdown(struct snd_pcm_substream *substream)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
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 snd_soc_card *card = rtd->card;
|
||||||
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
|
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
|
||||||
struct msm_pinctrl_info *pinctrl_info = NULL;
|
struct msm_pinctrl_info *pinctrl_info = NULL;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-only
|
// SPDX-License-Identifier: GPL-2.0-only
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
|
* Copyright (c) 2018-2019, 2021 The Linux Foundation. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/clk.h>
|
#include <linux/clk.h>
|
||||||
@ -5622,7 +5622,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_pcm_runtime *rtd = substream->private_data;
|
||||||
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
||||||
int port_id = 0;
|
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);
|
port_id = msm_get_port_id(rtd->dai_link->id);
|
||||||
if (port_id < 0) {
|
if (port_id < 0) {
|
||||||
@ -5875,7 +5876,8 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||||
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
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;
|
||||||
int port_id = msm_get_port_id(rtd->dai_link->id);
|
int port_id = msm_get_port_id(rtd->dai_link->id);
|
||||||
unsigned int fmt = SND_SOC_DAIFMT_CBS_CFS;
|
unsigned int fmt = SND_SOC_DAIFMT_CBS_CFS;
|
||||||
struct snd_soc_card *card = rtd->card;
|
struct snd_soc_card *card = rtd->card;
|
||||||
@ -5906,11 +5908,6 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
|
|||||||
*/
|
*/
|
||||||
mutex_lock(&mi2s_intf_conf[index].lock);
|
mutex_lock(&mi2s_intf_conf[index].lock);
|
||||||
if (++mi2s_intf_conf[index].ref_cnt == 1) {
|
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);
|
ret = msm_mi2s_set_sclk(substream, true);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(rtd->card->dev,
|
dev_err(rtd->card->dev,
|
||||||
@ -5919,12 +5916,6 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
|
|||||||
goto clean_up;
|
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 (mi2s_intf_conf[index].msm_is_ext_mclk) {
|
if (mi2s_intf_conf[index].msm_is_ext_mclk) {
|
||||||
pr_debug("%s: Enabling mclk, clk_freq_in_hz = %u\n",
|
pr_debug("%s: Enabling mclk, clk_freq_in_hz = %u\n",
|
||||||
__func__, mi2s_mclk[index].clk_freq_in_hz);
|
__func__, mi2s_mclk[index].clk_freq_in_hz);
|
||||||
@ -5941,6 +5932,17 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
|
|||||||
msm_cdc_pinctrl_select_active_state(
|
msm_cdc_pinctrl_select_active_state(
|
||||||
pdata->mi2s_gpio_p[index]);
|
pdata->mi2s_gpio_p[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:
|
clk_off:
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
msm_mi2s_set_sclk(substream, false);
|
msm_mi2s_set_sclk(substream, false);
|
||||||
@ -5956,7 +5958,8 @@ static void msm_mi2s_snd_shutdown(struct snd_pcm_substream *substream)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
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;
|
||||||
int port_id = msm_get_port_id(rtd->dai_link->id);
|
int port_id = msm_get_port_id(rtd->dai_link->id);
|
||||||
struct snd_soc_card *card = rtd->card;
|
struct snd_soc_card *card = rtd->card;
|
||||||
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
|
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-only
|
// SPDX-License-Identifier: GPL-2.0-only
|
||||||
/* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
|
/* Copyright (c) 2016-2019, 2021, The Linux Foundation. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/clk.h>
|
#include <linux/clk.h>
|
||||||
@ -4404,7 +4404,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_pcm_runtime *rtd = substream->private_data;
|
||||||
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
||||||
int port_id = 0;
|
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);
|
port_id = msm_get_port_id(rtd->dai_link->id);
|
||||||
if (port_id < 0) {
|
if (port_id < 0) {
|
||||||
@ -4824,7 +4825,8 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||||
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
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;
|
unsigned int fmt = SND_SOC_DAIFMT_CBS_CFS;
|
||||||
struct snd_soc_card *card = rtd->card;
|
struct snd_soc_card *card = rtd->card;
|
||||||
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
|
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
|
||||||
@ -4850,11 +4852,6 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
|
|||||||
*/
|
*/
|
||||||
mutex_lock(&mi2s_intf_conf[index].lock);
|
mutex_lock(&mi2s_intf_conf[index].lock);
|
||||||
if (++mi2s_intf_conf[index].ref_cnt == 1) {
|
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);
|
ret = msm_mi2s_set_sclk(substream, true);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(rtd->card->dev,
|
dev_err(rtd->card->dev,
|
||||||
@ -4863,12 +4860,6 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
|
|||||||
goto clean_up;
|
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 (index == QUAT_MI2S) {
|
if (index == QUAT_MI2S) {
|
||||||
ret_pinctrl = msm_set_pinctrl(pinctrl_info,
|
ret_pinctrl = msm_set_pinctrl(pinctrl_info,
|
||||||
STATE_MI2S_ACTIVE);
|
STATE_MI2S_ACTIVE);
|
||||||
@ -4877,6 +4868,17 @@ static int msm_mi2s_snd_startup(struct snd_pcm_substream *substream)
|
|||||||
__func__, ret_pinctrl);
|
__func__, ret_pinctrl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* 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:
|
clk_off:
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
msm_mi2s_set_sclk(substream, false);
|
msm_mi2s_set_sclk(substream, false);
|
||||||
@ -4892,7 +4894,8 @@ static void msm_mi2s_snd_shutdown(struct snd_pcm_substream *substream)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
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 snd_soc_card *card = rtd->card;
|
||||||
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
|
struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(card);
|
||||||
struct msm_pinctrl_info *pinctrl_info = &pdata->pinctrl_info;
|
struct msm_pinctrl_info *pinctrl_info = &pdata->pinctrl_info;
|
||||||
|
Loading…
Reference in New Issue
Block a user