-----Troy Kisky <[email protected]> ha scritto: ----- >Per: Raffaele Recalcati <[email protected]> >Da: Troy Kisky <[email protected]> >Data: 02/07/2010 22.57 >Cc: [email protected], Mark Brown ><[email protected]>, Raffaele Recalcati ><[email protected]> >Oggetto: Re: [PATCH 3/3] ASoC: DaVinci: More accurate calculation for >clock divider for McBSP (I2S) > >Raffaele Recalcati wrote: >> @@ -447,6 +448,24 @@ static int davinci_i2s_hw_params(struct >snd_pcm_substream *substream, >> 8 - 1); >> + if (dev->i2s_accurate_clock) { >> + clk_div = 256; >> + do { >> + framesize = (freq / (--clk_div)) / >> + params->rate_num * >> + params-> rate_den; >> + } while (((framesize < 33) || (framesize > 4095)) >&& >> + (clk_div)); >> + clk_div--; >> + srgr |= DAVINCI_MCBSP_SRGR_FPER (framesize - 1); >> + } else { >> + /* symmetric waveforms */ >> + clk_div = freq / (mcbsp_word_length * 16) / >> + params-> rate_num * params->rate_den; >> + srgr |= DAVINCI_MCBSP_SRGR_FPER (mcbsp_word_length * >> + 16 - 1); >> + } >> + >> /* symmetric waveforms */ >> clk_div = freq / (mcbsp_word_length * 16) / >> params->rate_num * params-> rate_den; > >Can you test to see if this works to replace all the above ? > > unsigned cycles; > framesize = mcbsp_word_length * 16; > cycles = (freq / params->rate_num) * params-> rate_den; > clk_div = cycles / framesize; > > if (dev->i2s_accurate_clock) { > framesize = cycles / clk_div; > if (framesize > 4096)) > framesize = 4096; > } > srgr |= DAVINCI_MCBSP_SRGR_FPER(framesize - 1);
yes, it works. Now I'm trying to understand the differences: your solution with i2s_accurate_clock enabled: davinci-asp davinci-asp.0: framesize = 32 davinci-asp davinci-asp.0: clk_div = 86 your solution with i2s_accurate_clock NOT enabled: davinci-asp davinci-asp.0: framesize = 32 davinci-asp davinci-asp.0: clk_div = 86 the same. my solution with i2s_accurate_clock enabled: davinci-asp davinci-asp.0: my framesize = 33 davinci-asp davinci-asp.0: clk_div = 82 here the continuous serial clock is faster my solution with i2s_accurate_clock NOT enabled davinci-asp davinci-asp.0: my framesize = 32 davinci-asp davinci-asp.0: clk_div = 86 here the continuous serial clock is the same as yours. it "seems" better my and Davide solution. Raffaele Recalcati Driver Linux BSP Bticino S.p.A. Via L.Manara 4, Erba (CO), Italy Tel: +39.(0)31.653.252 Tel2: +39.(0)31.653.652 Fax: +39.(0)31.653.283 E-mail: [email protected] Web: www.bticino.it Bticino Legrand Zucchini Cablofil Ortronics Ce message, ainsi que tous les fichiers joints à ce message, peuvent contenir des informations sensibles et/ ou confidentielles ne devant pas être divulguées. Si vous n'êtes pas le destinataire de ce message (ou que vous recevez ce message par erreur), nous vous remercions de le notifier immédiatement à son expéditeur, et de détruire ce message. Toute copie, divulgation, modification, utilisation ou diffusion, non autorisée, directe ou indirecte, de tout ou partie de ce message, est strictement interdite. This e-mail, and any document attached hereby, may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized, direct or indirect, copying, disclosure, distribution or other use of the material or parts thereof is strictly forbidden. _______________________________________________ Davinci-linux-open-source mailing list [email protected] http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
