diff options
author | Liam Girdwood <lg@opensource.wolfsonmicro.com> | 2007-05-10 13:27:27 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2007-05-16 05:45:28 -0400 |
commit | a68660e0c63d8f7ab8725f9e771119c08e9f953b (patch) | |
tree | a9a9d78e07320a8ba0650037f31f3778ebed148e | |
parent | 9ae67c7b870f5220a6b30e4f6e83b319bd9be718 (diff) |
[ALSA] ASoC AC97 device reg bugfix
This patch fixes a bug whereby AC97 bus device data was being clobbered
when AC97 codecs using the generic ac97_codec.c driver were being
registered. Codecs that didn't use the generic driver were unaffected
(e.g. WM9712, WM9713).
Changes:-
o Add new AC97 codec class for custom (or need bus dev registration)
AC97 codecs.
o Only register/deregister this custom codec device with the AC97 bus.
The generic AC97 driver already does this for generic codec devices.
This may be related to bug #3038 :-
https://bugtrack.alsa-project.org/alsa-bug/view.php?id=3038
Signed-off-by: Liam Girdwood <lg@opensource.wolfsonmicro.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
-rw-r--r-- | include/sound/soc.h | 4 | ||||
-rw-r--r-- | sound/soc/codecs/ac97.c | 1 | ||||
-rw-r--r-- | sound/soc/codecs/wm9712.c | 1 | ||||
-rw-r--r-- | sound/soc/soc-core.c | 18 |
4 files changed, 20 insertions, 4 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h index b1dc364b8f74..db6edba8ef08 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <sound/control.h> | 22 | #include <sound/control.h> |
23 | #include <sound/ac97_codec.h> | 23 | #include <sound/ac97_codec.h> |
24 | 24 | ||
25 | #define SND_SOC_VERSION "0.13.0" | 25 | #define SND_SOC_VERSION "0.13.1" |
26 | 26 | ||
27 | /* | 27 | /* |
28 | * Convenience kcontrol builders | 28 | * Convenience kcontrol builders |
@@ -83,6 +83,7 @@ | |||
83 | #define SND_SOC_DAI_AC97 0x1 | 83 | #define SND_SOC_DAI_AC97 0x1 |
84 | #define SND_SOC_DAI_I2S 0x2 | 84 | #define SND_SOC_DAI_I2S 0x2 |
85 | #define SND_SOC_DAI_PCM 0x4 | 85 | #define SND_SOC_DAI_PCM 0x4 |
86 | #define SND_SOC_DAI_AC97_BUS 0x8 /* for custom i.e. non ac97_codec.c */ | ||
86 | 87 | ||
87 | /* | 88 | /* |
88 | * DAI hardware audio formats | 89 | * DAI hardware audio formats |
@@ -278,6 +279,7 @@ struct snd_soc_cpu_ops { | |||
278 | struct snd_soc_codec_dai { | 279 | struct snd_soc_codec_dai { |
279 | char *name; | 280 | char *name; |
280 | int id; | 281 | int id; |
282 | unsigned char type; | ||
281 | 283 | ||
282 | /* DAI capabilities */ | 284 | /* DAI capabilities */ |
283 | struct snd_soc_pcm_stream playback; | 285 | struct snd_soc_pcm_stream playback; |
diff --git a/sound/soc/codecs/ac97.c b/sound/soc/codecs/ac97.c index f3b3b9efbb61..0b8a6f8b3668 100644 --- a/sound/soc/codecs/ac97.c +++ b/sound/soc/codecs/ac97.c | |||
@@ -45,6 +45,7 @@ static int ac97_prepare(struct snd_pcm_substream *substream) | |||
45 | 45 | ||
46 | struct snd_soc_codec_dai ac97_dai = { | 46 | struct snd_soc_codec_dai ac97_dai = { |
47 | .name = "AC97 HiFi", | 47 | .name = "AC97 HiFi", |
48 | .type = SND_SOC_DAI_AC97, | ||
48 | .playback = { | 49 | .playback = { |
49 | .stream_name = "AC97 Playback", | 50 | .stream_name = "AC97 Playback", |
50 | .channels_min = 1, | 51 | .channels_min = 1, |
diff --git a/sound/soc/codecs/wm9712.c b/sound/soc/codecs/wm9712.c index 264413a00cac..986b5d59cefa 100644 --- a/sound/soc/codecs/wm9712.c +++ b/sound/soc/codecs/wm9712.c | |||
@@ -544,6 +544,7 @@ static int ac97_aux_prepare(struct snd_pcm_substream *substream) | |||
544 | struct snd_soc_codec_dai wm9712_dai[] = { | 544 | struct snd_soc_codec_dai wm9712_dai[] = { |
545 | { | 545 | { |
546 | .name = "AC97 HiFi", | 546 | .name = "AC97 HiFi", |
547 | .type = SND_SOC_DAI_AC97_BUS, | ||
547 | .playback = { | 548 | .playback = { |
548 | .stream_name = "HiFi Playback", | 549 | .stream_name = "HiFi Playback", |
549 | .channels_min = 1, | 550 | .channels_min = 1, |
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 36519aef55d9..92d5d917b73b 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -116,6 +116,7 @@ static int soc_ac97_dev_register(struct snd_soc_codec *codec) | |||
116 | static inline const char* get_dai_name(int type) | 116 | static inline const char* get_dai_name(int type) |
117 | { | 117 | { |
118 | switch(type) { | 118 | switch(type) { |
119 | case SND_SOC_DAI_AC97_BUS: | ||
119 | case SND_SOC_DAI_AC97: | 120 | case SND_SOC_DAI_AC97: |
120 | return "AC97"; | 121 | return "AC97"; |
121 | case SND_SOC_DAI_I2S: | 122 | case SND_SOC_DAI_I2S: |
@@ -1099,7 +1100,8 @@ int snd_soc_register_card(struct snd_soc_device *socdev) | |||
1099 | continue; | 1100 | continue; |
1100 | } | 1101 | } |
1101 | } | 1102 | } |
1102 | if (socdev->machine->dai_link[i].cpu_dai->type == SND_SOC_DAI_AC97) | 1103 | if (socdev->machine->dai_link[i].codec_dai->type == |
1104 | SND_SOC_DAI_AC97_BUS) | ||
1103 | ac97 = 1; | 1105 | ac97 = 1; |
1104 | } | 1106 | } |
1105 | snprintf(codec->card->shortname, sizeof(codec->card->shortname), | 1107 | snprintf(codec->card->shortname, sizeof(codec->card->shortname), |
@@ -1148,11 +1150,21 @@ EXPORT_SYMBOL_GPL(snd_soc_register_card); | |||
1148 | void snd_soc_free_pcms(struct snd_soc_device *socdev) | 1150 | void snd_soc_free_pcms(struct snd_soc_device *socdev) |
1149 | { | 1151 | { |
1150 | struct snd_soc_codec *codec = socdev->codec; | 1152 | struct snd_soc_codec *codec = socdev->codec; |
1153 | #ifdef CONFIG_SND_SOC_AC97_BUS | ||
1154 | struct snd_soc_codec_dai *codec_dai; | ||
1155 | int i; | ||
1156 | #endif | ||
1151 | 1157 | ||
1152 | mutex_lock(&codec->mutex); | 1158 | mutex_lock(&codec->mutex); |
1153 | #ifdef CONFIG_SND_SOC_AC97_BUS | 1159 | #ifdef CONFIG_SND_SOC_AC97_BUS |
1154 | if (codec->ac97) | 1160 | for(i = 0; i < codec->num_dai; i++) { |
1155 | soc_ac97_dev_unregister(codec); | 1161 | codec_dai = &codec->dai[i]; |
1162 | if (codec_dai->type == SND_SOC_DAI_AC97_BUS && codec->ac97) { | ||
1163 | soc_ac97_dev_unregister(codec); | ||
1164 | goto free_card; | ||
1165 | } | ||
1166 | } | ||
1167 | free_card: | ||
1156 | #endif | 1168 | #endif |
1157 | 1169 | ||
1158 | if (codec->card) | 1170 | if (codec->card) |