soc_init_codec_debugfs(codec);
----- - if (driver->dapm_widgets)
----- - snd_soc_dapm_new_controls(&codec->dapm, driver->dapm_widgets,
----- - driver->num_dapm_widgets);
+++++ + if (driver->dapm_widgets) {
+++++ + ret = snd_soc_dapm_new_controls(&codec->dapm,
+++++ + driver->dapm_widgets,
+++++ + driver->num_dapm_widgets);
+
---- - /* Create DAPM widgets for each DAI stream */
---- - list_for_each_entry(dai, &codec->component.dai_list, list)
---- - snd_soc_dapm_new_dai_widgets(&codec->dapm, dai);
+++++ + if (ret != 0) {
+++++ + dev_err(codec->dev,
+++++ + "Failed to create new controls %d\n", ret);
+++++ + goto err_probe;
+++++ + }
+++++ + }
---- - codec->dapm.idle_bias_off = driver->idle_bias_off;
++++ + /* Create DAPM widgets for each DAI stream */
- list_for_each_entry(dai, &codec->component.dai_list, list)
- snd_soc_dapm_new_dai_widgets(&codec->dapm, dai);
+++++ + list_for_each_entry(dai, &codec->component.dai_list, list) {
+++++ + ret = snd_soc_dapm_new_dai_widgets(&codec->dapm, dai);
+
---- - if (!codec->write && dev_get_regmap(codec->dev, NULL)) {
---- - /* Set the default I/O up try regmap */
---- - ret = snd_soc_codec_set_cache_io(codec, NULL);
---- - if (ret < 0) {
+++++ + if (ret != 0) {
+ dev_err(codec->dev,
---- - "Failed to set cache I/O: %d\n", ret);
+++++ + "Failed to create DAI widgets %d\n", ret);
+ goto err_probe;
+ }
+ }
++++ + codec->dapm.idle_bias_off = driver->idle_bias_off;
++++ +
if (driver->probe) {
ret = driver->probe(codec);
if (ret < 0) {
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)
+++++++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;
}
return;
found:
------ - snd_soc_unregister_dais(cmpnt);
-
- mutex_lock(&client_mutex);
- list_del(&cmpnt->list);
- mutex_unlock(&client_mutex);
-
- dev_dbg(dev, "ASoC: Unregistered component '%s'\n", cmpnt->name);
- kfree(cmpnt->name);
++++++ + __snd_soc_unregister_component(cmpnt);
+++++ +}
+++++ +EXPORT_SYMBOL_GPL(snd_soc_unregister_component);
----- - mutex_lock(&client_mutex);
----- - list_del(&cmpnt->list);
----- - mutex_unlock(&client_mutex);
+++++ +static int snd_soc_platform_drv_write(struct snd_soc_component *component,
+++++ + unsigned int reg, unsigned int val)
+++++ +{
+++++ + struct snd_soc_platform *platform = snd_soc_component_to_platform(component);
----- - dev_dbg(dev, "ASoC: Unregistered component '%s'\n", cmpnt->name);
----- - kfree(cmpnt->name);
+++++ + return platform->driver->write(platform, reg, val);
+++++ +}
+++++ +
+++++ +static int snd_soc_platform_drv_read(struct snd_soc_component *component,
+++++ + unsigned int reg, unsigned int *val)
+++++ +{
+++++ + struct snd_soc_platform *platform = snd_soc_component_to_platform(component);
+++++ +
+++++ + *val = platform->driver->read(platform, reg);
+++++ +
+++++ + return 0;
}
----- -EXPORT_SYMBOL_GPL(snd_soc_unregister_component);
/**
* snd_soc_add_platform - Add a platform to the ASoC core
*/
void snd_soc_remove_platform(struct snd_soc_platform *platform)
{
- snd_soc_unregister_component(platform->dev);
++++++ + __snd_soc_unregister_component(&platform->component);
+++++ +
mutex_lock(&client_mutex);
list_del(&platform->list);
mutex_unlock(&client_mutex);
codec->dev = dev;
codec->driver = codec_drv;
codec->num_dai = num_dai;
+++++ + codec->component.val_bytes = codec_drv->reg_word_size;
mutex_init(&codec->mutex);
- if (!codec->write) {
+++++ + if (!codec->component.write) {
++++ + if (codec_drv->get_regmap)
++++ + regmap = codec_drv->get_regmap(dev);
++++ + else
++++ + regmap = dev_get_regmap(dev, NULL);
++++ +
++++ + if (regmap) {
- ret = snd_soc_codec_set_cache_io(codec, regmap);
- if (ret && ret != -ENOTSUPP) {
+++++ + ret = snd_soc_component_init_io(&codec->component,
+++++ + regmap);
+++++ + if (ret) {
++++ + dev_err(codec->dev,
++++ + "Failed to set cache I/O:%d\n",
++++ + ret);
++++ + return ret;
++++ + }
++++ + }
++++ + }
++++ +
for (i = 0; i < num_dai; i++) {
fixup_codec_formats(&dai_drv[i].playback);
fixup_codec_formats(&dai_drv[i].capture);