[alsa-devel] Ordering in soc_pcm_hw_params()

jonsmirl at gmail.com jonsmirl at gmail.com
Mon Aug 11 18:58:03 CEST 2014


On Mon, Aug 11, 2014 at 12:09 PM, jonsmirl at gmail.com <jonsmirl at gmail.com> wrote:
> On Mon, Aug 11, 2014 at 11:33 AM, Mark Brown <broonie at kernel.org> wrote:
>> On Mon, Aug 11, 2014 at 09:35:51AM -0400, jonsmirl at gmail.com wrote:
>>
>>> I have code in the cpu set_hw_params which will switch the sysclk, but
>>> it never gets to run because the codec set_hw_params() has already
>>> errored out.
>>
>>> Shouldn't this order be:
>>> platform, link, cpu, codec
>>
>> No, the machine driver runs first so it can do any coordination needed
>> between the other devices.  Attempting to fiddle about with the ordering
>> is never going to be robust, someone else will always want a different
>> ordering at some point.
>
> I don't see how to fix this without making a machine driver that
> simply tells the cpu-dai to change the MCLK output from 22.5Mhz to
> 24.5Mhz earlier in the hw_params chain. But that's putting a generic
> piece of code into the machine driver.
>
> Shouldn't codec always be the last in the chain? What would be a case
> where you don't want it at the end of the chain?

Plan B. I added code in the codec's hw_param function to first call
the cpu's hw_param function.  cpu's hw_param will run twice but that
doesn't hurt anything.

/* give the cpu_dai a chance to change sysclk first if needed */
ret = rtd->cpu_dai->driver->ops->hw_params(substream, params, rtd->cpu_dai);

>
>
>
> --
> Jon Smirl
> jonsmirl at gmail.com



-- 
Jon Smirl
jonsmirl at gmail.com


More information about the Alsa-devel mailing list