Add a quick check that device actually has sound capabilities. The problem

is that some cards built around fm801 chip have the same device ID, only
have radio tuner onboard, but no sound capabilities. Therefore, with such
card inserted and `device pcm' in kernel the user has a big problem, as
the fm801 driver effectively hangs the machine when trying to initialise
nonexistent ac97 codecs (it does 500 retries with 1 second interval!).
It would be better if MediaForte's engeneers were smart enough to put
different device ID into such cards, but it isn't an option.

MFC after:	2 weeks
This commit is contained in:
Maxim Sobolev 2002-07-30 10:54:19 +00:00
parent 133267776c
commit b047aa218b

View File

@ -223,7 +223,7 @@ fm801_rdcd(kobj_t obj, void *devinfo, int regno)
}
if (i >= TIMO) {
printf("fm801 rdcd: write codec invalid\n");
return 0;
return -1;
}
return fm801_rd(fm801,FM_CODEC_DATA,2);
@ -613,6 +613,13 @@ fm801_pci_attach(device_t dev)
codec = AC97_CREATE(dev, fm801, fm801_ac97);
if (codec == NULL) goto oops;
/*
* XXX: quick check that device actually has sound capabilities.
* The problem is that some cards built around fm801 chip only
* have radio tuner onboard, but no sound capabilities.
*/
if (fm801_rdcd(NULL, fm801, AC97_REG_POWER) == -1) goto oops;
if (mixer_init(dev, ac97_getmixerclass(), codec) == -1) goto oops;
fm801->irqid = 0;