您尚未登录。

楼主 #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)

离线

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

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

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

晕哥 说:

硬件连接有问题吗?

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

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

离线

楼主 #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;

离线

楼主 #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)

离线

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

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

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

trigger 说:

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

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

离线

楼主 #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";
    };

离线

楼主 #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)

离线

楼主 #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在设备树中的复用配置为什么没有生效。。。

离线

楼主 #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的温度测量功能也应该产生中断吧

离线

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

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

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

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

离线

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

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

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

@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

离线

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

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

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

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

离线

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

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

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

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

离线

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

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

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

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

离线

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

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

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

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

离线

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

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

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

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

离线

楼主 #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)

离线

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

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

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

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

离线

页脚

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

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