summaryrefslogtreecommitdiffstats
path: root/sys/dev/sound/pcm/ac97.c
diff options
context:
space:
mode:
authorcg <cg@FreeBSD.org>2000-04-01 22:24:03 +0000
committercg <cg@FreeBSD.org>2000-04-01 22:24:03 +0000
commita3c065ea56199480229fabf9848000c6be8ce2d9 (patch)
tree1a0c857b5ff57f71804e91ab4b0bb5105cd499d1 /sys/dev/sound/pcm/ac97.c
parent5bcbc0e18f73a09f1d42126e5f6baa130f605ec9 (diff)
downloadFreeBSD-src-a3c065ea56199480229fabf9848000c6be8ce2d9.zip
FreeBSD-src-a3c065ea56199480229fabf9848000c6be8ce2d9.tar.gz
fail in attach if we seem to have no ac97 codec
Diffstat (limited to 'sys/dev/sound/pcm/ac97.c')
-rw-r--r--sys/dev/sound/pcm/ac97.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/dev/sound/pcm/ac97.c b/sys/dev/sound/pcm/ac97.c
index 757efca..a8a3a11 100644
--- a/sys/dev/sound/pcm/ac97.c
+++ b/sys/dev/sound/pcm/ac97.c
@@ -303,7 +303,7 @@ ac97_initmixer(struct ac97_info *codec)
codec->init(codec->devinfo);
wrcd(codec, AC97_REG_POWER, 0);
wrcd(codec, AC97_REG_RESET, 0);
- DELAY(10000);
+ DELAY(100000);
i = rdcd(codec, AC97_REG_RESET);
codec->caps = i & 0x03ff;
@@ -311,6 +311,10 @@ ac97_initmixer(struct ac97_info *codec)
id = (rdcd(codec, AC97_REG_ID1) << 16) | rdcd(codec, AC97_REG_ID2);
codec->rev = id & 0x000000ff;
+ if (id == 0 || id == 0xffffffff) {
+ device_printf(codec->dev, "ac97 codec invalid or not present (id == %x)\n", id);
+ return ENODEV;
+ }
for (i = 0; ac97codecid[i].id; i++)
if (ac97codecid[i].id == id)
@@ -333,7 +337,7 @@ ac97_initmixer(struct ac97_info *codec)
wrcd(codec, AC97_MIX_MASTER, 0x00);
if (bootverbose) {
- device_printf(codec->dev, "ac97 codec id 0x%8x", id);
+ device_printf(codec->dev, "ac97 codec id 0x%08x", id);
for (i = 0; ac97codecid[i].id; i++)
if (ac97codecid[i].id == id)
printf(" (%s)", ac97codecid[i].name);
@@ -384,7 +388,8 @@ ac97mix_init(snd_mixer *m)
struct ac97_info *codec = mix_getdevinfo(m);
if (codec == NULL)
return -1;
- ac97_initmixer(codec);
+ if (ac97_initmixer(codec))
+ return -1;
mix_setdevs(m, ac97mixdevs | ((codec->caps & 4)? SOUND_MASK_BASS | SOUND_MASK_TREBLE : 0));
mix_setrecdevs(m, ac97recdevs);
return 0;
OpenPOWER on IntegriCloud