aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_conexant.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2007-08-10 11:09:26 -0400
committerJaroslav Kysela <perex@perex.cz>2007-10-16 09:58:43 -0400
commit82beb8fd365afe3891b277c46425083f13e23c56 (patch)
treea564d7228b59170aa490d4fc9284b5fa4442adb0 /sound/pci/hda/patch_conexant.c
parentb3ac56364126f78cae94eb2a75b72d9ea85aca9d (diff)
[ALSA] hda-codec - optimize resume using caches
So far, the driver looked the table of snd_kcontrol_new used for creating mixer elements and forces to call each of its put callbacks in PM resume code. This is too ugly and hackish. Now, the resume is simplified using the codec amp and command register caches. The driver simply restores the values that have been written in the cache table. With this simplification, most codec support codes don't require any special resume callback. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/pci/hda/patch_conexant.c')
-rw-r--r--sound/pci/hda/patch_conexant.c28
1 files changed, 4 insertions, 24 deletions
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index 26034315197f..f1b6d0eda140 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -311,23 +311,6 @@ static void conexant_free(struct hda_codec *codec)
311 kfree(codec->spec); 311 kfree(codec->spec);
312} 312}
313 313
314#ifdef CONFIG_PM
315static int conexant_resume(struct hda_codec *codec)
316{
317 struct conexant_spec *spec = codec->spec;
318 int i;
319
320 codec->patch_ops.init(codec);
321 for (i = 0; i < spec->num_mixers; i++)
322 snd_hda_resume_ctls(codec, spec->mixers[i]);
323 if (spec->multiout.dig_out_nid)
324 snd_hda_resume_spdif_out(codec);
325 if (spec->dig_in_nid)
326 snd_hda_resume_spdif_in(codec);
327 return 0;
328}
329#endif
330
331static int conexant_build_controls(struct hda_codec *codec) 314static int conexant_build_controls(struct hda_codec *codec)
332{ 315{
333 struct conexant_spec *spec = codec->spec; 316 struct conexant_spec *spec = codec->spec;
@@ -358,9 +341,6 @@ static struct hda_codec_ops conexant_patch_ops = {
358 .build_pcms = conexant_build_pcms, 341 .build_pcms = conexant_build_pcms,
359 .init = conexant_init, 342 .init = conexant_init,
360 .free = conexant_free, 343 .free = conexant_free,
361#ifdef CONFIG_PM
362 .resume = conexant_resume,
363#endif
364}; 344};
365 345
366/* 346/*
@@ -396,13 +376,13 @@ static int cxt_eapd_put(struct snd_kcontrol *kcontrol,
396 eapd = ucontrol->value.integer.value[0]; 376 eapd = ucontrol->value.integer.value[0];
397 if (invert) 377 if (invert)
398 eapd = !eapd; 378 eapd = !eapd;
399 if (eapd == spec->cur_eapd && !codec->in_resume) 379 if (eapd == spec->cur_eapd)
400 return 0; 380 return 0;
401 381
402 spec->cur_eapd = eapd; 382 spec->cur_eapd = eapd;
403 snd_hda_codec_write(codec, nid, 383 snd_hda_codec_write_cache(codec, nid,
404 0, AC_VERB_SET_EAPD_BTLENABLE, 384 0, AC_VERB_SET_EAPD_BTLENABLE,
405 eapd ? 0x02 : 0x00); 385 eapd ? 0x02 : 0x00);
406 return 1; 386 return 1;
407} 387}
408 388