On Sun, Sep 28, 2014 at 06:05:50PM +0200, Jean-Francois Moine wrote:
Russell King - ARM Linux linux@arm.linux.org.uk wrote:
On Sun, Sep 28, 2014 at 04:19:27PM +0200, Jean-Francois Moine wrote:
This patch prevents the controller to raise an error when the DT audio card definition by the simple card contains the PCM format of one CPU DAI only.
I think this is a silly idea - why should every driver have additional code to detect when it's called to do thing. Why doesn't the simple card code always pass the required format?
Looking at other drivers, no one else does this; they all appear to require the proper format to be specified.
What some drivers do (eg, omap-mcbsp.c) is to block set_fmt when the DAI is already in use - setting a flag "configured" in hw_params, and clearing it in shutdown. Maybe following this will solve your problem.
In any case, random drivers doing stuff differently without reason is really not a good idea.
As the simple card is done, the audio hardware definitions of the platform and all the CPU DAIS are always set in the audio controller.
When the PCM format is globally defined (platform), the function set_fmt() is called for all CPU DAIs (then, twice for the kirkwood controller) with the same value. The DT is:
...
The PCM format may also be defined per DAI link. The following DT works the same as setting globally the format, i.e. there are two calls to set_fmt() with 'i2s':
The problem appears when the format is defined in only one DAI link:
Then, audio does not work.
So this is still a generic rather than driver issue and should be solved outside of the driver - exactly the same issue is going to apply to any other device with a similar shared configuration. We could either say that the DT is buggy here or we could say that the generic card ought to assume that if only one link specifies a format then it should use that format for other links if possible (since clearly the user doesn't care what it chooses).
Please also try to use subject lines matching the style for the subsystem. You've been working with upstream for a while, you really ought to be familiar with this sort of basic process stuff.