aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_generic.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/hda_generic.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/hda_generic.c')
-rw-r--r--sound/pci/hda/hda_generic.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index 000287f7da43..d5f1180115ce 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -218,9 +218,9 @@ static int unmute_output(struct hda_codec *codec, struct hda_gnode *node)
218 ofs = (node->amp_out_caps & AC_AMPCAP_OFFSET) >> AC_AMPCAP_OFFSET_SHIFT; 218 ofs = (node->amp_out_caps & AC_AMPCAP_OFFSET) >> AC_AMPCAP_OFFSET_SHIFT;
219 if (val >= ofs) 219 if (val >= ofs)
220 val -= ofs; 220 val -= ofs;
221 val |= AC_AMP_SET_LEFT | AC_AMP_SET_RIGHT; 221 snd_hda_codec_amp_update(codec, node->nid, 0, HDA_OUTPUT, 0, 0xff, val);
222 val |= AC_AMP_SET_OUTPUT; 222 snd_hda_codec_amp_update(codec, node->nid, 0, HDA_OUTPUT, 1, 0xff, val);
223 return snd_hda_codec_write(codec, node->nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, val); 223 return 0;
224} 224}
225 225
226/* 226/*
@@ -234,11 +234,11 @@ static int unmute_input(struct hda_codec *codec, struct hda_gnode *node, unsigne
234 ofs = (node->amp_in_caps & AC_AMPCAP_OFFSET) >> AC_AMPCAP_OFFSET_SHIFT; 234 ofs = (node->amp_in_caps & AC_AMPCAP_OFFSET) >> AC_AMPCAP_OFFSET_SHIFT;
235 if (val >= ofs) 235 if (val >= ofs)
236 val -= ofs; 236 val -= ofs;
237 val |= AC_AMP_SET_LEFT | AC_AMP_SET_RIGHT; 237 snd_hda_codec_amp_update(codec, node->nid, 0, HDA_INPUT, index,
238 val |= AC_AMP_SET_INPUT; 238 0xff, val);
239 // awk added - fixed to allow unmuting of indexed amps 239 snd_hda_codec_amp_update(codec, node->nid, 1, HDA_INPUT, index,
240 val |= index << AC_AMP_SET_INDEX_SHIFT; 240 0xff, val);
241 return snd_hda_codec_write(codec, node->nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, val); 241 return 0;
242} 242}
243 243
244/* 244/*
@@ -248,7 +248,8 @@ static int select_input_connection(struct hda_codec *codec, struct hda_gnode *no
248 unsigned int index) 248 unsigned int index)
249{ 249{
250 snd_printdd("CONNECT: NID=0x%x IDX=0x%x\n", node->nid, index); 250 snd_printdd("CONNECT: NID=0x%x IDX=0x%x\n", node->nid, index);
251 return snd_hda_codec_write(codec, node->nid, 0, AC_VERB_SET_CONNECT_SEL, index); 251 return snd_hda_codec_write_cache(codec, node->nid, 0,
252 AC_VERB_SET_CONNECT_SEL, index);
252} 253}
253 254
254/* 255/*
@@ -379,7 +380,7 @@ static struct hda_gnode *parse_output_jack(struct hda_codec *codec,
379 /* unmute the PIN output */ 380 /* unmute the PIN output */
380 unmute_output(codec, node); 381 unmute_output(codec, node);
381 /* set PIN-Out enable */ 382 /* set PIN-Out enable */
382 snd_hda_codec_write(codec, node->nid, 0, 383 snd_hda_codec_write_cache(codec, node->nid, 0,
383 AC_VERB_SET_PIN_WIDGET_CONTROL, 384 AC_VERB_SET_PIN_WIDGET_CONTROL,
384 AC_PINCTL_OUT_EN | 385 AC_PINCTL_OUT_EN |
385 ((node->pin_caps & AC_PINCAP_HP_DRV) ? 386 ((node->pin_caps & AC_PINCAP_HP_DRV) ?
@@ -570,7 +571,8 @@ static int parse_adc_sub_nodes(struct hda_codec *codec, struct hda_gspec *spec,
570 /* unmute the PIN external input */ 571 /* unmute the PIN external input */
571 unmute_input(codec, node, 0); /* index = 0? */ 572 unmute_input(codec, node, 0); /* index = 0? */
572 /* set PIN-In enable */ 573 /* set PIN-In enable */
573 snd_hda_codec_write(codec, node->nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, pinctl); 574 snd_hda_codec_write_cache(codec, node->nid, 0,
575 AC_VERB_SET_PIN_WIDGET_CONTROL, pinctl);
574 576
575 return 1; /* found */ 577 return 1; /* found */
576} 578}