diff options
author | Jacob Meuser <jakemsr@cvs.openbsd.org> | 2009-09-09 02:22:22 +0000 |
---|---|---|
committer | Jacob Meuser <jakemsr@cvs.openbsd.org> | 2009-09-09 02:22:22 +0000 |
commit | 77ec8501d5836a9e96c29df7738bb15d1af714b8 (patch) | |
tree | b0d45e4b91df5903c04830d935c5b28600e8ad2f | |
parent | 59019a52eb95fcb0b7becca9a942cff945ff4862 (diff) |
move code to enable widget unsolicited event generation into it's
own function
-rw-r--r-- | sys/dev/pci/azalia.h | 4 | ||||
-rw-r--r-- | sys/dev/pci/azalia_codec.c | 39 |
2 files changed, 29 insertions, 14 deletions
diff --git a/sys/dev/pci/azalia.h b/sys/dev/pci/azalia.h index 72955435c93..907d1990dfa 100644 --- a/sys/dev/pci/azalia.h +++ b/sys/dev/pci/azalia.h @@ -1,4 +1,4 @@ -/* $OpenBSD: azalia.h,v 1.53 2009/09/09 00:26:57 jakemsr Exp $ */ +/* $OpenBSD: azalia.h,v 1.54 2009/09/09 02:22:21 jakemsr Exp $ */ /* $NetBSD: azalia.h,v 1.6 2006/01/16 14:15:26 kent Exp $ */ /*- @@ -712,3 +712,5 @@ int azalia_unsol_event(codec_t *, int); int azalia_comresp(const codec_t *, nid_t, uint32_t, uint32_t, uint32_t *); int azalia_mixer_get(const codec_t *, nid_t, int, mixer_ctrl_t *); int azalia_mixer_set(codec_t *, nid_t, int, const mixer_ctrl_t *); + +int azalia_codec_enable_unsol(codec_t *); diff --git a/sys/dev/pci/azalia_codec.c b/sys/dev/pci/azalia_codec.c index 402dddcba74..1174a58a060 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.135 2009/09/09 02:13:35 jakemsr Exp $ */ +/* $OpenBSD: azalia_codec.c,v 1.136 2009/09/09 02:22:21 jakemsr Exp $ */ /* $NetBSD: azalia_codec.c,v 1.8 2006/05/10 11:17:27 kent Exp $ */ /*- @@ -1242,7 +1242,6 @@ azalia_mixer_default(codec_t *this) mixer_item_t *m; mixer_ctrl_t mc; int i, j, tgt, cap, err; - uint32_t result; /* unmute all */ for (i = 0; i < this->nmixers; i++) { @@ -1304,17 +1303,6 @@ azalia_mixer_default(codec_t *this) azalia_mixer_set(this, m->nid, m->target, &mc); } - /* turn on jack sense unsolicited responses */ - for (i = 0; i < this->nsense_pins; i++) { - if (this->spkr_muters & (1 << i)) { - azalia_comresp(this, this->sense_pins[i], - CORB_SET_UNSOLICITED_RESPONSE, - CORB_UNSOL_ENABLE | AZ_TAG_SPKR, NULL); - } - } - if (this->spkr_muters != 0) - azalia_unsol_event(this, AZ_TAG_SPKR); - /* get default value for play group master */ for (i = 0; i < this->playvols.nslaves; i++) { if (!(this->playvols.cur & (1 << i))) @@ -1353,6 +1341,31 @@ azalia_mixer_default(codec_t *this) } this->recvols.mute = 0; + err = azalia_codec_enable_unsol(this); + if (err) + return(err); + + return 0; +} + +int +azalia_codec_enable_unsol(codec_t *this) +{ + widget_t *w; + uint32_t result; + int i, err; + + /* jack sense */ + for (i = 0; i < this->nsense_pins; i++) { + if (this->spkr_muters & (1 << i)) { + azalia_comresp(this, this->sense_pins[i], + CORB_SET_UNSOLICITED_RESPONSE, + CORB_UNSOL_ENABLE | AZ_TAG_SPKR, NULL); + } + } + if (this->spkr_muters != 0) + azalia_unsol_event(this, AZ_TAG_SPKR); + /* volume knob */ if (this->playvols.master != this->audiofunc) { |