From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ron Cococcia Subject: Re: intel8x0 dual codec issue Date: Thu, 10 Feb 2005 14:16:12 -0500 Message-ID: <420BB2FC.6070502@request.com> References: <4208437B.3080207@request.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit In-Reply-To: Sender: alsa-devel-admin@lists.sourceforge.net Errors-To: alsa-devel-admin@lists.sourceforge.net List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , List-Archive: To: Takashi Iwai Cc: alsa-devel@lists.sourceforge.net List-Id: alsa-devel@alsa-project.org I had been looking through that block of code, and had made some of my own "tweaks". What I did was make "reg_ok" an array (size 4, all initialized to 0). I used the codec index (cidx) to index into that array. The idea is that there would be a reg_ok for each codec, instead of just 1 for all codecs. This correctly set the output on all codecs after making the change. Unfortunately, I was still noticing some audio distortions on the secondary codec. Originally, some tones would sound "tinny". After the change, the tinny sound went away, but I could hear distinct "clicks" in the audio. What causes this is unknown to me, but I thought it might be some kind of problem where both codecs are producing some information (maybe interrupts) and causing some weirdness with loading the data. If I knew more about what was going on I would have looked into this more, but I am still just an novice driver "tweaker". On a hunch, I figured that if the primary codec was doing something weird, I might need to make it "forget" about the primary codec. I went into intel8x0.c, and started to take a look, and was able to add a quick test hack. If the number of codecs detected in snd_intel8x0_mixer was 2, set it to 1. In snd_intel8x0_codec_{read/write/read_test}, it would add 1 to ac97->num, so it would access the secondary codecs values and skip the primary. After compiling and installing, alsamixer only knows of 1 codec (CS4299), and the audio playback appears to be greatly improved with no clicks or tinny sounds. For now, I will be leaving my hack in, unless there is a better fix available. A few hours after getting it working, I managed to hose my development setup anyway, so it will be a little while before I can play around again. Thanks, Ron Takashi Iwai wrote: > At Mon, 07 Feb 2005 23:43:39 -0500, > Ron Cococcia wrote: > >>Hello, >> >>I'm having a little trouble with a dual codec setup that I am using. >>The motherboard has an Intel 815 chip (82801BAICH2). The motherboard >>has the primary (00) codec, which is an AD1885. A secondary (01) codec >>has been added over a CNR connector. This one is a CS4299. The >>secondary codec uses the timing values generated by the primary. >> >>I had been hearing some distortion in the audio. It was quite >>noticeable. Using a wav file of sine waves that has different >>frequencies (440, 880, 1760, 3520) at 44100Hz, I could see that there >>was some jitter on a scope. As the frequencies went up, it got worse. >>I then created another test file with the same frequencies, but sampled >>at 48000Hz. Playback of that audio was extremely clean on the scope. >> >>Looking into it more, I noticed that the PCM front DAC (ac97#1-1) was >>not adjusting itself to the appropriate frequency. The DAC on the >>primary codec was switching between 44100Hz and 48000Hz when I played >>the different samples. >> >>I'd like to have the secondary codec reflect the output rate that is >>being sent to it. How might I get it to do this? Is it a bug (should >>the codec front DAC on the secondary codec reflect the appropriate >>frequency?), or how is it intended to work? > > > I guess it's a bug. Could you try the attached patch? > > > Takashi > > > ------------------------------------------------------------------------ > > Index: alsa-kernel/pci/ac97/ac97_pcm.c > =================================================================== > RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/pci/ac97/ac97_pcm.c,v > retrieving revision 1.19 > diff -u -r1.19 ac97_pcm.c > --- alsa-kernel/pci/ac97/ac97_pcm.c 27 Dec 2004 13:19:32 -0000 1.19 > +++ alsa-kernel/pci/ac97/ac97_pcm.c 10 Feb 2005 17:19:45 -0000 > @@ -602,8 +602,10 @@ > snd_printk(KERN_ERR "invalid AC97 slot %i?\n", i); > continue; > } > +#if 0 > if (reg_ok & (1 << (reg - AC97_PCM_FRONT_DAC_RATE))) > continue; > +#endif > //printk(KERN_DEBUG "setting ac97 reg 0x%x to rate %d\n", reg, rate); > err = snd_ac97_set_rate(pcm->r[r].codec[cidx], reg, rate); > if (err < 0) ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click