[alsa-devel] codec->card removed
jonsmirl at gmail.com
jonsmirl at gmail.com
Fri Sep 26 21:32:47 CEST 2014
On Fri, Sep 26, 2014 at 3:25 PM, Lars-Peter Clausen <lars at metafoo.de> wrote:
> On 09/26/2014 09:19 PM, jonsmirl at gmail.com wrote:
>
>> How should I rewrite this to reflect that codec->card has been removed?
>>
>
> This is codec is on the SOC chip, not an external one.
>>
>> static int sunxi_codec_trigger(struct snd_pcm_substream *substream, int
>> cmd, struct snd_soc_dai *dai) {
>> struct snd_soc_pcm_runtime *rtd = substream->private_data;
>> struct snd_soc_dai *codec_dai = rtd->codec_dai;
>> struct snd_soc_codec *codec = codec_dai->codec;
>> struct snd_soc_card *card = codec->card;
>> struct sunxi_priv *priv = snd_soc_card_get_drvdata(card);
>>
>
>
> It was moved to the component sub-structure in the CODEC struct. So
>
> codec->component.card
>
> But you really shouldn't access the card from the CODEC driver, that is a
> layering violation.
>
> Similarly accessing rtd->codec_dai from the CODEC driver is not correct,
> since codec_dai may not necessarily point to the CODEC DAI of your CODEC.
> (E.g. for multi-codec links or codec-to-codec links).
In this case CPU DAI and CODEC DAI are integrated onto the CPU SOC. You
can't attach an external codec.
Check out sunxi_codec_probe()
Where should 'priv' have been stashed?
https://bitbucket.org/emiliolopez/linux/src/fbfc3e9c092c90574aee454062fc465e8c71703c/sound/soc/sunxi/sunxi-codec.c?at=sunxi-codec-exp
>
> - Lars
>
>
--
Jon Smirl
jonsmirl at gmail.com
More information about the Alsa-devel
mailing list