Subversion Repositories Kolibri OS

Rev

Rev 4555 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1.  
  2. ;; Compose a 32bit command word to be sent to the HD-audio controller
  3. proc make_codec_cmd stdcall, nid:dword, direct:dword, verb:dword, parm:dword
  4.         push    ebx
  5.  
  6.         and     dword [codec.addr], 0xF
  7.         and     dword [direct], 1
  8.         and     dword [nid], 0x7F
  9.         and     dword [verb], 0xFFF
  10.         and     dword [parm], 0xFFFF
  11.  
  12.         mov     eax, [codec.addr]
  13.         shl     eax, 28
  14.         mov     ebx, [direct]
  15.         shl     ebx, 27
  16.         or      eax, ebx
  17.         mov     ebx, [nid]
  18.         shl     ebx, 20
  19.         or      eax, ebx
  20.         mov     ebx, [verb]
  21.         shl     ebx, 8
  22.         or      eax, ebx
  23.         mov     ebx, [parm]
  24.         or      eax, ebx
  25.         pop     ebx
  26.         ret
  27. .err:
  28.         pop     ebx
  29.         mov     eax, -1
  30.         ret
  31. endp
  32.  
  33. ;; Send and receive a verb
  34. proc codec_exec_verb stdcall, cmd:dword;, res:dword <- returned in eax
  35.         push    ebx  edx
  36.         mov     ebx, [cmd]
  37.         cmp     ebx, -1
  38.         jne     @f
  39.         pop     edx  ebx
  40.         mov     eax, -1
  41.         ret
  42. @@:
  43. if  FDEBUG
  44.         push    eax esi
  45.         mov     esi, msgVerbQuery
  46.         invoke  SysMsgBoardStr
  47.         mov     eax, ebx
  48.         stdcall fdword2str, 2
  49.         invoke  SysMsgBoardStr
  50.         pop     esi eax
  51. end if
  52.  
  53.         mov     edx, -1
  54. .again:
  55.         ;call   snd_hda_power_up
  56.         stdcall azx_send_cmd, ebx
  57.         mov     ebx, eax
  58.         test    ebx, ebx
  59.         jnz     @f
  60.         call    azx_get_response
  61.         mov     edx, eax
  62. if  FDEBUG
  63.         test    edx, edx
  64.         jz      .end_debug
  65.         push    eax esi
  66.         mov     esi, msgVerbAnswer
  67.         invoke  SysMsgBoardStr
  68.         mov     eax, edx
  69.         stdcall fdword2str, 2
  70.         invoke  SysMsgBoardStr
  71.         pop     esi eax
  72. .end_debug:
  73. end if
  74.  
  75. @@:
  76.         ;call   snd_hda_power_down
  77.         cmp     edx, -1
  78.         jne     .l1
  79.  
  80.         mov     eax, [ctrl.rirb_error]
  81.         test    eax, eax
  82.         jz      .l1
  83.  
  84.         mov     eax, [ctrl.response_reset]
  85.         jz      @f
  86.  
  87. if DEBUG
  88.         push    esi
  89.         mov     esi, emsgBusResetFatalComm
  90.         invoke  SysMsgBoardStr
  91.         pop     esi
  92. end if
  93.         call    azx_bus_reset
  94. @@:
  95. .l1:
  96.         ;; clear reset-flag when the communication gets recovered
  97.         test    ebx, ebx
  98.         jnz     @f
  99.         mov     [ctrl.response_reset], 0
  100. @@:
  101.         mov     eax, edx
  102.  
  103.         pop     edx  ebx
  104.         ret
  105. endp
  106.  
  107.  
  108. ;;
  109. ;; snd_hda_codec_read - send a command and get the response
  110. ;; @nid: NID to send the command
  111. ;; @direct: direct flag
  112. ;; @verb: the verb to send
  113. ;; @parm: the parameter for the verb
  114. ;;
  115. ;; Send a single command and read the corresponding response.
  116. ;;
  117. ;; Returns the obtained response value, or -1 for an error.
  118. ;;
  119. proc snd_hda_codec_read stdcall, nid:dword, direct:dword, verb:dword, parm:dword
  120.         stdcall make_codec_cmd, [nid], [direct], [verb], [parm]
  121.         stdcall codec_exec_verb, eax
  122.         ret
  123. endp
  124.  
  125.  
  126. ;;
  127. ;; snd_hda_codec_write - send a single command without waiting for response
  128. ;; @nid: NID to send the command
  129. ;; @direct: direct flag
  130. ;; @verb: the verb to send
  131. ;; @parm: the parameter for the verb
  132. ;;
  133. ;; Send a single command without waiting for response.
  134. ;;
  135. ;; Returns 0 if successful, or a negative error code.
  136. ;;
  137. proc snd_hda_codec_write stdcall, nid:dword, direct:dword, verb:dword, parm:dword
  138.         ; Do we need to support a sync write?
  139.         stdcall make_codec_cmd, [nid], [direct], [verb], [parm]
  140.         stdcall codec_exec_verb, eax
  141.         ret
  142. endp
  143.  
  144.  
  145. ;;
  146. ;; snd_hda_sequence_write - sequence writes
  147. ;; @seq: VERB array to send
  148. ;;
  149. ;; Send the commands sequentially from the given array.
  150. ;; The array must be terminated with NID=0.
  151. ;;
  152. proc snd_hda_sequence_write stdcall, seq:dword
  153.         push    eax  ebx  ecx  esi
  154.         mov     esi, [seq]
  155. @@:
  156.         ;mov     ecx, [esi + hda_verb.nid]
  157.         ;mov     ebx, [esi + hda_verb.verb]
  158.         ;mov     eax, [esi + hda_verb.param]
  159.         ;stdcall snd_hda_codec_write, ecx, 0, ebx, eax
  160.         ;add     esi, hda_verb.sizeof
  161.         ;test    ecx, ecx
  162.         ;jnz     @b
  163.         ;______________________________________
  164.         cmp     dword [esi], 0
  165.         je      .out
  166.         movzx   ecx, word [esi] ; NID
  167.         movzx   ebx, word [esi+2] ; verb
  168.         and     bx, 0x0FFF
  169.         movzx   eax, word [esi + 4] ; sizeof(param) = 4 bytes
  170.         stdcall snd_hda_codec_write, ecx, 0, ebx, eax
  171.         add     esi, 6
  172.         jmp     @b
  173. .out:
  174.         pop     esi  ecx  ebx  eax
  175.         ret
  176. endp
  177.  
  178.  
  179. macro snd_hda_param_read  nid, param
  180. {
  181.         stdcall snd_hda_codec_read, nid, 0, AC_VERB_PARAMETERS, param
  182. }
  183.  
  184. ;;
  185. ;; snd_hda_get_sub_nodes - get the range of sub nodes
  186. ;; @codec: the HDA codec
  187. ;; @nid: NID to parse
  188. ;; @start_id: the pointer to store the start NID
  189. ;;
  190. ;; Parse the NID and store the start NID of its sub-nodes.
  191. ;; Returns the number of sub-nodes.
  192. ;;
  193. proc snd_hda_get_sub_nodes stdcall, nid:dword;, start_id:dword  <- returned in upper word of eax
  194.         snd_hda_param_read  [nid], AC_PAR_NODE_COUNT
  195.  
  196.         cmp     eax, -1
  197.         jne     @f
  198.         inc     eax
  199. @@:
  200.         and     eax, 0x7FFF7FFF
  201.         ret
  202. endp
  203.  
  204. ;;
  205. ;; snd_hda_get_connections - get connection list
  206. ;; @codec: the HDA codec
  207. ;; @nid: NID to parse
  208. ;; @conn_list: connection list array
  209. ;; @max_conns: max. number of connections to store
  210. ;;
  211. ;; Parses the connection list of the given widget and stores the list
  212. ;; of NIDs.
  213. ;;
  214. ;; Returns the number of connections, or a negative error code.
  215. ;;
  216. proc snd_hda_get_connections stdcall, nid:dword, conn_list:dword, max_conns:dword   ;Asper: Complete translation!
  217. locals
  218.         parm          dd ?
  219.         conn_len      dd ?
  220.         conns         dd 0
  221.         shift         db 8
  222.         num_elements  dd 4
  223.         mask          dd 0x7F
  224.         wcaps         dd ?
  225.         prev_nid      dw 1 ;Asper: Hmm.. Probably ALSA bug that it isn't initialized. I suppose to init it with 1.
  226. endl
  227.  
  228.         push    ebx ecx edx edi esi
  229.         mov     edi, [conn_list]
  230.         test    edi, edi
  231.         jz      .err_out
  232.         mov     ecx, [max_conns]
  233.         cmp     ecx, 0
  234.         jle     .err_out
  235.  
  236.  
  237.         stdcall get_wcaps, [nid]
  238.         mov     ebx, eax
  239.         mov     [wcaps], eax
  240.         stdcall get_wcaps_type, ebx
  241.         cmp     eax, AC_WID_VOL_KNB
  242.         je      .conn_list_ok
  243.         test    ebx, AC_WCAP_CONN_LIST
  244.         jnz     .conn_list_ok
  245. if DEBUG
  246.         mov     esi, emsgConnListNotAvailable
  247.         invoke  SysMsgBoardStr
  248.         mov     eax, [nid]
  249.         stdcall fdword2str, 3
  250.         invoke  SysMsgBoardStr
  251. end if
  252.         xor     eax, eax
  253.         dec     eax
  254.         jmp     .out
  255. .conn_list_ok:
  256.  
  257.         snd_hda_param_read  [nid], AC_PAR_CONNLIST_LEN
  258.         mov     [parm], eax
  259.  
  260.         test    eax, AC_CLIST_LONG
  261.         jz      @f
  262.         ; long form
  263.         mov     [shift], 16
  264.         mov     [num_elements], 2
  265.         mov     [mask], 0x7FFF ;Asper+
  266. @@:
  267.         and     eax, AC_CLIST_LENGTH
  268.         test    eax, eax
  269.         jz      .out ; no connection
  270.  
  271.         mov     [conn_len], eax
  272.         cmp     eax, 1
  273.         jne     .multi_conns
  274.         ; single connection
  275.         stdcall snd_hda_codec_read, [nid], 0, AC_VERB_GET_CONNECT_LIST, 0
  276.         mov     [parm], eax
  277.         cmp     [parm], -1
  278.         jne     @f
  279.         cmp     [ctrl.rirb_error], 0
  280.         jne     @f
  281.         xor     eax, eax
  282.         dec     eax
  283.         jmp     .out
  284. @@:
  285.  
  286.         mov     eax, [parm]
  287.         and     eax, [mask]
  288.         stosd
  289.         xor     eax, eax
  290.         inc     eax
  291.         jmp     .out
  292. .multi_conns:
  293.  
  294.         ; multi connection
  295.         xor     ecx, ecx
  296.         mov     edx, [num_elements]
  297. .next_conn:
  298.         mov     eax, ecx
  299. .mod:
  300.         cmp     eax, edx
  301.         jl      .mod_counted
  302.         sub     eax, edx
  303.         jmp     .mod
  304. .mod_counted:
  305.  
  306.         test    eax, eax
  307.         jnz     .l1
  308.         stdcall snd_hda_codec_read, [nid], 0, AC_VERB_GET_CONNECT_LIST, ecx
  309.         mov     [parm], eax
  310.  
  311.         cmp     eax, -1
  312.         jne     .l1
  313.         cmp     [ctrl.rirb_error], 0
  314.         jne     .err_out
  315. .l1:
  316.  
  317.         mov     eax, 1
  318.         push    ecx
  319.         mov     cl, [shift]
  320.         dec     cl
  321.         shl     eax, cl
  322.         and     eax, [parm]
  323.         pop     ecx
  324.         mov     ebx, eax  ;ranges
  325.  
  326.         mov     eax, [parm]
  327.         and     eax, [mask] ;val
  328.  
  329.         test    eax, eax
  330.         jnz     @f
  331. if DEBUG
  332.         push    eax esi
  333.         mov     esi, emsgInvConnList
  334.         invoke  SysMsgBoardStr
  335.         mov     eax, [nid]
  336.         stdcall fdword2str, 1
  337.         invoke  SysMsgBoardStr
  338.  
  339.         mov     esi, strSemicolon
  340.         invoke  SysMsgBoardStr
  341.         mov     eax, ecx
  342.         stdcall fdword2str, 0
  343.         invoke  SysMsgBoardStr
  344.  
  345.         mov     esi, strSemicolon
  346.         invoke  SysMsgBoardStr
  347.         mov     eax, [parm]
  348.         stdcall fdword2str, 2
  349.         invoke  SysMsgBoardStr
  350.         pop     esi eax
  351. end if
  352.         xor     eax, eax
  353.         jmp     .out
  354. @@:
  355.         push    ecx
  356.         mov     cl, [shift]
  357.         shr     [parm], cl
  358.         pop     ecx
  359.  
  360.         test    ebx, ebx
  361.         jz      .range_zero
  362.         ; ranges between the previous and this one
  363.         movzx   esi, word [prev_nid]
  364.         test    esi, esi
  365.         jz      .l2
  366.         cmp     esi, eax
  367.         jl      @f
  368. .l2:
  369. if DEBUG
  370.         push    eax esi
  371.         push    esi
  372.         mov     esi, emsgInvDepRangeVal
  373.         invoke  SysMsgBoardStr
  374.         pop     esi
  375.         push    eax
  376.         mov     eax, esi
  377.         stdcall fdword2str, 0
  378.         invoke  SysMsgBoardStr
  379.  
  380.         mov     esi, strSemicolon
  381.         invoke  SysMsgBoardStr
  382.         pop     eax
  383.         stdcall fdword2str, 2
  384.         invoke  SysMsgBoardStr
  385.         pop     esi eax
  386. end if
  387.         jmp     .continue
  388. @@:
  389.         push    ecx
  390.         mov     ecx, esi
  391.         inc     ecx
  392.         mov     ebx, [conns]
  393. .next_conn2:
  394.         cmp     ebx, [max_conns]
  395.         jl      @f
  396. if DEBUG
  397.         push    esi
  398.         mov     esi, emsgTooManyConns
  399.         invoke  SysMsgBoardStr
  400.         pop     esi
  401. end if
  402.         pop     ecx
  403.         jmp     .err_out
  404. @@:
  405.         shl     ebx, 1
  406.         push    edi
  407.         add     edi, ebx
  408.         mov     word [edi], cx
  409.         pop     edi
  410.         shr     ebx, 1
  411.         inc     ebx
  412.         inc     ecx
  413.         cmp     ecx, eax
  414.         jle     .next_conn2
  415.  
  416.         mov     [conns], ebx
  417.         pop     ecx
  418.         jmp     .end_range_test
  419. .range_zero:
  420.  
  421.         mov     ebx, [conns]
  422.         cmp     ebx, [max_conns]
  423.         jl      @f
  424. if DEBUG
  425.         push    esi
  426.         mov     esi, emsgTooManyConns
  427.         invoke  SysMsgBoardStr
  428.         pop     esi
  429. end if
  430.         jmp     .err_out
  431. @@:
  432.         shl     ebx, 1
  433.         push    edi
  434.         add     edi, ebx
  435.         mov     word [edi], ax
  436.         pop     edi
  437.         shr     ebx, 1
  438.         inc     ebx
  439.         mov     [conns], ebx
  440. .end_range_test:
  441.         mov     [prev_nid], ax
  442. .continue:
  443.         inc     ecx
  444.         cmp     ecx, [conn_len]
  445.         jl      .next_conn
  446.  
  447.         mov     eax, [conns]
  448. .out:
  449.         pop     esi edi edx ecx ebx
  450.         ret
  451. .err_out:
  452.         pop     esi edi edx ecx ebx
  453.         mov     eax, -1
  454.         ret
  455. endp
  456.  
  457.  
  458. ; Asper: Have to be realized later, when we will work with such events, but not NOW!
  459. ;proc snd_hda_queue_unsol_events stdcall, res:dword, res_ex:dword
  460. ;        push    ebx  edi  esi
  461. ;        ...
  462. ;        pop     esi  edi  ebx
  463. ;        ret
  464. ;endp
  465.  
  466. ; This functions also will be later realized.
  467. ;proc process_unsol_events stdcall, work:dword
  468. ;proc init_usol_queue stdcall, bus:dword
  469.  
  470. ;;
  471. ;; snd_hda_bus_new - create a HDA bus
  472. ;; @card: the card entry
  473. ;; @temp: the template for hda_bus information
  474. ;; @busp: the pointer to store the created bus instance
  475. ;;
  476. ;; Returns 0 if successful, or a negative error code.
  477. ;;
  478. ;proc snd_hda_bus_new
  479.         ; if we want to support unsolicited events, we have to solve this
  480.         ;    bus->workq = create_singlethread_workqueue(bus->workq_name);
  481.         ; (...)
  482. ;        xor   eax, eax
  483. ;        ret
  484. ;endp
  485.  
  486. ;;
  487. ;; snd_hda_codec_init - initialize a HDA codec
  488. ;;
  489. ;; Returns 0 if successful, or a negative error code.
  490. ;;
  491. proc snd_hda_codec_init    ; We use just one codec (the first found)
  492.         snd_hda_param_read  AC_NODE_ROOT, AC_PAR_VENDOR_ID
  493.         cmp     eax, -1
  494.         jne     @f
  495.         snd_hda_param_read  AC_NODE_ROOT, AC_PAR_VENDOR_ID
  496. @@:
  497.         mov     [codec.chip_id], ax
  498.         shr     eax, 16
  499.         mov     [codec.vendor_id], ax
  500.  
  501.         snd_hda_param_read  AC_NODE_ROOT, AC_PAR_SUBSYSTEM_ID
  502.         mov     [codec.subsystem_id], eax
  503.  
  504.         snd_hda_param_read  AC_NODE_ROOT, AC_PAR_REV_ID
  505.         mov     [codec.revision_id], eax
  506.  
  507.         stdcall setup_fg_nodes
  508.  
  509.         mov     eax, [codec.afg]
  510.         test    eax, eax
  511.         jnz     @f
  512.         ;Asper+: try to use another codec if possible [
  513. if DEBUG
  514.         push    esi
  515.         mov     esi, msgNoAFGFound
  516.         invoke  SysMsgBoardStr
  517.         pop     esi
  518. end  if
  519.         push    ecx
  520.         inc     eax
  521.         mov     ecx, [codec.addr]
  522.         shl     eax, cl
  523.         pop     ecx
  524.         cmp     eax, [ctrl.codec_mask]
  525.         jl      .skip_codec
  526.         ;Asper+]
  527.  
  528.         mov     eax, [codec.mfg]
  529.         test    eax, eax
  530.         jnz     @f
  531. if DEBUG
  532.         push    esi
  533.         mov     esi, emsgNoAFGorMFGFound
  534.         invoke  SysMsgBoardStr
  535.         pop     esi
  536. end  if
  537. .skip_codec:
  538.         mov     eax, -1
  539.         ret
  540. @@:
  541.  
  542.         mov     ebx, eax
  543.         push    ebx
  544.         stdcall read_widget_caps, eax
  545.  
  546.         cmp     eax, 0
  547.         jge     @f
  548. if DEBUG
  549.         push    esi
  550.         mov     esi, emsgNoMem
  551.         invoke  SysMsgBoardStr
  552.         pop     esi
  553. end  if
  554.         pop     ebx
  555.         mov     eax, -1
  556.         ret
  557. @@:
  558.  
  559.         call    read_pin_defaults
  560.  
  561.         cmp     eax, 0
  562.         jge     @f
  563.         pop     ebx
  564.         mov     eax, -1
  565.         ret
  566. @@:
  567.         mov     eax, [codec.subsystem_id]
  568.         test    eax, eax
  569.         jnz     @f
  570.         stdcall snd_hda_codec_read, ebx, 0, AC_VERB_GET_SUBSYSTEM_ID, 0
  571. @@:
  572.         ; power up all before initialization
  573.         stdcall snd_hda_set_power_state, ebx, AC_PWRST_D0
  574.  
  575.         xor     eax, eax
  576.         pop     ebx
  577.         ret
  578. endp
  579.  
  580.  
  581. ;;
  582. ;; snd_hda_codec_configure - (Re-)configure the HD-audio codec
  583. ;;
  584. ;; Start parsing of the given codec tree and (re-)initialize the whole
  585. ;; patch instance.
  586. ;;
  587. ;; Returns 0 if successful or a negative error code.
  588. ;;
  589. proc snd_hda_codec_configure
  590.         call    get_codec_name
  591. @@:
  592.         ; call the default parser
  593.         stdcall snd_hda_parse_generic_codec  ;entry point to generic tree parser!!!
  594.  
  595.         test    eax, eax
  596.         jz      @f
  597. if DEBUG
  598.         push    esi
  599.         mov     esi, emsgNoParserAvailable
  600.         invoke  SysMsgBoardStr
  601.         pop     esi
  602. end if
  603. @@:
  604. .out:
  605.         ret
  606. endp
  607.  
  608.  
  609. ; get_codec_name - store the codec name
  610. proc get_codec_name
  611.         push    eax ebx edi esi
  612.         mov     eax, [codec.ac_vendor_ids]
  613.         test    eax, eax
  614.         jnz     .get_chip_name
  615.         mov     ax, [codec.vendor_id]
  616.         mov     edi, hda_vendor_ids
  617.  
  618. @@:
  619.         mov     ebx, [edi]
  620.         test    ebx, ebx
  621.         jz      .unknown
  622.  
  623.         cmp     ax, bx
  624.         jne     .next
  625.         mov     eax, [edi+4]
  626.         mov     [codec.ac_vendor_ids], eax
  627.         mov     esi, eax
  628.         invoke  SysMsgBoardStr
  629. .get_chip_name:
  630.         stdcall detect_chip, [edi+8]
  631.         pop     esi  edi  ebx  eax
  632.         ret
  633. .next:
  634.         add     edi, 12
  635.         jmp     @b
  636. .unknown:
  637.         mov     [codec.ac_vendor_ids], ac_unknown
  638.         mov     [codec.chip_ids], chip_unknown
  639.  
  640.         mov     esi, chip_unknown
  641.         invoke  SysMsgBoardStr
  642.         movzx   eax, [codec.chip_id]
  643.         stdcall fdword2str, 2
  644.         invoke  SysMsgBoardStr
  645.         pop     esi edi ebx eax
  646.         ret
  647. endp
  648.  
  649.  
  650. align 4
  651. proc detect_chip stdcall, chip_tab:dword
  652.         push    eax ebx edi esi
  653.         mov     ax, [codec.chip_id]
  654.  
  655.         mov     edi, [chip_tab]
  656. @@:
  657.         mov     ebx, [edi]
  658.         cmp     ebx, 0xFF
  659.         je      .unknown
  660.  
  661.         cmp     ax, bx
  662.         jne     .next
  663.         mov     eax, [edi+4]
  664.         mov     [codec.chip_ids], eax
  665.         mov     esi, eax
  666.         invoke  SysMsgBoardStr
  667.         pop     esi  edi  ebx  eax
  668.         ret
  669. .next:
  670.         add     edi, 8
  671.         jmp     @b
  672. .unknown:
  673.         mov     [codec.chip_ids], chip_unknown
  674.         mov     esi, chip_unknown
  675.         invoke  SysMsgBoardStr
  676.         movzx   eax, [codec.chip_id]
  677.         stdcall fdword2str, 2
  678.         invoke  SysMsgBoardStr
  679.         pop     esi edi ebx eax
  680.         ret
  681. endp
  682.  
  683.  
  684. ;; look for an AFG and MFG nodes
  685. proc setup_fg_nodes
  686.         push    eax  ebx  ecx
  687.         stdcall snd_hda_get_sub_nodes, AC_NODE_ROOT
  688.         mov     ecx, eax
  689.         and     ecx, 0x7FFF ; total_nodes
  690.         mov     ebx, eax
  691.         shr     ebx, 16
  692.         and     ebx, 0x7FFF ; nid
  693.  
  694. if DEBUG
  695.         push    eax esi
  696.         mov     esi, msgSETUP_FG_NODES
  697.         invoke  SysMsgBoardStr
  698.         mov     eax, ebx
  699.         stdcall fdword2str, 1
  700.         invoke  SysMsgBoardStr
  701.  
  702.         mov     esi, strSemicolon
  703.         invoke  SysMsgBoardStr
  704.         mov     eax, ecx
  705.         stdcall fdword2str, 3
  706.         invoke  SysMsgBoardStr
  707.         pop     esi eax
  708. end if
  709.  
  710. .next:
  711.         test    ecx, ecx
  712.         jz      .l1
  713.         snd_hda_param_read  ebx, AC_PAR_FUNCTION_TYPE
  714.         and     eax, 0xFF
  715.  
  716. if DEBUG
  717.         push    eax esi
  718.         mov     esi, msgFG_TYPE
  719.         invoke  SysMsgBoardStr
  720.         stdcall fdword2str, 3
  721.         invoke  SysMsgBoardStr
  722.         pop     esi eax
  723. end if
  724.  
  725.         cmp     eax, AC_GRP_AUDIO_FUNCTION
  726.         jne     @f
  727.  
  728.         mov     [codec.afg], ebx
  729.         mov     [codec.function_id], eax
  730.         jmp     .continue
  731. @@:
  732.         cmp     eax, AC_GRP_MODEM_FUNCTION
  733.         jne     @f
  734.  
  735.         mov     [codec.mfg], ebx
  736.         mov     [codec.function_id], eax
  737.         jmp     .continue
  738. @@:
  739. .continue:
  740.         inc     ebx
  741.         dec     ecx
  742.         jnz     .next
  743. .l1:
  744.         pop     ecx  ebx  eax
  745.         ret
  746. endp
  747.  
  748.  
  749. ;======================================================================================
  750. ; read widget caps for each widget and store in cache
  751. proc read_widget_caps stdcall, fg_node:dword
  752.         push    ebx ecx edx edi
  753.  
  754.         stdcall snd_hda_get_sub_nodes, [fg_node]
  755.         mov     ecx, eax
  756.         and     ecx, 0x7FFF ; total_nodes
  757.         mov     [codec.num_nodes], cx
  758.         mov     ebx, eax
  759.         shr     ebx, 16
  760.         and     ebx, 0x7FFF ; nid
  761.         mov     [codec.start_nid], bx
  762.  
  763. if DEBUG
  764.         push    eax esi
  765.         mov     esi, msgSETUP_FG_NODES
  766.         invoke  SysMsgBoardStr
  767.         mov     eax, ebx
  768.         stdcall fdword2str, 1
  769.         invoke  SysMsgBoardStr
  770.  
  771.         mov     esi, strSemicolon
  772.         invoke  SysMsgBoardStr
  773.         mov     eax, ecx
  774.         stdcall fdword2str, 3
  775.         invoke  SysMsgBoardStr
  776.         pop     esi eax
  777. end if
  778.  
  779. if FDEBUG
  780.         push    esi
  781.         mov     esi, msgWCaps
  782.         invoke  SysMsgBoardStr
  783.         pop     esi
  784. end if
  785.  
  786.         mov     eax, ecx
  787.         shl     eax, 2
  788.         push    ebx ecx
  789.         invoke  Kmalloc
  790.         pop     ecx ebx
  791.         test    eax, eax
  792.         jz      .err_out
  793.         mov     [codec.wcaps], eax
  794.  
  795.         mov     edi, eax
  796. .next_node:
  797.  
  798.         snd_hda_param_read ebx, AC_PAR_AUDIO_WIDGET_CAP
  799.         stosd
  800.         inc     ebx
  801.         dec     ecx
  802.         jnz     .next_node
  803.         pop     edi edx ecx ebx
  804.         xor     eax, eax
  805.         ret
  806. .err_out:
  807.         pop     edi edx ecx ebx
  808.         xor     eax, eax
  809.         dec     eax
  810.         ret
  811. endp
  812.  
  813.  
  814. ; read all pin default configurations and save codec->init_pins
  815. proc  read_pin_defaults
  816.         push    ebx ecx edx edi
  817.  
  818.         movzx   ebx, [codec.start_nid]
  819.         movzx   ecx, [codec.num_nodes]
  820.  
  821.         ;Asper [
  822.         mov     eax, HDA_PINCFG.sizeof
  823.         mul     cl
  824.         push    ebx ecx
  825.         invoke  Kmalloc
  826.         pop     ecx ebx
  827.         test    eax, eax
  828.         jz      .err_out
  829.         mov     [codec.init_pins], eax
  830.         mov     [codec.num_pins], 0
  831.         mov     edi, eax
  832.         ;Asper ]
  833.  
  834. if FDEBUG
  835.         push    eax esi
  836.         mov     esi, msgPinCfgs
  837.         invoke  SysMsgBoardStr
  838.         pop     esi eax
  839. end if
  840.  
  841.  
  842. .next_node:
  843.         stdcall get_wcaps, ebx
  844.         and     eax, AC_WCAP_TYPE
  845.         shr     eax, AC_WCAP_TYPE_SHIFT
  846.  
  847.         cmp     eax, AC_WID_PIN
  848.         jne     .continue
  849.  
  850.         mov     [edi + HDA_PINCFG.nid], bx
  851.         stdcall snd_hda_codec_read, ebx, 0, AC_VERB_GET_CONFIG_DEFAULT, 0
  852.         mov     [edi + HDA_PINCFG.cfg], eax
  853.         add     edi, HDA_PINCFG.sizeof
  854.         inc     [codec.num_pins]
  855.  
  856. .continue:
  857.         inc     ebx
  858.         dec     ecx
  859.         jnz     .next_node
  860.  
  861.         pop     edi edx ecx ebx
  862.         xor     eax, eax
  863.         ret
  864. .err_out:
  865.         pop     edi edx ecx ebx
  866.         xor     eax, eax
  867.         dec     eax
  868.         ret
  869. endp
  870.  
  871.  
  872.  
  873. ; look up the given pin config list and return the item matching with NID
  874. proc look_up_pincfg stdcall, array:dword, nid:dword
  875.         push    ebx ecx edx
  876.         mov     ecx, [codec.num_pins]
  877.         mov     eax, [array]
  878.         mov     ebx, [nid]
  879. .next_pin:
  880.         mov     dx,  [eax + HDA_PINCFG.nid]
  881.         cmp     dx,  bx
  882.         je      .out
  883. .continue:
  884.         add     eax, HDA_PINCFG.sizeof
  885.         dec     ecx
  886.         jnz     .next_pin
  887.  
  888.         xor     eax, eax
  889. .out:
  890.         pop     edx ecx ebx
  891.         ret
  892. endp
  893.  
  894. ; write a config value for the given NID
  895. proc set_pincfg stdcall, nid:dword, cfg:dword
  896.         push    eax  ebx  ecx  edx
  897.         mov     eax, [cfg]
  898.         xor     ebx, ebx
  899.         mov     edx, AC_VERB_SET_CONFIG_DEFAULT_BYTES_0
  900.         mov     ecx, 4
  901. @@:
  902.         mov     bl,  al
  903.         stdcall snd_hda_codec_write, [nid], 0, edx, ebx
  904.         shr     eax, 8
  905.         inc     edx
  906.         dec     ecx
  907.         jnz     @b
  908. .l1:
  909.         pop     edx  ecx  ebx  eax
  910.         ret
  911. endp
  912.  
  913.  
  914. ;;
  915. ;; snd_hda_codec_get_pincfg - Obtain a pin-default configuration
  916. ;; @codec: the HDA codec
  917. ;; @nid: NID to get the pin config
  918. ;;
  919. ;; Get the current pin config value of the given pin NID.
  920. ;; If the pincfg value is cached or overridden via sysfs or driver,
  921. ;; returns the cached value.
  922. ;;
  923. proc snd_hda_codec_get_pincfg stdcall, nid:dword
  924.         push    edi
  925.         stdcall look_up_pincfg, [codec.init_pins], [nid]
  926.         test    eax, eax
  927.         jz      @f
  928.         mov     edi, eax
  929.         mov     eax, [edi + HDA_PINCFG.cfg]
  930. @@:
  931.         pop     edi
  932.         ret
  933. endp
  934.  
  935. ;======================================================================================
  936.  
  937. ;;
  938. ;; snd_hda_codec_setup_stream - set up the codec for streaming
  939. ;; @nid: the NID to set up
  940. ;; @stream_tag: stream tag to pass, it's between 0x1 and 0xf.
  941. ;; @channel_id: channel id to pass, zero based.
  942. ;; @format: stream format.
  943. ;;
  944. proc hda_codec_setup_stream stdcall, nid:dword, stream_tag:dword, channel_id:dword, format:dword
  945.         push    eax
  946.         mov     eax, [nid]
  947.         test    eax, eax
  948.         jnz     @f
  949.         pop     eax
  950.         ret
  951. @@:
  952. if DEBUG
  953.         push    esi
  954.         mov     esi, msgHDACodecSetupStream
  955.         invoke  SysMsgBoardStr
  956.         stdcall fdword2str, 3
  957.         invoke  SysMsgBoardStr
  958.  
  959.         mov     esi, msgStream
  960.         invoke  SysMsgBoardStr
  961.         mov     eax, [stream_tag]
  962.         stdcall fdword2str, 3
  963.         invoke  SysMsgBoardStr
  964.  
  965.         mov     esi, msgChannel
  966.         invoke  SysMsgBoardStr
  967.         mov     eax, [channel_id]
  968.         stdcall fdword2str, 3
  969.         invoke  SysMsgBoardStr
  970.  
  971.         mov     esi, msgFormat
  972.         invoke  SysMsgBoardStr
  973.         mov     eax, [format]
  974.         stdcall fdword2str, 3
  975.         invoke  SysMsgBoardStr
  976.         pop     esi
  977. end if
  978.         mov     eax, [stream_tag]
  979.         shl     eax, 4
  980.         or      eax, [channel_id]
  981.         stdcall snd_hda_codec_write, [nid], 0, AC_VERB_SET_CHANNEL_STREAMID, eax
  982.  
  983.         mov     eax, 1000  ; wait 1 ms
  984.         call    StallExec
  985.  
  986.         stdcall snd_hda_codec_write, [nid], 0, AC_VERB_SET_STREAM_FORMAT, [format]
  987.         pop     eax
  988.         ret
  989. endp
  990.  
  991.  
  992. proc snd_hda_codec_cleanup_stream stdcall, nid:dword
  993.         push    eax
  994.         mov     eax, [nid]
  995.         test    eax, eax
  996.         jz      @f
  997.         pop     eax
  998.         ret
  999. @@:
  1000. if DEBUG
  1001.         push    esi
  1002.         mov     esi, msgHDACodecCleanupStream
  1003.         invoke  SysMsgBoardStr
  1004.         stdcall fdword2str, 3
  1005.         invoke  SysMsgBoardStr
  1006.         pop     esi
  1007. end if
  1008.         stdcall snd_hda_codec_write, [nid], 0, AC_VERB_SET_CHANNEL_STREAMID, 0
  1009. if 0  ; keep the format
  1010.         mov     eax, 1000000  ; wait 100 ms
  1011.         call    StallExec
  1012.         stdcall snd_hda_codec_write, [nid], 0, AC_VERB_SET_STREAM_FORMAT, 0
  1013. end if
  1014.         pop     eax
  1015.         ret
  1016. endp
  1017.  
  1018.  
  1019. proc read_pin_cap, nid:dword
  1020.         snd_hda_param_read  [nid], AC_PAR_PIN_CAP
  1021.         ret
  1022. endp
  1023.  
  1024.  
  1025. ;; read the current volume
  1026. proc get_volume_mute stdcall, nid:dword, ch:dword, direction:dword, index:dword
  1027.         push    ebx
  1028.         mov     ebx, AC_AMP_GET_LEFT
  1029.         mov     eax, [ch]
  1030.         test    eax, eax
  1031.         jz      @f
  1032.         mov     ebx, AC_AMP_GET_RIGHT
  1033. @@:
  1034.         mov     eax, [direction]
  1035.         cmp     eax, HDA_OUTPUT
  1036.         jne     @f
  1037.         or      ebx, AC_AMP_GET_OUTPUT
  1038.         jmp     .l1
  1039. @@:
  1040.         or      ebx, AC_AMP_GET_INPUT
  1041. .l1:
  1042.         or      ebx, [index]
  1043.         stdcall snd_hda_codec_read, [nid], 0, AC_VERB_GET_AMP_GAIN_MUTE, ebx
  1044.         and     eax, 0xFF
  1045.         pop     ebx
  1046.         ret
  1047. endp
  1048.  
  1049.  
  1050. ;; write the current volume in info to the h/w
  1051. proc put_volume_mute stdcall, nid:dword, ch:dword, direction:dword, index:dword, val:dword
  1052.         push    eax  ebx
  1053.         mov     ebx, AC_AMP_SET_LEFT
  1054.         mov     eax, [ch]
  1055.         test    eax, eax
  1056.         jz      @f
  1057.         mov     ebx, AC_AMP_SET_RIGHT
  1058. @@:
  1059.         mov     eax, [direction]
  1060.         cmp     eax, HDA_OUTPUT
  1061.         jne     @f
  1062.         or      ebx, AC_AMP_SET_OUTPUT
  1063.         jmp     .l1
  1064. @@:
  1065.         or      ebx, AC_AMP_SET_INPUT
  1066. .l1:
  1067.         mov     eax, [index]
  1068.         shl     eax, AC_AMP_SET_INDEX_SHIFT
  1069.         or      ebx, eax
  1070.         or      ebx, [val]
  1071.         stdcall snd_hda_codec_write, [nid], 0, AC_VERB_SET_AMP_GAIN_MUTE, ebx
  1072.         pop     ebx  eax
  1073.         ret
  1074. endp
  1075.  
  1076.  
  1077. ;;
  1078. ;; snd_hda_codec_amp_update - update the AMP value
  1079. ;; @nid: NID to read the AMP value
  1080. ;; @ch: channel (left=0 or right=1)
  1081. ;; @direction: #HDA_INPUT or #HDA_OUTPUT
  1082. ;; @idx: the index value (only for input direction)
  1083. ;; @mask: bit mask to set
  1084. ;; @val: the bits value to set
  1085. ;;
  1086. ;; Update the AMP value with a bit mask.
  1087. ;; Returns 0 if the value is unchanged, 1 if changed.
  1088. ;;
  1089. ;-proc snd_hda_codec_amp_update stdcall, nid:dword, ch:dword, direction:dword, idx:dword, mask:dword, val:dword
  1090. ;-        push    ebx  edx
  1091. ;-        mov     eax, [mask]
  1092. ;-        mov     ebx, [val]
  1093. ;-        and     ebx, eax
  1094. ;-        xor     eax, -1
  1095. ;-        mov     edx, eax
  1096. ;-        stdcall get_volume_mute, [nid], [ch], [direction], [idx]
  1097. ;-        and     eax, edx
  1098. ;-        or      ebx, eax
  1099. ;-
  1100. ;-        stdcall put_volume_mute, [nid], [ch], [direction], [idx], ebx
  1101. ;-        xor     eax, eax
  1102. ;-        inc     eax
  1103. ;-        pop     edx  ebx
  1104. ;-        ret
  1105. ;-endp
  1106.  
  1107.  
  1108. ;;
  1109. ;; snd_hda_codec_amp_stereo - update the AMP stereo values
  1110. ;; @nid: NID to read the AMP value
  1111. ;; @direction: #HDA_INPUT or #HDA_OUTPUT
  1112. ;; @idx: the index value (only for input direction)
  1113. ;; @mask: bit mask to set
  1114. ;; @val: the bits value to set
  1115. ;;
  1116. ;; Update the AMP values like snd_hda_codec_amp_update(), but for a
  1117. ;; stereo widget with the same mask and value.
  1118. ;;
  1119. proc snd_hda_codec_amp_stereo stdcall, nid:dword, direction:dword, idx:dword, mask:dword, val:dword
  1120.         push    ebx edx
  1121.         mov     ebx, [val]
  1122.         mov     edx, [mask]
  1123.         and     ebx, edx
  1124.         stdcall put_volume_mute, [nid], 0, [direction], [idx], ebx
  1125.         stdcall put_volume_mute, [nid], 1, [direction], [idx], ebx
  1126.         pop     edx  ebx
  1127.         ret
  1128. endp
  1129.  
  1130. ; execute pin sense measurement
  1131. proc snd_hda_read_pin_sense stdcall, nid:dword, trigger_sense:dword
  1132.         mov     eax, [trigger_sense]
  1133.         test    eax, eax
  1134.         jz      .no_trigger_sense
  1135.  
  1136.         stdcall read_pin_cap, [nid]
  1137.         test    eax, AC_PINCAP_TRIG_REQ ;need trigger?
  1138.         jz      .no_trigger_sense
  1139.  
  1140.         stdcall snd_hda_codec_read, [nid], 0, AC_VERB_SET_PIN_SENSE, 0
  1141. .no_trigger_sense:
  1142.         stdcall snd_hda_codec_read, [nid], 0, AC_VERB_GET_PIN_SENSE, 0
  1143.         ret
  1144. endp
  1145.  
  1146. proc is_jack_detectable stdcall, nid:dword
  1147.         stdcall read_pin_cap, [nid]
  1148.         test    eax, AC_PINCAP_PRES_DETECT
  1149.         jz      .no
  1150.  
  1151.         stdcall get_wcaps, [nid]
  1152.         test    eax, AC_WCAP_UNSOL_CAP
  1153.         jz      .no
  1154. .yes:
  1155.         xor     eax, eax
  1156.         inc     eax
  1157.         ret
  1158. .no:
  1159.         xor     eax, eax
  1160.         ret
  1161. endp
  1162.  
  1163. proc snd_hda_enable_pin_sense stdcall nid:dword, jacktag:dword
  1164.         push    eax
  1165.         stdcall is_jack_detectable, [nid]
  1166.         test    eax, eax
  1167.         jz      @f
  1168.         mov     eax, [jacktag]
  1169.         or      eax, AC_USRSP_EN
  1170.         stdcall snd_hda_codec_write, [nid], 0, AC_VERB_SET_UNSOLICITED_ENABLE, eax
  1171. @@:
  1172.         pop     eax
  1173.         ret
  1174. endp
  1175.  
  1176. ;; set power state of the codec
  1177. proc snd_hda_set_power_state stdcall, fg:dword, power_state:dword
  1178.         push    eax ebx ecx edx
  1179.         ; this delay seems necessary to avoid click noise at power down
  1180.         mov     ebx, [power_state]
  1181.         cmp     ebx, AC_PWRST_D3
  1182.         jne     @f
  1183.         mov     eax, 100000
  1184.         call    StallExec
  1185. @@:
  1186.         stdcall snd_hda_codec_read, [fg], 0, AC_VERB_SET_POWER_STATE, ebx
  1187.         ;partial workaround for "azx_get_response timeout"
  1188.         cmp     ebx, AC_PWRST_D0
  1189.         jne     @f
  1190.  
  1191.         mov     dx, [codec.vendor_id]
  1192.         cmp     dx, 0x14F1
  1193.         jne     @f
  1194.         mov     eax, 10000
  1195.         call    StallExec
  1196. @@:
  1197.         movzx   ecx, [codec.num_nodes]
  1198.         movzx   edx, [codec.start_nid]
  1199. .next_nid:
  1200.         stdcall get_wcaps, edx
  1201.         test    eax, AC_WCAP_POWER
  1202.         jz      .skip_nid
  1203.  
  1204.         stdcall get_wcaps_type, eax
  1205.         cmp     ebx, AC_PWRST_D3
  1206.         jne     .l1
  1207.         cmp     eax, AC_WID_PIN
  1208.         jne     .l1
  1209.         ;don't power down the widget if it controls
  1210.         ;eapd and EAPD_BTLENABLE is set.
  1211.         stdcall read_pin_cap, edx
  1212.         test    eax, AC_PINCAP_EAPD
  1213.         jz      .l2
  1214.  
  1215.         stdcall snd_hda_codec_read, edx, 0, AC_VERB_GET_EAPD_BTLENABLE, 0
  1216.         and     eax, 0x02
  1217.         test    eax, eax
  1218.         jnz     .skip_nid
  1219. .l2:
  1220. .l1:
  1221.         stdcall snd_hda_codec_write, edx, 0, AC_VERB_SET_POWER_STATE, ebx
  1222. .skip_nid:
  1223.         inc     edx
  1224.         dec     ecx
  1225.         jnz     .next_nid
  1226.  
  1227.         cmp     ebx, AC_PWRST_D0
  1228.         jne     .out
  1229.         ;wait until codec reaches to D0
  1230.         mov     ecx, 500
  1231. .wait_D0:
  1232.         stdcall snd_hda_codec_read, [fg], 0, AC_VERB_GET_POWER_STATE, 0
  1233.         cmp     eax, ebx
  1234.         je      .out
  1235.         mov     eax, 1000  ; msleep(1);
  1236.         call    StallExec
  1237.         dec     ecx
  1238.         jnz     .wait_D0
  1239. .out:
  1240.         pop     edx ecx ebx eax
  1241.         ret
  1242. endp
  1243.  
  1244.  
  1245. ;data
  1246.  
  1247. ; codec vendors
  1248. align 16
  1249. msg_Cirrus           db 'Cirrus Logic ',0
  1250. msg_Motorola         db 'Motorola ',0
  1251. msg_SiliconImage     db 'Silicon Image ',0
  1252. msg_Realtek          db 'Realtek ',0
  1253. msg_Creative         db 'Creative ',0
  1254. msg_IDT              db 'IDT ',0
  1255. msg_LSI              db 'LSI ',0
  1256. msg_AnalogDevices    db 'Analog Devices ',0
  1257. msg_CMedia           db 'C-Media ',0
  1258. msg_Conexant         db 'Conexant ',0
  1259. msg_Chrontel         db 'Chrontel ',0
  1260. msg_LG               db 'LG ',0
  1261. msg_Wolfson          db 'Wolfson Microelectronics ',0
  1262. msg_Qumranet         db 'Qumranet ',0
  1263. msg_SigmaTel         db 'SigmaTel ',0
  1264. ac_unknown     db 'unknown manufacturer ',0
  1265.  
  1266. chip_unknown   db 'unknown codec id ', 0
  1267.  
  1268.  
  1269. ; codec vendor labels
  1270. align 4
  1271. hda_vendor_ids:
  1272.         dd    0x1002, msg_ATI, chips_ATI
  1273.         dd    0x1013, msg_Cirrus, chips_Cirrus
  1274.         dd    0x1057, msg_Motorola, chips_Motorola
  1275.         dd    0x1095, msg_SiliconImage, chips_SiliconImage
  1276.         dd    0x10de, msg_NVidia, chips_NVidia
  1277.         dd    0x10ec, msg_Realtek, chips_Realtek
  1278.         dd    0x1102, msg_Creative, chips_Creative
  1279.         dd    0x1106, msg_VIA, chips_VIA
  1280.         dd    0x111d, msg_IDT, chips_IDT
  1281.         dd    0x11c1, msg_LSI, chips_LSI
  1282.         dd    0x11d4, msg_AnalogDevices, chips_Analog
  1283.         dd    0x13f6, msg_CMedia, chips_CMedia
  1284.         dd    0x14f1, msg_Conexant, chips_Conexant
  1285.         dd    0x17e8, msg_Chrontel, chips_Chrontel
  1286.         dd    0x1854, msg_LG, chips_LG
  1287.         dd    0x1aec, msg_Wolfson, chips_Wolfson
  1288.         dd    0x1af4, msg_Qumranet, chips_Qumranet   ; Qemu 0.14
  1289.         dd    0x434d, msg_CMedia, chips_CMedia
  1290.         dd    0x8086, msg_Intel, chips_Intel
  1291.         dd    0x8384, msg_SigmaTel, chips_SigmaTel
  1292.         dd    0 ; terminator
  1293.  
  1294. align 16             ;known codecs
  1295. chips_ATI            dd 0xAA01, chip_ATIR6XX
  1296.                      dd 0xFF
  1297.  
  1298. chips_Cirrus         dd 0xFF
  1299. chips_Motorola       dd 0xFF
  1300.  
  1301. chips_SiliconImage   dd 0x1392, chip_SI1392
  1302.                      dd 0xFF
  1303.  
  1304. chips_NVidia         dd 0x0002, chip_MCP78
  1305.                      dd 0xFF
  1306.  
  1307. chips_Realtek        dd 0x0262, chip_ALC262
  1308.                      dd 0x0268, chip_ALC268
  1309.                      dd 0x0269, chip_ALC269
  1310.                      dd 0x0272, chip_ALC272
  1311.                      dd 0x0662, chip_ALC662
  1312.                      dd 0x0663, chip_ALC663
  1313.                      dd 0x0883, chip_ALC883
  1314.                      dd 0x0887, chip_ALC887
  1315.                      dd 0x0888, chip_ALC888
  1316.                      dd 0x0889, chip_ALC889
  1317.                      dd 0xFF
  1318.  
  1319. chips_Creative       dd 0xFF
  1320.  
  1321. chips_VIA            dd 0xE721, chip_VT1708B_1
  1322.                      dd 0x0397, chip_VT17085_0
  1323.                      dd 0xFF
  1324.  
  1325. chips_IDT            dd 0xFF
  1326. chips_LSI            dd 0x1039, chip_LSI1039
  1327.                      dd 0x1040, chip_LSI1040
  1328.                      dd 0x3026, chip_LSI3026
  1329.                      dd 0x3055, chip_LSI3055
  1330.                      dd 0xFF
  1331.  
  1332. chips_Analog         dd 0x1986, chip_AD1986A
  1333.                      dd 0x198B, chip_AD198B
  1334.                      dd 0xFF
  1335.  
  1336. chips_CMedia         dd 0xFF
  1337.  
  1338. chips_Conexant       dd 0x5045, chip_CX20549
  1339.                      dd 0x5051, chip_CX20561
  1340.                      dd 0xFF
  1341.  
  1342. chips_Chrontel       dd 0xFF
  1343. chips_LG             dd 0xFF
  1344. chips_Wolfson        dd 0xFF
  1345. chips_Intel          dd 0xFF
  1346.  
  1347. chips_Qumranet       dd 0x0010, chip_HDA_OUTPUT
  1348.                      dd 0x0020, chip_HDA_DUPLEX
  1349.                      dd 0xFF
  1350.  
  1351. chips_SigmaTel       dd 0x7680, chip_STAC9221
  1352.                      dd 0x7682, chip_STAC9221_A2
  1353.                      dd 0xFF
  1354.  
  1355. align 16
  1356. ;AnalogDevices
  1357. chip_AD1986A         db 'AD1986A',13,10,0
  1358. chip_AD198B          db 'AD198B',13,10,0
  1359.  
  1360. ;ATI
  1361. chip_ATIR6XX         db 'ATIR6XX',13,10,0
  1362.  
  1363. ;Silicon Image
  1364. chip_SI1392          db 'SI1392',13,10,0
  1365.  
  1366. ;NVidia
  1367. chip_MCP78           db 'MCP78',13,10,0
  1368.  
  1369. ;Realtek
  1370. chip_ALC262          db 'ALC262',13,10,0
  1371. chip_ALC268          db 'ALC268',13,10,0
  1372. chip_ALC269          db 'ALC269',13,10,0
  1373. chip_ALC272          db 'ALC272',13,10,0
  1374. chip_ALC662          db 'ALC662',13,10,0
  1375. chip_ALC663          db 'ALC663',13,10,0
  1376. chip_ALC883          db 'ALC883',13,10,0
  1377. chip_ALC887          db 'ALC887',13,10,0
  1378. chip_ALC888          db 'ALC888',13,10,0
  1379. chip_ALC889          db 'ALC889',13,10,0
  1380.  
  1381. ;Sigmatel
  1382. chip_STAC9221        db 'STAC9221',13,10,0
  1383. chip_STAC9221_A2     db 'STAC9221_A2',13,10,0
  1384.  
  1385. ;VIA
  1386. chip_VT1708B_1       db 'VT1708B_1',13,10,0
  1387. chip_VT17085_0       db 'VT17085_0',13,10,0
  1388.  
  1389. ;Conexant
  1390. chip_CX20549         db 'CX20549',13,10,0
  1391. chip_CX20561         db 'CX20561',13,10,0
  1392.  
  1393. ;Qumranet
  1394. chip_HDA_OUTPUT      db 'HDA-OUTPUT',13,10,0
  1395. chip_HDA_DUPLEX      db 'HDA-DUPLEX',13,10,0
  1396.  
  1397. ;LSI
  1398. chip_LSI1039         db '1039 (Agere Systems HDA Modem)',13,10,0
  1399. chip_LSI1040         db '1040 (Agere Systems HDA Modem)',13,10,0
  1400. chip_LSI3026         db '3026 (Agere Systems HDA Modem)',13,10,0
  1401. chip_LSI3055         db '3055 (Agere Systems HDA Modem)',13,10,0
  1402.  
  1403.