My平台: Beagle,Ubuntu,内核: 3.14.29-ti-r46
传感器: MPR121,连接到Beagle的i2c-2
我想让触摸传感器MPR121 (飞思卡尔触摸屏芯片)工作在我的比格骨黑。内核驱动程序已经准备好了。但是它需要与设备树一起工作。
首先,我为MPR121创建了一个设备树dts文件,如下所示:
tomxue@ubuntu:~/Tom/Source_Code/BBB/Ubuntu/ti-linux-kernel-dev/KERNEL/arch/arm/boot/dts$ cat am335x-bone-i2c2-mpr121.dts
/*
* Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
/dts-v1/;
#include "am33xx.dtsi"
#include "am335x-bone-common.dtsi"
#include "am335x-bone-common-pinmux.dtsi"
/ {
model = "TI AM335x BeagleBone Black";
compatible = "ti,am335x-bone-black", "ti,am335x-bone", "ti,am33xx";
};
&ocp {
/* i2c2 */
P9_19_pinmux {
mode = "i2c";
};
P9_20_pinmux {
mode = "i2c";
};
};
&i2c2 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <>; /* pinctrl-0 = <&i2c2_pins>; */
clock-frequency = <100000>;
touchkey: mpr121@5a {
compatible = "fsl,mpr121";
reg = <0x5a>;
};
};
#include "am335x-bone-i2c2-cape-eeprom.dtsi"dts目录下的Makefile如下所示:
dtb-$(CONFIG_ARCH_OMAP2PLUS) += omap2420-h4.dtb \
...
am335x-base0033.dtb \
am335x-bone-i2c2-mpr121.dtb \
am3517-craneboard.dtb \然后,我与设备树文件一起重新编译内核。使用正式脚本将内核图像、模块和设备树闪现到我的上。
重启Beagle之后,我检查了我的新内核版本:
root@arm:/dev/input# uname -a
Linux arm 3.14.29-ti-r46 #2 SMP PREEMPT Tue Apr 21 14:30:14 CST 2015 armv7l armv7l armv7l GNU/Linux然后侵入模块:
root@arm:~# insmod mpr121_touchkey.kodmesg没有关于mpr121的任何内容。然后我检查了i2c-2,传感器在0x5a地址上真正连接到Beagle的i2c-2 (与设备树设置相同):
root@arm:~# i2cdetect -y -r 2
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- UU UU UU UU -- -- 5a -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --最后,我检查了输入设备如下:
root@arm:/dev/input# ls
mice没有传感器的事!我错过了什么?如何使传感器内核驱动程序工作?谢谢!
发布于 2015-05-02 08:20:30
查看驱动程序源(touchkey.c),它似乎是一个常见的输入驱动程序。
首先要检查的是,这样的输入驱动程序一旦加载(insmod) 必须出现在/proc/bus/input/devices和/proc/bus/input/handlers中,设备节点进入/dev取决于您使用的设备管理器(udev .)它可能无法创建节点,必须有一种方法来知道次要部分手动创建节点(主语可能总是13 (我不确定)),并从其中读取类似的十六进制来检查hw和驱动程序是否工作。
如果驱动程序出现在上面提到的/proc节点中,您应该检查设备管理器的配置。
如果它没有出现,您可能需要在驱动程序的源代码中添加一些printk,并检查dmesg是否有问题(驱动程序已经显示了一些dev_err,但可能没有涵盖一些流)。
https://stackoverflow.com/questions/29829965
复制相似问题