wm6890.c: Suspicious bit rate calculation.
Closed this issue · 5 comments
This line looks strange, since it has the '* 2U' term in both numerator and denominator. In fact that function creates a bit rate which is half of what is should be. While recording from a microphone with a sample rate of 16000 and 16 bit width, codec set to master mode, the bit rate was 512kHz. It should have been 1024 kHz. Dropping the '* 2U' in the numerator fixed it.
Maybe the calculation is right for playing and wrong for recording only, but then that must be handled.
Hi @robert-hh
Thank you for your feedback.
I am sorry for late reply.
Let us discuss the issue you report,
The *2U added in the numerator is used to expand the bit clock divider to an integer, as the calculated bit clock divider maybe a fractional value
So *2U is added for non-float calculation.
And the below code convert the expanded divider to the register value
I understand the intention. However, using that code I got a wrong bitclock frequency in master mode when recording from a microphone. The frequency was half of what it should be. So maybe the problem is somewhere else.
is the issue come from the *2 of denominator? since there is only one channel MIC?
Even in Mono mode, both channels are present. For Mono, the signal is taken from the left channel. And, there is a second mic input at the headphone connector of the Dev boards.
If the divisor is smaller, the resulting frequency is higher.
I compared that with the timing in slave mode, and it seems fine.