Dominique Dumont domi.dumont@free.fr writes:
I've included the patch which implement the behavior described above.
Looks like the attachment was ditched by mailman. Here it is ...
--- alsa-driver-1.0.14rc3-old/alsa-kernel/pci/hda/hda_intel.c 2007-03-06 13:26:32.000000000 +0100 +++ alsa-driver-1.0.14rc3/alsa-kernel/pci/hda/hda_intel.c 2007-04-03 19:21:34.000000000 +0200 @@ -1140,6 +1140,8 @@ struct azx_dev *azx_dev = get_azx_dev(substream); struct hda_pcm_stream *hinfo = apcm->hinfo[substream->stream]; struct snd_pcm_runtime *runtime = substream->runtime; + int val ; + int ret ;
azx_dev->bufsize = snd_pcm_lib_buffer_bytes(substream); azx_dev->fragsize = snd_pcm_lib_period_bytes(substream); @@ -1148,12 +1150,22 @@ runtime->channels, runtime->format, hinfo->maxbps); + + + if (! azx_dev->format_val) { snd_printk(KERN_ERR SFX "invalid format_val, rate=%d, ch=%d, format=%d\n", runtime->rate, runtime->channels, runtime->format); return -EINVAL; }
+ /* azx_dev->format_val |= 0x800 ; */ + + /* Switch off iec958 before changing stream format as the digi + converter may misbehave */ + val = apcm->codec->spdif_ctls ; + snd_hda_codec_write(apcm->codec, hinfo->nid, 0, AC_VERB_SET_DIGI_CONVERT_1, val & 0xfe); + snd_printdd("azx_pcm_prepare: bufsize=0x%x, fragsize=0x%x, format=0x%x\n", azx_dev->bufsize, azx_dev->fragsize, azx_dev->format_val); azx_setup_periods(azx_dev); @@ -1163,8 +1175,12 @@ else azx_dev->fifo_size = 0;
- return hinfo->ops.prepare(hinfo, apcm->codec, azx_dev->stream_tag, + ret = hinfo->ops.prepare(hinfo, apcm->codec, azx_dev->stream_tag, azx_dev->format_val, substream); + + /* Restore iec958 switch after all stream and converter are set */ + snd_hda_codec_write(apcm->codec, hinfo->nid, 0, AC_VERB_SET_DIGI_CONVERT_1, val & 0xff); + return ret ; }
static int azx_pcm_trigger(struct snd_pcm_substream *substream, int cmd)