aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2008-03-18 04:57:50 -0400
committerTakashi Iwai <tiwai@suse.de>2008-04-24 06:00:26 -0400
commit888afa15418f001896bc11f498f9348e029611bd (patch)
tree7e0bb8f9c6d8d5d86b4cbd1fa473712f8b2f7c39 /sound/pci
parent117f257d7a9599ff9cb5ab7a6a10201c6294b5f1 (diff)
[ALSA] hda-codec - keep the format verb at closing PCM streams
Keep the format verb at closing PCM streams. Introduced snd_hda_codec_cleanup_stream() for the parcicular purpose. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/hda/hda_codec.c31
-rw-r--r--sound/pci/hda/hda_codec.h1
-rw-r--r--sound/pci/hda/hda_generic.c4
-rw-r--r--sound/pci/hda/patch_analog.c6
-rw-r--r--sound/pci/hda/patch_cmedia.c2
-rw-r--r--sound/pci/hda/patch_conexant.c7
-rw-r--r--sound/pci/hda/patch_realtek.c4
-rw-r--r--sound/pci/hda/patch_sigmatel.c2
-rw-r--r--sound/pci/hda/patch_via.c3
9 files changed, 34 insertions, 26 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index e6bace83e7cf..689d177c17bd 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -720,6 +720,19 @@ void snd_hda_codec_setup_stream(struct hda_codec *codec, hda_nid_t nid,
720 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_STREAM_FORMAT, format); 720 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_STREAM_FORMAT, format);
721} 721}
722 722
723void snd_hda_codec_cleanup_stream(struct hda_codec *codec, hda_nid_t nid)
724{
725 if (!nid)
726 return;
727
728 snd_printdd("hda_codec_cleanup_stream: NID=0x%x\n", nid);
729 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CHANNEL_STREAMID, 0);
730#if 0 /* keep the format */
731 msleep(1);
732 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_STREAM_FORMAT, 0);
733#endif
734}
735
723/* 736/*
724 * amp access functions 737 * amp access functions
725 */ 738 */
@@ -2204,7 +2217,7 @@ static int hda_pcm_default_cleanup(struct hda_pcm_stream *hinfo,
2204 struct hda_codec *codec, 2217 struct hda_codec *codec,
2205 struct snd_pcm_substream *substream) 2218 struct snd_pcm_substream *substream)
2206{ 2219{
2207 snd_hda_codec_setup_stream(codec, hinfo->nid, 0, 0, 0); 2220 snd_hda_codec_cleanup_stream(codec, hinfo->nid);
2208 return 0; 2221 return 0;
2209} 2222}
2210 2223
@@ -2589,7 +2602,7 @@ int snd_hda_multi_out_dig_open(struct hda_codec *codec,
2589 mutex_lock(&codec->spdif_mutex); 2602 mutex_lock(&codec->spdif_mutex);
2590 if (mout->dig_out_used == HDA_DIG_ANALOG_DUP) 2603 if (mout->dig_out_used == HDA_DIG_ANALOG_DUP)
2591 /* already opened as analog dup; reset it once */ 2604 /* already opened as analog dup; reset it once */
2592 snd_hda_codec_setup_stream(codec, mout->dig_out_nid, 0, 0, 0); 2605 snd_hda_codec_cleanup_stream(codec, mout->dig_out_nid);
2593 mout->dig_out_used = HDA_DIG_EXCLUSIVE; 2606 mout->dig_out_used = HDA_DIG_EXCLUSIVE;
2594 mutex_unlock(&codec->spdif_mutex); 2607 mutex_unlock(&codec->spdif_mutex);
2595 return 0; 2608 return 0;
@@ -2684,8 +2697,7 @@ int snd_hda_multi_out_analog_prepare(struct hda_codec *codec,
2684 stream_tag, format); 2697 stream_tag, format);
2685 } else { 2698 } else {
2686 mout->dig_out_used = 0; 2699 mout->dig_out_used = 0;
2687 snd_hda_codec_setup_stream(codec, mout->dig_out_nid, 2700 snd_hda_codec_cleanup_stream(codec, mout->dig_out_nid);
2688 0, 0, 0);
2689 } 2701 }
2690 } 2702 }
2691 mutex_unlock(&codec->spdif_mutex); 2703 mutex_unlock(&codec->spdif_mutex);
@@ -2727,17 +2739,16 @@ int snd_hda_multi_out_analog_cleanup(struct hda_codec *codec,
2727 int i; 2739 int i;
2728 2740
2729 for (i = 0; i < mout->num_dacs; i++) 2741 for (i = 0; i < mout->num_dacs; i++)
2730 snd_hda_codec_setup_stream(codec, nids[i], 0, 0, 0); 2742 snd_hda_codec_cleanup_stream(codec, nids[i]);
2731 if (mout->hp_nid) 2743 if (mout->hp_nid)
2732 snd_hda_codec_setup_stream(codec, mout->hp_nid, 0, 0, 0); 2744 snd_hda_codec_cleanup_stream(codec, mout->hp_nid);
2733 for (i = 0; i < ARRAY_SIZE(mout->extra_out_nid); i++) 2745 for (i = 0; i < ARRAY_SIZE(mout->extra_out_nid); i++)
2734 if (mout->extra_out_nid[i]) 2746 if (mout->extra_out_nid[i])
2735 snd_hda_codec_setup_stream(codec, 2747 snd_hda_codec_cleanup_stream(codec,
2736 mout->extra_out_nid[i], 2748 mout->extra_out_nid[i]);
2737 0, 0, 0);
2738 mutex_lock(&codec->spdif_mutex); 2749 mutex_lock(&codec->spdif_mutex);
2739 if (mout->dig_out_nid && mout->dig_out_used == HDA_DIG_ANALOG_DUP) { 2750 if (mout->dig_out_nid && mout->dig_out_used == HDA_DIG_ANALOG_DUP) {
2740 snd_hda_codec_setup_stream(codec, mout->dig_out_nid, 0, 0, 0); 2751 snd_hda_codec_cleanup_stream(codec, mout->dig_out_nid);
2741 mout->dig_out_used = 0; 2752 mout->dig_out_used = 0;
2742 } 2753 }
2743 mutex_unlock(&codec->spdif_mutex); 2754 mutex_unlock(&codec->spdif_mutex);
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index 301b5227bfb1..dcd390b2bbaa 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -722,6 +722,7 @@ int snd_hda_build_pcms(struct hda_bus *bus);
722void snd_hda_codec_setup_stream(struct hda_codec *codec, hda_nid_t nid, 722void snd_hda_codec_setup_stream(struct hda_codec *codec, hda_nid_t nid,
723 u32 stream_tag, 723 u32 stream_tag,
724 int channel_id, int format); 724 int channel_id, int format);
725void snd_hda_codec_cleanup_stream(struct hda_codec *codec, hda_nid_t nid);
725unsigned int snd_hda_calc_stream_format(unsigned int rate, 726unsigned int snd_hda_calc_stream_format(unsigned int rate,
726 unsigned int channels, 727 unsigned int channels,
727 unsigned int format, 728 unsigned int format,
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index f9de7c467c25..59e4389c94a4 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -1007,8 +1007,8 @@ static int generic_pcm2_cleanup(struct hda_pcm_stream *hinfo,
1007{ 1007{
1008 struct hda_gspec *spec = codec->spec; 1008 struct hda_gspec *spec = codec->spec;
1009 1009
1010 snd_hda_codec_setup_stream(codec, hinfo->nid, 0, 0, 0); 1010 snd_hda_codec_cleanup_stream(codec, hinfo->nid);
1011 snd_hda_codec_setup_stream(codec, spec->dac_node[1]->nid, 0, 0, 0); 1011 snd_hda_codec_cleanup_stream(codec, spec->dac_node[1]->nid);
1012 return 0; 1012 return 0;
1013} 1013}
1014 1014
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index 87db3c410a10..220784bb76a7 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -296,8 +296,7 @@ static int ad198x_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
296 struct snd_pcm_substream *substream) 296 struct snd_pcm_substream *substream)
297{ 297{
298 struct ad198x_spec *spec = codec->spec; 298 struct ad198x_spec *spec = codec->spec;
299 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], 299 snd_hda_codec_cleanup_stream(codec, spec->adc_nids[substream->number]);
300 0, 0, 0);
301 return 0; 300 return 0;
302} 301}
303 302
@@ -3325,8 +3324,7 @@ static int ad1984_pcm_dmic_cleanup(struct hda_pcm_stream *hinfo,
3325 struct hda_codec *codec, 3324 struct hda_codec *codec,
3326 struct snd_pcm_substream *substream) 3325 struct snd_pcm_substream *substream)
3327{ 3326{
3328 snd_hda_codec_setup_stream(codec, 0x05 + substream->number, 3327 snd_hda_codec_cleanup_stream(codec, 0x05 + substream->number);
3329 0, 0, 0);
3330 return 0; 3328 return 0;
3331} 3329}
3332 3330
diff --git a/sound/pci/hda/patch_cmedia.c b/sound/pci/hda/patch_cmedia.c
index 1892c81f1d11..8d142851aaca 100644
--- a/sound/pci/hda/patch_cmedia.c
+++ b/sound/pci/hda/patch_cmedia.c
@@ -513,7 +513,7 @@ static int cmi9880_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
513{ 513{
514 struct cmi_spec *spec = codec->spec; 514 struct cmi_spec *spec = codec->spec;
515 515
516 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], 0, 0, 0); 516 snd_hda_codec_cleanup_stream(codec, spec->adc_nids[substream->number]);
517 return 0; 517 return 0;
518} 518}
519 519
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index c67613ff842d..36fd85260035 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -174,8 +174,7 @@ static int conexant_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
174 struct snd_pcm_substream *substream) 174 struct snd_pcm_substream *substream)
175{ 175{
176 struct conexant_spec *spec = codec->spec; 176 struct conexant_spec *spec = codec->spec;
177 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], 177 snd_hda_codec_cleanup_stream(codec, spec->adc_nids[substream->number]);
178 0, 0, 0);
179 return 0; 178 return 0;
180} 179}
181 180
@@ -243,7 +242,7 @@ static int cx5051_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
243 struct snd_pcm_substream *substream) 242 struct snd_pcm_substream *substream)
244{ 243{
245 struct conexant_spec *spec = codec->spec; 244 struct conexant_spec *spec = codec->spec;
246 snd_hda_codec_setup_stream(codec, spec->cur_adc, 0, 0, 0); 245 snd_hda_codec_cleanup_stream(codec, spec->cur_adc);
247 spec->cur_adc = 0; 246 spec->cur_adc = 0;
248 return 0; 247 return 0;
249} 248}
@@ -1594,7 +1593,7 @@ static void cxt5051_portc_automic(struct hda_codec *codec)
1594 new_adc = spec->adc_nids[spec->cur_adc_idx]; 1593 new_adc = spec->adc_nids[spec->cur_adc_idx];
1595 if (spec->cur_adc && spec->cur_adc != new_adc) { 1594 if (spec->cur_adc && spec->cur_adc != new_adc) {
1596 /* stream is running, let's swap the current ADC */ 1595 /* stream is running, let's swap the current ADC */
1597 snd_hda_codec_setup_stream(codec, spec->cur_adc, 0, 0, 0); 1596 snd_hda_codec_cleanup_stream(codec, spec->cur_adc);
1598 spec->cur_adc = new_adc; 1597 spec->cur_adc = new_adc;
1599 snd_hda_codec_setup_stream(codec, new_adc, 1598 snd_hda_codec_setup_stream(codec, new_adc,
1600 spec->cur_adc_stream_tag, 0, 1599 spec->cur_adc_stream_tag, 0,
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index c21d7863e0dc..eb40f4820c8b 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -2409,8 +2409,8 @@ static int alc880_alt_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
2409{ 2409{
2410 struct alc_spec *spec = codec->spec; 2410 struct alc_spec *spec = codec->spec;
2411 2411
2412 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], 2412 snd_hda_codec_cleanup_stream(codec,
2413 0, 0, 0); 2413 spec->adc_nids[substream->number + 1]);
2414 return 0; 2414 return 0;
2415} 2415}
2416 2416
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index a39fbd89a985..8eff8fe9dcfd 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -1932,7 +1932,7 @@ static int stac92xx_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
1932{ 1932{
1933 struct sigmatel_spec *spec = codec->spec; 1933 struct sigmatel_spec *spec = codec->spec;
1934 1934
1935 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], 0, 0, 0); 1935 snd_hda_codec_cleanup_stream(codec, spec->adc_nids[substream->number]);
1936 return 0; 1936 return 0;
1937} 1937}
1938 1938
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c
index 09f1c25eb7e5..52b1d81a26f7 100644
--- a/sound/pci/hda/patch_via.c
+++ b/sound/pci/hda/patch_via.c
@@ -431,8 +431,7 @@ static int via_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
431 struct snd_pcm_substream *substream) 431 struct snd_pcm_substream *substream)
432{ 432{
433 struct via_spec *spec = codec->spec; 433 struct via_spec *spec = codec->spec;
434 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], 434 snd_hda_codec_cleanup_stream(codec, spec->adc_nids[substream->number]);
435 0, 0, 0);
436 return 0; 435 return 0;
437} 436}
438 437