Lines Matching refs:codec
364 hda_codec_get_quirks(hda_codec* codec) in hda_codec_get_quirks() argument
366 codec->quirks = 0; in hda_codec_get_quirks()
368 uint32 subSystemID = codec->subsystem_id & 0xffff; in hda_codec_get_quirks()
369 uint32 subSystemVendorID = codec->subsystem_id >> 16; in hda_codec_get_quirks()
380 && kCodecQuirks[i].codec_vendor_id != codec->vendor_id) in hda_codec_get_quirks()
383 && kCodecQuirks[i].codec_id != codec->product_id) in hda_codec_get_quirks()
386 codec->quirks |= kCodecQuirks[i].quirks; in hda_codec_get_quirks()
387 codec->quirks &= ~kCodecQuirks[i].nonquirks; in hda_codec_get_quirks()
393 hda_get_pm_support(hda_codec* codec, uint32 nodeID, uint32* pm) in hda_get_pm_support() argument
395 corb_t verb = MAKE_VERB(codec->addr, nodeID, VID_GET_PARAMETER, in hda_get_pm_support()
399 status_t status = hda_send_verbs(codec, &verb, &response, 1); in hda_get_pm_support()
408 hda_get_stream_support(hda_codec* codec, uint32 nodeID, uint32* formats, in hda_get_stream_support() argument
415 verbs[0] = MAKE_VERB(codec->addr, nodeID, VID_GET_PARAMETER, in hda_get_stream_support()
417 verbs[1] = MAKE_VERB(codec->addr, nodeID, VID_GET_PARAMETER, in hda_get_stream_support()
420 status = hda_send_verbs(codec, verbs, resp, 2); in hda_get_stream_support()
480 return hda_get_pm_support(audioGroup->codec, widget->node_id, &widget->pm); in hda_widget_get_pm_support()
495 return hda_get_stream_support(audioGroup->codec, widget->node_id, in hda_widget_get_stream_support()
511 verb = MAKE_VERB(audioGroup->codec->addr, widget->node_id, in hda_widget_get_amplifier_capabilities()
513 status_t status = hda_send_verbs(audioGroup->codec, &verb, in hda_widget_get_amplifier_capabilities()
530 verb = MAKE_VERB(audioGroup->codec->addr, widget->node_id, in hda_widget_get_amplifier_capabilities()
532 status_t status = hda_send_verbs(audioGroup->codec, &verb, in hda_widget_get_amplifier_capabilities()
563 corb_t verb = MAKE_VERB(audioGroup->codec->addr, widget->node_id, in hda_widget_get_connections()
567 if (hda_send_verbs(audioGroup->codec, &verb, &response, 1) != B_OK) in hda_widget_get_connections()
579 verb = MAKE_VERB(audioGroup->codec->addr, widget->node_id, in hda_widget_get_connections()
581 if (hda_send_verbs(audioGroup->codec, &verb, &response, 1) == B_OK) in hda_widget_get_connections()
596 verb = MAKE_VERB(audioGroup->codec->addr, widget->node_id, in hda_widget_get_connections()
598 if (hda_send_verbs(audioGroup->codec, &verb, &response, 1) in hda_widget_get_connections()
690 && (audioGroup->codec->quirks & (isOutput ? HDA_QUIRK_OVREF50 in hda_widget_prepare_pin_ctrl()
696 && (audioGroup->codec->quirks & (isOutput ? HDA_QUIRK_OVREF80 in hda_widget_prepare_pin_ctrl()
702 && (audioGroup->codec->quirks & (isOutput ? HDA_QUIRK_OVREF100 in hda_widget_prepare_pin_ctrl()
721 hda_codec* codec = audioGroup->codec; in hda_codec_parse_audio_group() local
722 uint32 codec_id = (codec->vendor_id << 16) | codec->product_id; in hda_codec_parse_audio_group()
725 verbs[0] = MAKE_VERB(audioGroup->codec->addr, audioGroup->widget.node_id, in hda_codec_parse_audio_group()
727 hda_send_verbs(audioGroup->codec, verbs, NULL, 1); in hda_codec_parse_audio_group()
733 verbs[0] = MAKE_VERB(audioGroup->codec->addr, audioGroup->widget.node_id, in hda_codec_parse_audio_group()
735 verbs[1] = MAKE_VERB(audioGroup->codec->addr, audioGroup->widget.node_id, in hda_codec_parse_audio_group()
737 verbs[2] = MAKE_VERB(audioGroup->codec->addr, audioGroup->widget.node_id, in hda_codec_parse_audio_group()
740 if (hda_send_verbs(audioGroup->codec, verbs, resp, 3) != B_OK) in hda_codec_parse_audio_group()
776 verbs[0] = MAKE_VERB(audioGroup->codec->addr, nodeID, VID_GET_PARAMETER, in hda_codec_parse_audio_group()
778 if (hda_send_verbs(audioGroup->codec, verbs, &capabilities, 1) != B_OK) in hda_codec_parse_audio_group()
820 verbs[0] = MAKE_VERB(audioGroup->codec->addr, nodeID, in hda_codec_parse_audio_group()
822 hda_send_verbs(audioGroup->codec, verbs, NULL, 1); in hda_codec_parse_audio_group()
841 verbs[0] = MAKE_VERB(audioGroup->codec->addr, nodeID, in hda_codec_parse_audio_group()
843 if (hda_send_verbs(audioGroup->codec, verbs, resp, 1) == B_OK) { in hda_codec_parse_audio_group()
852 verbs[0] = MAKE_VERB(audioGroup->codec->addr, nodeID, in hda_codec_parse_audio_group()
854 if (hda_send_verbs(audioGroup->codec, verbs, resp, 1) == B_OK) { in hda_codec_parse_audio_group()
870 verbs[0] = MAKE_VERB(audioGroup->codec->addr, nodeID, in hda_codec_parse_audio_group()
872 hda_send_verbs(audioGroup->codec, verbs, NULL, 1); in hda_codec_parse_audio_group()
893 hda_verb_write(codec, 0x20, VID_SET_COEFFICIENT_INDEX, 0x0); in hda_codec_parse_audio_group()
895 hda_verb_read(codec, 0x20, VID_GET_PROCESSING_COEFFICIENT, &tmp); in hda_codec_parse_audio_group()
896 hda_verb_write(codec, 0x20, VID_SET_COEFFICIENT_INDEX, 0x7); in hda_codec_parse_audio_group()
897 hda_verb_write(codec, 0x20, VID_SET_PROCESSING_COEFFICIENT, in hda_codec_parse_audio_group()
1151 corb_t verb = MAKE_VERB(audioGroup->codec->addr, in hda_audio_group_build_tree()
1153 if (hda_send_verbs(audioGroup->codec, &verb, NULL, 1) != B_OK) in hda_audio_group_build_tree()
1163 if (audioGroup->codec->quirks & (1 << i)) { in hda_audio_group_build_tree()
1170 MAKE_VERB(audioGroup->codec->addr, in hda_audio_group_build_tree()
1172 MAKE_VERB(audioGroup->codec->addr, in hda_audio_group_build_tree()
1174 MAKE_VERB(audioGroup->codec->addr, in hda_audio_group_build_tree()
1178 if (hda_send_verbs(audioGroup->codec, verb, NULL, 3) != B_OK) in hda_audio_group_build_tree()
1199 corb_t verb = MAKE_VERB(audioGroup->codec->addr, widget.node_id, in hda_audio_group_switch_init()
1201 hda_send_verbs(audioGroup->codec, &verb, NULL, 1); in hda_audio_group_switch_init()
1221 corb_t verb = MAKE_VERB(audioGroup->codec->addr, widget.node_id, in hda_audio_group_check_sense()
1224 hda_send_verbs(audioGroup->codec, &verb, &response, 1); in hda_audio_group_check_sense()
1230 verb = MAKE_VERB(audioGroup->codec->addr, widget.node_id, in hda_audio_group_check_sense()
1232 hda_send_verbs(audioGroup->codec, &verb, NULL, 1); in hda_audio_group_check_sense()
1251 corb_t verb = MAKE_VERB(audioGroup->codec->addr, widget.node_id, in hda_audio_group_check_sense()
1253 hda_send_verbs(audioGroup->codec, &verb, NULL, 1); in hda_audio_group_check_sense()
1259 hda_codec_switch_handler(hda_codec* codec) in hda_codec_switch_handler() argument
1261 while (acquire_sem(codec->unsol_response_sem) == B_OK) { in hda_codec_switch_handler()
1262 uint32 response = codec->unsol_responses[codec->unsol_response_read++]; in hda_codec_switch_handler()
1263 codec->unsol_response_read %= MAX_CODEC_UNSOL_RESPONSES; in hda_codec_switch_handler()
1266 hda_audio_group* audioGroup = codec->audio_groups[0]; in hda_codec_switch_handler()
1291 hda_codec_new_audio_group(hda_codec* codec, uint32 audioGroupNodeID) in hda_codec_new_audio_group() argument
1300 audioGroup->codec = codec; in hda_codec_new_audio_group()
1328 codec->audio_groups[codec->num_audio_groups++] = audioGroup; in hda_codec_new_audio_group()
1373 corb_t verb = MAKE_VERB(audioGroup->codec->addr, in hda_audio_group_get_widgets()
1376 hda_send_verbs(audioGroup->codec, &verb, NULL, 1); in hda_audio_group_get_widgets()
1380 verb = MAKE_VERB(audioGroup->codec->addr, in hda_audio_group_get_widgets()
1382 if (hda_send_verbs(audioGroup->codec, &verb, in hda_audio_group_get_widgets()
1385 verb = MAKE_VERB(audioGroup->codec->addr, in hda_audio_group_get_widgets()
1388 hda_send_verbs(audioGroup->codec, in hda_audio_group_get_widgets()
1400 corb_t verb = MAKE_VERB(audioGroup->codec->addr, in hda_audio_group_get_widgets()
1406 hda_send_verbs(audioGroup->codec, &verb, NULL, 1); in hda_audio_group_get_widgets()
1413 corb_t verb = MAKE_VERB(audioGroup->codec->addr, in hda_audio_group_get_widgets()
1421 hda_send_verbs(audioGroup->codec, &verb, NULL, 1); in hda_audio_group_get_widgets()
1452 hda_codec_delete(hda_codec* codec) in hda_codec_delete() argument
1454 if (codec == NULL) in hda_codec_delete()
1457 delete_sem(codec->response_sem); in hda_codec_delete()
1458 delete_sem(codec->unsol_response_sem); in hda_codec_delete()
1461 wait_for_thread(codec->unsol_response_thread, &result); in hda_codec_delete()
1463 for (uint32 i = 0; i < codec->num_audio_groups; i++) { in hda_codec_delete()
1464 hda_codec_delete_audio_group(codec->audio_groups[i]); in hda_codec_delete()
1465 codec->audio_groups[i] = NULL; in hda_codec_delete()
1468 free(codec); in hda_codec_delete()
1478 hda_codec* codec = (hda_codec*)calloc(1, sizeof(hda_codec)); in hda_codec_new() local
1479 if (codec == NULL) { in hda_codec_new()
1486 codec->controller = controller; in hda_codec_new()
1487 codec->addr = codecAddress; in hda_codec_new()
1488 codec->response_sem = create_sem(0, "hda_codec_response_sem"); in hda_codec_new()
1489 if (codec->response_sem < B_OK) { in hda_codec_new()
1493 controller->codecs[codecAddress] = codec; in hda_codec_new()
1495 codec->unsol_response_sem = create_sem(0, "hda_codec_unsol_response_sem"); in hda_codec_new()
1496 if (codec->unsol_response_sem < B_OK) { in hda_codec_new()
1500 codec->unsol_response_read = 0; in hda_codec_new()
1501 codec->unsol_response_write = 0; in hda_codec_new()
1525 status = hda_send_verbs(codec, verbs, (uint32*)&response, 4); in hda_codec_new()
1532 codec->vendor_id = response.vendor; in hda_codec_new()
1533 codec->subsystem_id = response.subsystem; in hda_codec_new()
1534 codec->product_id = response.device; in hda_codec_new()
1535 codec->stepping = response.stepping; in hda_codec_new()
1536 codec->revision = response.revision; in hda_codec_new()
1537 codec->minor = response.minor; in hda_codec_new()
1538 codec->major = response.major; in hda_codec_new()
1539 hda_codec_get_quirks(codec); in hda_codec_new()
1551 if (hda_send_verbs(codec, verbs, (uint32*)&functionResponse, 2) != B_OK) { in hda_codec_new()
1561 codec->subsystem_id = functionResponse.subsystem; in hda_codec_new()
1562 hda_codec_get_quirks(codec); in hda_codec_new()
1565 status_t status = hda_codec_new_audio_group(codec, nodeID); in hda_codec_new()
1579 (uint32)codec->subsystem_id, in hda_codec_new()
1581 codec->quirks); in hda_codec_new()
1583 codec->unsol_response_thread = spawn_kernel_thread( in hda_codec_new()
1585 "hda_codec_unsol_thread", B_LOW_PRIORITY, codec); in hda_codec_new()
1586 if (codec->unsol_response_thread < B_OK) { in hda_codec_new()
1590 resume_thread(codec->unsol_response_thread); in hda_codec_new()
1592 return codec; in hda_codec_new()
1596 hda_codec_delete(codec); in hda_codec_new()