Title: [8879] trunk/sound/soc/codecs/adau1373.c: bug[#6052]clean up code,and add delay between the code of enabling dai and clock
Revision
8879
Author
cliff
Date
2010-06-02 04:54:09 -0400 (Wed, 02 Jun 2010)

Log Message

bug[#6052]clean up code,and add delay between the code of enabling dai and clock

Modified Paths

Diff

Modified: trunk/sound/soc/codecs/adau1373.c (8878 => 8879)


--- trunk/sound/soc/codecs/adau1373.c	2010-06-02 08:24:18 UTC (rev 8878)
+++ trunk/sound/soc/codecs/adau1373.c	2010-06-02 08:54:09 UTC (rev 8879)
@@ -618,6 +618,10 @@
 
 	if (i == adau1373->data->pll_settings_num)
 		return -EINVAL;
+
+	reg = snd_soc_read(codec, ADAU_CLK1SDIV);
+	snd_soc_write(codec, ADAU_CLK1SDIV, reg & ~CLKSDIV_COREN);
+	snd_soc_write(codec, ADAU_PLLACTL6, 0x0);
 	/* Divide PLL output(48k * 1024 or 44.1k * 1024) to get wanted rate */
 	switch (params_rate(params)) {
 	case 96000:
@@ -642,10 +646,8 @@
 		dev_err(codec->dev, "rate : %d isn't supported\n", params_rate(params));
 		break;
 	}
-	reg = snd_soc_read(codec, ADAU_CLK1SDIV);
-	snd_soc_write(codec, ADAU_CLK1SDIV, reg & ~CLKSDIV_COREN);
+
 	/* Set PLL */
-	snd_soc_write(codec, ADAU_PLLACTL6, 0x00);
 
 	snd_soc_write(codec, ADAU_PLLACTL1,
 		((pll_settings + i)->m & 0xff00) >> 8);
@@ -678,8 +680,6 @@
 	}
 	reg = snd_soc_read(codec, ADAU_DAIA);
 	snd_soc_write(codec, ADAU_DAIA, reg | dai_ctl);
-	snd_soc_write(codec, ADAU_PLLACTL, 0x00);
-	snd_soc_write(codec, ADAU_PLLACTL6, PLLEN);
 
 	return 0;
 }
@@ -693,6 +693,8 @@
 	int counter = 0;
 	u8 reg;
 
+	snd_soc_write(codec, ADAU_PLLACTL, 0x00);
+	snd_soc_write(codec, ADAU_PLLACTL6, PLLEN);
 	/* Chcek if PLL is locked by polling the lock bit */
 	do {
 		++counter;
@@ -707,6 +709,7 @@
 
 	/* Use DAI A */
 	snd_soc_write(codec, ADAU_DAIACTL, DAI_EN);
+	udelay(10);
 	reg = snd_soc_read(codec, ADAU_CLK1SDIV);
 	snd_soc_write(codec, ADAU_CLK1SDIV, reg | CLKSDIV_COREN);
 
@@ -726,7 +729,7 @@
 		reg = snd_soc_read(codec, ADAU_CLK1SDIV);
 		snd_soc_write(codec, ADAU_DAIACTL, 0x00);
 		snd_soc_write(codec, ADAU_CLK1SDIV, reg & ~CLKSDIV_COREN);
-		snd_soc_write(codec, ADAU_PLLACTL6, 0x0);
+		snd_soc_write(codec, ADAU_PLLACTL6, 0x00);
 	}
 }
 
@@ -826,18 +829,15 @@
 	switch (level) {
 	case SND_SOC_BIAS_ON:
 		snd_soc_write(codec, ADAU_PWDCTL3, reg_pwr | WHOLEPWR);
-		snd_soc_write(codec, ADAU_CLK1SDIV, reg_clk | CLKSDIV_COREN);
 		/* vref/mid, osc on, dac unmute */
 		break;
 	case SND_SOC_BIAS_PREPARE:
 		break;
 	case SND_SOC_BIAS_STANDBY:
 		/* everything off except vref/vmid, */
-		snd_soc_write(codec, ADAU_CLK1SDIV, reg_clk & ~CLKSDIV_COREN);
+		snd_soc_write(codec, ADAU_PWDCTL3, reg_pwr & ~WHOLEPWR);
 		break;
 	case SND_SOC_BIAS_OFF:
-		snd_soc_write(codec, ADAU_PWDCTL3, reg_pwr & ~WHOLEPWR);
-		snd_soc_write(codec, ADAU_CLK1SDIV, reg_clk & ~CLKSDIV_COREN);
 		break;
 	}
 	codec->bias_level = level;
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to