Loading sound/soc/codecs/sdm660_cdc/msm-digital-cdc.c +10 −2 Original line number Diff line number Diff line Loading @@ -2085,10 +2085,18 @@ static int msm_dig_cdc_remove(struct platform_device *pdev) #ifdef CONFIG_PM static int msm_dig_suspend(struct device *dev) { struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(registered_digcodec->component.card); struct msm_asoc_mach_data *pdata; struct msm_dig_priv *msm_dig_cdc = dev_get_drvdata(dev); if (!registered_digcodec || !msm_dig_cdc) { pr_debug("%s:digcodec not initialized, return\n", __func__); return 0; } pdata = snd_soc_card_get_drvdata(registered_digcodec->component.card); if (!pdata) { pr_debug("%s:card not initialized, return\n", __func__); return 0; } if (msm_dig_cdc->dapm_bias_off) { pr_debug("%s: mclk cnt = %d, mclk_enabled = %d\n", __func__, atomic_read(&pdata->int_mclk0_rsc_ref), Loading sound/soc/msm/msm8998.c +155 −0 Original line number Diff line number Diff line Loading @@ -496,6 +496,8 @@ static SOC_ENUM_SINGLE_EXT_DECL(tert_mi2s_rx_chs, mi2s_ch_text); static SOC_ENUM_SINGLE_EXT_DECL(tert_mi2s_tx_chs, mi2s_ch_text); static SOC_ENUM_SINGLE_EXT_DECL(quat_mi2s_rx_chs, mi2s_ch_text); static SOC_ENUM_SINGLE_EXT_DECL(quat_mi2s_tx_chs, mi2s_ch_text); static SOC_ENUM_SINGLE_EXT_DECL(mi2s_rx_format, bit_format_text); static SOC_ENUM_SINGLE_EXT_DECL(mi2s_tx_format, bit_format_text); static SOC_ENUM_SINGLE_EXT_DECL(hifi_function, hifi_text); static struct platform_device *spdev; Loading Loading @@ -2263,6 +2265,54 @@ static int mi2s_get_sample_rate(int value) return sample_rate; } static int mi2s_get_format(int value) { int format; switch (value) { case 0: format = SNDRV_PCM_FORMAT_S16_LE; break; case 1: format = SNDRV_PCM_FORMAT_S24_LE; break; case 2: format = SNDRV_PCM_FORMAT_S24_3LE; break; case 3: format = SNDRV_PCM_FORMAT_S32_LE; break; default: format = SNDRV_PCM_FORMAT_S16_LE; break; } return format; } static int mi2s_get_format_value(int format) { int value; switch (format) { case SNDRV_PCM_FORMAT_S16_LE: value = 0; break; case SNDRV_PCM_FORMAT_S24_LE: value = 1; break; case SNDRV_PCM_FORMAT_S24_3LE: value = 2; break; case SNDRV_PCM_FORMAT_S32_LE: value = 3; break; default: value = 0; break; } return value; } static int mi2s_rx_sample_rate_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { Loading Loading @@ -2395,6 +2445,78 @@ static int msm_mi2s_tx_ch_put(struct snd_kcontrol *kcontrol, return 1; } static int msm_mi2s_rx_format_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { int idx = mi2s_get_port_idx(kcontrol); if (idx < 0) return idx; ucontrol->value.enumerated.item[0] = mi2s_get_format_value(mi2s_rx_cfg[idx].bit_format); pr_debug("%s: idx[%d]_rx_format = %d, item = %d\n", __func__, idx, mi2s_rx_cfg[idx].bit_format, ucontrol->value.enumerated.item[0]); return 0; } static int msm_mi2s_rx_format_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { int idx = mi2s_get_port_idx(kcontrol); if (idx < 0) return idx; mi2s_rx_cfg[idx].bit_format = mi2s_get_format(ucontrol->value.enumerated.item[0]); pr_debug("%s: idx[%d]_rx_format = %d, item = %d\n", __func__, idx, mi2s_rx_cfg[idx].bit_format, ucontrol->value.enumerated.item[0]); return 0; } static int msm_mi2s_tx_format_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { int idx = mi2s_get_port_idx(kcontrol); if (idx < 0) return idx; ucontrol->value.enumerated.item[0] = mi2s_get_format_value(mi2s_tx_cfg[idx].bit_format); pr_debug("%s: idx[%d]_tx_format = %d, item = %d\n", __func__, idx, mi2s_tx_cfg[idx].bit_format, ucontrol->value.enumerated.item[0]); return 0; } static int msm_mi2s_tx_format_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { int idx = mi2s_get_port_idx(kcontrol); if (idx < 0) return idx; mi2s_tx_cfg[idx].bit_format = mi2s_get_format(ucontrol->value.enumerated.item[0]); pr_debug("%s: idx[%d]_tx_format = %d, item = %d\n", __func__, idx, mi2s_tx_cfg[idx].bit_format, ucontrol->value.enumerated.item[0]); return 0; } static int msm_hifi_ctrl(struct snd_soc_codec *codec) { struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); Loading Loading @@ -2647,6 +2769,22 @@ static const struct snd_kcontrol_new msm_snd_controls[] = { msm_mi2s_rx_ch_get, msm_mi2s_rx_ch_put), SOC_ENUM_EXT("QUAT_MI2S_TX Channels", quat_mi2s_tx_chs, msm_mi2s_tx_ch_get, msm_mi2s_tx_ch_put), SOC_ENUM_EXT("PRIM_MI2S_RX Format", mi2s_rx_format, msm_mi2s_rx_format_get, msm_mi2s_rx_format_put), SOC_ENUM_EXT("PRIM_MI2S_TX Format", mi2s_tx_format, msm_mi2s_tx_format_get, msm_mi2s_tx_format_put), SOC_ENUM_EXT("SEC_MI2S_RX Format", mi2s_rx_format, msm_mi2s_rx_format_get, msm_mi2s_rx_format_put), SOC_ENUM_EXT("SEC_MI2S_TX Format", mi2s_tx_format, msm_mi2s_tx_format_get, msm_mi2s_tx_format_put), SOC_ENUM_EXT("TERT_MI2S_RX Format", mi2s_rx_format, msm_mi2s_rx_format_get, msm_mi2s_rx_format_put), SOC_ENUM_EXT("TERT_MI2S_TX Format", mi2s_tx_format, msm_mi2s_tx_format_get, msm_mi2s_tx_format_put), SOC_ENUM_EXT("QUAT_MI2S_RX Format", mi2s_rx_format, msm_mi2s_rx_format_get, msm_mi2s_rx_format_put), SOC_ENUM_EXT("QUAT_MI2S_TX Format", mi2s_tx_format, msm_mi2s_tx_format_get, msm_mi2s_tx_format_put), SOC_ENUM_EXT("HiFi Function", hifi_function, msm_hifi_get, msm_hifi_put), }; Loading Loading @@ -3111,48 +3249,64 @@ static int msm_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, break; case MSM_BACKEND_DAI_PRI_MI2S_RX: param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT, mi2s_rx_cfg[PRIM_MI2S].bit_format); rate->min = rate->max = mi2s_rx_cfg[PRIM_MI2S].sample_rate; channels->min = channels->max = mi2s_rx_cfg[PRIM_MI2S].channels; break; case MSM_BACKEND_DAI_PRI_MI2S_TX: param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT, mi2s_tx_cfg[PRIM_MI2S].bit_format); rate->min = rate->max = mi2s_tx_cfg[PRIM_MI2S].sample_rate; channels->min = channels->max = mi2s_tx_cfg[PRIM_MI2S].channels; break; case MSM_BACKEND_DAI_SECONDARY_MI2S_RX: param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT, mi2s_rx_cfg[SEC_MI2S].bit_format); rate->min = rate->max = mi2s_rx_cfg[SEC_MI2S].sample_rate; channels->min = channels->max = mi2s_rx_cfg[SEC_MI2S].channels; break; case MSM_BACKEND_DAI_SECONDARY_MI2S_TX: param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT, mi2s_tx_cfg[SEC_MI2S].bit_format); rate->min = rate->max = mi2s_tx_cfg[SEC_MI2S].sample_rate; channels->min = channels->max = mi2s_tx_cfg[SEC_MI2S].channels; break; case MSM_BACKEND_DAI_TERTIARY_MI2S_RX: param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT, mi2s_rx_cfg[TERT_MI2S].bit_format); rate->min = rate->max = mi2s_rx_cfg[TERT_MI2S].sample_rate; channels->min = channels->max = mi2s_rx_cfg[TERT_MI2S].channels; break; case MSM_BACKEND_DAI_TERTIARY_MI2S_TX: param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT, mi2s_tx_cfg[TERT_MI2S].bit_format); rate->min = rate->max = mi2s_tx_cfg[TERT_MI2S].sample_rate; channels->min = channels->max = mi2s_tx_cfg[TERT_MI2S].channels; break; case MSM_BACKEND_DAI_QUATERNARY_MI2S_RX: param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT, mi2s_rx_cfg[QUAT_MI2S].bit_format); rate->min = rate->max = mi2s_rx_cfg[QUAT_MI2S].sample_rate; channels->min = channels->max = mi2s_rx_cfg[QUAT_MI2S].channels; break; case MSM_BACKEND_DAI_QUATERNARY_MI2S_TX: param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT, mi2s_tx_cfg[QUAT_MI2S].bit_format); rate->min = rate->max = mi2s_tx_cfg[QUAT_MI2S].sample_rate; channels->min = channels->max = mi2s_tx_cfg[QUAT_MI2S].channels; Loading Loading @@ -3980,6 +4134,7 @@ static u32 get_mi2s_bits_per_sample(u32 bit_format) u32 bit_per_sample; switch (bit_format) { case SNDRV_PCM_FORMAT_S32_LE: case SNDRV_PCM_FORMAT_S24_3LE: case SNDRV_PCM_FORMAT_S24_LE: bit_per_sample = 32; Loading Loading
sound/soc/codecs/sdm660_cdc/msm-digital-cdc.c +10 −2 Original line number Diff line number Diff line Loading @@ -2085,10 +2085,18 @@ static int msm_dig_cdc_remove(struct platform_device *pdev) #ifdef CONFIG_PM static int msm_dig_suspend(struct device *dev) { struct msm_asoc_mach_data *pdata = snd_soc_card_get_drvdata(registered_digcodec->component.card); struct msm_asoc_mach_data *pdata; struct msm_dig_priv *msm_dig_cdc = dev_get_drvdata(dev); if (!registered_digcodec || !msm_dig_cdc) { pr_debug("%s:digcodec not initialized, return\n", __func__); return 0; } pdata = snd_soc_card_get_drvdata(registered_digcodec->component.card); if (!pdata) { pr_debug("%s:card not initialized, return\n", __func__); return 0; } if (msm_dig_cdc->dapm_bias_off) { pr_debug("%s: mclk cnt = %d, mclk_enabled = %d\n", __func__, atomic_read(&pdata->int_mclk0_rsc_ref), Loading
sound/soc/msm/msm8998.c +155 −0 Original line number Diff line number Diff line Loading @@ -496,6 +496,8 @@ static SOC_ENUM_SINGLE_EXT_DECL(tert_mi2s_rx_chs, mi2s_ch_text); static SOC_ENUM_SINGLE_EXT_DECL(tert_mi2s_tx_chs, mi2s_ch_text); static SOC_ENUM_SINGLE_EXT_DECL(quat_mi2s_rx_chs, mi2s_ch_text); static SOC_ENUM_SINGLE_EXT_DECL(quat_mi2s_tx_chs, mi2s_ch_text); static SOC_ENUM_SINGLE_EXT_DECL(mi2s_rx_format, bit_format_text); static SOC_ENUM_SINGLE_EXT_DECL(mi2s_tx_format, bit_format_text); static SOC_ENUM_SINGLE_EXT_DECL(hifi_function, hifi_text); static struct platform_device *spdev; Loading Loading @@ -2263,6 +2265,54 @@ static int mi2s_get_sample_rate(int value) return sample_rate; } static int mi2s_get_format(int value) { int format; switch (value) { case 0: format = SNDRV_PCM_FORMAT_S16_LE; break; case 1: format = SNDRV_PCM_FORMAT_S24_LE; break; case 2: format = SNDRV_PCM_FORMAT_S24_3LE; break; case 3: format = SNDRV_PCM_FORMAT_S32_LE; break; default: format = SNDRV_PCM_FORMAT_S16_LE; break; } return format; } static int mi2s_get_format_value(int format) { int value; switch (format) { case SNDRV_PCM_FORMAT_S16_LE: value = 0; break; case SNDRV_PCM_FORMAT_S24_LE: value = 1; break; case SNDRV_PCM_FORMAT_S24_3LE: value = 2; break; case SNDRV_PCM_FORMAT_S32_LE: value = 3; break; default: value = 0; break; } return value; } static int mi2s_rx_sample_rate_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { Loading Loading @@ -2395,6 +2445,78 @@ static int msm_mi2s_tx_ch_put(struct snd_kcontrol *kcontrol, return 1; } static int msm_mi2s_rx_format_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { int idx = mi2s_get_port_idx(kcontrol); if (idx < 0) return idx; ucontrol->value.enumerated.item[0] = mi2s_get_format_value(mi2s_rx_cfg[idx].bit_format); pr_debug("%s: idx[%d]_rx_format = %d, item = %d\n", __func__, idx, mi2s_rx_cfg[idx].bit_format, ucontrol->value.enumerated.item[0]); return 0; } static int msm_mi2s_rx_format_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { int idx = mi2s_get_port_idx(kcontrol); if (idx < 0) return idx; mi2s_rx_cfg[idx].bit_format = mi2s_get_format(ucontrol->value.enumerated.item[0]); pr_debug("%s: idx[%d]_rx_format = %d, item = %d\n", __func__, idx, mi2s_rx_cfg[idx].bit_format, ucontrol->value.enumerated.item[0]); return 0; } static int msm_mi2s_tx_format_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { int idx = mi2s_get_port_idx(kcontrol); if (idx < 0) return idx; ucontrol->value.enumerated.item[0] = mi2s_get_format_value(mi2s_tx_cfg[idx].bit_format); pr_debug("%s: idx[%d]_tx_format = %d, item = %d\n", __func__, idx, mi2s_tx_cfg[idx].bit_format, ucontrol->value.enumerated.item[0]); return 0; } static int msm_mi2s_tx_format_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { int idx = mi2s_get_port_idx(kcontrol); if (idx < 0) return idx; mi2s_tx_cfg[idx].bit_format = mi2s_get_format(ucontrol->value.enumerated.item[0]); pr_debug("%s: idx[%d]_tx_format = %d, item = %d\n", __func__, idx, mi2s_tx_cfg[idx].bit_format, ucontrol->value.enumerated.item[0]); return 0; } static int msm_hifi_ctrl(struct snd_soc_codec *codec) { struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); Loading Loading @@ -2647,6 +2769,22 @@ static const struct snd_kcontrol_new msm_snd_controls[] = { msm_mi2s_rx_ch_get, msm_mi2s_rx_ch_put), SOC_ENUM_EXT("QUAT_MI2S_TX Channels", quat_mi2s_tx_chs, msm_mi2s_tx_ch_get, msm_mi2s_tx_ch_put), SOC_ENUM_EXT("PRIM_MI2S_RX Format", mi2s_rx_format, msm_mi2s_rx_format_get, msm_mi2s_rx_format_put), SOC_ENUM_EXT("PRIM_MI2S_TX Format", mi2s_tx_format, msm_mi2s_tx_format_get, msm_mi2s_tx_format_put), SOC_ENUM_EXT("SEC_MI2S_RX Format", mi2s_rx_format, msm_mi2s_rx_format_get, msm_mi2s_rx_format_put), SOC_ENUM_EXT("SEC_MI2S_TX Format", mi2s_tx_format, msm_mi2s_tx_format_get, msm_mi2s_tx_format_put), SOC_ENUM_EXT("TERT_MI2S_RX Format", mi2s_rx_format, msm_mi2s_rx_format_get, msm_mi2s_rx_format_put), SOC_ENUM_EXT("TERT_MI2S_TX Format", mi2s_tx_format, msm_mi2s_tx_format_get, msm_mi2s_tx_format_put), SOC_ENUM_EXT("QUAT_MI2S_RX Format", mi2s_rx_format, msm_mi2s_rx_format_get, msm_mi2s_rx_format_put), SOC_ENUM_EXT("QUAT_MI2S_TX Format", mi2s_tx_format, msm_mi2s_tx_format_get, msm_mi2s_tx_format_put), SOC_ENUM_EXT("HiFi Function", hifi_function, msm_hifi_get, msm_hifi_put), }; Loading Loading @@ -3111,48 +3249,64 @@ static int msm_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, break; case MSM_BACKEND_DAI_PRI_MI2S_RX: param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT, mi2s_rx_cfg[PRIM_MI2S].bit_format); rate->min = rate->max = mi2s_rx_cfg[PRIM_MI2S].sample_rate; channels->min = channels->max = mi2s_rx_cfg[PRIM_MI2S].channels; break; case MSM_BACKEND_DAI_PRI_MI2S_TX: param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT, mi2s_tx_cfg[PRIM_MI2S].bit_format); rate->min = rate->max = mi2s_tx_cfg[PRIM_MI2S].sample_rate; channels->min = channels->max = mi2s_tx_cfg[PRIM_MI2S].channels; break; case MSM_BACKEND_DAI_SECONDARY_MI2S_RX: param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT, mi2s_rx_cfg[SEC_MI2S].bit_format); rate->min = rate->max = mi2s_rx_cfg[SEC_MI2S].sample_rate; channels->min = channels->max = mi2s_rx_cfg[SEC_MI2S].channels; break; case MSM_BACKEND_DAI_SECONDARY_MI2S_TX: param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT, mi2s_tx_cfg[SEC_MI2S].bit_format); rate->min = rate->max = mi2s_tx_cfg[SEC_MI2S].sample_rate; channels->min = channels->max = mi2s_tx_cfg[SEC_MI2S].channels; break; case MSM_BACKEND_DAI_TERTIARY_MI2S_RX: param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT, mi2s_rx_cfg[TERT_MI2S].bit_format); rate->min = rate->max = mi2s_rx_cfg[TERT_MI2S].sample_rate; channels->min = channels->max = mi2s_rx_cfg[TERT_MI2S].channels; break; case MSM_BACKEND_DAI_TERTIARY_MI2S_TX: param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT, mi2s_tx_cfg[TERT_MI2S].bit_format); rate->min = rate->max = mi2s_tx_cfg[TERT_MI2S].sample_rate; channels->min = channels->max = mi2s_tx_cfg[TERT_MI2S].channels; break; case MSM_BACKEND_DAI_QUATERNARY_MI2S_RX: param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT, mi2s_rx_cfg[QUAT_MI2S].bit_format); rate->min = rate->max = mi2s_rx_cfg[QUAT_MI2S].sample_rate; channels->min = channels->max = mi2s_rx_cfg[QUAT_MI2S].channels; break; case MSM_BACKEND_DAI_QUATERNARY_MI2S_TX: param_set_mask(params, SNDRV_PCM_HW_PARAM_FORMAT, mi2s_tx_cfg[QUAT_MI2S].bit_format); rate->min = rate->max = mi2s_tx_cfg[QUAT_MI2S].sample_rate; channels->min = channels->max = mi2s_tx_cfg[QUAT_MI2S].channels; Loading Loading @@ -3980,6 +4134,7 @@ static u32 get_mi2s_bits_per_sample(u32 bit_format) u32 bit_per_sample; switch (bit_format) { case SNDRV_PCM_FORMAT_S32_LE: case SNDRV_PCM_FORMAT_S24_3LE: case SNDRV_PCM_FORMAT_S24_LE: bit_per_sample = 32; Loading