Я написал наложение дерева устройств для драйвера сенсорного экрана ad7879-i2c (скомпилировано как модуль с использованием исходного кода Raspberry Pi, файлы: ad7879-i2c.c, ad7879.c). Драйвер загружен, но я думаю, что параметры не передаются драйверу. Устройство имеет адрес i2c1, адрес 0x2c, GPIO 26 (BCM 12). evtest показывает параметры драйвера по умолчанию, а сенсорный экран вообще не работает.
В /boot/config.txt:
dtparam=i2c_arm=on
dtoverlay=i2c-ad7879
В / etc / modules:
i2c-bcm2708
i2c-dev
Вывод gpio readall:
+-----+-----+---------+------+---+---Pi 2---+---+------+---------+-----+-----+
| BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM |
+-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
| | | 3.3v | | | 1 || 2 | | | 5v | | |
| 2 | 8 | SDA.1 | ALT0 | 1 | 3 || 4 | | | 5V | | |
| 3 | 9 | SCL.1 | ALT0 | 1 | 5 || 6 | | | 0v | | |
| 4 | 7 | GPIO. 7 | IN | 0 | 7 || 8 | 1 | ALT0 | TxD | 15 | 14 |
| | | 0v | | | 9 || 10 | 1 | ALT0 | RxD | 16 | 15 |
| 17 | 0 | GPIO. 0 | IN | 0 | 11 || 12 | 0 | IN | GPIO. 1 | 1 | 18 |
| 27 | 2 | GPIO. 2 | IN | 0 | 13 || 14 | | | 0v | | |
| 22 | 3 | GPIO. 3 | IN | 0 | 15 || 16 | 0 | IN | GPIO. 4 | 4 | 23 |
| | | 3.3v | | | 17 || 18 | 0 | IN | GPIO. 5 | 5 | 24 |
| 10 | 12 | MOSI | IN | 0 | 19 || 20 | | | 0v | | |
| 9 | 13 | MISO | IN | 0 | 21 || 22 | 0 | IN | GPIO. 6 | 6 | 25 |
| 11 | 14 | SCLK | IN | 0 | 23 || 24 | 1 | IN | CE0 | 10 | 8 |
| | | 0v | | | 25 || 26 | 1 | IN | CE1 | 11 | 7 |
| 0 | 30 | SDA.0 | IN | 0 | 27 || 28 | 1 | IN | SCL.0 | 31 | 1 |
| 5 | 21 | GPIO.21 | IN | 1 | 29 || 30 | | | 0v | | |
| 6 | 22 | GPIO.22 | IN | 0 | 31 || 32 | 1 | IN | GPIO.26 | 26 | 12 |
| 13 | 23 | GPIO.23 | IN | 0 | 33 || 34 | | | 0v | | |
| 19 | 24 | GPIO.24 | IN | 0 | 35 || 36 | 0 | IN | GPIO.27 | 27 | 16 |
| 26 | 25 | GPIO.25 | IN | 1 | 37 || 38 | 0 | IN | GPIO.28 | 28 | 20 |
| | | 0v | | | 39 || 40 | 0 | IN | GPIO.29 | 29 | 21 |
+-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
| BCM | wPi | Name | Mode | V | Physical | V | Mode | Name | wPi | BCM |
+-----+-----+---------+------+---+---Pi 2---+---+------+---------+-----+-----+
Вывод dmesg:
3.235940] input: AD7879 Touchscreen as /devices/platform/soc/3f804000.i2c/i2c-1/1-002c/input/input0
Вывод сообщения vcdbg log (в режиме отладки):
002590.952: Loaded overlay 'i2c-ad7879'
002591.011: dtdebug: Found fragment 0 (offset 36)
002596.047: dtdebug: merge_fragment(/soc/i2c@7e804000,/fragment@0/__overlay__)
002596.070: dtdebug: +prop(#address-cells)
002596.967: dtdebug: +prop(#size-cells)
002597.869: dtdebug: +prop(status)
002601.245: dtdebug: merge_fragment(/soc/i2c@7e804000/ad7879@2c,/fragment@0/__overlay__/ad7879@2c)
002601.271: dtdebug: +prop(compatible)
002602.139: dtdebug: +prop(reg)
002603.067: dtdebug: +prop(adi,swap-xy-axis-enable)
002604.278: dtdebug: +prop(adi,x-plate-ohms)
002605.510: dtdebug: +prop(adi,x-min)
002606.760: dtdebug: +prop(adi,x-max)
002608.025: dtdebug: +prop(adi,y-min)
002609.306: dtdebug: +prop(adi,y.max)
002610.619: dtdebug: +prop(adi,pressure-min)
002611.927: dtdebug: +prop(adi,pressure-max)
002613.257: dtdebug: +prop(adi,pen-down-acquisition-interval)
002614.601: dtdebug: +prop(adi,first-conversion-delay)
002615.968: dtdebug: +prop(adi,acquisition-time)
002617.359: dtdebug: +prop(adi,averaging)
002618.773: dtdebug: +prop(adi,median)
002620.213: dtdebug: +prop(interrupts)
002621.325: dtdebug: +prop(interrupt-parent)
002622.386: dtdebug: +prop(status)
002623.509: dtdebug: +prop(linux,phandle)
002624.646: dtdebug: +prop(phandle)
002625.820: dtdebug: merge_fragment() end
002625.867: dtdebug: merge_fragment() end
002626.003: dtdebug: delete_node(/hat)
Вывод i2cdetect -y 1:
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- UU -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: 60 -- -- -- -- -- -- -- -- UU -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
Вывод lsmod:
Module Size Used by
cfg80211 420690 0
rfkill 16659 1 cfg80211
i2c_dev 6047 0
snd_bcm2835 19769 0
snd_pcm 74825 1 snd_bcm2835
snd_seq 53561 0
snd_seq_device 3650 1 snd_seq
snd_timer 18157 2 snd_pcm,snd_seq
snd 52116 5 snd_bcm2835,snd_timer,snd_pcm,snd_seq,snd_seq_device
evdev 10216 1
joydev 9047 0
ad7879_i2c 1525 0
ad7879 5379 1 ad7879_i2c
rtc_abx80x 3247 0
i2c_bcm2708 5014 0
bcm2835_gpiomem 3023 0
uio_pdrv_genirq 2966 0
uio 8235 1 uio_pdrv_genirq
Источник дерева устройств наложения, файл i2c-ad7879-overlay.dts:
// Definition for I2C based Touch screen ad7879
/dts-v1/;
/plugin/;
/ {
compatible = "brcm,bcm2708";
fragment@0 {
target = <&i2c_arm>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
ad7879: ad7879@2c {
compatible = "adi,ad7879";
reg = <0x2c>;
adi,swap-xy-axis-enable = <0>;
adi,x-plate-ohms = <620>;
adi,x-min = <0>;
adi,x-max = <4000>;
adi,y-min = <0>;
adi,y-max = <4000>;
adi,pressure-min = <0>;
adi,pressure-max = <10000>;
interrupts = <26 2>; /* falling edge */
interrupt-parent = <&gpio>;
status = "okay";
};
};
};
};
Вывод evtest / dev / input / touchscreen:
Input driver version is 1.0.1
Input device ID: bus 0x18 vendor 0x0 product 0x79 version 0x3
Input device name: "AD7879 Touchscreen"
Supported events:
Event type 0 (EV_SYN)
Event type 1 (EV_KEY)
Event code 330 (BTN_TOUCH)
Event type 3 (EV_ABS)
Event code 0 (ABS_X)
Value 286
Min 0
Max 4095
Event code 1 (ABS_Y)
Value 2729
Min 0
Max 4095
Event code 24 (ABS_PRESSURE)
Value 0
Min 0
Max 0
Properties:
Testing ... (interrupt to exit)