[alsa-devel] [PATCH 2/3] ASoC: add snd_soc_of_get_port_dai_name()

Stephen Warren swarren at wwwdotorg.org
Thu Feb 14 00:33:54 CET 2013

On 02/11/2013 10:37 PM, Kuninori Morimoto wrote:
> Hi Stephen
>> 2) Call an "of_xlate" function on that driver, passing it the "portspec"
>> I mentioned above; the driver will interpret the portspec, maps it to
>> the ASoC port name, and return it.
>> The DT binding for each audio component must define the list of valid
>> port IDs, and the number of cells used to encode the value.
>> See for example the GPIO and PWM subsystem's of_xlate functions.
> Hmm...
> I guess this means struct snd_soc_dai_driver or similar has .of_xlate() callback ?

Yes, something like that.

> But, this simple-audio is "independent" from cpu/codec.

Well, any driver that could be used with it will need to implement the
.of_xlate() callback. The simple-audio code would still be 100%
independent from any CPU or CODEC, since of_xlate would be a standard
interface/API that any CPU or CODEC driver could implement, and any ASoC
machine driver could call.

> For example, basically, we can use this simple-audio for FSI-wm8903 matching.
> But, this wm8903 is used on tegra too.
> Then, FSI-wm8903 (which use simple-audio) needs .of_xlate on wm8903 driver to get interpreted port name,
> but tegra-wm8903 don't need it.

Yes, .of_xlate() wouldn't have to be implemented by the WM8903 CODEC
driver for the tegra-wm8903 machine driver to use the WM8903 CODEC.
However, if it /was/ implemented, it wouldn't stop tegra-wm8903 from
working. And later, it may help unify all the simple Tegra machine
drivers into one, since they could also become CODEC-independent, and
hence become unified (or at least mostly unified) code.

More information about the Alsa-devel mailing list