我正在为cs4245设备开发一个音频编解码驱动程序。它由i2c控制。我有两个硬件(开发板),其中一个有编解码器连接到i2c-1,另一个连接到i2c-2。第一个是有效的,但第二个是无效的。
我在第二块板上测试了与编解码器的通信(使用i2cdetect,i2cget),它正在工作。它的通信和接收芯片ID。
查看代码,我可以找到应该用来设置总线通信的i2c总线的定义:
static struct snd_soc_dai_link mod_duo_dai =
{
.name = "MOD-DUO-I2S",
.stream_name = "MOD-DUO-SUNXI-I2S",
.cpu_dai_name = "sunxi-i2s.0",
.codec_dai_name = "cs4245-dai",
.platform_name = "sunxi-i2s-pcm-audio.0",
.codec_name = "cs4245-codec.1-004c", // EDITED
.ops = &mod_duo_ops,
.init = &mod_duo_dai_link_init,
};因此,我编辑了"cs4245-codec.2-004c"的高亮显示行,但是驱动程序仍然在寻找i2c-1。下面的内核打印显示:
bus: 'i2c': really_probe: probing driver cs4245-codec with device 1-004c
[i2c_device_probe] client name: cs4245, adapter name: sunxi-i2c.1, adapter nr: 1此外,我还在soc-core.c中插入了函数snd_soc_instantiate_card中的打印,以确保它得到了我的更改:
snd_soc_instantiate_card: cs4245-codec.2-004c随后,内核实现了编解码器探测功能,它显示:
[ 11.907394] [CS4245]Failed to read i2c at addr 0x4C.
[ 11.919643] cs4245-codec: probe of 1-004c failed with error -70编辑的行是否足以更改i2c总线?
代码可在以下网址获得:https://github.com/moddevices/linux-sunxi/blob/mod-duo/sound/soc/sunxi/mod-duo.c
我还试着改变下面这句话,如评论中所述:
static const struct i2c_device_id cs4245_id[] = {
{"cs4245", 1}, // changed to {"cs4245", 2}
{}
};也不管用。这段代码存在于编解码器驱动程序:https://github.com/moddevices/linux-sunxi/blob/mod-duo/sound/soc/codecs/cs4245.c中。
发布于 2015-08-20 18:22:23
i2c总线选项设置在提交修复后的arch/arm/plat/devices.c文件中。
https://unix.stackexchange.com/questions/224247
复制相似问题