module_put(codec->dev->driver->owner);
}
- list_del(&codec_dai->card_list);
++++++ static void soc_remove_codec_dai(struct snd_soc_dai *codec_dai, int order)
++++++ {
++++++ int err;
++++++
++++++ if (codec_dai && codec_dai->probed &&
++++++ codec_dai->driver->remove_order == order) {
++++++ if (codec_dai->driver->remove) {
++++++ err = codec_dai->driver->remove(codec_dai);
++++++ if (err < 0)
++++++ dev_err(codec_dai->dev,
++++++ "ASoC: failed to remove %s: %d\n",
++++++ codec_dai->name, err);
++++++ }
++++++ codec_dai->probed = 0;
++++++ }
++++++ }
++++++
static void soc_remove_link_dais(struct snd_soc_card *card, int num, int order)
{
struct snd_soc_pcm_runtime *rtd = &card->rtd[num];
return 0;
}
- list_add(&codec_dai->card_list, &card->dai_dev_list);
++++++ static int soc_probe_codec_dai(struct snd_soc_card *card,
++++++ struct snd_soc_dai *codec_dai,
++++++ int order)
++++++ {
++++++ int ret;
++++++
++++++ if (!codec_dai->probed && codec_dai->driver->probe_order == order) {
++++++ if (codec_dai->driver->probe) {
++++++ ret = codec_dai->driver->probe(codec_dai);
++++++ if (ret < 0) {
++++++ dev_err(codec_dai->dev,
++++++ "ASoC: failed to probe CODEC DAI %s: %d\n",
++++++ codec_dai->name, ret);
++++++ return ret;
++++++ }
++++++ }
++++++
++++++ /* mark codec_dai as probed and add to card dai list */
++++++ codec_dai->probed = 1;
++++++ }
++++++
++++++ return 0;
++++++ }
++++++
++++++ static int soc_link_dai_widgets(struct snd_soc_card *card,
++++++ struct snd_soc_dai_link *dai_link,
++++++ struct snd_soc_dai *cpu_dai,
++++++ struct snd_soc_dai *codec_dai)
++++++ {
++++++ struct snd_soc_dapm_widget *play_w, *capture_w;
++++++ int ret;
++++++
++++++ /* link the DAI widgets */
++++++ play_w = codec_dai->playback_widget;
++++++ capture_w = cpu_dai->capture_widget;
++++++ if (play_w && capture_w) {
++++++ ret = snd_soc_dapm_new_pcm(card, dai_link->params,
++++++ capture_w, play_w);
++++++ if (ret != 0) {
++++++ dev_err(card->dev, "ASoC: Can't link %s to %s: %d\n",
++++++ play_w->name, capture_w->name, ret);
++++++ return ret;
++++++ }
++++++ }
++++++
++++++ play_w = cpu_dai->playback_widget;
++++++ capture_w = codec_dai->capture_widget;
++++++ if (play_w && capture_w) {
++++++ ret = snd_soc_dapm_new_pcm(card, dai_link->params,
++++++ capture_w, play_w);
++++++ if (ret != 0) {
++++++ dev_err(card->dev, "ASoC: Can't link %s to %s: %d\n",
++++++ play_w->name, capture_w->name, ret);
++++++ return ret;
++++++ }
++++++ }
++++++
++++++ return 0;
++++++ }
++++++
static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order)
{
struct snd_soc_dai_link *dai_link = &card->dai_link[num];
codec->ac97_registered = 0;
}
}
++++++
++++++ static void soc_unregister_ac97_dai_link(struct snd_soc_pcm_runtime *rtd)
++++++ {
++++++ soc_unregister_ac97_codec(rtd->codec);
++++++ }
#endif
-------static int soc_check_aux_dev(struct snd_soc_card *card, int num)
+++++++static struct snd_soc_codec *soc_find_matching_codec(struct snd_soc_card *card,
+++++++ int num)
{
struct snd_soc_aux_dev *aux_dev = &card->aux_dev[num];
struct snd_soc_codec *codec;
------- /* find CODEC from registered CODECs*/
+++++++ /* find CODEC from registered CODECs */
list_for_each_entry(codec, &codec_list, list) {
------- if (!strcmp(codec->name, aux_dev->codec_name))
------- return 0;
+++++++ if (aux_dev->codec_of_node &&
+++++++ (codec->dev->of_node != aux_dev->codec_of_node))
+++++++ continue;
+++++++ if (aux_dev->codec_name && strcmp(codec->name, aux_dev->codec_name))
+++++++ continue;
+++++++ return codec;
}
------- dev_err(card->dev, "ASoC: %s not registered\n", aux_dev->codec_name);
+++++++ return NULL;
+++++++}
+
+++++++static int soc_check_aux_dev(struct snd_soc_card *card, int num)
+++++++{
+++++++ struct snd_soc_aux_dev *aux_dev = &card->aux_dev[num];
+++++++ const char *codecname = aux_dev->codec_name;
+++++++ struct snd_soc_codec *codec = soc_find_matching_codec(card, num);
++++++
+++++++ if (codec)
+++++++ return 0;
+++++++ if (aux_dev->codec_of_node)
+++++++ codecname = of_node_full_name(aux_dev->codec_of_node);
+++++++
+++++++ dev_err(card->dev, "ASoC: %s not registered\n", codecname);
return -EPROBE_DEFER;
}
int ret;
unsigned int val;
------- val = (snd_soc_read(codec, reg) >> shift) & mask;
+++++++ ret = snd_soc_component_read(component, reg, &val);
+++++++ if (ret < 0)
+++++++ return ret;
+
------ if (!sign_bit)
------ return val;
+++++++ val = (val >> shift) & mask;
++++++
- if (!sign_bit)
- return val;
+++++++ if (!sign_bit) {
+++++++ *signed_val = val;
+++++++ return 0;
+++++++ }
/* non-negative number */
------- if (!(val & BIT(sign_bit)))
------- return val;
+++++++ if (!(val & BIT(sign_bit))) {
+++++++ *signed_val = val;
+++++++ return 0;
+++++++ }
ret = val;
}
static inline struct snd_soc_dapm_widget *
------- rtd_get_cpu_widget(struct snd_soc_pcm_runtime *rtd, int stream)
------ {
------ if (stream == SNDRV_PCM_STREAM_PLAYBACK)
------ return rtd->cpu_dai->playback_widget;
------ else
------ return rtd->cpu_dai->capture_widget;
------ }
------
------ static inline struct snd_soc_dapm_widget *
------ rtd_get_codec_widget(struct snd_soc_pcm_runtime *rtd, int stream)
+++++++ dai_get_widget(struct snd_soc_dai *dai, int stream)
{
if (stream == SNDRV_PCM_STREAM_PLAYBACK)
- return rtd->cpu_dai->playback_widget;
------ return rtd->codec_dai->playback_widget;
+++++++ return dai->playback_widget;
else
- return rtd->cpu_dai->capture_widget;
- }
-
- static inline struct snd_soc_dapm_widget *
- rtd_get_codec_widget(struct snd_soc_pcm_runtime *rtd, int stream)
- {
- if (stream == SNDRV_PCM_STREAM_PLAYBACK)
- return rtd->codec_dai->playback_widget;
- else
------- return rtd->codec_dai->capture_widget;
+++++++ return dai->capture_widget;
}
static int widget_in_list(struct snd_soc_dapm_widget_list *list,