summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Meuser <jakemsr@cvs.openbsd.org>2008-05-25 23:52:31 +0000
committerJacob Meuser <jakemsr@cvs.openbsd.org>2008-05-25 23:52:31 +0000
commitf0cdbe4f7744702991b761684e14a7e861e6663d (patch)
treeefd61d4ecb856c93835f1b0eb19bce1020006351
parent3720c857ec04b612f2d38e4caa9af22b3ec791d5 (diff)
add a function to get default parameters for ac97 codecs. all ac97
codecs support 16-bit stereo slinear_le @ 48kHz. ok ratchov@
-rw-r--r--sys/dev/ic/ac97.c19
-rw-r--r--sys/dev/ic/ac97.h3
2 files changed, 20 insertions, 2 deletions
diff --git a/sys/dev/ic/ac97.c b/sys/dev/ic/ac97.c
index b3633da355f..dfb165e3ee3 100644
--- a/sys/dev/ic/ac97.c
+++ b/sys/dev/ic/ac97.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ac97.c,v 1.67 2008/02/12 13:02:21 jakemsr Exp $ */
+/* $OpenBSD: ac97.c,v 1.68 2008/05/25 23:52:30 jakemsr Exp $ */
/*
* Copyright (c) 1999, 2000 Constantine Sapuntzakis
@@ -70,6 +70,17 @@
#include <dev/audio_if.h>
#include <dev/ic/ac97.h>
+
+/* default parameters; supported by all ac97 codecs */
+const struct audio_params ac97_audio_default = {
+ 48000, /* sample_rate */
+ AUDIO_ENCODING_SLINEAR_LE, /* encoding */
+ 16, /* precision */
+ 2, /* channels */
+ NULL, /* sw_code */
+ 1 /* factor */
+};
+
const struct audio_mixer_enum ac97_on_off = {
2,
{ { { AudioNoff } , 0 },
@@ -583,6 +594,12 @@ int ac97debug = 0;
#define DPRINTFN(n,x)
#endif
+void
+ac97_get_default_params(struct audio_params *params)
+{
+ *params = ac97_audio_default;
+}
+
int
ac97_read(struct ac97_softc *as, u_int8_t reg, u_int16_t *val)
{
diff --git a/sys/dev/ic/ac97.h b/sys/dev/ic/ac97.h
index a84da43c469..3439aa64058 100644
--- a/sys/dev/ic/ac97.h
+++ b/sys/dev/ic/ac97.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ac97.h,v 1.21 2008/02/12 13:02:21 jakemsr Exp $ */
+/* $OpenBSD: ac97.h,v 1.22 2008/05/25 23:52:30 jakemsr Exp $ */
/*
* Copyright (c) 1999 Constantine Sapuntzakis
@@ -81,6 +81,7 @@ struct ac97_codec_if {
int ac97_attach(struct ac97_host_if *);
int ac97_set_rate(struct ac97_codec_if *, int, u_long *);
+void ac97_get_default_params(struct audio_params *);
#define AC97_REG_RESET 0x00
#define AC97_CAPS_MICIN 0x0001