Lines Matching defs:uacp
408 usb_ac_state_t *uacp = NULL;
449 uacp = (usb_ac_state_t *)ddi_get_soft_state(usb_ac_statep, instance);
450 if (uacp == NULL) {
456 uacp->usb_ac_log_handle = usb_alloc_log_hdl(dip, "ac",
461 uacp->usb_ac_instance = instance;
462 uacp->usb_ac_dip = dip;
464 (void) snprintf(uacp->dstr, sizeof (uacp->dstr), "%s#%d",
468 USB_DPRINTF_L2(PRINT_MASK_ATTA, uacp->usb_ac_log_handle,
471 usb_free_log_hdl(uacp->usb_ac_log_handle);
472 ddi_soft_state_free(usb_ac_statep, uacp->usb_ac_instance);
477 if (usb_get_dev_data(dip, &uacp->usb_ac_dev_data,
479 USB_DPRINTF_L2(PRINT_MASK_ATTA, uacp->usb_ac_log_handle,
483 usb_free_log_hdl(uacp->usb_ac_log_handle);
484 ddi_soft_state_free(usb_ac_statep, uacp->usb_ac_instance);
490 mutex_init(&uacp->usb_ac_mutex, NULL, MUTEX_DRIVER,
491 uacp->usb_ac_dev_data->dev_iblock_cookie);
493 uacp->usb_ac_default_ph = uacp->usb_ac_dev_data->dev_default_ph;
496 if (usb_ac_handle_descriptors(uacp) != USB_SUCCESS) {
502 usb_free_descr_tree(dip, uacp->usb_ac_dev_data);
504 uacp->usb_ac_ser_acc = usb_init_serialization(dip,
507 mutex_enter(&uacp->usb_ac_mutex);
510 uacp->usb_ac_dev_state = USB_DEV_ONLINE;
516 uacp->usb_ac_plumbing_state = USB_AC_STATE_UNPLUMBED;
517 uacp->usb_ac_current_plumbed_index = -1;
519 mutex_exit(&uacp->usb_ac_mutex);
522 usb_ac_create_pm_components(dip, uacp);
526 USB_DPRINTF_L2(PRINT_MASK_ATTA, uacp->usb_ac_log_handle,
532 USB_DPRINTF_L4(PRINT_MASK_ATTA, uacp->usb_ac_log_handle,
538 if (usb_ac_do_plumbing(uacp) != USB_SUCCESS)
544 if (uacp) {
545 USB_DPRINTF_L2(PRINT_MASK_ATTA, uacp->usb_ac_log_handle,
549 if (uacp->tqp != NULL) {
550 ddi_taskq_wait(uacp->tqp);
551 ddi_taskq_destroy(uacp->tqp);
552 uacp->tqp = NULL;
554 (void) usb_ac_cleanup(dip, uacp);
565 usb_ac_state_t *uacp;
568 uacp = ddi_get_soft_state(usb_ac_statep, instance);
573 uacp->usb_ac_log_handle, "usb_ac_detach: detach");
576 if (uacp->tqp != NULL)
577 ddi_taskq_wait(uacp->tqp);
579 mutex_enter(&uacp->usb_ac_mutex);
582 if (uacp->usb_ac_busy_count) {
583 USB_DPRINTF_L2(PRINT_MASK_ATTA, uacp->usb_ac_log_handle,
585 uacp->usb_ac_busy_count);
587 mutex_exit(&uacp->usb_ac_mutex);
590 mutex_exit(&uacp->usb_ac_mutex);
592 (void) usb_audio_unregister(uacp);
600 if (usb_ac_do_unplumbing(uacp) == USB_SUCCESS)
601 rval = usb_ac_cleanup(dip, uacp);
605 uacp->usb_ac_log_handle, "detach failed: %s%d",
611 USB_DPRINTF_L4(PRINT_MASK_ATTA, uacp->usb_ac_log_handle,
629 usb_ac_cleanup(dev_info_t *dip, usb_ac_state_t *uacp)
635 mutex_enter(&uacp->usb_ac_mutex);
636 uacpm = uacp->usb_ac_pm;
638 USB_DPRINTF_L4(PRINT_MASK_ATTA, uacp->usb_ac_log_handle,
641 ASSERT(uacp->usb_ac_busy_count == 0);
643 ASSERT(uacp->usb_ac_plumbing_state == USB_AC_STATE_UNPLUMBED);
645 mutex_exit(&uacp->usb_ac_mutex);
656 mutex_enter(&uacp->usb_ac_mutex);
658 if (uacpm && (uacp->usb_ac_dev_state != USB_DEV_DISCONNECTED)) {
660 mutex_exit(&uacp->usb_ac_mutex);
661 usb_ac_pm_busy_component(uacp);
668 uacp->usb_ac_log_handle,
672 usb_ac_pm_idle_component(uacp);
674 mutex_exit(&uacp->usb_ac_mutex);
679 mutex_enter(&uacp->usb_ac_mutex);
684 uacp->usb_ac_pm = NULL;
687 usb_client_detach(dip, uacp->usb_ac_dev_data);
690 usb_ac_free_all_units(uacp);
692 mutex_exit(&uacp->usb_ac_mutex);
694 mutex_destroy(&uacp->usb_ac_mutex);
696 usb_fini_serialization(uacp->usb_ac_ser_acc);
698 USB_DPRINTF_L4(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
701 usb_free_log_hdl(uacp->usb_ac_log_handle);
702 kmem_free(uacp->usb_ac_connections, uacp->usb_ac_connections_len);
703 kmem_free(uacp->usb_ac_connections_a, uacp->usb_ac_connections_a_len);
704 kmem_free(uacp->usb_ac_unit_type, uacp->usb_ac_max_unit);
705 kmem_free(uacp->usb_ac_traverse_path, uacp->usb_ac_max_unit);
707 ddi_soft_state_free(usb_ac_statep, uacp->usb_ac_instance);
719 usb_ac_state_t *uacp = ddi_get_soft_state(usb_ac_statep, inst);
721 mutex_enter(&uacp->usb_ac_mutex);
723 uacp->usb_ac_busy_count++;
725 mutex_exit(&uacp->usb_ac_mutex);
727 usb_ac_pm_busy_component(uacp);
728 (void) pm_raise_power(uacp->usb_ac_dip, 0, USB_DEV_OS_FULL_PWR);
738 usb_ac_state_t *uacp = ddi_get_soft_state(usb_ac_statep, inst);
740 mutex_enter(&uacp->usb_ac_mutex);
742 if (uacp->usb_ac_busy_count > 0)
743 uacp->usb_ac_busy_count--;
745 mutex_exit(&uacp->usb_ac_mutex);
747 usb_ac_pm_idle_component(uacp);
758 usb_ac_state_t *uacp = plumb_infop->acp_uacp;
765 ASSERT(mutex_owned(&uacp->usb_ac_mutex));
774 USB_DPRINTF_L4(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
779 USB_DPRINTF_L4(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
786 if (uacp->usb_ac_registered_with_mixer) {
792 uacp->usb_ac_log_handle, "val1=0x%x(%d),"
799 uacp->usb_ac_busy_count++;
800 if (uacp->usb_ac_plumbing_state ==
802 mutex_exit(&uacp->usb_ac_mutex);
804 uacp, val);
805 mutex_enter(&uacp->
808 uacp->usb_ac_busy_count--;
821 USB_DPRINTF_L2(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
829 USB_DPRINTF_L2(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
849 usb_ac_state_t *uacp;
853 uacp = ddi_get_soft_state(usb_ac_statep, instance);
855 mutex_enter(&uacp->usb_ac_mutex);
856 uacpm = uacp->usb_ac_pm;
859 USB_DPRINTF_L2(PRINT_MASK_PM, uacp->usb_ac_log_handle,
868 rval = usb_ac_pwrlvl0(uacp);
871 rval = usb_ac_pwrlvl1(uacp);
874 rval = usb_ac_pwrlvl2(uacp);
877 rval = usb_ac_pwrlvl3(uacp);
882 mutex_exit(&uacp->usb_ac_mutex);
899 usb_ac_pwrlvl0(usb_ac_state_t *uacp)
904 uacpm = uacp->usb_ac_pm;
906 switch (uacp->usb_ac_dev_state) {
915 rval = usb_set_device_pwrlvl3(uacp->usb_ac_dip);
918 uacp->usb_ac_dev_state = USB_DEV_PWRED_DOWN;
933 usb_ac_pwrlvl1(usb_ac_state_t *uacp)
938 rval = usb_set_device_pwrlvl2(uacp->usb_ac_dip);
947 usb_ac_pwrlvl2(usb_ac_state_t *uacp)
951 rval = usb_set_device_pwrlvl1(uacp->usb_ac_dip);
959 usb_ac_pwrlvl3(usb_ac_state_t *uacp)
964 uacpm = uacp->usb_ac_pm;
966 switch (uacp->usb_ac_dev_state) {
969 rval = usb_set_device_pwrlvl0(uacp->usb_ac_dip);
972 uacp->usb_ac_dev_state = USB_DEV_ONLINE;
984 USB_DPRINTF_L2(PRINT_MASK_PM, uacp->usb_ac_log_handle,
993 usb_ac_create_pm_components(dev_info_t *dip, usb_ac_state_t *uacp)
998 USB_DPRINTF_L4(PRINT_MASK_PM, uacp->usb_ac_log_handle,
1003 uacp->usb_ac_pm = uacpm;
1004 uacpm->acpm_state = uacp;
1015 uacp->usb_ac_log_handle,
1023 uacp->usb_ac_pm = NULL;
1025 USB_DPRINTF_L2(PRINT_MASK_PM, uacp->usb_ac_log_handle,
1038 usb_ac_get_featureID(usb_ac_state_t *uacp, uchar_t dir,
1043 return (usb_ac_set_control(uacp, dir, USB_AUDIO_FEATURE_UNIT,
1057 usb_ac_feature_unit_check(usb_ac_state_t *uacp, uint_t featureID,
1064 ASSERT(featureID < uacp->usb_ac_max_unit);
1070 uacp->usb_ac_units[featureID].acu_descriptor;
1073 USB_DPRINTF_L3(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
1086 uacp->usb_ac_log_handle,
1101 uacp->usb_ac_log_handle,
1112 USB_DPRINTF_L4(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
1128 usb_ac_handle_descriptors(usb_ac_state_t *uacp)
1133 usb_client_dev_data_t *dev_data = uacp->usb_ac_dev_data;
1141 uacp->usb_ac_ifno = dev_data->dev_curr_if;
1142 uacp->usb_ac_if_descr = altif_data->altif_descr;
1156 USB_DPRINTF_L2(PRINT_MASK_ATTA, uacp->usb_ac_log_handle,
1172 USB_DPRINTF_L2(PRINT_MASK_ATTA, uacp->usb_ac_log_handle,
1178 USB_DPRINTF_L3(PRINT_MASK_ATTA, uacp->usb_ac_log_handle,
1193 USB_DPRINTF_L3(PRINT_MASK_ATTA, uacp->usb_ac_log_handle,
1202 usb_ac_add_unit_descriptor(uacp, cvs->cvs_buf,
1207 usb_ac_setup_connections(uacp);
1210 usb_ac_map_termtype_to_port(uacp, USB_AUDIO_PLAY);
1211 usb_ac_map_termtype_to_port(uacp, USB_AUDIO_RECORD);
1223 usb_ac_setup_connections(usb_ac_state_t *uacp)
1225 usb_ac_unit_list_t *units = uacp->usb_ac_units;
1230 uacp->usb_ac_unit_type = kmem_zalloc(uacp->usb_ac_max_unit,
1233 uacp->usb_ac_traverse_path = kmem_zalloc(uacp->usb_ac_max_unit,
1238 a_len = uacp->usb_ac_max_unit * uacp->usb_ac_max_unit;
1239 p_len = uacp->usb_ac_max_unit * sizeof (uchar_t *);
1244 for (i = 0; i < uacp->usb_ac_max_unit; i++) {
1245 p[i] = a + i * uacp->usb_ac_max_unit;
1247 uacp->usb_ac_connections = p;
1248 uacp->usb_ac_connections_len = p_len;
1249 uacp->usb_ac_connections_a = a;
1250 uacp->usb_ac_connections_a_len = a_len;
1253 for (unit = 0; unit < uacp->usb_ac_max_unit; unit++) {
1255 USB_DPRINTF_L3(PRINT_MASK_ATTA, uacp->usb_ac_log_handle,
1260 uacp->usb_ac_unit_type[unit] = units[unit].acu_type;
1269 USB_DPRINTF_L3(PRINT_MASK_ATTA, uacp->usb_ac_log_handle,
1285 USB_DPRINTF_L3(PRINT_MASK_ATTA, uacp->usb_ac_log_handle,
1305 uacp->usb_ac_log_handle,
1330 uacp->usb_ac_log_handle,
1353 uacp->usb_ac_log_handle,
1376 uacp->usb_ac_log_handle,
1407 l = uacp->usb_ac_max_unit * 5;
1411 USB_DPRINTF_L3(PRINT_MASK_ATTA, uacp->usb_ac_log_handle,
1416 for (i = 1; i < uacp->usb_ac_max_unit; i++) {
1419 USB_DPRINTF_L3(PRINT_MASK_ATTA, uacp->usb_ac_log_handle, buf);
1422 for (i = 1; i < uacp->usb_ac_max_unit; i++) {
1425 USB_DPRINTF_L3(PRINT_MASK_ATTA, uacp->usb_ac_log_handle, buf);
1428 for (i = 1; i < uacp->usb_ac_max_unit; i++) {
1430 uacp->usb_ac_unit_type[i]);
1432 USB_DPRINTF_L3(PRINT_MASK_ATTA, uacp->usb_ac_log_handle, buf);
1433 USB_DPRINTF_L3(PRINT_MASK_ATTA, uacp->usb_ac_log_handle, " ");
1435 USB_DPRINTF_L3(PRINT_MASK_ATTA, uacp->usb_ac_log_handle,
1438 for (i = 1; i < uacp->usb_ac_max_unit; i++) {
1441 USB_DPRINTF_L3(PRINT_MASK_ATTA, uacp->usb_ac_log_handle, buf);
1444 for (i = 1; i < uacp->usb_ac_max_unit; i++) {
1447 USB_DPRINTF_L3(PRINT_MASK_ATTA, uacp->usb_ac_log_handle, buf);
1449 for (i = 1; i < uacp->usb_ac_max_unit; i++) {
1451 for (j = 1; j < uacp->usb_ac_max_unit; j++) {
1454 USB_DPRINTF_L3(PRINT_MASK_ATTA, uacp->usb_ac_log_handle, buf);
1468 usb_ac_add_unit_descriptor(usb_ac_state_t *uacp, uchar_t *buffer,
1519 uacp->usb_ac_log_handle,
1542 uacp->usb_ac_log_handle,
1554 usb_ac_alloc_unit(uacp, d->bTerminalID);
1555 uacp->usb_ac_units[d->bTerminalID].acu_descriptor = descr;
1556 uacp->usb_ac_units[d->bTerminalID].acu_type = buffer[2];
1557 uacp->usb_ac_units[d->bTerminalID].acu_descr_length = len;
1567 uacp->usb_ac_log_handle,
1577 usb_ac_alloc_unit(uacp, d->bTerminalID);
1578 uacp->usb_ac_units[d->bTerminalID].acu_descriptor = descr;
1579 uacp->usb_ac_units[d->bTerminalID].acu_type = buffer[2];
1580 uacp->usb_ac_units[d->bTerminalID].acu_descr_length = len;
1590 uacp->usb_ac_log_handle,
1597 usb_ac_alloc_unit(uacp, d->bUnitID);
1598 uacp->usb_ac_units[d->bUnitID].acu_descriptor = descr;
1599 uacp->usb_ac_units[d->bUnitID].acu_type = buffer[2];
1600 uacp->usb_ac_units[d->bUnitID].acu_descr_length = len;
1610 uacp->usb_ac_log_handle,
1617 usb_ac_alloc_unit(uacp, d->bUnitID);
1618 uacp->usb_ac_units[d->bUnitID].acu_descriptor = descr;
1619 uacp->usb_ac_units[d->bUnitID].acu_type = buffer[2];
1620 uacp->usb_ac_units[d->bUnitID].acu_descr_length = len;
1630 uacp->usb_ac_log_handle,
1638 usb_ac_alloc_unit(uacp, d->bUnitID);
1639 uacp->usb_ac_units[d->bUnitID].acu_descriptor = descr;
1640 uacp->usb_ac_units[d->bUnitID].acu_type = buffer[2];
1641 uacp->usb_ac_units[d->bUnitID].acu_descr_length = len;
1651 uacp->usb_ac_log_handle,
1658 usb_ac_alloc_unit(uacp, d->bUnitID);
1659 uacp->usb_ac_units[d->bUnitID].acu_descriptor = descr;
1660 uacp->usb_ac_units[d->bUnitID].acu_type = buffer[2];
1661 uacp->usb_ac_units[d->bUnitID].acu_descr_length = len;
1671 uacp->usb_ac_log_handle,
1678 usb_ac_alloc_unit(uacp, d->bUnitID);
1679 uacp->usb_ac_units[d->bUnitID].acu_descriptor = descr;
1680 uacp->usb_ac_units[d->bUnitID].acu_type = buffer[2];
1681 uacp->usb_ac_units[d->bUnitID].acu_descr_length = len;
1698 usb_ac_alloc_unit(usb_ac_state_t *uacp, uint_t unit)
1704 if (uacp->usb_ac_units) {
1705 if (unit < uacp->usb_ac_max_unit) {
1710 old = uacp->usb_ac_units;
1711 max_unit = uacp->usb_ac_max_unit;
1716 uacp->usb_ac_max_unit = unit;
1717 uacp->usb_ac_units = kmem_zalloc(unit *
1722 bcopy(old, uacp->usb_ac_units, len);
1734 usb_ac_free_all_units(usb_ac_state_t *uacp)
1739 if (uacp->usb_ac_units == NULL) {
1745 for (unit = 0; unit < uacp->usb_ac_max_unit; unit++) {
1746 unitp = &uacp->usb_ac_units[unit];
1755 kmem_free(uacp->usb_ac_units, uacp->usb_ac_max_unit *
1798 usb_ac_update_port(usb_ac_state_t *uacp, uint_t id,
1804 uacp->usb_ac_units[id].acu_descriptor;
1808 USB_DPRINTF_L4(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
1812 uacp->usb_ac_output_ports |= (1U << port_type);
1816 uacp->usb_ac_units[id].acu_descriptor;
1820 USB_DPRINTF_L4(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
1824 uacp->usb_ac_input_ports |= (1U << port_type);
1835 * input or output terminals and OR into uacp->usb_ac_input_ports
1836 * or uacp->usb_ac_output_ports;
1839 usb_ac_map_termtype_to_port(usb_ac_state_t *uacp, uint_t dir)
1847 (void) usb_ac_traverse_all_units(uacp, dir, search_type, 0,
1860 usb_ac_set_port(usb_ac_state_t *uacp, uint_t dir, uint_t port)
1869 id = usb_ac_traverse_all_units(uacp, dir,
1874 USB_DPRINTF_L4(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
1892 usb_ac_match_port(usb_ac_state_t *uacp, uint_t id,
1901 uacp->usb_ac_units[id].acu_descriptor;
1904 USB_DPRINTF_L4(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
1911 uacp->usb_ac_units[id].acu_descriptor;
1914 USB_DPRINTF_L4(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
1931 usb_ac_set_selector(usb_ac_state_t *uacp, uint_t id,
1942 uacp->usb_ac_units[id].acu_descriptor;
1958 USB_DPRINTF_L3(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
1961 if (uacp->usb_ac_unit_type[unit] == search_target) {
1962 if (usb_ac_match_port(uacp, unit, dir, channel,
1974 unit = usb_ac_traverse_connections(uacp, unit,
1991 USB_DPRINTF_L3(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
1994 mutex_exit(&uacp->usb_ac_mutex);
1998 USB_DPRINTF_L2(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
2000 mutex_enter(&uacp->usb_ac_mutex);
2009 uacp->usb_ac_dip,
2010 uacp->usb_ac_default_ph,
2017 (id << 8)| uacp->usb_ac_ifno, /* wIndex */
2024 uacp->usb_ac_log_handle,
2030 uacp->usb_ac_log_handle,
2035 mutex_enter(&uacp->usb_ac_mutex);
2037 USB_DPRINTF_L2(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
2051 usb_ac_set_control(usb_ac_state_t *uacp, uint_t dir, uint_t search_target,
2054 int (*func)(usb_ac_state_t *uacp, uint_t unit, uint_t dir,
2060 id = usb_ac_traverse_all_units(uacp, dir, search_target, channel,
2068 id = usb_ac_traverse_all_units(uacp, dir, search_target,
2087 usb_ac_traverse_all_units(usb_ac_state_t *uacp, uint_t dir,
2090 int (*func)(usb_ac_state_t *uacp, uint_t unit, uint_t dir,
2100 USB_DPRINTF_L1(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
2106 for (unit = 1; unit < uacp->usb_ac_max_unit; unit++) {
2108 if (uacp->usb_ac_unit_type[unit] != start_type) {
2116 uacp->usb_ac_units[unit].acu_descriptor;
2124 uacp->usb_ac_units[unit].acu_descriptor;
2133 id = usb_ac_traverse_connections(uacp, unit, dir,
2147 return ((unit < uacp->usb_ac_max_unit) ? unit : USB_AC_ID_NONE);
2159 usb_ac_set_monitor_gain_control(usb_ac_state_t *uacp, uint_t dir,
2162 int (*func)(usb_ac_state_t *uacp, uint_t unit, uint_t dir,
2169 for (unit = 1; unit < uacp->usb_ac_max_unit; unit++) {
2171 uacp->usb_ac_units[unit].acu_descriptor;
2174 if ((uacp->usb_ac_unit_type[unit] ==
2179 id = usb_ac_traverse_connections(uacp, unit, dir,
2202 usb_ac_push_unit_id(usb_ac_state_t *uacp, uint_t unit)
2204 uacp->usb_ac_traverse_path[uacp->usb_ac_traverse_path_index++] =
2206 ASSERT(uacp->usb_ac_traverse_path_index < uacp->usb_ac_max_unit);
2212 usb_ac_pop_unit_id(usb_ac_state_t *uacp, uint_t unit)
2214 uacp->usb_ac_traverse_path[uacp->usb_ac_traverse_path_index--] = 0;
2223 usb_ac_show_traverse_path(usb_ac_state_t *uacp)
2227 for (i = 0; i < uacp->usb_ac_traverse_path_index; i++) {
2228 USB_DPRINTF_L4(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
2230 i, uacp->usb_ac_traverse_path[i],
2231 uacp->usb_ac_unit_type[uacp->usb_ac_traverse_path[i]]);
2241 usb_ac_check_path(usb_ac_state_t *uacp, uint_t type)
2245 for (i = 0; i < uacp->usb_ac_traverse_path_index; i++) {
2246 uint_t unit = uacp->usb_ac_traverse_path[i];
2248 if (uacp->usb_ac_unit_type[unit] == type) {
2269 usb_ac_traverse_connections(usb_ac_state_t *uacp, uint_t start_unit, uint_t dir,
2272 int (*func)(usb_ac_state_t *uacp, uint_t unit, uint_t dir,
2282 USB_DPRINTF_L1(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
2288 usb_ac_push_unit_id(uacp, start_unit);
2290 for (unit = 1; unit < uacp->usb_ac_max_unit; unit++) {
2292 uacp->usb_ac_connections[unit][start_unit] :
2293 uacp->usb_ac_connections[start_unit][unit];
2297 uacp->usb_ac_log_handle,
2301 uacp->usb_ac_unit_type[unit]);
2304 if (uacp->usb_ac_unit_type[unit] == search_target) {
2306 uacp->usb_ac_log_handle,
2311 if (func(uacp, unit, dir, channel,
2316 uacp->usb_ac_log_handle,
2330 if (uacp->usb_ac_unit_type[unit] == done) {
2334 id = usb_ac_traverse_connections(uacp, unit, dir,
2347 usb_ac_pop_unit_id(uacp, start_unit);
2349 return ((unit < uacp->usb_ac_max_unit) ? unit : USB_AC_ID_NONE);
2363 usb_ac_state_t *uacp = (usb_ac_state_t *)ddi_get_soft_state(
2366 USB_DPRINTF_L4(PRINT_MASK_EVENTS, uacp->usb_ac_log_handle,
2369 usb_ac_serialize_access(uacp);
2370 mutex_enter(&uacp->usb_ac_mutex);
2373 uacp->usb_ac_dev_state = USB_DEV_DISCONNECTED;
2375 if (uacp->usb_ac_busy_count) {
2376 USB_DPRINTF_L0(PRINT_MASK_EVENTS, uacp->usb_ac_log_handle,
2380 mutex_exit(&uacp->usb_ac_mutex);
2382 usb_ac_release_access(uacp);
2383 USB_DPRINTF_L4(PRINT_MASK_EVENTS, uacp->usb_ac_log_handle,
2397 usb_ac_state_t *uacp = (usb_ac_state_t *)ddi_get_soft_state(
2400 USB_DPRINTF_L4(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
2403 mutex_enter(&uacp->usb_ac_mutex);
2404 uacp->usb_ac_dev_state = USB_DEV_SUSPENDED;
2405 mutex_exit(&uacp->usb_ac_mutex);
2407 USB_DPRINTF_L4(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
2426 usb_ac_state_t *uacp = (usb_ac_state_t *)ddi_get_soft_state(
2429 USB_DPRINTF_L4(PRINT_MASK_EVENTS, uacp->usb_ac_log_handle,
2432 mutex_enter(&uacp->usb_ac_mutex);
2433 mutex_exit(&uacp->usb_ac_mutex);
2435 usb_ac_serialize_access(uacp);
2438 mutex_enter(&uacp->usb_ac_mutex);
2439 uacp->usb_ac_busy_count++;
2440 if (uacp->usb_ac_plumbing_state ==
2442 mutex_exit(&uacp->usb_ac_mutex);
2443 usb_ac_restore_device_state(dip, uacp);
2444 mutex_enter(&uacp->usb_ac_mutex);
2446 uacp->usb_ac_busy_count--;
2448 if (uacp->usb_ac_busy_count) {
2449 USB_DPRINTF_L0(PRINT_MASK_EVENTS, uacp->usb_ac_log_handle,
2453 mutex_exit(&uacp->usb_ac_mutex);
2455 usb_ac_release_access(uacp);
2456 USB_DPRINTF_L4(PRINT_MASK_EVENTS, uacp->usb_ac_log_handle,
2470 usb_ac_state_t *uacp = (usb_ac_state_t *)ddi_get_soft_state(
2473 USB_DPRINTF_L4(PRINT_MASK_EVENTS, uacp->usb_ac_log_handle,
2476 usb_ac_serialize_access(uacp);
2478 usb_ac_restore_device_state(dip, uacp);
2480 usb_ac_release_access(uacp);
2490 usb_ac_restore_device_state(dev_info_t *dip, usb_ac_state_t *uacp)
2495 USB_DPRINTF_L4(PRINT_MASK_ATTA, uacp->usb_ac_log_handle,
2498 usb_ac_pm_busy_component(uacp);
2502 if (usb_check_same_device(dip, uacp->usb_ac_log_handle,
2505 usb_ac_pm_idle_component(uacp);
2508 mutex_enter(&uacp->usb_ac_mutex);
2509 uacp->usb_ac_dev_state = USB_DEV_DISCONNECTED;
2510 mutex_exit(&uacp->usb_ac_mutex);
2515 mutex_enter(&uacp->usb_ac_mutex);
2516 uacpm = uacp->usb_ac_pm;
2519 mutex_exit(&uacp->usb_ac_mutex);
2521 if ((rval = usb_handle_remote_wakeup(uacp->usb_ac_dip,
2525 uacp->usb_ac_log_handle,
2531 mutex_enter(&uacp->usb_ac_mutex);
2536 uacp->usb_ac_busy_count++;
2537 uacp->usb_ac_dev_state = USB_DEV_ONLINE;
2538 if (uacp->usb_ac_plumbing_state == USB_AC_STATE_PLUMBED) {
2539 (void) usb_ac_restore_audio_state(uacp, 0);
2541 uacp->usb_ac_busy_count--;
2542 mutex_exit(&uacp->usb_ac_mutex);
2543 usb_ac_pm_idle_component(uacp);
2553 usb_ac_state_t *uacp = (usb_ac_state_t *)arg;
2555 USB_DPRINTF_L4(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
2558 usb_ac_serialize_access(uacp);
2560 mutex_enter(&uacp->usb_ac_mutex);
2562 if (uacp->usb_ac_plumbing_state ==
2564 mutex_exit(&uacp->usb_ac_mutex);
2572 usb_restore_engine(uacp);
2574 mutex_enter(&uacp->usb_ac_mutex);
2575 uacp->usb_ac_plumbing_state = USB_AC_STATE_PLUMBED;
2579 uacp->usb_ac_busy_count--;
2580 mutex_exit(&uacp->usb_ac_mutex);
2582 usb_ac_release_access(uacp);
2584 USB_DPRINTF_L4(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
2593 usb_ac_restore_audio_state(usb_ac_state_t *uacp, int flag)
2595 ASSERT(mutex_owned(&uacp->usb_ac_mutex));
2598 switch (uacp->usb_ac_plumbing_state) {
2600 uacp->usb_ac_plumbing_state =
2617 uacp->usb_ac_busy_count++;
2620 mutex_exit(&uacp->usb_ac_mutex);
2621 usb_ac_am_restore_state((void *)uacp);
2622 mutex_enter(&uacp->usb_ac_mutex);
2624 mutex_exit(&uacp->usb_ac_mutex);
2625 if (usb_async_req(uacp->usb_ac_dip,
2627 (void *)uacp, USB_FLAGS_SLEEP) != USB_SUCCESS) {
2629 mutex_enter(&uacp->usb_ac_mutex);
2630 uacp->usb_ac_busy_count--;
2634 mutex_enter(&uacp->usb_ac_mutex);
2653 usb_ac_setup(usb_ac_state_t *uacp, usb_audio_eng_t *engine)
2658 mutex_enter(&uacp->usb_ac_mutex);
2660 if (uacp->usb_ac_dev_state != USB_DEV_ONLINE) {
2661 mutex_exit(&uacp->usb_ac_mutex);
2665 mutex_exit(&uacp->usb_ac_mutex);
2667 usb_ac_serialize_access(uacp);
2670 rval = usb_ac_do_setup(uacp, engine);
2672 usb_ac_release_access(uacp);
2684 usb_ac_do_setup(usb_ac_state_t *uacp, usb_audio_eng_t *engine)
2689 mutex_enter(&uacp->usb_ac_mutex);
2699 USB_DPRINTF_L3(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
2703 mutex_exit(&uacp->usb_ac_mutex);
2709 if (usb_ac_send_as_cmd(uacp, engine, USB_AUDIO_SETUP, 0) !=
2711 USB_DPRINTF_L2(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
2716 mutex_exit(&uacp->usb_ac_mutex);
2721 mutex_exit(&uacp->usb_ac_mutex);
2734 usb_ac_teardown(usb_ac_state_t *uacp, usb_audio_eng_t *engine)
2739 usb_ac_serialize_access(uacp);
2745 mutex_enter(&uacp->usb_ac_mutex);
2758 USB_DPRINTF_L3(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
2767 if (usb_ac_send_as_cmd(uacp, engine, USB_AUDIO_TEARDOWN,
2770 USB_DPRINTF_L2(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
2780 mutex_exit(&uacp->usb_ac_mutex);
2782 USB_DPRINTF_L4(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
2784 usb_ac_release_access(uacp);
2794 usb_ac_set_monitor_gain(usb_ac_state_t *uacp, uint_t unit,
2798 uacp->usb_ac_units[unit].acu_descriptor;
2800 USB_DPRINTF_L4(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
2804 usb_ac_push_unit_id(uacp, unit);
2805 usb_ac_show_traverse_path(uacp);
2806 usb_ac_pop_unit_id(uacp, unit);
2828 if (usb_ac_check_path(uacp, USB_AUDIO_MIXER_UNIT) ==
2833 for (i = uacp->usb_ac_traverse_path_index - 1; i >= 0;
2835 id = uacp->usb_ac_traverse_path[i];
2837 switch (uacp->usb_ac_unit_type[id]) {
2847 if (usb_ac_set_gain(uacp, id, dir, channel,
2851 if (usb_ac_set_gain(uacp, id, dir,
2878 usb_ac_set_gain(usb_ac_state_t *uacp, uint_t featureID,
2883 USB_DPRINTF_L4(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
2887 if (usb_ac_feature_unit_check(uacp, featureID,
2893 if (usb_ac_get_maxmin_volume(uacp, channel,
2895 USB_DPRINTF_L2(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
2901 USB_DPRINTF_L3(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
2904 if (usb_ac_get_maxmin_volume(uacp, channel,
2906 USB_DPRINTF_L2(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
2912 USB_DPRINTF_L3(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
2915 if (usb_ac_get_maxmin_volume(uacp, channel,
2917 USB_DPRINTF_L2(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
2923 USB_DPRINTF_L3(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
2941 USB_DPRINTF_L3(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
2945 if (usb_ac_set_volume(uacp, channel, gain, dir,
2947 USB_DPRINTF_L2(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
2954 if (usb_ac_get_maxmin_volume(uacp, channel,
2956 USB_DPRINTF_L2(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
2960 USB_DPRINTF_L4(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
2983 usb_ac_set_format(usb_ac_state_t *uacp, usb_audio_eng_t *engine)
2989 mutex_enter(&uacp->usb_ac_mutex);
2992 if (uacp->usb_ac_dev_state != USB_DEV_ONLINE) {
2993 mutex_exit(&uacp->usb_ac_mutex);
2997 mutex_exit(&uacp->usb_ac_mutex);
2999 usb_ac_serialize_access(uacp);
3000 mutex_enter(&uacp->usb_ac_mutex);
3016 mutex_exit(&uacp->usb_ac_mutex);
3017 usb_ac_release_access(uacp);
3019 usb_ac_stop_play(uacp, engine);
3020 usb_ac_teardown(uacp, engine);
3022 usb_ac_serialize_access(uacp);
3023 mutex_enter(&uacp->usb_ac_mutex);
3032 if (usb_ac_send_as_cmd(uacp, engine,
3035 uacp->usb_ac_log_handle,
3043 if (usb_ac_send_as_cmd(uacp, engine, USB_AUDIO_SET_SAMPLE_FREQ,
3045 USB_DPRINTF_L2(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
3051 mutex_exit(&uacp->usb_ac_mutex);
3053 usb_ac_release_access(uacp);
3057 (void) usb_ac_setup(uacp, engine);
3060 mutex_enter(&uacp->usb_ac_mutex);
3062 mutex_exit(&uacp->usb_ac_mutex);
3067 mutex_exit(&uacp->usb_ac_mutex);
3068 usb_ac_release_access(uacp);
3080 usb_ac_start_play(usb_ac_state_t *uacp, usb_audio_eng_t *engine)
3086 mutex_enter(&uacp->usb_ac_mutex);
3087 if (uacp->usb_ac_dev_state != USB_DEV_ONLINE) {
3088 mutex_exit(&uacp->usb_ac_mutex);
3092 mutex_exit(&uacp->usb_ac_mutex);
3094 usb_ac_serialize_access(uacp);
3096 mutex_enter(&uacp->usb_ac_mutex);
3107 play_req.up_handle = uacp;
3110 if (usb_ac_send_as_cmd(uacp, engine, USB_AUDIO_START_PLAY,
3113 USB_DPRINTF_L2(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
3116 mutex_exit(&uacp->usb_ac_mutex);
3118 usb_ac_release_access(uacp);
3123 mutex_exit(&uacp->usb_ac_mutex);
3125 usb_ac_release_access(uacp);
3137 usb_ac_stop_play(usb_ac_state_t *uacp, usb_audio_eng_t *engine)
3141 engine = &(uacp->engines[0]);
3143 mutex_enter(&uacp->usb_ac_mutex);
3144 if (uacp->usb_ac_dev_state != USB_DEV_ONLINE) {
3145 mutex_exit(&uacp->usb_ac_mutex);
3149 mutex_exit(&uacp->usb_ac_mutex);
3151 usb_ac_serialize_access(uacp);
3152 mutex_enter(&uacp->usb_ac_mutex);
3155 if (usb_ac_send_as_cmd(uacp, engine, USB_AUDIO_PAUSE_PLAY,
3158 USB_DPRINTF_L2(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
3162 mutex_exit(&uacp->usb_ac_mutex);
3163 usb_ac_release_access(uacp);
3173 usb_ac_start_record(usb_ac_state_t *uacp, usb_audio_eng_t *engine)
3177 mutex_enter(&uacp->usb_ac_mutex);
3178 if (uacp->usb_ac_dev_state != USB_DEV_ONLINE) {
3179 mutex_exit(&uacp->usb_ac_mutex);
3183 mutex_exit(&uacp->usb_ac_mutex);
3185 usb_ac_serialize_access(uacp);
3186 mutex_enter(&uacp->usb_ac_mutex);
3190 if (usb_ac_send_as_cmd(uacp, engine, USB_AUDIO_START_RECORD,
3191 (void *)uacp) != USB_SUCCESS) {
3193 USB_DPRINTF_L2(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
3196 mutex_exit(&uacp->usb_ac_mutex);
3198 usb_ac_release_access(uacp);
3203 mutex_exit(&uacp->usb_ac_mutex);
3204 usb_ac_release_access(uacp);
3216 usb_ac_stop_record(usb_ac_state_t *uacp, usb_audio_eng_t *engine)
3219 usb_ac_serialize_access(uacp);
3220 mutex_enter(&uacp->usb_ac_mutex);
3223 if (usb_ac_send_as_cmd(uacp, engine, USB_AUDIO_STOP_RECORD,
3226 USB_DPRINTF_L2(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
3230 mutex_exit(&uacp->usb_ac_mutex);
3231 usb_ac_release_access(uacp);
3245 usb_ac_get_maxmin_volume(usb_ac_state_t *uacp, uint_t channel, int cmd,
3253 mutex_exit(&uacp->usb_ac_mutex);
3256 uacp->usb_ac_dip,
3257 uacp->usb_ac_default_ph,
3264 (feature_unitID << 8)| uacp->usb_ac_ifno, /* wIndex */
3270 USB_DPRINTF_L2(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
3276 mutex_enter(&uacp->usb_ac_mutex);
3281 mutex_enter(&uacp->usb_ac_mutex);
3286 USB_DPRINTF_L4(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
3301 usb_ac_set_volume(usb_ac_state_t *uacp, uint_t channel, short gain, int dir,
3310 mutex_exit(&uacp->usb_ac_mutex);
3315 USB_DPRINTF_L2(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
3317 mutex_enter(&uacp->usb_ac_mutex);
3328 uacp->usb_ac_dip,
3329 uacp->usb_ac_default_ph,
3336 (feature_unitID << 8) | uacp->usb_ac_ifno, /* wIndex */
3340 USB_DPRINTF_L2(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
3346 mutex_enter(&uacp->usb_ac_mutex);
3357 usb_ac_set_mute(usb_ac_state_t *uacp, uint_t featureID, uint_t dir,
3366 if (usb_ac_feature_unit_check(uacp, featureID,
3371 mutex_exit(&uacp->usb_ac_mutex);
3377 USB_DPRINTF_L2(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
3379 mutex_enter(&uacp->usb_ac_mutex);
3388 uacp->usb_ac_dip,
3389 uacp->usb_ac_default_ph,
3396 (featureID << 8) | uacp->usb_ac_ifno, /* wIndex */
3402 USB_DPRINTF_L2(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
3407 mutex_enter(&uacp->usb_ac_mutex);
3422 usb_ac_send_as_cmd(usb_ac_state_t *uacp, usb_audio_eng_t *engine,
3431 ASSERT(mutex_owned(&uacp->usb_ac_mutex));
3440 USB_DPRINTF_L2(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
3454 usb_ac_serialize_access(usb_ac_state_t *uacp)
3456 (void) usb_serialize_access(uacp->usb_ac_ser_acc, USB_WAIT, 0);
3460 usb_ac_release_access(usb_ac_state_t *uacp)
3462 usb_release_access(uacp->usb_ac_ser_acc);
3528 usb_ac_state_t *uacp = acp->acp_uacp;
3534 mutex_enter(&uacp->usb_ac_mutex);
3541 mutex_exit(&uacp->usb_ac_mutex);
3545 mutex_enter(&uacp->usb_ac_mutex);
3548 USB_DPRINTF_L2(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
3558 mutex_exit(&uacp->usb_ac_mutex);
3569 usb_ac_state_t *uacp = acp->acp_uacp;
3577 mutex_enter(&uacp->usb_ac_mutex);
3579 dip = uacp->usb_ac_dip;
3585 USB_DPRINTF_L4(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
3604 USB_DPRINTF_L4(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
3610 mutex_exit(&uacp->usb_ac_mutex);
3612 USB_DPRINTF_L3(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
3622 usb_ac_state_t *uacp = (usb_ac_state_t *)arg;
3624 if (usb_ac_mux_plumbing(uacp) != USB_SUCCESS)
3625 USB_DPRINTF_L2(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
3631 usb_ac_do_plumbing(usb_ac_state_t *uacp)
3633 dev_info_t *dip = uacp->usb_ac_dip;
3641 uacp->tqp = ddi_taskq_create(dip, tq_nm, 1, TASKQ_DEFAULTPRI, 0);
3642 if (uacp->tqp == NULL) {
3643 USB_DPRINTF_L2(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
3648 if (ddi_taskq_dispatch(uacp->tqp, usb_ac_mux_plumbing_tq, (void *)uacp,
3650 USB_DPRINTF_L2(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
3666 usb_ac_state_t *uacp = (usb_ac_state_t *)arg;
3668 if (usb_ac_mux_unplumbing(uacp) != USB_SUCCESS)
3669 USB_DPRINTF_L2(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
3675 usb_ac_do_unplumbing(usb_ac_state_t *uacp)
3679 if (uacp->tqp == NULL)
3682 if (ddi_taskq_dispatch(uacp->tqp, usb_ac_mux_unplumbing_tq,
3683 (void *)uacp, DDI_SLEEP) != DDI_SUCCESS) {
3684 USB_DPRINTF_L2(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
3689 USB_DPRINTF_L4(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
3692 ddi_taskq_wait(uacp->tqp);
3695 USB_DPRINTF_L4(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
3699 if (uacp->tqp != NULL) {
3700 ddi_taskq_destroy(uacp->tqp);
3701 uacp->tqp = NULL;
3715 usb_ac_state_t *uacp = acp->acp_uacp;
3718 USB_DPRINTF_L4(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
3722 USB_DPRINTF_L4(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
3728 mutex_enter(&uacp->usb_ac_mutex);
3743 mutex_exit(&uacp->usb_ac_mutex);
3745 USB_DPRINTF_L4(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
3752 usb_ac_mux_plumbing(usb_ac_state_t *uacp)
3757 dip = uacp->usb_ac_dip;
3760 mutex_enter(&uacp->usb_ac_mutex);
3762 USB_DPRINTF_L4(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
3764 uacp->usb_ac_plumbing_state);
3766 if (uacp->usb_ac_plumbing_state >= USB_AC_STATE_PLUMBED) {
3767 mutex_exit(&uacp->usb_ac_mutex);
3768 USB_DPRINTF_L2(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
3776 if (usb_ac_online_siblings(uacp) != USB_SUCCESS) {
3777 mutex_exit(&uacp->usb_ac_mutex);
3778 USB_DPRINTF_L2(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
3784 USB_DPRINTF_L4(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
3786 mutex_exit(&uacp->usb_ac_mutex);
3789 usb_ac_pm_busy_component(uacp);
3793 usb_ac_hold_siblings(uacp);
3795 mutex_enter(&uacp->usb_ac_mutex);
3802 if (usb_ac_mux_walk_siblings(uacp) == 0) {
3804 uacp->usb_ac_plumbing_state = USB_AC_STATE_PLUMBED;
3806 mutex_exit(&uacp->usb_ac_mutex);
3808 (void) usb_ac_mux_unplumbing(uacp);
3810 USB_DPRINTF_L2(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
3813 usb_ac_rele_siblings(uacp);
3815 usb_ac_pm_idle_component(uacp);
3819 uacp->usb_ac_plumbing_state = USB_AC_STATE_PLUMBED;
3822 if (uacp->usb_ac_registered_with_mixer) {
3823 USB_DPRINTF_L3(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
3827 (void) usb_ac_restore_audio_state(uacp, USB_FLAGS_SLEEP);
3829 } else if (usb_ac_mixer_registration(uacp) != USB_SUCCESS) {
3830 mutex_exit(&uacp->usb_ac_mutex);
3832 USB_DPRINTF_L3(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
3835 (void) usb_ac_mux_unplumbing(uacp);
3837 usb_ac_rele_siblings(uacp);
3839 usb_ac_pm_idle_component(uacp);
3844 mutex_exit(&uacp->usb_ac_mutex);
3845 usb_ac_rele_siblings(uacp);
3847 usb_ac_pm_idle_component(uacp);
3849 USB_DPRINTF_L4(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
3857 usb_ac_mux_unplumbing(usb_ac_state_t *uacp)
3868 mutex_enter(&uacp->usb_ac_mutex);
3871 if (uacp->usb_ac_plumbing_state == USB_AC_STATE_UNPLUMBED) {
3872 USB_DPRINTF_L4(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
3874 mutex_exit(&uacp->usb_ac_mutex);
3880 if (uacp->usb_ac_current_plumbed_index == -1) {
3881 USB_DPRINTF_L4(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
3883 uacp->usb_ac_plumbing_state = USB_AC_STATE_UNPLUMBED;
3884 mutex_exit(&uacp->usb_ac_mutex);
3890 if (uacp->usb_ac_busy_count) {
3891 USB_DPRINTF_L2(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
3893 uacp->usb_ac_busy_count);
3894 mutex_exit(&uacp->usb_ac_mutex);
3899 uacp->usb_ac_plumbing_state = USB_AC_STATE_UNPLUMBED;
3902 maxlinked = uacp->usb_ac_current_plumbed_index + 1;
3903 USB_DPRINTF_L4(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
3911 acp = &uacp->usb_ac_plumbed[i];
3917 USB_DPRINTF_L3(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
3925 uacp->usb_ac_current_plumbed_index = i;
3927 USB_DPRINTF_L4(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
3935 mutex_exit(&uacp->usb_ac_mutex);
3937 USB_DPRINTF_L4(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
3949 USB_DPRINTF_L4(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
3952 mutex_enter(&uacp->usb_ac_mutex);
3956 mutex_exit(&uacp->usb_ac_mutex);
3959 usb_ac_serialize_access(uacp);
3960 usb_ac_release_access(uacp);
3962 mutex_enter(&uacp->usb_ac_mutex);
3963 uacp->usb_ac_current_plumbed_index = -1;
3964 mutex_exit(&uacp->usb_ac_mutex);
3966 USB_DPRINTF_L4(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
3977 usb_ac_mux_walk_siblings(usb_ac_state_t *uacp)
3991 ASSERT(mutex_owned(&uacp->usb_ac_mutex));
3993 pdip = ddi_get_parent(uacp->usb_ac_dip);
4000 USB_DPRINTF_L3(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
4005 if (child_dip == uacp->usb_ac_dip) {
4013 uacp->usb_ac_plumbed[count].acp_driver = USB_AS_PLUMBED;
4016 uacp->usb_ac_plumbed[count].acp_driver = USB_AH_PLUMBED;
4020 uacp->usb_ac_plumbed[count].acp_driver =
4041 uacp->usb_ac_current_plumbed_index = count;
4043 mutex_exit(&uacp->usb_ac_mutex);
4047 USB_DPRINTF_L3(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
4051 error = ldi_ident_from_dip(uacp->usb_ac_dip, &li);
4053 mutex_enter(&uacp->usb_ac_mutex);
4054 uacp->usb_ac_plumbed[count].acp_flags |= ACP_ENABLED;
4055 mutex_exit(&uacp->usb_ac_mutex);
4062 mutex_enter(&uacp->usb_ac_mutex);
4064 USB_DPRINTF_L2(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
4071 uacp->usb_ac_plumbed[count].acp_uacp = uacp;
4072 uacp->usb_ac_plumbed[count].acp_devt = drv_devt;
4073 uacp->usb_ac_plumbed[count].acp_lh = drv_lh;
4074 uacp->usb_ac_plumbed[count].acp_dip = child_dip;
4075 uacp->usb_ac_plumbed[count].acp_ifno =
4078 if (uacp->usb_ac_plumbed[count].acp_driver == USB_AS_PLUMBED) {
4080 if (usb_ac_get_reg_data(uacp, drv_lh, count) !=
4084 uacp->usb_ac_log_handle,
4089 uacp->usb_ac_plumbed[count].acp_dip = NULL;
4093 } else if (uacp->usb_ac_plumbed[count].acp_driver ==
4097 USB_DPRINTF_L3(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
4101 mutex_exit(&uacp->usb_ac_mutex);
4106 mutex_enter(&uacp->usb_ac_mutex);
4110 uacp->usb_ac_log_handle,
4115 uacp->usb_ac_plumbed[count].acp_dip = NULL;
4123 USB_DPRINTF_L2(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
4128 uacp->usb_ac_plumbed[count].acp_dip = NULL;
4135 mutex_exit(&uacp->usb_ac_mutex);
4136 error = usb_ac_plumb(&uacp->usb_ac_plumbed[count]);
4137 mutex_enter(&uacp->usb_ac_mutex);
4140 USB_DPRINTF_L2(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
4147 USB_DPRINTF_L3(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
4155 USB_DPRINTF_L4(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
4171 usb_ac_mixer_registration(usb_ac_state_t *uacp)
4176 if (uacp->usb_ac_registered_with_mixer) {
4181 if (uacp->usb_ac_streams[n].acs_rcvd_reg_data) {
4188 USB_DPRINTF_L2(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
4202 if (uacp->usb_ac_streams[n].acs_rcvd_reg_data == 0) {
4206 asreg = &(uacp->usb_ac_streams[n].acs_streams_reg);
4216 if ((id = usb_ac_get_featureID(uacp,
4220 uacp->usb_ac_log_handle,
4229 uacp->usb_ac_streams[n].acs_default_gain =
4232 USB_DPRINTF_L3(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
4236 uacp->usb_ac_streams[n].acs_default_gain, id);
4242 USB_DPRINTF_L4(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
4245 mutex_exit(&uacp->usb_ac_mutex);
4247 if (usb_audio_register(uacp) != USB_SUCCESS) {
4248 USB_DPRINTF_L2(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
4251 mutex_enter(&uacp->usb_ac_mutex);
4256 mutex_enter(&uacp->usb_ac_mutex);
4258 uacp->usb_ac_registered_with_mixer = 1;
4268 usb_ac_get_reg_data(usb_ac_state_t *uacp, ldi_handle_t drv_lh, int index)
4274 ASSERT(uacp->usb_ac_registered_with_mixer == 0);
4281 if (!uacp->usb_ac_streams[n].acs_rcvd_reg_data) {
4287 USB_DPRINTF_L2(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
4295 streams_reg = &uacp->usb_ac_streams[n].acs_streams_reg;
4297 USB_DPRINTF_L4(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
4301 mutex_exit(&uacp->usb_ac_mutex);
4305 USB_DPRINTF_L2(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
4309 mutex_enter(&uacp->usb_ac_mutex);
4313 mutex_enter(&uacp->usb_ac_mutex);
4315 rval = usb_ac_setup_plumbed(uacp, index, n);
4317 USB_DPRINTF_L4(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
4320 uacp->usb_ac_streams[n].acs_rcvd_reg_data,
4324 usb_ac_print_reg_data(uacp, streams_reg);
4335 usb_ac_setup_plumbed(usb_ac_state_t *uacp, int plb_idx, int str_idx)
4337 uacp->usb_ac_plumbed[plb_idx].acp_data =
4338 &uacp->usb_ac_streams[str_idx];
4339 uacp->usb_ac_streams[str_idx].acs_plumbed =
4340 &uacp->usb_ac_plumbed[plb_idx];
4341 uacp->usb_ac_streams[str_idx].acs_rcvd_reg_data = 1;
4344 USB_DPRINTF_L4(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
4356 usb_ac_print_reg_data(usb_ac_state_t *uacp,
4362 USB_DPRINTF_L3(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
4371 USB_DPRINTF_L3(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
4377 USB_DPRINTF_L3(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
4381 USB_DPRINTF_L4(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
4387 usb_ac_online_siblings(usb_ac_state_t *uacp)
4392 ASSERT(mutex_owned(&uacp->usb_ac_mutex));
4394 USB_DPRINTF_L4(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
4397 pdip = ddi_get_parent(uacp->usb_ac_dip);
4402 USB_DPRINTF_L3(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
4412 mutex_exit(&uacp->usb_ac_mutex);
4416 uacp->usb_ac_log_handle,
4424 mutex_enter(&uacp->usb_ac_mutex);
4429 mutex_enter(&uacp->usb_ac_mutex);
4443 usb_ac_hold_siblings(usb_ac_state_t *uacp)
4448 USB_DPRINTF_L4(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
4452 pdip = ddi_get_parent(uacp->usb_ac_dip);
4460 USB_DPRINTF_L4(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
4475 usb_ac_rele_siblings(usb_ac_state_t *uacp)
4480 USB_DPRINTF_L4(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
4484 pdip = ddi_get_parent(uacp->usb_ac_dip);
4490 USB_DPRINTF_L3(PRINT_MASK_ALL, uacp->usb_ac_log_handle,
4594 usb_ac_add_eng(usb_ac_state_t *uacp, usb_ac_streams_info_t *asinfo)
4596 audio_dev_t *af_devp = uacp->usb_ac_audio_dev;
4608 engp = &(uacp->engines[0]);
4610 engp = &(uacp->engines[1]);
4621 engp->statep = uacp;
4640 USB_DPRINTF_L2(PRINT_MASK_ATTA, uacp->usb_ac_log_handle,
4656 if (usb_ac_set_format(uacp, engp) != USB_SUCCESS) {
4657 USB_DPRINTF_L2(PRINT_MASK_ATTA, uacp->usb_ac_log_handle,
4665 usb_ac_rem_eng(uacp, engp);