History

ASoC: wm97xx: Reset AC'97 device before registering it

The wm97xx touchscreen driver binds itself to the snd_ac97 device that gets registered by the CODEC driver and expects that the device has already been reset. Before commit 6794f709b712 ("ASoC: ac97: Drop delayed device registration") the device was only registered after the probe function of the CODEC driver had finished running, but starting with the mentioned commit the device is registered as soon as snd_soc_new_ac97_codec() is called. This causes the touchscreen driver to no longer work. Modify the CODEC drivers to use snd_soc_alloc_ac97_codec() instead of snd_soc_new_ac97_codec() and make sure that the AC'97 device is reset before the snd_ac97 device gets registered.

Lars-Peter Clausen committed 11 years ago

Commit f8d71be1 parent 47e03943 files · +26 −14Browse files

Unified · Split

3 files
  1. sound/soc/codecs/wm9705.c +10 −6
  2. sound/soc/codecs/wm9712.c +8 −4
  3. sound/soc/codecs/wm9713.c +8 −4
sound/soc/codecs/wm9705.c+10−6
@@ -344,23 +344,27 @@ static int wm9705_soc_probe(struct snd_soc_codec *codec) · 343 unmodified lines
344344 struct snd_ac97 *ac97;
345345 int ret = 0;
346346
347− ac97 = snd_soc_new_ac97_codec(codec);
347+ ac97 = snd_soc_alloc_ac97_codec(codec);
348348 if (IS_ERR(ac97)) {
349349 ret = PTR_ERR(ac97);
350350 dev_err(codec->dev, "Failed to register AC97 codec\n");
351351 return ret;
352352 }
353353
354− snd_soc_codec_set_drvdata(codec, ac97);
355−
356354 ret = wm9705_reset(codec);
357355 if (ret)
358− goto reset_err;
356+ goto err_put_device;
357+
358+ ret = device_add(&ac97->dev);
359+ if (ret)
360+ goto err_put_device;
361+
362+ snd_soc_codec_set_drvdata(codec, ac97);
359363
360364 return 0;
361365
362−reset_err:
363− snd_soc_free_ac97_codec(ac97);
366+err_put_device:
367+ put_device(&ac97->dev);
364368 return ret;
365369 }
366370
sound/soc/codecs/wm9712.c+8−4
@@ -666,7 +666,7 @@ static int wm9712_soc_probe(struct snd_soc_codec *codec) · 665 unmodified lines
666666 struct wm9712_priv *wm9712 = snd_soc_codec_get_drvdata(codec);
667667 int ret = 0;
668668
669− wm9712->ac97 = snd_soc_new_ac97_codec(codec);
669+ wm9712->ac97 = snd_soc_alloc_ac97_codec(codec);
670670 if (IS_ERR(wm9712->ac97)) {
671671 ret = PTR_ERR(wm9712->ac97);
672672 dev_err(codec->dev, "Failed to register AC97 codec: %d\n", ret);
@@ -675,15 +675,19 @@ static int wm9712_soc_probe(struct snd_soc_codec *codec) · 2 unmodified lines
675675
676676 ret = wm9712_reset(codec, 0);
677677 if (ret < 0)
678− goto reset_err;
678+ goto err_put_device;
679+
680+ ret = device_add(&wm9712->ac97->dev);
681+ if (ret)
682+ goto err_put_device;
679683
680684 /* set alc mux to none */
681685 ac97_write(codec, AC97_VIDEO, ac97_read(codec, AC97_VIDEO) | 0x3000);
682686
683687 return 0;
684688
685−reset_err:
686− snd_soc_free_ac97_codec(wm9712->ac97);
689+err_put_device:
690+ put_device(&wm9712->ac97->dev);
687691 return ret;
688692 }
689693
sound/soc/codecs/wm9713.c+8−4
@@ -1225,7 +1225,7 @@ static int wm9713_soc_probe(struct snd_soc_codec *codec) · 1224 unmodified lines
12251225 struct wm9713_priv *wm9713 = snd_soc_codec_get_drvdata(codec);
12261226 int ret = 0, reg;
12271227
1228− wm9713->ac97 = snd_soc_new_ac97_codec(codec);
1228+ wm9713->ac97 = snd_soc_alloc_ac97_codec(codec);
12291229 if (IS_ERR(wm9713->ac97))
12301230 return PTR_ERR(wm9713->ac97);
12311231
@@ -1234,7 +1234,11 @@ static int wm9713_soc_probe(struct snd_soc_codec *codec) · 2 unmodified lines
12341234 wm9713_reset(codec, 0);
12351235 ret = wm9713_reset(codec, 1);
12361236 if (ret < 0)
1237− goto reset_err;
1237+ goto err_put_device;
1238+
1239+ ret = device_add(&wm9713->ac97->dev);
1240+ if (ret)
1241+ goto err_put_device;
12381242
12391243 /* unmute the adc - move to kcontrol */
12401244 reg = ac97_read(codec, AC97_CD) & 0x7fff;
@@ -1242,8 +1246,8 @@ static int wm9713_soc_probe(struct snd_soc_codec *codec) · 1 unmodified line
12421246
12431247 return 0;
12441248
1245−reset_err:
1246− snd_soc_free_ac97_codec(wm9713->ac97);
1249+err_put_device:
1250+ put_device(&wm9713->ac97->dev);
12471251 return ret;
12481252 }
12491253

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t