diff options
author | sobomax <sobomax@FreeBSD.org> | 2002-07-30 10:54:19 +0000 |
---|---|---|
committer | sobomax <sobomax@FreeBSD.org> | 2002-07-30 10:54:19 +0000 |
commit | b063d986287423b86eae8ecfb37feb396f94c346 (patch) | |
tree | d1b96c1400edd415a50a468b7cbdd217a759e3cc /sys/dev | |
parent | bc06c086d90619821468298585e079c8e4bb00d8 (diff) | |
download | FreeBSD-src-b063d986287423b86eae8ecfb37feb396f94c346.zip FreeBSD-src-b063d986287423b86eae8ecfb37feb396f94c346.tar.gz |
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
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/sound/pci/fm801.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/dev/sound/pci/fm801.c b/sys/dev/sound/pci/fm801.c index 639200a..1293687 100644 --- a/sys/dev/sound/pci/fm801.c +++ b/sys/dev/sound/pci/fm801.c @@ -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; |