summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2017-01-10 12:27:07 -0800
committerGerrit - the friendly Code Review server <code-review@localhost>2017-01-10 12:27:07 -0800
commit1847eaf629806a7351cf496510d257026a8111ed (patch)
tree3cada52c0a05a391f4c65108341f4ebaca04855f /sound
parente7bbbbb03149145778810a4de89bfdcb63de44c6 (diff)
parent8976fa2c87fd9a30e09d9cadaf4482b9446c9dca (diff)
Merge "ASoC: msm: Add support for INT5_MI2S vi feedback"
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/msm/qdsp6v2/msm-dai-q6-v2.c69
-rw-r--r--sound/soc/msm/qdsp6v2/msm-pcm-routing-v2.c51
-rw-r--r--sound/soc/msm/sdm660-internal.c4
3 files changed, 118 insertions, 6 deletions
diff --git a/sound/soc/msm/qdsp6v2/msm-dai-q6-v2.c b/sound/soc/msm/qdsp6v2/msm-dai-q6-v2.c
index 26cdd0fa7ad7..954db7943e48 100644
--- a/sound/soc/msm/qdsp6v2/msm-dai-q6-v2.c
+++ b/sound/soc/msm/qdsp6v2/msm-dai-q6-v2.c
@@ -1,4 +1,4 @@
-/* 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
@@ -52,6 +52,11 @@ enum {
ENC_FMT_APTX_HD = ASM_MEDIA_FMT_APTX_HD,
};
+enum {
+ SPKR_1,
+ SPKR_2,
+};
+
static const struct afe_clk_set lpass_clk_set_default = {
AFE_API_VERSION_CLOCK_SET,
Q6AFE_LPASS_CLK_ID_PRI_PCM_IBIT,
@@ -176,6 +181,7 @@ struct msm_dai_q6_dai_data {
u16 afe_in_bitformat;
struct afe_enc_config enc_config;
union afe_port_config port_config;
+ u16 vi_feed_mono;
};
struct msm_dai_q6_spdif_dai_data {
@@ -231,8 +237,14 @@ static const char *const mi2s_format[] = {
"Compr-60958"
};
+static const char *const mi2s_vi_feed_mono[] = {
+ "Left",
+ "Right",
+};
+
static const struct soc_enum mi2s_config_enum[] = {
SOC_ENUM_SINGLE_EXT(4, mi2s_format),
+ SOC_ENUM_SINGLE_EXT(2, mi2s_vi_feed_mono),
};
static const char *const sb_format[] = {
@@ -3346,6 +3358,26 @@ static int msm_dai_q6_mi2s_format_get(struct snd_kcontrol *kcontrol,
return 0;
}
+static int msm_dai_q6_mi2s_vi_feed_mono_put(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct msm_dai_q6_dai_data *dai_data = kcontrol->private_data;
+ int value = ucontrol->value.integer.value[0];
+
+ dai_data->vi_feed_mono = value;
+ pr_debug("%s: value = %d\n", __func__, value);
+ return 0;
+}
+
+static int msm_dai_q6_mi2s_vi_feed_mono_get(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct msm_dai_q6_dai_data *dai_data = kcontrol->private_data;
+
+ ucontrol->value.integer.value[0] = dai_data->vi_feed_mono;
+ return 0;
+}
+
static const struct snd_kcontrol_new mi2s_config_controls[] = {
SOC_ENUM_EXT("PRI MI2S RX Format", mi2s_config_enum[0],
msm_dai_q6_mi2s_format_get,
@@ -3380,6 +3412,15 @@ static const struct snd_kcontrol_new mi2s_config_controls[] = {
SOC_ENUM_EXT("SENARY MI2S TX Format", mi2s_config_enum[0],
msm_dai_q6_mi2s_format_get,
msm_dai_q6_mi2s_format_put),
+ SOC_ENUM_EXT("INT5 MI2S TX Format", mi2s_config_enum[0],
+ msm_dai_q6_mi2s_format_get,
+ msm_dai_q6_mi2s_format_put),
+};
+
+static const struct snd_kcontrol_new mi2s_vi_feed_controls[] = {
+ SOC_ENUM_EXT("INT5 MI2S VI MONO", mi2s_config_enum[1],
+ msm_dai_q6_mi2s_vi_feed_mono_get,
+ msm_dai_q6_mi2s_vi_feed_mono_put),
};
static int msm_dai_q6_dai_mi2s_probe(struct snd_soc_dai *dai)
@@ -3391,6 +3432,7 @@ static int msm_dai_q6_dai_mi2s_probe(struct snd_soc_dai *dai)
struct snd_kcontrol *kcontrol = NULL;
int rc = 0;
const struct snd_kcontrol_new *ctrl = NULL;
+ const struct snd_kcontrol_new *vi_feed_ctrl = NULL;
dai->id = mi2s_pdata->intf_id;
@@ -3433,6 +3475,8 @@ static int msm_dai_q6_dai_mi2s_probe(struct snd_soc_dai *dai)
ctrl = &mi2s_config_controls[9];
if (dai->id == MSM_SENARY_MI2S)
ctrl = &mi2s_config_controls[10];
+ if (dai->id == MSM_INT5_MI2S)
+ ctrl = &mi2s_config_controls[11];
}
if (ctrl) {
@@ -3448,6 +3492,21 @@ static int msm_dai_q6_dai_mi2s_probe(struct snd_soc_dai *dai)
__func__, dai->name);
}
}
+
+ if (dai->id == MSM_INT5_MI2S)
+ vi_feed_ctrl = &mi2s_vi_feed_controls[0];
+
+ if (vi_feed_ctrl) {
+ rc = snd_ctl_add(dai->component->card->snd_card,
+ snd_ctl_new1(vi_feed_ctrl,
+ &mi2s_dai_data->tx_dai.mi2s_dai_data));
+
+ if (IS_ERR_VALUE(rc)) {
+ dev_err(dai->dev, "%s: err add TX vi feed channel ctl DAI = %s\n",
+ __func__, dai->name);
+ }
+ }
+
rc = msm_dai_q6_dai_add_route(dai);
rtn:
return rc;
@@ -3695,8 +3754,12 @@ static int msm_dai_q6_mi2s_hw_params(struct snd_pcm_substream *substream,
case AFE_PORT_I2S_QUAD01:
case AFE_PORT_I2S_6CHS:
case AFE_PORT_I2S_8CHS:
- dai_data->port_config.i2s.channel_mode =
- AFE_PORT_I2S_SD0;
+ if (dai_data->vi_feed_mono == SPKR_1)
+ dai_data->port_config.i2s.channel_mode =
+ AFE_PORT_I2S_SD0;
+ else
+ dai_data->port_config.i2s.channel_mode =
+ AFE_PORT_I2S_SD1;
break;
case AFE_PORT_I2S_QUAD23:
dai_data->port_config.i2s.channel_mode =
diff --git a/sound/soc/msm/qdsp6v2/msm-pcm-routing-v2.c b/sound/soc/msm/qdsp6v2/msm-pcm-routing-v2.c
index dc57ae804dfa..03994225edcf 100644
--- a/sound/soc/msm/qdsp6v2/msm-pcm-routing-v2.c
+++ b/sound/soc/msm/qdsp6v2/msm-pcm-routing-v2.c
@@ -1,4 +1,4 @@
-/* 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
@@ -8386,6 +8386,14 @@ static const char * const mi2s_rx_vi_fb_tx_mux_text[] = {
"ZERO", "SENARY_TX"
};
+static const char * const int4_mi2s_rx_vi_fb_tx_mono_mux_text[] = {
+ "ZERO", "INT5_MI2S_TX"
+};
+
+static const char * const int4_mi2s_rx_vi_fb_tx_stereo_mux_text[] = {
+ "ZERO", "INT5_MI2S_TX"
+};
+
static const int const slim0_rx_vi_fb_tx_lch_value[] = {
MSM_BACKEND_DAI_MAX, MSM_BACKEND_DAI_SLIMBUS_4_TX
};
@@ -8398,6 +8406,14 @@ static const int const mi2s_rx_vi_fb_tx_value[] = {
MSM_BACKEND_DAI_MAX, MSM_BACKEND_DAI_SENARY_MI2S_TX
};
+static const int const int4_mi2s_rx_vi_fb_tx_mono_ch_value[] = {
+ MSM_BACKEND_DAI_MAX, MSM_BACKEND_DAI_INT5_MI2S_TX
+};
+
+static const int const int4_mi2s_rx_vi_fb_tx_stereo_ch_value[] = {
+ MSM_BACKEND_DAI_MAX, MSM_BACKEND_DAI_INT5_MI2S_TX
+};
+
static const struct soc_enum slim0_rx_vi_fb_lch_mux_enum =
SOC_VALUE_ENUM_DOUBLE(0, MSM_BACKEND_DAI_SLIMBUS_0_RX, 0, 0,
ARRAY_SIZE(slim0_rx_vi_fb_tx_lch_mux_text),
@@ -8413,6 +8429,18 @@ static const struct soc_enum mi2s_rx_vi_fb_mux_enum =
ARRAY_SIZE(mi2s_rx_vi_fb_tx_mux_text),
mi2s_rx_vi_fb_tx_mux_text, mi2s_rx_vi_fb_tx_value);
+static const struct soc_enum int4_mi2s_rx_vi_fb_mono_ch_mux_enum =
+ SOC_VALUE_ENUM_DOUBLE(0, MSM_BACKEND_DAI_INT4_MI2S_RX, 0, 0,
+ ARRAY_SIZE(int4_mi2s_rx_vi_fb_tx_mono_mux_text),
+ int4_mi2s_rx_vi_fb_tx_mono_mux_text,
+ int4_mi2s_rx_vi_fb_tx_mono_ch_value);
+
+static const struct soc_enum int4_mi2s_rx_vi_fb_stereo_ch_mux_enum =
+ SOC_VALUE_ENUM_DOUBLE(0, MSM_BACKEND_DAI_INT4_MI2S_RX, 0, 0,
+ ARRAY_SIZE(int4_mi2s_rx_vi_fb_tx_stereo_mux_text),
+ int4_mi2s_rx_vi_fb_tx_stereo_mux_text,
+ int4_mi2s_rx_vi_fb_tx_stereo_ch_value);
+
static const struct snd_kcontrol_new slim0_rx_vi_fb_lch_mux =
SOC_DAPM_ENUM_EXT("SLIM0_RX_VI_FB_LCH_MUX",
slim0_rx_vi_fb_lch_mux_enum, spkr_prot_get_vi_lch_port,
@@ -8428,6 +8456,16 @@ static const struct snd_kcontrol_new mi2s_rx_vi_fb_mux =
mi2s_rx_vi_fb_mux_enum, spkr_prot_get_vi_lch_port,
spkr_prot_put_vi_lch_port);
+static const struct snd_kcontrol_new int4_mi2s_rx_vi_fb_mono_ch_mux =
+ SOC_DAPM_ENUM_EXT("INT4_MI2S_RX_VI_FB_MONO_CH_MUX",
+ int4_mi2s_rx_vi_fb_mono_ch_mux_enum, spkr_prot_get_vi_lch_port,
+ spkr_prot_put_vi_lch_port);
+
+static const struct snd_kcontrol_new int4_mi2s_rx_vi_fb_stereo_ch_mux =
+ SOC_DAPM_ENUM_EXT("INT4_MI2S_RX_VI_FB_STEREO_CH_MUX",
+ int4_mi2s_rx_vi_fb_stereo_ch_mux_enum, spkr_prot_get_vi_rch_port,
+ spkr_prot_put_vi_rch_port);
+
static const struct snd_soc_dapm_widget msm_qdsp6_widgets[] = {
/* Frontend AIF */
/* Widget name equals to Front-End DAI name<Need confirmation>,
@@ -8986,6 +9024,8 @@ static const struct snd_soc_dapm_widget msm_qdsp6_widgets[] = {
0, 0, 0, 0),
SND_SOC_DAPM_AIF_IN("SENARY_TX", "Senary_mi2s Capture",
0, 0, 0, 0),
+ SND_SOC_DAPM_AIF_IN("INT5_MI2S_TX", "INT5 MI2S Capture",
+ 0, 0, 0, 0),
SND_SOC_DAPM_AIF_IN("SLIMBUS_5_TX", "Slimbus5 Capture", 0, 0, 0, 0),
SND_SOC_DAPM_AIF_OUT("AUX_PCM_RX", "AUX PCM Playback", 0, 0, 0, 0),
@@ -9433,6 +9473,10 @@ static const struct snd_soc_dapm_widget msm_qdsp6_widgets[] = {
&slim0_rx_vi_fb_rch_mux),
SND_SOC_DAPM_MUX("PRI_MI2S_RX_VI_FB_MUX", SND_SOC_NOPM, 0, 0,
&mi2s_rx_vi_fb_mux),
+ SND_SOC_DAPM_MUX("INT4_MI2S_RX_VI_FB_MONO_CH_MUX", SND_SOC_NOPM, 0, 0,
+ &int4_mi2s_rx_vi_fb_mono_ch_mux),
+ SND_SOC_DAPM_MUX("INT4_MI2S_RX_VI_FB_STEREO_CH_MUX", SND_SOC_NOPM, 0, 0,
+ &int4_mi2s_rx_vi_fb_stereo_ch_mux),
SND_SOC_DAPM_MUX("VOC_EXT_EC MUX", SND_SOC_NOPM, 0, 0,
&voc_ext_ec_mux),
@@ -11440,6 +11484,7 @@ static const struct snd_soc_dapm_route intercon[] = {
{"TERT_MI2S_TX", NULL, "BE_IN"},
{"INT2_MI2S_TX", NULL, "BE_IN"},
{"INT3_MI2S_TX", NULL, "BE_IN"},
+ {"INT5_MI2S_TX", NULL, "BE_IN"},
{"SEC_MI2S_TX", NULL, "BE_IN"},
{"SENARY_MI2S_TX", NULL, "BE_IN" },
{"SLIMBUS_0_TX", NULL, "BE_IN" },
@@ -11469,9 +11514,13 @@ static const struct snd_soc_dapm_route intercon[] = {
{"SLIM0_RX_VI_FB_LCH_MUX", "SLIM4_TX", "SLIMBUS_4_TX"},
{"SLIM0_RX_VI_FB_RCH_MUX", "SLIM4_TX", "SLIMBUS_4_TX"},
{"PRI_MI2S_RX_VI_FB_MUX", "SENARY_TX", "SENARY_TX"},
+ {"INT4_MI2S_RX_VI_FB_MONO_CH_MUX", "INT5_MI2S_TX", "INT5_MI2S_TX"},
+ {"INT4_MI2S_RX_VI_FB_STEREO_CH_MUX", "INT5_MI2S_TX", "INT5_MI2S_TX"},
{"SLIMBUS_0_RX", NULL, "SLIM0_RX_VI_FB_LCH_MUX"},
{"SLIMBUS_0_RX", NULL, "SLIM0_RX_VI_FB_RCH_MUX"},
{"PRI_MI2S_RX", NULL, "PRI_MI2S_RX_VI_FB_MUX"},
+ {"INT4_MI2S_RX", NULL, "INT4_MI2S_RX_VI_FB_MONO_CH_MUX"},
+ {"INT4_MI2S_RX", NULL, "INT4_MI2S_RX_VI_FB_STEREO_CH_MUX"},
{"PRI_TDM_TX_0", NULL, "BE_IN"},
{"SEC_TDM_TX_0", NULL, "BE_IN"},
{"TERT_TDM_TX_0", NULL, "BE_IN"},
diff --git a/sound/soc/msm/sdm660-internal.c b/sound/soc/msm/sdm660-internal.c
index 5d3ec356343e..c5661dd7ec1e 100644
--- a/sound/soc/msm/sdm660-internal.c
+++ b/sound/soc/msm/sdm660-internal.c
@@ -1,4 +1,4 @@
-/* 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
@@ -2247,7 +2247,7 @@ static struct snd_soc_dai_link msm_int_dai[] = {
},
{/* hw:x,35 */
.name = LPASS_BE_INT5_MI2S_TX,
- .stream_name = "INT5_mi2s Capture",
+ .stream_name = "INT5 MI2S Capture",
.cpu_dai_name = "msm-dai-q6-mi2s.12",
.platform_name = "msm-pcm-hostless",
.codec_name = "msm_sdw_codec",