On Wed, Aug 12, 2015 at 03:39:00PM +0800, Zidan Wang wrote:
- priv->dai_link[0].codec_dai_name = codec_dev->name;
- if (strstr(codec_dev->name, "wm8960"))
priv->dai_link[0].codec_dai_name = "wm8960-hifi";
- else
priv->dai_link[0].codec_dai_name = codec_dev->name;
What happens to the codec_dev->name over here so that you need to specify the name?
In wm8960 codec driver, codec dai name is "wm8960-hifi". Using codec_dev->name will cauce register card failed.
When we meet a problem, the first response should be to find out the route cause instead of fixing it with a work around directly. If the codec_dev->name caused a card registration failure, you need to find out why. There must be something wrong with its codec driver or this sound card driver.
The root cause is that the codec dai name is not always be codec_dev->name. It will cause the sound card can't find such codec dai. You can refer to function snd_soc_find_dai(). For wm8962 the codec dai name and codec_dev->name are "wm8962". But some other codec like wm8960, it may have different codec dai name.
Then we should fix this by finding out a better way to get the dai name. I will look into it tomorrow.