hdaudio: check pin sense on init, don't wait for a switch event
with headphones plugged on boot, sound was still enabled on speakers. see #9956
This commit is contained in:
committed by
Rene Gollent
parent
9202a719e1
commit
697c0d7c63
@@ -1174,14 +1174,9 @@ hda_codec_switch_init(hda_audio_group* audioGroup)
|
||||
}
|
||||
|
||||
|
||||
static status_t
|
||||
hda_codec_switch_handler(hda_codec* codec)
|
||||
static void
|
||||
hda_codec_check_sense(hda_codec* codec, bool disable)
|
||||
{
|
||||
while (acquire_sem(codec->unsol_response_sem) == B_OK) {
|
||||
uint32 response = codec->unsol_responses[codec->unsol_response_read++];
|
||||
codec->unsol_response_read %= MAX_CODEC_UNSOL_RESPONSES;
|
||||
|
||||
bool disable = response & 1;
|
||||
hda_audio_group* audioGroup = codec->audio_groups[0];
|
||||
|
||||
for (uint32 i = 0; i < audioGroup->widget_count; i++) {
|
||||
@@ -1229,6 +1224,17 @@ hda_codec_switch_handler(hda_codec* codec)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static status_t
|
||||
hda_codec_switch_handler(hda_codec* codec)
|
||||
{
|
||||
while (acquire_sem(codec->unsol_response_sem) == B_OK) {
|
||||
uint32 response = codec->unsol_responses[codec->unsol_response_read++];
|
||||
codec->unsol_response_read %= MAX_CODEC_UNSOL_RESPONSES;
|
||||
|
||||
bool disable = response & 1;
|
||||
hda_codec_check_sense(codec, disable);
|
||||
}
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
@@ -1521,6 +1527,8 @@ hda_codec_new(hda_controller* controller, uint32 codecAddress)
|
||||
}
|
||||
}
|
||||
|
||||
hda_codec_check_sense(codec, false);
|
||||
|
||||
codec->unsol_response_thread = spawn_kernel_thread(
|
||||
(status_t(*)(void*))hda_codec_switch_handler,
|
||||
"hda_codec_unsol_thread", B_LOW_PRIORITY, codec);
|
||||
|
||||
Reference in New Issue
Block a user