Loading sound/soc/codecs/msm8x16-wcd.c +48 −44 Original line number Diff line number Diff line /* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved. /* Copyright (c) 2015-2018, 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 Loading Loading @@ -3885,11 +3885,20 @@ static int msm8x16_wcd_codec_config_compander(struct snd_soc_codec *codec, int interp_n, int event) { struct msm8x16_wcd_priv *msm8x16_wcd = 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, msm8x16_wcd->comp_enabled[interp_n]); /* compander is invalid */ if (msm8x16_wcd->comp_enabled[interp_n] != COMPANDER_1 && msm8x16_wcd->comp_enabled[interp_n]) { dev_dbg(codec->dev, "%s: Invalid compander %d\n", __func__, msm8x16_wcd->comp_enabled[interp_n]); return 0; } /* compander is not enabled */ if (!msm8x16_wcd->comp_enabled[interp_n]) { if (interp_n < MSM8X16_WCD_RX3) Loading @@ -3900,8 +3909,6 @@ static int msm8x16_wcd_codec_config_compander(struct snd_soc_codec *codec, return 0; } switch (msm8x16_wcd->comp_enabled[interp_n]) { case COMPANDER_1: if (SND_SOC_DAPM_EVENT_ON(event)) { if (get_codec_version(msm8x16_wcd) >= DIANGU) snd_soc_update_bits(codec, Loading Loading @@ -3934,21 +3941,18 @@ static int msm8x16_wcd_codec_config_compander(struct snd_soc_codec *codec, if (msm8x16_wcd->codec_hph_comp_gpio) msm8x16_wcd->codec_hph_comp_gpio(0); snd_soc_update_bits(codec, MSM8X16_WCD_A_CDC_COMP0_B2_CTL, 0x0F, 0x05); snd_soc_update_bits(codec, MSM8X16_WCD_A_CDC_COMP0_B1_CTL, 1 << interp_n, 0); comp_ch_bits_set = snd_soc_read(codec, MSM8X16_WCD_A_CDC_COMP0_B1_CTL); if ((comp_ch_bits_set & 0x03) == 0x00) { snd_soc_update_bits(codec, MSM8X16_WCD_A_CDC_COMP0_B2_CTL, 0x0F, 0x05); snd_soc_update_bits(codec, MSM8X16_WCD_A_CDC_CLK_RX_B2_CTL, 0x01, 0x00); } break; default: dev_dbg(codec->dev, "%s: Invalid compander %d\n", __func__, msm8x16_wcd->comp_enabled[interp_n]); break; }; } return 0; } Loading Loading
sound/soc/codecs/msm8x16-wcd.c +48 −44 Original line number Diff line number Diff line /* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved. /* Copyright (c) 2015-2018, 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 Loading Loading @@ -3885,11 +3885,20 @@ static int msm8x16_wcd_codec_config_compander(struct snd_soc_codec *codec, int interp_n, int event) { struct msm8x16_wcd_priv *msm8x16_wcd = 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, msm8x16_wcd->comp_enabled[interp_n]); /* compander is invalid */ if (msm8x16_wcd->comp_enabled[interp_n] != COMPANDER_1 && msm8x16_wcd->comp_enabled[interp_n]) { dev_dbg(codec->dev, "%s: Invalid compander %d\n", __func__, msm8x16_wcd->comp_enabled[interp_n]); return 0; } /* compander is not enabled */ if (!msm8x16_wcd->comp_enabled[interp_n]) { if (interp_n < MSM8X16_WCD_RX3) Loading @@ -3900,8 +3909,6 @@ static int msm8x16_wcd_codec_config_compander(struct snd_soc_codec *codec, return 0; } switch (msm8x16_wcd->comp_enabled[interp_n]) { case COMPANDER_1: if (SND_SOC_DAPM_EVENT_ON(event)) { if (get_codec_version(msm8x16_wcd) >= DIANGU) snd_soc_update_bits(codec, Loading Loading @@ -3934,21 +3941,18 @@ static int msm8x16_wcd_codec_config_compander(struct snd_soc_codec *codec, if (msm8x16_wcd->codec_hph_comp_gpio) msm8x16_wcd->codec_hph_comp_gpio(0); snd_soc_update_bits(codec, MSM8X16_WCD_A_CDC_COMP0_B2_CTL, 0x0F, 0x05); snd_soc_update_bits(codec, MSM8X16_WCD_A_CDC_COMP0_B1_CTL, 1 << interp_n, 0); comp_ch_bits_set = snd_soc_read(codec, MSM8X16_WCD_A_CDC_COMP0_B1_CTL); if ((comp_ch_bits_set & 0x03) == 0x00) { snd_soc_update_bits(codec, MSM8X16_WCD_A_CDC_COMP0_B2_CTL, 0x0F, 0x05); snd_soc_update_bits(codec, MSM8X16_WCD_A_CDC_CLK_RX_B2_CTL, 0x01, 0x00); } break; default: dev_dbg(codec->dev, "%s: Invalid compander %d\n", __func__, msm8x16_wcd->comp_enabled[interp_n]); break; }; } return 0; } Loading