HDA: Use another codec when no AFG found if possible

git-svn-id: svn://kolibrios.org@4324 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Asper 2013-12-03 22:26:30 +00:00
parent d24c668030
commit 6b3f1e224c
2 changed files with 139 additions and 117 deletions

View File

@ -512,6 +512,22 @@ proc snd_hda_codec_init ; We use just one codec (the first found)
test eax, eax test eax, eax
jnz @f jnz @f
;Asper+: try to use another codec if possible [
if DEBUG
push esi
mov esi, msgNoAFGFound
call SysMsgBoardStr
pop esi
end if
push ecx
inc eax
mov ecx, [codec.addr]
shl eax, cl
pop ecx
cmp eax, [ctrl.codec_mask]
jl .skip_codec
;Asper+]
mov eax, [codec.mfg] mov eax, [codec.mfg]
test eax, eax test eax, eax
jnz @f jnz @f
@ -521,6 +537,7 @@ proc snd_hda_codec_init ; We use just one codec (the first found)
call SysMsgBoardStr call SysMsgBoardStr
pop esi pop esi
end if end if
.skip_codec:
mov eax, -1 mov eax, -1
ret ret
@@: @@:
@ -560,6 +577,7 @@ proc snd_hda_codec_init ; We use just one codec (the first found)
; power up all before initialization ; power up all before initialization
stdcall snd_hda_set_power_state, ebx, AC_PWRST_D0 stdcall snd_hda_set_power_state, ebx, AC_PWRST_D0
xor eax, eax
pop ebx pop ebx
ret ret
endp endp

View File

@ -13,7 +13,7 @@ DEBUG_IRQ equ 0
USE_SINGLE_MODE equ 0 ; 1 = Single mode; 0 = Normal mode. USE_SINGLE_MODE equ 0 ; 1 = Single mode; 0 = Normal mode.
TEST_VERSION_NUMBER equ '018d' TEST_VERSION_NUMBER equ '018e'
;Asper+ [ ;Asper+ [
SDO_TAG equ 1 ;Asper: Output stream tag id (any number except 0) SDO_TAG equ 1 ;Asper: Output stream tag id (any number except 0)
@ -2338,14 +2338,17 @@ proc azx_codec_create
; if USE_FIRST_CODEC ; if USE_FIRST_CODEC
; cmp ecx, 1 ; cmp ecx, 1
; else ; else
cmp ecx, 3 cmp ecx, 4
; end if ; end if
jl .next_slot jl .next_slot
mov eax, -1 mov eax, -1
jmp .out jmp .out
.init: .init:
push ecx edx
stdcall snd_hda_codec_init stdcall snd_hda_codec_init
xor eax, eax pop edx ecx
test eax, eax
jnz @b
.out: .out:
pop edx ecx ebx pop edx ecx ebx
ret ret
@ -2900,6 +2903,7 @@ if DEBUG
msgCodecOK db 'codec probed OK',13,10,0 msgCodecOK db 'codec probed OK',13,10,0
msgCodecError db 'codec probe error disabling it...',13,10,0 msgCodecError db 'codec probe error disabling it...',13,10,0
emsgNoAFGorMFGFound db 'no AFG or MFG node found',13,10,0 emsgNoAFGorMFGFound db 'no AFG or MFG node found',13,10,0
msgNoAFGFound db 'no AFG node found, trying another codec',13,10,0
emsgNoMem db 'hda_codec: cannot malloc',13,10,0 emsgNoMem db 'hda_codec: cannot malloc',13,10,0
msgConnect db 'CONNECT: NID=',0 msgConnect db 'CONNECT: NID=',0
msgIdx db ' IDX=',0 msgIdx db ' IDX=',0