Lines Matching refs:as

490 #define SOURCE_INFO_SIZE(as) ((as)->type == AC97_CODEC_TYPE_MODEM ? \  argument
929 #define POWER_EAMP_ON(as) ((as->host_flags & AC97_HOST_INVERTED_EAMP) \ argument
931 #define POWER_EAMP_OFF(as) ((as->host_flags & AC97_HOST_INVERTED_EAMP) \ argument
935 ac97_read(struct ac97_softc *as, uint8_t reg, uint16_t *val) in ac97_read() argument
937 KASSERT(mutex_owned(as->lock)); in ac97_read()
939 if (as->host_flags & AC97_HOST_DONT_READ && in ac97_read()
942 *val = as->shadow_reg[reg >> 1]; in ac97_read()
946 if (as->host_if->read(as->host_if->arg, reg, val)) { in ac97_read()
947 *val = as->shadow_reg[reg >> 1]; in ac97_read()
952 ac97_write(struct ac97_softc *as, uint8_t reg, uint16_t val) in ac97_write() argument
954 KASSERT(mutex_owned(as->lock)); in ac97_write()
957 as->shadow_reg[reg >> 1] = val; in ac97_write()
958 return as->host_if->write(as->host_if->arg, reg, val); in ac97_write()
963 as->shadow_reg[reg >> 1] = val; in ac97_write()
964 ret = as->host_if->write(as->host_if->arg, reg, val); in ac97_write()
965 as->host_if->read(as->host_if->arg, reg, &actual); in ac97_write()
975 ac97_setup_defaults(struct ac97_softc *as) in ac97_setup_defaults() argument
980 KASSERT(mutex_owned(as->lock)); in ac97_setup_defaults()
982 memset(as->shadow_reg, 0, sizeof(as->shadow_reg)); in ac97_setup_defaults()
987 ac97_write(as, si->reg, si->default_value); in ac97_setup_defaults()
992 ac97_write(as, si->reg, si->default_value); in ac97_setup_defaults()
999 struct ac97_softc *as; in ac97_restore_shadow() local
1004 as = (struct ac97_softc *)codec_if; in ac97_restore_shadow()
1006 KASSERT(mutex_owned(as->lock)); in ac97_restore_shadow()
1008 if (as->type == AC97_CODEC_TYPE_AUDIO) { in ac97_restore_shadow()
1010 ac97_write(as, AC97_REG_POWER, as->power_reg); in ac97_restore_shadow()
1013 ac97_read(as, AC97_REG_POWER, &val); in ac97_restore_shadow()
1014 if ((val & as->power_all) == as->power_all) in ac97_restore_shadow()
1024 ac97_write(as, AC97_REG_MASTER_VOLUME, 0x1010); in ac97_restore_shadow()
1025 ac97_read(as, AC97_REG_MASTER_VOLUME, &val); in ac97_restore_shadow()
1032 for (idx = 0; idx < SOURCE_INFO_SIZE(as); idx++) { in ac97_restore_shadow()
1033 if (as->type == AC97_CODEC_TYPE_MODEM) in ac97_restore_shadow()
1039 ac97_write(as, si->reg, as->shadow_reg[si->reg >> 1]); in ac97_restore_shadow()
1042 if (as->ext_id & (AC97_EXT_AUDIO_VRA | AC97_EXT_AUDIO_DRA in ac97_restore_shadow()
1046 ac97_write(as, AC97_REG_EXT_AUDIO_CTRL, in ac97_restore_shadow()
1047 as->shadow_reg[AC97_REG_EXT_AUDIO_CTRL >> 1]); in ac97_restore_shadow()
1049 if (as->ext_mid & (AC97_EXT_MODEM_LINE1 | AC97_EXT_MODEM_LINE2 in ac97_restore_shadow()
1053 ac97_write(as, AC97_REG_EXT_MODEM_CTRL, in ac97_restore_shadow()
1054 as->shadow_reg[AC97_REG_EXT_MODEM_CTRL >> 1]); in ac97_restore_shadow()
1065 ac97_check_capability(struct ac97_softc *as, int check) in ac97_check_capability() argument
1071 return as->ext_id & AC97_EXT_AUDIO_SDAC; in ac97_check_capability()
1073 return as->ext_id & AC97_EXT_AUDIO_CDAC; in ac97_check_capability()
1075 return as->ext_id & AC97_EXT_AUDIO_LDAC; in ac97_check_capability()
1077 return as->ext_id & AC97_EXT_AUDIO_SPDIF; in ac97_check_capability()
1079 return as->caps & AC97_CAPS_HEADPHONES; in ac97_check_capability()
1081 return as->caps & AC97_CAPS_TONECTRL; in ac97_check_capability()
1083 return as->caps & AC97_CAPS_MICIN; in ac97_check_capability()
1085 return as->caps & AC97_CAPS_LOUDNESS; in ac97_check_capability()
1087 return AC97_CAPS_ENHANCEMENT(as->caps) != 0; in ac97_check_capability()
1089 return as->ext_mid & AC97_EXT_MODEM_LINE1; in ac97_check_capability()
1091 return as->ext_mid & AC97_EXT_MODEM_LINE2; in ac97_check_capability()
1093 return as->ext_mid & AC97_EXT_MODEM_HANDSET; in ac97_check_capability()
1101 ac97_setup_source_info(struct ac97_softc *as) in ac97_setup_source_info() argument
1107 KASSERT(mutex_owned(as->lock)); in ac97_setup_source_info()
1109 for (idx = 0, ouridx = 0; idx < SOURCE_INFO_SIZE(as); idx++) { in ac97_setup_source_info()
1110 si = &as->source_info[ouridx]; in ac97_setup_source_info()
1111 if (as->type == AC97_CODEC_TYPE_MODEM) { in ac97_setup_source_info()
1116 if (!ac97_check_capability(as, si->req_feature)) in ac97_setup_source_info()
1120 ac97_read(as, si->reg, &value1); in ac97_setup_source_info()
1124 ac97_write(as, si->reg, value2); in ac97_setup_source_info()
1126 ac97_read(as, si->reg, &value3); in ac97_setup_source_info()
1134 ac97_write(as, si->reg, value1); in ac97_setup_source_info()
1148 si = &as->source_info[ouridx]; in ac97_setup_source_info()
1149 if (as->type == AC97_CODEC_TYPE_MODEM) in ac97_setup_source_info()
1176 as->num_source_info = ouridx; in ac97_setup_source_info()
1178 for (idx = 0; idx < as->num_source_info; idx++) { in ac97_setup_source_info()
1181 si = &as->source_info[idx]; in ac97_setup_source_info()
1184 for (idx2 = 0; idx2 < as->num_source_info; idx2++) { in ac97_setup_source_info()
1185 si2 = &as->source_info[idx2]; in ac97_setup_source_info()
1205 for (idx2 = 0; idx2 < as->num_source_info; idx2++) { in ac97_setup_source_info()
1209 si2 = &as->source_info[idx2]; in ac97_setup_source_info()
1214 as->source_info[previdx].next = idx2; in ac97_setup_source_info()
1215 as->source_info[idx2].prev = previdx; in ac97_setup_source_info()
1221 as->source_info[previdx].next = AUDIO_MIXER_LAST; in ac97_setup_source_info()
1235 struct ac97_softc *as; in ac97_attach_type() local
1247 as = malloc(sizeof(struct ac97_softc), M_DEVBUF, M_WAITOK|M_ZERO); in ac97_attach_type()
1249 if (as == NULL) in ac97_attach_type()
1252 as->codec_if.vtbl = &ac97civ; in ac97_attach_type()
1253 as->host_if = host_if; in ac97_attach_type()
1254 as->type = type; in ac97_attach_type()
1255 as->lock = lk; in ac97_attach_type()
1257 if ((error = host_if->attach(host_if->arg, &as->codec_if))) { in ac97_attach_type()
1258 free(as, M_DEVBUF); in ac97_attach_type()
1262 mutex_enter(as->lock); in ac97_attach_type()
1266 mutex_exit(as->lock); in ac97_attach_type()
1267 free(as, M_DEVBUF); in ac97_attach_type()
1273 as->host_flags = host_if->flags(host_if->arg); in ac97_attach_type()
1279 as->power_all = AC97_POWER_REF | AC97_POWER_ANL | AC97_POWER_DAC | in ac97_attach_type()
1281 if (as->type == AC97_CODEC_TYPE_AUDIO) { in ac97_attach_type()
1290 ac97_read(as, AC97_REG_POWER, &val); in ac97_attach_type()
1293 as->power_all &= ~AC97_POWER_ANL; in ac97_attach_type()
1295 host_if->write(host_if->arg, AC97_REG_POWER, POWER_EAMP_ON(as)); in ac97_attach_type()
1298 ac97_read(as, AC97_REG_POWER, &val); in ac97_attach_type()
1299 if ((val & as->power_all) == as->power_all) in ac97_attach_type()
1305 ac97_read(as, AC97_REG_POWER, &as->power_reg); in ac97_attach_type()
1306 } else if (as->type == AC97_CODEC_TYPE_MODEM) { in ac97_attach_type()
1310 ac97_setup_defaults(as); in ac97_attach_type()
1311 if (as->type == AC97_CODEC_TYPE_AUDIO) in ac97_attach_type()
1312 ac97_read(as, AC97_REG_RESET, &as->caps); in ac97_attach_type()
1313 ac97_read(as, AC97_REG_VENDOR_ID1, &id1); in ac97_attach_type()
1314 ac97_read(as, AC97_REG_VENDOR_ID2, &id2); in ac97_attach_type()
1316 mutex_exit(as->lock); in ac97_attach_type()
1346 if (as->caps & (1 << i)) { in ac97_attach_type()
1352 ac97enhancement[AC97_CAPS_ENHANCEMENT(as->caps)]); in ac97_attach_type()
1354 as->ac97_clock = AC97_STANDARD_CLOCK; in ac97_attach_type()
1356 mutex_enter(as->lock); in ac97_attach_type()
1358 if (as->type == AC97_CODEC_TYPE_AUDIO) { in ac97_attach_type()
1359 ac97_read(as, AC97_REG_EXT_AUDIO_ID, &as->ext_id); in ac97_attach_type()
1360 if (as->ext_id != 0) { in ac97_attach_type()
1361 mutex_exit(as->lock); in ac97_attach_type()
1367 "\7CDAC\4VRM\3SPDIF\2DRA\1VRA", as->ext_id); in ac97_attach_type()
1372 if (as->ext_id & AC97_EXT_AUDIO_DSA_MASK) { in ac97_attach_type()
1374 switch (as->ext_id & AC97_EXT_AUDIO_DSA_MASK) { in ac97_attach_type()
1386 if (as->host_flags & AC97_HOST_INVERTED_EAMP) { in ac97_attach_type()
1391 mutex_enter(as->lock); in ac97_attach_type()
1394 ac97_read(as, AC97_REG_EXT_AUDIO_CTRL, &extstat); in ac97_attach_type()
1396 if (as->ext_id & AC97_EXT_AUDIO_LDAC) in ac97_attach_type()
1398 if (as->ext_id & AC97_EXT_AUDIO_SDAC) in ac97_attach_type()
1400 if (as->ext_id & AC97_EXT_AUDIO_CDAC) in ac97_attach_type()
1402 if (as->ext_id & AC97_EXT_AUDIO_VRM) in ac97_attach_type()
1404 if (as->ext_id & AC97_EXT_AUDIO_SPDIF) { in ac97_attach_type()
1408 ac97_read(as, AC97_REG_SPDIF_CTRL, &val); in ac97_attach_type()
1411 ac97_write(as, AC97_REG_SPDIF_CTRL, val); in ac97_attach_type()
1413 if (as->ext_id & AC97_EXT_AUDIO_VRA) in ac97_attach_type()
1415 ac97_write(as, AC97_REG_EXT_AUDIO_CTRL, extstat); in ac97_attach_type()
1416 if (as->ext_id & AC97_EXT_AUDIO_VRA) { in ac97_attach_type()
1419 ac97_write(as, AC97_REG_PCM_FRONT_DAC_RATE, in ac97_attach_type()
1421 ac97_read(as, AC97_REG_PCM_FRONT_DAC_RATE, in ac97_attach_type()
1425 as->ext_id = 0; in ac97_attach_type()
1430 ac97_write(as, AC97_REG_PCM_FRONT_DAC_RATE, in ac97_attach_type()
1434 } else if (as->type == AC97_CODEC_TYPE_MODEM) { in ac97_attach_type()
1442 ac97_read(as, AC97_REG_EXT_MODEM_ID, &as->ext_mid); in ac97_attach_type()
1443 mutex_exit(as->lock); in ac97_attach_type()
1445 if (as->ext_mid == 0 || as->ext_mid == 0xffff) { in ac97_attach_type()
1447 free(as, M_DEVBUF); in ac97_attach_type()
1450 as->type = AC97_CODEC_TYPE_MODEM; in ac97_attach_type()
1454 "\20\5CID2\4CID1\3HANDSET\2LINE2\1LINE1", as->ext_mid); in ac97_attach_type()
1458 (as->ext_mid & 0xc000) == 0 ? in ac97_attach_type()
1462 err = sysctl_createv(&as->log, 0, NULL, NULL, 0, CTLTYPE_NODE, in ac97_attach_type()
1467 err = sysctl_createv(&as->log, 0, NULL, &node, 0, in ac97_attach_type()
1474 mutex_enter(as->lock); in ac97_attach_type()
1477 ac97_write(as, AC97_REG_EXT_MODEM_ID, 1); in ac97_attach_type()
1481 if (as->ext_mid & AC97_EXT_MODEM_LINE1) { in ac97_attach_type()
1482 ac97_write(as, AC97_REG_LINE1_RATE, xrate); in ac97_attach_type()
1486 if (as->ext_mid & AC97_EXT_MODEM_LINE2) { in ac97_attach_type()
1487 ac97_write(as, AC97_REG_LINE2_RATE, xrate); in ac97_attach_type()
1491 if (as->ext_mid & AC97_EXT_MODEM_HANDSET) { in ac97_attach_type()
1492 ac97_write(as, AC97_REG_HANDSET_RATE, xrate); in ac97_attach_type()
1498 ac97_write(as, AC97_REG_EXT_MODEM_CTRL, 0); in ac97_attach_type()
1500 ac97_read(as, AC97_REG_EXT_MODEM_CTRL, &reg); in ac97_attach_type()
1506 mutex_exit(as->lock); in ac97_attach_type()
1513 if (as->ext_mid & AC97_EXT_MODEM_LINE1) { in ac97_attach_type()
1514 ac97_read(as, AC97_REG_GPIO_CFG, &reg); in ac97_attach_type()
1516 ac97_write(as, AC97_REG_GPIO_CFG, reg); in ac97_attach_type()
1517 ac97_read(as, AC97_REG_GPIO_POLARITY, &reg); in ac97_attach_type()
1519 ac97_write(as, AC97_REG_GPIO_POLARITY, reg); in ac97_attach_type()
1521 mutex_exit(as->lock); in ac97_attach_type()
1522 err = sysctl_createv(&as->log, 0, NULL, &node_line1, in ac97_attach_type()
1526 ac97_sysctl_verify, 0, (void *)as, 0, in ac97_attach_type()
1529 mutex_enter(as->lock); in ac97_attach_type()
1533 as->offhook_line1_mib = node_line1->sysctl_num; in ac97_attach_type()
1535 if (as->ext_mid & AC97_EXT_MODEM_LINE2) { in ac97_attach_type()
1536 ac97_read(as, AC97_REG_GPIO_CFG, &reg); in ac97_attach_type()
1538 ac97_write(as, AC97_REG_GPIO_CFG, reg); in ac97_attach_type()
1539 ac97_read(as, AC97_REG_GPIO_POLARITY, &reg); in ac97_attach_type()
1541 ac97_write(as, AC97_REG_GPIO_POLARITY, reg); in ac97_attach_type()
1543 mutex_exit(as->lock); in ac97_attach_type()
1544 err = sysctl_createv(&as->log, 0, NULL, &node_line2, in ac97_attach_type()
1548 ac97_sysctl_verify, 0, (void *)as, 0, in ac97_attach_type()
1551 mutex_enter(as->lock); in ac97_attach_type()
1555 as->offhook_line2_mib = node_line2->sysctl_num; in ac97_attach_type()
1559 ac97_write(as, AC97_REG_GPIO_STICKY, 0xffff); in ac97_attach_type()
1560 ac97_write(as, AC97_REG_GPIO_WAKEUP, 0x0); in ac97_attach_type()
1561 ac97_write(as, AC97_REG_MISC_AFE, 0x0); in ac97_attach_type()
1564 as->source_info = (as->type == AC97_CODEC_TYPE_MODEM ? in ac97_attach_type()
1565 as->modem_source_info : as->audio_source_info); in ac97_attach_type()
1566 ac97_setup_source_info(as); in ac97_attach_type()
1590 ctl.dev = ac97_get_portnum_by_name(&as->codec_if, in ac97_attach_type()
1592 ac97_mixer_set_port(&as->codec_if, &ctl); in ac97_attach_type()
1596 ctl.dev = ac97_get_portnum_by_name(&as->codec_if, AudioCrecord, in ac97_attach_type()
1598 ac97_mixer_set_port(&as->codec_if, &ctl); in ac97_attach_type()
1605 ctl.dev = ac97_get_portnum_by_name(&as->codec_if, AudioCoutputs, in ac97_attach_type()
1607 ac97_mixer_set_port(&as->codec_if, &ctl); in ac97_attach_type()
1608 ctl.dev = ac97_get_portnum_by_name(&as->codec_if, AudioCoutputs, in ac97_attach_type()
1610 ac97_mixer_set_port(&as->codec_if, &ctl); in ac97_attach_type()
1612 ctl.dev = ac97_get_portnum_by_name(&as->codec_if, AudioCoutputs, in ac97_attach_type()
1614 ac97_mixer_set_port(&as->codec_if, &ctl); in ac97_attach_type()
1615 ctl.dev = ac97_get_portnum_by_name(&as->codec_if, AudioCoutputs, in ac97_attach_type()
1617 ac97_mixer_set_port(&as->codec_if, &ctl); in ac97_attach_type()
1620 initfunc(as); in ac97_attach_type()
1623 if (as->type == AC97_CODEC_TYPE_AUDIO) in ac97_attach_type()
1624 ac97_write(as, AC97_REG_POWER, as->power_reg); in ac97_attach_type()
1626 mutex_exit(as->lock); in ac97_attach_type()
1634 struct ac97_softc *as; in ac97_detach() local
1636 as = (struct ac97_softc *)codec_if; in ac97_detach()
1638 mutex_enter(as->lock); in ac97_detach()
1639 ac97_write(as, AC97_REG_POWER, AC97_POWER_IN | AC97_POWER_OUT in ac97_detach()
1642 | POWER_EAMP_OFF(as)); in ac97_detach()
1643 mutex_exit(as->lock); in ac97_detach()
1645 free(as, M_DEVBUF); in ac97_detach()
1651 struct ac97_softc *as; in ac97_lock() local
1653 as = (struct ac97_softc *)codec_if; in ac97_lock()
1655 KASSERT(mutex_owned(as->lock)); in ac97_lock()
1657 as->lock_counter++; in ac97_lock()
1663 struct ac97_softc *as; in ac97_unlock() local
1665 as = (struct ac97_softc *)codec_if; in ac97_unlock()
1667 KASSERT(mutex_owned(as->lock)); in ac97_unlock()
1669 as->lock_counter--; in ac97_unlock()
1675 struct ac97_softc *as; in ac97_query_devinfo() local
1679 as = (struct ac97_softc *)codec_if; in ac97_query_devinfo()
1680 if (dip->index >= 0 && dip->index < as->num_source_info) { in ac97_query_devinfo()
1681 si = &as->source_info[dip->index]; in ac97_query_devinfo()
1715 struct ac97_softc *as; in ac97_mixer_set_port() local
1722 as = (struct ac97_softc *)codec_if; in ac97_mixer_set_port()
1724 KASSERT(mutex_owned(as->lock)); in ac97_mixer_set_port()
1726 if (cp->dev < 0 || cp->dev >= as->num_source_info) in ac97_mixer_set_port()
1728 si = &as->source_info[cp->dev]; in ac97_mixer_set_port()
1733 if (spdif && as->lock_counter >= 0) { in ac97_mixer_set_port()
1739 ac97_read(as, si->reg, &val); in ac97_mixer_set_port()
1774 if (!(as->host_flags & AC97_HOST_SWAPPED_CHANNELS)) { in ac97_mixer_set_port()
1815 error = ac97_write(as, si->reg, (val & ~mask) | newval); in ac97_mixer_set_port()
1819 if (spdif && as->host_if->spdif_event != NULL) { in ac97_mixer_set_port()
1821 as->host_if->spdif_event(as->host_if->arg, cp->un.ord); in ac97_mixer_set_port()
1830 struct ac97_softc *as; in ac97_get_portnum_by_name() local
1833 as = (struct ac97_softc *)codec_if; in ac97_get_portnum_by_name()
1835 KASSERT(mutex_owned(as->lock)); in ac97_get_portnum_by_name()
1837 for (idx = 0; idx < as->num_source_info; idx++) { in ac97_get_portnum_by_name()
1838 struct ac97_source_info *si = &as->source_info[idx]; in ac97_get_portnum_by_name()
1851 struct ac97_softc *as; in ac97_mixer_get_port() local
1856 as = (struct ac97_softc *)codec_if; in ac97_mixer_get_port()
1858 KASSERT(mutex_owned(as->lock)); in ac97_mixer_get_port()
1860 si = &as->source_info[cp->dev]; in ac97_mixer_get_port()
1861 if (cp->dev < 0 || cp->dev >= as->num_source_info) in ac97_mixer_get_port()
1867 ac97_read(as, si->reg, &val); in ac97_mixer_get_port()
1891 if (!(as->host_flags & AC97_HOST_SWAPPED_CHANNELS)) { in ac97_mixer_get_port()
1930 struct ac97_softc *as; in ac97_set_rate() local
1937 as = (struct ac97_softc *)codec_if; in ac97_set_rate()
1939 KASSERT(mutex_owned(as->lock)); in ac97_set_rate()
1942 if (!(as->ext_id & AC97_EXT_AUDIO_VRM)) { in ac97_set_rate()
1947 if (!(as->ext_id & AC97_EXT_AUDIO_VRA)) { in ac97_set_rate()
1952 value = *rate * AC97_STANDARD_CLOCK / as->ac97_clock; in ac97_set_rate()
1967 if (!(as->ext_id & AC97_EXT_AUDIO_VRA)) { in ac97_set_rate()
1971 if (as->ext_id & AC97_EXT_AUDIO_DRA) { in ac97_set_rate()
1972 ac97_read(as, AC97_REG_EXT_AUDIO_CTRL, &ext_stat); in ac97_set_rate()
1978 ac97_write(as, AC97_REG_EXT_AUDIO_CTRL, ext_stat); in ac97_set_rate()
1983 ac97_write(as, AC97_REG_EXT_AUDIO_CTRL, ext_stat); in ac97_set_rate()
1992 if (!(as->ext_id & AC97_EXT_AUDIO_VRA)) { in ac97_set_rate()
2001 if (!(as->ext_id & AC97_EXT_AUDIO_VRM)) { in ac97_set_rate()
2013 ac97_read(as, AC97_REG_POWER, &power); in ac97_set_rate()
2014 ac97_write(as, AC97_REG_POWER, power | power_bit); in ac97_set_rate()
2016 ac97_write(as, target, (uint16_t)value); in ac97_set_rate()
2017 ac97_read(as, target, &actual); in ac97_set_rate()
2018 actual = (uint32_t)actual * as->ac97_clock / AC97_STANDARD_CLOCK; in ac97_set_rate()
2020 ac97_write(as, AC97_REG_POWER, power); in ac97_set_rate()
2032 struct ac97_softc *as; in ac97_set_clock() local
2034 as = (struct ac97_softc *)codec_if; in ac97_set_clock()
2036 KASSERT(mutex_owned(as->lock)); in ac97_set_clock()
2038 as->ac97_clock = clock; in ac97_set_clock()
2044 struct ac97_softc *as; in ac97_get_extcaps() local
2046 as = (struct ac97_softc *)codec_if; in ac97_get_extcaps()
2048 KASSERT(mutex_owned(as->lock)); in ac97_get_extcaps()
2050 return as->ext_id; in ac97_get_extcaps()
2054 ac97_add_port(struct ac97_softc *as, const struct ac97_source_info *src) in ac97_add_port() argument
2059 KASSERT(mutex_owned(as->lock)); in ac97_add_port()
2061 if ((as->type == AC97_CODEC_TYPE_AUDIO && in ac97_add_port()
2062 as->num_source_info >= AUDIO_MAX_SOURCES) || in ac97_add_port()
2063 (as->type == AC97_CODEC_TYPE_MODEM && in ac97_add_port()
2064 as->num_source_info >= MODEM_MAX_SOURCES)) { in ac97_add_port()
2069 if (!ac97_check_capability(as, src->req_feature)) in ac97_add_port()
2071 ouridx = as->num_source_info; in ac97_add_port()
2072 si = &as->source_info[ouridx]; in ac97_add_port()
2087 as->num_source_info++; in ac97_add_port()
2089 si->mixer_class = ac97_get_portnum_by_name(&as->codec_if, si->class, in ac97_add_port()
2092 idx = ac97_get_portnum_by_name(&as->codec_if, si->class, in ac97_add_port()
2095 while (as->source_info[idx].next != AUDIO_MIXER_LAST) in ac97_add_port()
2096 idx = as->source_info[idx].next; in ac97_add_port()
2098 as->source_info[idx].next = ouridx; in ac97_add_port()
2133 ac97_ad198x_init(struct ac97_softc *as) in ac97_ad198x_init() argument
2138 KASSERT(mutex_owned(as->lock)); in ac97_ad198x_init()
2140 ac97_read(as, AD1980_REG_MISC, &misc); in ac97_ad198x_init()
2141 ac97_write(as, AD1980_REG_MISC, in ac97_ad198x_init()
2144 for (i = 0; i < as->num_source_info; i++) { in ac97_ad198x_init()
2145 if (as->source_info[i].type != AUDIO_MIXER_VALUE) in ac97_ad198x_init()
2148 if (as->source_info[i].reg == AC97_REG_MASTER_VOLUME) in ac97_ad198x_init()
2149 as->source_info[i].reg = AC97_REG_SURR_MASTER; in ac97_ad198x_init()
2150 else if (as->source_info[i].reg == AC97_REG_SURR_MASTER) in ac97_ad198x_init()
2151 as->source_info[i].reg = AC97_REG_MASTER_VOLUME; in ac97_ad198x_init()
2171 ac97_alc650_init(struct ac97_softc *as) in ac97_alc650_init() argument
2200 ac97_add_port(as, &sources[0]); in ac97_alc650_init()
2201 ac97_add_port(as, &sources[1]); in ac97_alc650_init()
2202 ac97_add_port(as, &sources[2]); in ac97_alc650_init()
2203 ac97_add_port(as, &sources[3]); in ac97_alc650_init()
2204 ac97_add_port(as, &sources[4]); in ac97_alc650_init()
2205 ac97_add_port(as, &sources[5]); in ac97_alc650_init()
2236 ac97_ucb1400_init(struct ac97_softc *as) in ac97_ucb1400_init() argument
2239 ac97_write(as, UCB1400_REG_FEATURE_CSR1, in ac97_ucb1400_init()
2241 ac97_write(as, UCB1400_REG_FEATURE_CSR2, UCB1400_AVE | UCB1400_SLP_ON); in ac97_ucb1400_init()
2252 ac97_vt1616_init(struct ac97_softc *as) in ac97_vt1616_init() argument
2269 KASSERT(mutex_owned(as->lock)); in ac97_vt1616_init()
2271 ac97_add_port(as, &sources[0]); in ac97_vt1616_init()
2272 ac97_add_port(as, &sources[1]); in ac97_vt1616_init()
2273 ac97_add_port(as, &sources[2]); in ac97_vt1616_init()
2277 ac97_modem_offhook_set(struct ac97_softc *as, int line, int newval) in ac97_modem_offhook_set() argument
2281 KASSERT(mutex_owned(as->lock)); in ac97_modem_offhook_set()
2283 val = as->shadow_reg[AC97_REG_GPIO_STATUS >> 1]; in ac97_modem_offhook_set()
2292 ac97_write(as, AC97_REG_GPIO_STATUS, val); in ac97_modem_offhook_set()
2302 struct ac97_softc *as; in ac97_sysctl_verify() local
2305 as = rnode->sysctl_data; in ac97_sysctl_verify()
2306 if (node.sysctl_num == as->offhook_line1_mib) { in ac97_sysctl_verify()
2307 tmp = as->offhook_line1; in ac97_sysctl_verify()
2316 as->offhook_line1 = tmp; in ac97_sysctl_verify()
2317 mutex_enter(as->lock); in ac97_sysctl_verify()
2318 ac97_modem_offhook_set(as, AC97_GPIO_LINE1_OH, tmp); in ac97_sysctl_verify()
2319 mutex_exit(as->lock); in ac97_sysctl_verify()
2320 } else if (node.sysctl_num == as->offhook_line2_mib) { in ac97_sysctl_verify()
2321 tmp = as->offhook_line2; in ac97_sysctl_verify()
2330 as->offhook_line2 = tmp; in ac97_sysctl_verify()
2331 mutex_enter(as->lock); in ac97_sysctl_verify()
2332 ac97_modem_offhook_set(as, AC97_GPIO_LINE2_OH, tmp); in ac97_sysctl_verify()
2333 mutex_exit(as->lock); in ac97_sysctl_verify()