summaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/tlv320aic26.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2011-07-09 11:56:43 +0200
committerTakashi Iwai <tiwai@suse.de>2011-07-09 11:56:43 +0200
commite8fd86efaa09445ca1afc1aea08d4666c966ed03 (patch)
treee6b42da2811b9ca49529195a3a66f7f2ddebe2f3 /sound/soc/codecs/tlv320aic26.c
parentabaead6ac55dbda8b4bae40251d69dc3f0c49b1c (diff)
parent18361bbe3180eca62796188d62aefac1519f4c83 (diff)
downloadlinux-e8fd86efaa09445ca1afc1aea08d4666c966ed03.tar.bz2
Merge branch 'fix/asoc' into for-linus
Diffstat (limited to 'sound/soc/codecs/tlv320aic26.c')
-rw-r--r--sound/soc/codecs/tlv320aic26.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/sound/soc/codecs/tlv320aic26.c b/sound/soc/codecs/tlv320aic26.c
index e2a7608d3944..7859bdcc93db 100644
--- a/sound/soc/codecs/tlv320aic26.c
+++ b/sound/soc/codecs/tlv320aic26.c
@@ -161,10 +161,18 @@ static int aic26_hw_params(struct snd_pcm_substream *substream,
dev_dbg(&aic26->spi->dev, "bad format\n"); return -EINVAL;
}
- /* Configure PLL */
+ /**
+ * Configure PLL
+ * fsref = (mclk * PLLM) / 2048
+ * where PLLM = J.DDDD (DDDD register ranges from 0 to 9999, decimal)
+ */
pval = 1;
- jval = (fsref == 44100) ? 7 : 8;
- dval = (fsref == 44100) ? 5264 : 1920;
+ /* compute J portion of multiplier */
+ jval = fsref / (aic26->mclk / 2048);
+ /* compute fractional DDDD component of multiplier */
+ dval = fsref - (jval * (aic26->mclk / 2048));
+ dval = (10000 * dval) / (aic26->mclk / 2048);
+ dev_dbg(&aic26->spi->dev, "Setting PLLM to %d.%04d\n", jval, dval);
qval = 0;
reg = 0x8000 | qval << 11 | pval << 8 | jval << 2;
aic26_reg_write(codec, AIC26_REG_PLL_PROG1, reg);