Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 216629
b: refs/heads/master
c: 0562f78
h: refs/heads/master
i:
  216627: 12b8123
v: v3
  • Loading branch information
Mika Westerberg authored and Mark Brown committed Oct 13, 2010
1 parent f9e887f commit 034e319
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7750752a22cbf7760f0073d218c737f5a03bff4a
refs/heads/master: 0562f7882d968463119bb63d47ef4bdaba7d6631
1 change: 1 addition & 0 deletions trunk/include/sound/soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ struct snd_soc_codec {
unsigned int suspended:1; /* Codec is in suspend PM state */
unsigned int probed:1; /* Codec has been probed */
unsigned int ac97_registered:1; /* Codec has been AC97 registered */
unsigned int ac97_created:1; /* Codec has been created by SoC */
unsigned int sysfs_registered:1; /* codec has been sysfs registered */

/* codec IO */
Expand Down
18 changes: 18 additions & 0 deletions trunk/sound/soc/soc-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1497,6 +1497,16 @@ static int soc_register_ac97_dai_link(struct snd_soc_pcm_runtime *rtd)
* for the generic AC97 subsystem.
*/
if (rtd->codec_dai->driver->ac97_control && !rtd->codec->ac97_registered) {
/*
* It is possible that the AC97 device is already registered to
* the device subsystem. This happens when the device is created
* via snd_ac97_mixer(). Currently only SoC codec that does so
* is the generic AC97 glue but others migh emerge.
*
* In those cases we don't try to register the device again.
*/
if (!rtd->codec->ac97_created)
return 0;

ret = soc_ac97_dev_register(rtd->codec);
if (ret < 0) {
Expand Down Expand Up @@ -1812,6 +1822,13 @@ int snd_soc_new_ac97_codec(struct snd_soc_codec *codec,

codec->ac97->bus->ops = ops;
codec->ac97->num = num;

/*
* Mark the AC97 device to be created by us. This way we ensure that the
* device will be registered with the device subsystem later on.
*/
codec->ac97_created = 1;

mutex_unlock(&codec->mutex);
return 0;
}
Expand All @@ -1832,6 +1849,7 @@ void snd_soc_free_ac97_codec(struct snd_soc_codec *codec)
kfree(codec->ac97->bus);
kfree(codec->ac97);
codec->ac97 = NULL;
codec->ac97_created = 0;
mutex_unlock(&codec->mutex);
}
EXPORT_SYMBOL_GPL(snd_soc_free_ac97_codec);
Expand Down

0 comments on commit 034e319

Please sign in to comment.