OSDN Git Service

ASoC: wcd9335: Configure DMIC clock rate for ECPP path
authorSudheer Papothi <spapothi@codeaurora.org>
Thu, 19 May 2016 15:14:15 +0000 (20:44 +0530)
committerGerrit - the friendly Code Review server <code-review@localhost>
Thu, 4 Aug 2016 18:05:51 +0000 (11:05 -0700)
DMIC clock on ECPP(Echo Cancellation Ping-Pong) hardware path
can run at lower clock rate to avoid power consumption. Select
ECPP dmic clock rate when decimator is connected only to ECPP
path.

CRs-fixed: 1022917
Change-Id: I968e1fe6b099ebf5334eadb209219181293b207f
Signed-off-by: Sudheer Papothi <spapothi@codeaurora.org>
Signed-off-by: Vidyakumar Athota <vathota@codeaurora.org>
sound/soc/codecs/wcd9335.c

index 0af7314..11993bb 100644 (file)
@@ -5820,6 +5820,18 @@ static u32 tasha_get_dmic_sample_rate(struct snd_soc_codec *codec,
                tx_stream_fs = snd_soc_read(codec, tx_fs_reg) & 0x0F;
                dmic_fs = tx_stream_fs <= 4 ? WCD9XXX_DMIC_SAMPLE_RATE_2P4MHZ :
                                        WCD9XXX_DMIC_SAMPLE_RATE_4P8MHZ;
+
+               /*
+                * Check for ECPP path selection and DEC1 not connected to
+                * any other audio path to apply ECPP DMIC sample rate
+                */
+               if ((adc_mux_index == 1) &&
+                   ((snd_soc_read(codec, WCD9335_CPE_SS_US_EC_MUX_CFG)
+                                  & 0x0F) == 0x0A) &&
+                   ((snd_soc_read(codec, WCD9335_CDC_IF_ROUTER_TX_MUX_CFG0)
+                                  & 0x0C) == 0x00)) {
+                       dmic_fs = pdata->ecpp_dmic_sample_rate;
+               }
        } else {
                dmic_fs = pdata->dmic_sample_rate;
        }
@@ -12476,6 +12488,17 @@ static int tasha_handle_pdata(struct tasha_priv *tasha,
                 */
                pdata->mad_dmic_sample_rate = pdata->dmic_sample_rate;
        }
+       if (pdata->ecpp_dmic_sample_rate ==
+           WCD9XXX_DMIC_SAMPLE_RATE_UNDEFINED) {
+               dev_info(codec->dev,
+                        "%s: ecpp_dmic_rate invalid default = %d\n",
+                        __func__, def_dmic_rate);
+               /*
+                * use dmic_sample_rate as the default for ECPP DMIC
+                * if ecpp dmic sample rate is undefined
+                */
+               pdata->ecpp_dmic_sample_rate = pdata->dmic_sample_rate;
+       }
 
        if (pdata->dmic_clk_drv ==
            WCD9XXX_DMIC_CLK_DRIVE_UNDEFINED) {