Merge remote-tracking branch 'asoc/for-5.9' into asoc-linus
[linux-2.6-microblaze.git] / sound / soc / codecs / tlv320aic32x4.c
index 4678028..ea8cd44 100644 (file)
@@ -665,7 +665,7 @@ static int aic32x4_set_processing_blocks(struct snd_soc_component *component,
 }
 
 static int aic32x4_setup_clocks(struct snd_soc_component *component,
-                               unsigned int sample_rate)
+                               unsigned int sample_rate, unsigned int channels)
 {
        u8 aosr;
        u16 dosr;
@@ -753,7 +753,9 @@ static int aic32x4_setup_clocks(struct snd_soc_component *component,
                                                        dosr);
 
                                                clk_set_rate(clocks[5].clk,
-                                                       sample_rate * 32);
+                                                       sample_rate * 32 *
+                                                       channels);
+
                                                return 0;
                                        }
                                }
@@ -775,7 +777,8 @@ static int aic32x4_hw_params(struct snd_pcm_substream *substream,
        u8 iface1_reg = 0;
        u8 dacsetup_reg = 0;
 
-       aic32x4_setup_clocks(component, params_rate(params));
+       aic32x4_setup_clocks(component, params_rate(params),
+                            params_channels(params));
 
        switch (params_width(params)) {
        case 16:
@@ -1010,6 +1013,14 @@ static int aic32x4_component_probe(struct snd_soc_component *component)
                                AIC32X4_LADC_EN | AIC32X4_RADC_EN);
        snd_soc_component_write(component, AIC32X4_ADCSETUP, tmp_reg);
 
+       /*
+        * Enable the fast charging feature and ensure the needed 40ms ellapsed
+        * before using the analog circuits.
+        */
+       snd_soc_component_write(component, AIC32X4_REFPOWERUP,
+                               AIC32X4_REFPOWERUP_40MS);
+       msleep(40);
+
        return 0;
 }