From 3fa33c82a4e24a5395896a477931720ecbb8d45d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Mon, 17 Nov 2008 22:45:04 +0000 Subject: [PATCH] * store vendor, revision, stepping, revision, minor, major in the codec struct * check specific node ids for nodes declared as inputs which are really beepers * when unmuting/setting amp on the input amplifier, iterate on each input instead of only the first one * also unmute/set amp on the output and input amplifiers for the input and output paths, respectively git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28683 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/drivers/audio/hda/driver.h | 4 +- .../kernel/drivers/audio/hda/hda_codec.cpp | 53 ++++++++++++++----- 2 files changed, 43 insertions(+), 14 deletions(-) diff --git a/src/add-ons/kernel/drivers/audio/hda/driver.h b/src/add-ons/kernel/drivers/audio/hda/driver.h index 4e5287a1fb..9df311c764 100644 --- a/src/add-ons/kernel/drivers/audio/hda/driver.h +++ b/src/add-ons/kernel/drivers/audio/hda/driver.h @@ -275,8 +275,10 @@ struct hda_audio_group { struct hda_codec { uint16 vendor_id; uint16 product_id; + uint8 major; + uint8 minor; uint8 revision; - uint16 stepping; + uint8 stepping; uint8 addr; sem_id response_sem; diff --git a/src/add-ons/kernel/drivers/audio/hda/hda_codec.cpp b/src/add-ons/kernel/drivers/audio/hda/hda_codec.cpp index ba67b70271..427ab401c8 100644 --- a/src/add-ons/kernel/drivers/audio/hda/hda_codec.cpp +++ b/src/add-ons/kernel/drivers/audio/hda/hda_codec.cpp @@ -528,6 +528,25 @@ hda_codec_parse_audio_group(hda_audio_group* audioGroup) widget.type = (hda_widget_type)((capabilities & AUDIO_CAP_TYPE_MASK) >> AUDIO_CAP_TYPE_SHIFT); + + /* Check specific node ids declared as inputs as beepers */ + switch ((audioGroup->codec->vendor_id << 16) | audioGroup->codec->product_id) { + case 0x10ec0260: + if (nodeID == 23) + widget.type = WT_BEEP_GENERATOR; + break; + case 0x10ec0262: + case 0x10ec0268: + case 0x10ec0880: + case 0x10ec0882: + case 0x10ec0883: + case 0x10ec0885: + case 0x10ec0888: + case 0x10ec0889: + if (nodeID == 29) + widget.type = WT_BEEP_GENERATOR; + break; + } widget.active_input = -1; widget.capabilities.audio = capabilities; widget.node_id = nodeID; @@ -930,8 +949,7 @@ dprintf("ENABLE pin widget %ld\n", widget.node_id); hda_send_verbs(audioGroup->codec, &verb, NULL, 1); } - if (widget.capabilities.output_amplifier != 0 - && widget.flags & WIDGET_FLAG_OUTPUT_PATH) { + if (widget.capabilities.output_amplifier != 0) { dprintf("UNMUTE/SET OUTPUT GAIN widget %ld (offset %ld)\n", widget.node_id, widget.capabilities.output_amplifier & AMP_CAP_OFFSET_MASK); uint32 verb = MAKE_VERB(audioGroup->codec->addr, @@ -943,18 +961,20 @@ dprintf("UNMUTE/SET OUTPUT GAIN widget %ld (offset %ld)\n", widget.node_id, & AMP_CAP_OFFSET_MASK)); hda_send_verbs(audioGroup->codec, &verb, NULL, 1); } - if (widget.capabilities.input_amplifier != 0 - && widget.flags & WIDGET_FLAG_INPUT_PATH) { + if (widget.capabilities.input_amplifier != 0) { dprintf("UNMUTE/SET INPUT GAIN widget %ld (offset %ld)\n", widget.node_id, - widget.capabilities.output_amplifier & AMP_CAP_OFFSET_MASK); - uint32 verb = MAKE_VERB(audioGroup->codec->addr, - widget.node_id, - VID_SET_AMPLIFIER_GAIN_MUTE, - AMP_SET_INPUT | AMP_SET_LEFT_CHANNEL - | AMP_SET_RIGHT_CHANNEL - | (widget.capabilities.input_amplifier - & AMP_CAP_OFFSET_MASK)); - hda_send_verbs(audioGroup->codec, &verb, NULL, 1); + widget.capabilities.input_amplifier & AMP_CAP_OFFSET_MASK); + for (uint32 i = 0; i < widget.num_inputs; i++) { + uint32 verb = MAKE_VERB(audioGroup->codec->addr, + widget.node_id, + VID_SET_AMPLIFIER_GAIN_MUTE, + AMP_SET_INPUT | AMP_SET_LEFT_CHANNEL + | AMP_SET_RIGHT_CHANNEL + | AMP_SET_INPUT_INDEX(i) + | (widget.capabilities.input_amplifier + & AMP_CAP_OFFSET_MASK)); + hda_send_verbs(audioGroup->codec, &verb, NULL, 1); + } } } @@ -1038,6 +1058,13 @@ hda_codec_new(hda_controller* controller, uint32 codecAddress) if (hda_send_verbs(codec, verbs, (uint32*)&response, 3) != B_OK) goto err; + codec->vendor_id = response.vendor; + codec->product_id = response.device; + codec->stepping = response.stepping; + codec->revision = response.revision; + codec->minor = response.minor; + codec->major = response.major; + dprintf("Codec %ld Vendor: %04lx Product: %04lx, Revision: " "%lu.%lu.%lu.%lu\n", codecAddress, response.vendor, response.device, response.major, response.minor, response.revision, response.stepping);