biggreat 发表于 2016-6-26 21:50

本帖最后由 biggreat 于 2016-6-28 02:24 编辑

该说说codec文件了。
codec文件描述了声卡各种物理属性和各个部件的定义及初始数值。先来认识一下codec文件结构
Codec: Realtek ALC668 (声卡名称)
Address: 0 (初始启用模块)
AFG Function Id: 0x1 (unsol 1)(功能组)
Vendor Id: 0x10ec0668(就是codecid)
Subsystem Id: 0x10431080(子系统id,好像用不到)
Revision Id: 0x100003(修订版本)上述说明在intel hda def spec中成为 node id 0x0,没错他就是node id 0x0 说明的内容。
State of AFG node 0x01:(功能模块)
Power states:D0 D1 D2 D3 EPSS(电源管理选项)
Power: setting=D0, actual=D0(初始电源方案)
GPIO: io=4, o=0, i=0, unsolicited=1, wake=0(几个基本输入输出)
IO: enable=0, dir=0, wake=0, sticky=0, data=0, unsol=0
IO: enable=0, dir=0, wake=0, sticky=0, data=0, unsol=0
IO: enable=0, dir=0, wake=0, sticky=0, data=0, unsol=0
IO: enable=0, dir=0, wake=0, sticky=0, data=0, unsol=0上述为 node id 0x01 说明的内容
Node 0x02 wcaps 0x41d: Stereo Amp-Out(带功放立体声输出)
Control: name="Headphone Playback Volume", index=0, device=0(耳机)
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0(功放控制)
Device: name="ALC668 Analog", type="Audio", device=0(设备名称)
Amp-Out caps: ofs=0x57, nsteps=0x57, stepsize=0x02, mute=0
Amp-Out vals:
Converter: stream=0, channel=0
PCM:(脉冲编码调制)
    rates : 44100 48000 96000 192000
    bits : 16 20 24
    formats : PCM
Power states:D0 D1 D2 D3 EPSS
Power: setting=D0, actual=D0看到上述节点,立即就知道是耳机的audio out 节点。
Node 0x03 wcaps 0x41d: Stereo Amp-Out
Control: name="Speaker Playback Volume", index=0, device=0(内置扬声器)
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
Amp-Out caps: ofs=0x57, nsteps=0x57, stepsize=0x02, mute=0
Amp-Out vals:
Converter: stream=0, channel=0
PCM:
    rates : 44100 48000 96000 192000
    bits : 16 20 24
    formats : PCM
Power states:D0 D1 D2 D3 EPSS
Power: setting=D0, actual=D0看到上述节点,立即就知道是内置扬声器的audio out 节点。
Node 0x07 wcaps 0x10051b: Stereo Amp-In (立体声带功放输入)
Control: name="Capture Volume", index=0, device=0 (内置麦克风)
    ControlAmp: chs=3, dir=In, idx=0, ofs=0
Control: name="Capture Switch", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=0, ofs=0
Device: name="ALC668 Analog", type="Audio", device=0
Amp-In caps: ofs=0x17, nsteps=0x3f, stepsize=0x02, mute=1
Amp-In vals:
Converter: stream=0, channel=0
SDI-Select: 0
PCM:
    rates : 44100 48000 96000 192000
    bits : 16 20 24
    formats : PCM
Power states:D0 D1 D2 D3 EPSS
Power: setting=D0, actual=D0
Connection: 1
   0x12 (连接到 0x12 节点)Node 0x08 wcaps 0x10051b: Stereo Amp-In
Amp-In caps: ofs=0x17, nsteps=0x3f, stepsize=0x02, mute=1(不带名字的一般是line in或者外置mic)
Amp-In vals:
Converter: stream=0, channel=0
SDI-Select: 0
PCM:
    rates : 44100 48000 96000 192000
    bits : 16 20 24
    formats : PCM
Power states:D0 D1 D2 D3 EPSS
Power: setting=D0, actual=D0
Connection: 1
   0x23(连接到0x23 节点)Node 0x0c wcaps 0x20010b: Stereo Amp-In(耳机的audio mixer)Node 0x0d wcaps 0x20010b: Stereo Amp-In(内置扬声器的audio mixer)
Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
Amp-In vals:
Connection: 2
   0x03 0x0bNode 0x23 wcaps 0x20010b: Stereo Amp-In(内置mic的audio mixer)Node 0x12 wcaps 0x400401: Stereo (立体声)
Node 0x14 wcaps 0x40058f: Stereo Amp-In Amp-Out(立体声带功放输入输出)
Control: name="Speaker Playback Switch", index=0, device=0(扬声器播放开关)
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
Amp-In caps: N/A
Amp-In vals:
Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
Amp-Out vals:
Pincap 0x0001003c: IN OUT HP EAPD Detect
EAPD 0x2: EAPD
Pin Default 0x90170110: Speaker at Int N/A(内置扬声器)
    Conn = Analog, Color = Unknown
    DefAssociation = 0x1, Sequence = 0x0
    Misc = NO_PRESENCE
Pin-ctls: 0x40: OUT(打开扬声器)
Unsolicited: tag=00, enabled=0
Power states:D0 D1 D2 D3 EPSS
Power: setting=D0, actual=D0
Connection: 3
   0x0c 0x0d* 0x0eNode 0x15 wcaps 0x40058d: Stereo Amp-Out (立体声带功输出)
Control: name="Headphone Playback Switch", index=0, device=0(耳机播放开关)
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
Amp-Out vals:
Pincap 0x0001001c: OUT HP EAPD Detect (侦查 eapd)
EAPD 0x2: EAPD
Pin Default 0x04211020: HP Out at Ext Right(右边外置耳机输出)
    Conn = 1/8, Color = Black
    DefAssociation = 0x2, Sequence = 0x0
Pin-ctls: 0xc0: OUT HP(打开耳机)
Unsolicited: tag=01, enabled=1(自适应,即插入耳机,打开耳机播放开关)
Power states:D0 D1 D2 D3 EPSS
Power: setting=D0, actual=D0
Connection: 3
   0x0c* 0x0d 0x0e
Unsolicited:这个参数在cc中会用到,解决睡眠后无声,命令为:node id + 708+h(10000001)。
Node 0x19 wcaps 0x40048b: Stereo Amp-In (立体声带功放输入)
Control: name="Mic Boost Volume", index=0, device=0(外置麦克风)
    ControlAmp: chs=3, dir=In, idx=0, ofs=0
Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0
Amp-In vals:
Pincap 0x00003724: IN Detect(输入侦查)
    Vref caps: HIZ 50 GRD 80 100(电压控制选项)
Pin Default 0x02a11030: Mic at Ext Front
    Conn = 1/8, Color = Black
    DefAssociation = 0x3, Sequence = 0x0
Pin-ctls: 0x24: IN VREF_80(电压增加80%)
Unsolicited: tag=02, enabled=1
Power states:D0 D1 D2 D3 EPSS
Power: setting=D3, actual=D3Pin-ctls: 0x24,外置麦克风的此参数,和耳机输出有杂音有关,命令:node id +707+Pin-ctls
另补上一个xml.zlib文件和xml文件相互转换的工具,直接拖放,相互转换。需要注意的是文件所在上级目录不要有中文字符,否则出现转换失败。

biggreat 发表于 2016-6-28 01:17

(五)Platforms
该文件描述了输入输出节点的pathmaps。一般而言,realtec alc声卡codec:
输入节点pathmap为:->->
输出节点pathmap为:->->
中描述Control: name="Capture Volume"必为内置麦克风,没有的为外置麦克风(或者描述为extmic)
中描述Control: name="Headphone Playback Volume"必为耳机,描述为Control: name="Speaker Playback Volume"必为内置扬声器,没有的为line out 或 spdif out。这样每个输入输出开头和结尾都知道了,中间的为两者共同连接节点,是不是很简单?
Platforms文件结构如图:

pathmapid为前面说的layout文件中指向pathmap的同pathmapid。
外部dsp一般只要前两项即可,headphone和microphone
大类输入输出装置,第一类输入装置和第二类输入装置需要进行人工切换,第一类输入装置下第一输入装置和第二输入装置自动切换(如内置麦克风和外置麦克风可以设置自动切换,SPDIF in可以另起一类输入,需要人工切换到该类输入)
大类输出装置下有3个输出装置自动切换,第一个输出装置为多通道,其他两个为单通道(分为左右声道)。
输入装置的节点一般按如下配置:

输入一般在audio input 节点配置amp(功放),在pin complex 配置boost(增效),数值为0 1 2 3(增效依次加强)
输出装置的节点一般按如下配置:

输出装置一般在audio mixer 和 audio output 节点配置amp,其他按图配置即可。

wx3124558 发表于 2016-6-28 01:26

想尝试一下win pe和mac pe共存,下了微PE的镜像,但是解压后按原路径放入EFI分区,重启还是看不到,哪里步骤有问题?

wx3124558 发表于 2016-6-28 09:56

biggreat 发表于 2016-6-28 01:17 https://www.pcbeta.com/static/image/common/back.gif
(五)Platforms
该文件描述了输入输出节点的pathmaps。一般而言,realtec alc声卡codec:
输入节点pathma ...

能不能把你制作win PE的镜像发我一份,我自己找的镜像解压后不知道路径怎么放。

biggreat 发表于 2016-6-28 10:01

wx3124558 发表于 2016-6-28 09:56 https://www.pcbeta.com/static/image/common/back.gif
能不能把你制作win PE的镜像发我一份,我自己找的镜像解压后不知道路径怎么放。

win pe就是网上的,支持EFI启动的那种

huoxiangdong19 发表于 2016-6-28 19:01

谢谢分享!!!

biggreat 发表于 2016-6-29 11:03

本帖最后由 biggreat 于 2016-6-29 11:04 编辑

(六)patch AppleHDA binary
对AppleHDA进行二进制修改,将原生支持的codecid替换为目标声卡的codecid,同时根据目标codecid的大小,对小于替换的id大于目标id的原生codecid进行置零(去除比较,防止跳转),我的经验是无需全部置零,对目标相邻的原生id满足上述条件的原生id置零即可(有待进一步验证)。
我们经常用于替换的原生id有:10ec0885;11d41984;11d4198b等
10.7-10.12 原生支持的id有:
osx10.7
    0x1aec87ff,
    0x15ad1974,
    0x8384767f,
    0x1002aa00,
    0x83847680,
    0x10134205,
    0x1002aa01,
    0x10de0006,
    0x10134206,
    0x11d41983,
    0x10ec0884,
    0x10ec0261,
    0x10de003f,
    0x10de0013,
    0x10de0007,
    0x10de000a,
    0x10de000c,
    0x11d41984,
    0x11d4198b,
    0x10ec0262,
    0x10ec0885,
    0x1aec8800,
    0x10de0014,
    0x15ad1975

osx10.8
    0x1aec87ff,
    0x15ad1974,
    0x8384767f,
    0x1002aa00,
    0x83847680,
    0x10134205,
    0x1002aa01,
    0x10de0006,
    0x10134206,
    0x10ec0261,
    0x10de003f,
    0x10ec0884,
    0x10ec0262,
    0x10ec0885,
    0x11d41984,
    0x11d4198b,
    0x15ad1975,
    0x1aec8800

osx10.9
    0x8384767f,
    0x80862804,
    0x1aec87ff,
    0x15ad1974,
    0x10134205,
    0x1002aa01,
    0x83847680,
    0x1aec8800,
    0x80862807,
    0x15ad1975,
    0x10de0006,
    0x10134206,
    0x10ec0261,
    0x10134208,
    0x10ec0884,
    0x10ec0262,
    0x10ec0885,
    0x11d41984,
    0x11d4198b,
    0x10de0000

osx10.10
    0x8384767f,
    0x80862804,
    0x1aec87ff,
    0x15ad1974,
    0x10134205,
    0x1002aa01,
    0x83847680,
    0x1aec8800,
    0x15ad1975,
    0x10de0006,
    0x10134206,
    0x10ec0261,
    0x10134208,
    0x10ec0884,
    0x10ec0262,
    0x10ec0885,
    0x11d41984,
    0x11d4198b,
    0x10de0000

osx10.11
    0x8384767f,
    0x15ad1974,
    0x1002aa01,
    0x83847680,
    0x1aec8800,
    0x15ad1975,
    0x10de0006,
    0x10134206,
    0x10ec0261,
    0x10134208,
    0x10ec0262,
    0x10ec0885,
    0x11d41983,
    0x11d41984,
    0x11d4198b,
    0x10de0000

osx10.12
    0x8384767f,
    0x1002aa01,
    0x83847680,
    0x1aec8800,
    0x15ad1975,
    0x10134206,
    0x10134208,
    0x10ec0261,
    0x10ec0262,
    0x10ec0885,
    0x11d41984,
    0x11d4198a,
    0x11d4198b,
    0x10de0000

国外大神bcc9写了个脚本,对AppleHDA打二进制补丁,原脚本支持10.7-10.9,我对其进行修改,增加了10.10-10.12的支持。有了这个脚本,AppleHDA二进制补丁就很好做了。

biggreat 发表于 2016-6-29 11:50

最后用一张表格来说明,codec 、configdata、layout、Platforms、patch AppleHDA binary之间的关系。

前面零零星星了给大家说明了整个仿冒驱动的过程,我会在首楼进行总结,有兴趣的坛友可以按照指引的顺序进行阅读,有不同见解的,随时发表评论,以便完善。

我不要用户名 发表于 2016-6-29 15:00

建议冒仿声卡部分自己HDMI声音输出整理成一个完整的帖子~

biggreat 发表于 2016-6-29 15:03

我不要用户名 发表于 2016-6-29 15:00 https://www.pcbeta.com/static/image/common/back.gif
建议冒仿声卡部分自己HDMI声音输出整理成一个完整的帖子~

首楼已进行了整理,虽然是零星的,但是按照阅读顺序指引,应该是完整的,包含了集显hdmi全面驱动

那朵花yyou 发表于 2016-6-29 15:22

谢谢分享!!

346043142 发表于 2016-6-29 15:25

学习学习啊

我不要用户名 发表于 2016-6-29 15:53

biggreat 发表于 2016-6-29 15:03
首楼已进行了整理,虽然是零星的,但是按照阅读顺序指引,应该是完整的,包含了集显hdmi全面驱动

写得很全面有深度不过不够傻瓜式小白不能跟着做   不过小白也不需要自己弄了。。有applealc

maojinbing 发表于 2016-6-29 19:47

绝世好文

lwf2012 发表于 2016-6-29 19:50

点个赞,非常好很详细,至少基本我能看懂,希望以后能帮更多的景友制作ALC,希望论坛能有更多这种技术贴,而不是%完美贴,像biggreat大神这么有耐心讲解的大神已经不多了{:9_359:}

weigeloveu 发表于 2016-6-29 20:06

很好 逻辑清晰 条理清楚

7788mp3 发表于 2016-6-29 20:10

楼主好厉害 辛苦了 感谢分享

lff520520 发表于 2016-6-29 20:12

biggreat 发表于 2016-6-26 15:59 https://www.pcbeta.com/static/image/common/back.gif
聊聊声卡仿冒驱动(续一)
(四)layout文件
layout文件的结构是固定的,对于黑果而言,完整的结构图如下 ...

从头看到尾,过程很详细,方便了有一定基础的朋友们,真的很用心!!

gdoog 发表于 2016-6-29 20:41

写得很详细,我的声卡也是@biggreat修复的,十分感谢!{:5_273:}

CuminLo 发表于 2016-6-29 21:30

强势顶贴!!!

biggreat 大神讲的通俗易懂,感谢分享
页: 26 27 28 29 30 31 32 33 34 35 [36] 37 38 39 40 41 42 43 44 45
查看完整版本: yoga2 13完美了!(授人以渔)全面仿冒声卡教程、制作案例和经验分享!!!