您尚未登录。

楼主 #1 2019-02-12 10:15:01

Peter
会员
注册时间: 2018-12-12
已发帖子: 36
积分: 36

荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

主芯片:F1C100s
内核:https://github.com/Lichee-Pi/linux/tree/nano-4.14-exp
内核配置:

CONFIG_TOUCHSCREEN_SUN4I=y

设备树:

pio: pinctrl@1c20800 {
    compatible = "allwinner,suniv-f1c100s-pinctrl";
    reg = <0x01c20800 0x400>;
    interrupts = <38>, <39>, <40>;
    clocks = <&ccu CLK_BUS_PIO>, <&osc24M>, <&osc32k>;
    clock-names = "apb", "hosc", "losc";
    gpio-controller;
    interrupt-controller;
    #interrupt-cells = <3>;
    #gpio-cells = <3>;

    spi0_pins_a: spi0-pins-pc {
        pins = "PC0", "PC1", "PC2", "PC3";
        function = "spi0";
    };

    lcd_rgb666_pins: lcd-rgb666-pins {
        pins = "PD0", "PD1", "PD2", "PD3", "PD4",
                "PD5", "PD6", "PD7", "PD8", "PD9",
                "PD10", "PD11", "PD12", "PD13", "PD14",
                "PD15", "PD16", "PD17", "PD18", "PD19",
                "PD20", "PD21";
        function = "lcd";
    };
    
    rtp_pins: rtp-pins {
        pins = "PA0", "PA1", "PA2", "PA3";
        function = "rtp";
    };

    uart0_pins_a: uart-pins-pe {
        pins = "PE0", "PE1";
        function = "uart0";
    };

    mmc0_pins: mmc0-pins {
        pins = "PF0", "PF1", "PF2", "PF3", "PF4", "PF5";
        function = "mmc0";
    };
};

rtp: rtp@1c24800 {
    compatible = "allwinner,sun4i-a10-ts";
    reg = <0x01c24800 0x100>;
    interrupts = <20>;
    allwinner,ts-attached;
    #thermal-sensor-cells = <0>;
};

启动日志:

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.14.0-licheepi-nano (peter@peter-ThinkPad-T440p) (gcc version 6.4.0 (Buildroot 2018.11.1)) #6 Tue Jan 22 17:37:309
[    0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=0005317f
[    0.000000] CPU: VIVT data cache, VIVT instruction cache
[    0.000000] OF: fdt: Machine model: Lichee Pi Nano
[    0.000000] Memory policy: Data cache writeback
[    0.000000] random: fast init done
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 8128
[    0.000000] Kernel command line: console=tty0 console=ttyS0,115200 panic=5 rootwait root=/dev/mmcblk0p2 rw
[    0.000000] PID hash table entries: 128 (order: -3, 512 bytes)
[    0.000000] Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000000] Memory: 23748K/32768K available (5120K kernel code, 183K rwdata, 1096K rodata, 1024K init, 228K bss, 9020K reserved, 0K cma-rese)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
[    0.000000]     vmalloc : 0xc2800000 - 0xff800000   ( 976 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xc2000000   (  32 MB)
[    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
[    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
[    0.000000]       .text : 0xc0008000 - 0xc0600000   (6112 kB)
[    0.000000]       .init : 0xc0800000 - 0xc0900000   (1024 kB)
[    0.000000]       .data : 0xc0900000 - 0xc092dc60   ( 184 kB)
[    0.000000]        .bss : 0xc09324f0 - 0xc096b81c   ( 229 kB)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000047] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[    0.000112] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[    0.000628] Console: colour dummy device 80x30
[    0.001539] console [tty0] enabled
[    0.001643] Calibrating delay loop... 203.16 BogoMIPS (lpj=1015808)
[    0.070288] pid_max: default: 32768 minimum: 301
[    0.070662] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.070758] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.072219] CPU: Testing write buffer coherency: ok
[    0.073941] Setting up static identity map for 0x80100000 - 0x80100058
[    0.076445] devtmpfs: initialized
[    0.082684] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.082854] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.083155] pinctrl core: initialized pinctrl subsystem
[    0.085204] NET: Registered protocol family 16
[    0.086505] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.088354] cpuidle: using governor menu
[    0.107432] SCSI subsystem initialized
[    0.107751] pps_core: LinuxPPS API ver. 1 registered
[    0.107820] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.107945] PTP clock support registered
[    0.109667] clocksource: Switched to clocksource timer
[    0.136277] NET: Registered protocol family 2
[    0.137772] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.137927] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.138018] TCP: Hash tables configured (established 1024 bind 1024)
[    0.138330] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.138446] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.138964] NET: Registered protocol family 1
[    0.139460] NetWinder Floating Point Emulator V0.97 (double precision)
[    0.141388] Initialise system trusted keyrings
[    0.142199] workingset: timestamp_bits=30 max_order=13 bucket_order=0
[    0.170148] Key type asymmetric registered
[    0.170261] Asymmetric key parser 'x509' registered
[    0.170508] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
[    0.170610] io scheduler noop registered
[    0.170659] io scheduler deadline registered
[    0.171442] io scheduler cfq registered (default)
[    0.171541] io scheduler mq-deadline registered
[    0.171598] io scheduler kyber registered
[    0.181444] suniv-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver
[    0.352926] Serial: 8250/16550 driver, 8 ports, IRQ sharing disabled
[    0.359623] console [ttyS0] disabled
[    0.380028] 1c25000.serial: ttyS0 at MMIO 0x1c25000 (irq = 24, base_baud = 6250000) is a 16550A
[    0.793564] console [ttyS0] enabled
[    0.804093] panel-simple panel: panel supply power not found, using dummy regulator
[    0.813412] SCSI Media Changer driver v0.25 
[    0.819478] mousedev: PS/2 mouse device common for all mice
[    0.826825] input: 1c24800.rtp as /devices/platform/soc/1c24800.rtp/input/input0
[    0.835615] i2c /dev entries driver
[    0.899797] sunxi-mmc 1c0f000.mmc: base:0xc2855000 irq:19
[    0.908247] NET: Registered protocol family 17
[    0.912999] Key type dns_resolver registered
[    0.919435] Loading compiled-in X.509 certificates
[    0.932931] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[    0.939632] [drm] No driver support for vblank timestamp query.
[    0.946685] sun4i-drm display-engine: bound 1e60000.display-backend (ops 0xc0634648)
[    0.955638] sun4i-drm display-engine: bound 1c0c000.lcd-controller (ops 0xc06339fc)
[    1.098176] Console: switching to colour frame buffer device 100x30
[    1.106020] mmc0: host does not support reading read-only switch, assuming write-enable
[    1.108221] mmc0: new high speed SD card at address 2143
[    1.109414] mmcblk0: mmc0:2143 APPSD 120 MiB 
[    1.167002]  mmcblk0: p1 p2
[    1.167781] mmcblk0: p2 size 1048576 extends beyond EOD, truncated
[    1.232612] sun4i-drm display-engine: fb0:  frame buffer device
[    1.250921] [drm] Initialized sun4i-drm 1.0.0 20150629 for display-engine on minor 0
[    1.273917] EXT4-fs (mmcblk0p2): couldn't mount as ext3 due to feature incompatibilities
[    1.595420] EXT4-fs (mmcblk0p2): recovery complete
[    1.651226] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[    1.671096] VFS: Mounted root (ext4 filesystem) on device 179:2.
[    1.691264] devtmpfs: mounted
[    1.711986] Freeing unused kernel memory: 1024K
[    1.915283] EXT4-fs (mmcblk0p2): re-mounted. Opts: data=ordered

系统生成输入设备:

# ls /dev/input/
event0  mice    mouse0

系统中断数一直为零:

# cat /proc/interrupts 
           CPU0       
 16:       2024  sun4i_irq  13 Edge      /soc/timer@1c20c00
 18:        379  sun4i_irq  29 Edge      1c0c000.lcd-controller
 19:       1824  sun4i_irq  23 Edge      sunxi-mmc
 23:          0  sun4i_irq  20 Edge      sun4i-ts
 24:        192  sun4i_irq   1 Edge      ttyS0
Err:          0

参考:
     1. f1c100s 官方bsp没有整合 电阻触摸屏(RTP)驱动, 现在在主线Linux上面找到驱动了
     2. f1c100s 触摸屏(TP)驱动程序部分代码 (裸奔) 已验证,可以进【按压】和【抬起】中断,可以读按压坐标

最近编辑记录 Peter (2019-02-12 10:19:54)

离线

#2 2019-02-12 10:52:03

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

硬件连接有问题吗?

荔枝派 nano 板子的 触摸屏没有连到 PA0..3,
需要自己飞线





离线

楼主 #3 2019-02-12 11:00:37

Peter
会员
注册时间: 2018-12-12
已发帖子: 36
积分: 36

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

晕哥 说:

硬件连接有问题吗?

荔枝派 nano 板子的 触摸屏没有连到 PA0..3,
需要自己飞线

应该没有问题,我照着原理图飞的线。测过电阻屏四线间的电阻正常。
1218175543.jpg

离线

#4 2019-02-12 11:02:02

IoTer
会员
注册时间: 2019-01-20
已发帖子: 25
积分: 25

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

https://github.com/Lichee-Pi/linux/blob/nano-4.14-exp/drivers/input/touchscreen/sun4i-ts.c

那到 sun4i_ts_probe 加一些调试信息,看检测有没有过?

devm_request_irq 中断申请有没有成功?

最近编辑记录 IoTer (2019-02-12 11:02:29)

离线

楼主 #5 2019-02-12 11:15:47

Peter
会员
注册时间: 2018-12-12
已发帖子: 36
积分: 36

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

IoTer 说:

https://github.com/Lichee-Pi/linux/blob/nano-4.14-exp/drivers/input/touchscreen/sun4i-ts.c

那到 sun4i_ts_probe 加一些调试信息,看检测有没有过?

devm_request_irq 中断申请有没有成功?

系统存在hwmon设备

# cat /sys/class/hwmon/hwmon0/name 
sun4i_ts

证明hwmon注册通过:

        hwmon = devm_hwmon_device_register_with_groups(ts->dev, "sun4i_ts",
						       ts, sun4i_ts_groups);
	if (IS_ERR(hwmon))
		return PTR_ERR(hwmon);

进而说明中断注册没有问题:

	ts->irq = platform_get_irq(pdev, 0);
	error = devm_request_irq(dev, ts->irq, sun4i_ts_irq, 0, "sun4i-ts", ts);
	if (error)
		return error;

离线

#6 2019-02-12 11:32:43

IoTer
会员
注册时间: 2019-01-20
已发帖子: 25
积分: 25

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

那是不是说明一次都没有进入: sun4i_ts_irq ?

那会不会是基地址或者中断号对不上?

最近编辑记录 IoTer (2019-02-12 11:33:46)

离线

#7 2019-02-12 11:50:08

trigger
会员
注册时间: 2018-12-30
已发帖子: 41
积分: 41

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

看了一下

# cat /proc/interrupts 
           CPU0       
 16:       2024  sun4i_irq  13 Edge      /soc/timer@1c20c00
 18:        379  sun4i_irq  29 Edge      1c0c000.lcd-controller
 19:       1824  sun4i_irq  23 Edge      sunxi-mmc
 23:          0  sun4i_irq  20 Edge      sun4i-ts
 24:        192  sun4i_irq   1 Edge      ttyS0
Err:          0

中断号能对上, 看起来中断号和申请中断都没有问题,
只能从 基地址和硬件找原因了。

离线

楼主 #8 2019-02-12 11:51:23

Peter
会员
注册时间: 2018-12-12
已发帖子: 36
积分: 36

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

IoTer 说:

那是不是说明一次都没有进入: sun4i_ts_irq ?

那会不会是基地址或者中断号对不上?

@IoTer 设备树中的基地址和中断号是按照手册(Nano F600 User Manual.pdf)填写的,# cat /proc/interrupts的输出说明,确实没有中断发生。

Screenshot_20190212_114425.png
Screenshot_20190212_114551.png

最近编辑记录 Peter (2019-02-12 11:51:44)

离线

#9 2019-02-12 13:52:40

trigger
会员
注册时间: 2018-12-30
已发帖子: 41
积分: 41

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

据说 XBOOT 把触摸整合进去了, 可以编译一个试一试。

离线

楼主 #10 2019-02-12 13:59:12

Peter
会员
注册时间: 2018-12-12
已发帖子: 36
积分: 36

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

trigger 说:

据说 XBOOT 把触摸整合进去了, 可以编译一个试一试。

@trigger 提议不错,先用XBoot验证一下硬件是否有问题。
不过有没有在荔枝派Nano上开箱即用的教程,填坑怕了 tongue

离线

#11 2019-02-12 14:21:46

trigger
会员
注册时间: 2018-12-30
已发帖子: 41
积分: 41

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

rtp: rtp@1c24800 {
    compatible = "allwinner,sun4i-a10-ts";
    reg = <0x01c24800 0x100>;
    interrupts = <20>;
    allwinner,ts-attached;
    #thermal-sensor-cells = <0>;
};

https://github.com/Lichee-Pi/linux/blob/nano-4.14-exp/drivers/input/touchscreen/sun4i-ts.c

我仔细研究了一下设备树和驱动,

缺一个很重要的步骤,

就是端口的初始化,

要把 PA0..3 复用成为 RTP 端口才行。

直接到 probe 函数里面修改试一试。

为了简化问题, 可以用 busybox 里面的 devmem 命令,

直接把寄存器(0x01C20800)读出来, 然后再写进去。

最近编辑记录 trigger (2019-02-12 14:25:56)

离线

楼主 #12 2019-02-12 14:28:31

Peter
会员
注册时间: 2018-12-12
已发帖子: 36
积分: 36

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

@trigger 设备树中这一段对GPIO进行了配置,就像其它功能,例如UARTx, SPIx

    rtp_pins: rtp-pins {
        pins = "PA0", "PA1", "PA2", "PA3";
        function = "rtp";
    };

离线

#13 2019-02-12 14:32:27

trigger
会员
注册时间: 2018-12-30
已发帖子: 41
积分: 41

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

Peter 说:

@trigger 设备树中这一段对GPIO进行了配置,就像其它功能,例如UARTx, SPIx

    rtp_pins: rtp-pins {
        pins = "PA0", "PA1", "PA2", "PA3";
        function = "rtp";
    };

不好意思, 没注意到这个,
那你仍然可以用 dev 0x01C20800 寄存器读出来,
看上面的 复用配置有没有生效。

离线

楼主 #14 2019-02-12 14:49:51

Peter
会员
注册时间: 2018-12-12
已发帖子: 36
积分: 36

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

@trigger 确实没生效,全是默认值,按手册说明处于禁用状态,无语了,该肿么配置呢 yikes

# devmem 0x01C20800
0x00007777

Screenshot_20190212_144900.png

最近编辑记录 Peter (2019-02-12 14:50:32)

离线

#15 2019-02-12 14:55:39

trigger
会员
注册时间: 2018-12-30
已发帖子: 41
积分: 41

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

先写进去:

devmem 0x01C20800 0x00002222

然后再读出来:

devmem 0x01C20800

离线

楼主 #16 2019-02-12 15:03:25

Peter
会员
注册时间: 2018-12-12
已发帖子: 36
积分: 36

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

@trigger 写入成功,依然没有中断

# devmem 0x01C20800 32 0x00002222
# devmem 0x01C20800
0x00002222
# cat /proc/interrupts 
           CPU0       
 16:      11593  sun4i_irq  13 Edge      /soc/timer@1c20c00
 18:        985  sun4i_irq  29 Edge      1c0c000.lcd-controller
 19:       4835  sun4i_irq  23 Edge      sunxi-mmc
 23:          0  sun4i_irq  20 Edge      sun4i-ts
 24:       1357  sun4i_irq   1 Edge      ttyS0
Err:          0

离线

楼主 #17 2019-02-12 15:06:19

Peter
会员
注册时间: 2018-12-12
已发帖子: 36
积分: 36

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

@trigger 很奇怪PA0..3在设备树中的复用配置为什么没有生效。。。

离线

#18 2019-02-12 15:11:10

trigger
会员
注册时间: 2018-12-30
已发帖子: 41
积分: 41

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

Peter 说:

@trigger 很奇怪PA0..3在设备树中的复用配置为什么没有生效。。。

设备树配置复用, 我也不会.

奇怪, GPIO复用对了也没反应,
这下我没招了。

离线

楼主 #19 2019-02-12 15:18:19

Peter
会员
注册时间: 2018-12-12
已发帖子: 36
积分: 36

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

@trigger 还是非常感谢,学了一招devmem big_smile

离线

楼主 #20 2019-02-12 15:22:58

Peter
会员
注册时间: 2018-12-12
已发帖子: 36
积分: 36

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

@trigger 还有一点,既使GPIO复用不成功,RTP的温度测量功能也应该产生中断吧

离线

#21 2019-02-12 15:27:57

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

mmexport1549956183691.png


mmexport1549956188273.png

这是 @assert 断言哥给我发的, 是他在 f1c100s bsp linux(3.10) 改好的触摸驱动, 仅供参考。





离线

楼主 #22 2019-02-12 15:40:29

Peter
会员
注册时间: 2018-12-12
已发帖子: 36
积分: 36

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

@晕哥,我对比一下,试试,多谢

离线

#23 2019-02-12 16:01:21

trigger
会员
注册时间: 2018-12-30
已发帖子: 41
积分: 41

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

Peter 说:

@trigger 还有一点,既使GPIO复用不成功,RTP的温度测量功能也应该产生中断吧

对, 理论上会有中断的。

离线

楼主 #24 2019-02-12 16:12:34

Peter
会员
注册时间: 2018-12-12
已发帖子: 36
积分: 36

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

@trigger 仔细看了看手册,F1c100s的RTP确实没有温度测量功能,怪不得 @assert 要把温度屏蔽掉。看来F1c100s与sun4i的RTP有一定的差别,要重新整理下驱动了,不能直接拿来就用。

离线

#25 2019-02-12 16:14:49

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

Peter 说:

@trigger 仔细看了看手册,F1c100s的RTP确实没有温度测量功能,怪不得 @assert 要把温度屏蔽掉。看来F1c100s与sun4i的RTP有一定的差别,要重新整理下驱动了,不能直接拿来就用。

温度的可以用,只是手册为了避免麻烦没有写上,或许是稳定性一致性等问题。





离线

楼主 #26 2019-02-12 16:19:31

Peter
会员
注册时间: 2018-12-12
已发帖子: 36
积分: 36

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

@晕哥 能否请 @assert 断言哥赐教完整的sun4i-ts.c文件?驱动小白看截图有些不太明白 tongue

离线

#27 2019-02-12 16:54:10

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

Peter 说:

@晕哥 能否请 @assert 断言哥赐教完整的sun4i-ts.c文件?驱动小白看截图有些不太明白 tongue

他比较忙, 可能要晚点才能答复。





离线

楼主 #28 2019-02-13 09:04:40

Peter
会员
注册时间: 2018-12-12
已发帖子: 36
积分: 36

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

用Xboot验证了一下,硬件连接没有问题......
1281336563.jpg

离线

#29 2019-02-13 09:06:11

山无棱
会员
注册时间: 2017-10-23
已发帖子: 116
积分: 116

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

Peter 说:

用Xboot验证了一下,硬件连接没有问题......
https://whycan.cn/files/members/1308/1281336563.jpg

xboo触摸屏可以使用对吗?

离线

楼主 #30 2019-02-13 09:16:45

Peter
会员
注册时间: 2018-12-12
已发帖子: 36
积分: 36

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

@山无棱  是的,Xboot的触摸屏可以用

离线

#31 2019-02-13 09:19:07

山无棱
会员
注册时间: 2017-10-23
已发帖子: 116
积分: 116

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

Peter 说:

@山无棱  是的,Xboot的触摸屏可以用

太好了,你用哪个分支? sha256sum是多少?我也试一试

离线

楼主 #32 2019-02-13 09:45:39

Peter
会员
注册时间: 2018-12-12
已发帖子: 36
积分: 36

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

@山无棱 就是github上的master分支,刚pull下来的 lol

离线

#33 2019-02-13 09:52:48

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

刚刚Q群上面一位好友 @饺子 告诉我,

修改 drivers/pinctrl/sunxi/pinctrl-suniv.c, 加入:

static const struct sunxi_pinctrl_desc suniv_pinctrl_data = {
        .pins = suniv_pins,
        .npins = ARRAY_SIZE(suniv_pins),
        .irq_bank_base = 1,
        .irq_banks = 3,
};

我没有看明白原理, 你可以先试一试。


参考这个帖子:  http://bbs.ilichee.cc/t/how-to-assign-gpio-interrupt-solved/172





离线

楼主 #34 2019-02-13 10:18:36

Peter
会员
注册时间: 2018-12-12
已发帖子: 36
积分: 36

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

@晕哥 试过了,没有效果。看了参考贴,也没搞明白

离线

#35 2019-02-13 10:35:22

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

Peter 说:

@晕哥 试过了,没有效果。看了参考贴,也没搞明白

这就有点尴尬了,

想了一下,这个地方应该是 IO 的中断, 而不是 RTP 的中断, 所以方向还是错了。





离线

楼主 #36 2019-02-13 10:39:23

Peter
会员
注册时间: 2018-12-12
已发帖子: 36
积分: 36

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

@晕哥 现在最尴尬的是连PA0..3的RTP复用也没搞定,不知该如何配置。。。

离线

#37 2019-02-13 11:32:52

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

Peter 说:

@晕哥 现在最尴尬的是连PA0..3的RTP复用也没搞定,不知该如何配置。。。

rtp: rtp@1c24800 {
    compatible = "allwinner,sun4i-a10-ts";
    reg = <0x01c24800 0x100>;
    interrupts = <20>;
    allwinner,ts-attached;
    #thermal-sensor-cells = <0>;
    pinctrl-names = "default";
    pinctrl-0 = <&rtp_pins>;

};

改成上面的试一试.





离线

楼主 #38 2019-02-13 11:39:25

Peter
会员
注册时间: 2018-12-12
已发帖子: 36
积分: 36

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

改了,寄存器写入成功! big_smile

不过还是没有中断

最近编辑记录 Peter (2019-02-13 11:42:33)

离线

#39 2019-02-13 11:42:52

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

Peter 说:

改了,成功,;)  666!

恭喜恭喜!

现在有中断了?可以点了吗?

我看了 A10的原理图
http://hands.com/~lkcl/eoma/A10-EVB-V1-2-20110726.pdf

发现 A10/A20 引脚足够多, 所以RTP引脚没有复用, 所以表现在 dts 上有些差异。





离线

#40 2019-02-13 11:43:45

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

Peter 说:

改了,寄存器写入成功! big_smile

不过还是没有中断

那还得继续调   sad





离线

楼主 #41 2019-02-13 11:55:54

Peter
会员
注册时间: 2018-12-12
已发帖子: 36
积分: 36

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

从A10与F1C100s的手册来看,TP模块的寄存器,基本上没有差异,所以sun4i-ts的驱动应该是没有问题的。问题可能主要还是出现在中断的配置上。 neutral

离线

#42 2019-04-23 09:41:29

rayfoxjx
会员
注册时间: 2019-04-23
已发帖子: 24
积分: 24

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

这个驱动 TP_CTRL_REG1 TP_EN 位是不是要设置1,第5的一位,我使用 devmem设置就可以中断了。
不知道这样改行不行。
    writel(reg | (1 << 5), ts->base + TP_CTRL1);

离线

#43 2019-04-23 10:10:20

超级萌新
会员
注册时间: 2018-05-04
已发帖子: 408
积分: 407

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

rayfoxjx 说:

这个驱动 TP_CTRL_REG1 TP_EN 位是不是要设置1,第5的一位,我使用 devmem设置就可以中断了。
不知道这样改行不行。
    writel(reg | (1 << 5), ts->base + TP_CTRL1);

看起来没什么问题

试一试看行不行

离线

#44 2019-04-23 10:38:50

rayfoxjx
会员
注册时间: 2019-04-23
已发帖子: 24
积分: 24

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

# cat /proc/interrupts                                                          
           CPU0                                                                 
 16:       4529  sun4i_irq  13 Edge      timer@1c20c00                          
 17:     829674  sun4i_irq  10 Edge      sun6i-spi                              
 18:        361  sun4i_irq  29 Edge      1c0c000.lcd-controller                 
 19:       6117  sun4i_irq  23 Edge      sunxi-mmc                              
 23:        137  sun4i_irq  20 Edge      sun4i-ts                               
 24:        486  sun4i_irq   1 Edge      ttyS0                                  
 25:         87  sun4i_irq  26 Edge      musb-hdrc.1.auto                       
 61:          1  sunxi_pio_edge  34 Edge      usb0-id-det                       
Err:          0 

中断来了

离线

#45 2019-04-23 10:54:34

超级萌新
会员
注册时间: 2018-05-04
已发帖子: 408
积分: 407

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

厉害厉害

只要改上面那一处吗?

那 tslib 测试应该没有问题了。

最近编辑记录 超级萌新 (2019-04-23 10:57:53)

离线

#46 2019-04-23 11:07:07

rayfoxjx
会员
注册时间: 2019-04-23
已发帖子: 24
积分: 24

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

超级萌新 说:

厉害厉害

只要改上面那一处吗?

那 tslib 测试应该没有问题了。

可以试一试,不知道这样对不对

离线

#47 2019-04-23 11:29:12

超级萌新
会员
注册时间: 2018-05-04
已发帖子: 408
积分: 407

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

我感觉问题不大了,期待下续集!

离线

#48 2019-04-23 12:47:02

阿黄
会员
注册时间: 2018-10-03
已发帖子: 298
积分: 133

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

rayfoxjx 说:
# cat /proc/interrupts                                                          
           CPU0                                                                 
 16:       4529  sun4i_irq  13 Edge      timer@1c20c00                          
 17:     829674  sun4i_irq  10 Edge      sun6i-spi                              
 18:        361  sun4i_irq  29 Edge      1c0c000.lcd-controller                 
 19:       6117  sun4i_irq  23 Edge      sunxi-mmc                              
 23:        137  sun4i_irq  20 Edge      sun4i-ts                               
 24:        486  sun4i_irq   1 Edge      ttyS0                                  
 25:         87  sun4i_irq  26 Edge      musb-hdrc.1.auto                       
 61:          1  sunxi_pio_edge  34 Edge      usb0-id-det                       
Err:          0 

中断来了

sun4i-ts.rar

最近编辑记录 阿黄 (2019-04-23 12:47:32)

离线

#49 2019-04-23 12:49:54

阿黄
会员
注册时间: 2018-10-03
已发帖子: 298
积分: 133

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

我是修改
#define SUN4I_TP_EN(x)    ((x) << 5)
#define SUN4I_TP_DUAL_EN(x)    ((x) << 6)
#define SUN4I_TP_CALI_EN(x)    ((x) << 7)

并且
        reg |= SUN4I_TP_EN(1);
        reg |= TP_MODE_EN(0);
        reg |= ADC_CHAN_SELECT(2);

OK

离线

#50 2019-04-23 13:31:31

rayfoxjx
会员
注册时间: 2019-04-23
已发帖子: 24
积分: 24

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

阿黄 说:

我是修改
#define SUN4I_TP_EN(x)    ((x) << 5)
#define SUN4I_TP_DUAL_EN(x)    ((x) << 6)
#define SUN4I_TP_CALI_EN(x)    ((x) << 7)

并且
        reg |= SUN4I_TP_EN(1);
        reg |= TP_MODE_EN(0);
        reg |= ADC_CHAN_SELECT(2);

OK

完全正确

离线

#51 2019-04-23 13:46:16

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

感谢各位分享, 有空拿出我尘封已久的 licheepi nano 出来晒晒.





离线

#52 2019-05-02 18:01:06

超级萌新
会员
注册时间: 2018-05-04
已发帖子: 408
积分: 407

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

原来自带的触摸搞定了啊,我还在用ns2009,捂脸捂脸

离线

#53 2019-07-31 10:58:23

傅伟清
会员
注册时间: 2019-07-17
已发帖子: 39
积分: 39

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

我把drivers/input/touchscreen下的sun4i_ts,Makefile 改为obj-y +=sun4i_ts.o,编译内核出错,我的操作有问题吗,照着您的操作想调电阻屏的,报错undefined reference to `devm_hwmon_device_register_with_groups'

离线

#54 2019-07-31 11:12:02

超级萌新
会员
注册时间: 2018-05-04
已发帖子: 408
积分: 407

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

不用修改Makefile, 只要在 menuconfig 配置即可。

离线

#55 2019-07-31 18:01:39

傅伟清
会员
注册时间: 2019-07-17
已发帖子: 39
积分: 39

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

用的是华嵌c200的内核源码,编译不到内核里去,
drivers/input/touchscreen/suniv-ts.o: In function `sun4i_ts_probe':
suniv-ts.c:(.text+0x458): undefined reference to `devm_hwmon_device_register_with_groups'
Makefile:999: recipe for target 'vmlinux' failed
make: *** [vmlinux] Error 1
想不出问题在哪

离线

#56 2019-07-31 18:45:03

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

.config 里面那个 hwmon 可能要打开





离线

#57 2019-08-01 10:37:35

shaoxi2010
会员
注册时间: 2019-06-13
已发帖子: 363
积分: 312

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

emmmmmm,其实BSP代码里面以及附带了触摸驱动了,不过我也用的主线的改的,给坛子点小贡献(顺便吐槽下这附件上传好难用)

离线

#58 2019-08-01 10:38:29

shaoxi2010
会员
注册时间: 2019-06-13
已发帖子: 363
积分: 312

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

touch_tar.gz
还需要点下才能复制,难受。。。

离线

#59 2019-08-01 10:54:14

傅伟清
会员
注册时间: 2019-07-17
已发帖子: 39
积分: 39

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

超级萌新 说:

不用修改Makefile, 只要在 menuconfig 配置即可。

menuconfig里没有那个sun4i的选项的,应该是依赖没开

离线

#60 2019-08-01 11:40:32

傅伟清
会员
注册时间: 2019-07-17
已发帖子: 39
积分: 39

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

shaoxi2010 说:

touch_tar.gz
还需要点下才能复制,难受。。。

谢谢,这个能适配C200的吧:p

离线

#61 2019-08-01 13:56:51

shaoxi2010
会员
注册时间: 2019-06-13
已发帖子: 363
积分: 312

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

傅伟清 说:
shaoxi2010 说:

touch_tar.gz
还需要点下才能复制,难受。。。

谢谢,这个能适配C200的吧:p

我没测试过,没空折腾这个

离线

#62 2019-08-01 14:37:42

傅伟清
会员
注册时间: 2019-07-17
已发帖子: 39
积分: 39

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

将华嵌源码下的menuconfig里的deviceXX-》Hardware Monitoring support 打开就能找到全志4i的触摸驱动了,并且能够成功编译进内核,但是/dev下无/input,问题是不是出在设备树上导致没识别,我看日志里也没有关于rtp的日志。

离线

#63 2019-08-01 14:38:14

傅伟清
会员
注册时间: 2019-07-17
已发帖子: 39
积分: 39

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

shaoxi2010 说:
傅伟清 说:
shaoxi2010 说:

touch_tar.gz
还需要点下才能复制,难受。。。

谢谢,这个能适配C200的吧:p

我没测试过,没空折腾这个

谢谢

离线

#64 2019-08-02 11:00:01

傅伟清
会员
注册时间: 2019-07-17
已发帖子: 39
积分: 39

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

rayfoxjx 说:
阿黄 说:

我是修改
#define SUN4I_TP_EN(x)    ((x) << 5)
#define SUN4I_TP_DUAL_EN(x)    ((x) << 6)
#define SUN4I_TP_CALI_EN(x)    ((x) << 7)

并且
        reg |= SUN4I_TP_EN(1);
        reg |= TP_MODE_EN(0);
        reg |= ADC_CHAN_SELECT(2);

OK

完全正确

编译完后,cat event0,一直上报乱码(事件),不该是我触摸了才上报吗

离线

#65 2019-08-02 12:39:45

晕哥
管理员
所在地: 微信 whycan_cn
注册时间: 2017-09-06
已发帖子: 9,223
积分: 9197

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

https://whycan.cn/t_1632.html#p8974

看下接线方法对不对





离线

#66 2019-08-02 14:59:49

傅伟清
会员
注册时间: 2019-07-17
已发帖子: 39
积分: 39

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

晕哥 说:

https://whycan.cn/t_1632.html#p8974

看下接线方法对不对

看了我的板子原理图,接线没问题,拔了屏还是一直上报事件

离线

#67 2019-08-02 15:17:23

傅伟清
会员
注册时间: 2019-07-17
已发帖子: 39
积分: 39

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

傅伟清 说:

将华嵌源码下的menuconfig里的deviceXX-》Hardware Monitoring support 打开就能找到全志4i的触摸驱动了,并且能够成功编译进内核,但是/dev下无/input,问题是不是出在设备树上导致没识别,我看日志里也没有关于rtp的日志。

问题是设备树没配置好

离线

#68 2019-08-05 17:21:26

傅伟清
会员
注册时间: 2019-07-17
已发帖子: 39
积分: 39

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

确定这么操作正常吗,仔细比对一下,sun4i-ts有的寄存器位错了,有的无效位的寄存器这个驱动里的代码也使用了

离线

#69 2019-08-07 18:16:13

傅伟清
会员
注册时间: 2019-07-17
已发帖子: 39
积分: 39

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

傅伟清 说:

确定这么操作正常吗,仔细比对一下,sun4i-ts有的寄存器位错了,有的无效位的寄存器这个驱动里的代码也使用了

是以上,引脚配置不成功的问题导致一直误判进中断,感谢各位大佬,嘿嘿

离线

#70 2019-09-06 23:12:09

nuvoton
会员
注册时间: 2019-06-17
已发帖子: 59
积分: 59

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

阿黄 说:

我是修改
#define SUN4I_TP_EN(x)    ((x) << 5)
#define SUN4I_TP_DUAL_EN(x)    ((x) << 6)
#define SUN4I_TP_CALI_EN(x)    ((x) << 7)

并且
        reg |= SUN4I_TP_EN(1);
        reg |= TP_MODE_EN(0);
        reg |= ADC_CHAN_SELECT(2);

OK

搞定了, 非常感谢!

离线

#71 2020-05-14 17:57:37

kin
会员
注册时间: 2020-04-06
已发帖子: 26
积分: 40.5

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

傅伟清 说:

编译完后,cat event0,一直上报乱码(事件),不该是我触摸了才上报吗

请问你这个问题是怎么解决的?能详细说说吧?我现在也遇到这个问题,cat event0一直有内容,不管有没有触摸

离线

#72 2020-05-21 16:14:37

auroal1
会员
注册时间: 2020-05-21
已发帖子: 7
积分: 7

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

从A10与F1C100s的手册来看,TP模块的寄存器,基本上没有差异,所以sun4i-ts的驱动应该是没有问题的。问题可能主要还是出现在中断的配置上。

离线

#73 2020-06-22 00:13:53

zl308424
会员
注册时间: 2020-03-19
已发帖子: 14
积分: 4

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

阿黄 说:

我是修改
#define SUN4I_TP_EN(x)    ((x) << 5)
#define SUN4I_TP_DUAL_EN(x)    ((x) << 6)
#define SUN4I_TP_CALI_EN(x)    ((x) << 7)

并且
        reg |= SUN4I_TP_EN(1);
        reg |= TP_MODE_EN(0);
        reg |= ADC_CHAN_SELECT(2);

OK

感谢大家分享,按帖子里面说明修改就能成功,只是在设备树修改里面要加上一句status = "okay"才行

离线

#74 2020-11-24 17:07:35

willX
会员
注册时间: 2019-09-06
已发帖子: 40
积分: 24

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

问下楼上的大神,我使用的是nanopi的4.15的内核。一直找不到CONFIG_TOUCHSCREEN_SUN4I这个选项,hwmon已经打开了。
但是在  General setup  ---> Input device support  ---> Touchscreens  ---> 下面找不到与sunxiv相关的选项,请问这个是什么原因?
我在.config文件中也没有找到CONFIG_TOUCHSCREEN_SUN4I这个选项,这是不是就是说kernel 4.15代码中没有带f1c200s的触摸驱动?

离线

#75 2023-05-17 15:09:50

123546
会员
注册时间: 2023-04-18
已发帖子: 12
积分: 2

Re: 荔枝派Nano电阻触摸屏(RTP)使用主线内核无法进中断,大神帮忙看一下

楼主我的一直触发中断是什么原因,校准也没反应

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn