On 1/15/19 6:19 AM, Dimitris Papavasiliou wrote:
On Tue, Jan 15, 2019 at 10:08 AM Peter Rosin peda@axentia.se wrote:
On 2019-01-14 18:36, Pierre-Louis Bossart wrote:
You should perhaps check if (ratio >= 1 && ratio <= 256) prior to accepting a divider that can't be programmed? But maybe that's enforced somewhere else? And perhaps the sanity check should be even stricter?
Yes it should be stricter with a power of two only. I tried really hard to make this codec work with ratios of 50 (and a 19.2 MHz mclk) on an Up board and it's just not possible, probably not supported by hardware.
Disallowing anything but powers of two just because 50 doesn't work seems pretty wild. According to docs I think 48 should work just fine.
Section 8.3.2 Audio Data Interface page 16. http://www.ti.com/lit/ds/symlink/pcm5142.pdf
Or?
According to the datasheet[1], you can program any divider between 1 and 256, via register 33 (page 80), but, as Peter points out, in the description of the audio data interface (page 15), only the values 32, 48, 64, 128, 256 are mentioned as permissible. So one approach would be to restrict the values accepted by the callback to this set. Since the datasheet is not terribly clear on whether only these are allowed, and since the ratio is set explicitly in the machine driver, it could be argued that it would be preferable to allow all values that can be set in the register, to minimize the risk of needlessly rejecting valid configurations.
I meant multiple of 16, sorry. multiples of 25/50 commonly used with other codecs will not work.