Lines Matching full:w

179 static void	hdaa_dump_pin_config(struct hdaa_widget *w, uint32_t conf);
268 struct hdaa_widget *w; in hdaa_channels_handler() local
279 w = hdaa_widget_get(devinfo, as->pins[i]); in hdaa_channels_handler()
280 if (w == NULL) in hdaa_channels_handler()
282 if (w->wclass.pin.connected == 1) in hdaa_channels_handler()
284 else if (w->wclass.pin.connected != 0) in hdaa_channels_handler()
286 if (w->eld != NULL && w->eld_len >= 8) in hdaa_channels_handler()
287 eld = w->eld; in hdaa_channels_handler()
379 hdaa_hpredir_handler(struct hdaa_widget *w) in hdaa_hpredir_handler() argument
381 struct hdaa_devinfo *devinfo = w->devinfo; in hdaa_hpredir_handler()
382 struct hdaa_audio_as *as = &devinfo->as[w->bindas]; in hdaa_hpredir_handler()
386 int j, connected = w->wclass.pin.connected; in hdaa_hpredir_handler()
396 w->nid, HDAA_CTL_IN, -1, 1); in hdaa_hpredir_handler()
409 val = w->wclass.pin.ctrl | in hdaa_hpredir_handler()
412 val = w->wclass.pin.ctrl & in hdaa_hpredir_handler()
414 if (val != w->wclass.pin.ctrl) { in hdaa_hpredir_handler()
415 w->wclass.pin.ctrl = val; in hdaa_hpredir_handler()
418 w->nid, w->wclass.pin.ctrl)); in hdaa_hpredir_handler()
461 hdaa_autorecsrc_handler(struct hdaa_audio_as *as, struct hdaa_widget *w) in hdaa_autorecsrc_handler() argument
473 (pdevinfo->autorecsrc == 1 && w != NULL)) in hdaa_autorecsrc_handler()
505 if (w != NULL && (mask & (1 << w->ossdev))) in hdaa_autorecsrc_handler()
506 mask = (1 << w->ossdev); in hdaa_autorecsrc_handler()
532 hdaa_presence_handler(struct hdaa_widget *w) in hdaa_presence_handler() argument
534 struct hdaa_devinfo *devinfo = w->devinfo; in hdaa_presence_handler()
541 if (w->enable == 0 || w->type != in hdaa_presence_handler()
545 if (HDA_PARAM_PIN_CAP_PRESENCE_DETECT_CAP(w->wclass.pin.cap) == 0 || in hdaa_presence_handler()
546 (HDA_CONFIG_DEFAULTCONF_MISC(w->wclass.pin.config) & 1) != 0) in hdaa_presence_handler()
549 res = hda_command(devinfo->dev, HDA_CMD_GET_PIN_SENSE(0, w->nid)); in hdaa_presence_handler()
553 old = w->wclass.pin.connected; in hdaa_presence_handler()
556 w->wclass.pin.connected = connected; in hdaa_presence_handler()
558 as = &devinfo->as[w->bindas]; in hdaa_presence_handler()
559 if (as->hpredir >= 0 && as->pins[15] == w->nid) in hdaa_presence_handler()
560 hdaa_hpredir_handler(w); in hdaa_presence_handler()
562 hdaa_autorecsrc_handler(as, w); in hdaa_presence_handler()
570 w->nid, res, !connected ? "dis" : ""); in hdaa_presence_handler()
606 struct hdaa_widget *w; in hdaa_jack_poll_callback() local
617 w = hdaa_widget_get(devinfo, devinfo->as[i].pins[15]); in hdaa_jack_poll_callback()
618 if (w == NULL || w->enable == 0 || w->type != in hdaa_jack_poll_callback()
621 hdaa_presence_handler(w); in hdaa_jack_poll_callback()
629 hdaa_eld_dump(struct hdaa_widget *w) in hdaa_eld_dump() argument
631 struct hdaa_devinfo *devinfo = w->devinfo; in hdaa_eld_dump()
636 if (w->eld == NULL || w->eld_len < 4) in hdaa_eld_dump()
640 w->nid, w->eld[0] >> 3, w->eld[2]); in hdaa_eld_dump()
641 if ((w->eld[0] >> 3) != 0x02) in hdaa_eld_dump()
643 mnl = w->eld[4] & 0x1f; in hdaa_eld_dump()
646 w->nid, w->eld[4] >> 5, mnl); in hdaa_eld_dump()
647 sadc = w->eld[5] >> 4; in hdaa_eld_dump()
650 w->nid, sadc, (w->eld[5] >> 2) & 0x3, in hdaa_eld_dump()
651 (w->eld[5] >> 1) & 0x1, w->eld[5] & 0x1); in hdaa_eld_dump()
654 w->nid, w->eld[6] * 2); in hdaa_eld_dump()
657 w->nid, w->eld[7], in hdaa_eld_dump()
661 w->nid, w->eld[8], w->eld[9], w->eld[10], w->eld[11], in hdaa_eld_dump()
662 w->eld[12], w->eld[13], w->eld[14], w->eld[15]); in hdaa_eld_dump()
665 w->nid, w->eld[16], w->eld[17]); in hdaa_eld_dump()
668 w->nid, w->eld[18], w->eld[19]); in hdaa_eld_dump()
671 w->nid, mnl, &w->eld[20]); in hdaa_eld_dump()
673 sad = &w->eld[20 + mnl + i * 3]; in hdaa_eld_dump()
684 w->nid, HDA_HDMI_CODING_TYPES[fmt], (sad[0] & 0x07) + 1, in hdaa_eld_dump()
709 hdaa_eld_handler(struct hdaa_widget *w) in hdaa_eld_handler() argument
711 struct hdaa_devinfo *devinfo = w->devinfo; in hdaa_eld_handler()
715 if (w->enable == 0 || w->type != in hdaa_eld_handler()
719 if (HDA_PARAM_PIN_CAP_PRESENCE_DETECT_CAP(w->wclass.pin.cap) == 0 || in hdaa_eld_handler()
720 (HDA_CONFIG_DEFAULTCONF_MISC(w->wclass.pin.config) & 1) != 0) in hdaa_eld_handler()
723 res = hda_command(devinfo->dev, HDA_CMD_GET_PIN_SENSE(0, w->nid)); in hdaa_eld_handler()
724 if ((w->eld != 0) == ((res & HDA_CMD_GET_PIN_SENSE_ELD_VALID) != 0)) in hdaa_eld_handler()
726 if (w->eld != NULL) { in hdaa_eld_handler()
727 w->eld_len = 0; in hdaa_eld_handler()
728 free(w->eld, M_HDAA); in hdaa_eld_handler()
729 w->eld = NULL; in hdaa_eld_handler()
735 w->nid, res, in hdaa_eld_handler()
743 HDA_CMD_GET_HDMI_DIP_SIZE(0, w->nid, 0x08)); in hdaa_eld_handler()
746 w->eld_len = res & 0xff; in hdaa_eld_handler()
747 if (w->eld_len != 0) in hdaa_eld_handler()
748 w->eld = malloc(w->eld_len, M_HDAA, M_ZERO | M_NOWAIT); in hdaa_eld_handler()
749 if (w->eld == NULL) { in hdaa_eld_handler()
750 w->eld_len = 0; in hdaa_eld_handler()
754 for (i = 0; i < w->eld_len; i++) { in hdaa_eld_handler()
756 HDA_CMD_GET_HDMI_ELDD(0, w->nid, i)); in hdaa_eld_handler()
758 w->eld[i] = res & 0xff; in hdaa_eld_handler()
761 hdaa_eld_dump(w); in hdaa_eld_handler()
763 hdaa_channels_handler(&devinfo->as[w->bindas]); in hdaa_eld_handler()
773 struct hdaa_widget *w; in hdaa_sense_init() local
777 w = hdaa_widget_get(devinfo, i); in hdaa_sense_init()
778 if (w == NULL || w->enable == 0 || w->type != in hdaa_sense_init()
781 if (HDA_PARAM_AUDIO_WIDGET_CAP_UNSOL_CAP(w->param.widget_cap)) { in hdaa_sense_init()
782 if (w->unsol < 0) in hdaa_sense_init()
783 w->unsol = HDAC_UNSOL_ALLOC( in hdaa_sense_init()
785 devinfo->dev, w->nid); in hdaa_sense_init()
787 HDA_CMD_SET_UNSOLICITED_RESPONSE(0, w->nid, in hdaa_sense_init()
788 HDA_CMD_SET_UNSOLICITED_RESPONSE_ENABLE | w->unsol)); in hdaa_sense_init()
790 as = &devinfo->as[w->bindas]; in hdaa_sense_init()
791 if (as->hpredir >= 0 && as->pins[15] == w->nid) { in hdaa_sense_init()
792 if (HDA_PARAM_PIN_CAP_PRESENCE_DETECT_CAP(w->wclass.pin.cap) == 0 || in hdaa_sense_init()
793 (HDA_CONFIG_DEFAULTCONF_MISC(w->wclass.pin.config) & 1) != 0) { in hdaa_sense_init()
796 w->nid); in hdaa_sense_init()
798 if (w->unsol < 0) in hdaa_sense_init()
804 w->bindas, w->nid, in hdaa_sense_init()
805 (w->unsol < 0) ? "polling" : in hdaa_sense_init()
810 hdaa_presence_handler(w); in hdaa_sense_init()
811 if (!HDA_PARAM_PIN_CAP_DP(w->wclass.pin.cap) && in hdaa_sense_init()
812 !HDA_PARAM_PIN_CAP_HDMI(w->wclass.pin.cap)) in hdaa_sense_init()
814 hdaa_eld_handler(w); in hdaa_sense_init()
825 struct hdaa_widget *w; in hdaa_sense_deinit() local
830 w = hdaa_widget_get(devinfo, i); in hdaa_sense_deinit()
831 if (w == NULL || w->enable == 0 || w->type != in hdaa_sense_deinit()
834 if (w->unsol < 0) in hdaa_sense_deinit()
837 HDA_CMD_SET_UNSOLICITED_RESPONSE(0, w->nid, 0)); in hdaa_sense_deinit()
840 w->unsol); in hdaa_sense_deinit()
841 w->unsol = -1; in hdaa_sense_deinit()
967 hdaa_local_patch_pin(struct hdaa_widget *w) in hdaa_local_patch_pin() argument
969 device_t dev = w->devinfo->dev; in hdaa_local_patch_pin()
974 config = orig = w->wclass.pin.config; in hdaa_local_patch_pin()
976 hda_get_codec_id(dev), w->nid); in hdaa_local_patch_pin()
987 snprintf(buf, sizeof(buf), "nid%u.config", w->nid); in hdaa_local_patch_pin()
998 device_printf(w->devinfo->dev, in hdaa_local_patch_pin()
1000 w->nid, orig, config); in hdaa_local_patch_pin()
1002 w->wclass.pin.newconf = w->wclass.pin.config = config; in hdaa_local_patch_pin()
1061 hdaa_dump_pin_sb(struct sbuf *sb, struct hdaa_widget *w) in hdaa_dump_pin_sb() argument
1065 pincap = w->wclass.pin.cap; in hdaa_dump_pin_sb()
1105 conf = w->wclass.pin.config; in hdaa_dump_pin_sb()
1117 sbuf_printf(sb, " Pin control: 0x%08x", w->wclass.pin.ctrl); in hdaa_dump_pin_sb()
1118 if (w->wclass.pin.ctrl & HDA_CMD_SET_PIN_WIDGET_CTRL_HPHN_ENABLE) in hdaa_dump_pin_sb()
1120 if (w->wclass.pin.ctrl & HDA_CMD_SET_PIN_WIDGET_CTRL_IN_ENABLE) in hdaa_dump_pin_sb()
1122 if (w->wclass.pin.ctrl & HDA_CMD_SET_PIN_WIDGET_CTRL_OUT_ENABLE) in hdaa_dump_pin_sb()
1124 if (HDA_PARAM_AUDIO_WIDGET_CAP_DIGITAL(w->param.widget_cap)) { in hdaa_dump_pin_sb()
1125 if ((w->wclass.pin.ctrl & in hdaa_dump_pin_sb()
1128 else if ((w->wclass.pin.ctrl & in hdaa_dump_pin_sb()
1132 if ((w->wclass.pin.ctrl & in hdaa_dump_pin_sb()
1160 struct hdaa_widget *w, *cw; in hdaa_sysctl_caps() local
1165 w = (struct hdaa_widget *)oidp->oid_arg1; in hdaa_sysctl_caps()
1166 devinfo = w->devinfo; in hdaa_sysctl_caps()
1169 sbuf_printf(&sb, "%s%s\n", w->name, in hdaa_sysctl_caps()
1170 (w->enable == 0) ? " [DISABLED]" : ""); in hdaa_sysctl_caps()
1172 w->param.widget_cap); in hdaa_sysctl_caps()
1173 if (w->param.widget_cap & 0x0ee1) { in hdaa_sysctl_caps()
1174 if (HDA_PARAM_AUDIO_WIDGET_CAP_LR_SWAP(w->param.widget_cap)) in hdaa_sysctl_caps()
1176 if (HDA_PARAM_AUDIO_WIDGET_CAP_POWER_CTRL(w->param.widget_cap)) in hdaa_sysctl_caps()
1178 if (HDA_PARAM_AUDIO_WIDGET_CAP_DIGITAL(w->param.widget_cap)) in hdaa_sysctl_caps()
1180 if (HDA_PARAM_AUDIO_WIDGET_CAP_UNSOL_CAP(w->param.widget_cap)) in hdaa_sysctl_caps()
1182 if (HDA_PARAM_AUDIO_WIDGET_CAP_PROC_WIDGET(w->param.widget_cap)) in hdaa_sysctl_caps()
1184 if (HDA_PARAM_AUDIO_WIDGET_CAP_STRIPE(w->param.widget_cap)) in hdaa_sysctl_caps()
1186 1 << (fls(w->wclass.conv.stripecap) - 1)); in hdaa_sysctl_caps()
1187 j = HDA_PARAM_AUDIO_WIDGET_CAP_CC(w->param.widget_cap); in hdaa_sysctl_caps()
1194 if (w->bindas != -1) { in hdaa_sysctl_caps()
1196 w->bindas, w->bindseqmask); in hdaa_sysctl_caps()
1198 if (w->ossmask != 0 || w->ossdev >= 0) { in hdaa_sysctl_caps()
1200 hdaa_audio_ctl_ossmixer_mask2allname(w->ossmask, buf, sizeof(buf))); in hdaa_sysctl_caps()
1201 if (w->ossdev >= 0) in hdaa_sysctl_caps()
1202 sbuf_printf(&sb, " (%s)", ossnames[w->ossdev]); in hdaa_sysctl_caps()
1205 if (w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_OUTPUT || in hdaa_sysctl_caps()
1206 w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_INPUT) { in hdaa_sysctl_caps()
1208 w->param.supp_stream_formats, in hdaa_sysctl_caps()
1209 w->param.supp_pcm_size_rate); in hdaa_sysctl_caps()
1210 } else if (w->type == in hdaa_sysctl_caps()
1211 HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX || w->waspin) in hdaa_sysctl_caps()
1212 hdaa_dump_pin_sb(&sb, w); in hdaa_sysctl_caps()
1213 if (w->param.eapdbtl != HDA_INVALID) { in hdaa_sysctl_caps()
1215 w->param.eapdbtl, in hdaa_sysctl_caps()
1216 (w->param.eapdbtl & HDA_CMD_SET_EAPD_BTL_ENABLE_LR_SWAP) ? in hdaa_sysctl_caps()
1218 (w->param.eapdbtl & HDA_CMD_SET_EAPD_BTL_ENABLE_EAPD) ? in hdaa_sysctl_caps()
1220 (w->param.eapdbtl & HDA_CMD_SET_EAPD_BTL_ENABLE_BTL) ? in hdaa_sysctl_caps()
1223 if (HDA_PARAM_AUDIO_WIDGET_CAP_OUT_AMP(w->param.widget_cap) && in hdaa_sysctl_caps()
1224 w->param.outamp_cap != 0) in hdaa_sysctl_caps()
1225 hdaa_dump_amp_sb(&sb, w->param.outamp_cap, "Output"); in hdaa_sysctl_caps()
1226 if (HDA_PARAM_AUDIO_WIDGET_CAP_IN_AMP(w->param.widget_cap) && in hdaa_sysctl_caps()
1227 w->param.inamp_cap != 0) in hdaa_sysctl_caps()
1228 hdaa_dump_amp_sb(&sb, w->param.inamp_cap, " Input"); in hdaa_sysctl_caps()
1229 if (w->nconns > 0) in hdaa_sysctl_caps()
1230 sbuf_printf(&sb, " Connections: %d\n", w->nconns); in hdaa_sysctl_caps()
1231 for (j = 0; j < w->nconns; j++) { in hdaa_sysctl_caps()
1232 cw = hdaa_widget_get(devinfo, w->conns[j]); in hdaa_sysctl_caps()
1234 (w->connsenable[j] == 0)?"[DISABLED] ":"", in hdaa_sysctl_caps()
1235 w->conns[j], (cw == NULL) ? "GHOST!" : cw->name); in hdaa_sysctl_caps()
1240 if (w->nconns > 1 && w->selconn == j && w->type != in hdaa_sysctl_caps()
1351 struct hdaa_widget *w; in hdaa_local_patch() local
1357 w = hdaa_widget_get(devinfo, i); in hdaa_local_patch()
1358 if (w == NULL) in hdaa_local_patch()
1360 if (w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX) in hdaa_local_patch()
1361 hdaa_local_patch_pin(w); in hdaa_local_patch()
1408 hdaa_widget_connection_parse(struct hdaa_widget *w) in hdaa_widget_connection_parse() argument
1412 nid_t nid = w->nid; in hdaa_widget_connection_parse()
1415 w->nconns = 0; in hdaa_widget_connection_parse()
1417 res = hda_command(w->devinfo->dev, in hdaa_widget_connection_parse()
1426 max = (sizeof(w->conns) / sizeof(w->conns[0])) - 1; in hdaa_widget_connection_parse()
1436 res = hda_command(w->devinfo->dev, in hdaa_widget_connection_parse()
1441 if (w->nconns < ents) in hdaa_widget_connection_parse()
1442 device_printf(w->devinfo->dev, in hdaa_widget_connection_parse()
1447 ents, w->nconns, res); in hdaa_widget_connection_parse()
1451 if (cnid < w->devinfo->startnode || in hdaa_widget_connection_parse()
1452 cnid >= w->devinfo->endnode) { in hdaa_widget_connection_parse()
1454 device_printf(w->devinfo->dev, in hdaa_widget_connection_parse()
1464 device_printf(w->devinfo->dev, in hdaa_widget_connection_parse()
1474 if (w->nconns > max) { in hdaa_widget_connection_parse()
1475 device_printf(w->devinfo->dev, in hdaa_widget_connection_parse()
1481 w->connsenable[w->nconns] = 1; in hdaa_widget_connection_parse()
1482 w->conns[w->nconns++] = addcnid++; in hdaa_widget_connection_parse()
1493 hdaa_widget_parse(struct hdaa_widget *w) in hdaa_widget_parse() argument
1495 device_t dev = w->devinfo->dev; in hdaa_widget_parse()
1497 nid_t nid = w->nid; in hdaa_widget_parse()
1500 w->param.widget_cap = wcap = hda_command(dev, in hdaa_widget_parse()
1502 w->type = HDA_PARAM_AUDIO_WIDGET_CAP_TYPE(wcap); in hdaa_widget_parse()
1504 hdaa_widget_connection_parse(w); in hdaa_widget_parse()
1508 w->param.outamp_cap = in hdaa_widget_parse()
1513 w->param.outamp_cap = in hdaa_widget_parse()
1514 w->devinfo->outamp_cap; in hdaa_widget_parse()
1516 w->param.outamp_cap = 0; in hdaa_widget_parse()
1520 w->param.inamp_cap = in hdaa_widget_parse()
1525 w->param.inamp_cap = in hdaa_widget_parse()
1526 w->devinfo->inamp_cap; in hdaa_widget_parse()
1528 w->param.inamp_cap = 0; in hdaa_widget_parse()
1530 if (w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_OUTPUT || in hdaa_widget_parse()
1531 w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_INPUT) { in hdaa_widget_parse()
1536 w->param.supp_stream_formats = (cap != 0) ? cap : in hdaa_widget_parse()
1537 w->devinfo->supp_stream_formats; in hdaa_widget_parse()
1541 w->param.supp_pcm_size_rate = (cap != 0) ? cap : in hdaa_widget_parse()
1542 w->devinfo->supp_pcm_size_rate; in hdaa_widget_parse()
1544 w->param.supp_stream_formats = in hdaa_widget_parse()
1545 w->devinfo->supp_stream_formats; in hdaa_widget_parse()
1546 w->param.supp_pcm_size_rate = in hdaa_widget_parse()
1547 w->devinfo->supp_pcm_size_rate; in hdaa_widget_parse()
1549 if (HDA_PARAM_AUDIO_WIDGET_CAP_STRIPE(w->param.widget_cap)) { in hdaa_widget_parse()
1550 w->wclass.conv.stripecap = hda_command(dev, in hdaa_widget_parse()
1551 HDA_CMD_GET_STRIPE_CONTROL(0, w->nid)) >> 20; in hdaa_widget_parse()
1553 w->wclass.conv.stripecap = 1; in hdaa_widget_parse()
1555 w->param.supp_stream_formats = 0; in hdaa_widget_parse()
1556 w->param.supp_pcm_size_rate = 0; in hdaa_widget_parse()
1559 if (w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX) { in hdaa_widget_parse()
1560 w->wclass.pin.original = w->wclass.pin.newconf = in hdaa_widget_parse()
1561 w->wclass.pin.config = hda_command(dev, in hdaa_widget_parse()
1562 HDA_CMD_GET_CONFIGURATION_DEFAULT(0, w->nid)); in hdaa_widget_parse()
1563 w->wclass.pin.cap = hda_command(dev, in hdaa_widget_parse()
1564 HDA_CMD_GET_PARAMETER(0, w->nid, HDA_PARAM_PIN_CAP)); in hdaa_widget_parse()
1565 w->wclass.pin.ctrl = hda_command(dev, in hdaa_widget_parse()
1567 w->wclass.pin.connected = 2; in hdaa_widget_parse()
1568 if (HDA_PARAM_PIN_CAP_EAPD_CAP(w->wclass.pin.cap)) { in hdaa_widget_parse()
1569 w->param.eapdbtl = hda_command(dev, in hdaa_widget_parse()
1571 w->param.eapdbtl &= 0x7; in hdaa_widget_parse()
1572 w->param.eapdbtl |= HDA_CMD_SET_EAPD_BTL_ENABLE_EAPD; in hdaa_widget_parse()
1574 w->param.eapdbtl = HDA_INVALID; in hdaa_widget_parse()
1576 w->unsol = -1; in hdaa_widget_parse()
1578 hdaa_unlock(w->devinfo); in hdaa_widget_parse()
1579 snprintf(buf, sizeof(buf), "nid%d", w->nid); in hdaa_widget_parse()
1583 w, 0, hdaa_sysctl_caps, "A", "Node capabilities"); in hdaa_widget_parse()
1584 if (w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX) { in hdaa_widget_parse()
1585 snprintf(buf, sizeof(buf), "nid%d_config", w->nid); in hdaa_widget_parse()
1589 &w->wclass.pin.newconf, 0, hdaa_sysctl_config, "A", in hdaa_widget_parse()
1591 snprintf(buf, sizeof(buf), "nid%d_original", w->nid); in hdaa_widget_parse()
1595 &w->wclass.pin.original, 0, hdaa_sysctl_config, "A", in hdaa_widget_parse()
1598 hdaa_lock(w->devinfo); in hdaa_widget_parse()
1602 hdaa_widget_postprocess(struct hdaa_widget *w) in hdaa_widget_postprocess() argument
1606 w->type = HDA_PARAM_AUDIO_WIDGET_CAP_TYPE(w->param.widget_cap); in hdaa_widget_postprocess()
1607 switch (w->type) { in hdaa_widget_postprocess()
1639 strlcpy(w->name, typestr, sizeof(w->name)); in hdaa_widget_postprocess()
1641 if (w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX) { in hdaa_widget_postprocess()
1646 config = w->wclass.pin.config; in hdaa_widget_postprocess()
1653 strlcat(w->name, ": ", sizeof(w->name)); in hdaa_widget_postprocess()
1654 strlcat(w->name, devstr, sizeof(w->name)); in hdaa_widget_postprocess()
1655 strlcat(w->name, " (", sizeof(w->name)); in hdaa_widget_postprocess()
1657 strlcat(w->name, HDA_COLORS[color], sizeof(w->name)); in hdaa_widget_postprocess()
1658 strlcat(w->name, " ", sizeof(w->name)); in hdaa_widget_postprocess()
1660 strlcat(w->name, HDA_CONNS[conn], sizeof(w->name)); in hdaa_widget_postprocess()
1661 strlcat(w->name, ")", sizeof(w->name)); in hdaa_widget_postprocess()
1739 hdaa_widget_connection_select(struct hdaa_widget *w, uint8_t index) in hdaa_widget_connection_select() argument
1741 if (w == NULL || w->nconns < 1 || index > (w->nconns - 1)) in hdaa_widget_connection_select()
1744 device_printf(w->devinfo->dev, in hdaa_widget_connection_select()
1745 "Setting selector nid=%d index=%d\n", w->nid, index); in hdaa_widget_connection_select()
1747 hda_command(w->devinfo->dev, in hdaa_widget_connection_select()
1748 HDA_CMD_SET_CONNECTION_SELECT_CONTROL(0, w->nid, index)); in hdaa_widget_connection_select()
1749 w->selconn = index; in hdaa_widget_connection_select()
1871 struct hdaa_widget *w, *wp; in hdaa_audio_setup() local
1916 w = hdaa_widget_get(ch->devinfo, ch->io[i]); in hdaa_audio_setup()
1917 if (w == NULL) in hdaa_audio_setup()
1937 if (HDA_PARAM_AUDIO_WIDGET_CAP_DIGITAL(w->param.widget_cap)) { in hdaa_audio_setup()
1943 if (HDA_PARAM_AUDIO_WIDGET_CAP_STRIPE(w->param.widget_cap)) { in hdaa_audio_setup()
1945 HDA_CMD_SET_STRIPE_CONTROL(0, w->nid, ch->stripectl)); in hdaa_audio_setup()
1947 cchn = HDA_PARAM_AUDIO_WIDGET_CAP_CC(w->param.widget_cap); in hdaa_audio_setup()
2011 if (w->eld != NULL && w->eld_len >= 6 && in hdaa_audio_setup()
2012 ((w->eld[5] >> 2) & 0x3) == 1) { /* DisplayPort */ in hdaa_audio_setup()
2130 struct hdaa_widget *w; in hdaa_channel_stop() local
2139 w = hdaa_widget_get(ch->devinfo, ch->io[i]); in hdaa_channel_stop()
2140 if (w == NULL) in hdaa_channel_stop()
2142 if (HDA_PARAM_AUDIO_WIDGET_CAP_DIGITAL(w->param.widget_cap)) { in hdaa_channel_stop()
2253 struct hdaa_widget *w, *cw; in hdaa_audio_ctl_ossmixer_init() local
2271 w = hdaa_widget_get(devinfo, i); in hdaa_audio_ctl_ossmixer_init()
2272 if (w == NULL || w->enable == 0) in hdaa_audio_ctl_ossmixer_init()
2274 if (w->type != HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX || in hdaa_audio_ctl_ossmixer_init()
2275 w->param.eapdbtl == HDA_INVALID || in hdaa_audio_ctl_ossmixer_init()
2276 w->bindas != pdevinfo->playas) in hdaa_audio_ctl_ossmixer_init()
2315 w = hdaa_widget_get(devinfo, in hdaa_audio_ctl_ossmixer_init()
2317 if (w == NULL || w->enable == 0) in hdaa_audio_ctl_ossmixer_init()
2319 for (j = 0; j < w->nconns; j++) { in hdaa_audio_ctl_ossmixer_init()
2320 if (w->connsenable[j] == 0) in hdaa_audio_ctl_ossmixer_init()
2322 cw = hdaa_widget_get(devinfo, w->conns[j]); in hdaa_audio_ctl_ossmixer_init()
2383 struct hdaa_widget *w, *wc; in hdaa_audio_ctl_source_volume() local
2390 w = hdaa_widget_get(devinfo, nid); in hdaa_audio_ctl_source_volume()
2391 if (w == NULL || w->enable == 0) in hdaa_audio_ctl_source_volume()
2396 for (j = 0; j < w->nconns; j++) { in hdaa_audio_ctl_source_volume()
2397 if (!w->connsenable[j]) in hdaa_audio_ctl_source_volume()
2406 w->type != HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX)) { in hdaa_audio_ctl_source_volume()
2407 ctl = hdaa_audio_ctl_amp_get(devinfo, w->nid, HDAA_CTL_IN, in hdaa_audio_ctl_source_volume()
2415 if (w->ossdev >= 0 && depth > 0) in hdaa_audio_ctl_source_volume()
2419 if ((w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_INPUT || in hdaa_audio_ctl_source_volume()
2420 w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX) && in hdaa_audio_ctl_source_volume()
2429 (w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_MIXER || in hdaa_audio_ctl_source_volume()
2430 w->selconn != index)) in hdaa_audio_ctl_source_volume()
2433 ctl = hdaa_audio_ctl_amp_get(devinfo, w->nid, HDAA_CTL_OUT, -1, 1); in hdaa_audio_ctl_source_volume()
2460 struct hdaa_widget *w, *wc; in hdaa_audio_ctl_dest_volume() local
2467 w = hdaa_widget_get(devinfo, nid); in hdaa_audio_ctl_dest_volume()
2468 if (w == NULL || w->enable == 0) in hdaa_audio_ctl_dest_volume()
2488 if ((consumers == 2 && (w->bindas < 0 || in hdaa_audio_ctl_dest_volume()
2489 as[w->bindas].hpredir < 0 || as[w->bindas].fakeredir || in hdaa_audio_ctl_dest_volume()
2490 (w->bindseqmask & (1 << 15)) == 0)) || in hdaa_audio_ctl_dest_volume()
2495 ctl = hdaa_audio_ctl_amp_get(devinfo, w->nid, in hdaa_audio_ctl_dest_volume()
2502 if (w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX && in hdaa_audio_ctl_dest_volume()
2506 for (i = 0; i < w->nconns; i++) { in hdaa_audio_ctl_dest_volume()
2507 if (w->connsenable[i] == 0) in hdaa_audio_ctl_dest_volume()
2513 ctl = hdaa_audio_ctl_amp_get(devinfo, w->nid, in hdaa_audio_ctl_dest_volume()
2517 hdaa_audio_ctl_dest_volume(pdevinfo, ossdev, w->conns[i], -1, in hdaa_audio_ctl_dest_volume()
2529 struct hdaa_widget *w, *cw; in hdaa_audio_ctl_dev_volume() local
2548 w = hdaa_widget_get(devinfo, i); in hdaa_audio_ctl_dev_volume()
2549 if (w == NULL || w->enable == 0) in hdaa_audio_ctl_dev_volume()
2551 if (w->bindas < 0) { in hdaa_audio_ctl_dev_volume()
2555 if (w->bindas != pdevinfo->playas && in hdaa_audio_ctl_dev_volume()
2556 w->bindas != pdevinfo->recas) in hdaa_audio_ctl_dev_volume()
2560 w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_INPUT) { in hdaa_audio_ctl_dev_volume()
2562 w->nid, -1, mute, lvol, rvol, 0); in hdaa_audio_ctl_dev_volume()
2566 w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX && in hdaa_audio_ctl_dev_volume()
2567 devinfo->as[w->bindas].dir == HDAA_CTL_OUT) { in hdaa_audio_ctl_dev_volume()
2569 w->nid, -1, mute, lvol, rvol, 0); in hdaa_audio_ctl_dev_volume()
2573 w->pflags & HDAA_ADC_MONITOR) { in hdaa_audio_ctl_dev_volume()
2574 for (j = 0; j < w->nconns; j++) { in hdaa_audio_ctl_dev_volume()
2575 if (!w->connsenable[j]) in hdaa_audio_ctl_dev_volume()
2577 cw = hdaa_widget_get(devinfo, w->conns[j]); in hdaa_audio_ctl_dev_volume()
2586 w->nid, j, mute, lvol, rvol, 0); in hdaa_audio_ctl_dev_volume()
2590 if (w->ossdev != dev) in hdaa_audio_ctl_dev_volume()
2593 w->nid, -1, mute, lvol, rvol, 0); in hdaa_audio_ctl_dev_volume()
2594 if (dev == SOUND_MIXER_IMIX && (w->pflags & HDAA_IMIX_AS_DST)) in hdaa_audio_ctl_dev_volume()
2596 w->nid, -1, mute, lvol, rvol, 0); in hdaa_audio_ctl_dev_volume()
2609 struct hdaa_widget *w; in hdaa_audio_ctl_ossmixer_set() local
2621 w = NULL; in hdaa_audio_ctl_ossmixer_set()
2623 w = hdaa_widget_get(devinfo, i); in hdaa_audio_ctl_ossmixer_set()
2624 if (w == NULL || w->enable == 0) in hdaa_audio_ctl_ossmixer_set()
2626 if (w->type != HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX || in hdaa_audio_ctl_ossmixer_set()
2627 w->param.eapdbtl == HDA_INVALID) in hdaa_audio_ctl_ossmixer_set()
2635 orig = w->param.eapdbtl; in hdaa_audio_ctl_ossmixer_set()
2637 w->param.eapdbtl &= ~HDA_CMD_SET_EAPD_BTL_ENABLE_EAPD; in hdaa_audio_ctl_ossmixer_set()
2639 w->param.eapdbtl |= HDA_CMD_SET_EAPD_BTL_ENABLE_EAPD; in hdaa_audio_ctl_ossmixer_set()
2640 if (orig != w->param.eapdbtl) { in hdaa_audio_ctl_ossmixer_set()
2643 val = w->param.eapdbtl; in hdaa_audio_ctl_ossmixer_set()
2647 HDA_CMD_SET_EAPD_BTL_ENABLE(0, w->nid, val)); in hdaa_audio_ctl_ossmixer_set()
2710 struct hdaa_widget *w, *cw; in hdaa_audio_ctl_recsel_comm() local
2719 w = hdaa_widget_get(devinfo, nid); in hdaa_audio_ctl_recsel_comm()
2720 if (w == NULL || w->enable == 0) in hdaa_audio_ctl_recsel_comm()
2723 for (i = 0; i < w->nconns; i++) { in hdaa_audio_ctl_recsel_comm()
2724 if (w->connsenable[i] == 0) in hdaa_audio_ctl_recsel_comm()
2726 cw = hdaa_widget_get(devinfo, w->conns[i]); in hdaa_audio_ctl_recsel_comm()
2733 w->conns[i], depth + 1); in hdaa_audio_ctl_recsel_comm()
2739 if (w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_MIXER) { in hdaa_audio_ctl_recsel_comm()
2741 w->nid, HDAA_CTL_IN, i, 1); in hdaa_audio_ctl_recsel_comm()
2761 if (w->nconns == 1) in hdaa_audio_ctl_recsel_comm()
2766 hdaa_widget_connection_select(w, i); in hdaa_audio_ctl_recsel_comm()
2785 struct hdaa_widget *w; in hdaa_audio_ctl_ossmixer_setrecsrc() local
2809 w = hdaa_widget_get(devinfo, ch->io[i]); in hdaa_audio_ctl_ossmixer_setrecsrc()
2810 if (w == NULL || w->enable == 0) in hdaa_audio_ctl_ossmixer_setrecsrc()
2951 struct hdaa_widget *w; in hdaa_audio_parse() local
2993 w = hdaa_widget_get(devinfo, i); in hdaa_audio_parse()
2994 if (w == NULL) in hdaa_audio_parse()
2997 w->devinfo = devinfo; in hdaa_audio_parse()
2998 w->nid = i; in hdaa_audio_parse()
2999 w->enable = 1; in hdaa_audio_parse()
3000 w->selconn = -1; in hdaa_audio_parse()
3001 w->pflags = 0; in hdaa_audio_parse()
3002 w->ossdev = -1; in hdaa_audio_parse()
3003 w->bindas = -1; in hdaa_audio_parse()
3004 w->param.eapdbtl = HDA_INVALID; in hdaa_audio_parse()
3005 hdaa_widget_parse(w); in hdaa_audio_parse()
3013 struct hdaa_widget *w; in hdaa_audio_postprocess() local
3017 w = hdaa_widget_get(devinfo, i); in hdaa_audio_postprocess()
3018 if (w == NULL) in hdaa_audio_postprocess()
3020 hdaa_widget_postprocess(w); in hdaa_audio_postprocess()
3028 struct hdaa_widget *w, *cw; in hdaa_audio_ctl_parse() local
3035 w = hdaa_widget_get(devinfo, i); in hdaa_audio_ctl_parse()
3036 if (w == NULL || w->enable == 0) in hdaa_audio_ctl_parse()
3038 if (w->param.outamp_cap != 0) in hdaa_audio_ctl_parse()
3040 if (w->param.inamp_cap != 0) { in hdaa_audio_ctl_parse()
3041 switch (w->type) { in hdaa_audio_ctl_parse()
3044 for (j = 0; j < w->nconns; j++) { in hdaa_audio_ctl_parse()
3046 w->conns[j]); in hdaa_audio_ctl_parse()
3079 w = hdaa_widget_get(devinfo, i); in hdaa_audio_ctl_parse()
3080 if (w == NULL || w->enable == 0) in hdaa_audio_ctl_parse()
3082 ocap = w->param.outamp_cap; in hdaa_audio_ctl_parse()
3083 icap = w->param.inamp_cap; in hdaa_audio_ctl_parse()
3094 w->nid, offset, step); in hdaa_audio_ctl_parse()
3099 ctls[cnt].widget = w; in hdaa_audio_ctl_parse()
3106 if (w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX || in hdaa_audio_ctl_parse()
3107 w->waspin) in hdaa_audio_ctl_parse()
3124 w->nid, offset, step); in hdaa_audio_ctl_parse()
3128 switch (w->type) { in hdaa_audio_ctl_parse()
3131 for (j = 0; j < w->nconns; j++) { in hdaa_audio_ctl_parse()
3139 w->conns[j]); in hdaa_audio_ctl_parse()
3143 ctls[cnt].widget = w; in hdaa_audio_ctl_parse()
3164 ctls[cnt].widget = w; in hdaa_audio_ctl_parse()
3171 if (w->type == in hdaa_audio_ctl_parse()
3189 struct hdaa_widget *w; in hdaa_audio_as_parse() local
3196 w = hdaa_widget_get(devinfo, i); in hdaa_audio_as_parse()
3197 if (w == NULL || w->enable == 0) in hdaa_audio_as_parse()
3199 if (w->type != HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX) in hdaa_audio_as_parse()
3201 if (HDA_CONFIG_DEFAULTCONF_ASSOCIATION(w->wclass.pin.config) in hdaa_audio_as_parse()
3237 w = hdaa_widget_get(devinfo, i); in hdaa_audio_as_parse()
3238 if (w == NULL || w->enable == 0) in hdaa_audio_as_parse()
3240 if (w->type != HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX) in hdaa_audio_as_parse()
3242 assoc = HDA_CONFIG_DEFAULTCONF_ASSOCIATION(w->wclass.pin.config); in hdaa_audio_as_parse()
3243 seq = HDA_CONFIG_DEFAULTCONF_SEQUENCE(w->wclass.pin.config); in hdaa_audio_as_parse()
3250 type = w->wclass.pin.config & in hdaa_audio_as_parse()
3273 __func__, seq, w->nid, j); in hdaa_audio_as_parse()
3280 __func__, w->nid, j); in hdaa_audio_as_parse()
3283 if (HDA_PARAM_AUDIO_WIDGET_CAP_DIGITAL(w->param.widget_cap)) { in hdaa_audio_as_parse()
3285 if (HDA_PARAM_PIN_CAP_HDMI(w->wclass.pin.cap)) in hdaa_audio_as_parse()
3287 if (HDA_PARAM_PIN_CAP_DP(w->wclass.pin.cap)) in hdaa_audio_as_parse()
3292 HDA_CONFIG_DEFAULTCONF_LOCATION(w->wclass.pin.config); in hdaa_audio_as_parse()
3294 HDA_CONFIG_DEFAULTCONF_LOCATION(w->wclass.pin.config)) { in hdaa_audio_as_parse()
3301 as[cnt].pins[seq] = w->nid; in hdaa_audio_as_parse()
3346 struct hdaa_widget *w; in hdaa_audio_trace_dac() local
3352 w = hdaa_widget_get(devinfo, nid); in hdaa_audio_trace_dac()
3353 if (w == NULL || w->enable == 0) in hdaa_audio_trace_dac()
3359 depth + 1, "", w->nid); in hdaa_audio_trace_dac()
3363 if (w->bindas >= 0 && w->bindas != as) { in hdaa_audio_trace_dac()
3368 depth + 1, "", w->nid, w->bindas); in hdaa_audio_trace_dac()
3374 if (w->bindseqmask != 0) { in hdaa_audio_trace_dac()
3379 depth + 1, "", w->nid, w->bindseqmask); in hdaa_audio_trace_dac()
3386 if (w->bindseqmask != 0 && in hdaa_audio_trace_dac()
3387 (w->bindseqmask & (1 << dupseq)) == 0) { in hdaa_audio_trace_dac()
3391 depth + 1, "", w->nid, w->bindseqmask); in hdaa_audio_trace_dac()
3397 switch (w->type) { in hdaa_audio_trace_dac()
3404 if ((only == 0 || only == w->nid) && in hdaa_audio_trace_dac()
3405 (w->nid >= min) && (dupseq < 0 || w->nid == in hdaa_audio_trace_dac()
3407 m = w->nid; in hdaa_audio_trace_dac()
3415 for (i = 0; i < w->nconns; i++) { in hdaa_audio_trace_dac()
3416 if (w->connsenable[i] == 0) in hdaa_audio_trace_dac()
3418 if (w->selconn != -1 && w->selconn != i) in hdaa_audio_trace_dac()
3421 w->conns[i], dupseq, min, only, depth + 1)) != 0) { in hdaa_audio_trace_dac()
3430 if (im >= 0 && only && ((w->nconns > 1 && in hdaa_audio_trace_dac()
3431 w->type != HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_MIXER) || in hdaa_audio_trace_dac()
3432 w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_SELECTOR)) in hdaa_audio_trace_dac()
3433 w->selconn = im; in hdaa_audio_trace_dac()
3437 w->bindas = as; in hdaa_audio_trace_dac()
3438 w->bindseqmask |= (1 << seq); in hdaa_audio_trace_dac()
3444 depth + 1, "", w->nid, m); in hdaa_audio_trace_dac()
3457 struct hdaa_widget *w, *wc; in hdaa_audio_trace_adc() local
3463 w = hdaa_widget_get(devinfo, nid); in hdaa_audio_trace_adc()
3464 if (w == NULL || w->enable == 0) in hdaa_audio_trace_adc()
3469 depth + 1, "", w->nid); in hdaa_audio_trace_adc()
3472 if (w->bindas >= 0 && w->bindas != as) { in hdaa_audio_trace_adc()
3476 depth + 1, "", w->nid, w->bindas); in hdaa_audio_trace_adc()
3480 if (!mixed && w->bindseqmask != 0) { in hdaa_audio_trace_adc()
3484 depth + 1, "", w->nid, w->bindseqmask); in hdaa_audio_trace_adc()
3488 switch (w->type) { in hdaa_audio_trace_adc()
3490 if ((only == 0 || only == w->nid) && (w->nid >= min) && in hdaa_audio_trace_adc()
3492 m = w->nid; in hdaa_audio_trace_adc()
3534 w->bindas = as; in hdaa_audio_trace_adc()
3535 w->bindseqmask |= (1 << seq); in hdaa_audio_trace_adc()
3540 depth + 1, "", w->nid, m); in hdaa_audio_trace_adc()
3551 struct hdaa_widget *w; in hdaa_audio_undo_trace() local
3555 w = hdaa_widget_get(devinfo, i); in hdaa_audio_undo_trace()
3556 if (w == NULL || w->enable == 0) in hdaa_audio_undo_trace()
3558 if (w->bindas == as) { in hdaa_audio_undo_trace()
3560 w->bindseqmask &= ~(1 << seq); in hdaa_audio_undo_trace()
3561 if (w->bindseqmask == 0) { in hdaa_audio_undo_trace()
3562 w->bindas = -1; in hdaa_audio_undo_trace()
3563 w->selconn = -1; in hdaa_audio_undo_trace()
3566 w->bindas = -1; in hdaa_audio_undo_trace()
3567 w->bindseqmask = 0; in hdaa_audio_undo_trace()
3568 w->selconn = -1; in hdaa_audio_undo_trace()
3804 struct hdaa_widget *w; in hdaa_audio_trace_as_in() local
3808 w = hdaa_widget_get(devinfo, j); in hdaa_audio_trace_as_in()
3809 if (w == NULL || w->enable == 0) in hdaa_audio_trace_as_in()
3811 if (w->type != HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_INPUT) in hdaa_audio_trace_as_in()
3813 if (w->bindas >= 0 && w->bindas != as) in hdaa_audio_trace_as_in()
3918 struct hdaa_widget *w, *wc; in hdaa_audio_trace_to_out() local
3924 w = hdaa_widget_get(devinfo, nid); in hdaa_audio_trace_to_out()
3925 if (w == NULL || w->enable == 0) in hdaa_audio_trace_to_out()
3930 depth + 1, "", w->nid); in hdaa_audio_trace_to_out()
3933 if (depth > 0 && w->bindas != -1) { in hdaa_audio_trace_to_out()
3934 if (w->bindas < 0 || ases[w->bindas].dir == HDAA_CTL_OUT) { in hdaa_audio_trace_to_out()
3938 depth + 1, "", w->nid, w->bindas); in hdaa_audio_trace_to_out()
3940 if (w->bindas >= 0) in hdaa_audio_trace_to_out()
3941 w->pflags |= HDAA_ADC_MONITOR; in hdaa_audio_trace_to_out()
3947 depth + 1, "", w->nid, w->bindas); in hdaa_audio_trace_to_out()
3953 switch (w->type) { in hdaa_audio_trace_to_out()
3984 if (res && w->bindas == -1) in hdaa_audio_trace_to_out()
3985 w->bindas = -2; in hdaa_audio_trace_to_out()
3990 depth + 1, "", w->nid, res); in hdaa_audio_trace_to_out()
4002 struct hdaa_widget *w; in hdaa_audio_trace_as_extra() local
4013 w = hdaa_widget_get(devinfo, j); in hdaa_audio_trace_as_extra()
4014 if (w == NULL || w->enable == 0) in hdaa_audio_trace_as_extra()
4016 if (w->type != HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_MIXER) in hdaa_audio_trace_as_extra()
4018 if (w->bindas < 0 || as[w->bindas].dir != HDAA_CTL_IN) in hdaa_audio_trace_as_extra()
4025 if (hdaa_audio_trace_to_out(devinfo, w->nid, 0)) { in hdaa_audio_trace_as_extra()
4029 w->nid); in hdaa_audio_trace_as_extra()
4031 w->ossdev = SOUND_MIXER_IMIX; in hdaa_audio_trace_as_extra()
4043 w = hdaa_widget_get(devinfo, j); in hdaa_audio_trace_as_extra()
4044 if (w == NULL || w->enable == 0) in hdaa_audio_trace_as_extra()
4046 if (w->type != HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX) in hdaa_audio_trace_as_extra()
4048 if (w->bindas < 0 || as[w->bindas].dir != HDAA_CTL_IN) in hdaa_audio_trace_as_extra()
4055 if (hdaa_audio_trace_to_out(devinfo, w->nid, 0)) { in hdaa_audio_trace_as_extra()
4059 w->nid); in hdaa_audio_trace_as_extra()
4070 w = hdaa_widget_get(devinfo, j); in hdaa_audio_trace_as_extra()
4071 if (w == NULL || w->enable == 0) in hdaa_audio_trace_as_extra()
4073 if (w->type != HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_BEEP_WIDGET) in hdaa_audio_trace_as_extra()
4080 if (hdaa_audio_trace_to_out(devinfo, w->nid, 0)) { in hdaa_audio_trace_as_extra()
4087 w->bindas = -2; in hdaa_audio_trace_as_extra()
4153 struct hdaa_widget *w; in hdaa_audio_disable_nonaudio() local
4158 w = hdaa_widget_get(devinfo, i); in hdaa_audio_disable_nonaudio()
4159 if (w == NULL || w->enable == 0) in hdaa_audio_disable_nonaudio()
4161 if (w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_POWER_WIDGET || in hdaa_audio_disable_nonaudio()
4162 w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_VOLUME_WIDGET) { in hdaa_audio_disable_nonaudio()
4163 w->enable = 0; in hdaa_audio_disable_nonaudio()
4168 w->nid); in hdaa_audio_disable_nonaudio()
4177 struct hdaa_widget *w, *cw; in hdaa_audio_disable_useless() local
4183 w = hdaa_widget_get(devinfo, i); in hdaa_audio_disable_useless()
4184 if (w == NULL || w->enable == 0) in hdaa_audio_disable_useless()
4186 if (w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX) { in hdaa_audio_disable_useless()
4187 if ((w->wclass.pin.config & in hdaa_audio_disable_useless()
4190 w->enable = 0; in hdaa_audio_disable_useless()
4195 w->nid); in hdaa_audio_disable_useless()
4197 } else if ((w->wclass.pin.config & in hdaa_audio_disable_useless()
4199 w->enable = 0; in hdaa_audio_disable_useless()
4204 w->nid); in hdaa_audio_disable_useless()
4239 w = hdaa_widget_get(devinfo, i); in hdaa_audio_disable_useless()
4240 if (w == NULL || w->enable == 0) in hdaa_audio_disable_useless()
4243 for (j = 0; j < w->nconns; j++) { in hdaa_audio_disable_useless()
4244 if (w->connsenable[j]) { in hdaa_audio_disable_useless()
4245 cw = hdaa_widget_get(devinfo, w->conns[j]); in hdaa_audio_disable_useless()
4247 w->connsenable[j] = 0; in hdaa_audio_disable_useless()
4257 if (w->type != HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_SELECTOR && in hdaa_audio_disable_useless()
4258 w->type != HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_MIXER) in hdaa_audio_disable_useless()
4262 for (j = 0; j < w->nconns; j++) { in hdaa_audio_disable_useless()
4263 if (w->connsenable[j]) { in hdaa_audio_disable_useless()
4269 w->enable = 0; in hdaa_audio_disable_useless()
4274 " inputs disabled.\n", w->nid); in hdaa_audio_disable_useless()
4278 if (w->type != HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_SELECTOR && in hdaa_audio_disable_useless()
4279 w->type != HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_MIXER) in hdaa_audio_disable_useless()
4294 w->enable = 0; in hdaa_audio_disable_useless()
4299 " consumers disabled.\n", w->nid); in hdaa_audio_disable_useless()
4311 struct hdaa_widget *w, *cw; in hdaa_audio_disable_unas() local
4317 w = hdaa_widget_get(devinfo, i); in hdaa_audio_disable_unas()
4318 if (w == NULL || w->enable == 0) in hdaa_audio_disable_unas()
4320 if (w->bindas == -1) { in hdaa_audio_disable_unas()
4321 w->enable = 0; in hdaa_audio_disable_unas()
4325 w->nid); in hdaa_audio_disable_unas()
4332 w = hdaa_widget_get(devinfo, i); in hdaa_audio_disable_unas()
4333 if (w == NULL || w->enable == 0) in hdaa_audio_disable_unas()
4335 if (w->type != HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX) in hdaa_audio_disable_unas()
4337 if (w->bindas < 0) in hdaa_audio_disable_unas()
4339 if (as[w->bindas].dir == HDAA_CTL_IN) { in hdaa_audio_disable_unas()
4340 for (j = 0; j < w->nconns; j++) { in hdaa_audio_disable_unas()
4341 if (w->connsenable[j] == 0) in hdaa_audio_disable_unas()
4343 w->connsenable[j] = 0; in hdaa_audio_disable_unas()
4351 ctl = hdaa_audio_ctl_amp_get(devinfo, w->nid, in hdaa_audio_disable_unas()
4361 ctl = hdaa_audio_ctl_amp_get(devinfo, w->nid, in hdaa_audio_disable_unas()
4406 struct hdaa_widget *w; in hdaa_audio_disable_notselected() local
4411 w = hdaa_widget_get(devinfo, i); in hdaa_audio_disable_notselected()
4412 if (w == NULL || w->enable == 0) in hdaa_audio_disable_notselected()
4414 if (w->nconns <= 1) in hdaa_audio_disable_notselected()
4416 if (w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_MIXER) in hdaa_audio_disable_notselected()
4418 if (w->bindas < 0 || as[w->bindas].dir == HDAA_CTL_IN) in hdaa_audio_disable_notselected()
4420 for (j = 0; j < w->nconns; j++) { in hdaa_audio_disable_notselected()
4421 if (w->connsenable[j] == 0) in hdaa_audio_disable_notselected()
4423 if (w->selconn < 0 || w->selconn == j) in hdaa_audio_disable_notselected()
4425 w->connsenable[j] = 0; in hdaa_audio_disable_notselected()
4440 struct hdaa_widget *w, *cw; in hdaa_audio_disable_crossas() local
4447 w = hdaa_widget_get(devinfo, i); in hdaa_audio_disable_crossas()
4448 if (w == NULL || w->enable == 0) in hdaa_audio_disable_crossas()
4450 if (w->nconns <= 1) in hdaa_audio_disable_crossas()
4452 if (w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_MIXER) in hdaa_audio_disable_crossas()
4455 if (w->bindas == -2) in hdaa_audio_disable_crossas()
4457 for (j = 0; j < w->nconns; j++) { in hdaa_audio_disable_crossas()
4458 if (w->connsenable[j] == 0) in hdaa_audio_disable_crossas()
4460 cw = hdaa_widget_get(devinfo, w->conns[j]); in hdaa_audio_disable_crossas()
4461 if (cw == NULL || w->enable == 0) in hdaa_audio_disable_crossas()
4464 if (cw->bindas == -2 && w->bindas >= 0 && in hdaa_audio_disable_crossas()
4465 ases[w->bindas].dir == HDAA_CTL_OUT) in hdaa_audio_disable_crossas()
4468 if (cw->bindas == -2 && w->bindas >= 0 && in hdaa_audio_disable_crossas()
4469 ases[w->bindas].mixed) in hdaa_audio_disable_crossas()
4472 if ((w->pflags & HDAA_ADC_MONITOR) && in hdaa_audio_disable_crossas()
4477 if (w->bindas == cw->bindas && in hdaa_audio_disable_crossas()
4478 (w->bindseqmask & cw->bindseqmask) != 0) in hdaa_audio_disable_crossas()
4480 w->connsenable[j] = 0; in hdaa_audio_disable_crossas()
4542 struct hdaa_widget *w, *wc; in hdaa_audio_ctl_source_amp() local
4549 w = hdaa_widget_get(devinfo, nid); in hdaa_audio_ctl_source_amp()
4550 if (w == NULL || w->enable == 0) in hdaa_audio_ctl_source_amp()
4555 for (j = 0; j < w->nconns; j++) { in hdaa_audio_ctl_source_amp()
4556 if (!w->connsenable[j]) in hdaa_audio_ctl_source_amp()
4565 w->type != HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX)) { in hdaa_audio_ctl_source_amp()
4566 ctl = hdaa_audio_ctl_amp_get(devinfo, w->nid, HDAA_CTL_IN, in hdaa_audio_ctl_source_amp()
4580 if (w->ossdev >= 0 && depth > 0) in hdaa_audio_ctl_source_amp()
4584 if ((w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_INPUT || in hdaa_audio_ctl_source_amp()
4585 w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX) && in hdaa_audio_ctl_source_amp()
4590 w->ossmask |= (1 << ossdev); in hdaa_audio_ctl_source_amp()
4597 w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_MIXER) in hdaa_audio_ctl_source_amp()
4601 ctl = hdaa_audio_ctl_amp_get(devinfo, w->nid, HDAA_CTL_OUT, -1, 1); in hdaa_audio_ctl_source_amp()
4649 struct hdaa_widget *w, *wc; in hdaa_audio_ctl_dest_amp() local
4656 w = hdaa_widget_get(devinfo, nid); in hdaa_audio_ctl_dest_amp()
4657 if (w == NULL || w->enable == 0) in hdaa_audio_ctl_dest_amp()
4677 if ((consumers == 2 && (w->bindas < 0 || in hdaa_audio_ctl_dest_amp()
4678 as[w->bindas].hpredir < 0 || as[w->bindas].fakeredir || in hdaa_audio_ctl_dest_amp()
4679 (w->bindseqmask & (1 << 15)) == 0)) || in hdaa_audio_ctl_dest_amp()
4684 ctl = hdaa_audio_ctl_amp_get(devinfo, w->nid, in hdaa_audio_ctl_dest_amp()
4697 if (w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX && in hdaa_audio_ctl_dest_amp()
4702 for (i = 0; i < w->nconns; i++) { in hdaa_audio_ctl_dest_amp()
4703 if (w->connsenable[i] == 0) in hdaa_audio_ctl_dest_amp()
4708 ctl = hdaa_audio_ctl_amp_get(devinfo, w->nid, in hdaa_audio_ctl_dest_amp()
4718 found += hdaa_audio_ctl_dest_amp(devinfo, w->conns[i], -1, ossdev, in hdaa_audio_ctl_dest_amp()
4742 struct hdaa_widget *w; in hdaa_audio_assign_names() local
4763 w = hdaa_widget_get(devinfo, i); in hdaa_audio_assign_names()
4764 if (w == NULL || w->enable == 0) in hdaa_audio_assign_names()
4766 if (w->bindas == -1) in hdaa_audio_assign_names()
4769 switch (w->type) { in hdaa_audio_assign_names()
4771 if (as[w->bindas].dir == HDAA_CTL_OUT) in hdaa_audio_assign_names()
4774 switch (w->wclass.pin.config & HDA_CONFIG_DEFAULTCONF_DEVICE_MASK) { in hdaa_audio_assign_names()
4779 if ((w->wclass.pin.config & HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_MASK) in hdaa_audio_assign_names()
4815 w->ossdev = use; in hdaa_audio_assign_names()
4821 w = hdaa_widget_get(devinfo, i); in hdaa_audio_assign_names()
4822 if (w == NULL || w->enable == 0) in hdaa_audio_assign_names()
4824 if (w->ossdev >= 0) in hdaa_audio_assign_names()
4826 if (w->bindas == -1) in hdaa_audio_assign_names()
4828 if (w->type != HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX) in hdaa_audio_assign_names()
4830 if (as[w->bindas].dir == HDAA_CTL_OUT) in hdaa_audio_assign_names()
4833 switch (w->wclass.pin.config & HDA_CONFIG_DEFAULTCONF_DEVICE_MASK) { in hdaa_audio_assign_names()
4856 w->ossdev = types[type][j]; in hdaa_audio_assign_names()
4862 w = hdaa_widget_get(devinfo, i); in hdaa_audio_assign_names()
4863 if (w == NULL || w->enable == 0) in hdaa_audio_assign_names()
4865 if (w->ossdev >= 0) in hdaa_audio_assign_names()
4867 if (w->bindas == -1) in hdaa_audio_assign_names()
4869 if (w->type != HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX) in hdaa_audio_assign_names()
4871 if (as[w->bindas].dir == HDAA_CTL_OUT) in hdaa_audio_assign_names()
4879 w->ossdev = types[6][j]; in hdaa_audio_assign_names()
4945 hdaa_adjust_amp(struct hdaa_widget *w, int ossdev, in hdaa_adjust_amp() argument
4948 struct hdaa_devinfo *devinfo = w->devinfo; in hdaa_adjust_amp()
4951 if (w->bindas >= 0) in hdaa_adjust_amp()
4952 pdevinfo = devinfo->as[w->bindas].pdevinfo; in hdaa_adjust_amp()
4976 struct hdaa_widget *w, *cw; in hdaa_audio_assign_mixers() local
4981 w = hdaa_widget_get(devinfo, i); in hdaa_audio_assign_mixers()
4982 if (w == NULL || w->enable == 0) in hdaa_audio_assign_mixers()
4985 if (w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_OUTPUT || in hdaa_audio_assign_mixers()
4986 w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_BEEP_WIDGET || in hdaa_audio_assign_mixers()
4987 (w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX && in hdaa_audio_assign_mixers()
4988 as[w->bindas].dir == HDAA_CTL_IN)) { in hdaa_audio_assign_mixers()
4989 if (w->ossdev < 0) in hdaa_audio_assign_mixers()
4991 found = hdaa_audio_ctl_source_amp(devinfo, w->nid, -1, in hdaa_audio_assign_mixers()
4992 w->ossdev, 1, 0, &minamp, &maxamp); in hdaa_audio_assign_mixers()
4993 hdaa_adjust_amp(w, w->ossdev, found, minamp, maxamp); in hdaa_audio_assign_mixers()
4994 } else if (w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_INPUT) { in hdaa_audio_assign_mixers()
4995 found = hdaa_audio_ctl_dest_amp(devinfo, w->nid, -1, in hdaa_audio_assign_mixers()
4997 hdaa_adjust_amp(w, SOUND_MIXER_RECLEV, found, minamp, maxamp); in hdaa_audio_assign_mixers()
4998 } else if (w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX && in hdaa_audio_assign_mixers()
4999 as[w->bindas].dir == HDAA_CTL_OUT) { in hdaa_audio_assign_mixers()
5000 found = hdaa_audio_ctl_dest_amp(devinfo, w->nid, -1, in hdaa_audio_assign_mixers()
5002 hdaa_adjust_amp(w, SOUND_MIXER_VOLUME, found, minamp, maxamp); in hdaa_audio_assign_mixers()
5004 if (w->ossdev == SOUND_MIXER_IMIX) { in hdaa_audio_assign_mixers()
5006 found = hdaa_audio_ctl_source_amp(devinfo, w->nid, -1, in hdaa_audio_assign_mixers()
5007 w->ossdev, 1, 0, &minamp, &maxamp); in hdaa_audio_assign_mixers()
5011 found += hdaa_audio_ctl_dest_amp(devinfo, w->nid, -1, in hdaa_audio_assign_mixers()
5012 w->ossdev, 0, &minamp, &maxamp); in hdaa_audio_assign_mixers()
5013 w->pflags |= HDAA_IMIX_AS_DST; in hdaa_audio_assign_mixers()
5015 hdaa_adjust_amp(w, w->ossdev, found, minamp, maxamp); in hdaa_audio_assign_mixers()
5017 if (w->pflags & HDAA_ADC_MONITOR) { in hdaa_audio_assign_mixers()
5018 for (j = 0; j < w->nconns; j++) { in hdaa_audio_assign_mixers()
5019 if (!w->connsenable[j]) in hdaa_audio_assign_mixers()
5021 cw = hdaa_widget_get(devinfo, w->conns[j]); in hdaa_audio_assign_mixers()
5031 w->nid, j, SOUND_MIXER_IGAIN, 0, in hdaa_audio_assign_mixers()
5033 hdaa_adjust_amp(w, SOUND_MIXER_IGAIN, in hdaa_audio_assign_mixers()
5044 struct hdaa_widget *w; in hdaa_audio_prepare_pin_ctrl() local
5049 w = &devinfo->widget[i]; in hdaa_audio_prepare_pin_ctrl()
5050 if (w == NULL) in hdaa_audio_prepare_pin_ctrl()
5052 if (w->type != HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX && in hdaa_audio_prepare_pin_ctrl()
5053 w->waspin == 0) in hdaa_audio_prepare_pin_ctrl()
5056 pincap = w->wclass.pin.cap; in hdaa_audio_prepare_pin_ctrl()
5060 w->wclass.pin.ctrl &= ~( in hdaa_audio_prepare_pin_ctrl()
5067 if (w->enable == 0) { in hdaa_audio_prepare_pin_ctrl()
5070 } else if (w->waspin) { in hdaa_audio_prepare_pin_ctrl()
5072 w->wclass.pin.ctrl |= in hdaa_audio_prepare_pin_ctrl()
5074 } else if (w->bindas < 0 || as[w->bindas].enable == 0) { in hdaa_audio_prepare_pin_ctrl()
5077 } else if (as[w->bindas].dir == HDAA_CTL_IN) { in hdaa_audio_prepare_pin_ctrl()
5080 w->wclass.pin.ctrl |= in hdaa_audio_prepare_pin_ctrl()
5085 w->wclass.pin.ctrl |= in hdaa_audio_prepare_pin_ctrl()
5090 w->wclass.pin.ctrl |= in hdaa_audio_prepare_pin_ctrl()
5095 w->wclass.pin.ctrl |= in hdaa_audio_prepare_pin_ctrl()
5101 w->wclass.pin.ctrl |= in hdaa_audio_prepare_pin_ctrl()
5105 (w->wclass.pin.config & in hdaa_audio_prepare_pin_ctrl()
5108 w->wclass.pin.ctrl |= in hdaa_audio_prepare_pin_ctrl()
5113 w->wclass.pin.ctrl |= in hdaa_audio_prepare_pin_ctrl()
5118 w->wclass.pin.ctrl |= in hdaa_audio_prepare_pin_ctrl()
5123 w->wclass.pin.ctrl |= in hdaa_audio_prepare_pin_ctrl()
5235 struct hdaa_widget *w; in hdaa_audio_commit() local
5243 w = &devinfo->widget[i]; in hdaa_audio_commit()
5244 if (w == NULL) in hdaa_audio_commit()
5246 if (w->selconn == -1) in hdaa_audio_commit()
5247 w->selconn = 0; in hdaa_audio_commit()
5248 if (w->nconns > 0) in hdaa_audio_commit()
5249 hdaa_widget_connection_select(w, w->selconn); in hdaa_audio_commit()
5250 if (w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX || in hdaa_audio_commit()
5251 w->waspin) { in hdaa_audio_commit()
5253 HDA_CMD_SET_PIN_WIDGET_CTRL(0, w->nid, in hdaa_audio_commit()
5254 w->wclass.pin.ctrl)); in hdaa_audio_commit()
5256 if (w->param.eapdbtl != HDA_INVALID) { in hdaa_audio_commit()
5259 val = w->param.eapdbtl; in hdaa_audio_commit()
5264 HDA_CMD_SET_EAPD_BTL_ENABLE(0, w->nid, in hdaa_audio_commit()
5296 struct hdaa_widget *w; in hdaa_pcmchannel_setup() local
5331 w = hdaa_widget_get(devinfo, as[ch->as].dacs[ch->asindex][i]); in hdaa_pcmchannel_setup()
5332 if (w == NULL || w->enable == 0) in hdaa_pcmchannel_setup()
5334 cap = w->param.supp_stream_formats; in hdaa_pcmchannel_setup()
5340 if (HDA_PARAM_AUDIO_WIDGET_CAP_DIGITAL(w->param.widget_cap)) in hdaa_pcmchannel_setup()
5344 pcmcap = w->param.supp_pcm_size_rate; in hdaa_pcmchannel_setup()
5347 pcmcap &= w->param.supp_pcm_size_rate; in hdaa_pcmchannel_setup()
5350 ch->stripecap &= w->wclass.conv.stripecap; in hdaa_pcmchannel_setup()
5354 channels += HDA_PARAM_AUDIO_WIDGET_CAP_CC(w->param.widget_cap) + 1; in hdaa_pcmchannel_setup()
5355 if (HDA_PARAM_AUDIO_WIDGET_CAP_CC(w->param.widget_cap) != 1) in hdaa_pcmchannel_setup()
5699 hdaa_dump_pin(struct hdaa_widget *w) in hdaa_dump_pin() argument
5703 pincap = w->wclass.pin.cap; in hdaa_dump_pin()
5705 device_printf(w->devinfo->dev, " Pin cap: 0x%08x", pincap); in hdaa_dump_pin()
5743 device_printf(w->devinfo->dev, " Pin config: 0x%08x\n", in hdaa_dump_pin()
5744 w->wclass.pin.config); in hdaa_dump_pin()
5745 device_printf(w->devinfo->dev, " Pin control: 0x%08x", w->wclass.pin.ctrl); in hdaa_dump_pin()
5746 if (w->wclass.pin.ctrl & HDA_CMD_SET_PIN_WIDGET_CTRL_HPHN_ENABLE) in hdaa_dump_pin()
5748 if (w->wclass.pin.ctrl & HDA_CMD_SET_PIN_WIDGET_CTRL_IN_ENABLE) in hdaa_dump_pin()
5750 if (w->wclass.pin.ctrl & HDA_CMD_SET_PIN_WIDGET_CTRL_OUT_ENABLE) in hdaa_dump_pin()
5752 if (HDA_PARAM_AUDIO_WIDGET_CAP_DIGITAL(w->param.widget_cap)) { in hdaa_dump_pin()
5753 if ((w->wclass.pin.ctrl & in hdaa_dump_pin()
5756 else if ((w->wclass.pin.ctrl & in hdaa_dump_pin()
5760 if ((w->wclass.pin.ctrl & in hdaa_dump_pin()
5768 hdaa_dump_pin_config(struct hdaa_widget *w, uint32_t conf) in hdaa_dump_pin_config() argument
5771 device_printf(w->devinfo->dev, "%2d %08x %-2d %-2d " in hdaa_dump_pin_config()
5773 w->nid, conf, in hdaa_dump_pin_config()
5782 (w->enable == 0)?" DISA":""); in hdaa_dump_pin_config()
5788 struct hdaa_widget *w; in hdaa_dump_pin_configs() local
5794 w = hdaa_widget_get(devinfo, i); in hdaa_dump_pin_configs()
5795 if (w == NULL) in hdaa_dump_pin_configs()
5797 if (w->type != HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX) in hdaa_dump_pin_configs()
5799 hdaa_dump_pin_config(w, w->wclass.pin.config); in hdaa_dump_pin_configs()
5823 struct hdaa_widget *w, *cw; in hdaa_dump_nodes() local
5835 w = hdaa_widget_get(devinfo, i); in hdaa_dump_nodes()
5836 if (w == NULL) { in hdaa_dump_nodes()
5841 device_printf(devinfo->dev, " nid: %d%s\n", w->nid, in hdaa_dump_nodes()
5842 (w->enable == 0) ? " [DISABLED]" : ""); in hdaa_dump_nodes()
5843 device_printf(devinfo->dev, " Name: %s\n", w->name); in hdaa_dump_nodes()
5845 w->param.widget_cap); in hdaa_dump_nodes()
5846 if (w->param.widget_cap & 0x0ee1) { in hdaa_dump_nodes()
5847 if (HDA_PARAM_AUDIO_WIDGET_CAP_LR_SWAP(w->param.widget_cap)) in hdaa_dump_nodes()
5849 if (HDA_PARAM_AUDIO_WIDGET_CAP_POWER_CTRL(w->param.widget_cap)) in hdaa_dump_nodes()
5851 if (HDA_PARAM_AUDIO_WIDGET_CAP_DIGITAL(w->param.widget_cap)) in hdaa_dump_nodes()
5853 if (HDA_PARAM_AUDIO_WIDGET_CAP_UNSOL_CAP(w->param.widget_cap)) in hdaa_dump_nodes()
5855 if (HDA_PARAM_AUDIO_WIDGET_CAP_PROC_WIDGET(w->param.widget_cap)) in hdaa_dump_nodes()
5857 if (HDA_PARAM_AUDIO_WIDGET_CAP_STRIPE(w->param.widget_cap)) in hdaa_dump_nodes()
5859 1 << (fls(w->wclass.conv.stripecap) - 1)); in hdaa_dump_nodes()
5860 j = HDA_PARAM_AUDIO_WIDGET_CAP_CC(w->param.widget_cap); in hdaa_dump_nodes()
5867 if (w->bindas != -1) { in hdaa_dump_nodes()
5869 w->bindas, w->bindseqmask); in hdaa_dump_nodes()
5871 if (w->ossmask != 0 || w->ossdev >= 0) { in hdaa_dump_nodes()
5873 hdaa_audio_ctl_ossmixer_mask2allname(w->ossmask, buf, sizeof(buf))); in hdaa_dump_nodes()
5874 if (w->ossdev >= 0) in hdaa_dump_nodes()
5875 printf(" (%s)", ossnames[w->ossdev]); in hdaa_dump_nodes()
5878 if (w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_OUTPUT || in hdaa_dump_nodes()
5879 w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_INPUT) { in hdaa_dump_nodes()
5881 w->param.supp_stream_formats, in hdaa_dump_nodes()
5882 w->param.supp_pcm_size_rate); in hdaa_dump_nodes()
5883 } else if (w->type == in hdaa_dump_nodes()
5884 HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX || w->waspin) in hdaa_dump_nodes()
5885 hdaa_dump_pin(w); in hdaa_dump_nodes()
5886 if (w->param.eapdbtl != HDA_INVALID) in hdaa_dump_nodes()
5888 w->param.eapdbtl); in hdaa_dump_nodes()
5889 if (HDA_PARAM_AUDIO_WIDGET_CAP_OUT_AMP(w->param.widget_cap) && in hdaa_dump_nodes()
5890 w->param.outamp_cap != 0) in hdaa_dump_nodes()
5891 hdaa_dump_amp(devinfo->dev, w->param.outamp_cap, "Output"); in hdaa_dump_nodes()
5892 if (HDA_PARAM_AUDIO_WIDGET_CAP_IN_AMP(w->param.widget_cap) && in hdaa_dump_nodes()
5893 w->param.inamp_cap != 0) in hdaa_dump_nodes()
5894 hdaa_dump_amp(devinfo->dev, w->param.inamp_cap, " Input"); in hdaa_dump_nodes()
5895 if (w->nconns > 0) in hdaa_dump_nodes()
5896 device_printf(devinfo->dev, " Connections: %d\n", w->nconns); in hdaa_dump_nodes()
5897 for (j = 0; j < w->nconns; j++) { in hdaa_dump_nodes()
5898 cw = hdaa_widget_get(devinfo, w->conns[j]); in hdaa_dump_nodes()
5900 (w->connsenable[j] == 0)?"[DISABLED] ":"", in hdaa_dump_nodes()
5901 w->conns[j], (cw == NULL) ? "GHOST!" : cw->name); in hdaa_dump_nodes()
5906 if (w->nconns > 1 && w->selconn == j && w->type != in hdaa_dump_nodes()
5919 struct hdaa_widget *w, *cw; in hdaa_dump_dst_nid() local
5926 w = hdaa_widget_get(devinfo, nid); in hdaa_dump_dst_nid()
5927 if (w == NULL || w->enable == 0) in hdaa_dump_dst_nid()
5934 printf("nid=%d [%s]", w->nid, w->name); in hdaa_dump_dst_nid()
5937 if (w->ossmask == 0) { in hdaa_dump_dst_nid()
5943 w->ossmask, buf, sizeof(buf))); in hdaa_dump_dst_nid()
5944 if (w->ossdev >= 0) { in hdaa_dump_dst_nid()
5951 for (i = 0; i < w->nconns; i++) { in hdaa_dump_dst_nid()
5952 if (w->connsenable[i] == 0) in hdaa_dump_dst_nid()
5954 cw = hdaa_widget_get(devinfo, w->conns[i]); in hdaa_dump_dst_nid()
5957 hdaa_dump_dst_nid(pdevinfo, w->conns[i], depth + 1); in hdaa_dump_dst_nid()
5967 struct hdaa_widget *w; in hdaa_dump_dac() local
5992 w = hdaa_widget_get(devinfo, as->pins[i]); in hdaa_dump_dac()
5993 if (w == NULL || w->enable == 0) in hdaa_dump_dac()
6005 struct hdaa_widget *w; in hdaa_dump_adc() local
6027 w = hdaa_widget_get(devinfo, i); in hdaa_dump_adc()
6028 if (w == NULL || w->enable == 0) in hdaa_dump_adc()
6030 if (w->type != HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_INPUT) in hdaa_dump_adc()
6032 if (w->bindas != pdevinfo->recas) in hdaa_dump_adc()
6044 struct hdaa_widget *w; in hdaa_dump_mix() local
6049 w = hdaa_widget_get(devinfo, i); in hdaa_dump_mix()
6050 if (w == NULL || w->enable == 0) in hdaa_dump_mix()
6052 if (w->ossdev != SOUND_MIXER_IMIX) in hdaa_dump_mix()
6054 if (w->bindas != pdevinfo->recas) in hdaa_dump_mix()
6071 struct hdaa_widget *w; in hdaa_pindump() local
6079 w = hdaa_widget_get(devinfo, i); in hdaa_pindump()
6080 if (w == NULL || w->type != in hdaa_pindump()
6083 hdaa_dump_pin_config(w, w->wclass.pin.config); in hdaa_pindump()
6084 pincap = w->wclass.pin.cap; in hdaa_pindump()
6096 HDA_CMD_SET_PIN_SENSE(0, w->nid, 0)); in hdaa_pindump()
6099 HDA_CMD_GET_PIN_SENSE(0, w->nid)); in hdaa_pindump()
6107 w->nid)); in hdaa_pindump()
6112 (HDA_PARAM_AUDIO_WIDGET_CAP_DIGITAL(w->param.widget_cap) && in hdaa_pindump()
6286 struct hdaa_widget *w; in hdaa_unconfigure() local
6306 w = hdaa_widget_get(devinfo, i); in hdaa_unconfigure()
6307 if (w == NULL) in hdaa_unconfigure()
6309 w->enable = 1; in hdaa_unconfigure()
6310 w->selconn = -1; in hdaa_unconfigure()
6311 w->pflags = 0; in hdaa_unconfigure()
6312 w->bindas = -1; in hdaa_unconfigure()
6313 w->bindseqmask = 0; in hdaa_unconfigure()
6314 w->ossdev = -1; in hdaa_unconfigure()
6315 w->ossmask = 0; in hdaa_unconfigure()
6316 for (j = 0; j < w->nconns; j++) in hdaa_unconfigure()
6317 w->connsenable[j] = 1; in hdaa_unconfigure()
6318 if (w->type == HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX) in hdaa_unconfigure()
6319 w->wclass.pin.config = w->wclass.pin.newconf; in hdaa_unconfigure()
6320 if (w->eld != NULL) { in hdaa_unconfigure()
6321 w->eld_len = 0; in hdaa_unconfigure()
6322 free(w->eld, M_HDAA); in hdaa_unconfigure()
6323 w->eld = NULL; in hdaa_unconfigure()
6823 struct hdaa_widget *w; in hdaa_unsol_intr() local
6831 w = hdaa_widget_get(devinfo, i); in hdaa_unsol_intr()
6832 if (w == NULL || w->enable == 0 || w->type != in hdaa_unsol_intr()
6835 if (w->unsol != tag) in hdaa_unsol_intr()
6837 if (HDA_PARAM_PIN_CAP_DP(w->wclass.pin.cap) || in hdaa_unsol_intr()
6838 HDA_PARAM_PIN_CAP_HDMI(w->wclass.pin.cap)) in hdaa_unsol_intr()
6843 hdaa_presence_handler(w); in hdaa_unsol_intr()
6845 hdaa_eld_handler(w); in hdaa_unsol_intr()
6907 struct hdaa_widget *w; in hdaa_chan_type() local
6912 w = hdaa_widget_get(devinfo, as->pins[i]); in hdaa_chan_type()
6913 if (w == NULL || w->enable == 0 || w->type != in hdaa_chan_type()
6916 t1 = HDA_CONFIG_DEFAULTCONF_DEVICE(w->wclass.pin.config); in hdaa_chan_type()