diff options
author | Takashi Iwai <tiwai@suse.de> | 2008-03-18 04:57:50 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2008-04-24 06:00:26 -0400 |
commit | 888afa15418f001896bc11f498f9348e029611bd (patch) | |
tree | 7e0bb8f9c6d8d5d86b4cbd1fa473712f8b2f7c39 /sound/pci/hda/hda_codec.c | |
parent | 117f257d7a9599ff9cb5ab7a6a10201c6294b5f1 (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/hda/hda_codec.c')
-rw-r--r-- | sound/pci/hda/hda_codec.c | 31 |
1 files changed, 21 insertions, 10 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 | ||
723 | void 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); |