automute on pin (when it is possible)

git-svn-id: svn://kolibrios.org@6943 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Asper 2017-08-20 12:08:25 +00:00
parent 2cbf514c37
commit 7eee1429ae

View File

@ -15,7 +15,7 @@ DEBUG_IRQ equ 0
USE_SINGLE_MODE equ 0 ; 1 = Single mode; 0 = Normal mode.
USE_UNSOL_EV equ 1 ; 1 = Use unsolicited events; 0 = Do not use unsolicited events.
TEST_VERSION_NUMBER equ '019'
TEST_VERSION_NUMBER equ '019a'
;Asper+ [
SDO_TAG equ 1 ;Output stream tag id (any number except 0)
@ -652,6 +652,7 @@ end if
stdcall hda_codec_setup_stream, eax, SDO_TAG, 0, 0x11 ; Left & Right channels (Back panel)
;Asper+ ]
invoke TimerHS, 1, 0, snd_hda_automute, 0
if USE_SINGLE_MODE
mov esi, msgSingleMode
invoke SysMsgBoardStr
@ -828,7 +829,7 @@ if DEBUG_IRQ
push eax esi
;mov esi, msgIRQ
;invoke SysMsgBoardStr
call GetTimerTicks
invoke GetTimerTicks
stdcall fdword2str, 2
invoke SysMsgBoardStr
pop esi eax
@ -2300,6 +2301,7 @@ endp
proc azx_bus_reset
call azx_stop_chip
call azx_init_chip
ret
endp
@ -2614,6 +2616,49 @@ endp
;_______
proc snd_hda_automute stdcall, data:dword
push eax ebx ecx edx esi
mov esi, [spec.out_pin_node+4]
mov ecx, [spec.out_pin_node]
test esi, esi
jnz @f
xchg ecx, esi
test esi, esi
jz .out
@@:
movzx edx, word [esi + HDA_GNODE.nid]
stdcall is_jack_detectable, edx
test eax, eax
jz .out
stdcall snd_hda_read_pin_sense, edx, 1
test eax, AC_PINSENSE_PRESENCE
jnz @f
xchg ecx, esi
@@:
; set PIN-Out enable
test esi, esi
jz .out
xor edx, edx
test [esi + HDA_GNODE.pin_caps], AC_PINCAP_HP_DRV
jz @f
mov edx, AC_PINCTL_HP_EN
@@:
or edx, AC_PINCTL_OUT_EN
movzx eax, [esi + HDA_GNODE.nid]
stdcall snd_hda_codec_write, eax, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, edx
; set PIN-Out disable
test ecx, ecx
jz .out
xor edx, edx
movzx eax, [ecx + HDA_GNODE.nid]
stdcall snd_hda_codec_write, eax, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, edx
.out:
pop esi edx ecx ebx eax
ret
endp
;Asper remember to add this functions:
proc snd_hda_queue_unsol_event stdcall, par1:dword, par2:dword
@ -2627,6 +2672,7 @@ if USE_UNSOL_EV = 0
;Test. Do not make queue, process immediately!
;stdcall here snd_hda_read_pin_sense stdcall, nid:dword, trigger_sense:dword
;and then mute/unmute pin based on the results
invoke TimerHS, 1, 0, snd_hda_automute, 0
end if
ret
endp
@ -2916,6 +2962,7 @@ msgPciStat db 'PCI status ',0
msgHDALowMMIo db 'lower mmio base ',0
msgHDAUpMMIo db 'upper mmio base ',0
msgIrqMap db 'HDA irq map as ',0
msgUnsolEvent db 'Unsolicited event!',13,10,0
;Asper [
if DEBUG
@ -2955,7 +3002,6 @@ if DEBUG
msgPollingCodecOnce db 'polling the codec once',13,10,0 ;Asper~
msgSwitchToPollMode db 'switching to polling mode',13,10,0 ;Asper~
msgUnsolEvent db 'Unsolicited event!',13,10,0
strSemicolon db ':',0
msgSETUP_FG_NODES db 'Setup FG nodes = start_nid:total_nodes = ',0
msgFG_TYPE db 'FG type = ',0