diff options
author | Jacob Meuser <jakemsr@cvs.openbsd.org> | 2009-05-31 02:57:52 +0000 |
---|---|---|
committer | Jacob Meuser <jakemsr@cvs.openbsd.org> | 2009-05-31 02:57:52 +0000 |
commit | b7aba38b6b06fac64b2b610ad953c111b5d684d2 (patch) | |
tree | 75e726bcb5093da2109e1634fa97a2fb59c99126 | |
parent | 6d36489723e16575a03179284cfe0f375033894a (diff) |
- all codecs now use the same functions, always. call the functions
directly instead of through pointers in the codec_t.
- fold azalia_generic_{g,s}et_port into azalia_{g,s}et_port since both
are small and partly duplicated eachother.
-rw-r--r-- | sys/dev/pci/azalia.c | 140 | ||||
-rw-r--r-- | sys/dev/pci/azalia.h | 16 | ||||
-rw-r--r-- | sys/dev/pci/azalia_codec.c | 182 |
3 files changed, 154 insertions, 184 deletions
diff --git a/sys/dev/pci/azalia.c b/sys/dev/pci/azalia.c index 148b3f93b9e..8c1b7a6516b 100644 --- a/sys/dev/pci/azalia.c +++ b/sys/dev/pci/azalia.c @@ -1,4 +1,4 @@ -/* $OpenBSD: azalia.c,v 1.135 2009/05/29 21:16:37 jakemsr Exp $ */ +/* $OpenBSD: azalia.c,v 1.136 2009/05/31 02:57:51 jakemsr Exp $ */ /* $NetBSD: azalia.c,v 1.20 2006/05/07 08:31:44 kent Exp $ */ /*- @@ -200,8 +200,6 @@ int azalia_codec_init(codec_t *); int azalia_codec_delete(codec_t *); void azalia_codec_add_bits(codec_t *, int, uint32_t, int); void azalia_codec_add_format(codec_t *, int, int, uint32_t, int32_t); -int azalia_codec_comresp(const codec_t *, nid_t, uint32_t, - uint32_t, uint32_t *); int azalia_codec_connect_stream(codec_t *, int, uint16_t, int); int azalia_codec_disconnect_stream(codec_t *, int); void azalia_codec_print_audiofunc(const codec_t *); @@ -719,7 +717,7 @@ azalia_attach_intr(struct device *self) if (i != az->codecno) { if (codec->audiofunc < 0) continue; - codec->comresp(codec, codec->audiofunc, + azalia_comresp(codec, codec->audiofunc, CORB_SET_POWER_STATE, CORB_PS_D3, NULL); DELAY(100); azalia_codec_delete(codec); @@ -1063,8 +1061,7 @@ azalia_rirb_kick_unsol_events(azalia_t *az) DPRINTF(("%s: codec#=%d tag=%d\n", __func__, i, tag)); az->unsolq_rp++; az->unsolq_rp %= UNSOLQ_SIZE; - if (codec->unsol_event != NULL) - codec->unsol_event(codec, tag); + azalia_unsol_event(codec, tag); } az->unsolq_kick = FALSE; } @@ -1163,14 +1160,13 @@ azalia_codec_init(codec_t *this) uint32_t rev, id, result; int err, addr, n, i; - this->comresp = azalia_codec_comresp; addr = this->address; /* codec vendor/device/revision */ - err = this->comresp(this, CORB_NID_ROOT, CORB_GET_PARAMETER, + err = azalia_comresp(this, CORB_NID_ROOT, CORB_GET_PARAMETER, COP_REVISION_ID, &rev); if (err) return err; - err = this->comresp(this, CORB_NID_ROOT, CORB_GET_PARAMETER, + err = azalia_comresp(this, CORB_NID_ROOT, CORB_GET_PARAMETER, COP_VENDOR_ID, &id); if (err) return err; @@ -1184,7 +1180,7 @@ azalia_codec_init(codec_t *this) COP_RID_MAJ(rev), COP_RID_MIN(rev))); /* identify function nodes */ - err = this->comresp(this, CORB_NID_ROOT, CORB_GET_PARAMETER, + err = azalia_comresp(this, CORB_NID_ROOT, CORB_GET_PARAMETER, COP_SUBORDINATE_NODE_COUNT, &result); if (err) return err; @@ -1200,7 +1196,7 @@ azalia_codec_init(codec_t *this) XNAME(this->az), n, this->nfunctions)); this->audiofunc = -1; for (i = 0; i < this->nfunctions; i++) { - err = this->comresp(this, n + i, CORB_GET_PARAMETER, + err = azalia_comresp(this, n + i, CORB_GET_PARAMETER, COP_FUNCTION_GROUP_TYPE, &result); if (err) continue; @@ -1213,20 +1209,20 @@ azalia_codec_init(codec_t *this) if (this->audiofunc < 0) { DPRINTF(("%s: codec[%d]: No audio function groups\n", XNAME(this->az), addr)); - this->comresp(this, this->audiofunc, CORB_SET_POWER_STATE, + azalia_comresp(this, this->audiofunc, CORB_SET_POWER_STATE, CORB_PS_D3, &result); DELAY(100); return -1; } /* power the audio function */ - this->comresp(this, this->audiofunc, CORB_SET_POWER_STATE, + azalia_comresp(this, this->audiofunc, CORB_SET_POWER_STATE, CORB_PS_D0, &result); DELAY(100); /* check widgets in the audio function */ - err = this->comresp(this, this->audiofunc, - CORB_GET_PARAMETER, COP_SUBORDINATE_NODE_COUNT, &result); + err = azalia_comresp(this, this->audiofunc, CORB_GET_PARAMETER, + COP_SUBORDINATE_NODE_COUNT, &result); if (err) return err; DPRINTF(("%s: There are %d widgets in the audio function.\n", @@ -1244,16 +1240,16 @@ azalia_codec_init(codec_t *this) } /* query the base parameters */ - this->comresp(this, this->audiofunc, CORB_GET_PARAMETER, + azalia_comresp(this, this->audiofunc, CORB_GET_PARAMETER, COP_STREAM_FORMATS, &result); this->w[this->audiofunc].d.audio.encodings = result; - this->comresp(this, this->audiofunc, CORB_GET_PARAMETER, + azalia_comresp(this, this->audiofunc, CORB_GET_PARAMETER, COP_PCM, &result); this->w[this->audiofunc].d.audio.bits_rates = result; - this->comresp(this, this->audiofunc, CORB_GET_PARAMETER, + azalia_comresp(this, this->audiofunc, CORB_GET_PARAMETER, COP_INPUT_AMPCAP, &result); this->w[this->audiofunc].inamp_cap = result; - this->comresp(this, this->audiofunc, CORB_GET_PARAMETER, + azalia_comresp(this, this->audiofunc, CORB_GET_PARAMETER, COP_OUTPUT_AMPCAP, &result); this->w[this->audiofunc].outamp_cap = result; @@ -1338,7 +1334,7 @@ azalia_codec_init(codec_t *this) !(this->w[i].d.pin.cap & COP_PINCAP_PRESENCE)) break; /* check override bit */ - err = this->comresp(this, i, + err = azalia_comresp(this, i, CORB_GET_CONFIGURATION_DEFAULT, 0, &result); if (err) break; @@ -1381,7 +1377,7 @@ azalia_codec_init(codec_t *this) if (err) return err; - err = this->init_dacgroup(this); + err = azalia_init_dacgroup(this); if (err) return err; @@ -1405,7 +1401,7 @@ azalia_codec_init(codec_t *this) return err; } - err = this->mixer_init(this); + err = azalia_mixer_init(this); if (err) return err; @@ -1485,7 +1481,7 @@ azalia_codec_select_micadc(codec_t *this) } if (i >= w->nconnections) return(-1); - err = this->comresp(this, w->nid, + err = azalia_comresp(this, w->nid, CORB_SET_CONNECTION_SELECT_CONTROL, i, 0); if (err) return(err); @@ -1772,7 +1768,7 @@ azalia_codec_select_dacs(codec_t *this) break; } if (j < w->nconnections && conv != -1) { - err = this->comresp(this, w->nid, + err = azalia_comresp(this, w->nid, CORB_SET_CONNECTION_SELECT_CONTROL, j, 0); if (err) return(err); @@ -1855,7 +1851,7 @@ azalia_codec_select_spkrdac(codec_t *this) } } if (conn != -1) { - err = this->comresp(this, w->nid, + err = azalia_comresp(this, w->nid, CORB_SET_CONNECTION_SELECT_CONTROL, conn, 0); if (err) return(err); @@ -2030,7 +2026,7 @@ azalia_codec_init_volgroups(codec_t *this) if (w->type == COP_AWTYPE_BEEP_GENERATOR) { continue; } else if (w->type == COP_AWTYPE_PIN_COMPLEX) { - err = this->comresp(this, w->nid, + err = azalia_comresp(this, w->nid, CORB_GET_PIN_WIDGET_CONTROL, 0, &result); if (!err && (result & CORB_PWC_OUTPUT)) this->playvols.cur |= (1 << i); @@ -2054,7 +2050,7 @@ azalia_codec_init_volgroups(codec_t *this) if (w->type == COP_AWTYPE_BEEP_GENERATOR) continue; if (w->type == COP_AWTYPE_PIN_COMPLEX) { - err = this->comresp(this, w->nid, + err = azalia_comresp(this, w->nid, CORB_GET_PIN_WIDGET_CONTROL, 0, &result); if (!err && (result & CORB_PWC_OUTPUT)) this->playvols.cur |= (1 << i); @@ -2121,7 +2117,7 @@ azalia_codec_init_volgroups(codec_t *this) continue; if ((cap & COP_AMPCAP_MUTE) && COP_AMPCAP_NUMSTEPS(cap)) { if (w->type == COP_AWTYPE_PIN_COMPLEX) { - err = this->comresp(this, w->nid, + err = azalia_comresp(this, w->nid, CORB_GET_PIN_WIDGET_CONTROL, 0, &result); if (!err && !(result & CORB_PWC_OUTPUT)) this->recvols.cur |= (1 << i); @@ -2140,7 +2136,7 @@ azalia_codec_init_volgroups(codec_t *this) if (w->mixer_class != AZ_CLASS_RECORD) continue; if (w->type == COP_AWTYPE_PIN_COMPLEX) { - err = this->comresp(this, w->nid, + err = azalia_comresp(this, w->nid, CORB_GET_PIN_WIDGET_CONTROL, 0, &result); if (!err && !(result & CORB_PWC_OUTPUT)) this->recvols.cur |= (1 << i); @@ -2158,8 +2154,7 @@ azalia_codec_init_volgroups(codec_t *this) int azalia_codec_delete(codec_t *this) { - if (this->mixer_delete != NULL) - this->mixer_delete(this); + azalia_mixer_delete(this); if (this->formats != NULL) { free(this->formats, M_DEVBUF); @@ -2382,7 +2377,7 @@ azalia_codec_add_format(codec_t *this, int chan, int prec, uint32_t rates, } int -azalia_codec_comresp(const codec_t *codec, nid_t nid, uint32_t control, +azalia_comresp(const codec_t *codec, nid_t nid, uint32_t control, uint32_t param, uint32_t* result) { int err, s; @@ -2434,14 +2429,14 @@ azalia_codec_connect_stream(codec_t *this, int dir, uint16_t fmt, int number) w->nid, stream_chan & ~(number << 4))); } - err = this->comresp(this, w->nid, - CORB_SET_CONVERTER_FORMAT, fmt, NULL); + err = azalia_comresp(this, w->nid, CORB_SET_CONVERTER_FORMAT, + fmt, NULL); if (err) { DPRINTF(("%s: nid %2.2x fmt %2.2x: %d\n", __func__, w->nid, fmt, err)); break; } - err = this->comresp(this, w->nid, + err = azalia_comresp(this, w->nid, CORB_SET_CONVERTER_STREAM_CHANNEL, stream_chan, NULL); if (err) { DPRINTF(("%s: nid %2.2x chan %d: %d\n", @@ -2450,7 +2445,7 @@ azalia_codec_connect_stream(codec_t *this, int dir, uint16_t fmt, int number) } if (w->widgetcap & COP_AWCAP_DIGITAL) { - err = this->comresp(this, w->nid, + err = azalia_comresp(this, w->nid, CORB_GET_DIGITAL_CONTROL, 0, &digital); if (err) { DPRINTF(("%s: nid %2.2x get digital: %d\n", @@ -2458,7 +2453,7 @@ azalia_codec_connect_stream(codec_t *this, int dir, uint16_t fmt, int number) break; } digital = (digital & 0xff) | CORB_DCC_DIGEN; - err = this->comresp(this, w->nid, + err = azalia_comresp(this, w->nid, CORB_SET_DIGITAL_CONTROL_L, digital, NULL); if (err) { DPRINTF(("%s: nid %2.2x set digital: %d\n", @@ -2486,13 +2481,15 @@ azalia_codec_disconnect_stream(codec_t *this, int dir) group = &this->dacs.groups[this->dacs.cur]; for (i = 0; i < group->nconv; i++) { nid = group->conv[i]; - this->comresp(this, nid, CORB_SET_CONVERTER_STREAM_CHANNEL, + azalia_comresp(this, nid, CORB_SET_CONVERTER_STREAM_CHANNEL, 0, NULL); /* stream#0 */ if (this->w[nid].widgetcap & COP_AWCAP_DIGITAL) { /* disable S/PDIF */ - this->comresp(this, nid, CORB_GET_DIGITAL_CONTROL, 0, &v); + azalia_comresp(this, nid, CORB_GET_DIGITAL_CONTROL, + 0, &v); v = (v & ~CORB_DCC_DIGEN) & 0xff; - this->comresp(this, nid, CORB_SET_DIGITAL_CONTROL_L, v, NULL); + azalia_comresp(this, nid, CORB_SET_DIGITAL_CONTROL_L, + v, NULL); } } return 0; @@ -2508,7 +2505,7 @@ azalia_widget_init(widget_t *this, const codec_t *codec, nid_t nid) uint32_t result; int err; - err = codec->comresp(codec, nid, CORB_GET_PARAMETER, + err = azalia_comresp(codec, nid, CORB_GET_PARAMETER, COP_AUDIO_WIDGET_CAP, &result); if (err) return err; @@ -2516,8 +2513,8 @@ azalia_widget_init(widget_t *this, const codec_t *codec, nid_t nid) this->widgetcap = result; this->type = COP_AWCAP_TYPE(result); if (this->widgetcap & COP_AWCAP_POWER) { - codec->comresp(codec, nid, CORB_SET_POWER_STATE, - CORB_PS_D0, &result); + azalia_comresp(codec, nid, CORB_SET_POWER_STATE, CORB_PS_D0, + &result); DELAY(100); } @@ -2535,7 +2532,7 @@ azalia_widget_init(widget_t *this, const codec_t *codec, nid_t nid) azalia_widget_init_pin(this, codec); break; case COP_AWTYPE_VOLUME_KNOB: - err = codec->comresp(codec, this->nid, CORB_GET_PARAMETER, + err = azalia_comresp(codec, this->nid, CORB_GET_PARAMETER, COP_VOLUME_KNOB_CAPABILITIES, &result); if (err) return err; @@ -2549,14 +2546,14 @@ azalia_widget_init(widget_t *this, const codec_t *codec, nid_t nid) /* amplifier information */ if (this->widgetcap & COP_AWCAP_INAMP) { if (this->widgetcap & COP_AWCAP_AMPOV) - codec->comresp(codec, nid, CORB_GET_PARAMETER, + azalia_comresp(codec, nid, CORB_GET_PARAMETER, COP_INPUT_AMPCAP, &this->inamp_cap); else this->inamp_cap = codec->w[codec->audiofunc].inamp_cap; } if (this->widgetcap & COP_AWCAP_OUTAMP) { if (this->widgetcap & COP_AWCAP_AMPOV) - codec->comresp(codec, nid, CORB_GET_PARAMETER, + azalia_comresp(codec, nid, CORB_GET_PARAMETER, COP_OUTPUT_AMPCAP, &this->outamp_cap); else this->outamp_cap = codec->w[codec->audiofunc].outamp_cap; @@ -2793,8 +2790,8 @@ azalia_widget_init_audio(widget_t *this, const codec_t *codec) /* check audio format */ if (this->widgetcap & COP_AWCAP_FORMATOV) { - err = codec->comresp(codec, this->nid, - CORB_GET_PARAMETER, COP_STREAM_FORMATS, &result); + err = azalia_comresp(codec, this->nid, CORB_GET_PARAMETER, + COP_STREAM_FORMATS, &result); if (err) return err; this->d.audio.encodings = result; @@ -2810,8 +2807,8 @@ azalia_widget_init_audio(widget_t *this, const codec_t *codec) XNAME(codec->az), this->name, result); return -1; } - err = codec->comresp(codec, this->nid, CORB_GET_PARAMETER, - COP_PCM, &result); + err = azalia_comresp(codec, this->nid, + CORB_GET_PARAMETER, COP_PCM, &result); if (err) return err; this->d.audio.bits_rates = result; @@ -2831,7 +2828,7 @@ azalia_widget_init_pin(widget_t *this, const codec_t *codec) uint32_t result, dir; int err; - err = codec->comresp(codec, this->nid, CORB_GET_CONFIGURATION_DEFAULT, + err = azalia_comresp(codec, this->nid, CORB_GET_CONFIGURATION_DEFAULT, 0, &result); if (err) return err; @@ -2841,7 +2838,7 @@ azalia_widget_init_pin(widget_t *this, const codec_t *codec) this->d.pin.color = CORB_CD_COLOR(result); this->d.pin.device = CORB_CD_DEVICE(result); - err = codec->comresp(codec, this->nid, CORB_GET_PARAMETER, + err = azalia_comresp(codec, this->nid, CORB_GET_PARAMETER, COP_PINCAP, &result); if (err) return err; @@ -2871,18 +2868,18 @@ azalia_widget_init_pin(widget_t *this, const codec_t *codec) dir |= CORB_PWC_VREF_50; } - codec->comresp(codec, this->nid, CORB_SET_PIN_WIDGET_CONTROL, + azalia_comresp(codec, this->nid, CORB_SET_PIN_WIDGET_CONTROL, dir, NULL); if (this->d.pin.cap & COP_PINCAP_EAPD) { - err = codec->comresp(codec, this->nid, CORB_GET_EAPD_BTL_ENABLE, - 0, &result); + err = azalia_comresp(codec, this->nid, + CORB_GET_EAPD_BTL_ENABLE, 0, &result); if (err) return err; result &= 0xff; result |= CORB_EAPD_EAPD; - err = codec->comresp(codec, this->nid, CORB_SET_EAPD_BTL_ENABLE, - result, &result); + err = azalia_comresp(codec, this->nid, + CORB_SET_EAPD_BTL_ENABLE, result, &result); if (err) return err; } @@ -2906,7 +2903,7 @@ azalia_widget_init_connection(widget_t *this, const codec_t *codec) if ((this->widgetcap & COP_AWCAP_CONNLIST) == 0) return 0; - err = codec->comresp(codec, this->nid, CORB_GET_PARAMETER, + err = azalia_comresp(codec, this->nid, CORB_GET_PARAMETER, COP_CONNECTION_LIST_LENGTH, &result); if (err) return err; @@ -2926,7 +2923,7 @@ azalia_widget_init_connection(widget_t *this, const codec_t *codec) return ENOMEM; } for (i = 0; i < length;) { - err = codec->comresp(codec, this->nid, + err = azalia_comresp(codec, this->nid, CORB_GET_CONNECTION_LIST_ENTRY, i, &result); if (err) return err; @@ -2945,7 +2942,7 @@ azalia_widget_init_connection(widget_t *this, const codec_t *codec) } } if (length > 0) { - err = codec->comresp(codec, this->nid, + err = azalia_comresp(codec, this->nid, CORB_GET_CONNECTION_SELECT_CONTROL, 0, &result); if (err) return err; @@ -3036,7 +3033,7 @@ azalia_codec_print_audiofunc(const codec_t *this) DPRINTF(("\toutamp: mute=%u size=%u steps=%u offset=%u\n", (result & COP_AMPCAP_MUTE) != 0, COP_AMPCAP_STEPSIZE(result), COP_AMPCAP_NUMSTEPS(result), COP_AMPCAP_OFFSET(result))); - this->comresp(this, this->audiofunc, CORB_GET_PARAMETER, + azalia_comresp(this, this->audiofunc, CORB_GET_PARAMETER, COP_GPIO_COUNT, &result); DPRINTF(("\tgpio: wake=%u unsol=%u gpis=%u gpos=%u gpios=%u\n", (result & COP_GPIO_WAKE) != 0, (result & COP_GPIO_UNSOL) != 0, @@ -3646,12 +3643,21 @@ azalia_set_port(void *v, mixer_ctrl_t *mc) { azalia_t *az; codec_t *co; + const mixer_item_t *m; + + if (mc->type == AUDIO_MIXER_CLASS) + return 0; /* nothing to do */ az = v; co = &az->codecs[az->codecno]; if (mc->dev < 0 || mc->dev >= co->nmixers) return EINVAL; - return co->set_port(co, mc); + + m = &co->mixers[mc->dev]; + if (mc->type != m->devinfo.type) + return EINVAL; + + return azalia_generic_mixer_set(co, m->nid, m->target, mc); } int @@ -3659,12 +3665,20 @@ azalia_get_port(void *v, mixer_ctrl_t *mc) { azalia_t *az; codec_t *co; + const mixer_item_t *m; + + if (mc->type == AUDIO_MIXER_CLASS) + return 0; /* nothing to do */ az = v; co = &az->codecs[az->codecno]; if (mc->dev < 0 || mc->dev >= co->nmixers) return EINVAL; - return co->get_port(co, mc); + + m = &co->mixers[mc->dev]; + mc->type = m->devinfo.type; + + return azalia_generic_mixer_get(co, m->nid, m->target, mc); } int diff --git a/sys/dev/pci/azalia.h b/sys/dev/pci/azalia.h index efd5f17541b..fd3467ef503 100644 --- a/sys/dev/pci/azalia.h +++ b/sys/dev/pci/azalia.h @@ -1,4 +1,4 @@ -/* $OpenBSD: azalia.h,v 1.48 2009/05/29 21:16:37 jakemsr Exp $ */ +/* $OpenBSD: azalia.h,v 1.49 2009/05/31 02:57:51 jakemsr Exp $ */ /* $NetBSD: azalia.h,v 1.6 2006/01/16 14:15:26 kent Exp $ */ /*- @@ -633,12 +633,6 @@ struct io_pin { typedef struct codec_t { int (*comresp)(const struct codec_t *, nid_t, uint32_t, uint32_t, uint32_t *); - int (*init_dacgroup)(struct codec_t *); - int (*mixer_init)(struct codec_t *); - int (*mixer_delete)(struct codec_t *); - int (*set_port)(struct codec_t *, mixer_ctrl_t *); - int (*get_port)(struct codec_t *, mixer_ctrl_t *); - int (*unsol_event)(struct codec_t *, int); struct azalia_t *az; uint32_t vid; /* codec vendor/device ID */ @@ -712,3 +706,11 @@ int azalia_widget_enabled(const codec_t *, nid_t); int azalia_codec_gpio_quirks(codec_t *); int azalia_codec_widget_quirks(codec_t *, nid_t); int azalia_codec_fnode(codec_t *, nid_t, int, int); + +int azalia_init_dacgroup(codec_t *); +int azalia_mixer_init(codec_t *); +int azalia_mixer_delete(codec_t *); +int azalia_unsol_event(codec_t *, int); +int azalia_comresp(const codec_t *, nid_t, uint32_t, uint32_t, uint32_t *); +int azalia_generic_mixer_get(const codec_t *, nid_t, int, mixer_ctrl_t *); +int azalia_generic_mixer_set(codec_t *, nid_t, int, const mixer_ctrl_t *); diff --git a/sys/dev/pci/azalia_codec.c b/sys/dev/pci/azalia_codec.c index dec4f4d1e00..a10b02a8929 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.128 2009/05/31 02:12:54 jakemsr Exp $ */ +/* $OpenBSD: azalia_codec.c,v 1.129 2009/05/31 02:57:51 jakemsr Exp $ */ /* $NetBSD: azalia_codec.c,v 1.8 2006/05/10 11:17:27 kent Exp $ */ /*- @@ -40,25 +40,16 @@ #define XNAME(co) (((struct device *)co->az)->dv_xname) #define MIXER_DELTA(n) (AUDIO_MAX_GAIN / (n)) -int azalia_generic_codec_init_dacgroup(codec_t *); int azalia_generic_codec_add_convgroup(codec_t *, convgroupset_t *, struct io_pin *, int, nid_t *, int, uint32_t, uint32_t); -int azalia_generic_unsol(codec_t *, int); - -int azalia_generic_mixer_init(codec_t *); int azalia_generic_mixer_fix_indexes(codec_t *); int azalia_generic_mixer_default(codec_t *); -int azalia_generic_mixer_delete(codec_t *); int azalia_generic_mixer_ensure_capacity(codec_t *, size_t); -int azalia_generic_mixer_get(const codec_t *, nid_t, int, mixer_ctrl_t *); -int azalia_generic_mixer_set(codec_t *, nid_t, int, const mixer_ctrl_t *); u_char azalia_generic_mixer_from_device_value (const codec_t *, nid_t, int, uint32_t ); uint32_t azalia_generic_mixer_to_device_value (const codec_t *, nid_t, int, u_char); -int azalia_generic_set_port(codec_t *, mixer_ctrl_t *); -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); @@ -72,12 +63,6 @@ azalia_codec_init_vtbl(codec_t *this) * We can refer this->vid and this->subid. */ this->name = NULL; - this->init_dacgroup = azalia_generic_codec_init_dacgroup; - 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; - this->unsol_event = azalia_generic_unsol; this->qrks = AZ_QRK_NONE; switch (this->vid) { case 0x10ec0260: @@ -366,7 +351,7 @@ azalia_widget_enabled(const codec_t *this, nid_t nid) } int -azalia_generic_codec_init_dacgroup(codec_t *this) +azalia_init_dacgroup(codec_t *this) { this->dacs.ngroups = 0; if (this->na_dacs > 0) @@ -516,7 +501,7 @@ azalia_codec_fnode(codec_t *this, nid_t node, int index, int depth) } int -azalia_generic_unsol(codec_t *this, int tag) +azalia_unsol_event(codec_t *this, int tag) { mixer_ctrl_t mc; uint32_t result; @@ -531,11 +516,11 @@ azalia_generic_unsol(codec_t *this, int tag) for (i = 0; err == 0 && i < this->nsense_pins; i++) { if (!(this->spkr_muters & (1 << i))) continue; - err = this->comresp(this, this->sense_pins[i], + err = azalia_comresp(this, this->sense_pins[i], CORB_GET_PIN_WIDGET_CONTROL, 0, &result); if (err || !(result & CORB_PWC_OUTPUT)) continue; - err = this->comresp(this, this->sense_pins[i], + err = azalia_comresp(this, this->sense_pins[i], CORB_GET_PIN_SENSE, 0, &result); if (!err && (result & CORB_PS_PRESENCE)) vol = 1; @@ -564,7 +549,7 @@ azalia_generic_unsol(codec_t *this, int tag) case AZ_TAG_PLAYVOL: if (this->playvols.master == this->audiofunc) return EINVAL; - err = this->comresp(this, this->playvols.master, + err = azalia_comresp(this, this->playvols.master, CORB_GET_VOLUME_KNOB, 0, &result); if (err) return err; @@ -609,7 +594,7 @@ azalia_generic_unsol(codec_t *this, int tag) * ---------------------------------------------------------------- */ int -azalia_generic_mixer_init(codec_t *this) +azalia_mixer_init(codec_t *this) { /* * pin "<color>%2.2x" @@ -1321,13 +1306,13 @@ azalia_generic_mixer_default(codec_t *this) /* turn on jack sense unsolicited responses */ for (i = 0; i < this->nsense_pins; i++) { if (this->spkr_muters & (1 << i)) { - this->comresp(this, this->sense_pins[i], + azalia_comresp(this, this->sense_pins[i], CORB_SET_UNSOLICITED_RESPONSE, CORB_UNSOL_ENABLE | AZ_TAG_SPKR, NULL); } } - if (this->spkr_muters != 0 && this->unsol_event != NULL) - this->unsol_event(this, AZ_TAG_SPKR); + 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++) { @@ -1371,7 +1356,7 @@ azalia_generic_mixer_default(codec_t *this) if (this->playvols.master != this->audiofunc) { w = &this->w[this->playvols.master]; - err = this->comresp(this, w->nid, CORB_GET_VOLUME_KNOB, + err = azalia_comresp(this, w->nid, CORB_GET_VOLUME_KNOB, 0, &result); if (err) return err; @@ -1382,14 +1367,14 @@ azalia_generic_mixer_default(codec_t *this) /* indirect mode */ result &= ~(CORB_VKNOB_DIRECT); - err = this->comresp(this, w->nid, CORB_SET_VOLUME_KNOB, + err = azalia_comresp(this, w->nid, CORB_SET_VOLUME_KNOB, result, NULL); if (err) return err; /* enable unsolicited responses */ result = CORB_UNSOL_ENABLE | AZ_TAG_PLAYVOL; - err = this->comresp(this, w->nid, + err = azalia_comresp(this, w->nid, CORB_SET_UNSOLICITED_RESPONSE, result, NULL); if (err) return err; @@ -1399,7 +1384,7 @@ azalia_generic_mixer_default(codec_t *this) } int -azalia_generic_mixer_delete(codec_t *this) +azalia_mixer_delete(codec_t *this) { if (this->mixers != NULL) { free(this->mixers, M_DEVBUF); @@ -1421,7 +1406,7 @@ azalia_generic_mixer_get(const codec_t *this, nid_t nid, int target, /* inamp mute */ if (IS_MI_TARGET_INAMP(target) && mc->type == AUDIO_MIXER_ENUM) { - err = this->comresp(this, nid, CORB_GET_AMPLIFIER_GAIN_MUTE, + err = azalia_comresp(this, nid, CORB_GET_AMPLIFIER_GAIN_MUTE, CORB_GAGM_INPUT | CORB_GAGM_LEFT | MI_TARGET_INAMP(target), &result); if (err) @@ -1431,7 +1416,7 @@ azalia_generic_mixer_get(const codec_t *this, nid_t nid, int target, /* inamp gain */ else if (IS_MI_TARGET_INAMP(target) && mc->type == AUDIO_MIXER_VALUE) { - err = this->comresp(this, nid, CORB_GET_AMPLIFIER_GAIN_MUTE, + err = azalia_comresp(this, nid, CORB_GET_AMPLIFIER_GAIN_MUTE, CORB_GAGM_INPUT | CORB_GAGM_LEFT | MI_TARGET_INAMP(target), &result); if (err) @@ -1450,7 +1435,7 @@ azalia_generic_mixer_get(const codec_t *this, nid_t nid, int target, n = nid; mc->un.value.num_channels = WIDGET_CHANNELS(&this->w[n]); if (mc->un.value.num_channels == 2) { - err = this->comresp(this, nid, + err = azalia_comresp(this, nid, CORB_GET_AMPLIFIER_GAIN_MUTE, CORB_GAGM_INPUT | CORB_GAGM_RIGHT | MI_TARGET_INAMP(target), &result); @@ -1463,7 +1448,7 @@ azalia_generic_mixer_get(const codec_t *this, nid_t nid, int target, /* outamp mute */ else if (target == MI_TARGET_OUTAMP && mc->type == AUDIO_MIXER_ENUM) { - err = this->comresp(this, nid, CORB_GET_AMPLIFIER_GAIN_MUTE, + err = azalia_comresp(this, nid, CORB_GET_AMPLIFIER_GAIN_MUTE, CORB_GAGM_OUTPUT | CORB_GAGM_LEFT | 0, &result); if (err) return err; @@ -1472,7 +1457,7 @@ azalia_generic_mixer_get(const codec_t *this, nid_t nid, int target, /* outamp gain */ else if (target == MI_TARGET_OUTAMP && mc->type == AUDIO_MIXER_VALUE) { - err = this->comresp(this, nid, CORB_GET_AMPLIFIER_GAIN_MUTE, + err = azalia_comresp(this, nid, CORB_GET_AMPLIFIER_GAIN_MUTE, CORB_GAGM_OUTPUT | CORB_GAGM_LEFT | 0, &result); if (err) return err; @@ -1480,7 +1465,7 @@ azalia_generic_mixer_get(const codec_t *this, nid_t nid, int target, nid, target, CORB_GAGM_GAIN(result)); mc->un.value.num_channels = WIDGET_CHANNELS(&this->w[nid]); if (mc->un.value.num_channels == 2) { - err = this->comresp(this, nid, + err = azalia_comresp(this, nid, CORB_GET_AMPLIFIER_GAIN_MUTE, CORB_GAGM_OUTPUT | CORB_GAGM_RIGHT | 0, &result); if (err) @@ -1492,7 +1477,7 @@ azalia_generic_mixer_get(const codec_t *this, nid_t nid, int target, /* selection */ else if (target == MI_TARGET_CONNLIST) { - err = this->comresp(this, nid, + err = azalia_comresp(this, nid, CORB_GET_CONNECTION_SELECT_CONTROL, 0, &result); if (err) return err; @@ -1506,7 +1491,7 @@ azalia_generic_mixer_get(const codec_t *this, nid_t nid, int target, /* pin I/O */ else if (target == MI_TARGET_PINDIR) { - err = this->comresp(this, nid, + err = azalia_comresp(this, nid, CORB_GET_PIN_WIDGET_CONTROL, 0, &result); if (err) return err; @@ -1534,7 +1519,7 @@ azalia_generic_mixer_get(const codec_t *this, nid_t nid, int target, /* pin headphone-boost */ else if (target == MI_TARGET_PINBOOST) { - err = this->comresp(this, nid, + err = azalia_comresp(this, nid, CORB_GET_PIN_WIDGET_CONTROL, 0, &result); if (err) return err; @@ -1553,13 +1538,13 @@ azalia_generic_mixer_get(const codec_t *this, nid_t nid, int target, /* S/PDIF */ else if (target == MI_TARGET_SPDIF) { - err = this->comresp(this, nid, CORB_GET_DIGITAL_CONTROL, + err = azalia_comresp(this, nid, CORB_GET_DIGITAL_CONTROL, 0, &result); if (err) return err; mc->un.mask = result & 0xff & ~(CORB_DCC_DIGEN | CORB_DCC_NAUDIO); } else if (target == MI_TARGET_SPDIF_CC) { - err = this->comresp(this, nid, CORB_GET_DIGITAL_CONTROL, + err = azalia_comresp(this, nid, CORB_GET_DIGITAL_CONTROL, 0, &result); if (err) return err; @@ -1569,8 +1554,8 @@ azalia_generic_mixer_get(const codec_t *this, nid_t nid, int target, /* EAPD */ else if (target == MI_TARGET_EAPD) { - err = this->comresp(this, nid, - CORB_GET_EAPD_BTL_ENABLE, 0, &result); + err = azalia_comresp(this, nid, CORB_GET_EAPD_BTL_ENABLE, + 0, &result); if (err) return err; mc->un.ord = result & CORB_EAPD_EAPD ? 1 : 0; @@ -1578,7 +1563,7 @@ azalia_generic_mixer_get(const codec_t *this, nid_t nid, int target, /* sense pin */ else if (target == MI_TARGET_PINSENSE) { - err = this->comresp(this, nid, CORB_GET_PIN_SENSE, + err = azalia_comresp(this, nid, CORB_GET_PIN_SENSE, 0, &result); if (err) return err; @@ -1598,7 +1583,7 @@ azalia_generic_mixer_get(const codec_t *this, nid_t nid, int target, for (i = 0; i < w->nconnections; i++) { if (!azalia_widget_enabled(this, w->connections[i])) continue; - err = this->comresp(this, nid, + err = azalia_comresp(this, nid, CORB_GET_AMPLIFIER_GAIN_MUTE, CORB_GAGM_INPUT | CORB_GAGM_LEFT | MI_TARGET_INAMP(i), &result); @@ -1691,7 +1676,7 @@ azalia_generic_mixer_set(codec_t *this, nid_t nid, int target, /* inamp mute */ if (IS_MI_TARGET_INAMP(target) && mc->type == AUDIO_MIXER_ENUM) { /* We have to set stereo mute separately to keep each gain value. */ - err = this->comresp(this, nid, CORB_GET_AMPLIFIER_GAIN_MUTE, + err = azalia_comresp(this, nid, CORB_GET_AMPLIFIER_GAIN_MUTE, CORB_GAGM_INPUT | CORB_GAGM_LEFT | MI_TARGET_INAMP(target), &result); if (err) @@ -1701,12 +1686,12 @@ azalia_generic_mixer_set(codec_t *this, nid_t nid, int target, CORB_GAGM_GAIN(result); if (mc->un.ord) value |= CORB_AGM_MUTE; - err = this->comresp(this, nid, CORB_SET_AMPLIFIER_GAIN_MUTE, + err = azalia_comresp(this, nid, CORB_SET_AMPLIFIER_GAIN_MUTE, value, &result); if (err) return err; if (WIDGET_CHANNELS(&this->w[nid]) == 2) { - err = this->comresp(this, nid, + err = azalia_comresp(this, nid, CORB_GET_AMPLIFIER_GAIN_MUTE, CORB_GAGM_INPUT | CORB_GAGM_RIGHT | MI_TARGET_INAMP(target), &result); @@ -1717,7 +1702,7 @@ azalia_generic_mixer_set(codec_t *this, nid_t nid, int target, CORB_GAGM_GAIN(result); if (mc->un.ord) value |= CORB_AGM_MUTE; - err = this->comresp(this, nid, + err = azalia_comresp(this, nid, CORB_SET_AMPLIFIER_GAIN_MUTE, value, &result); if (err) return err; @@ -1728,7 +1713,7 @@ azalia_generic_mixer_set(codec_t *this, nid_t nid, int target, else if (IS_MI_TARGET_INAMP(target) && mc->type == AUDIO_MIXER_VALUE) { if (mc->un.value.num_channels < 1) return EINVAL; - err = this->comresp(this, nid, CORB_GET_AMPLIFIER_GAIN_MUTE, + err = azalia_comresp(this, nid, CORB_GET_AMPLIFIER_GAIN_MUTE, CORB_GAGM_INPUT | CORB_GAGM_LEFT | MI_TARGET_INAMP(target), &result); if (err) @@ -1739,13 +1724,13 @@ azalia_generic_mixer_set(codec_t *this, nid_t nid, int target, (target << CORB_AGM_INDEX_SHIFT) | (result & CORB_GAGM_MUTE ? CORB_AGM_MUTE : 0) | (value & CORB_AGM_GAIN_MASK); - err = this->comresp(this, nid, CORB_SET_AMPLIFIER_GAIN_MUTE, + err = azalia_comresp(this, nid, CORB_SET_AMPLIFIER_GAIN_MUTE, value, &result); if (err) return err; if (mc->un.value.num_channels >= 2 && WIDGET_CHANNELS(&this->w[nid]) == 2) { - err = this->comresp(this, nid, + err = azalia_comresp(this, nid, CORB_GET_AMPLIFIER_GAIN_MUTE, CORB_GAGM_INPUT | CORB_GAGM_RIGHT | MI_TARGET_INAMP(target), &result); @@ -1757,7 +1742,7 @@ azalia_generic_mixer_set(codec_t *this, nid_t nid, int target, (target << CORB_AGM_INDEX_SHIFT) | (result & CORB_GAGM_MUTE ? CORB_AGM_MUTE : 0) | (value & CORB_AGM_GAIN_MASK); - err = this->comresp(this, nid, + err = azalia_comresp(this, nid, CORB_SET_AMPLIFIER_GAIN_MUTE, value, &result); if (err) return err; @@ -1766,19 +1751,19 @@ azalia_generic_mixer_set(codec_t *this, nid_t nid, int target, /* outamp mute */ else if (target == MI_TARGET_OUTAMP && mc->type == AUDIO_MIXER_ENUM) { - err = this->comresp(this, nid, CORB_GET_AMPLIFIER_GAIN_MUTE, + err = azalia_comresp(this, nid, CORB_GET_AMPLIFIER_GAIN_MUTE, CORB_GAGM_OUTPUT | CORB_GAGM_LEFT, &result); if (err) return err; value = CORB_AGM_OUTPUT | CORB_AGM_LEFT | CORB_GAGM_GAIN(result); if (mc->un.ord) value |= CORB_AGM_MUTE; - err = this->comresp(this, nid, CORB_SET_AMPLIFIER_GAIN_MUTE, + err = azalia_comresp(this, nid, CORB_SET_AMPLIFIER_GAIN_MUTE, value, &result); if (err) return err; if (WIDGET_CHANNELS(&this->w[nid]) == 2) { - err = this->comresp(this, nid, + err = azalia_comresp(this, nid, CORB_GET_AMPLIFIER_GAIN_MUTE, CORB_GAGM_OUTPUT | CORB_GAGM_RIGHT, &result); if (err) @@ -1787,7 +1772,7 @@ azalia_generic_mixer_set(codec_t *this, nid_t nid, int target, CORB_GAGM_GAIN(result); if (mc->un.ord) value |= CORB_AGM_MUTE; - err = this->comresp(this, nid, + err = azalia_comresp(this, nid, CORB_SET_AMPLIFIER_GAIN_MUTE, value, &result); if (err) return err; @@ -1798,7 +1783,7 @@ azalia_generic_mixer_set(codec_t *this, nid_t nid, int target, else if (target == MI_TARGET_OUTAMP && mc->type == AUDIO_MIXER_VALUE) { if (mc->un.value.num_channels < 1) return EINVAL; - err = this->comresp(this, nid, CORB_GET_AMPLIFIER_GAIN_MUTE, + err = azalia_comresp(this, nid, CORB_GET_AMPLIFIER_GAIN_MUTE, CORB_GAGM_OUTPUT | CORB_GAGM_LEFT, &result); if (err) return err; @@ -1807,13 +1792,13 @@ azalia_generic_mixer_set(codec_t *this, nid_t nid, int target, value = CORB_AGM_OUTPUT | CORB_AGM_LEFT | (result & CORB_GAGM_MUTE ? CORB_AGM_MUTE : 0) | (value & CORB_AGM_GAIN_MASK); - err = this->comresp(this, nid, CORB_SET_AMPLIFIER_GAIN_MUTE, + err = azalia_comresp(this, nid, CORB_SET_AMPLIFIER_GAIN_MUTE, value, &result); if (err) return err; if (mc->un.value.num_channels >= 2 && WIDGET_CHANNELS(&this->w[nid]) == 2) { - err = this->comresp(this, nid, + err = azalia_comresp(this, nid, CORB_GET_AMPLIFIER_GAIN_MUTE, CORB_GAGM_OUTPUT | CORB_GAGM_RIGHT, &result); if (err) @@ -1823,7 +1808,7 @@ azalia_generic_mixer_set(codec_t *this, nid_t nid, int target, value = CORB_AGM_OUTPUT | CORB_AGM_RIGHT | (result & CORB_GAGM_MUTE ? CORB_AGM_MUTE : 0) | (value & CORB_AGM_GAIN_MASK); - err = this->comresp(this, nid, + err = azalia_comresp(this, nid, CORB_SET_AMPLIFIER_GAIN_MUTE, value, &result); if (err) return err; @@ -1837,7 +1822,7 @@ azalia_generic_mixer_set(codec_t *this, nid_t nid, int target, !azalia_widget_enabled(this, this->w[nid].connections[mc->un.ord])) return EINVAL; - err = this->comresp(this, nid, + err = azalia_comresp(this, nid, CORB_SET_CONNECTION_SELECT_CONTROL, mc->un.ord, &result); if (err) return err; @@ -1846,7 +1831,7 @@ azalia_generic_mixer_set(codec_t *this, nid_t nid, int target, /* pin I/O */ else if (target == MI_TARGET_PINDIR) { - err = this->comresp(this, nid, + err = azalia_comresp(this, nid, CORB_GET_PIN_WIDGET_CONTROL, 0, &result); if (err) return err; @@ -1871,7 +1856,7 @@ azalia_generic_mixer_set(codec_t *this, nid_t nid, int target, if (mc->un.ord == 6) value |= CORB_PWC_VREF_100; } - err = this->comresp(this, nid, + err = azalia_comresp(this, nid, CORB_SET_PIN_WIDGET_CONTROL, value, &result); if (err) return err; @@ -1884,8 +1869,7 @@ azalia_generic_mixer_set(codec_t *this, nid_t nid, int target, break; } if (i < this->nsense_pins) { - if (this->unsol_event != NULL) - this->unsol_event(this, AZ_TAG_SPKR); + azalia_unsol_event(this, AZ_TAG_SPKR); } } @@ -1893,7 +1877,7 @@ azalia_generic_mixer_set(codec_t *this, nid_t nid, int target, else if (target == MI_TARGET_PINBOOST) { if (mc->un.ord >= 2) return EINVAL; - err = this->comresp(this, nid, + err = azalia_comresp(this, nid, CORB_GET_PIN_WIDGET_CONTROL, 0, &result); if (err) return err; @@ -1902,7 +1886,7 @@ azalia_generic_mixer_set(codec_t *this, nid_t nid, int target, } else { result |= CORB_PWC_HEADPHONE; } - err = this->comresp(this, nid, + err = azalia_comresp(this, nid, CORB_SET_PIN_WIDGET_CONTROL, result, &result); if (err) return err; @@ -1936,11 +1920,11 @@ azalia_generic_mixer_set(codec_t *this, nid_t nid, int target, /* S/PDIF */ else if (target == MI_TARGET_SPDIF) { - err = this->comresp(this, nid, CORB_GET_DIGITAL_CONTROL, + err = azalia_comresp(this, nid, CORB_GET_DIGITAL_CONTROL, 0, &result); result &= CORB_DCC_DIGEN | CORB_DCC_NAUDIO; result |= mc->un.mask & 0xff & ~CORB_DCC_DIGEN; - err = this->comresp(this, nid, CORB_SET_DIGITAL_CONTROL_L, + err = azalia_comresp(this, nid, CORB_SET_DIGITAL_CONTROL_L, result, NULL); if (err) return err; @@ -1949,7 +1933,7 @@ azalia_generic_mixer_set(codec_t *this, nid_t nid, int target, return EINVAL; if (mc->un.value.level[0] > 127) return EINVAL; - err = this->comresp(this, nid, CORB_SET_DIGITAL_CONTROL_H, + err = azalia_comresp(this, nid, CORB_SET_DIGITAL_CONTROL_H, mc->un.value.level[0], NULL); if (err) return err; @@ -1959,7 +1943,7 @@ azalia_generic_mixer_set(codec_t *this, nid_t nid, int target, else if (target == MI_TARGET_EAPD) { if (mc->un.ord >= 2) return EINVAL; - err = this->comresp(this, nid, + err = azalia_comresp(this, nid, CORB_GET_EAPD_BTL_ENABLE, 0, &result); if (err) return err; @@ -1969,7 +1953,7 @@ azalia_generic_mixer_set(codec_t *this, nid_t nid, int target, } else { result |= CORB_EAPD_EAPD; } - err = this->comresp(this, nid, + err = azalia_comresp(this, nid, CORB_SET_EAPD_BTL_ENABLE, result, &result); if (err) return err; @@ -1994,7 +1978,7 @@ azalia_generic_mixer_set(codec_t *this, nid_t nid, int target, /* We have to set stereo mute separately * to keep each gain value. */ - err = this->comresp(this, nid, + err = azalia_comresp(this, nid, CORB_GET_AMPLIFIER_GAIN_MUTE, CORB_GAGM_INPUT | CORB_GAGM_LEFT | MI_TARGET_INAMP(i), &result); @@ -2005,13 +1989,13 @@ azalia_generic_mixer_set(codec_t *this, nid_t nid, int target, CORB_GAGM_GAIN(result); if ((mc->un.mask & (1 << i)) == 0) value |= CORB_AGM_MUTE; - err = this->comresp(this, nid, + err = azalia_comresp(this, nid, CORB_SET_AMPLIFIER_GAIN_MUTE, value, &result); if (err) return err; if (WIDGET_CHANNELS(w) == 2) { - err = this->comresp(this, nid, + err = azalia_comresp(this, nid, CORB_GET_AMPLIFIER_GAIN_MUTE, CORB_GAGM_INPUT | CORB_GAGM_RIGHT | MI_TARGET_INAMP(i), &result); @@ -2022,7 +2006,7 @@ azalia_generic_mixer_set(codec_t *this, nid_t nid, int target, CORB_GAGM_GAIN(result); if ((mc->un.mask & (1 << i)) == 0) value |= CORB_AGM_MUTE; - err = this->comresp(this, nid, + err = azalia_comresp(this, nid, CORB_SET_AMPLIFIER_GAIN_MUTE, value, &result); if (err) @@ -2039,8 +2023,7 @@ azalia_generic_mixer_set(codec_t *this, nid_t nid, int target, if (nid == this->speaker) { this->spkr_muters = mc->un.mask; - if (this->unsol_event != NULL) - this->unsol_event(this, AZ_TAG_SPKR); + azalia_unsol_event(this, AZ_TAG_SPKR); } else { DPRINTF(("%s: invalid senseset nid\n")); return EINVAL; @@ -2240,51 +2223,22 @@ azalia_generic_mixer_to_device_value(const codec_t *this, nid_t nid, int target, } int -azalia_generic_set_port(codec_t *this, mixer_ctrl_t *mc) -{ - const mixer_item_t *m; - - if (mc->dev >= this->nmixers) - return ENXIO; - m = &this->mixers[mc->dev]; - if (mc->type != m->devinfo.type) - return EINVAL; - if (mc->type == AUDIO_MIXER_CLASS) - return 0; /* nothing to do */ - return azalia_generic_mixer_set(this, m->nid, m->target, mc); -} - -int -azalia_generic_get_port(codec_t *this, mixer_ctrl_t *mc) -{ - const mixer_item_t *m; - - if (mc->dev >= this->nmixers) - return ENXIO; - m = &this->mixers[mc->dev]; - mc->type = m->devinfo.type; - if (mc->type == AUDIO_MIXER_CLASS) - return 0; /* nothing to do */ - return azalia_generic_mixer_get(this, m->nid, m->target, mc); -} - -int azalia_gpio_unmute(codec_t *this, int pin) { uint32_t data, mask, dir; - this->comresp(this, this->audiofunc, CORB_GET_GPIO_DATA, 0, &data); - this->comresp(this, this->audiofunc, CORB_GET_GPIO_ENABLE_MASK, 0, &mask); - this->comresp(this, this->audiofunc, CORB_GET_GPIO_DIRECTION, 0, &dir); + azalia_comresp(this, this->audiofunc, CORB_GET_GPIO_DATA, 0, &data); + azalia_comresp(this, this->audiofunc, CORB_GET_GPIO_ENABLE_MASK, 0, &mask); + azalia_comresp(this, this->audiofunc, CORB_GET_GPIO_DIRECTION, 0, &dir); data |= 1 << pin; mask |= 1 << pin; dir |= 1 << pin; - this->comresp(this, this->audiofunc, CORB_SET_GPIO_ENABLE_MASK, mask, NULL); - this->comresp(this, this->audiofunc, CORB_SET_GPIO_DIRECTION, dir, NULL); + azalia_comresp(this, this->audiofunc, CORB_SET_GPIO_ENABLE_MASK, mask, NULL); + azalia_comresp(this, this->audiofunc, CORB_SET_GPIO_DIRECTION, dir, NULL); DELAY(1000); - this->comresp(this, this->audiofunc, CORB_SET_GPIO_DATA, data, NULL); + azalia_comresp(this, this->audiofunc, CORB_SET_GPIO_DATA, data, NULL); return 0; } @@ -2317,7 +2271,7 @@ int azalia_codec_gpio_quirks(codec_t *this) { if (this->qrks & AZ_QRK_GPIO_POL_0) { - this->comresp(this, this->audiofunc, + azalia_comresp(this, this->audiofunc, CORB_SET_GPIO_POLARITY, 0, NULL); } if (this->qrks & AZ_QRK_GPIO_UNMUTE_0) { |