[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>
This commit is contained in:
Takashi Iwai
2007-08-10 17:09:26 +02:00
committed by Jaroslav Kysela
parent b3ac563641
commit 82beb8fd36
12 changed files with 195 additions and 348 deletions

View File

@ -427,27 +427,6 @@ static int cmi9880_init(struct hda_codec *codec)
return 0;
}
#ifdef CONFIG_PM
/*
* resume
*/
static int cmi9880_resume(struct hda_codec *codec)
{
struct cmi_spec *spec = codec->spec;
cmi9880_init(codec);
snd_hda_resume_ctls(codec, cmi9880_basic_mixer);
if (spec->channel_modes)
snd_hda_resume_ctls(codec, cmi9880_ch_mode_mixer);
if (spec->multiout.dig_out_nid)
snd_hda_resume_spdif_out(codec);
if (spec->dig_in_nid)
snd_hda_resume_spdif_in(codec);
return 0;
}
#endif
/*
* Analog playback callbacks
*/
@ -635,9 +614,6 @@ static struct hda_codec_ops cmi9880_patch_ops = {
.build_pcms = cmi9880_build_pcms,
.init = cmi9880_init,
.free = cmi9880_free,
#ifdef CONFIG_PM
.resume = cmi9880_resume,
#endif
};
static int patch_cmi9880(struct hda_codec *codec)