Loading sound/soc/codecs/sdm660_cdc/msm-analog-cdc.c +12 −0 Original line number Diff line number Diff line Loading @@ -2619,6 +2619,17 @@ static int msm_anlg_cdc_codec_enable_micbias(struct snd_soc_dapm_widget *w, return 0; } static void set_compander_mode(void *handle, int val) { struct sdm660_cdc_priv *handle_cdc = handle; struct snd_soc_codec *codec = handle_cdc->codec; if (get_codec_version(handle_cdc) >= DIANGU) { snd_soc_update_bits(codec, MSM89XX_PMIC_ANALOG_RX_COM_BIAS_DAC, 0x08, val); }; } static void update_clkdiv(void *handle, int val) { struct sdm660_cdc_priv *handle_cdc = handle; Loading Loading @@ -4636,6 +4647,7 @@ static int msm_anlg_cdc_probe(struct platform_device *pdev) BLOCKING_INIT_NOTIFIER_HEAD(&sdm660_cdc->notifier_mbhc); sdm660_cdc->dig_plat_data.handle = (void *) sdm660_cdc; sdm660_cdc->dig_plat_data.set_compander_mode = set_compander_mode; sdm660_cdc->dig_plat_data.update_clkdiv = update_clkdiv; sdm660_cdc->dig_plat_data.get_cdc_version = get_cdc_version; sdm660_cdc->dig_plat_data.register_notifier = Loading sound/soc/codecs/sdm660_cdc/msm-analog-cdc.h +1 −0 Original line number Diff line number Diff line Loading @@ -168,6 +168,7 @@ struct msm_dig_ctrl_data { struct msm_dig_ctrl_platform_data { void *handle; void (*set_compander_mode)(void *handle, int val); void (*update_clkdiv)(void *handle, int val); int (*get_cdc_version)(void *handle); int (*register_notifier)(void *handle, Loading sound/soc/codecs/sdm660_cdc/msm-digital-cdc.c +48 −41 Original line number Diff line number Diff line Loading @@ -214,18 +214,27 @@ static int msm_dig_cdc_codec_config_compander(struct snd_soc_codec *codec, int interp_n, int event) { struct msm_dig_priv *dig_cdc = snd_soc_codec_get_drvdata(codec); int comp_ch_bits_set = 0x03; dev_dbg(codec->dev, "%s: event %d shift %d, enabled %d\n", __func__, event, interp_n, dig_cdc->comp_enabled[interp_n]); /* compander is not enabled */ if (!dig_cdc->comp_enabled[interp_n]) /* compander is invalid */ if (dig_cdc->comp_enabled[interp_n] != COMPANDER_1 && dig_cdc->comp_enabled[interp_n]) { dev_dbg(codec->dev, "%s: Invalid compander %d\n", __func__, dig_cdc->comp_enabled[interp_n]); return 0; } switch (dig_cdc->comp_enabled[interp_n]) { case COMPANDER_1: if (SND_SOC_DAPM_EVENT_ON(event)) { /* compander is not enabled */ if (!dig_cdc->comp_enabled[interp_n]) { dig_cdc->set_compander_mode(dig_cdc->handle, 0x00); return 0; }; dig_cdc->set_compander_mode(dig_cdc->handle, 0x08); /* Enable Compander Clock */ snd_soc_update_bits(codec, MSM89XX_CDC_CORE_COMP0_B2_CTL, 0x0F, 0x09); Loading Loading @@ -253,21 +262,18 @@ static int msm_dig_cdc_codec_config_compander(struct snd_soc_codec *codec, if (dig_cdc->codec_hph_comp_gpio) dig_cdc->codec_hph_comp_gpio(0, codec); snd_soc_update_bits(codec, MSM89XX_CDC_CORE_COMP0_B2_CTL, 0x0F, 0x05); snd_soc_update_bits(codec, MSM89XX_CDC_CORE_COMP0_B1_CTL, 1 << interp_n, 0); comp_ch_bits_set = snd_soc_read(codec, MSM89XX_CDC_CORE_COMP0_B1_CTL); if ((comp_ch_bits_set & 0x03) == 0x00) { snd_soc_update_bits(codec, MSM89XX_CDC_CORE_COMP0_B2_CTL, 0x0F, 0x05); snd_soc_update_bits(codec, MSM89XX_CDC_CORE_CLK_RX_B2_CTL, 0x01, 0x00); } break; default: dev_dbg(codec->dev, "%s: Invalid compander %d\n", __func__, dig_cdc->comp_enabled[interp_n]); break; }; } return 0; } Loading Loading @@ -2107,6 +2113,7 @@ static int msm_dig_cdc_probe(struct platform_device *pdev) msm_dig_cdc->dig_base, &msm_digital_regmap_config); msm_dig_cdc->update_clkdiv = pdata->update_clkdiv; msm_dig_cdc->set_compander_mode = pdata->set_compander_mode; msm_dig_cdc->get_cdc_version = pdata->get_cdc_version; msm_dig_cdc->handle = pdata->handle; msm_dig_cdc->register_notifier = pdata->register_notifier; Loading sound/soc/codecs/sdm660_cdc/msm-digital-cdc.h +2 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ struct msm_dig_priv { u32 mute_mask; int dapm_bias_off; void *handle; void (*set_compander_mode)(void *handle, int val); void (*update_clkdiv)(void *handle, int val); int (*get_cdc_version)(void *handle); int (*register_notifier)(void *handle, Loading @@ -58,6 +59,7 @@ struct msm_dig_priv { struct dig_ctrl_platform_data { void *handle; void (*set_compander_mode)(void *handle, int val); void (*update_clkdiv)(void *handle, int val); int (*get_cdc_version)(void *handle); int (*register_notifier)(void *handle, Loading Loading
sound/soc/codecs/sdm660_cdc/msm-analog-cdc.c +12 −0 Original line number Diff line number Diff line Loading @@ -2619,6 +2619,17 @@ static int msm_anlg_cdc_codec_enable_micbias(struct snd_soc_dapm_widget *w, return 0; } static void set_compander_mode(void *handle, int val) { struct sdm660_cdc_priv *handle_cdc = handle; struct snd_soc_codec *codec = handle_cdc->codec; if (get_codec_version(handle_cdc) >= DIANGU) { snd_soc_update_bits(codec, MSM89XX_PMIC_ANALOG_RX_COM_BIAS_DAC, 0x08, val); }; } static void update_clkdiv(void *handle, int val) { struct sdm660_cdc_priv *handle_cdc = handle; Loading Loading @@ -4636,6 +4647,7 @@ static int msm_anlg_cdc_probe(struct platform_device *pdev) BLOCKING_INIT_NOTIFIER_HEAD(&sdm660_cdc->notifier_mbhc); sdm660_cdc->dig_plat_data.handle = (void *) sdm660_cdc; sdm660_cdc->dig_plat_data.set_compander_mode = set_compander_mode; sdm660_cdc->dig_plat_data.update_clkdiv = update_clkdiv; sdm660_cdc->dig_plat_data.get_cdc_version = get_cdc_version; sdm660_cdc->dig_plat_data.register_notifier = Loading
sound/soc/codecs/sdm660_cdc/msm-analog-cdc.h +1 −0 Original line number Diff line number Diff line Loading @@ -168,6 +168,7 @@ struct msm_dig_ctrl_data { struct msm_dig_ctrl_platform_data { void *handle; void (*set_compander_mode)(void *handle, int val); void (*update_clkdiv)(void *handle, int val); int (*get_cdc_version)(void *handle); int (*register_notifier)(void *handle, Loading
sound/soc/codecs/sdm660_cdc/msm-digital-cdc.c +48 −41 Original line number Diff line number Diff line Loading @@ -214,18 +214,27 @@ static int msm_dig_cdc_codec_config_compander(struct snd_soc_codec *codec, int interp_n, int event) { struct msm_dig_priv *dig_cdc = snd_soc_codec_get_drvdata(codec); int comp_ch_bits_set = 0x03; dev_dbg(codec->dev, "%s: event %d shift %d, enabled %d\n", __func__, event, interp_n, dig_cdc->comp_enabled[interp_n]); /* compander is not enabled */ if (!dig_cdc->comp_enabled[interp_n]) /* compander is invalid */ if (dig_cdc->comp_enabled[interp_n] != COMPANDER_1 && dig_cdc->comp_enabled[interp_n]) { dev_dbg(codec->dev, "%s: Invalid compander %d\n", __func__, dig_cdc->comp_enabled[interp_n]); return 0; } switch (dig_cdc->comp_enabled[interp_n]) { case COMPANDER_1: if (SND_SOC_DAPM_EVENT_ON(event)) { /* compander is not enabled */ if (!dig_cdc->comp_enabled[interp_n]) { dig_cdc->set_compander_mode(dig_cdc->handle, 0x00); return 0; }; dig_cdc->set_compander_mode(dig_cdc->handle, 0x08); /* Enable Compander Clock */ snd_soc_update_bits(codec, MSM89XX_CDC_CORE_COMP0_B2_CTL, 0x0F, 0x09); Loading Loading @@ -253,21 +262,18 @@ static int msm_dig_cdc_codec_config_compander(struct snd_soc_codec *codec, if (dig_cdc->codec_hph_comp_gpio) dig_cdc->codec_hph_comp_gpio(0, codec); snd_soc_update_bits(codec, MSM89XX_CDC_CORE_COMP0_B2_CTL, 0x0F, 0x05); snd_soc_update_bits(codec, MSM89XX_CDC_CORE_COMP0_B1_CTL, 1 << interp_n, 0); comp_ch_bits_set = snd_soc_read(codec, MSM89XX_CDC_CORE_COMP0_B1_CTL); if ((comp_ch_bits_set & 0x03) == 0x00) { snd_soc_update_bits(codec, MSM89XX_CDC_CORE_COMP0_B2_CTL, 0x0F, 0x05); snd_soc_update_bits(codec, MSM89XX_CDC_CORE_CLK_RX_B2_CTL, 0x01, 0x00); } break; default: dev_dbg(codec->dev, "%s: Invalid compander %d\n", __func__, dig_cdc->comp_enabled[interp_n]); break; }; } return 0; } Loading Loading @@ -2107,6 +2113,7 @@ static int msm_dig_cdc_probe(struct platform_device *pdev) msm_dig_cdc->dig_base, &msm_digital_regmap_config); msm_dig_cdc->update_clkdiv = pdata->update_clkdiv; msm_dig_cdc->set_compander_mode = pdata->set_compander_mode; msm_dig_cdc->get_cdc_version = pdata->get_cdc_version; msm_dig_cdc->handle = pdata->handle; msm_dig_cdc->register_notifier = pdata->register_notifier; Loading
sound/soc/codecs/sdm660_cdc/msm-digital-cdc.h +2 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ struct msm_dig_priv { u32 mute_mask; int dapm_bias_off; void *handle; void (*set_compander_mode)(void *handle, int val); void (*update_clkdiv)(void *handle, int val); int (*get_cdc_version)(void *handle); int (*register_notifier)(void *handle, Loading @@ -58,6 +59,7 @@ struct msm_dig_priv { struct dig_ctrl_platform_data { void *handle; void (*set_compander_mode)(void *handle, int val); void (*update_clkdiv)(void *handle, int val); int (*get_cdc_version)(void *handle); int (*register_notifier)(void *handle, Loading