Hi Takashi,
I'm encountering a strange issue when working with our MAN301 device and external clock sync. I am currently using our kernel-side AV/C code to switch between clock sources[1].
When I switch to an external clock source, the user-space ALSA code is not able to change the clock rate anymore. This means that I cannot switch to the external clock rate that the DICE is currently locked onto.
Here is a practical example / steps to reproduce:
1. Set the clock source to internal and the clock rate to an arbitrary value (e.g. 44100) from the user-space. The relevant sections of /proc/asound/card0/firewire/dice will then look like this:
global: owner: ffc0:000100000000 notification: 00000040 nick name: Weiss MAN301 clock select: internal 44100 enable: 0 status: locked 44100 ext status: 00010001 sample rate: 44100 version: 1.0.12.0 clock caps: 44100 48000 88200 96000 176400 192000 aes1 aes2 aes3 wc internal clock source names: AES/EBU (XLR)\S/PDIF (RCA)\S/PDIF (TOS)\Unused\Unused\Unused\Unused\Word Clock (BNC)\Unused\Unused\Unused\Unused\Internal\
ext status: clock source: internal locked: 1 rate: 44100
2. Set the clock source to external (e.g. aes1) through AV/C command[1] and connect a digital input with a different clock rate (e.g. 48000). Now the two sections of will look like this. You can see that the external source status is "locked".
global: owner: ffc0:000100000000 notification: 00000010 nick name: Weiss MAN301 clock select: aes1 44100 enable: 0 status: unlocked 44100 ext status: 00010001 sample rate: 44100 version: 1.0.12.0 clock caps: 44100 48000 88200 96000 176400 192000 aes1 aes2 aes3 wc internal clock source names: AES/EBU (XLR)\S/PDIF (RCA)\S/PDIF (TOS)\Unused\Unused\Unused\Unused\Word Clock (BNC)\Unused\Unused\Unused\Unused\Internal\
ext status: clock source: aes1 locked: 1 rate: 48000
3. Try to set the clock rate to 48000 from user-space ALSA. This will fail. Only 44100 can be used. Example:
$ aplay --disable-resample 48000_S32.wav Playing WAVE '48000_S32.wav' : Signed 32 bit Little Endian, Rate 48000 Hz, Stereo Warning: rate is not accurate (requested = 48000Hz, got = 44100Hz)
The current workaround is going back to the internal clock source, switch the clock rate to the one reported in the "ext status" section, and then go back to the external clock source. This however does not feel quite right.
I will be very grateful for any suggestion from your side.
Thank you and kind regards, Michele Perrone
[1]https://github.com/weiss-engineering/snd-dice/blob/5a95496c0666048bc5bc8c07b...