We now pin sense the headphone pin widget to check if something is plugged in. Use this to disable/enable speakers.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35528 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval
2010-02-20 00:28:46 +00:00
parent 87c1c0e443
commit cd439bd9e3
2 changed files with 25 additions and 2 deletions
@@ -1105,11 +1105,31 @@ hda_codec_switch_handler(hda_codec* codec)
for (uint32 i = 0; i < audioGroup->widget_count; i++) {
hda_widget& widget = audioGroup->widgets[i];
if (widget.type != WT_PIN_COMPLEX || !PIN_CAP_IS_OUTPUT(widget.d.pin.capabilities))
if (widget.type != WT_PIN_COMPLEX
|| !PIN_CAP_IS_OUTPUT(widget.d.pin.capabilities)
|| CONF_DEFAULT_DEVICE(widget.d.pin.config)
!= PIN_DEV_HEAD_PHONE_OUT)
continue;
corb_t verb = MAKE_VERB(audioGroup->codec->addr, widget.node_id,
VID_GET_PINSENSE, 0);
uint32 response;
hda_send_verbs(audioGroup->codec, &verb, &response, 1);
disable = response & PIN_SENSE_PRESENCE_DETECT;
TRACE("hda: sensed pin widget %ld, %d\n", widget.node_id, disable);
break;
}
for (uint32 i = 0; i < audioGroup->widget_count; i++) {
hda_widget& widget = audioGroup->widgets[i];
if (widget.type != WT_PIN_COMPLEX
|| !PIN_CAP_IS_OUTPUT(widget.d.pin.capabilities))
continue;
int device = CONF_DEFAULT_DEVICE(widget.d.pin.config);
if (device != PIN_DEV_SPEAKER
if (device != PIN_DEV_AUX
&& device != PIN_DEV_SPEAKER
&& device != PIN_DEV_LINE_OUT)
continue;
@@ -281,6 +281,9 @@ enum pin_dev_type {
/* Unsolicited Response */
#define UNSOLRESP_ENABLE (1L << 7)
/* Pin sense */
#define PIN_SENSE_PRESENCE_DETECT (1L << 31)
/* Supported power states */
#define POWER_STATE_D0 (1L << 0)
#define POWER_STATE_D1 (1L << 1)