35#ifdef HAVE_KERNEL_OPTION_HEADERS
42#include <sys/taskqueue.h>
52#define hdaa_lock(devinfo) snd_mtxlock((devinfo)->lock)
53#define hdaa_unlock(devinfo) snd_mtxunlock((devinfo)->lock)
54#define hdaa_lockassert(devinfo) snd_mtxassert((devinfo)->lock)
76#define HDA_PARSE_MAXDEPTH 10
80static const char *
HDA_COLORS[16] = {
"Unknown",
"Black",
"Grey",
"Blue",
81 "Green",
"Red",
"Orange",
"Yellow",
"Purple",
"Pink",
"Res.A",
"Res.B",
82 "Res.C",
"Res.D",
"White",
"Other"};
84static const char *
HDA_DEVS[16] = {
"Line-out",
"Speaker",
"Headphones",
"CD",
85 "SPDIF-out",
"Digital-out",
"Modem-line",
"Modem-handset",
"Line-in",
86 "AUX",
"Mic",
"Telephony",
"SPDIF-in",
"Digital-in",
"Res.E",
"Other"};
88static const char *
HDA_CONNS[4] = {
"Jack",
"None",
"Fixed",
"Both"};
91 "Unknown",
"1/8",
"1/4",
"ATAPI",
"RCA",
"Optical",
"Digital",
"Analog",
92 "DIN",
"XLR",
"RJ-11",
"Combo",
"0xc",
"0xd",
"0xe",
"Other" };
95 "0x00",
"Rear",
"Front",
"Left",
"Right",
"Top",
"Bottom",
"Rear-panel",
96 "Drive-bay",
"0x09",
"0x0a",
"0x0b",
"0x0c",
"0x0d",
"0x0e",
"0x0f",
97 "Internal",
"0x11",
"0x12",
"0x13",
"0x14",
"0x15",
"0x16",
"Riser",
98 "0x18",
"Onboard",
"0x1a",
"0x1b",
"0x1c",
"0x1d",
"0x1e",
"0x1f",
99 "External",
"Ext-Rear",
"Ext-Front",
"Ext-Left",
"Ext-Right",
"Ext-Top",
"Ext-Bottom",
"0x07",
100 "0x28",
"0x29",
"0x2a",
"0x2b",
"0x2c",
"0x2d",
"0x2e",
"0x2f",
101 "Other",
"0x31",
"0x32",
"0x33",
"0x34",
"0x35",
"Other-Bott",
"Lid-In",
102 "Lid-Out",
"0x39",
"0x3a",
"0x3b",
"0x3c",
"0x3d",
"0x3e",
"0x3f" };
105 "keep",
"set",
"clear",
"disable",
"input",
"0x05",
"0x06",
"0x07"};
108 "undefined",
"LPCM",
"AC-3",
"MPEG1",
"MP3",
"MPEG2",
"AAC-LC",
"DTS",
109 "ATRAC",
"DSD",
"E-AC-3",
"DTS-HD",
"MLP",
"DST",
"WMAPro",
"HE-AAC",
110 "HE-AACv2",
"MPEG-Surround"
128 { 8000, 1, 0x0000, 0x0000, 0x0500 },
129 { 9600, 0, 0x0000, 0x0000, 0x0400 },
130 { 12000, 0, 0x0000, 0x0000, 0x0300 },
131 { 16000, 1, 0x0000, 0x0000, 0x0200 },
132 { 18000, 0, 0x0000, 0x1000, 0x0700 },
133 { 19200, 0, 0x0000, 0x0800, 0x0400 },
134 { 24000, 0, 0x0000, 0x0000, 0x0100 },
135 { 28800, 0, 0x0000, 0x1000, 0x0400 },
136 { 32000, 1, 0x0000, 0x0800, 0x0200 },
137 { 36000, 0, 0x0000, 0x1000, 0x0300 },
138 { 38400, 0, 0x0000, 0x1800, 0x0400 },
139 { 48000, 1, 0x0000, 0x0000, 0x0000 },
140 { 64000, 0, 0x0000, 0x1800, 0x0200 },
141 { 72000, 0, 0x0000, 0x1000, 0x0100 },
142 { 96000, 1, 0x0000, 0x0800, 0x0000 },
143 { 144000, 0, 0x0000, 0x1000, 0x0000 },
144 { 192000, 1, 0x0000, 0x1800, 0x0000 },
145 { 8820, 0, 0x4000, 0x0000, 0x0400 },
146 { 11025, 1, 0x4000, 0x0000, 0x0300 },
147 { 12600, 0, 0x4000, 0x0800, 0x0600 },
148 { 14700, 0, 0x4000, 0x0000, 0x0200 },
149 { 17640, 0, 0x4000, 0x0800, 0x0400 },
150 { 18900, 0, 0x4000, 0x1000, 0x0600 },
151 { 22050, 1, 0x4000, 0x0000, 0x0100 },
152 { 25200, 0, 0x4000, 0x1800, 0x0600 },
153 { 26460, 0, 0x4000, 0x1000, 0x0400 },
154 { 29400, 0, 0x4000, 0x0800, 0x0200 },
155 { 33075, 0, 0x4000, 0x1000, 0x0300 },
156 { 35280, 0, 0x4000, 0x1800, 0x0400 },
157 { 44100, 1, 0x4000, 0x0000, 0x0000 },
158 { 58800, 0, 0x4000, 0x1800, 0x0200 },
159 { 66150, 0, 0x4000, 0x1000, 0x0100 },
160 { 88200, 1, 0x4000, 0x0800, 0x0000 },
161 { 132300, 0, 0x4000, 0x1000, 0x0000 },
162 { 176400, 1, 0x4000, 0x1800, 0x0000 },
164#define HDA_RATE_TAB_LEN (sizeof(hda_rate_tab) / sizeof(hda_rate_tab[0]))
177 nid_t,
int,
int,
int);
179 nid_t,
int,
int,
int,
int,
int,
int);
189 for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) {
190 if (
mask & (1 << i)) {
206 *index < 0 || *index >=
devinfo->ctlcnt)
233 if (found == cnt || cnt <= 0)
272 int i, total, sub, assume, channels;
273 uint16_t cpins, upins, tpins;
277 for (i = 0; i < 16; i++) {
278 if (as->
pins[i] <= 0)
290 tpins = cpins | upins;
296 total = sub = assume = channels = 0;
318 }
else if (as->
pinset != 0 && (tpins & 0xffe0) == 0) {
328 if (tpins & 0x0010) {
330 if ((as->
pinset & 0x0004) == 0)
335 }
else if (as->
mixed) {
344 device_printf(pdevinfo->
dev,
"%s channel set is: ",
347 if (channels & (1 << i))
364 sub = (total == 6 || total == 8) ? 1 : 0;
367 device_printf(pdevinfo->
dev,
368 "%s channel matrix is: %s%d.%d (%s)\n",
370 assume ?
"unknown, assuming " :
"", total - sub, sub,
371 cpins != 0 ?
"connected" :
372 (upins != 0 ?
"unknown" :
"disconnected"));
392 "Redirect output to: %s\n",
393 connected ?
"headphones":
"main");
398 if (ctl != NULL && ctl->
mute) {
400 val = connected ? 0 : 1;
414 ~HDA_CMD_SET_PIN_WIDGET_CTRL_OUT_ENABLE;
423 for (j = 0; j < 15; j++) {
424 if (as->
pins[j] <= 0)
428 if (ctl != NULL && ctl->
mute) {
430 val = connected ? 1 : 0;
444 ~HDA_CMD_SET_PIN_WIDGET_CTRL_OUT_ENABLE;
467 int i,
mask, fullmask, prio, bestprio;
470 if (!as->
mixed || pdevinfo == NULL || pdevinfo->
mixer == NULL)
477 if (pdevinfo->
recsrc & (SOUND_MASK_IMIX | SOUND_MASK_SPEAKER))
485 for (i = 0; i < 16; i++) {
486 if (as->
pins[i] <= 0)
489 if (w1 == NULL || w1->
enable == 0)
496 if (prio > bestprio) {
501 fullmask |= (1 << w1->
ossdev);
512 if (
mask & SOUND_MASK_MIC)
513 mask = SOUND_MASK_MIC;
515 if (
mask & SOUND_MASK_MONITOR)
516 mask = SOUND_MASK_MONITOR;
521 device_printf(pdevinfo->
dev,
522 "Automatically set rec source to: %s\n",
buf);
551 connected = !connected;
553 if (connected == old)
557 if (connected || old != 2) {
559 "Pin sense: nid=%d sense=0x%08x (%sconnected)\n",
560 w->
nid, res, !connected ?
"dis" :
"");
588 for (i = 0; i <
devinfo->ascnt; i++) {
589 if (
devinfo->as[i].hpredir < 0)
608 int len, mnl, i, sadc,
fmt;
613 "ELD nid=%d: ELD_Ver=%u Baseline_ELD_Len=%u\n",
615 if ((w->
eld[0] >> 3) != 0x02)
618 mnl = w->
eld[4] & 0x1f;
620 "ELD nid=%d: CEA_EDID_Ver=%u MNL=%u\n",
621 w->
nid, w->
eld[4] >> 5, mnl);
622 sadc = w->
eld[5] >> 4;
624 "ELD nid=%d: SAD_Count=%u Conn_Type=%u S_AI=%u HDCP=%u\n",
625 w->
nid, sadc, (w->
eld[5] >> 2) & 0x3,
626 (w->
eld[5] >> 1) & 0x1, w->
eld[5] & 0x1);
628 "ELD nid=%d: Aud_Synch_Delay=%ums\n",
631 "ELD nid=%d: Channels=0x%b\n",
633 "\020\07RLRC\06FLRC\05RC\04RLR\03FC\02LFE\01FLR");
635 "ELD nid=%d: Port_ID=0x%02x%02x%02x%02x%02x%02x%02x%02x\n",
639 "ELD nid=%d: Manufacturer_Name=0x%02x%02x\n",
642 "ELD nid=%d: Product_Code=0x%02x%02x\n",
645 "ELD nid=%d: Monitor_Name_String='%.*s'\n",
646 w->
nid, mnl, &w->
eld[20]);
647 for (i = 0; i < sadc; i++) {
648 sad = &w->
eld[20 + mnl + i * 3];
649 fmt = (sad[0] >> 3) & 0x0f;
651 fmt = (sad[2] >> 3) & 0x1f;
652 if (fmt < 1 || fmt > 3)
658 "ELD nid=%d: %s %dch freqs=0x%b",
660 sad[1],
"\020\007192\006176\00596\00488\00348\00244\00132");
663 printf(
" sizes=0x%b",
664 sad[2] & 0x07,
"\020\00324\00220\00116");
673 printf(
" max_bitrate=%d", sad[2] * 8000);
676 printf(
" profile=%d", sad[2] & 0x07);
701 if (w->
eld != NULL) {
708 "Pin sense: nid=%d sense=0x%08x "
709 "(%sconnected, ELD %svalid)\n",
723 w->
eld = malloc(w->
eld_len, M_HDAA, M_ZERO | M_NOWAIT);
724 if (w->
eld == NULL) {
729 for (i = 0; i < w->
eld_len; i++) {
732 if (res & 0x80000000)
733 w->
eld[i] = res & 0xff;
751 for (i =
devinfo->startnode; i < devinfo->endnode; i++) {
758 w->
unsol = HDAC_UNSOL_ALLOC(
759 device_get_parent(
devinfo->dev),
770 "No presence detection support at nid %d\n",
777 "Headphones redirection for "
778 "association %d nid=%d using %s.\n",
780 (w->
unsol < 0) ?
"polling" :
781 "unsolicited responses");
792 callout_reset(&
devinfo->poll_jack, 1,
803 callout_stop(&
devinfo->poll_jack);
804 for (i =
devinfo->startnode; i < devinfo->endnode; i++) {
827 strlcpy(
buf, str,
sizeof(
buf));
829 while ((
key = strsep(&rest,
"=")) != NULL) {
830 value = strsep(&rest,
" \t");
833 ival = strtol(
value, &bad, 10);
834 if (strcmp(
key,
"seq") == 0) {
835 config &= ~HDA_CONFIG_DEFAULTCONF_SEQUENCE_MASK;
838 }
else if (strcmp(
key,
"as") == 0) {
839 config &= ~HDA_CONFIG_DEFAULTCONF_ASSOCIATION_MASK;
842 }
else if (strcmp(
key,
"misc") == 0) {
843 config &= ~HDA_CONFIG_DEFAULTCONF_MISC_MASK;
846 }
else if (strcmp(
key,
"color") == 0) {
847 config &= ~HDA_CONFIG_DEFAULTCONF_COLOR_MASK;
852 for (i = 0; i < 16; i++) {
858 }
else if (strcmp(
key,
"ctype") == 0) {
859 config &= ~HDA_CONFIG_DEFAULTCONF_CONNECTION_TYPE_MASK;
864 for (i = 0; i < 16; i++) {
870 }
else if (strcmp(
key,
"device") == 0) {
871 config &= ~HDA_CONFIG_DEFAULTCONF_DEVICE_MASK;
877 for (i = 0; i < 16; i++) {
883 }
else if (strcmp(
key,
"loc") == 0) {
884 config &= ~HDA_CONFIG_DEFAULTCONF_LOCATION_MASK;
890 for (i = 0; i < 64; i++) {
896 }
else if (strcmp(
key,
"conn") == 0) {
897 config &= ~HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_MASK;
903 for (i = 0; i < 4; i++) {
921 strlcpy(
buf, str,
sizeof(
buf));
923 while ((
key = strsep(&rest,
"=")) != NULL) {
924 value = strsep(&rest,
" \t");
927 ikey = strtol(
key, NULL, 10);
928 if (ikey < 0 || ikey > 7)
930 for (i = 0; i < 7; i++) {
932 gpio &= ~HDAA_GPIO_MASK(ikey);
945 const char *res = NULL;
950 snprintf(
buf,
sizeof(
buf),
"cad%u.nid%u.config",
951 hda_get_codec_id(
dev), w->
nid);
952 if (resource_string_value(device_get_name(
953 device_get_parent(device_get_parent(
dev))),
954 device_get_unit(device_get_parent(device_get_parent(
dev))),
956 if (strncmp(res,
"0x", 2) == 0) {
957 config = strtol(res + 2, NULL, 16);
962 snprintf(
buf,
sizeof(
buf),
"nid%u.config", w->
nid);
963 if (resource_string_value(device_get_name(
dev), device_get_unit(
dev),
965 if (strncmp(res,
"0x", 2) == 0) {
966 config = strtol(res + 2, NULL, 16);
974 "Patching pin config nid=%u 0x%08x -> 0x%08x\n",
987 sbuf_printf(sb,
" Stream cap: 0x%08x",
cap);
989 sbuf_printf(sb,
" AC3");
991 sbuf_printf(sb,
" FLOAT32");
993 sbuf_printf(sb,
" PCM");
994 sbuf_printf(sb,
"\n");
998 sbuf_printf(sb,
" PCM cap: 0x%08x",
cap);
1000 sbuf_printf(sb,
" 8");
1002 sbuf_printf(sb,
" 16");
1004 sbuf_printf(sb,
" 20");
1006 sbuf_printf(sb,
" 24");
1008 sbuf_printf(sb,
" 32");
1009 sbuf_printf(sb,
" bits,");
1011 sbuf_printf(sb,
" 8");
1013 sbuf_printf(sb,
" 11");
1015 sbuf_printf(sb,
" 16");
1017 sbuf_printf(sb,
" 22");
1019 sbuf_printf(sb,
" 32");
1021 sbuf_printf(sb,
" 44");
1022 sbuf_printf(sb,
" 48");
1024 sbuf_printf(sb,
" 88");
1026 sbuf_printf(sb,
" 96");
1028 sbuf_printf(sb,
" 176");
1030 sbuf_printf(sb,
" 192");
1031 sbuf_printf(sb,
" KHz\n");
1038 uint32_t pincap, conf;
1042 sbuf_printf(sb,
" Pin cap: 0x%08x", pincap);
1044 sbuf_printf(sb,
" ISC");
1046 sbuf_printf(sb,
" TRQD");
1048 sbuf_printf(sb,
" PDC");
1050 sbuf_printf(sb,
" HP");
1052 sbuf_printf(sb,
" OUT");
1054 sbuf_printf(sb,
" IN");
1056 sbuf_printf(sb,
" BAL");
1058 sbuf_printf(sb,
" HDMI");
1060 sbuf_printf(sb,
" VREF[");
1062 sbuf_printf(sb,
" 50");
1064 sbuf_printf(sb,
" 80");
1066 sbuf_printf(sb,
" 100");
1068 sbuf_printf(sb,
" GROUND");
1070 sbuf_printf(sb,
" HIZ");
1071 sbuf_printf(sb,
" ]");
1074 sbuf_printf(sb,
" EAPD");
1076 sbuf_printf(sb,
" DP");
1078 sbuf_printf(sb,
" HBR");
1079 sbuf_printf(sb,
"\n");
1081 sbuf_printf(sb,
" Pin config: 0x%08x", conf);
1082 sbuf_printf(sb,
" as=%d seq=%d "
1083 "device=%s conn=%s ctype=%s loc=%s color=%s misc=%d\n",
1092 sbuf_printf(sb,
" Pin control: 0x%08x", w->
wclass.
pin.
ctrl);
1094 sbuf_printf(sb,
" HP");
1096 sbuf_printf(sb,
" IN");
1098 sbuf_printf(sb,
" OUT");
1102 sbuf_printf(sb,
" HBR");
1105 sbuf_printf(sb,
" EPTs");
1109 sbuf_printf(sb,
" VREFs");
1111 sbuf_printf(sb,
"\n");
1122 sbuf_printf(sb,
" %s amp: 0x%08x "
1123 "mute=%d step=%d size=%d offset=%d (%+d/%+ddB)\n",
1142 sbuf_new_for_sysctl(&sb, NULL, 256,
req);
1144 sbuf_printf(&sb,
"%s%s\n", w->
name,
1145 (w->
enable == 0) ?
" [DISABLED]" :
"");
1146 sbuf_printf(&sb,
" Widget cap: 0x%08x",
1150 sbuf_printf(&sb,
" LRSWAP");
1152 sbuf_printf(&sb,
" PWR");
1154 sbuf_printf(&sb,
" DIGITAL");
1156 sbuf_printf(&sb,
" UNSOL");
1158 sbuf_printf(&sb,
" PROC");
1160 sbuf_printf(&sb,
" STRIPE(x%d)",
1164 sbuf_printf(&sb,
" STEREO");
1166 sbuf_printf(&sb,
" %dCH", j + 1);
1168 sbuf_printf(&sb,
"\n");
1170 sbuf_printf(&sb,
" Association: %d (0x%04x)\n",
1174 sbuf_printf(&sb,
" OSS: %s",
1178 sbuf_printf(&sb,
"\n");
1185 }
else if (w->
type ==
1189 sbuf_printf(&sb,
" EAPD: 0x%08x%s%s%s\n",
1205 sbuf_printf(&sb,
" Connections: %d\n", w->
nconns);
1206 for (j = 0; j < w->
nconns; j++) {
1208 sbuf_printf(&sb,
" + %s<- nid=%d [%s]",
1210 w->
conns[j], (cw == NULL) ?
"GHOST!" : cw->
name);
1212 sbuf_printf(&sb,
" [UNKNOWN]");
1213 else if (cw->
enable == 0)
1214 sbuf_printf(&sb,
" [DISABLED]");
1217 sbuf_printf(&sb,
" (selected)");
1218 sbuf_printf(&sb,
"\n");
1220 error = sbuf_finish(&sb);
1232 conf = *(uint32_t *)oidp->oid_arg1;
1233 snprintf(
buf,
sizeof(
buf),
"0x%08x as=%d seq=%d "
1234 "device=%s conn=%s ctype=%s loc=%s color=%s misc=%d",
1245 if (
error != 0 ||
req->newptr == NULL)
1247 if (strncmp(
buf,
"0x", 2) == 0)
1248 conf = strtol(
buf + 2, NULL, 16);
1251 *(uint32_t *)oidp->oid_arg1 = conf;
1258 int i = 0, j,
k,
len, inv;
1261 while (str[i] !=
'\0' &&
1262 (str[i] ==
',' || isspace(str[i]) != 0))
1267 while (str[j] !=
'\0' &&
1268 !(str[j] ==
',' || isspace(str[j]) != 0))
1271 if (
len > 2 && strncmp(str + i,
"no", 2) == 0)
1276 if (strncmp(str + i + inv,
1283 *off &= ~hdaa_quirks_tab[
k].value;
1286 *on &= ~hdaa_quirks_tab[
k].value;
1301 quirks = *(uint32_t *)oidp->oid_arg1;
1305 n += snprintf(
buf +
n,
sizeof(
buf) -
n,
"%s%s",
1309 if (
error != 0 ||
req->newptr == NULL)
1311 if (strncmp(
buf,
"0x", 2) == 0)
1317 *(uint32_t *)oidp->oid_arg1 =
quirks;
1325 const char *res = NULL;
1329 for (i =
devinfo->startnode; i < devinfo->endnode; i++) {
1337 if (resource_string_value(device_get_name(
devinfo->dev),
1338 device_get_unit(
devinfo->dev),
"config", &res) == 0) {
1339 if (res != NULL && strlen(res) > 0)
1342 devinfo->quirks &= ~quirks_off;
1350 "Config options: 0x%08x\n",
devinfo->quirks);
1353 if (resource_string_value(device_get_name(
devinfo->dev),
1354 device_get_unit(
devinfo->dev),
"gpio_config", &res) == 0) {
1355 if (strncmp(res,
"0x", 2) == 0) {
1356 devinfo->gpio = strtol(res + 2, NULL, 16);
1370 device_printf(
devinfo->dev,
"GPIO config options:");
1371 for (i = 0; i < 7; i++) {
1384 int i, j,
max, ents, entnum;
1386 nid_t cnid, addcnid, prevcnid;
1402#define CONN_RMASK(e) (1 << ((32 / (e)) - 1))
1403#define CONN_NMASK(e) (CONN_RMASK(e) - 1)
1404#define CONN_RESVAL(r, e, n) ((r) >> ((32 / (e)) * (n)))
1405#define CONN_RANGE(r, e, n) (CONN_RESVAL(r, e, n) & CONN_RMASK(e))
1406#define CONN_CNID(r, e, n) (CONN_RESVAL(r, e, n) & CONN_NMASK(e))
1408 for (i = 0; i < ents; i += entnum) {
1411 for (j = 0; j < entnum; j++) {
1416 "WARNING: nid=%d has zero cnid "
1417 "entnum=%d j=%d index=%d "
1418 "entries=%d found=%d res=0x%08x\n",
1424 if (cnid < w->
devinfo->startnode ||
1428 "WARNING: nid=%d has cnid outside "
1429 "of the AFG range j=%d "
1430 "entnum=%d index=%d res=0x%08x\n",
1431 nid, j, entnum, i, res);
1436 else if (prevcnid == 0 || prevcnid >= cnid) {
1438 "WARNING: Invalid child range "
1439 "nid=%d index=%d j=%d entnum=%d "
1440 "prevcnid=%d cnid=%d res=0x%08x\n",
1441 nid, i, j, entnum, prevcnid,
1445 addcnid = prevcnid + 1;
1446 while (addcnid <= cnid) {
1449 "Adding %d (nid=%d): "
1450 "Max connection reached! max=%d\n",
1552 snprintf(
buf,
sizeof(
buf),
"nid%d", w->
nid);
1553 SYSCTL_ADD_PROC(device_get_sysctl_ctx(
dev),
1554 SYSCTL_CHILDREN(device_get_sysctl_tree(
dev)), OID_AUTO,
1555 buf, CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE,
1558 snprintf(
buf,
sizeof(
buf),
"nid%d_config", w->
nid);
1559 SYSCTL_ADD_PROC(device_get_sysctl_ctx(
dev),
1560 SYSCTL_CHILDREN(device_get_sysctl_tree(
dev)), OID_AUTO,
1561 buf, CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_MPSAFE,
1563 "Current pin configuration");
1564 snprintf(
buf,
sizeof(
buf),
"nid%d_original", w->
nid);
1565 SYSCTL_ADD_PROC(device_get_sysctl_ctx(
dev),
1566 SYSCTL_CHILDREN(device_get_sysctl_tree(
dev)), OID_AUTO,
1567 buf, CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE,
1569 "Original pin configuration");
1577 const char *typestr;
1582 typestr =
"audio output";
1585 typestr =
"audio input";
1588 typestr =
"audio mixer";
1591 typestr =
"audio selector";
1597 typestr =
"power widget";
1600 typestr =
"volume widget";
1603 typestr =
"beep widget";
1606 typestr =
"vendor widget";
1609 typestr =
"unknown type";
1612 strlcpy(w->
name, typestr,
sizeof(w->
name));
1626 strlcat(w->
name,
": ",
sizeof(w->
name));
1627 strlcat(w->
name, devstr,
sizeof(w->
name));
1628 strlcat(w->
name,
" (",
sizeof(w->
name));
1629 if (conn == 0 && color != 0 && color != 15) {
1631 strlcat(w->
name,
" ",
sizeof(w->
name));
1634 strlcat(w->
name,
")",
sizeof(w->
name));
1642 nid < devinfo->startnode ||
nid >=
devinfo->endnode)
1649 int index,
int lmute,
int rmute,
1656 "Setting amplifier nid=%d index=%d %s mute=%d/%d vol=%d/%d\n",
1660 v = (1 << (15 -
dir)) | (1 << 13) | (
index << 8) |
1661 (lmute << 7) |
left;
1664 v = (1 << (15 -
dir)) | (1 << 12) | (
index << 8) |
1665 (rmute << 7) |
right;
1667 v = (1 << (15 -
dir)) | (3 << 12) | (
index << 8) |
1668 (lmute << 7) |
left;
1718 "Setting selector nid=%d index=%d\n", w->
nid,
index);
1751 hda_get_dma_nocache(
devinfo->dev) ? BUS_DMA_NOCACHE :
1779 uint32_t
spd = 0, threshold;
1783 for (i = 0; ch->
pcmrates[i] != 0; i++) {
1791 for (i = 0; ch->
pcmrates[i] != 0; i++) {
1795 if (
speed < threshold)
1809 if (ch->
fmt & AFMT_S16_LE)
1811 else if (ch->
fmt & AFMT_S32_LE)
1831 static const int bits[8] = { 8, 16, 20, 24, 32, 32, 32, 32 };
1834 size = bits[(
fmt >> 4) & 0x03];
1836 size *= ((
fmt >> 11) & 0x07) + 1;
1837 return (0xffffffffU >> (32 - fls(
size / 8)));
1845 int i, j,
k, chn, cchn, totalchn, totalextchn,
c;
1848 const static uint16_t convmap[2][5] =
1850 {{ 0x0010, 0x0001, 0x0201, 0x0231, 0x4231 },
1851 { 0x0010, 0x0001, 0x2201, 0x2231, 0x4231 }};
1853 const static uint8_t hdmica[2][8] =
1855 {{ 0x02, 0x00, 0x04, 0x08, 0x0a, 0x0e, 0x12, 0x12 },
1856 { 0x01, 0x03, 0x01, 0x03, 0x09, 0x0b, 0x0f, 0x13 }};
1858 const static uint32_t hdmich[2][8] =
1860 {{ 0xFFFF0F00, 0xFFFFFF10, 0xFFF2FF10, 0xFF32FF10,
1861 0xFF324F10, 0xF5324F10, 0x54326F10, 0x54326F10 },
1862 { 0xFFFFF000, 0xFFFF0100, 0xFFFFF210, 0xFFFF2310,
1863 0xFF32F410, 0xFF324510, 0xF6324510, 0x76325410 }};
1872 "PCMDIR_%s: Stream setup fmt=%08x (%d.%d) speed=%d\n",
1874 ch->
fmt, totalchn - totalextchn, totalextchn, ch->
spd);
1884 if (ch->
fmt & AFMT_AC3)
1888 for (i = 0; ch->
io[i] != -1; i++) {
1900 chn = (((convmap[convmapid][totalchn / 2]
1901 >> i * 4) & 0xf) - 1) * 2;
1902 if (chn < 0 || chn >= totalchn) {
1905 c = (ch->
sid << 4) | chn;
1921 if (cchn > 1 && chn < totalchn) {
1922 cchn = min(cchn, totalchn - chn - 1);
1928 "PCMDIR_%s: Stream setup nid=%d: "
1929 "fmt=0x%04x, dfmt=0x%04x, chan=0x%04x, "
1930 "chan_count=0x%02x, stripe=%d\n",
1934 for (j = 0; j < 16; j++) {
1946 for (
k = 0;
k < 8;
k++) {
1949 (((hdmich[totalextchn == 0 ? 0 : 1][totalchn - 1]
1950 >> (
k * 4)) & 0xf) << 4) |
k));
1960 ~HDA_CMD_SET_PIN_WIDGET_CTRL_VREF_ENABLE_MASK;
1961 if ((ch->
fmt & AFMT_AC3) && (cchn == 7))
1977 for (
k = 0;
k < 32;
k++)
1985 ((w->
eld[5] >> 2) & 0x3) == 1) {
2000 csum -= 0x84 + 0x01 + 0x0a + (totalchn - 1) +
2001 hdmica[totalextchn == 0 ? 0 : 1][totalchn - 1];
2013 hdmica[totalextchn == 0 ? 0 : 1][totalchn - 1]));
2048 return ((a *
b) /
gcd(a,
b));
2080 device_printf(ch->
devinfo->
dev,
"%s: failed blksz=%u blkcnt=%u\n",
2108 ch->
flags &= ~HDAA_CHN_RUNNING;
2111 for (i = 0; ch->
io[i] != -1; i++) {
2135 hda_get_stripes_mask(
devinfo->dev)) - 1;
2184 if (ch->
dmapos != NULL) {
2187 ptr = HDAC_STREAM_GETPTR(
2234 for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) {
2235 pdevinfo->
left[i] = 100;
2236 pdevinfo->
right[i] = 100;
2241 if (pdevinfo->
playas >= 0) {
2243 for (i =
devinfo->startnode; i < devinfo->endnode; i++) {
2245 if (w == NULL || w->
enable == 0)
2251 mask |= SOUND_MASK_OGAIN;
2256 if ((
mask & SOUND_MASK_PCM) == 0 ||
2258 pdevinfo->
minamp[SOUND_MIXER_PCM] ==
2259 pdevinfo->
maxamp[SOUND_MIXER_PCM]) {
2260 mask |= SOUND_MASK_PCM;
2263 device_printf(pdevinfo->
dev,
2264 "Forcing Soft PCM volume\n");
2269 if ((
mask & SOUND_MASK_VOLUME) == 0) {
2270 mask |= SOUND_MASK_VOLUME;
2276 device_printf(pdevinfo->
dev,
2277 "Forcing master volume with PCM\n");
2284 if (pdevinfo->
recas >= 0) {
2285 for (i = 0; i < 16; i++) {
2290 if (w == NULL || w->
enable == 0)
2292 for (j = 0; j < w->
nconns; j++) {
2296 if (cw == NULL || cw->
enable == 0)
2306 recmask &= (1 << SOUND_MIXER_NRDEVICES) - 1;
2307 mask &= (1 << SOUND_MIXER_NRDEVICES) - 1;
2326 int i, zleft, zright, sleft, sright, smute, lval, rval;
2331 smute = sleft = sright = zleft = zright = 0;
2332 for (i = 0; i < SOUND_MIXER_NRDEVICES; i++) {
2358 int i, j, conns = 0;
2364 if (w == NULL || w->
enable == 0)
2369 for (j = 0; j < w->
nconns; j++) {
2378 if (depth > 0 && (conns == 1 ||
2388 if (w->
ossdev >= 0 && depth > 0)
2410 for (i =
devinfo->startnode; i < devinfo->endnode; i++) {
2412 if (wc == NULL || wc->
enable == 0)
2414 for (j = 0; j < wc->
nconns; j++) {
2435 int i, j, consumers, cleft, cright;
2441 if (w == NULL || w->
enable == 0)
2448 for (i =
devinfo->startnode; i < devinfo->endnode; i++) {
2450 if (wc == NULL || wc->
enable == 0)
2452 for (j = 0; j < wc->
nconns; j++) {
2461 if ((consumers == 2 && (w->
bindas < 0 ||
2479 for (i = 0; i < w->
nconns; i++) {
2491 mute, cleft, cright, depth + 1);
2508 if (pdevinfo->
left[
dev] == 0) {
2520 for (i =
devinfo->startnode; i < devinfo->endnode; i++) {
2522 if (w == NULL || w->
enable == 0)
2525 if (pdevinfo->
index != 0)
2532 if (
dev == SOUND_MIXER_RECLEV &&
2535 w->
nid, -1, mute, lvol, rvol, 0);
2538 if (
dev == SOUND_MIXER_VOLUME &&
2542 w->
nid, -1, mute, lvol, rvol, 0);
2545 if (
dev == SOUND_MIXER_IGAIN &&
2547 for (j = 0; j < w->
nconns; j++) {
2551 if (cw == NULL || cw->
enable == 0)
2559 w->
nid, j, mute, lvol, rvol, 0);
2566 w->
nid, -1, mute, lvol, rvol, 0);
2569 w->
nid, -1, mute, lvol, rvol, 0);
2592 if (
dev == SOUND_MIXER_OGAIN) {
2595 for (i =
devinfo->startnode; i < devinfo->endnode; i++) {
2597 if (w == NULL || w->
enable == 0)
2642 for (
dev = 0;
dev < SOUND_MIXER_NRDEVICES;
dev++) {
2647 if (resource_int_value(device_get_name(pdevinfo->
dev),
2652 if (
dev == SOUND_MIXER_OGAIN)
2654 else if (
dev == SOUND_MIXER_IGAIN)
2656 else if (
dev == SOUND_MIXER_MIC ||
2657 dev == SOUND_MIXER_MONITOR)
2659 else if (
dev == SOUND_MIXER_VOLUME && !pdevinfo->
digital)
2666 }
else if (vol < 0) {
2667 vol = ((amp - pdevinfo->
minamp[
dev]) * 100 +
2670 vol = imin(imax(vol, 1), 100);
2693 if (w == NULL || w->
enable == 0)
2696 for (i = 0; i < w->
nconns; i++) {
2706 w->
conns[i], depth + 1);
2727 device_printf(pdevinfo->
dev,
2728 "Recsel (%s): nid %d source %d %s\n",
2731 nid, i,
muted?
"mute":
"unmute");
2741 device_printf(pdevinfo->
dev,
2742 "Recsel (%s): nid %d source %d select\n",
2763 uint32_t ret = 0xffffffff;
2779 for (j = 0; j <
as->num_chans; j++) {
2781 for (i = 0; ch->
io[i] >= 0; i++) {
2783 if (w == NULL || w->
enable == 0)
2789 if (ret == 0xffffffff)
2809 for (j = 0; j < SOUND_MIXER_NRDEVICES; j++) {
2822 for (j = 0; j < SOUND_MIXER_NRDEVICES; j++) {
2845 uint32_t
data, wake, unsol, sticky;
2857 device_printf(
dev,
" GPI%d:%s%s%s state=%d", i,
2858 (sticky & (1 << i)) ?
" sticky" :
"",
2859 (unsol & (1 << i)) ?
" unsol" :
"",
2860 (wake & (1 << i)) ?
" wake" :
"",
2887 device_printf(
dev,
" GPIO%d: ", i);
2888 if ((
enable & (1 << i)) == 0) {
2889 printf(
"disabled\n");
2892 if ((
dir & (1 << i)) == 0) {
2893 printf(
"input%s%s%s",
2894 (sticky & (1 << i)) ?
" sticky" :
"",
2895 (unsol & (1 << i)) ?
" unsol" :
"",
2896 (wake & (1 << i)) ?
" wake" :
"");
2899 printf(
" state=%d\n", (
data >> i) & 1);
2915 device_printf(
dev,
" GPO%d: state=%d", i,
2937 "NumGPIO=%d NumGPO=%d "
2938 "NumGPI=%d GPIWake=%d GPIUnsol=%d\n",
2951 devinfo->supp_stream_formats = res;
2955 devinfo->supp_pcm_size_rate = res;
2965 for (i =
devinfo->startnode; i < devinfo->endnode; i++) {
2968 device_printf(
devinfo->dev,
"Ghost widget! nid=%d!\n", i);
2989 for (i =
devinfo->startnode; i < devinfo->endnode; i++) {
3002 int i, j, cnt,
max, ocap, icap;
3007 for (i =
devinfo->startnode; i < devinfo->endnode; i++) {
3009 if (w == NULL || w->
enable == 0)
3017 for (j = 0; j < w->
nconns; j++) {
3020 if (cw == NULL || cw->
enable == 0)
3037 sizeof(*ctls) *
max, M_HDAA, M_ZERO | M_NOWAIT);
3041 device_printf(
devinfo->dev,
"unable to allocate ctls!\n");
3047 for (i =
devinfo->startnode; cnt <
max && i < devinfo->endnode; i++) {
3049 device_printf(
devinfo->dev,
"%s: Ctl overflow!\n",
3054 if (w == NULL || w->
enable == 0)
3105 for (j = 0; j < w->
nconns; j++) {
3108 "%s: Ctl overflow!\n",
3114 if (cw == NULL || cw->
enable == 0)
3119 ctls[cnt].
index = j;
3133 "%s: Ctl overflow!\n",
3164 int i, j, cnt,
max,
type,
dir, assoc, seq, first, hpredir;
3168 for (j = 1; j < 16; j++) {
3169 for (i =
devinfo->startnode; i < devinfo->endnode; i++) {
3171 if (w == NULL || w->
enable == 0)
3190 sizeof(*as) *
max, M_HDAA, M_ZERO | M_NOWAIT);
3194 device_printf(
devinfo->dev,
"unable to allocate assocs!\n");
3199 for (i = 0; i <
max; i++) {
3208 for (j = 1; j < 16 && cnt <
max; j++) {
3211 for (i =
devinfo->startnode; i < devinfo->endnode; i++) {
3213 if (w == NULL || w->
enable == 0)
3223 (
"%s: Associations owerflow (%d of %d)",
3224 __func__, cnt,
max));
3237 if (as[cnt].
pincnt == 0) {
3245 if (as[cnt].
pins[seq] != 0) {
3246 device_printf(
devinfo->dev,
"%s: Duplicate pin %d (%d) "
3247 "in association %d! Disabling association.\n",
3248 __func__, seq, w->
nid, j);
3251 if (
dir != as[cnt].
dir) {
3252 device_printf(
devinfo->dev,
"%s: Pin %d has wrong "
3253 "direction for association %d! Disabling "
3255 __func__, w->
nid, j);
3282 if (j != 15 && as[cnt].
pincnt > 0) {
3288 for (i = 0; i <
max; i++) {
3290 as[i].
pins[14] > 0 || as[i].
pins[15] > 0))
3295 "%d associations found:\n",
max);
3296 for (i = 0; i <
max; i++) {
3298 "Association %d (%d) %s%s:\n",
3300 as[i].
enable?
"":
" (disabled)");
3301 for (j = 0; j < 16; j++) {
3302 if (as[i].
pins[j] == 0)
3305 " Pin nid=%d seq=%d\n",
3319 int dupseq,
int min,
int only,
int depth)
3328 if (w == NULL || w->
enable == 0)
3333 " %*stracing via nid %d\n",
3334 depth + 1,
"", w->
nid);
3342 " %*snid %d busy by association %d\n",
3353 " %*snid %d busy by seqmask %x\n",
3365 " %*snid %d busy by seqmask %x\n",
3379 if ((only == 0 || only == w->
nid) &&
3380 (w->
nid >= min) && (dupseq < 0 || w->
nid ==
3381 devinfo->as[as].dacs[0][dupseq]))
3390 for (i = 0; i < w->
nconns; i++) {
3396 w->
conns[i], dupseq, min, only, depth + 1)) != 0) {
3397 if (
m == 0 || ret <
m) {
3401 if (only || dupseq >= 0)
3405 if (im >= 0 && only && ((w->
nconns > 1 &&
3418 " %*snid %d returned %d\n",
3419 depth + 1,
"", w->
nid,
m);
3430 int mixed,
int min,
int only,
int depth,
int *length,
int onlylength)
3439 if (w == NULL || w->
enable == 0)
3443 " %*stracing via nid %d\n",
3444 depth + 1,
"", w->
nid);
3450 " %*snid %d busy by association %d\n",
3458 " %*snid %d busy by seqmask %x\n",
3465 if ((only == 0 || only == w->
nid) && (w->
nid >= min) &&
3466 (onlylength == 0 || onlylength == depth)) {
3477 for (j =
devinfo->startnode; j < devinfo->endnode; j++) {
3479 if (wc == NULL || wc->
enable == 0)
3482 for (i = 0; i < wc->
nconns; i++) {
3488 j, mixed, min, only, depth + 1,
3489 length, onlylength)) != 0) {
3490 if (
m == 0 || ret <
m ||
3491 (ret ==
m && *length < lm)) {
3501 if (im >= 0 && only && ((wc->
nconns > 1 &&
3514 " %*snid %d returned %d\n",
3515 depth + 1,
"", w->
nid,
m);
3529 for (i =
devinfo->startnode; i < devinfo->endnode; i++) {
3531 if (w == NULL || w->
enable == 0)
3560 for (i = seq; i < 16 && ases[as].
pins[i] == 0; i++)
3571 " Tracing pin %d with min nid %d",
3572 ases[as].
pins[i], min);
3574 printf(
" and hpredir %d",
hpredir);
3584 " Unable to trace pin %d seq %d with min "
3586 ases[as].
pins[i], i, min);
3588 printf(
" and hpredir %d",
hpredir);
3595 " Pin %d traced to DAC %d",
3596 ases[as].
pins[i], res);
3598 printf(
" and hpredir %d",
hpredir);
3600 printf(
" with fake redirection");
3606 ases[as].
dacs[0][i] = res;
3612 ases[as].
dacs[0][i] = 0;
3629 for (i =
devinfo->startnode; i < devinfo->endnode; i++) {
3631 if (w3 == NULL || w3->
enable == 0)
3638 for (j = 0; j < w3->
nconns; j++) {
3673 if (w3 == NULL || w3->
enable == 0)
3676 if (w4 == NULL || w4->
enable == 0)
3688 for (i = 0; i < w3->
nconns; i++) {
3708 "Looking for additional %sC "
3709 "for association %d (%d)\n",
3716 for (i = 0; i < 16; i++) {
3717 if (as->
dacs[0][i] <= 0)
3719 if (pos >= 0 && as->
dacs[0][i] != as->
dacs[0][pos])
3724 nid1 = as->
dacs[0][pos];
3727 for (nid2 =
devinfo->startnode; nid2 < devinfo->endnode; nid2++) {
3729 if (w2 == NULL || w2->
enable == 0)
3752 " ADC %d considered equal to ADC %d\n", nid2, nid1);
3761 " DAC %d considered equal to DAC %d\n", nid2, nid1);
3764 for (i = 0; i < 16; i++) {
3765 if (as->
dacs[0][i] <= 0)
3780 int i, j,
k, length;
3782 for (j =
devinfo->startnode; j < devinfo->endnode; j++) {
3784 if (w == NULL || w->
enable == 0)
3792 for (i = 0; i < 16; i++) {
3793 if (ases[as].pins[i] == 0)
3798 " Tracing pin %d to ADC %d\n",
3799 ases[as].
pins[i], j);
3803 ases[as].pins[i], 1, 0, j, 0, &length, 0) == 0) {
3807 " Unable to trace pin %d to ADC %d, undo traces\n",
3808 ases[as].
pins[i], j);
3811 for (
k = 0;
k < 16;
k++)
3812 ases[as].dacs[0][
k] = 0;
3817 " Pin %d traced to ADC %d\n",
3818 ases[as].
pins[i], j);
3820 ases[as].
dacs[0][i] = j;
3839 for (i = seq; i < 16 && ases[as].
pins[i] == 0; i++)
3849 " Tracing pin %d with min nid %d",
3850 ases[as].
pins[i], min);
3855 ases[as].
pins[i], 0, min, 0, 0, &length, 0);
3860 " Unable to trace pin %d seq %d with min "
3862 ases[as].
pins[i], i, min);
3869 " Pin %d traced to ADC %d\n",
3870 ases[as].
pins[i], res);
3874 ases[as].
pins[i], 0, min, res, 0, &length, length);
3875 ases[as].
dacs[0][i] = res;
3881 ases[as].
dacs[0][i] = 0;
3900 if (w == NULL || w->
enable == 0)
3904 " %*stracing via nid %d\n",
3905 depth + 1,
"", w->
nid);
3908 if (depth > 0 && w->
bindas != -1) {
3912 " %*snid %d found output association %d\n",
3921 " %*snid %d busy by input association %d\n",
3939 for (j =
devinfo->startnode; j < devinfo->endnode; j++) {
3941 if (wc == NULL || wc->
enable == 0)
3943 for (i = 0; i < wc->
nconns; i++) {
3949 j, depth + 1) != 0) {
3959 if (res && w->
bindas == -1)
3964 " %*snid %d returned %d\n",
3965 depth + 1,
"", w->
nid, res);
3985 "Tracing input monitor\n");
3987 for (j =
devinfo->startnode; j < devinfo->endnode; j++) {
3989 if (w == NULL || w->
enable == 0)
3997 " Tracing nid %d to out\n",
4003 " nid %d is input monitor\n",
4006 w->
ossdev = SOUND_MIXER_IMIX;
4015 "Tracing other input monitors\n");
4017 for (j =
devinfo->startnode; j < devinfo->endnode; j++) {
4019 if (w == NULL || w->
enable == 0)
4027 " Tracing nid %d to out\n",
4033 " nid %d is input monitor\n",
4042 "Tracing beeper\n");
4044 for (j =
devinfo->startnode; j < devinfo->endnode; j++) {
4046 if (w == NULL || w->
enable == 0)
4052 " Tracing nid %d to out\n",
4058 " nid %d traced to out\n",
4073 int i, j, cnt = 0,
free;
4075 for (j = 0; j <
devinfo->ascnt; j++) {
4079 if (
devinfo->num_chans == 0) {
4082 M_HDAA, M_ZERO | M_NOWAIT);
4085 "Channels memory allocation failed!\n");
4091 M_HDAA, M_ZERO | M_NOWAIT);
4095 "Channels memory allocation failed!\n");
4099 for (j = 0; j <
devinfo->num_chans; j++)
4105 for (j =
free; j <
free + cnt; j++) {
4111 for (j = 0; j <
devinfo->ascnt; j++) {
4114 for (i = 0; i <
as[j].num_chans; i++) {
4133 for (i =
devinfo->startnode; i < devinfo->endnode; i++) {
4135 if (w == NULL || w->
enable == 0)
4142 " Disabling nid %d due to it's"
4143 " non-audio type.\n",
4155 int done, found, i, j,
k;
4158 for (i =
devinfo->startnode; i < devinfo->endnode; i++) {
4160 if (w == NULL || w->
enable == 0)
4169 " Disabling pin nid %d due"
4170 " to None connectivity.\n",
4178 " Disabling unassociated"
4205 " Disabling ctl %d nid %d cnid %d due"
4206 " to disabled widget.\n", i,
4214 for (i =
devinfo->startnode; i < devinfo->endnode; i++) {
4216 if (w == NULL || w->
enable == 0)
4219 for (j = 0; j < w->
nconns; j++) {
4222 if (cw == NULL || cw->
enable == 0) {
4226 " Disabling nid %d connection %d due"
4227 " to disabled child widget.\n",
4238 for (j = 0; j < w->
nconns; j++) {
4249 " Disabling nid %d due to all it's"
4250 " inputs disabled.\n", w->
nid);
4258 for (
k =
devinfo->startnode; k < devinfo->endnode;
k++) {
4260 if (cw == NULL || cw->
enable == 0)
4262 for (j = 0; j < cw->
nconns; j++) {
4274 " Disabling nid %d due to all it's"
4275 " consumers disabled.\n", w->
nid);
4279 }
while (done == 0);
4292 for (i =
devinfo->startnode; i < devinfo->endnode; i++) {
4294 if (w == NULL || w->
enable == 0)
4300 " Disabling unassociated nid %d.\n",
4307 for (i =
devinfo->startnode; i < devinfo->endnode; i++) {
4309 if (w == NULL || w->
enable == 0)
4316 for (j = 0; j < w->
nconns; j++) {
4322 " Disabling connection to input pin "
4323 "nid %d conn %d.\n",
4329 if (ctl && ctl->
enable) {
4339 if (ctl && ctl->
enable) {
4346 for (
k =
devinfo->startnode; k < devinfo->endnode;
k++) {
4348 if (cw == NULL || cw->
enable == 0)
4350 for (j = 0; j < cw->
nconns; j++) {
4355 " Disabling connection from output pin "
4356 "nid %d conn %d cnid %d.\n",
4364 if (ctl && ctl->
enable) {
4386 for (i =
devinfo->startnode; i < devinfo->endnode; i++) {
4388 if (w == NULL || w->
enable == 0)
4396 for (j = 0; j < w->
nconns; j++) {
4404 " Disabling unselected connection "
4405 "nid %d conn %d.\n",
4422 for (i =
devinfo->startnode; i < devinfo->endnode; i++) {
4424 if (w == NULL || w->
enable == 0)
4433 for (j = 0; j < w->
nconns; j++) {
4437 if (cw == NULL || w->
enable == 0)
4459 " Disabling crossassociatement connection "
4460 "nid %d conn %d cnid %d.\n",
4501 " Disabling crossassociatement connection "
4502 "ctl %d nid %d cnid %d.\n", i,
4516 int ossdev,
int ctlable,
int depth,
int *minamp,
int *maxamp)
4520 int i, j, conns = 0, tminamp, tmaxamp, cminamp, cmaxamp, found = 0;
4526 if (w == NULL || w->
enable == 0)
4531 for (j = 0; j < w->
nconns; j++) {
4540 if (depth > 0 && ctlable && (conns == 1 ||
4545 ctl->
ossmask |= (1 << ossdev);
4547 if (*minamp == *maxamp) {
4556 if (w->
ossdev >= 0 && depth > 0)
4579 ctl->
ossmask |= (1 << ossdev);
4581 if (*minamp == *maxamp) {
4588 cminamp = cmaxamp = 0;
4589 for (i =
devinfo->startnode; i < devinfo->endnode; i++) {
4591 if (wc == NULL || wc->
enable == 0)
4593 for (j = 0; j < wc->
nconns; j++) {
4595 tminamp = tmaxamp = 0;
4597 wc->
nid, j, ossdev, ctlable, depth + 1,
4598 &tminamp, &tmaxamp);
4599 if (cminamp == 0 && cmaxamp == 0) {
4602 }
else if (tminamp != tmaxamp) {
4603 cminamp = imax(cminamp, tminamp);
4604 cmaxamp = imin(cmaxamp, tmaxamp);
4609 if (*minamp == *maxamp && cminamp < cmaxamp) {
4622 int ossdev,
int depth,
int *minamp,
int *maxamp)
4627 int i, j, consumers, tminamp, tmaxamp, cminamp, cmaxamp, found = 0;
4633 if (w == NULL || w->
enable == 0)
4640 for (i =
devinfo->startnode; i < devinfo->endnode; i++) {
4642 if (wc == NULL || wc->
enable == 0)
4644 for (j = 0; j < wc->
nconns; j++) {
4653 if ((consumers == 2 && (w->
bindas < 0 ||
4663 ctl->
ossmask |= (1 << ossdev);
4665 if (*minamp == *maxamp) {
4677 cminamp = cmaxamp = 0;
4678 for (i = 0; i < w->
nconns; i++) {
4683 tminamp = tmaxamp = 0;
4687 ctl->
ossmask |= (1 << ossdev);
4689 if (*minamp == *maxamp) {
4695 depth + 1, &tminamp, &tmaxamp);
4696 if (cminamp == 0 && cmaxamp == 0) {
4699 }
else if (tminamp != tmaxamp) {
4700 cminamp = imax(cminamp, tminamp);
4701 cmaxamp = imin(cmaxamp, tmaxamp);
4704 if (*minamp == *maxamp && cminamp < cmaxamp) {
4720 int type = -1, use, used = 0;
4721 static const int types[7][13] = {
4722 { SOUND_MIXER_LINE, SOUND_MIXER_LINE1, SOUND_MIXER_LINE2,
4723 SOUND_MIXER_LINE3, -1 },
4724 { SOUND_MIXER_MONITOR, SOUND_MIXER_MIC, -1 },
4725 { SOUND_MIXER_MIC, SOUND_MIXER_MONITOR, -1 },
4726 { SOUND_MIXER_CD, -1 },
4727 { SOUND_MIXER_SPEAKER, -1 },
4728 { SOUND_MIXER_DIGITAL1, SOUND_MIXER_DIGITAL2, SOUND_MIXER_DIGITAL3,
4730 { SOUND_MIXER_LINE, SOUND_MIXER_LINE1, SOUND_MIXER_LINE2,
4731 SOUND_MIXER_LINE3, SOUND_MIXER_PHONEIN, SOUND_MIXER_PHONEOUT,
4732 SOUND_MIXER_VIDEO, SOUND_MIXER_RADIO, SOUND_MIXER_DIGITAL1,
4733 SOUND_MIXER_DIGITAL2, SOUND_MIXER_DIGITAL3, SOUND_MIXER_MONITOR,
4738 for (i =
devinfo->startnode; i < devinfo->endnode; i++) {
4740 if (w == NULL || w->
enable == 0)
4774 while (types[
type][j] >= 0 &&
4775 (used & (1 << types[
type][j])) != 0) {
4778 if (types[
type][j] >= 0)
4779 use = types[
type][j];
4782 use = SOUND_MIXER_PCM;
4785 use = SOUND_MIXER_SPEAKER;
4796 for (i =
devinfo->startnode; i < devinfo->endnode; i++) {
4798 if (w == NULL || w->
enable == 0)
4827 while (types[
type][j] >= 0 &&
4828 (used & (1 << types[
type][j])) != 0) {
4831 if (types[
type][j] >= 0) {
4833 used |= (1 << types[
type][j]);
4837 for (i =
devinfo->startnode; i < devinfo->endnode; i++) {
4839 if (w == NULL || w->
enable == 0)
4850 while (types[6][j] >= 0 &&
4851 (used & (1 << types[6][j])) != 0) {
4854 if (types[6][j] >= 0) {
4856 used |= (1 << types[6][j]);
4868 for (j = 0; j <
devinfo->ascnt; j++) {
4873 "Tracing association %d (%d)\n", j, as[j].
index);
4878 if (res == 0 && as[j].
hpredir >= 0 &&
4885 }
else if (as[j].
mixed)
4892 "Association %d (%d) trace succeeded\n",
4898 "Association %d (%d) trace failed\n",
4906 for (j = 0; j <
devinfo->ascnt; j++) {
4922 int found,
int minamp,
int maxamp)
4932 pdevinfo->
ossmask |= (1 << ossdev);
4935 if (pdevinfo->
minamp[ossdev] == 0 && pdevinfo->
maxamp[ossdev] == 0) {
4953 int i, j, minamp, maxamp, found;
4956 for (i =
devinfo->startnode; i < devinfo->endnode; i++) {
4958 if (w == NULL || w->
enable == 0)
4960 minamp = maxamp = 0;
4968 w->
ossdev, 1, 0, &minamp, &maxamp);
4972 SOUND_MIXER_RECLEV, 0, &minamp, &maxamp);
4977 SOUND_MIXER_VOLUME, 0, &minamp, &maxamp);
4980 if (w->
ossdev == SOUND_MIXER_IMIX) {
4981 minamp = maxamp = 0;
4983 w->
ossdev, 1, 0, &minamp, &maxamp);
4984 if (minamp == maxamp) {
4988 w->
ossdev, 0, &minamp, &maxamp);
4994 for (j = 0; j < w->
nconns; j++) {
4998 if (cw == NULL || cw->
enable == 0)
5005 minamp = maxamp = 0;
5007 w->
nid, j, SOUND_MIXER_IGAIN, 0,
5010 found, minamp, maxamp);
5024 for (i = 0; i <
devinfo->nodecnt; i++) {
5132 uint32_t gdata, gmask, gdir;
5136 if (
devinfo->gpio != 0 && numgpio != 0) {
5143 for (i = 0; i < numgpio; i++) {
5164 device_printf(
devinfo->dev,
"GPIO commit\n");
5185 if (
devinfo->gpo != 0 && numgpo != 0) {
5188 for (i = 0; i < numgpo; i++) {
5198 device_printf(
devinfo->dev,
"GPO commit\n");
5218 for (i = 0; i <
devinfo->nodecnt; i++) {
5259 for (i =
devinfo->startnode; i < devinfo->endnode; i++) {
5273 uint32_t
cap, fmtcap, pcmcap;
5274 int i, j, ret, channels, onlystereo;
5289 fmtcap =
devinfo->supp_stream_formats;
5290 pcmcap =
devinfo->supp_pcm_size_rate;
5292 for (i = 0; i < 16; i++) {
5300 for (j = 0; j < ret; j++) {
5308 if (w == NULL || w->
enable == 0)
5341 if ((!onlystereo) || as[ch->
as].
mixed)
5374 if (channels >= 2) {
5379 if (channels >= 3 && !onlystereo) {
5387 if (channels >= 4) {
5397 if (channels >= 5 && !onlystereo) {
5405 if (channels >= 6) {
5415 if (channels >= 7 && !onlystereo) {
5423 if (channels >= 8) {
5431 if (channels >= 8) {
5475 int i, j,
k, apdev = 0, ardev = 0, dpdev = 0, drdev = 0;
5477 for (i = 0; i <
devinfo->ascnt; i++) {
5493 max(ardev, apdev) +
max(drdev, dpdev);
5497 M_HDAA, M_ZERO | M_NOWAIT);
5500 "Unable to allocate memory for devices\n");
5503 for (i = 0; i <
devinfo->num_devs; i++) {
5508 devinfo->devs[i].digital = 255;
5510 for (i = 0; i <
devinfo->ascnt; i++) {
5513 for (j = 0; j <
devinfo->num_devs; j++) {
5514 if (
devinfo->devs[j].digital != 255 &&
5515 (!
devinfo->devs[j].digital) !=
5519 if (
devinfo->devs[j].recas >= 0)
5523 if (
devinfo->devs[j].playas >= 0)
5543 for (i = 0; i <
devinfo->num_devs; i++) {
5546 pdevinfo->
dev = device_add_child(
devinfo->dev,
"pcm", -1);
5547 device_set_ivars(pdevinfo->
dev, (
void *)pdevinfo);
5557 int i, j, printed = 0;
5560 flag = ~(SOUND_MASK_VOLUME | SOUND_MASK_PCM |
5561 SOUND_MASK_CD | SOUND_MASK_LINE | SOUND_MASK_RECLEV |
5562 SOUND_MASK_MIC | SOUND_MASK_SPEAKER | SOUND_MASK_IGAIN |
5563 SOUND_MASK_OGAIN | SOUND_MASK_IMIX | SOUND_MASK_MONITOR);
5566 for (j = 0; j < SOUND_MIXER_NRDEVICES; j++) {
5567 if ((flag & (1 << j)) == 0)
5575 if (!((pdevinfo->
playas >= 0 &&
5577 (pdevinfo->
recas >= 0 &&
5581 if ((ctl->
ossmask & (1 << j)) == 0)
5585 if (banner != NULL) {
5586 device_printf(pdevinfo->
dev,
"%s", banner);
5588 device_printf(pdevinfo->
dev,
"Unknown Ctl");
5590 printf(
" (OSS: %s)",
5593 if (pdevinfo->
ossmask & (1 << j)) {
5594 printf(
": %+d/%+ddB\n",
5596 pdevinfo->
maxamp[j] / 4);
5601 device_printf(pdevinfo->
dev,
" +- ctl %2d (nid %3d %s", i,
5605 printf(
" %2d): ", ctl->
index);
5608 if (ctl->
step > 0) {
5609 printf(
"%+d/%+ddB (%d steps)%s\n",
5613 ctl->
mute?
" + mute":
"");
5615 printf(
"%s\n", ctl->
mute?
"mute":
"");
5619 device_printf(pdevinfo->
dev,
"\n");
5629 device_printf(
dev,
" Stream cap: 0x%08x", cap);
5640 device_printf(
dev,
" PCM cap: 0x%08x", cap);
5684 device_printf(w->
devinfo->
dev,
" Pin cap: 0x%08x", pincap);
5722 device_printf(w->
devinfo->
dev,
" Pin config: 0x%08x\n",
5750 device_printf(w->
devinfo->
dev,
"%2d %08x %-2d %-2d "
5751 "%-13s %-5s %-7s %-10s %-7s %d%s\n",
5761 (w->
enable == 0)?
" DISA":
"");
5770 device_printf(
devinfo->dev,
"nid 0x as seq "
5771 "device conn jack loc color misc\n");
5772 for (i =
devinfo->startnode; i < devinfo->endnode; i++) {
5790 device_printf(
dev,
" %s amp: 0x%08x "
5791 "mute=%d step=%d size=%d offset=%d (%+d/%+ddB)\n",
5806 device_printf(
devinfo->dev,
"\n");
5807 device_printf(
devinfo->dev,
"Default parameters:\n");
5813 for (i =
devinfo->startnode; i < devinfo->endnode; i++) {
5816 device_printf(
devinfo->dev,
"Ghost widget nid=%d\n", i);
5819 device_printf(
devinfo->dev,
"\n");
5820 device_printf(
devinfo->dev,
" nid: %d%s\n", w->
nid,
5821 (w->
enable == 0) ?
" [DISABLED]" :
"");
5822 device_printf(
devinfo->dev,
" Name: %s\n", w->
name);
5823 device_printf(
devinfo->dev,
" Widget cap: 0x%08x",
5837 printf(
" STRIPE(x%d)",
5843 printf(
" %dCH", j + 1);
5847 device_printf(
devinfo->dev,
" Association: %d (0x%04x)\n",
5851 device_printf(
devinfo->dev,
" OSS: %s",
5862 }
else if (w->
type ==
5866 device_printf(
devinfo->dev,
" EAPD: 0x%08x\n",
5875 device_printf(
devinfo->dev,
" Connections: %d\n", w->
nconns);
5876 for (j = 0; j < w->
nconns; j++) {
5878 device_printf(
devinfo->dev,
" + %s<- nid=%d [%s]",
5880 w->
conns[j], (cw == NULL) ?
"GHOST!" : cw->
name);
5882 printf(
" [UNKNOWN]");
5883 else if (cw->
enable == 0)
5884 printf(
" [DISABLED]");
5887 printf(
" (selected)");
5906 if (w == NULL || w->
enable == 0)
5910 device_printf(pdevinfo->
dev,
"%*s", 4,
"");
5912 device_printf(pdevinfo->
dev,
"%*s + <- ", 4 + (depth - 1) * 7,
"");
5913 printf(
"nid=%d [%s]", w->
nid, w->
name);
5920 printf(
" [src: %s]",
5930 for (i = 0; i < w->
nconns; i++) {
5950 if (pdevinfo->
playas < 0)
5953 device_printf(pdevinfo->
dev,
"Playback:\n");
5957 devinfo->chans[chid].supp_stream_formats,
5958 devinfo->chans[chid].supp_pcm_size_rate);
5959 for (i = 0; i <
devinfo->as[pdevinfo->
playas].num_chans; i++) {
5961 device_printf(pdevinfo->
dev,
" DAC:");
5962 for (nids =
devinfo->chans[chid].io; *nids != -1; nids++)
5963 printf(
" %d", *nids);
5968 for (i = 0; i < 16; i++) {
5969 if (as->
pins[i] <= 0)
5972 if (w == NULL || w->
enable == 0)
5974 device_printf(pdevinfo->
dev,
"\n");
5977 device_printf(pdevinfo->
dev,
"\n");
5988 if (pdevinfo->
recas < 0)
5991 device_printf(pdevinfo->
dev,
"Record:\n");
5995 devinfo->chans[chid].supp_stream_formats,
5996 devinfo->chans[chid].supp_pcm_size_rate);
5997 for (i = 0; i <
devinfo->as[pdevinfo->
recas].num_chans; i++) {
5999 device_printf(pdevinfo->
dev,
" ADC:");
6000 for (nids =
devinfo->chans[chid].io; *nids != -1; nids++)
6001 printf(
" %d", *nids);
6005 for (i =
devinfo->startnode; i < devinfo->endnode; i++) {
6007 if (w == NULL || w->
enable == 0)
6013 device_printf(pdevinfo->
dev,
"\n");
6016 device_printf(pdevinfo->
dev,
"\n");
6027 for (i =
devinfo->startnode; i < devinfo->endnode; i++) {
6029 if (w == NULL || w->
enable == 0)
6031 if (w->
ossdev != SOUND_MIXER_IMIX)
6037 device_printf(pdevinfo->
dev,
"Input Mix:\n");
6039 device_printf(pdevinfo->
dev,
"\n");
6043 device_printf(pdevinfo->
dev,
"\n");
6051 uint32_t res, pincap, delay;
6054 device_printf(
dev,
"Dumping AFG pins:\n");
6055 device_printf(
dev,
"nid 0x as seq "
6056 "device conn jack loc color misc\n");
6057 for (i =
devinfo->startnode; i < devinfo->endnode; i++) {
6059 if (w == NULL || w->
type !=
6064 device_printf(
dev,
" Caps: %2s %3s %2s %4s %4s",
6079 if (res != 0x7fffffff && res != 0xffffffff)
6082 }
while (++delay < 10000);
6088 printf(
" Sense: 0x%08x (%sconnected%s)", res,
6093 ", ELD valid" :
"");
6095 printf(
" delay %dus", delay * 10);
6100 "NumGPIO=%d NumGPO=%d NumGPI=%d GPIWake=%d GPIUnsol=%d\n",
6119 device_printf(
dev,
"Applying built-in patches...\n");
6123 device_printf(
dev,
"Applying local patches...\n");
6128 device_printf(
dev,
"Parsing Ctls...\n");
6132 device_printf(
dev,
"Disabling nonaudio...\n");
6136 device_printf(
dev,
"Disabling useless...\n");
6140 device_printf(
dev,
"Patched pins configuration:\n");
6144 device_printf(
dev,
"Parsing pin associations...\n");
6148 device_printf(
dev,
"Building AFG tree...\n");
6152 device_printf(
dev,
"Disabling unassociated "
6157 device_printf(
dev,
"Disabling nonselected "
6162 device_printf(
dev,
"Disabling useless...\n");
6166 device_printf(
dev,
"Disabling "
6167 "crossassociatement connections...\n");
6171 device_printf(
dev,
"Disabling useless...\n");
6175 device_printf(
dev,
"Binding associations to channels...\n");
6179 device_printf(
dev,
"Assigning names to signal sources...\n");
6183 device_printf(
dev,
"Preparing PCM devices...\n");
6187 device_printf(
dev,
"Assigning mixers to the tree...\n");
6191 device_printf(
dev,
"Preparing pin controls...\n");
6195 device_printf(
dev,
"AFG commit...\n");
6199 device_printf(
dev,
"Applying direct built-in patches...\n");
6203 device_printf(
dev,
"Pin sense init...\n");
6207 device_printf(
dev,
"Creating PCM devices...\n");
6213 device_printf(dev,
"FG config/quirks:");
6214 for (i = 0; i < nitems(hdaa_quirks_tab); i++) {
6215 if ((devinfo->quirks &
6216 hdaa_quirks_tab[i].value) ==
6217 hdaa_quirks_tab[i].value)
6218 printf(
" %s", hdaa_quirks_tab[i].key);
6225 device_printf(
dev,
"\n");
6226 device_printf(
dev,
"+-----------+\n");
6227 device_printf(
dev,
"| HDA NODES |\n");
6228 device_printf(
dev,
"+-----------+\n");
6231 device_printf(
dev,
"\n");
6232 device_printf(
dev,
"+----------------+\n");
6233 device_printf(
dev,
"| HDA AMPLIFIERS |\n");
6234 device_printf(
dev,
"+----------------+\n");
6235 device_printf(
dev,
"\n");
6238 device_printf(
dev,
"%3d: nid %3d %s (%s) index %d", i,
6239 (ctl->widget != NULL) ? ctl->widget->nid : -1,
6243 if (ctl->childwidget != NULL)
6244 printf(
" cnid %3d", ctl->childwidget->nid);
6247 printf(
" ossmask=0x%08x\n",
6250 " mute: %d step: %3d size: %3d off: %3d%s\n",
6251 ctl->mute, ctl->step, ctl->size, ctl->offset,
6252 (ctl->enable == 0) ?
" [DISABLED]" :
6253 ((ctl->ossmask == 0) ?
" [UNUSED]" :
""));
6255 device_printf(
dev,
"\n");
6267 device_printf(
dev,
"Pin sense deinit...\n");
6282 for (i =
devinfo->startnode; i < devinfo->endnode; i++) {
6293 for (j = 0; j < w->
nconns; j++)
6297 if (w->
eld != NULL) {
6311 int n = 0, i, numgpi;
6322 for (i = 0; i < numgpi; i++) {
6323 n += snprintf(
buf +
n,
sizeof(
buf) -
n,
"%s%d=%d",
6324 n != 0 ?
" " :
"", i, ((
data >> i) & 1));
6326 return (sysctl_handle_string(oidp,
buf,
sizeof(
buf),
req));
6335 int n = 0, i, numgpio;
6350 for (i = 0; i < numgpio; i++) {
6351 n += snprintf(
buf +
n,
sizeof(
buf) -
n,
"%s%d=",
6352 n != 0 ?
" " :
"", i);
6353 if ((
enable & (1 << i)) == 0) {
6354 n += snprintf(
buf +
n,
sizeof(
buf) -
n,
"disabled");
6357 n += snprintf(
buf +
n,
sizeof(
buf) -
n,
"%sput(%d)",
6358 ((
dir >> i) & 1) ?
"out" :
"in", ((
data >> i) & 1));
6360 return (sysctl_handle_string(oidp,
buf,
sizeof(
buf),
req));
6368 int error,
n = 0, i, numgpio;
6374 for (i = 0; i < numgpio; i++) {
6376 n += snprintf(
buf +
n,
sizeof(
buf) -
n,
"%s%d=%s",
6380 if (
error != 0 ||
req->newptr == NULL)
6382 if (strncmp(
buf,
"0x", 2) == 0)
6383 gpio = strtol(
buf + 2, NULL, 16);
6399 int n = 0, i, numgpo;
6410 for (i = 0; i < numgpo; i++) {
6411 n += snprintf(
buf +
n,
sizeof(
buf) -
n,
"%s%d=%d",
6412 n != 0 ?
" " :
"", i, ((
data >> i) & 1));
6414 return (sysctl_handle_string(oidp,
buf,
sizeof(
buf),
req));
6422 int error,
n = 0, i, numgpo;
6428 for (i = 0; i < numgpo; i++) {
6430 n += snprintf(
buf +
n,
sizeof(
buf) -
n,
"%s%d=%s",
6434 if (
error != 0 ||
req->newptr == NULL)
6436 if (strncmp(
buf,
"0x", 2) == 0)
6437 gpo = strtol(
buf + 2, NULL, 16);
6454 dev = oidp->oid_arg1;
6460 if (
error != 0 ||
req->newptr == NULL ||
val == 0)
6464 device_printf(
dev,
"Reconfiguration...\n");
6469 if ((
error = device_delete_children(
dev)) != 0) {
6477 bus_generic_attach(
dev);
6479 device_printf(
dev,
"Reconfiguration done\n");
6494 device_printf(
dev,
"Suspend...\n");
6498 device_printf(
dev,
"Stop streams...\n");
6500 for (i = 0; i <
devinfo->num_chans; i++) {
6507 device_printf(
dev,
"Power down FG"
6508 " nid=%d to the D3 state...\n",
6514 callout_stop(&
devinfo->poll_jack);
6516 callout_drain(&
devinfo->poll_jack);
6518 device_printf(
dev,
"Suspend done\n");
6530 device_printf(
dev,
"Resume...\n");
6534 device_printf(
dev,
"Power up audio FG nid=%d...\n",
6539 device_printf(
dev,
"AFG commit...\n");
6543 device_printf(
dev,
"Applying direct built-in patches...\n");
6547 device_printf(
dev,
"Pin sense init...\n");
6552 for (i = 0; i <
devinfo->num_devs; i++) {
6555 device_printf(pdevinfo->
dev,
6556 "OSS mixer reinitialization...\n");
6559 device_printf(pdevinfo->
dev,
6560 "unable to reinitialize the mixer\n");
6564 device_printf(
dev,
"Start streams...\n");
6566 for (i = 0; i <
devinfo->num_chans; i++) {
6568 devinfo->chans[i].flags &= ~HDAA_CHN_SUSPEND;
6574 device_printf(
dev,
"Resume done\n");
6587 pdesc = device_get_desc(device_get_parent(
dev));
6588 snprintf(
buf,
sizeof(
buf),
"%.*s Audio Function Group",
6589 (
int)(strlen(pdesc) - 10), pdesc);
6590 device_set_desc_copy(
dev,
buf);
6591 return (BUS_PROBE_DEFAULT);
6607 callout_init(&
devinfo->poll_jack, 1);
6620 device_printf(
dev,
"Subsystem ID: 0x%08x\n",
6621 hda_get_subsystem_id(
dev));
6625 "Audio Function Group at nid=%d: %d subnodes %d-%d\n",
6639 device_printf(
dev,
"Powering up...\n");
6643 device_printf(
dev,
"Parsing audio FG...\n");
6647 device_printf(
dev,
"Original pins configuration:\n");
6653 SYSCTL_ADD_PROC(device_get_sysctl_ctx(
dev),
6654 SYSCTL_CHILDREN(device_get_sysctl_tree(
dev)), OID_AUTO,
6655 "config", CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_MPSAFE,
6657 "Configuration options");
6658 SYSCTL_ADD_PROC(device_get_sysctl_ctx(
dev),
6659 SYSCTL_CHILDREN(device_get_sysctl_tree(
dev)), OID_AUTO,
6660 "gpi_state", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE,
6662 SYSCTL_ADD_PROC(device_get_sysctl_ctx(
dev),
6663 SYSCTL_CHILDREN(device_get_sysctl_tree(
dev)), OID_AUTO,
6664 "gpio_state", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE,
6666 SYSCTL_ADD_PROC(device_get_sysctl_ctx(
dev),
6667 SYSCTL_CHILDREN(device_get_sysctl_tree(
dev)), OID_AUTO,
6668 "gpio_config", CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_MPSAFE,
6670 SYSCTL_ADD_PROC(device_get_sysctl_ctx(
dev),
6671 SYSCTL_CHILDREN(device_get_sysctl_tree(
dev)), OID_AUTO,
6672 "gpo_state", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE,
6674 SYSCTL_ADD_PROC(device_get_sysctl_ctx(
dev),
6675 SYSCTL_CHILDREN(device_get_sysctl_tree(
dev)), OID_AUTO,
6676 "gpo_config", CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_MPSAFE,
6678 SYSCTL_ADD_PROC(device_get_sysctl_ctx(
dev),
6679 SYSCTL_CHILDREN(device_get_sysctl_tree(
dev)), OID_AUTO,
6680 "reconfig", CTLTYPE_INT | CTLFLAG_RW,
6682 SYSCTL_ADD_INT(device_get_sysctl_ctx(
dev),
6683 SYSCTL_CHILDREN(device_get_sysctl_tree(
dev)), OID_AUTO,
6684 "init_clear", CTLFLAG_RW,
6685 &
devinfo->init_clear, 1,
"Clear initial pin widget configuration");
6686 bus_generic_attach(
dev);
6696 if ((
error = device_delete_children(
dev)) != 0)
6702 callout_stop(&
devinfo->poll_jack);
6704 callout_drain(&
devinfo->poll_jack);
6717 int retval, first = 1, i;
6719 retval = bus_print_child_header(
dev,
child);
6720 retval += printf(
" at nid ");
6723 for (i = 0; i < 16; i++) {
6724 if (as->
pins[i] <= 0)
6726 retval += printf(
"%s%d", first ?
"" :
",", as->
pins[i]);
6732 retval += printf(
" and ");
6736 for (i = 0; i < 16; i++) {
6737 if (as->
pins[i] <= 0)
6739 retval += printf(
"%s%d", first ?
"" :
",", as->
pins[i]);
6743 retval += bus_print_child_footer(
dev,
child);
6757 sbuf_printf(sb,
"nid=");
6760 for (i = 0; i < 16; i++) {
6761 if (as->
pins[i] <= 0)
6763 sbuf_printf(sb,
"%s%d", first ?
"" :
",", as->
pins[i]);
6769 for (i = 0; i < 16; i++) {
6770 if (as->
pins[i] <= 0)
6772 sbuf_printf(sb,
"%s%d", first ?
"" :
",", as->
pins[i]);
6786 for (i = 0; i <
devinfo->num_chans; i++) {
6807 device_printf(
dev,
"Unsolicited response %08x\n",
resp);
6810 for (i =
devinfo->startnode; i < devinfo->endnode; i++) {
6812 if (w == NULL || w->
enable == 0 || w->
type !=
6819 flags =
resp & 0x03;
6857 char *
buf,
int buflen)
6865 snprintf(
buf, buflen,
"mono");
6870 snprintf(
buf, buflen,
"2.0");
6871 }
else if (as->
pinset == 0x0003)
6872 snprintf(
buf, buflen,
"3.1");
6874 snprintf(
buf, buflen,
"4.0");
6876 snprintf(
buf, buflen,
"5.1");
6877 else if (as->
pinset == 0x0017)
6878 snprintf(
buf, buflen,
"7.1");
6880 snprintf(
buf, buflen,
"%dch",
c);
6882 strlcat(
buf,
"+HP", buflen);
6893 for (i = 0; i < 16; i++) {
6895 if (w == NULL || w->
enable == 0 || w->
type !=
6920 val = (ch->bit32 == 4) ? 32 : ((ch->bit32 == 3) ? 24 :
6921 ((ch->bit32 == 2) ? 20 : 0));
6923 if (
error != 0 ||
req->newptr == NULL)
6925 pcmcap = ch->supp_pcm_size_rate;
6946 char chans1[8], chans2[8];
6948 int loc1, loc2, t1, t2;
6950 if (pdevinfo->
playas >= 0)
6954 if (pdevinfo->
recas >= 0)
6960 if (loc1 >= 0 &&
HDA_LOCS[loc1][0] ==
'0')
6965 if (pdevinfo->
playas >= 0) {
6967 chans1,
sizeof(chans1));
6970 if (pdevinfo->
recas >= 0) {
6972 chans2,
sizeof(chans2));
6975 if (chans1[0] != 0 || chans2[0] != 0) {
6976 if (chans1[0] == 0 && pdevinfo->
playas >= 0)
6977 snprintf(chans1,
sizeof(chans1),
"2.0");
6978 else if (chans2[0] == 0 && pdevinfo->
recas >= 0)
6979 snprintf(chans2,
sizeof(chans2),
"2.0");
6980 if (strcmp(chans1, chans2) == 0)
6991 pdesc = device_get_desc(device_get_parent(
dev));
6992 snprintf(
buf,
sizeof(
buf),
"%.*s (%s%s%s%s%s%s%s%s%s)",
6993 (
int)(strlen(pdesc) - 21), pdesc,
6994 loc1 >= 0 ?
HDA_LOCS[loc1] :
"", loc1 >= 0 ?
" " :
"",
6995 (pdevinfo->
digital == 0x7)?
"HDMI/DP":
6996 ((pdevinfo->
digital == 0x5)?
"DisplayPort":
6997 ((pdevinfo->
digital == 0x3)?
"HDMI":
6998 ((pdevinfo->
digital)?
"Digital":
"Analog"))),
6999 chans1[0] ?
" " :
"", chans1,
7000 chans2[0] ?
"/" :
"", chans2,
7001 t1 >= 0 ?
" " :
"", t1 >= 0 ?
HDA_DEVS[t1] :
"");
7002 device_set_desc_copy(
dev,
buf);
7003 return (BUS_PROBE_SPECIFIC);
7028 hdaa_dump_ctls(pdevinfo,
"Microphone2 Volume", SOUND_MASK_MONITOR);
7030 hdaa_dump_ctls(pdevinfo,
"Speaker/Beep Volume", SOUND_MASK_SPEAKER);
7033 hdaa_dump_ctls(pdevinfo,
"Input Monitoring Level", SOUND_MASK_IGAIN);
7037 if (resource_int_value(device_get_name(
dev),
7038 device_get_unit(
dev),
"blocksize", &i) == 0 && i > 0) {
7061 device_printf(
dev,
"OSS mixer initialization...\n");
7063 if (
mixer_init(
dev, &hdaa_audio_ctl_ossmixer_class, pdevinfo) != 0)
7064 device_printf(
dev,
"Can't register mixer\n");
7067 device_printf(
dev,
"Registering PCM channels...\n");
7070 (pdevinfo->
recas >= 0)?1:0) != 0)
7071 device_printf(
dev,
"Can't register PCM\n");
7075 d = device_get_softc(
dev);
7076 if (pdevinfo->
playas >= 0) {
7081 SYSCTL_ADD_PROC(&d->play_sysctl_ctx,
7083 "32bit", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE,
7085 "Resolution of 32bit samples (20/24/32bit)");
7087 if (pdevinfo->
recas >= 0) {
7094 "32bit", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE,
7096 "Resolution of 32bit samples (20/24/32bit)");
7098 resource_int_value(device_get_name(
dev), device_get_unit(
dev),
7102 "autosrc", CTLFLAG_RW,
7104 "Automatic recording source selection");
7107 if (pdevinfo->
mixer != NULL) {
7110 if (pdevinfo->
playas >= 0) {
7114 if (pdevinfo->
recas >= 0) {
7123 device_get_nameunit(device_get_parent(
dev)),
int sndbuf_alloc(struct snd_dbuf *b, bus_dma_tag_t dmatag, int dmaflags, unsigned int size)
unsigned int sndbuf_getblkcnt(struct snd_dbuf *b)
bus_addr_t sndbuf_getbufaddr(struct snd_dbuf *buf)
unsigned int sndbuf_getalign(struct snd_dbuf *b)
unsigned int sndbuf_getblksz(struct snd_dbuf *b)
unsigned int sndbuf_getmaxsize(struct snd_dbuf *b)
int sndbuf_resize(struct snd_dbuf *b, unsigned int blkcnt, unsigned int blksz)
void chn_intr(struct pcm_channel *c)
#define PCMTRIG_COMMON(x)
struct pcmchan_matrix * m
#define HDA_HDMI_CODING_TYPE_MPEG1
#define HDA_CONFIG_DEFAULTCONF_SEQUENCE_SHIFT
#define HDA_HDMI_CODING_TYPE_ATRAC
#define HDA_PARAM_OUTPUT_AMP_CAP
#define HDA_HDMI_CODING_TYPE_MPEG2
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_88KHZ(param)
#define HDA_CMD_SET_GPIO_ENABLE_MASK(cad, nid, payload)
#define HDA_CONFIG_DEFAULTCONF_MISC_MASK
#define HDA_CONFIG_DEFAULTCONF_DEVICE_DIGITAL_OTHER_IN
#define HDA_PARAM_PIN_CAP_IMP_SENSE_CAP(param)
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_32BIT(param)
#define HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX
#define HDA_CMD_GET_CONFIGURATION_DEFAULT(cad, nid)
#define HDA_CMD_PIN_WIDGET_CTRL_VREF_ENABLE_50
#define HDA_CMD_GET_HDMI_DIP_SIZE(cad, nid, arg)
#define HDA_CMD_SET_DIGITAL_CONV_FMT1(cad, nid, payload)
#define HDA_CMD_SET_EAPD_BTL_ENABLE_LR_SWAP
#define HDA_PARAM_FCT_GRP_TYPE_NODE_TYPE_AUDIO
#define HDA_CMD_GET_GPI_DATA(cad, nid)
#define HDA_HDMI_CODING_TYPE_WMAPRO
#define HDA_PARAM_AUDIO_WIDGET_CAP_CC(param)
#define HDA_CMD_GET_GPIO_UNSOLICITED_ENABLE_MASK(cad, nid)
#define HDA_PARAM_PIN_CAP_VREF_CTRL(param)
#define HDA_CONFIG_DEFAULTCONF_MISC(conf)
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_8KHZ(param)
#define HDA_PARAM_SUB_NODE_COUNT
#define HDA_PARAM_SUPP_STREAM_FORMATS_AC3_MASK
#define HDA_CMD_SET_PIN_WIDGET_CTRL_VREF_ENABLE_MASK
#define HDA_CMD_SET_GPO_DATA(cad, nid, payload)
#define HDA_CMD_SET_AMP_GAIN_MUTE(cad, nid, payload)
#define HDA_CONFIG_DEFAULTCONF_CONNECTION_TYPE(conf)
#define HDA_CONFIG_DEFAULTCONF_CONNECTIVITY(conf)
#define HDA_CMD_GET_PIN_SENSE(cad, nid)
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_192KHZ(param)
#define HDA_CMD_GET_GPI_STICKY_MASK(cad, nid)
#define HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_VOLUME_WIDGET
#define HDA_PARAM_SUB_NODE_COUNT_START(param)
#define HDA_CMD_GET_CONN_LIST_ENTRY(cad, nid, payload)
#define HDA_CMD_SET_POWER_STATE(cad, nid, payload)
#define HDA_CMD_GET_GPO_DATA(cad, nid)
#define HDA_PARAM_PIN_CAP_VREF_CTRL_HIZ(param)
#define HDA_CMD_GET_PIN_SENSE_ELD_VALID
#define HDA_PARAM_SUPP_STREAM_FORMATS_FLOAT32(param)
#define HDA_HDMI_CODING_TYPE_LPCM
#define HDA_PARAM_PIN_CAP_HDMI(param)
#define HDA_CMD_PIN_WIDGET_CTRL_VREF_ENABLE_80
#define HDA_CMD_GET_STRIPE_CONTROL(cad, nid)
#define HDA_PARAM_OUTPUT_AMP_CAP_MUTE_CAP(param)
#define HDA_CMD_SET_CONV_STREAM_CHAN(cad, nid, payload)
#define HDA_HDMI_CODING_TYPE_AACLC
#define HDA_CMD_SET_PIN_WIDGET_CTRL_OUT_ENABLE
#define HDA_CMD_SET_EAPD_BTL_ENABLE(cad, nid, payload)
#define HDA_PARAM_AUDIO_WIDGET_CAP_POWER_CTRL(param)
#define HDA_CMD_SET_HDMI_DIP_INDEX(cad, nid, payload)
#define HDA_CMD_SET_GPIO_DATA(cad, nid, payload)
#define HDA_CONFIG_DEFAULTCONF_COLOR(conf)
#define HDA_PARAM_CONN_LIST_LENGTH
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_96KHZ(param)
#define HDA_CONFIG_DEFAULTCONF_COLOR_MASK
#define HDA_PARAM_PIN_CAP_HBR(param)
#define HDA_PARAM_AUDIO_WIDGET_CAP_OUT_AMP(param)
#define HDA_CONFIG_DEFAULTCONF_DEVICE_SHIFT
#define HDA_CONFIG_DEFAULTCONF_CONNECTION_TYPE_MASK
#define HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_NONE
#define HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_MASK
#define HDA_PARAM_GPIO_COUNT_NUM_GPI(param)
#define HDA_PARAM_OUTPUT_AMP_CAP_OFFSET(param)
#define HDA_CMD_GET_GPIO_ENABLE_MASK(cad, nid)
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_8BIT(param)
#define HDA_CONFIG_DEFAULTCONF_DEVICE_SPDIF_OUT
#define HDA_CMD_SET_PIN_WIDGET_CTRL_HPHN_ENABLE
#define HDA_CONFIG_DEFAULTCONF_ASSOCIATION(conf)
#define HDA_CMD_GET_GPIO_STICKY_MASK(cad, nid)
#define HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_VENDOR_WIDGET
#define HDA_CONFIG_DEFAULTCONF_SEQUENCE_MASK
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_22KHZ(param)
#define HDA_CMD_GET_GPIO_WAKE_ENABLE_MASK(cad, nid)
#define HDA_CMD_SET_HDMI_DIP_DATA(cad, nid, payload)
#define HDA_PARAM_INPUT_AMP_CAP
#define HDA_HDMI_CODING_TYPE_DTS
#define HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_JACK
#define HDA_CONFIG_DEFAULTCONF_DEVICE_MASK
#define HDA_CMD_SET_HDMI_DIP_XMIT(cad, nid, payload)
#define HDA_PARAM_AUDIO_WIDGET_CAP_AMP_OVR(param)
#define HDA_CONFIG_DEFAULTCONF_ASSOCIATION_SHIFT
#define HDA_CMD_SET_DIGITAL_CONV_FMT1_DIGEN
#define HDA_PARAM_SUPP_STREAM_FORMATS_PCM(param)
#define HDA_CONFIG_DEFAULTCONF_DEVICE_CD
#define HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_MIXER
#define HDA_CONFIG_DEFAULTCONF_MISC_SHIFT
#define HDA_PARAM_PIN_CAP_BALANCED_IO_PINS(param)
#define HDA_CMD_SET_GPIO_DIRECTION(cad, nid, payload)
#define HDA_CMD_GET_PIN_WIDGET_CTRL(cad, nid)
#define HDA_PARAM_GPIO_COUNT
#define HDA_CMD_POWER_STATE_D3
#define HDA_CONFIG_DEFAULTCONF_SEQUENCE(conf)
#define HDA_PARAM_AUDIO_WIDGET_CAP_DIGITAL(param)
#define HDA_CONFIG_DEFAULTCONF_ASSOCIATION_MASK
#define HDA_CMD_SET_CONV_FMT(cad, nid, payload)
#define HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_POWER_WIDGET
#define HDA_CMD_GET_GPIO_DATA(cad, nid)
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_20BIT(param)
#define HDA_HDMI_CODING_TYPE_REF_CTX
#define HDA_CMD_SET_HDMI_CHAN_SLOT(cad, nid, payload)
#define HDA_CONFIG_DEFAULTCONF_LOCATION_MASK
#define HDA_PARAM_SUPP_STREAM_FORMATS_AC3(param)
#define HDA_CONFIG_DEFAULTCONF_DEVICE_HP_OUT
#define HDA_CMD_SET_PIN_WIDGET_CTRL_IN_ENABLE
#define HDA_PARAM_PIN_CAP_OUTPUT_CAP(param)
#define HDA_CMD_SET_UNSOLICITED_RESPONSE(cad, nid, payload)
#define HDA_CMD_SET_STRIPE_CONTROL(cad, nid, payload)
#define HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_BEEP_WIDGET
#define HDA_PARAM_AUDIO_WIDGET_CAP_UNSOL_CAP(param)
#define HDA_PARAM_PIN_CAP_HEADPHONE_CAP(param)
#define HDA_PARAM_AUDIO_WIDGET_CAP_STRIPE(param)
#define HDA_PARAM_AUDIO_WIDGET_CAP_LR_SWAP(param)
#define HDA_PARAM_SUPP_STREAM_FORMATS
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_44KHZ(param)
#define HDA_PARAM_PIN_CAP_DP(param)
#define HDA_PARAM_GPIO_COUNT_GPI_WAKE(param)
#define HDA_CMD_POWER_STATE_D0
#define HDA_CONFIG_DEFAULTCONF_DEVICE_MIC_IN
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_32KHZ(param)
#define HDA_PARAM_AUDIO_WIDGET_CAP_PROC_WIDGET(param)
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_11KHZ(param)
#define HDA_CONFIG_DEFAULTCONF_DEVICE_LINE_IN
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_16BIT(param)
#define HDA_PARAM_CONN_LIST_LENGTH_LIST_LENGTH(param)
#define HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_INPUT
#define HDA_CMD_SET_UNSOLICITED_RESPONSE_ENABLE
#define HDA_CONFIG_DEFAULTCONF_LOCATION(conf)
#define HDA_PARAM_PIN_CAP_PRESENCE_DETECT_CAP(param)
#define HDA_CMD_SET_DIGITAL_CONV_FMT1_NAUDIO
#define HDA_CMD_SET_EAPD_BTL_ENABLE_EAPD
#define HDA_PARAM_PIN_CAP_VREF_CTRL_50(param)
#define HDA_CONFIG_DEFAULTCONF_CONNECTIVITY_SHIFT
#define HDA_PARAM_PIN_CAP_EAPD_CAP(param)
#define HDA_CMD_GET_GPIO_DIRECTION(cad, nid)
#define HDA_PARAM_SUPP_PCM_SIZE_RATE
#define HDA_PARAM_AUDIO_WIDGET_CAP_FORMAT_OVR(param)
#define HDA_PARAM_PIN_CAP_VREF_CTRL_100(param)
#define HDA_PARAM_OUTPUT_AMP_CAP_STEPSIZE(param)
#define HDA_CMD_SET_CONNECTION_SELECT_CONTROL(cad, nid, payload)
#define HDA_HDMI_CODING_TYPE_MP3
#define HDA_CONFIG_DEFAULTCONF_DEVICE_LINE_OUT
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_24BIT(param)
#define HDA_CONFIG_DEFAULTCONF_COLOR_SHIFT
#define HDA_CONFIG_DEFAULTCONF_DEVICE(conf)
#define HDA_PARAM_GPIO_COUNT_NUM_GPIO(param)
#define HDA_PARAM_AUDIO_WIDGET_CAP
#define HDA_PARAM_PIN_CAP_VREF_CTRL_GROUND(param)
#define HDA_CMD_GET_PIN_SENSE_PRESENCE_DETECT
#define HDA_PARAM_GPIO_COUNT_GPI_UNSOL(param)
#define HDA_PARAM_PIN_CAP
#define HDA_CONFIG_DEFAULTCONF_DEVICE_AUX
#define HDA_CMD_GET_EAPD_BTL_ENABLE(cad, nid)
#define HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_OUTPUT
#define HDA_CMD_SET_PIN_WIDGET_CTRL_VREF_ENABLE(param)
#define HDA_CMD_GET_PARAMETER(cad, nid, payload)
#define HDA_CONFIG_DEFAULTCONF_LOCATION_SHIFT
#define HDA_CONFIG_DEFAULTCONF_CONNECTION_TYPE_SHIFT
#define HDA_CONFIG_DEFAULTCONF_DEVICE_SPEAKER
#define HDA_HDMI_CODING_TYPE_AC3
#define HDA_PARAM_AUDIO_WIDGET_CAP_IN_AMP(param)
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_16KHZ(param)
#define HDA_PARAM_SUB_NODE_COUNT_TOTAL(param)
#define HDA_PARAM_OUTPUT_AMP_CAP_NUMSTEPS(param)
#define HDA_PARAM_AUDIO_WIDGET_CAP_TYPE(param)
#define HDA_CONFIG_DEFAULTCONF_DEVICE_DIGITAL_OTHER_OUT
#define HDA_PARAM_CONN_LIST_LENGTH_LONG_FORM(param)
#define HDA_CMD_SET_PIN_WIDGET_CTRL(cad, nid, payload)
#define HDA_CMD_SET_PIN_SENSE(cad, nid, payload)
#define HDA_CMD_GET_GPI_UNSOLICITED_ENABLE_MASK(cad, nid)
#define HDA_CMD_SET_CONV_CHAN_COUNT(cad, nid, payload)
#define HDA_CMD_GET_HDMI_ELDD(cad, nid, off)
#define HDA_CONFIG_DEFAULTCONF_DEVICE_SPDIF_IN
#define HDA_CMD_GET_GPI_WAKE_ENABLE_MASK(cad, nid)
#define HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_AUDIO_SELECTOR
#define HDA_PARAM_GPIO_COUNT_NUM_GPO(param)
#define HDA_CMD_PIN_WIDGET_CTRL_VREF_ENABLE_100
#define HDA_PARAM_PIN_CAP_TRIGGER_REQD(param)
#define HDA_PARAM_PIN_CAP_VREF_CTRL_80(param)
#define HDA_PARAM_SUPP_PCM_SIZE_RATE_176KHZ(param)
#define HDA_PARAM_PIN_CAP_INPUT_CAP(param)
#define HDA_CMD_SET_EAPD_BTL_ENABLE_BTL
static void hdaa_gpio_commit(struct hdaa_devinfo *devinfo)
static const char * HDA_GPIO_ACTIONS[8]
static const char * channel_names[]
static const char * HDA_DEVS[16]
static void hdaa_jack_poll_callback(void *arg)
static void hdaa_audio_disable_unas(struct hdaa_devinfo *devinfo)
static int hdaa_channel_start(struct hdaa_chan *ch)
static uint32_t hdaa_fmt[]
static int hdaa_sysctl_gpio_config(SYSCTL_HANDLER_ARGS)
static int hdaa_chan_type(struct hdaa_devinfo *devinfo, int asid)
static int hdaa_audio_trace_to_out(struct hdaa_devinfo *devinfo, nid_t nid, int depth)
static void hdaa_audio_ctl_dev_volume(struct hdaa_pcm_devinfo *pdevinfo, unsigned dev)
static void hdaa_autorecsrc_handler(struct hdaa_audio_as *as, struct hdaa_widget *w)
static int hdaa_sysctl_quirks(SYSCTL_HANDLER_ARGS)
static void hdaa_audio_disable_useless(struct hdaa_devinfo *devinfo)
static const char * HDA_LOCS[64]
static struct hdaa_audio_ctl * hdaa_audio_ctl_amp_get(struct hdaa_devinfo *, nid_t, int, int, int)
static void hdaa_dump_pin_configs(struct hdaa_devinfo *devinfo)
static const char * HDA_CONNECTORS[16]
static device_method_t hdaa_methods[]
static void hdaa_dump_pin(struct hdaa_widget *w)
static int hdaa_audio_trace_as_in_mch(struct hdaa_devinfo *devinfo, int as, int seq)
static int hdaa_audio_ctl_ossmixer_set(struct snd_mixer *m, unsigned dev, unsigned left, unsigned right)
static void hdaa_dump_nodes(struct hdaa_devinfo *devinfo)
static void hdaa_gpo_commit(struct hdaa_devinfo *devinfo)
static void hdaa_audio_ctl_source_volume(struct hdaa_pcm_devinfo *pdevinfo, int ossdev, nid_t nid, int index, int mute, int left, int right, int depth)
static void hdaa_config_fetch(const char *str, uint32_t *on, uint32_t *off)
static const char * HDA_CONNS[4]
static char * hdaa_audio_ctl_ossmixer_mask2allname(uint32_t mask, char *buf, size_t len)
static uint32_t hdaa_audio_ctl_ossmixer_setrecsrc(struct snd_mixer *m, uint32_t src)
static void hdaa_stream_intr(device_t dev, int dir, int stream)
static unsigned lcm(unsigned a, unsigned b)
static void hdaa_dump_amp_sb(struct sbuf *sb, uint32_t cap, const char *banner)
static int hdaa_audio_adcs_equal(struct hdaa_widget *w1, struct hdaa_widget *w2)
static void * hdaa_channel_init(kobj_t obj, void *data, struct snd_dbuf *b, struct pcm_channel *c, int dir)
static int hdaa_pcmchannel_setup(struct hdaa_chan *)
static void hdaa_adjust_amp(struct hdaa_widget *w, int ossdev, int found, int minamp, int maxamp)
static void hdaa_dump_pin_config(struct hdaa_widget *w, uint32_t conf)
static int hdaa_audio_ctl_dest_amp(struct hdaa_devinfo *devinfo, nid_t nid, int index, int ossdev, int depth, int *minamp, int *maxamp)
static int hdaa_sysctl_32bit(SYSCTL_HANDLER_ARGS)
static int hdaa_pcm_attach(device_t dev)
static int hdaa_sysctl_gpi_state(SYSCTL_HANDLER_ARGS)
static int hdaa_sysctl_gpo_state(SYSCTL_HANDLER_ARGS)
static void hdaa_dump_dst_nid(struct hdaa_pcm_devinfo *pdevinfo, nid_t nid, int depth)
static int hdaa_audio_ctl_source_amp(struct hdaa_devinfo *devinfo, nid_t nid, int index, int ossdev, int ctlable, int depth, int *minamp, int *maxamp)
static const char * ossnames[]
static void hdaa_audio_ctl_dest_volume(struct hdaa_pcm_devinfo *pdevinfo, int ossdev, nid_t nid, int index, int mute, int left, int right, int depth)
static void hdaa_channels_handler(struct hdaa_audio_as *as)
static void hdaa_audio_commit(struct hdaa_devinfo *devinfo)
static void hdaa_dump_pin_sb(struct sbuf *sb, struct hdaa_widget *w)
static int hdaa_audio_dacs_equal(struct hdaa_widget *w1, struct hdaa_widget *w2)
static device_method_t hdaa_pcm_methods[]
static void hdaa_dump_adc(struct hdaa_pcm_devinfo *pdevinfo)
static driver_t hdaa_driver
MIXER_DECLARE(hdaa_audio_ctl_ossmixer)
static void hdaa_audio_setup(struct hdaa_chan *ch)
static int hdaa_detach(device_t dev)
static devclass_t hdaa_devclass
SND_DECLARE_FILE("$FreeBSD$")
static int hdaa_audio_ctl_ossmixer_init(struct snd_mixer *m)
static void hdaa_local_patch_pin(struct hdaa_widget *w)
static struct hdaa_audio_ctl * hdaa_audio_ctl_each(struct hdaa_devinfo *devinfo, int *index)
static uint32_t hdaa_audio_ctl_recsel_comm(struct hdaa_pcm_devinfo *pdevinfo, uint32_t src, nid_t nid, int depth)
#define CONN_RANGE(r, e, n)
static void hdaa_audio_undo_trace(struct hdaa_devinfo *devinfo, int as, int seq)
static void hdaa_audio_postprocess(struct hdaa_devinfo *devinfo)
static uint32_t hdaa_channel_getptr(kobj_t obj, void *data)
#define hdaa_unlock(devinfo)
uint32_t hdaa_gpio_patch(uint32_t gpio, const char *str)
static void hdaa_presence_handler(struct hdaa_widget *w)
static void hdaa_audio_assign_mixers(struct hdaa_devinfo *devinfo)
static void hdaa_audio_assign_names(struct hdaa_devinfo *devinfo)
uint32_t hdaa_widget_pin_patch(uint32_t config, const char *str)
static uint32_t hdaa_channel_setspeed(kobj_t obj, void *data, uint32_t speed)
static struct pcmchan_caps hdaa_caps
MODULE_DEPEND(snd_hda, sound, SOUND_MINVER, SOUND_PREFVER, SOUND_MAXVER)
#define HDA_PARSE_MAXDEPTH
static void hdaa_audio_prepare_pin_ctrl(struct hdaa_devinfo *devinfo)
static int hdaa_sysctl_caps(SYSCTL_HANDLER_ARGS)
static int hdaa_resume(device_t dev)
static int hdaa_child_location(device_t dev, device_t child, struct sbuf *sb)
static void hdaa_eld_dump(struct hdaa_widget *w)
static void hdaa_audio_build_tree(struct hdaa_devinfo *devinfo)
static void hdaa_dump_amp(device_t dev, uint32_t cap, const char *banner)
static void hdaa_unconfigure(device_t dev)
#define CONN_CNID(r, e, n)
static struct pcmchan_caps * hdaa_channel_getcaps(kobj_t obj, void *data)
static void hdaa_channel_stop(struct hdaa_chan *ch)
static uint16_t hdaa_stream_format(struct hdaa_chan *ch)
static void hdaa_audio_bind_as(struct hdaa_devinfo *devinfo)
static int hdaa_print_child(device_t dev, device_t child)
static int hdaa_pcm_detach(device_t dev)
static void hdaa_dump_audio_formats(device_t dev, uint32_t fcap, uint32_t pcmcap)
static driver_t hdaa_pcm_driver
MALLOC_DEFINE(M_HDAA, "hdaa", "HDA Audio")
static void hdaa_dump_audio_formats_sb(struct sbuf *sb, uint32_t fcap, uint32_t pcmcap)
static void hdaa_dump_gpi(struct hdaa_devinfo *devinfo)
static int hdaa_sysctl_gpio_state(SYSCTL_HANDLER_ARGS)
static void hdaa_audio_ctl_dev_set(struct hdaa_audio_ctl *ctl, int ossdev, int mute, int *left, int *right)
static void hdaa_sense_deinit(struct hdaa_devinfo *devinfo)
static void hdaa_hpredir_handler(struct hdaa_widget *w)
static void hdaa_audio_ctl_amp_set_internal(struct hdaa_devinfo *, nid_t, int, int, int, int, int, int)
static void hdaa_audio_ctl_commit(struct hdaa_devinfo *devinfo)
DRIVER_MODULE(snd_hda, hdacc, hdaa_driver, hdaa_devclass, NULL, NULL)
static void hdaa_audio_ctl_set_defaults(struct hdaa_pcm_devinfo *pdevinfo)
static void hdaa_pindump(device_t dev)
static void hdaa_configure(device_t dev)
static void hdaa_audio_parse(struct hdaa_devinfo *devinfo)
static void hdaa_sense_init(struct hdaa_devinfo *devinfo)
static void hdaa_audio_disable_notselected(struct hdaa_devinfo *devinfo)
static void hdaa_prepare_pcms(struct hdaa_devinfo *devinfo)
static const struct @10 hda_rate_tab[]
static int hdaa_pcm_probe(device_t dev)
static int hdaa_audio_trace_as_out(struct hdaa_devinfo *devinfo, int as, int seq)
static void hdaa_dump_gpo(struct hdaa_devinfo *devinfo)
static int hdaa_sysctl_gpo_config(SYSCTL_HANDLER_ARGS)
static void hdaa_audio_disable_crossas(struct hdaa_devinfo *devinfo)
static void hdaa_audio_ctl_parse(struct hdaa_devinfo *devinfo)
static nid_t hdaa_audio_trace_dac(struct hdaa_devinfo *devinfo, int as, int seq, nid_t nid, int dupseq, int min, int only, int depth)
static nid_t hdaa_audio_trace_adc(struct hdaa_devinfo *devinfo, int as, int seq, nid_t nid, int mixed, int min, int only, int depth, int *length, int onlylength)
static void hdaa_audio_trace_as_extra(struct hdaa_devinfo *devinfo)
static int hdaa_sysctl_config(SYSCTL_HANDLER_ARGS)
static kobj_method_t hdaa_audio_ctl_ossmixer_methods[]
static void hdaa_audio_ctl_amp_set(struct hdaa_audio_ctl *, uint32_t, int, int)
static void hdaa_widget_connection_parse(struct hdaa_widget *w)
static void hdaa_powerup(struct hdaa_devinfo *devinfo)
static void hdaa_widget_connection_select(struct hdaa_widget *, uint8_t)
static void hdaa_dump_mix(struct hdaa_pcm_devinfo *pdevinfo)
static void hdaa_eld_handler(struct hdaa_widget *w)
#define hdaa_lock(devinfo)
static const struct @9 hdaa_quirks_tab[]
static void hdaa_create_pcms(struct hdaa_devinfo *devinfo)
static int hdaa_channel_trigger(kobj_t obj, void *data, int go)
static int hdaa_sysctl_reconfig(SYSCTL_HANDLER_ARGS)
static void hdaa_unsol_intr(device_t dev, uint32_t resp)
static uint32_t hdaa_channel_setblocksize(kobj_t obj, void *data, uint32_t blksz)
CHANNEL_DECLARE(hdaa_channel)
static int hdaa_allowed_stripes(uint16_t fmt)
static int hdaa_audio_trace_as_in(struct hdaa_devinfo *devinfo, int as)
static kobj_method_t hdaa_channel_methods[]
static int hdaa_channel_setformat(kobj_t obj, void *data, uint32_t format)
static int hdaa_probe(device_t dev)
static void hdaa_audio_disable_nonaudio(struct hdaa_devinfo *devinfo)
static void hdaa_audio_as_parse(struct hdaa_devinfo *devinfo)
static unsigned gcd(unsigned a, unsigned b)
static void hdaa_chan_formula(struct hdaa_devinfo *devinfo, int asid, char *buf, int buflen)
static void hdaa_widget_parse(struct hdaa_widget *w)
MODULE_VERSION(snd_hda, 1)
static void hdaa_widget_postprocess(struct hdaa_widget *w)
static void hdaa_audio_adddac(struct hdaa_devinfo *devinfo, int asid)
static void hdaa_local_patch(struct hdaa_devinfo *devinfo)
static const char * HDA_COLORS[16]
static const struct matrix matrixes[]
static const char * HDA_HDMI_CODING_TYPES[18]
static int hdaa_attach(device_t dev)
static int hdaa_suspend(device_t dev)
static void hdaa_dump_ctls(struct hdaa_pcm_devinfo *pdevinfo, const char *banner, uint32_t flag)
struct hdaa_widget * hdaa_widget_get(struct hdaa_devinfo *devinfo, nid_t nid)
static int hdaa_channel_setfragments(kobj_t obj, void *data, uint32_t blksz, uint32_t blkcnt)
static void hdaa_dump_gpio(struct hdaa_devinfo *devinfo)
static void hdaa_dump_dac(struct hdaa_pcm_devinfo *pdevinfo)
#define HDAA_GPIO_DISABLE(n)
#define HDAA_GPIO_INPUT(n)
#define HDAA_QUIRK_IVREF80
#define HDAA_AMP_MUTE_NONE
#define HDAA_QUIRK_FORCESTEREO
#define HDAA_QUIRK_EAPDINV
void hdaa_patch_direct(struct hdaa_devinfo *devinfo)
#define HDAA_GPIO_MASK(n)
#define HDAA_QUIRK_SOFTPCMVOL
#define VAL2QDB(ctl, val)
void hdaa_patch(struct hdaa_devinfo *devinfo)
#define HDAA_QUIRK_IVREF100
#define HDAA_AMP_MUTE_ALL
#define HDAA_QUIRK_OVREF100
#define HDAA_AMP_LEFT_MUTED(v)
#define HDAA_GPIO_CLEAR(n)
#define HDAA_GPIO_SHIFT(n)
#define HDAA_AMP_MUTE_LEFT
#define HDAA_AMP_MUTE_RIGHT
#define HDAA_QUIRK_OVREF50
#define HDAA_QUIRK_OVREF80
#define HDAA_AMP_VOL_DEFAULT
#define HDAA_QUIRK_FIXEDRATE
#define HDAA_AMP_MUTE_DEFAULT
#define QDB2VAL(ctl, qdb)
#define HDAA_QUIRK_IVREF50
#define HDAA_AMP_RIGHT_MUTED(v)
#define HDAA_QUIRK_SENSEINV
#define HDA_BUFSZ_DEFAULT
#define HDA_BOOTHVERBOSE(stmt)
#define HDA_DMA_ALIGNMENT
#define hda_command(dev, verb)
#define HDA_BOOTVERBOSE(stmt)
#define SND_CHN_T_MASK_BC
#define SND_CHN_T_MASK_FL
#define SND_CHN_T_MASK_BL
#define SND_CHN_T_MASK_LF
#define SND_CHN_T_MASK_BR
#define SND_CHN_T_MASK_FR
#define SND_CHN_T_MASK_FLC
#define SND_CHN_T_MASK_SL
#define SND_CHN_T_MASK_FC
#define SND_CHN_T_MASK_SR
#define SND_CHN_T_MASK_FRC
#define SND_CHN_MATRIX_MAP_4_1
#define SND_CHN_MATRIX_MAP_4_0
#define SND_CHN_MATRIX_MAP_7_1
#define SND_CHN_MATRIX_MAP_2_0
#define SND_CHN_MATRIX_MAP_3_0
#define SND_CHN_MATRIX_MAP_2_1
#define SND_CHN_MATRIX_MAP_1_0
#define SND_CHN_MATRIX_MAP_6_0
#define SND_CHN_MATRIX_MAP_6_1
#define SND_CHN_MATRIX_MAP_7_0
#define SND_CHN_MATRIX_MAP_3_1
#define SND_CHN_MATRIX_MAP_5_1
#define SND_CHN_MATRIX_MAP_5_0
static int mixer_setrecsrc(struct snd_mixer *mixer, u_int32_t src)
void mix_setparentchild(struct snd_mixer *m, u_int32_t parent, u_int32_t childs)
void mix_setrealdev(struct snd_mixer *m, u_int32_t dev, u_int32_t realdev)
int mixer_init(device_t dev, kobj_class_t cls, void *devinfo)
static int mixer_set(struct snd_mixer *m, u_int dev, u_int32_t muted, u_int lev)
void mix_setdevs(struct snd_mixer *m, u_int32_t v)
int mix_setrecsrc(struct snd_mixer *m, u_int32_t src)
int mixer_reinit(device_t dev)
u_int32_t mix_getrecdevs(struct snd_mixer *m)
int mix_set(struct snd_mixer *m, u_int dev, u_int left, u_int right)
void * mix_getdevinfo(struct snd_mixer *m)
void mix_setrecdevs(struct snd_mixer *m, u_int32_t v)
Record mask of available recording devices.
void pcm_setflags(device_t dev, uint32_t val)
uint32_t pcm_getflags(device_t dev)
int pcm_setstatus(device_t dev, char *str)
int pcm_addchan(device_t dev, int dir, kobj_class_t cls, void *devinfo)
int pcm_unregister(device_t dev)
int pcm_register(device_t dev, void *devinfo, int numplay, int numrec)
unsigned int pcm_getbuffersize(device_t dev, unsigned int minbufsz, unsigned int deflt, unsigned int maxbufsz)
#define SND_FORMAT(f, c, e)
#define AFMT_EXTCHANNEL(v)
struct hdaa_pcm_devinfo * pdevinfo
int devleft[SOUND_MIXER_NRDEVICES]
struct hdaa_widget * childwidget
struct hdaa_widget * widget
int devmute[SOUND_MIXER_NRDEVICES]
int devright[SOUND_MIXER_NRDEVICES]
struct hdaa_devinfo * devinfo
uint32_t supp_stream_formats
uint32_t supp_pcm_size_rate
struct hdaa_pcm_devinfo * pdevinfo
uint32_t supp_stream_formats
uint32_t supp_pcm_size_rate
struct hdaa_audio_as * as
int minamp[SOUND_MIXER_NRDEVICES]
int maxamp[SOUND_MIXER_NRDEVICES]
struct hdaa_devinfo * devinfo
u_char left[SOUND_MIXER_NRDEVICES]
u_char right[SOUND_MIXER_NRDEVICES]
char status[SND_STATUSLEN]
struct sysctl_oid * play_sysctl_tree
struct sysctl_ctx_list play_sysctl_ctx rec_sysctl_ctx
struct sysctl_oid * rec_sysctl_tree