diff options
author | cg <cg@FreeBSD.org> | 2000-09-05 21:08:01 +0000 |
---|---|---|
committer | cg <cg@FreeBSD.org> | 2000-09-05 21:08:01 +0000 |
commit | 4940b0a8a7927e49d74e750bfb615f72df91cbdf (patch) | |
tree | 14ecc2e14c8365670f744678deed04a1e5435d1c /sys | |
parent | 37e164419194b11b675358a7feb37a9aecdfa806 (diff) | |
download | FreeBSD-src-4940b0a8a7927e49d74e750bfb615f72df91cbdf.zip FreeBSD-src-4940b0a8a7927e49d74e750bfb615f72df91cbdf.tar.gz |
initial support for multiple ac97 codecs
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/sound/pci/ds1.c | 2 | ||||
-rw-r--r-- | sys/dev/sound/pci/neomagic.c | 2 | ||||
-rw-r--r-- | sys/dev/sound/pcm/ac97.c | 38 |
3 files changed, 24 insertions, 18 deletions
diff --git a/sys/dev/sound/pci/ds1.c b/sys/dev/sound/pci/ds1.c index 1d21064..143b5b4 100644 --- a/sys/dev/sound/pci/ds1.c +++ b/sys/dev/sound/pci/ds1.c @@ -325,7 +325,7 @@ ds_initcd(void *devinfo) DELAY(500000); } - return ds_cdbusy(sc, 0); + return ds_cdbusy(sc, 0)? 0 : 1; } static u_int32_t diff --git a/sys/dev/sound/pci/neomagic.c b/sys/dev/sound/pci/neomagic.c index 99eece8..72ae8b8 100644 --- a/sys/dev/sound/pci/neomagic.c +++ b/sys/dev/sound/pci/neomagic.c @@ -255,7 +255,7 @@ nm_initcd(void *devinfo) nm_wr(sc, 0x6cc, 0x87, 1); nm_wr(sc, 0x6cc, 0x80, 1); nm_wr(sc, 0x6cc, 0x00, 1); - return 0; + return 1; } static u_int32_t diff --git a/sys/dev/sound/pcm/ac97.c b/sys/dev/sound/pcm/ac97.c index 296e800..8fe3662 100644 --- a/sys/dev/sound/pcm/ac97.c +++ b/sys/dev/sound/pcm/ac97.c @@ -45,9 +45,9 @@ struct ac97_info { ac97_read *read; ac97_write *write; void *devinfo; - char id[4]; + char *name; char rev; - unsigned caps, se, extcaps, extid, extstat, noext:1; + unsigned count, caps, se, extcaps, extid, extstat, noext:1; struct ac97mixtable_entry mix[32]; }; @@ -82,13 +82,13 @@ static const unsigned ac97recdevs = static struct ac97_codecid ac97codecid[] = { { 0x414b4d00, 1, "Asahi Kasei AK4540 rev 0" }, + { 0x414b4d01, 1, "Asahi Kasei AK4540 rev 1" }, { 0x43525900, 0, "Cirrus Logic CS4297" }, { 0x83847600, 0, "SigmaTel STAC????" }, { 0x83847604, 0, "SigmaTel STAC9701/3/4/5" }, { 0x83847605, 0, "SigmaTel STAC9704" }, { 0x83847608, 0, "SigmaTel STAC9708" }, { 0x83847609, 0, "SigmaTel STAC9721" }, - { 0x414b4d01, 1, "Asahi Kasei AK4540 rev 1" }, { 0, 0, NULL } }; @@ -300,11 +300,13 @@ ac97_initmixer(struct ac97_info *codec) codec->mix[i] = ac97mixtable_default[i]; if (codec->init) { - if (codec->init(codec->devinfo)) { + codec->count = codec->init(codec->devinfo); + if (codec->count == 0) { device_printf(codec->dev, "ac97 codec init failed\n"); return ENODEV; } - } + } else + codec->count = 1; wrcd(codec, AC97_REG_POWER, 0); wrcd(codec, AC97_REG_RESET, 0); DELAY(100000); @@ -320,19 +322,24 @@ ac97_initmixer(struct ac97_info *codec) return ENODEV; } - for (i = 0; ac97codecid[i].id; i++) - if (ac97codecid[i].id == id) - codec->noext = 1; + codec->noext = 0; + codec->name = NULL; + for (i = 0; ac97codecid[i].id; i++) { + if (ac97codecid[i].id == id) { + codec->name = ac97codecid[i].name; + codec->noext = ac97codecid[i].noext; + } + } - if (!codec->noext) { + if (codec->noext) { + codec->extcaps = 0; + codec->extid = 0; + codec->extstat = 0; + } else { i = rdcd(codec, AC97_REGEXT_ID); codec->extcaps = i & 0x3fff; codec->extid = (i & 0xc000) >> 14; codec->extstat = rdcd(codec, AC97_REGEXT_STAT) & AC97_EXTCAPS; - } else { - codec->extcaps = 0; - codec->extid = 0; - codec->extstat = 0; } wrcd(codec, AC97_MIX_MASTER, 0x20); @@ -342,9 +349,8 @@ ac97_initmixer(struct ac97_info *codec) if (bootverbose) { 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); + if (codec->name) + printf(" (%s)", codec->name); printf("\n"); device_printf(codec->dev, "ac97 codec features "); for (i = j = 0; i < 10; i++) |