ASoc: msm: Support SEC_MI2S_TX Port ASM Loopback
Add dai link MultiMedia20 in reference machine driver and kcontrols for sample rate of SEC_MI2S_TX port. CRs-Fixed: 2045651 Change-Id: I7c6bc45b2d71403ed19ee0993a85c82649acda7d Signed-off-by: Cong Tang <congt@codeaurora.org>
This commit is contained in:
parent
6adb3d5ff2
commit
7ac4fb357f
1 changed files with 52 additions and 11 deletions
|
@ -57,6 +57,7 @@ static int msm_quat_mi2s_rx_ch = 2;
|
|||
static int msm_sec_mi2s_tx_bit_format = SNDRV_PCM_FORMAT_S16_LE;
|
||||
static int msm_tert_mi2s_tx_bit_format = SNDRV_PCM_FORMAT_S16_LE;
|
||||
static int msm_quat_mi2s_rx_bit_format = SNDRV_PCM_FORMAT_S16_LE;
|
||||
static int msm_sec_mi2s_rate = SAMPLING_RATE_48KHZ;
|
||||
|
||||
/* TDM default channels */
|
||||
static int msm_sec_tdm_tx_0_ch = 2; /* STEREO MIC */
|
||||
|
@ -385,6 +386,8 @@ static char const *ec_ref_bit_format_text[] = {"0", "S16_LE", "S24_LE"};
|
|||
static const char *const ec_ref_rate_text[] = {"0", "8000", "16000",
|
||||
"32000", "44100", "48000", "96000", "192000", "384000"};
|
||||
|
||||
static const char *const mi2s_rate_text[] = {"32000", "44100", "48000"};
|
||||
|
||||
static struct afe_clk_set sec_mi2s_tx_clk = {
|
||||
AFE_API_VERSION_I2S_CONFIG,
|
||||
Q6AFE_LPASS_CLK_ID_SEC_MI2S_EBIT,
|
||||
|
@ -694,6 +697,37 @@ static int msm_sec_mi2s_tx_bit_format_put(struct snd_kcontrol *kcontrol,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int msm_sec_mi2s_rate_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
ucontrol->value.integer.value[0] = msm_sec_mi2s_rate;
|
||||
pr_debug("%s: msm_sec_mi2s_rate = %d\n", __func__, msm_sec_mi2s_rate);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int msm_sec_mi2s_rate_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
switch (ucontrol->value.integer.value[0]) {
|
||||
case 0:
|
||||
msm_sec_mi2s_rate = SAMPLING_RATE_32KHZ;
|
||||
break;
|
||||
case 1:
|
||||
msm_sec_mi2s_rate = SAMPLING_RATE_44P1KHZ;
|
||||
break;
|
||||
case 2:
|
||||
msm_sec_mi2s_rate = SAMPLING_RATE_48KHZ;
|
||||
break;
|
||||
default:
|
||||
msm_sec_mi2s_rate = SAMPLING_RATE_48KHZ;
|
||||
break;
|
||||
}
|
||||
pr_debug("%s: msm_sec_mi2s_rate = %d\n",
|
||||
__func__, msm_sec_mi2s_rate);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int msm_sec_tdm_tx_0_ch_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
|
@ -1982,11 +2016,14 @@ static int msm_mi2s_tx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
|
|||
struct snd_interval *channels = hw_param_interval(params,
|
||||
SNDRV_PCM_HW_PARAM_CHANNELS);
|
||||
|
||||
rate->min = rate->max = SAMPLING_RATE_48KHZ;
|
||||
|
||||
switch (cpu_dai->id) {
|
||||
case 0: /*MSM_PRIM_MI2S*/
|
||||
break;
|
||||
case 1: /*MSM_SEC_MI2S*/
|
||||
pr_debug("%s: channel:%d\n", __func__, msm_sec_mi2s_tx_ch);
|
||||
rate->min = rate->max = msm_sec_mi2s_rate;
|
||||
channels->min = channels->max = msm_sec_mi2s_tx_ch;
|
||||
param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT,
|
||||
msm_sec_mi2s_tx_bit_format);
|
||||
|
@ -2004,7 +2041,6 @@ static int msm_mi2s_tx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
|
|||
__func__, cpu_dai->id);
|
||||
return -EINVAL;
|
||||
}
|
||||
rate->min = rate->max = SAMPLING_RATE_48KHZ;
|
||||
|
||||
pr_debug("%s: dai id = 0x%x channels = %d rate = %d format = 0x%x\n",
|
||||
__func__, cpu_dai->id, channels->max, rate->max,
|
||||
|
@ -2630,6 +2666,7 @@ static const struct soc_enum msm_snd_enum[] = {
|
|||
SOC_ENUM_SINGLE_EXT(9, ec_ref_ch_text),
|
||||
SOC_ENUM_SINGLE_EXT(3, ec_ref_bit_format_text),
|
||||
SOC_ENUM_SINGLE_EXT(9, ec_ref_rate_text),
|
||||
SOC_ENUM_SINGLE_EXT(3, mi2s_rate_text),
|
||||
};
|
||||
|
||||
static const struct snd_kcontrol_new msm_snd_controls[] = {
|
||||
|
@ -2757,6 +2794,8 @@ static const struct snd_kcontrol_new msm_snd_controls[] = {
|
|||
SOC_ENUM_EXT("SEC_MI2S_TX Bit Format", msm_snd_enum[7],
|
||||
msm_sec_mi2s_tx_bit_format_get,
|
||||
msm_sec_mi2s_tx_bit_format_put),
|
||||
SOC_ENUM_EXT("SEC_MI2S_TX SampleRate", msm_snd_enum[11],
|
||||
msm_sec_mi2s_rate_get, msm_sec_mi2s_rate_put),
|
||||
SOC_ENUM_EXT("EC Reference Channels", msm_snd_enum[8],
|
||||
msm_ec_ref_ch_get, msm_ec_ref_ch_put),
|
||||
SOC_ENUM_EXT("EC Reference Bit Format", msm_snd_enum[9],
|
||||
|
@ -3058,20 +3097,22 @@ static struct snd_soc_dai_link apq8096_common_dai_links[] = {
|
|||
.ops = &apq8096_ll_ops,
|
||||
},
|
||||
{
|
||||
.name = "Listen 1 Audio Service",
|
||||
.stream_name = "Listen 1 Audio Service",
|
||||
.cpu_dai_name = "LSM1",
|
||||
.platform_name = "msm-lsm-client",
|
||||
.name = "MSM8996 Media20",
|
||||
.stream_name = "MultiMedia20",
|
||||
.cpu_dai_name = "MultiMedia20",
|
||||
.platform_name = "msm-pcm-loopback",
|
||||
.dynamic = 1,
|
||||
.dpcm_playback = 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,
|
||||
.trigger = {SND_SOC_DPCM_TRIGGER_POST,
|
||||
SND_SOC_DPCM_TRIGGER_POST},
|
||||
.codec_dai_name = "snd-soc-dummy-dai",
|
||||
.codec_name = "snd-soc-dummy",
|
||||
.be_id = MSM_FRONTEND_DAI_LSM1,
|
||||
.ignore_suspend = 1,
|
||||
.no_host_mode = SND_SOC_DAI_LINK_NO_HOST,
|
||||
/* this dainlink has playback support */
|
||||
.ignore_pmdown_time = 1,
|
||||
.be_id = MSM_FRONTEND_DAI_MULTIMEDIA20,
|
||||
},
|
||||
/* Multiple Tunnel instances */
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue