Re: [alsa-devel] [PATCH] ASoC: atmel_ssc_dai: Track playback and capture CMR dividers separately.

From: Bo Shen
Date: Wed Oct 22 2014 - 05:23:32 EST


Hi Peter,

On 10/22/2014 04:33 PM, Peter Rosin wrote:
The sama5d3xek/wm9804 combo, as implemented in the kernel, has the
ssc dai in slave mode, and therefore don't need to fiddle with any
ssc dai dividers (atmel_9804.c :atmel_asoc_wm9804_hw_params() only
sets things in the wm9804 codec dai driver and leaves the ssc dai to itself).

Instead, try the above code on your code with the ssc dai in master mode
that you pointed at previously.

Yes, I try the ssc working as master mode.

https://github.com/Android4SAM/linux-at91/commit/33db8ebd3e75632c482dda271340f4d2adcfd320

If that happens to not hit -EBUSY (which it might not, since the wm9804 codec
will only allow stereo, so the SNDCTL_DSP_CHANNELS ioctl might not need
to make any change for any ssc divider) add code to also set a non-default
sample rate, e.g.:

speed = 22050;
if (ioctl(fd, SNDCTL_DSP_SPEED, &speed) == -1) {
perror("SNDCTL_DSP_SPEED");
return 1;
}

with this piece of code, I reproduce your issue.

Now, I know the reason of this issue, work in oss mode, it will set the default clock to 8KHz, and then if change to other sample rate, for example 48KHz, the div is different, then it reports -EBUSY.

So, I think we won't change the ATMEL_SSC_CMR_DIV to ATMEL_SSC_TCMR_DIV and ATMEL_SSC_RCMR_DIV, as it will affect other users. We just deal with this situation in ATMEL_SSC_CMR_DIV block, check the direction, if the same direction change the div, then accept the change, otherwise, return -EBUSY.


Cheers,
Peter

Best Regards,
Bo Shen
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/