概述
关于linux ak4495声卡的驱动编译,从零开始
设备树
/ { <-------/表法根目录
compatible = "rockchip,pro3288-act8846", "rockchip,rk3288";
ak449x-sound {
status = "okay";
compatible = "simple-audio-card";//simple-card framework框架
simple-audio-card,format = "i2s";
simple-audio-card,name = "rockchip,ak449x-codec";//<------simple-audio-card,name:用户指定的音频声卡名称。
simple-audio-card,mclk-fs = <256>;//主控供给编解码芯片用的时钟
// simple-audio-card,widgets:指定音频编解码器DAPM小部件(widgets),
// 每个 条目都是一对字符串:“template-wname”,“user-supplied-wname”。
// “ template-wname”是模板小部件名称,可选为:“Microphone”, “Line”, “Headphone”, “Speaker”.
// “user-supplied-wname”是用户指定的窗口小部件名称。
// simple-audio-card,widgets =
// "Microphone", "Mic Jack",
// "Headphone", "Headphone Jack",
// "Speaker", "Speaker";
//simple-audio-card,routing:音频组件之间的连接列表。
//每个条目都是一对字符串,第一个是目的(sink),第二个是源(source)。
//simple-audio-card,routing = //音频路径,如mic输入、耳机输出走那些通路
// "Mic Jack", "MICBIAS1",
// "IN1P", "Mic Jack",
// "Headphone Jack", "HPOL",
// "Headphone Jack", "HPOR",
// "Speaker", "SPOLP",
// "Speaker", "SPOLN",
// "Speaker", "SPORP",
// "Speaker", "SPORN";
//用于dai-link里指定CPU和CODEC子节点。
simple-audio-card,dai-link@0 {
//可选格式为:
//“ i2s”,“ right_j”,“ left_j”,“ dsp_a”
//“ dsp_b”,“ ac97”,“ pdm”,“ msb”,“ lsb”。
format = "i2s";
cpu {
sound-dai = <&i2s>;
};
codec {
sound-dai = <&ak449x>;
};
};
};
};//end of /
&i2c4 {
status = "okay";
ak449x: ak449x@1a {
#sound-dai-cells = <0>;
compatible = "AudioX,ak449x";
reg = <0x1a>;
status = "okay";//1573 add
chip = "AK4495";//1573 add
clocks = <&cru SCLK_I2S0_OUT>;
clock-names = "mclk";
pinctrl-names = "default";
pinctrl-0 = <&i2s0_mclk>;
io-channels = <&saradc 4>;
// hp-det-adc-value = <500>;
//realtek,in1-differential;
};
};
匹配优先顺序:https://blog.csdn.net/mcgrady_tracy/article/details/38980991?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.control&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.control
设备树中
compatible = “AudioX,ak449x”
匹配优先级
of_match_table>id_table
of_match_table表中的厂商和设备树中条目compatible(包含供应商字符串) 的厂商“myvendor”不匹配,则会用id_table去匹配设备树条目compatible (不包含供应商字符串)。
of_match_table > acpi_driver > id_table.
static const struct of_device_id ak449x_of_match[] = {
{ .compatible = "AudioX,ak449x", },
{ },
};
static const struct i2c_device_id ak449x_i2c_id[] = {
{ "ak449x", 0 },
{ "rt5639", 0 },
{ "rt5642", 0 },
{ }
};
MODULE_DEVICE_TABLE(i2c, ak449x_i2c_id);
static struct i2c_driver ak449x_i2c_driver = {
.driver = {
.name = "ak449x",
.pm = &ak449x_pm,
.of_match_table = ak449x_of_match,
//未用 .acpi_match_table = ACPI_PTR(rt5640_acpi_match),
},
.probe = ak449x_i2c_probe,//match成功后调用
.remove = ak449x_i2c_remove,
.id_table = ak449x_i2c_id,
};
module_i2c_driver(ak449x_i2c_driver);
i2c总线查看
i2cdetect -l
我是挂在ic2-4
i2cdetect -y -r 4
i2cdump -f -y 4 0x10
查看声卡
cat /proc/asound/cards
未完待续。。。。。2021.2.7
最后
以上就是炙热汉堡为你收集整理的2021-01-30的全部内容,希望文章能够帮你解决2021-01-30所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复