Hello Peter,
Peter Meerwald wrote:
Hello,
I'm trying to use the SoC TLV320AIC3x codec driver with sysclk 16384000 and ran into some problems with setting PLL; below is a patch against linux-2.6-asoc
I just tested your patch works fine with sysclk=16384000 and 12288000 but fails with 11286900: it returns FSREF=45467 instead of desired 44100. I think that this is a valuable difference. Please check it.
Please check also 33868800 sysclk, it returns FSREF=47545 instead of 48000.
I have put the proposed code at http://pmeerw.net/clk/ for review;
note that the proposed code has less deviation from fsref in all cases and manages to stay within recommended settings for sysclk 33868800
I have modified the following line to get rid of rounding errors as much as possible: /* do not use codec_clk here since we'd loose precision */ d = ((2048 * p * fsref) - j * sysclk) * 100 / (sysclk/100); and fixed a bug which always set pll_p = 1 in case d!=0
I confirm that it handles all cases with best precision now.
if code looks good, I'll submit a patch against linux-sound-2.6 as Mark suggested
I'm ok to submit.