【发布时间】:2016-05-11 21:57:25
【问题描述】:
我有一个需要 PEC 的 I2C/SMBus 设备,我正在为它编写内核空间驱动程序。
在 Linux 2.6.37 上,我使用 i2c_board_info 实例化客户端并在那里设置标志,但现在驱动程序正在移植到 3.14,我找不到 PEC 标志的设备树绑定。
其实我不认为有这样的绑定因为the I2C core is not getting any property from device tree other than reg and wakeup-source。
那么我应该在我的设备驱动程序中执行i2c_client->flags |= I2C_CLIENT_PEC 吗?
【问题讨论】:
-
ioctl(file, I2C_PEC, long select) Selects SMBus PEC (packet error checking) generation and verification if select not equals 0, disables if select equals 0. Default 0. Used only for SMBus transactions. This request only has an effect if the the adapter has I2C_FUNC_SMBUS_PEC; it is still safe if not, it just doesn't have any effect.来自kernel.org/doc/Documentation/i2c/dev-interface -
@AndyShevchenko 但lxr.free-electrons.com/source/drivers/i2c/i2c-dev.c#L438 似乎是用户空间 I2C api,不会影响内核空间 i2c 设备。
-
为什么在内核级别需要它?
-
@AndyShevchenko 我正在为 lc709203f 电池电量计 (onsemi.com/pub_link/Collateral/LC709203F-D.PDF) 编写驱动程序,并以该驱动程序为例 (lxr.free-electrons.com/source/drivers/power/ds2782_battery.c)。 LC709203 需要 PEC。所有没有 PEC 的写入都将被忽略。
-
原始问题中没有。考虑到以下答案似乎或多或少是正确的。
标签: linux linux-device-driver i2c