diff options
author | Jacob Meuser <jakemsr@cvs.openbsd.org> | 2008-12-21 20:32:47 +0000 |
---|---|---|
committer | Jacob Meuser <jakemsr@cvs.openbsd.org> | 2008-12-21 20:32:47 +0000 |
commit | 2d0fe69daed171083fdea4c10ff7c243153a8dbb (patch) | |
tree | 2d2814c4c5d956d9589a9d8b976f8c7587de5fba /sys/dev/pci/azalia.c | |
parent | 278bca9bf22c007da5199f29e799bd3b911433dc (diff) |
a little rearranging:
- move the azalia_widget_init_connection call from
azalia_widget_label_widgets to just after azalia_widget_init
- move azalia_widget_label_widgets to after dacgroup initialization
- move the widget info printing from azalia_widget_init_connection
and azalia_widget_init to new function azalia_widget_dump_info
- call azalia_widget_dump_info right after azalia_widget_init_connection
- in functions that are ony used if AZALIA_DEBUG is defined, use printf
instead of DPRINTF()
Diffstat (limited to 'sys/dev/pci/azalia.c')
-rw-r--r-- | sys/dev/pci/azalia.c | 137 |
1 files changed, 77 insertions, 60 deletions
diff --git a/sys/dev/pci/azalia.c b/sys/dev/pci/azalia.c index a38095d970d..50662c9cf7e 100644 --- a/sys/dev/pci/azalia.c +++ b/sys/dev/pci/azalia.c @@ -1,4 +1,4 @@ -/* $OpenBSD: azalia.c,v 1.80 2008/12/21 20:17:16 jakemsr Exp $ */ +/* $OpenBSD: azalia.c,v 1.81 2008/12/21 20:32:46 jakemsr Exp $ */ /* $NetBSD: azalia.c,v 1.20 2006/05/07 08:31:44 kent Exp $ */ /*- @@ -245,6 +245,7 @@ int azalia_widget_init_connection(widget_t *, const codec_t *); int azalia_widget_check_conn(codec_t *, int, int); int azalia_widget_sole_conn(codec_t *, nid_t); #ifdef AZALIA_DEBUG +int azalia_widget_dump_info(const widget_t *, const codec_t *); int azalia_widget_print_audio(const widget_t *, const char *); int azalia_widget_print_pin(const widget_t *); #endif @@ -1284,10 +1285,15 @@ azalia_codec_init(codec_t *this) err = azalia_widget_init(&this->w[i], this, i); if (err) return err; + err = azalia_widget_init_connection(&this->w[i], this); + if (err) + return err; +#ifdef AZALIA_DEBUG + err = azalia_widget_dump_info(&this->w[i], this); + if (err) + return err; +#endif } - err = azalia_widget_label_widgets(this); - if (err) - return err; /* Find widgets without any enabled inputs and disable them. * Must be done after all widgets are initialized and * their connections created. @@ -1302,6 +1308,9 @@ azalia_codec_init(codec_t *this) err = this->init_dacgroup(this); if (err) return err; + err = azalia_widget_label_widgets(this); + if (err) + return err; #ifdef AZALIA_DEBUG for (i = 0; i < this->dacs.ngroups; i++) { DPRINTF(("%s: dacgroup[%d]:", __func__, i)); @@ -1318,7 +1327,6 @@ azalia_codec_init(codec_t *this) DPRINTF(("\n")); } #endif - err = azalia_codec_construct_format(this, 0, 0); if (err) return err; @@ -1755,7 +1763,6 @@ azalia_widget_label_widgets(codec_t *codec) bzero(&types, sizeof(types)); FOR_EACH_WIDGET(codec, i) { - DPRINTF(("%s: ", XNAME(codec->az))); w = &codec->w[i]; if (w->type == COP_AWTYPE_PIN_COMPLEX) { pins[w->d.pin.device]++; @@ -1789,35 +1796,6 @@ azalia_widget_label_widgets(codec_t *codec) } if (codec->init_widget != NULL) codec->init_widget(codec, w, w->nid); -#ifdef AZALIA_DEBUG - DPRINTF(("%s%2.2x wcap=%b\n", w->type == COP_AWTYPE_PIN_COMPLEX ? - pin_colors[w->d.pin.color] : wtypes[w->type], - w->nid, w->widgetcap, WIDGETCAP_BITS)); - if (w->widgetcap & COP_AWCAP_FORMATOV) - azalia_widget_print_audio(w, "\t"); - if (w->type == COP_AWTYPE_PIN_COMPLEX) - azalia_widget_print_pin(w); - - if (w->type == COP_AWTYPE_VOLUME_KNOB) - DPRINTF(("\tdelta=%d steps=%d\n", - !!(w->d.volume.cap & COP_VKCAP_DELTA), - COP_VKCAP_NUMSTEPS(w->d.volume.cap))); - - if ((w->widgetcap & COP_AWCAP_INAMP) && (w->widgetcap & COP_AWCAP_AMPOV)) - DPRINTF(("\tinamp: mute=%u size=%u steps=%u offset=%u\n", - (w->inamp_cap & COP_AMPCAP_MUTE) != 0, - COP_AMPCAP_STEPSIZE(w->inamp_cap), - COP_AMPCAP_NUMSTEPS(w->inamp_cap), - COP_AMPCAP_OFFSET(w->inamp_cap))); - - if ((w->widgetcap & COP_AWCAP_OUTAMP) && (w->widgetcap & COP_AWCAP_AMPOV)) - DPRINTF(("\toutamp: mute=%u size=%u steps=%u offset=%u\n", - (w->outamp_cap & COP_AMPCAP_MUTE) != 0, - COP_AMPCAP_STEPSIZE(w->outamp_cap), - COP_AMPCAP_NUMSTEPS(w->outamp_cap), - COP_AMPCAP_OFFSET(w->outamp_cap))); -#endif - azalia_widget_init_connection(w, codec); } return 0; } @@ -1995,38 +1973,83 @@ azalia_widget_init_pin(widget_t *this, const codec_t *codec) #ifdef AZALIA_DEBUG int +azalia_widget_dump_info(const widget_t *w, const codec_t *codec) +{ + int i; + + printf("%s: ", XNAME(codec->az)); + printf("%s%2.2x wcap=%b\n", w->type == COP_AWTYPE_PIN_COMPLEX ? + pin_colors[w->d.pin.color] : wtypes[w->type], + w->nid, w->widgetcap, WIDGETCAP_BITS); + if (w->widgetcap & COP_AWCAP_FORMATOV) + azalia_widget_print_audio(w, "\t"); + if (w->type == COP_AWTYPE_PIN_COMPLEX) + azalia_widget_print_pin(w); + + if (w->type == COP_AWTYPE_VOLUME_KNOB) + printf("\tdelta=%d steps=%d\n", + !!(w->d.volume.cap & COP_VKCAP_DELTA), + COP_VKCAP_NUMSTEPS(w->d.volume.cap)); + + if ((w->widgetcap & COP_AWCAP_INAMP) && + (w->widgetcap & COP_AWCAP_AMPOV)) + printf("\tinamp: mute=%u size=%u steps=%u offset=%u\n", + (w->inamp_cap & COP_AMPCAP_MUTE) != 0, + COP_AMPCAP_STEPSIZE(w->inamp_cap), + COP_AMPCAP_NUMSTEPS(w->inamp_cap), + COP_AMPCAP_OFFSET(w->inamp_cap)); + + if ((w->widgetcap & COP_AWCAP_OUTAMP) && + (w->widgetcap & COP_AWCAP_AMPOV)) + printf("\toutamp: mute=%u size=%u steps=%u offset=%u\n", + (w->outamp_cap & COP_AMPCAP_MUTE) != 0, + COP_AMPCAP_STEPSIZE(w->outamp_cap), + COP_AMPCAP_NUMSTEPS(w->outamp_cap), + COP_AMPCAP_OFFSET(w->outamp_cap)); + + if (w->nconnections > 0) { + printf("\tconnections=0x%x", w->connections[0]); + for (i = 1; i < w->nconnections; i++) + printf(",0x%x", w->connections[i]); + printf("; selected=0x%x\n", w->connections[w->selected]); + } + + return 0; +} + +int azalia_widget_print_pin(const widget_t *this) { - DPRINTF(("\tcap=%b\n", this->d.pin.cap, PINCAP_BITS)); - DPRINTF(("\t[%2.2d/%2.2d] ", CORB_CD_ASSOCIATION(this->d.pin.config), - CORB_CD_SEQUENCE(this->d.pin.config))); - DPRINTF(("color=%s ", pin_colors[CORB_CD_COLOR(this->d.pin.config)])); - DPRINTF(("device=%s ", pin_devices[CORB_CD_DEVICE(this->d.pin.config)])); - DPRINTF(("conn=%s ", pin_conn[CORB_CD_PORT(this->d.pin.config)])); - DPRINTF(("conntype=%s\n", pin_conntype[CORB_CD_CONNECTION(this->d.pin.config)])); - DPRINTF(("\tlocation=%s ", pin_geo[CORB_CD_LOC_GEO(this->d.pin.config)])); - DPRINTF(("chassis=%s ", pin_chass[CORB_CD_LOC_CHASS(this->d.pin.config)])); - DPRINTF(("special=")); + printf("\tcap=%b\n", this->d.pin.cap, PINCAP_BITS); + printf("\t[%2.2d/%2.2d] ", CORB_CD_ASSOCIATION(this->d.pin.config), + CORB_CD_SEQUENCE(this->d.pin.config)); + printf("color=%s ", pin_colors[CORB_CD_COLOR(this->d.pin.config)]); + printf("device=%s ", pin_devices[CORB_CD_DEVICE(this->d.pin.config)]); + printf("conn=%s ", pin_conn[CORB_CD_PORT(this->d.pin.config)]); + printf("conntype=%s\n", pin_conntype[CORB_CD_CONNECTION(this->d.pin.config)]); + printf("\tlocation=%s ", pin_geo[CORB_CD_LOC_GEO(this->d.pin.config)]); + printf("chassis=%s ", pin_chass[CORB_CD_LOC_CHASS(this->d.pin.config)]); + printf("special="); if (CORB_CD_LOC_GEO(this->d.pin.config) == CORB_CD_LOC_SPEC0) { if (CORB_CD_LOC_CHASS(this->d.pin.config) == CORB_CD_EXTERNAL) - DPRINTF(("rear-panel")); + printf("rear-panel"); else if (CORB_CD_LOC_CHASS(this->d.pin.config) == CORB_CD_INTERNAL) - DPRINTF(("riser")); + printf("riser"); else if (CORB_CD_LOC_CHASS(this->d.pin.config) == CORB_CD_LOC_OTHER) - DPRINTF(("mobile-lid-internal")); + printf("mobile-lid-internal"); } else if (CORB_CD_LOC_GEO(this->d.pin.config) == CORB_CD_LOC_SPEC1) { if (CORB_CD_LOC_CHASS(this->d.pin.config) == CORB_CD_EXTERNAL) - DPRINTF(("drive-bay")); + printf("drive-bay"); else if (CORB_CD_LOC_CHASS(this->d.pin.config) == CORB_CD_INTERNAL) - DPRINTF(("hdmi")); + printf("hdmi"); else if (CORB_CD_LOC_CHASS(this->d.pin.config) == CORB_CD_LOC_OTHER) - DPRINTF(("mobile-lid-external")); + printf("mobile-lid-external"); } else if (CORB_CD_LOC_GEO(this->d.pin.config) == CORB_CD_LOC_SPEC2) { if (CORB_CD_LOC_CHASS(this->d.pin.config) == CORB_CD_INTERNAL) - DPRINTF(("atapi")); + printf("atapi"); } else - DPRINTF(("none")); - DPRINTF(("\n")); + printf("none"); + printf("\n"); return 0; } @@ -2081,17 +2104,11 @@ azalia_widget_init_connection(widget_t *this, const codec_t *codec) } } if (length > 0) { - DPRINTF(("\tconnections=0x%x", this->connections[0])); - for (i = 1; i < length; i++) { - DPRINTF((",0x%x", this->connections[i])); - } - err = codec->comresp(codec, this->nid, CORB_GET_CONNECTION_SELECT_CONTROL, 0, &result); if (err) return err; this->selected = CORB_CSC_INDEX(result); - DPRINTF(("; selected=0x%x\n", this->connections[result])); } return 0; } |