summaryrefslogtreecommitdiffstats
path: root/sys/dev/sound/pcm/ac97.c
diff options
context:
space:
mode:
authorcg <cg@FreeBSD.org>2001-06-23 17:32:40 +0000
committercg <cg@FreeBSD.org>2001-06-23 17:32:40 +0000
commit20fbfefbf3afd4f0cf079a012abce21cab3907cc (patch)
treeae89b112d4ff400641011dbe46e38585b4d27b66 /sys/dev/sound/pcm/ac97.c
parentf8e11dde2671e192fa12edbf3487f63e8e0ade6e (diff)
downloadFreeBSD-src-20fbfefbf3afd4f0cf079a012abce21cab3907cc.zip
FreeBSD-src-20fbfefbf3afd4f0cf079a012abce21cab3907cc.tar.gz
move a private struct definition from ac97.h to ac97.c
add proper handling of cards which take eapd=1 to mean 'produce sound' instead of 'external amplifier power down'
Diffstat (limited to 'sys/dev/sound/pcm/ac97.c')
-rw-r--r--sys/dev/sound/pcm/ac97.c32
1 files changed, 29 insertions, 3 deletions
diff --git a/sys/dev/sound/pcm/ac97.c b/sys/dev/sound/pcm/ac97.c
index 72214e6..5e07fe2 100644
--- a/sys/dev/sound/pcm/ac97.c
+++ b/sys/dev/sound/pcm/ac97.c
@@ -33,6 +33,17 @@
MALLOC_DEFINE(M_AC97, "ac97", "ac97 codec");
+struct ac97mixtable_entry {
+ int reg:8;
+ unsigned bits:4;
+ unsigned ofs:4;
+ unsigned stereo:1;
+ unsigned mute:1;
+ unsigned recidx:4;
+ unsigned mask:1;
+ unsigned enable:1;
+};
+
#define AC97_NAMELEN 16
struct ac97_info {
kobj_t methods;
@@ -41,6 +52,7 @@ struct ac97_info {
char *id;
char rev;
unsigned count, caps, se, extcaps, extid, extstat, noext:1;
+ u_int32_t flags;
struct ac97mixtable_entry mix[32];
char name[AC97_NAMELEN];
void *lock;
@@ -350,10 +362,10 @@ ac97_initmixer(struct ac97_info *codec)
return ENODEV;
}
- wrcd(codec, AC97_REG_POWER, 0x8000);
+ wrcd(codec, AC97_REG_POWER, (codec->flags & AC97_F_EAPD_INV)? 0x8000 : 0x0000);
wrcd(codec, AC97_REG_RESET, 0);
DELAY(100000);
- wrcd(codec, AC97_REG_POWER, 0x8000);
+ wrcd(codec, AC97_REG_POWER, (codec->flags & AC97_F_EAPD_INV)? 0x8000 : 0x0000);
i = rdcd(codec, AC97_REG_RESET);
codec->caps = i & 0x03ff;
@@ -445,9 +457,10 @@ ac97_reinitmixer(struct ac97_info *codec)
return ENODEV;
}
- wrcd(codec, AC97_REG_POWER, 0);
+ wrcd(codec, AC97_REG_POWER, (codec->flags & AC97_F_EAPD_INV)? 0x8000 : 0x0000);
wrcd(codec, AC97_REG_RESET, 0);
DELAY(100000);
+ wrcd(codec, AC97_REG_POWER, (codec->flags & AC97_F_EAPD_INV)? 0x8000 : 0x0000);
i = rdcd(codec, AC97_REG_RESET);
if (!codec->noext) {
@@ -484,6 +497,7 @@ ac97_create(device_t dev, void *devinfo, kobj_class_t cls)
codec->dev = dev;
codec->devinfo = devinfo;
+ codec->flags = 0;
return codec;
}
@@ -497,6 +511,18 @@ ac97_destroy(struct ac97_info *codec)
free(codec, M_AC97);
}
+void
+ac97_setflags(struct ac97_info *codec, u_int32_t val)
+{
+ codec->flags = val;
+}
+
+u_int32_t
+ac97_getflags(struct ac97_info *codec)
+{
+ return codec->flags;
+}
+
/* -------------------------------------------------------------------- */
static int
OpenPOWER on IntegriCloud