[alsa-devel] How to set idle S/PDIF sample rate?
When no programs have the sound hardware open, ALSA drives my Intel HDA's S/PDIF output with silence at 48000 Hz. How would I change this default so that the idle sample rate is 44100 Hz? The reason I ask is that my stereo receiver misses the first second or so of each song that I play as it switches from 48000 Hz to 44100 Hz. I understand that by switching the idle sample rate to 44100 Hz, I would have the same problem whenever playing a DVD, but I can much more happily accept the switching delay when starting DVDs than I can when starting music playback.
I've tried everything, including replacing /usr/share/alsa/alsa.conf with a single PCM definition that outputs straight to hardware with "rate 44100", but still, whenever nothing is accessing the sound hardware, ALSA reverts to 48000-Hz silence. There must be a way to influence that, right?
Alternatively, if ALSA would simply not output anything over S/PDIF when idle, my receiver could just stay at 44100 Hz, albeit unlocked since there would be no data stream at all. So this is also an acceptable solution to me, but I cannot find any way to make ALSA totally shut up when idle. It always wants to output silence. Interestingly, if I mute the IEC958 playback channel and then unmute it, my receiver reports no signal at all until I play a sound, and then after the sound finishes, my receiver reports that it is locked onto PCM at 48000 Hz. Seems kind of like a bug, doesn't it?
Thanks to anyone who can lend some assistance.
At Fri, 22 Feb 2008 22:34:22 -0500, Matt Whitlock wrote:
When no programs have the sound hardware open, ALSA drives my Intel HDA's S/PDIF output with silence at 48000 Hz. How would I change this default so that the idle sample rate is 44100 Hz? The reason I ask is that my stereo receiver misses the first second or so of each song that I play as it switches from 48000 Hz to 44100 Hz. I understand that by switching the idle sample rate to 44100 Hz, I would have the same problem whenever playing a DVD, but I can much more happily accept the switching delay when starting DVDs than I can when starting music playback.
You can use iecset utility to set the default SPDIF setting. But, in the case of HD-audio, the sample rate isn't included in the status bits verb but rather set dynamically via the normal PCM rate stting. So, I don't think this would fix your problem.
I've tried everything, including replacing /usr/share/alsa/alsa.conf with a single PCM definition that outputs straight to hardware with "rate 44100", but still, whenever nothing is accessing the sound hardware, ALSA reverts to 48000-Hz silence. There must be a way to influence that, right?
Alternatively, if ALSA would simply not output anything over S/PDIF when idle, my receiver could just stay at 44100 Hz, albeit unlocked since there would be no data stream at all. So this is also an acceptable solution to me, but I cannot find any way to make ALSA totally shut up when idle. It always wants to output silence. Interestingly, if I mute the IEC958 playback channel and then unmute it, my receiver reports no signal at all until I play a sound, and then after the sound finishes, my receiver reports that it is locked onto PCM at 48000 Hz. Seems kind of like a bug, doesn't it?
Hm, what happens if you mute IEC958 playback switch before the end of the playback stream?
Takashi
On Monday, 25 February 2008 6:16:11 am Takashi Iwai wrote:
At Fri, 22 Feb 2008 22:34:22 -0500, Matt Whitlock wrote:
When no programs have the sound hardware open, ALSA drives my Intel HDA's S/PDIF output with silence at 48000 Hz. How would I change this default so that the idle sample rate is 44100 Hz?
You can use iecset utility to set the default SPDIF setting. But, in the case of HD-audio, the sample rate isn't included in the status bits verb but rather set dynamically via the normal PCM rate stting. So, I don't think this would fix your problem.
Correct. Executing 'iecset rate 44100' while the sound card is idle prints a text block that says "Rate: 44100 Hz", but my receiver still shows that it is receiving PCM at 48000 Hz. If I then play a 44100-Hz stream, the receiver switches to 44100 Hz (takes a moment, during which audio is dropped), and then when I stop the playback, the receiver switches back to 48000 Hz (takes another moment, although it's imperceptible because there's no audio to drop at this point). Interestingly, running 'iecset' with no arguments at this point still shows "Rate: 44100 Hz" even though the card is outputting 48000-Hz silence.
I've tried everything, including replacing /usr/share/alsa/alsa.conf with a single PCM definition that outputs straight to hardware with "rate 44100", but still, whenever nothing is accessing the sound hardware, ALSA reverts to 48000-Hz silence. There must be a way to influence that, right?
Alternatively, if ALSA would simply not output anything over S/PDIF when idle, my receiver could just stay at 44100 Hz, albeit unlocked since there would be no data stream at all. So this is also an acceptable solution to me, but I cannot find any way to make ALSA totally shut up when idle. It always wants to output silence. Interestingly, if I mute the IEC958 playback channel and then unmute it, my receiver reports no signal at all until I play a sound, and then after the sound finishes, my receiver reports that it is locked onto PCM at 48000 Hz. Seems kind of like a bug, doesn't it?
Hm, what happens if you mute IEC958 playback switch before the end of the playback stream?
There are some interesting and complex behaviors going on here. I will record my steps and results exactly.
Precondition: iec958 channel muted; iecset shows "Rate: 48000 Hz"; no signal at receiver 1. begin playback of 44100-Hz stream with 'aplay' (default device) Result: no change at receiver (no signal) 2. interrupt aplay Result: no change 3. begin playback of 44100-Hz stream with 'aplay -D spdif' Result: iec958 channel becomes unmuted; receiver shows PCM at 44100 Hz; sound audible after momentary delay 4. interrupt aplay Result: iec958 channel becomes muted again; receiver shows no signal after ~2-second delay 5. unmute iec958 channel in alsamixer Result: receiver display blips momentarily but goes back to no signal 6. mute iec958 channel in alsamixer Result: no change (no signal) 7. unmute iec958 channel in alsamixer again Result: no change (no signal; no blip on receiver display this time) 8. begin playback of 44100-Hz stream with 'aplay' (default device) Result: receiver shows PCM at 48000 Hz; sound audible immediately 9. interrupt aplay Result: no change (receiver still shows PCM at 48000 Hz; no blip on receiver display) 10. begin playback of 44100-Hz stream with 'aplay -D spdif' Result: receiver switches to 44100-Hz PCM; sound becomes audible after momentary switching delay 11. interrupt aplay Result: receiver switches back to 48000-Hz PCM 12. begin playback of 44100-Hz stream with 'aplay' (default device) Result: no change on receiver display (still shows PCM at 48000 Hz); sound audible immediately 13. attempt to mute iec958 channel in alsamixer Result: iec958 channel becomes muted; receiver shows no signal after ~2-second delay 14. attempt to unmute iec958 channel in alsamixer Result: iec958 channel becomes unmuted; receiver shows PCM at 48000 Hz; sound audible again 15. interrupt aplay Result: no change at receiver (still shows PCM at 48000 Hz) 16. begin playback of 44100-Hz stream with 'aplay -D spdif' Result: receiver switches to 44100-Hz PCM; sound becomes audible after momentary switching delay 17. attempt to mute iec958 channel in alsamixer Result: no change (iec958 does not become muted; receiver still shows PCM at 44100 Hz; sound still audible)
I just ran through this list of steps a second time to be sure they are completely correct, and they are.
To sum up what I'm seeing:
iec958 channel muted -------------------- playback to default device: no signal playback to spdif device: PCM at 44100 Hz idle: no signal
iec958 channel unmuted ---------------------- playback to default device: PCM at 48000 Hz playback to spdif device: PCM at 44100 Hz idle: no signal immediately after unmute; PCM at 48000 Hz after any audio stream
If I could just get that last state (iec958 unmuted; idle after any audio stream) to be 44100 Hz instead of 48000 Hz, I would be happy.
Most likely the receiver does not read the sample rate from SPDIF headers, but analyses the actual incoming frequency. At least that is what well-behaved SPDIF receivers do.
Pavel.
Matt Whitlock wrote:
On Monday, 25 February 2008 6:16:11 am Takashi Iwai wrote:
At Fri, 22 Feb 2008 22:34:22 -0500, Matt Whitlock wrote:
When no programs have the sound hardware open, ALSA drives my Intel HDA's S/PDIF output with silence at 48000 Hz. How would I change this default so that the idle sample rate is 44100 Hz?
You can use iecset utility to set the default SPDIF setting. But, in the case of HD-audio, the sample rate isn't included in the status bits verb but rather set dynamically via the normal PCM rate stting. So, I don't think this would fix your problem.
Correct. Executing 'iecset rate 44100' while the sound card is idle prints a text block that says "Rate: 44100 Hz", but my receiver still shows that it is receiving PCM at 48000 Hz. If I then play a 44100-Hz stream, the receiver switches to 44100 Hz (takes a moment, during which audio is dropped), and then when I stop the playback, the receiver switches back to 48000 Hz (takes another moment, although it's imperceptible because there's no audio to drop at this point). Interestingly, running 'iecset' with no arguments at this point still shows "Rate: 44100 Hz" even though the card is outputting 48000-Hz silence.
I've tried everything, including replacing /usr/share/alsa/alsa.conf with a single PCM definition that outputs straight to hardware with "rate 44100", but still, whenever nothing is accessing the sound hardware, ALSA reverts to 48000-Hz silence. There must be a way to influence that, right?
Alternatively, if ALSA would simply not output anything over S/PDIF when idle, my receiver could just stay at 44100 Hz, albeit unlocked since there would be no data stream at all. So this is also an acceptable solution to me, but I cannot find any way to make ALSA totally shut up when idle. It always wants to output silence. Interestingly, if I mute the IEC958 playback channel and then unmute it, my receiver reports no signal at all until I play a sound, and then after the sound finishes, my receiver reports that it is locked onto PCM at 48000 Hz. Seems kind of like a bug, doesn't it?
Hm, what happens if you mute IEC958 playback switch before the end of the playback stream?
There are some interesting and complex behaviors going on here. I will record my steps and results exactly.
Precondition: iec958 channel muted; iecset shows "Rate: 48000 Hz"; no signal at receiver
- begin playback of 44100-Hz stream with 'aplay' (default device)
Result: no change at receiver (no signal) 2. interrupt aplay Result: no change 3. begin playback of 44100-Hz stream with 'aplay -D spdif' Result: iec958 channel becomes unmuted; receiver shows PCM at 44100 Hz; sound audible after momentary delay 4. interrupt aplay Result: iec958 channel becomes muted again; receiver shows no signal after ~2-second delay 5. unmute iec958 channel in alsamixer Result: receiver display blips momentarily but goes back to no signal 6. mute iec958 channel in alsamixer Result: no change (no signal) 7. unmute iec958 channel in alsamixer again Result: no change (no signal; no blip on receiver display this time) 8. begin playback of 44100-Hz stream with 'aplay' (default device) Result: receiver shows PCM at 48000 Hz; sound audible immediately 9. interrupt aplay Result: no change (receiver still shows PCM at 48000 Hz; no blip on receiver display) 10. begin playback of 44100-Hz stream with 'aplay -D spdif' Result: receiver switches to 44100-Hz PCM; sound becomes audible after momentary switching delay 11. interrupt aplay Result: receiver switches back to 48000-Hz PCM 12. begin playback of 44100-Hz stream with 'aplay' (default device) Result: no change on receiver display (still shows PCM at 48000 Hz); sound audible immediately 13. attempt to mute iec958 channel in alsamixer Result: iec958 channel becomes muted; receiver shows no signal after ~2-second delay 14. attempt to unmute iec958 channel in alsamixer Result: iec958 channel becomes unmuted; receiver shows PCM at 48000 Hz; sound audible again 15. interrupt aplay Result: no change at receiver (still shows PCM at 48000 Hz) 16. begin playback of 44100-Hz stream with 'aplay -D spdif' Result: receiver switches to 44100-Hz PCM; sound becomes audible after momentary switching delay 17. attempt to mute iec958 channel in alsamixer Result: no change (iec958 does not become muted; receiver still shows PCM at 44100 Hz; sound still audible)
I just ran through this list of steps a second time to be sure they are completely correct, and they are.
To sum up what I'm seeing:
iec958 channel muted
playback to default device: no signal playback to spdif device: PCM at 44100 Hz idle: no signal
iec958 channel unmuted
playback to default device: PCM at 48000 Hz playback to spdif device: PCM at 44100 Hz idle: no signal immediately after unmute; PCM at 48000 Hz after any audio stream
If I could just get that last state (iec958 unmuted; idle after any audio stream) to be 44100 Hz instead of 48000 Hz, I would be happy. _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
On Monday, 25 February 2008 2:51:58 pm Pavel Hofman wrote:
Most likely the receiver does not read the sample rate from SPDIF headers, but analyses the actual incoming frequency. At least that is what well-behaved SPDIF receivers do.
This is an Onkyo 5.1-channel receiver. A pretty well-respected brand in the audio world. Not quite a Denon, but close.
At Mon, 25 Feb 2008 14:03:21 -0500, Matt Whitlock wrote:
On Monday, 25 February 2008 6:16:11 am Takashi Iwai wrote:
At Fri, 22 Feb 2008 22:34:22 -0500, Matt Whitlock wrote:
When no programs have the sound hardware open, ALSA drives my Intel HDA's S/PDIF output with silence at 48000 Hz. How would I change this default so that the idle sample rate is 44100 Hz?
You can use iecset utility to set the default SPDIF setting. But, in the case of HD-audio, the sample rate isn't included in the status bits verb but rather set dynamically via the normal PCM rate stting. So, I don't think this would fix your problem.
Correct. Executing 'iecset rate 44100' while the sound card is idle prints a text block that says "Rate: 44100 Hz", but my receiver still shows that it is receiving PCM at 48000 Hz. If I then play a 44100-Hz stream, the receiver switches to 44100 Hz (takes a moment, during which audio is dropped), and then when I stop the playback, the receiver switches back to 48000 Hz (takes another moment, although it's imperceptible because there's no audio to drop at this point). Interestingly, running 'iecset' with no arguments at this point still shows "Rate: 44100 Hz" even though the card is outputting 48000-Hz silence.
I've tried everything, including replacing /usr/share/alsa/alsa.conf with a single PCM definition that outputs straight to hardware with "rate 44100", but still, whenever nothing is accessing the sound hardware, ALSA reverts to 48000-Hz silence. There must be a way to influence that, right?
Alternatively, if ALSA would simply not output anything over S/PDIF when idle, my receiver could just stay at 44100 Hz, albeit unlocked since there would be no data stream at all. So this is also an acceptable solution to me, but I cannot find any way to make ALSA totally shut up when idle. It always wants to output silence. Interestingly, if I mute the IEC958 playback channel and then unmute it, my receiver reports no signal at all until I play a sound, and then after the sound finishes, my receiver reports that it is locked onto PCM at 48000 Hz. Seems kind of like a bug, doesn't it?
Hm, what happens if you mute IEC958 playback switch before the end of the playback stream?
There are some interesting and complex behaviors going on here. I will record my steps and results exactly.
Precondition: iec958 channel muted; iecset shows "Rate: 48000 Hz"; no signal at receiver
- begin playback of 44100-Hz stream with 'aplay' (default device)
Result: no change at receiver (no signal) 2. interrupt aplay Result: no change 3. begin playback of 44100-Hz stream with 'aplay -D spdif' Result: iec958 channel becomes unmuted; receiver shows PCM at 44100 Hz; sound audible after momentary delay 4. interrupt aplay Result: iec958 channel becomes muted again; receiver shows no signal after ~2-second delay 5. unmute iec958 channel in alsamixer Result: receiver display blips momentarily but goes back to no signal 6. mute iec958 channel in alsamixer Result: no change (no signal) 7. unmute iec958 channel in alsamixer again Result: no change (no signal; no blip on receiver display this time) 8. begin playback of 44100-Hz stream with 'aplay' (default device) Result: receiver shows PCM at 48000 Hz; sound audible immediately 9. interrupt aplay Result: no change (receiver still shows PCM at 48000 Hz; no blip on receiver display) 10. begin playback of 44100-Hz stream with 'aplay -D spdif' Result: receiver switches to 44100-Hz PCM; sound becomes audible after momentary switching delay 11. interrupt aplay Result: receiver switches back to 48000-Hz PCM 12. begin playback of 44100-Hz stream with 'aplay' (default device) Result: no change on receiver display (still shows PCM at 48000 Hz); sound audible immediately 13. attempt to mute iec958 channel in alsamixer Result: iec958 channel becomes muted; receiver shows no signal after ~2-second delay 14. attempt to unmute iec958 channel in alsamixer Result: iec958 channel becomes unmuted; receiver shows PCM at 48000 Hz; sound audible again 15. interrupt aplay Result: no change at receiver (still shows PCM at 48000 Hz) 16. begin playback of 44100-Hz stream with 'aplay -D spdif' Result: receiver switches to 44100-Hz PCM; sound becomes audible after momentary switching delay 17. attempt to mute iec958 channel in alsamixer Result: no change (iec958 does not become muted; receiver still shows PCM at 44100 Hz; sound still audible)
I just ran through this list of steps a second time to be sure they are completely correct, and they are.
To sum up what I'm seeing:
iec958 channel muted
playback to default device: no signal playback to spdif device: PCM at 44100 Hz idle: no signal
iec958 channel unmuted
playback to default device: PCM at 48000 Hz playback to spdif device: PCM at 44100 Hz idle: no signal immediately after unmute; PCM at 48000 Hz after any audio stream
There is a clear difference between "default" and "spdif" PCMs. The default uses dmix plugin with the fixed 48kHz rate. The spdif is a direct access and can use all rates the codec chip supports (but no soft-mixing).
Takashi
On Tuesday, 26 February 2008 9:01:17 am Takashi Iwai wrote:
There is a clear difference between "default" and "spdif" PCMs. The default uses dmix plugin with the fixed 48kHz rate. The spdif is a direct access and can use all rates the codec chip supports (but no soft-mixing).
Well yes, I knew that. I was trying to show you the inconsistencies of state in ALSA's handling of the S/PDIF output under various sequences of actions.
Can I assume at this point that there is no way to set the idle S/PDIF output sample rate to 44100 Hz? That is my original question.
Matt Whitlock wrote:
Can I assume at this point that there is no way to set the idle S/PDIF output sample rate to 44100 Hz? That is my original question.
I have no experience with HDA. In ICE1712/24 the spdif-out outputs signal corresponding to the current sampling frequency the chip is running on, containing no data. When playing sound, the chip clock switches to appropriate frequency, and spdif outputs data of this frequency. I.e. if the "parking, idle, default" frequency is 44.1kHz, it continuously outputs 44.1kHz SPDIF signal.
I guess if you could force HDA to default to 44.1kHz (no idea whether it is feasible), that would be it.
Pavel.
Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
I tried forcing the 'rate' parameter of 'pcm.!default' to 44100, and while that does cause all my dmixed audio to be at 44100 Hz, still, when all playback streams have been closed, the hardware reverts back to silence at 48000 Hz.
I suppose I could write a little program that would simply open the default PCM and then go to sleep indefinitely. That would hold the hardware at 44100 Hz, and any music would simply be dmixed in. The downside would be that I would be unable to play DVD audio at 48000 Hz, and I would definitely be unable to stream AC3 or DTS out through S/PDIF.
On Wednesday, 27 February 2008 9:28:09 am Pavel Hofman wrote:
Matt Whitlock wrote:
Can I assume at this point that there is no way to set the idle S/PDIF output sample rate to 44100 Hz? That is my original question.
I have no experience with HDA. In ICE1712/24 the spdif-out outputs signal corresponding to the current sampling frequency the chip is running on, containing no data. When playing sound, the chip clock switches to appropriate frequency, and spdif outputs data of this frequency. I.e. if the "parking, idle, default" frequency is 44.1kHz, it continuously outputs 44.1kHz SPDIF signal.
I guess if you could force HDA to default to 44.1kHz (no idea whether it is feasible), that would be it.
Pavel.
Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
At Tue, 26 Feb 2008 17:25:35 -0500, Matt Whitlock wrote:
On Tuesday, 26 February 2008 9:01:17 am Takashi Iwai wrote:
There is a clear difference between "default" and "spdif" PCMs. The default uses dmix plugin with the fixed 48kHz rate. The spdif is a direct access and can use all rates the codec chip supports (but no soft-mixing).
Well yes, I knew that. I was trying to show you the inconsistencies of state in ALSA's handling of the S/PDIF output under various sequences of actions.
Can I assume at this point that there is no way to set the idle S/PDIF output sample rate to 44100 Hz? That is my original question.
The driver code resets the format verb of the relevant widgets at closing streams. This verb contains the sample rate, too. Maybe keeping this would prevent the reset.
The below is a test patch. Give it a try.
Takashi
---
diff -r d960c4971891 pci/hda/hda_codec.c --- a/pci/hda/hda_codec.c Thu Feb 28 12:02:56 2008 +0100 +++ b/pci/hda/hda_codec.c Thu Feb 28 12:46:43 2008 +0100 @@ -693,6 +693,19 @@ void snd_hda_codec_setup_stream(struct h (stream_tag << 4) | channel_id); msleep(1); snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_STREAM_FORMAT, format); +} + +void snd_hda_codec_cleanup_stream(struct hda_codec *codec, hda_nid_t nid) +{ + if (!nid) + return; + + snd_printdd("hda_codec_cleanup_stream: NID=0x%x\n", nid); + snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CHANNEL_STREAMID, 0); +#if 0 /* keep the format */ + msleep(1); + snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_STREAM_FORMAT, 0); +#endif }
/* @@ -2179,7 +2192,7 @@ static int hda_pcm_default_cleanup(struc struct hda_codec *codec, struct snd_pcm_substream *substream) { - snd_hda_codec_setup_stream(codec, hinfo->nid, 0, 0, 0); + snd_hda_codec_cleanup_stream(codec, hinfo->nid); return 0; }
@@ -2564,7 +2577,7 @@ int snd_hda_multi_out_dig_open(struct hd mutex_lock(&codec->spdif_mutex); if (mout->dig_out_used == HDA_DIG_ANALOG_DUP) /* already opened as analog dup; reset it once */ - snd_hda_codec_setup_stream(codec, mout->dig_out_nid, 0, 0, 0); + snd_hda_codec_cleanup_stream(codec, mout->dig_out_nid); mout->dig_out_used = HDA_DIG_EXCLUSIVE; mutex_unlock(&codec->spdif_mutex); return 0; @@ -2659,8 +2672,7 @@ int snd_hda_multi_out_analog_prepare(str stream_tag, format); } else { mout->dig_out_used = 0; - snd_hda_codec_setup_stream(codec, mout->dig_out_nid, - 0, 0, 0); + snd_hda_codec_cleanup_stream(codec, mout->dig_out_nid); } } mutex_unlock(&codec->spdif_mutex); @@ -2702,17 +2714,16 @@ int snd_hda_multi_out_analog_cleanup(str int i;
for (i = 0; i < mout->num_dacs; i++) - snd_hda_codec_setup_stream(codec, nids[i], 0, 0, 0); + snd_hda_codec_cleanup_stream(codec, nids[i]); if (mout->hp_nid) - snd_hda_codec_setup_stream(codec, mout->hp_nid, 0, 0, 0); + snd_hda_codec_cleanup_stream(codec, mout->hp_nid); for (i = 0; i < ARRAY_SIZE(mout->extra_out_nid); i++) if (mout->extra_out_nid[i]) - snd_hda_codec_setup_stream(codec, - mout->extra_out_nid[i], - 0, 0, 0); + snd_hda_codec_cleanup_stream(codec, + mout->extra_out_nid[i]); mutex_lock(&codec->spdif_mutex); if (mout->dig_out_nid && mout->dig_out_used == HDA_DIG_ANALOG_DUP) { - snd_hda_codec_setup_stream(codec, mout->dig_out_nid, 0, 0, 0); + snd_hda_codec_cleanup_stream(codec, mout->dig_out_nid); mout->dig_out_used = 0; } mutex_unlock(&codec->spdif_mutex); diff -r d960c4971891 pci/hda/hda_codec.h --- a/pci/hda/hda_codec.h Thu Feb 28 12:02:56 2008 +0100 +++ b/pci/hda/hda_codec.h Thu Feb 28 12:46:43 2008 +0100 @@ -722,6 +722,7 @@ void snd_hda_codec_setup_stream(struct h void snd_hda_codec_setup_stream(struct hda_codec *codec, hda_nid_t nid, u32 stream_tag, int channel_id, int format); +void snd_hda_codec_cleanup_stream(struct hda_codec *codec, hda_nid_t nid); unsigned int snd_hda_calc_stream_format(unsigned int rate, unsigned int channels, unsigned int format, diff -r d960c4971891 pci/hda/hda_generic.c --- a/pci/hda/hda_generic.c Thu Feb 28 12:02:56 2008 +0100 +++ b/pci/hda/hda_generic.c Thu Feb 28 12:46:43 2008 +0100 @@ -1007,8 +1007,8 @@ static int generic_pcm2_cleanup(struct h { struct hda_gspec *spec = codec->spec;
- snd_hda_codec_setup_stream(codec, hinfo->nid, 0, 0, 0); - snd_hda_codec_setup_stream(codec, spec->dac_node[1]->nid, 0, 0, 0); + snd_hda_codec_cleanup_stream(codec, hinfo->nid); + snd_hda_codec_cleanup_stream(codec, spec->dac_node[1]->nid); return 0; }
diff -r d960c4971891 pci/hda/patch_analog.c --- a/pci/hda/patch_analog.c Thu Feb 28 12:02:56 2008 +0100 +++ b/pci/hda/patch_analog.c Thu Feb 28 12:46:43 2008 +0100 @@ -295,8 +295,7 @@ static int ad198x_capture_pcm_cleanup(st struct snd_pcm_substream *substream) { struct ad198x_spec *spec = codec->spec; - snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], - 0, 0, 0); + snd_hda_codec_cleanup_stream(codec, spec->adc_nids[substream->number]); return 0; }
@@ -3324,8 +3323,7 @@ static int ad1984_pcm_dmic_cleanup(struc struct hda_codec *codec, struct snd_pcm_substream *substream) { - snd_hda_codec_setup_stream(codec, 0x05 + substream->number, - 0, 0, 0); + snd_hda_codec_cleanup_stream(codec, 0x05 + substream->number); return 0; }
diff -r d960c4971891 pci/hda/patch_cmedia.c --- a/pci/hda/patch_cmedia.c Thu Feb 28 12:02:56 2008 +0100 +++ b/pci/hda/patch_cmedia.c Thu Feb 28 12:46:43 2008 +0100 @@ -512,7 +512,7 @@ static int cmi9880_capture_pcm_cleanup(s { struct cmi_spec *spec = codec->spec;
- snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], 0, 0, 0); + snd_hda_codec_cleanup_stream(codec, spec->adc_nids[substream->number]); return 0; }
diff -r d960c4971891 pci/hda/patch_conexant.c --- a/pci/hda/patch_conexant.c Thu Feb 28 12:02:56 2008 +0100 +++ b/pci/hda/patch_conexant.c Thu Feb 28 12:46:43 2008 +0100 @@ -173,8 +173,7 @@ static int conexant_capture_pcm_cleanup( struct snd_pcm_substream *substream) { struct conexant_spec *spec = codec->spec; - snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], - 0, 0, 0); + snd_hda_codec_cleanup_stream(codec, spec->adc_nids[substream->number]); return 0; }
@@ -242,7 +241,7 @@ static int cx5051_capture_pcm_cleanup(st struct snd_pcm_substream *substream) { struct conexant_spec *spec = codec->spec; - snd_hda_codec_setup_stream(codec, spec->cur_adc, 0, 0, 0); + snd_hda_codec_cleanup_stream(codec, spec->cur_adc); spec->cur_adc = 0; return 0; } @@ -1544,7 +1543,7 @@ static void cxt5051_portc_automic(struct new_adc = spec->adc_nids[spec->cur_adc_idx]; if (spec->cur_adc && spec->cur_adc != new_adc) { /* stream is running, let's swap the current ADC */ - snd_hda_codec_setup_stream(codec, spec->cur_adc, 0, 0, 0); + snd_hda_codec_cleanup_stream(codec, spec->cur_adc); spec->cur_adc = new_adc; snd_hda_codec_setup_stream(codec, new_adc, spec->cur_adc_stream_tag, 0, diff -r d960c4971891 pci/hda/patch_realtek.c --- a/pci/hda/patch_realtek.c Thu Feb 28 12:02:56 2008 +0100 +++ b/pci/hda/patch_realtek.c Thu Feb 28 12:46:43 2008 +0100 @@ -2405,8 +2405,8 @@ static int alc880_alt_capture_pcm_cleanu { struct alc_spec *spec = codec->spec;
- snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number + 1], - 0, 0, 0); + snd_hda_codec_cleanup_stream(codec, + spec->adc_nids[substream->number + 1]); return 0; }
diff -r d960c4971891 pci/hda/patch_sigmatel.c --- a/pci/hda/patch_sigmatel.c Thu Feb 28 12:02:56 2008 +0100 +++ b/pci/hda/patch_sigmatel.c Thu Feb 28 12:46:43 2008 +0100 @@ -1891,7 +1891,7 @@ static int stac92xx_capture_pcm_cleanup( { struct sigmatel_spec *spec = codec->spec;
- snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], 0, 0, 0); + snd_hda_codec_cleanup_stream(codec, spec->adc_nids[substream->number]); return 0; }
diff -r d960c4971891 pci/hda/patch_via.c --- a/pci/hda/patch_via.c Thu Feb 28 12:02:56 2008 +0100 +++ b/pci/hda/patch_via.c Thu Feb 28 12:46:43 2008 +0100 @@ -431,8 +431,7 @@ static int via_capture_pcm_cleanup(struc struct snd_pcm_substream *substream) { struct via_spec *spec = codec->spec; - snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], - 0, 0, 0); + snd_hda_codec_cleanup_stream(codec, spec->adc_nids[substream->number]); return 0; }
On Thursday, 28 February 2008 6:43:25 am Takashi Iwai wrote:
The driver code resets the format verb of the relevant widgets at closing streams. This verb contains the sample rate, too. Maybe keeping this would prevent the reset.
The below is a test patch. Give it a try.
Wow, fantastic. I will give this patch a try. I'll have to rebuild my kernel to disable the in-kernel ALSA code and build the ALSA module separately from the latest sources, but if this patch fixes things, that would be worth the effort. I'll get back to you. Thanks.
-Matt
participants (3)
-
Matt Whitlock
-
Pavel Hofman
-
Takashi Iwai