【发布时间】:2013-12-20 08:02:58
【问题描述】:
我想连接 TCA6408 IO 扩展器并获取嵌入式系统的按键输入。 我正在尝试使用 SABRELite (iMX6Q) Boad,我的开发环境是 LTIB (L3.0.35_4.1.0_130816_source.tar.gz)
我做了以下修改
1.) 在“board-mx6q_sabrelite.c”中添加一个条目
static struct i2c_board_info mxc_i2c2_board_info[] __initdata = {
{
I2C_BOARD_INFO("pca953x", 0x21),
.irq = gpio_to_irq(MX6Q_SABRELITE_CAP_TCH_INT1),
},
};
2.) 从 menuconfig 启用驱动程序
--- GPIO Support
< * > PCA953x, PCA955x, TCA64xx, and MAX7310 I/O ports
[ * ] Interrupt controller support for PCA953x
当我启动系统时,驱动程序注册正常。 但是 Probe() 函数中有一个错误(pca953x: probe of 2-0020 failed with error -22)。
#Console 日志
Freescale USB OTG Driver loaded, $Revision: 1.55 $
pca953x: probe of 2-0020 failed with error -22
imx-ipuv3 imx-ipuv3.0: IPU DMFC NORMAL mode: 1(0~1), 5B(4,5), 5F(6,7)
imx-ipuv3 imx-ipuv3.1: IPU DMFC NORMAL mode: 1(0~1), 5B(4,5), 5F(6,7)
mxc_mipi_csi2 mxc_mipi_csi2: i.MX MIPI CSI2 driver probed
mxc_mipi_csi2 mxc_mipi_csi2: i.MX MIPI CSI2 dphy version is 0x3130302a
MIPI CSI2 driver module loaded
Advanced Linux Sound Architecture Driver Version 1.0.24.
由于(pdata == NULL)而发生此错误
linux-3.0.35/drivers/gpio/pca953x.c
static int __devinit pca953x_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct pca953x_platform_data *pdata;
struct pca953x_chip *chip;
int ret = 0;
chip = kzalloc(sizeof(struct pca953x_chip), GFP_KERNEL);
if (chip == NULL)
return -ENOMEM;
pdata = client->dev.platform_data;
if (pdata == NULL) {
pdata = pca953x_get_alt_pdata(client);
/*
* Unlike normal platform_data, this is allocated
* dynamically and must be freed in the driver
*/
chip->dyn_pdata = pdata;
}
if (pdata == NULL) {
dev_dbg(&client->dev, "no platform data\n");
ret = -EINVAL;
goto out_failed;
}
我无法理解这个问题。 “platform_data”需要做什么样的修改?
任何人都请支持我。
【问题讨论】:
标签: linux linux-device-driver embedded-linux kernel-module