Subject: Re: AC97 patch for ICH5 (native mode) & AD1985 codec
To: TAMURA Kent <kent@netbsd.org>
From: Lars Heidieker <lars@heidieker.de>
List: current-users
Date: 11/22/2003 10:32:06
On Saturday 22 November 2003 09:58, TAMURA Kent wrote:
> > *** ic/ac97.c   28 Sep 2003 22:24:09 -0000      1.49
> > --- ic/ac97.c   20 Nov 2003 09:13:37 -0000
> > ***************
> > *** 901,906 ****
> > --- 901,908 ----
> >         if (host_if->flags)
> >                 as->host_flags = host_if->flags(host_if->arg);
> >
> > +       ac97_read(as, AC97_REG_RESET, &id1);
> > +
> >         ac97_setup_defaults(as);
> >         ac97_read(as, AC97_REG_VENDOR_ID1, &id1);
> >         ac97_read(as, AC97_REG_VENDOR_ID2, &id2);
>
> This change seems meaningless.  Do you have the expected
> behavior by inserting DELAY() instead of reading AC97_REG_RESET?

No.
If I use a DELAY(1000) or DELAY(10000) which should be enough time for the codec, I get a wrong id1.

auich0 at pci0 dev 31 function 5: i82801EB (ICH5) AC-97 Audio
auich0: interrupting at irq 3
auich0: The 3rd codec is ready.
auich0: ac97: unknown (0xffff5375) codec; headphone, 20 bit DAC, no 3D stereo
auich0: ac97: ext id 3c7<AMAP,LDAC,SDAC,CDAC,SPDIF,DRA,VRA>

reading the AC97_REG_RESET register results in the correct id1

auich0 at pci0 dev 31 function 5: i82801EB (ICH5) AC-97 Audio
auich0: interrupting at irq 3
auich0: The 3rd codec is ready.
auich0: ac97: Analog Devices AD1985 codec; headphone, 20 bit DAC, no 3D stereo
auich0: ac97: ext id 3c7<AMAP,LDAC,SDAC,CDAC,SPDIF,DRA,VRA>

actually the reading from AC97_REG_RESET gives information about the codecs capabilities,
so reordering the AC97_REG_RESET read before reading the ids does work.
(Reading the AC97_REG_RESET twice was indeed not very clever)

        if (host_if->flags)
                as->host_flags = host_if->flags(host_if->arg);

        ac97_setup_defaults(as);
        ac97_read(as, AC97_REG_RESET, &as->caps);
        ac97_read(as, AC97_REG_VENDOR_ID1, &id1);
        ac97_read(as, AC97_REG_VENDOR_ID2, &id2);

Lars