diff options
author | Krishnankutty Kolathappilly <kkolat@codeaurora.org> | 2013-06-06 17:54:40 -0700 |
---|---|---|
committer | Stephen Boyd <sboyd@codeaurora.org> | 2013-09-04 16:59:03 -0700 |
commit | 5c38f79f37763933dabd3c2c862451f04c48e44c (patch) | |
tree | 9db829fda5989c129c9d7f5a6d5eae075e9ee251 /sound/soc/msm/msm8226.c | |
parent | 59fb7b56f790f381041a20eeba61cbd98ee97f35 (diff) |
ASoC: msm8226: Support multichannel playback over proxy port
Add kcontrol to allow configuring the proxy backend to six channels.
This is to support multichannel playback over proxy port on 8x26.
Change-Id: Ib2994edadbb2e1afcace1f058c21458c4b82d6ea
Signed-off-by: Krishnankutty Kolathappilly <kkolat@codeaurora.org>
Diffstat (limited to 'sound/soc/msm/msm8226.c')
-rw-r--r-- | sound/soc/msm/msm8226.c | 51 |
1 files changed, 45 insertions, 6 deletions
diff --git a/sound/soc/msm/msm8226.c b/sound/soc/msm/msm8226.c index 937b47389c76..2dcae0526687 100644 --- a/sound/soc/msm/msm8226.c +++ b/sound/soc/msm/msm8226.c @@ -126,6 +126,7 @@ static struct mutex cdc_mclk_mutex; static struct clk *codec_clk; static int clk_users; static int vdd_spkr_gpio = -1; +static int msm_proxy_rx_ch = 2; static int msm_snd_enable_codec_ext_clk(struct snd_soc_codec *codec, int enable, bool dapm) @@ -235,6 +236,8 @@ static const struct snd_soc_dapm_widget msm8226_dapm_widgets[] = { static const char *const slim0_rx_ch_text[] = {"One", "Two"}; static const char *const slim0_tx_ch_text[] = {"One", "Two", "Three", "Four"}; +static const char *const proxy_rx_ch_text[] = {"One", "Two", "Three", "Four", + "Five", "Six", "Seven", "Eight"}; static const struct soc_enum msm_enum[] = { SOC_ENUM_SINGLE_EXT(2, slim0_rx_ch_text), @@ -349,6 +352,23 @@ static int msm8226_auxpcm_rate_put(struct snd_kcontrol *kcontrol, return 0; } +static int msm_proxy_rx_ch_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + pr_debug("%s: msm_proxy_rx_ch = %d\n", __func__, + msm_proxy_rx_ch); + ucontrol->value.integer.value[0] = msm_proxy_rx_ch - 1; + return 0; +} + +static int msm_proxy_rx_ch_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ + msm_proxy_rx_ch = ucontrol->value.integer.value[0] + 1; + pr_debug("%s: msm_proxy_rx_ch = %d\n", __func__, + msm_proxy_rx_ch); + return 1; +} static int msm_auxpcm_be_params_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_params *params) { @@ -364,15 +384,31 @@ static int msm_auxpcm_be_params_fixup(struct snd_soc_pcm_runtime *rtd, return 0; } -static int msm_proxy_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, - struct snd_pcm_hw_params *params) +static int msm_proxy_rx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, + struct snd_pcm_hw_params *params) { struct snd_interval *rate = hw_param_interval(params, - SNDRV_PCM_HW_PARAM_RATE); + SNDRV_PCM_HW_PARAM_RATE); - pr_debug("%s()\n", __func__); + struct snd_interval *channels = hw_param_interval(params, + SNDRV_PCM_HW_PARAM_CHANNELS); + + pr_debug("%s: msm_proxy_rx_ch =%d\n", __func__, msm_proxy_rx_ch); + + if (channels->max < 2) + channels->min = channels->max = 2; + channels->min = channels->max = msm_proxy_rx_ch; rate->min = rate->max = 48000; + return 0; +} +static int msm_proxy_tx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, + struct snd_pcm_hw_params *params) +{ + struct snd_interval *rate = hw_param_interval(params, + SNDRV_PCM_HW_PARAM_RATE); + + rate->min = rate->max = 48000; return 0; } @@ -535,6 +571,7 @@ static int msm_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, static const struct soc_enum msm_snd_enum[] = { SOC_ENUM_SINGLE_EXT(2, slim0_rx_ch_text), SOC_ENUM_SINGLE_EXT(4, slim0_tx_ch_text), + SOC_ENUM_SINGLE_EXT(8, proxy_rx_ch_text), }; static const struct snd_kcontrol_new msm_snd_controls[] = { @@ -546,6 +583,8 @@ static const struct snd_kcontrol_new msm_snd_controls[] = { msm8226_auxpcm_rate_get, msm8226_auxpcm_rate_put), SOC_ENUM_EXT("Internal BTSCO SampleRate", msm_btsco_enum[0], msm_btsco_rate_get, msm_btsco_rate_put), + SOC_ENUM_EXT("PROXY_RX Channels", msm_snd_enum[2], + msm_proxy_rx_ch_get, msm_proxy_rx_ch_put), }; static int msm_audrx_init(struct snd_soc_pcm_runtime *rtd) @@ -1049,7 +1088,7 @@ static struct snd_soc_dai_link msm8226_dai[] = { .codec_dai_name = "msm-stub-rx", .no_pcm = 1, .be_id = MSM_BACKEND_DAI_AFE_PCM_RX, - .be_hw_params_fixup = msm_proxy_be_hw_params_fixup, + .be_hw_params_fixup = msm_proxy_rx_be_hw_params_fixup, /* this dainlink has playback support */ .ignore_pmdown_time = 1, .ignore_suspend = 1, @@ -1063,7 +1102,7 @@ static struct snd_soc_dai_link msm8226_dai[] = { .codec_dai_name = "msm-stub-tx", .no_pcm = 1, .be_id = MSM_BACKEND_DAI_AFE_PCM_TX, - .be_hw_params_fixup = msm_proxy_be_hw_params_fixup, + .be_hw_params_fixup = msm_proxy_tx_be_hw_params_fixup, .ignore_suspend = 1, }, /* HDMI Hostless */ |