summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Meuser <jakemsr@cvs.openbsd.org>2009-01-02 22:32:26 +0000
committerJacob Meuser <jakemsr@cvs.openbsd.org>2009-01-02 22:32:26 +0000
commitb845c006faaee044b45b2935b605066c47c01c64 (patch)
treefecf02c62e6d0173fd53378bf6df6772d313eed4
parent17954f4a461105ea0d92e1e96c1157de4308afe4 (diff)
- get rid of the function that was mostly just a wrapper for the old
function for creating "master" volume control. - apply gpio quirks separately from and prior to configuring the mixer. gpio manipulation can cause noise on output channels. configuring gpio before amps are unmuted in the mixer configuration is a good thing. from Alexey Suslikov, thanks
-rw-r--r--sys/dev/pci/azalia.c6
-rw-r--r--sys/dev/pci/azalia.h4
-rw-r--r--sys/dev/pci/azalia_codec.c27
3 files changed, 15 insertions, 22 deletions
diff --git a/sys/dev/pci/azalia.c b/sys/dev/pci/azalia.c
index 62b90982789..15c5abfb40f 100644
--- a/sys/dev/pci/azalia.c
+++ b/sys/dev/pci/azalia.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: azalia.c,v 1.106 2009/01/02 20:18:18 jakemsr Exp $ */
+/* $OpenBSD: azalia.c,v 1.107 2009/01/02 22:32:25 jakemsr Exp $ */
/* $NetBSD: azalia.c,v 1.20 2006/05/07 08:31:44 kent Exp $ */
/*-
@@ -1311,6 +1311,10 @@ azalia_codec_init(codec_t *this)
if (err)
return err;
+ err = azalia_codec_gpio_quirks(this);
+ if (err)
+ return err;
+
err = this->mixer_init(this);
if (err)
return err;
diff --git a/sys/dev/pci/azalia.h b/sys/dev/pci/azalia.h
index 4b816774fa8..bc4036f2498 100644
--- a/sys/dev/pci/azalia.h
+++ b/sys/dev/pci/azalia.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: azalia.h,v 1.35 2009/01/02 20:37:57 jakemsr Exp $ */
+/* $OpenBSD: azalia.h,v 1.36 2009/01/02 22:32:25 jakemsr Exp $ */
/* $NetBSD: azalia.h,v 1.6 2006/01/16 14:15:26 kent Exp $ */
/*-
@@ -662,7 +662,7 @@ typedef struct codec_t {
u_int rate;
} codec_t;
-
int azalia_codec_init_vtbl(codec_t *);
int azalia_codec_construct_format(codec_t *, int, int);
int azalia_widget_enabled(const codec_t *, nid_t);
+int azalia_codec_gpio_quirks(codec_t *);
diff --git a/sys/dev/pci/azalia_codec.c b/sys/dev/pci/azalia_codec.c
index 56227286b0e..10c5d38cfc2 100644
--- a/sys/dev/pci/azalia_codec.c
+++ b/sys/dev/pci/azalia_codec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: azalia_codec.c,v 1.105 2009/01/02 20:37:57 jakemsr Exp $ */
+/* $OpenBSD: azalia_codec.c,v 1.106 2009/01/02 22:32:25 jakemsr Exp $ */
/* $NetBSD: azalia_codec.c,v 1.8 2006/05/10 11:17:27 kent Exp $ */
/*-
@@ -72,7 +72,6 @@ int azalia_generic_codec_add_convgroup(codec_t *, convgroupset_t *,
int azalia_generic_unsol(codec_t *, int);
int azalia_generic_mixer_init(codec_t *);
-int azalia_generic_mixer_autoinit(codec_t *);
int azalia_generic_mixer_fix_indexes(codec_t *);
int azalia_generic_mixer_default(codec_t *);
int azalia_generic_mixer_delete(codec_t *);
@@ -89,7 +88,6 @@ int azalia_generic_get_port(codec_t *, mixer_ctrl_t *);
void azalia_devinfo_offon(mixer_devinfo_t *);
void azalia_pin_config_ov(widget_t *, int, int);
int azalia_gpio_unmute(codec_t *, int);
-int azalia_codec_gpio_quirks(codec_t *);
int azalia_ad1984_mixer_init(codec_t *);
int azalia_alc88x_init_widget(const codec_t *, widget_t *, nid_t);
@@ -104,7 +102,7 @@ azalia_codec_init_vtbl(codec_t *this)
*/
this->name = NULL;
this->init_dacgroup = azalia_generic_codec_init_dacgroup;
- this->mixer_init = azalia_generic_mixer_autoinit;
+ this->mixer_init = azalia_generic_mixer_init;
this->mixer_delete = azalia_generic_mixer_delete;
this->set_port = azalia_generic_set_port;
this->get_port = azalia_generic_get_port;
@@ -1162,21 +1160,12 @@ azalia_generic_mixer_default(codec_t *this)
}
int
-azalia_generic_mixer_autoinit(codec_t *this)
-{
- azalia_generic_mixer_init(this);
- azalia_codec_gpio_quirks(this);
-
- return 0;
-}
-
-int
azalia_generic_mixer_delete(codec_t *this)
{
- if (this->mixers == NULL)
- return 0;
- free(this->mixers, M_DEVBUF);
- this->mixers = NULL;
+ if (this->mixers != NULL) {
+ free(this->mixers, M_DEVBUF);
+ this->mixers = NULL;
+ }
return 0;
}
@@ -2091,7 +2080,7 @@ azalia_ad1984_mixer_init(codec_t *this)
{
mixer_ctrl_t mc;
- azalia_generic_mixer_autoinit(this);
+ azalia_generic_mixer_init(this);
mc.dev = -1;
mc.type = AUDIO_MIXER_ENUM;
@@ -2149,7 +2138,7 @@ azalia_stac7661_mixer_init(codec_t *this)
{
mixer_ctrl_t mc;
- azalia_generic_mixer_autoinit(this);
+ azalia_generic_mixer_init(this);
mc.dev = -1;
mc.type = AUDIO_MIXER_ENUM;