Loading sound/soc/msm/msm8996.c +43 −4 Original line number Diff line number Diff line Loading @@ -65,8 +65,10 @@ enum { static int slim0_rx_sample_rate = SAMPLING_RATE_48KHZ; static int slim0_tx_sample_rate = SAMPLING_RATE_48KHZ; static int slim1_tx_sample_rate = SAMPLING_RATE_48KHZ; static int slim0_rx_bit_format = SNDRV_PCM_FORMAT_S16_LE; static int slim0_tx_bit_format = SNDRV_PCM_FORMAT_S16_LE; static int slim1_tx_bit_format = SNDRV_PCM_FORMAT_S16_LE; static int hdmi_rx_bit_format = SNDRV_PCM_FORMAT_S16_LE; static int msm8996_auxpcm_rate = SAMPLING_RATE_8KHZ; static int slim5_rx_sample_rate = SAMPLING_RATE_48KHZ; Loading @@ -77,6 +79,7 @@ static int ext_us_amp_gpio = -1; static int msm8996_spk_control = 1; static int msm_slim_0_rx_ch = 1; static int msm_slim_0_tx_ch = 1; static int msm_slim_1_tx_ch = 1; static int msm_slim_5_rx_ch = 1; static int msm_hifi_control; static int msm_vi_feed_tx_ch = 2; Loading Loading @@ -885,6 +888,24 @@ static int msm_slim_0_tx_ch_put(struct snd_kcontrol *kcontrol, return 1; } static int msm_slim_1_tx_ch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { pr_debug("%s: msm_slim_1_tx_ch = %d\n", __func__, msm_slim_1_tx_ch); ucontrol->value.integer.value[0] = msm_slim_1_tx_ch - 1; return 0; } static int msm_slim_1_tx_ch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { msm_slim_1_tx_ch = ucontrol->value.integer.value[0] + 1; pr_debug("%s: msm_slim_1_tx_ch = %d\n", __func__, msm_slim_1_tx_ch); return 1; } static int msm_vi_feed_tx_ch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { Loading Loading @@ -1233,6 +1254,22 @@ static int msm_slim_0_tx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, return 0; } static int msm_slim_1_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); struct snd_interval *channels = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS); pr_debug("%s()\n", __func__); param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT, slim1_tx_bit_format); rate->min = rate->max = slim1_tx_sample_rate; channels->min = channels->max = msm_slim_1_tx_ch; return 0; } static int msm_slim_4_tx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_params *params) { Loading Loading @@ -1317,6 +1354,8 @@ static const struct snd_kcontrol_new msm_snd_controls[] = { msm_slim_5_rx_ch_get, msm_slim_5_rx_ch_put), SOC_ENUM_EXT("SLIM_0_TX Channels", msm_snd_enum[2], msm_slim_0_tx_ch_get, msm_slim_0_tx_ch_put), SOC_ENUM_EXT("SLIM_1_TX Channels", msm_snd_enum[2], msm_slim_1_tx_ch_get, msm_slim_1_tx_ch_put), SOC_ENUM_EXT("AUX PCM SampleRate", msm8996_auxpcm_enum[0], msm8996_auxpcm_rate_get, msm8996_auxpcm_rate_put), Loading Loading @@ -1790,9 +1829,9 @@ static int msm_snd_hw_params(struct snd_pcm_substream *substream, /* For <codec>_tx1 case */ if (dai_link->be_id == MSM_BACKEND_DAI_SLIMBUS_0_TX) user_set_tx_ch = msm_slim_0_tx_ch; /* For <codec>_tx2 case */ /* For <codec>_tx3 case */ else if (dai_link->be_id == MSM_BACKEND_DAI_SLIMBUS_1_TX) user_set_tx_ch = params_channels(params); user_set_tx_ch = msm_slim_1_tx_ch; else if (dai_link->be_id == MSM_BACKEND_DAI_SLIMBUS_3_TX) /* DAI 5 is used for external EC reference from codec. * Since Rx is fed as reference for EC, the config of Loading Loading @@ -2867,11 +2906,11 @@ static struct snd_soc_dai_link msm8996_tasha_be_dai_links[] = { .cpu_dai_name = "msm-dai-q6-dev.16387", .platform_name = "msm-pcm-routing", .codec_name = "tasha_codec", .codec_dai_name = "tasha_tx1", .codec_dai_name = "tasha_tx3", .no_pcm = 1, .dpcm_capture = 1, .be_id = MSM_BACKEND_DAI_SLIMBUS_1_TX, .be_hw_params_fixup = msm_slim_0_tx_be_hw_params_fixup, .be_hw_params_fixup = msm_slim_1_tx_be_hw_params_fixup, .ops = &msm8996_be_ops, .ignore_suspend = 1, }, Loading Loading
sound/soc/msm/msm8996.c +43 −4 Original line number Diff line number Diff line Loading @@ -65,8 +65,10 @@ enum { static int slim0_rx_sample_rate = SAMPLING_RATE_48KHZ; static int slim0_tx_sample_rate = SAMPLING_RATE_48KHZ; static int slim1_tx_sample_rate = SAMPLING_RATE_48KHZ; static int slim0_rx_bit_format = SNDRV_PCM_FORMAT_S16_LE; static int slim0_tx_bit_format = SNDRV_PCM_FORMAT_S16_LE; static int slim1_tx_bit_format = SNDRV_PCM_FORMAT_S16_LE; static int hdmi_rx_bit_format = SNDRV_PCM_FORMAT_S16_LE; static int msm8996_auxpcm_rate = SAMPLING_RATE_8KHZ; static int slim5_rx_sample_rate = SAMPLING_RATE_48KHZ; Loading @@ -77,6 +79,7 @@ static int ext_us_amp_gpio = -1; static int msm8996_spk_control = 1; static int msm_slim_0_rx_ch = 1; static int msm_slim_0_tx_ch = 1; static int msm_slim_1_tx_ch = 1; static int msm_slim_5_rx_ch = 1; static int msm_hifi_control; static int msm_vi_feed_tx_ch = 2; Loading Loading @@ -885,6 +888,24 @@ static int msm_slim_0_tx_ch_put(struct snd_kcontrol *kcontrol, return 1; } static int msm_slim_1_tx_ch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { pr_debug("%s: msm_slim_1_tx_ch = %d\n", __func__, msm_slim_1_tx_ch); ucontrol->value.integer.value[0] = msm_slim_1_tx_ch - 1; return 0; } static int msm_slim_1_tx_ch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { msm_slim_1_tx_ch = ucontrol->value.integer.value[0] + 1; pr_debug("%s: msm_slim_1_tx_ch = %d\n", __func__, msm_slim_1_tx_ch); return 1; } static int msm_vi_feed_tx_ch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { Loading Loading @@ -1233,6 +1254,22 @@ static int msm_slim_0_tx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, return 0; } static int msm_slim_1_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); struct snd_interval *channels = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS); pr_debug("%s()\n", __func__); param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT, slim1_tx_bit_format); rate->min = rate->max = slim1_tx_sample_rate; channels->min = channels->max = msm_slim_1_tx_ch; return 0; } static int msm_slim_4_tx_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_params *params) { Loading Loading @@ -1317,6 +1354,8 @@ static const struct snd_kcontrol_new msm_snd_controls[] = { msm_slim_5_rx_ch_get, msm_slim_5_rx_ch_put), SOC_ENUM_EXT("SLIM_0_TX Channels", msm_snd_enum[2], msm_slim_0_tx_ch_get, msm_slim_0_tx_ch_put), SOC_ENUM_EXT("SLIM_1_TX Channels", msm_snd_enum[2], msm_slim_1_tx_ch_get, msm_slim_1_tx_ch_put), SOC_ENUM_EXT("AUX PCM SampleRate", msm8996_auxpcm_enum[0], msm8996_auxpcm_rate_get, msm8996_auxpcm_rate_put), Loading Loading @@ -1790,9 +1829,9 @@ static int msm_snd_hw_params(struct snd_pcm_substream *substream, /* For <codec>_tx1 case */ if (dai_link->be_id == MSM_BACKEND_DAI_SLIMBUS_0_TX) user_set_tx_ch = msm_slim_0_tx_ch; /* For <codec>_tx2 case */ /* For <codec>_tx3 case */ else if (dai_link->be_id == MSM_BACKEND_DAI_SLIMBUS_1_TX) user_set_tx_ch = params_channels(params); user_set_tx_ch = msm_slim_1_tx_ch; else if (dai_link->be_id == MSM_BACKEND_DAI_SLIMBUS_3_TX) /* DAI 5 is used for external EC reference from codec. * Since Rx is fed as reference for EC, the config of Loading Loading @@ -2867,11 +2906,11 @@ static struct snd_soc_dai_link msm8996_tasha_be_dai_links[] = { .cpu_dai_name = "msm-dai-q6-dev.16387", .platform_name = "msm-pcm-routing", .codec_name = "tasha_codec", .codec_dai_name = "tasha_tx1", .codec_dai_name = "tasha_tx3", .no_pcm = 1, .dpcm_capture = 1, .be_id = MSM_BACKEND_DAI_SLIMBUS_1_TX, .be_hw_params_fixup = msm_slim_0_tx_be_hw_params_fixup, .be_hw_params_fixup = msm_slim_1_tx_be_hw_params_fixup, .ops = &msm8996_be_ops, .ignore_suspend = 1, }, Loading