Hi Ricard,
On Wed, 14 Nov 2018 at 16:07, Ricard Wanderlof ricard.wanderlof@axis.com wrote:
On Wed, 14 Nov 2018, Clément Péron wrote:
From: Adrien Charruel adrien.charruel@devialet.com
The AK4118A is a digital audio transceiver supporting 8 input channels at 192kHz and with 24bits resolution. It converts the S/PDIF signal to I2S format and is configurable over I2C.
This driver introduce a minimal support of the AK4118, like selecting the input channel, reading input frequency and detecting some errors.
I'm curious, from what it seems, there is no checking that the input sample rate actually matches the configured sample rate? It's perfectly understandable for a driver which has 'minimal support', but it's something a user must be aware of; for instance if someone does
arecord -r 48000 output.wav
when the input data actually has a rate of 44100 Hz then the file will be written with a header specifying 44100 Hz but the data will actually be 48000 Hz.
It's not an objection on my part, just an observation. I don't know how ALSA could enforce this in any way; ideally (barring automatic sample rate conversion) one would want an error message that the sample rate specified when opening the stream does not match the sample rate of the S/PDIF input data.
I'm quite new with linux audio driver but adding in ak4118_hw_params a check like if params_rate(params) == ak4118_rate should do the job no ?
Regards, Clement
/Ricard
Ricard Wolf Wanderlof ricardw(at)axis.com Axis Communications AB, Lund, Sweden www.axis.com Phone +46 46 272 2016 Fax +46 46 13 61 30