问题描述:本来屏幕好使,尝试移植ns2009电阻触摸驱动后,开机uboot屏幕有显示,启动内核时,屏幕一点一点变黑,进入系统后evtest 测试触摸有数据。
运行LVGL程序提示
Error: cannot open framebuffer device: No such file or directory
下面是移植驱动的步骤,麻烦各位大佬瞅瞅哪里步骤不对,指点一二,小弟感激不尽^_^
将ns2009.c放到drivers/input/touchscreen目录下
drivers/input/touchscreen/Makefile 增加了
obj-$(CONFIG_TOUCHSCREEN_NS2009) += ns2009.o
drivers/input/touchscreen/Kconfig 增加了
config TOUCHSCREEN_NS2009
tristate "Nsiway NS2009 touchscreen"
depends on I2C
select INPUT_POLLDEV
help
Say Y here to enable Nsiway NS2009 resistive touchscreen
controller support.
If unsure, say N.
To compile this driver as a module, choose M here: the
module will be called ns2009.
linux/arch/arm/boot/dts下suniv.dtsi增加了
i2c0: i2c@1C27000 {
compatible = "allwinner,sun6i-a31-i2c";
reg = <0x01C27000 0x400>;
interrupts = <7>;
clocks = <&ccu CLK_BUS_I2C0>;
resets = <&ccu RST_BUS_I2C0>;
pinctrl-names = "default";
pinctrl-0 = <&i2c0_pins>;
status = "disabled";
#address-cells = <1>;
#size-cells = <0>;
};
i2c0_pins: i2c0 {
pins = "PE11", "PE12";
function = "i2c0";
};
twi0: twi@1c27000 {
compatible = "allwinner,sun6i-a31-i2c";
reg = <0x01c27000 0x400>;
interrupts = <7>;
clocks = <&ccu CLK_BUS_I2C0>;
clock-names = "apb";
resets = <&ccu RST_BUS_I2C0>;
clock-frequency = <100000>;
#address-cells = <1>;
#size-cells = <0>;
};
linux/arch/arm/boot/dts下suniv-f1c100s-licheepi-nano.dts 增加了
&pio {
ts_reset_pin: ts_reset_pin@0 {
pins = "PE9";
function = "gpio_out";
};
twi0_pins: twi0-pin-pd {
pins = "PD0", "PD12";
function = "i2c0";
};
uart1_pins: uart1-pin-pa {
pins = "PA2", "PA3";
function = "uart1";
};
};
&twi0 {
pinctrl-names = "default";
pinctrl-0 = <&twi0_pins>;
status = "okay";
ts: twi0@0x48 {
compatible = "nsiway,ns2009";
i2c-max-frequency = <100000>;
reg = <0x48>;
status = "okay";
};
};
这是启动log
U-Boot SPL 2018.01-05679-g013ca457fd-dirty (Aug 02 2020 - 05:51:43)
DRAM: 64 MiB
Trying to boot from MMC1
Card did not respond to voltage select!
mmc_init: -95, time 22
spl: mmc init failed with error: -95
Trying to boot from sunxi SPI
U-Boot 2018.01-05679-g013ca457fd-dirty (Aug 02 2020 - 05:51:43 +0800) Allwinner Technology
DRAM: 64 MiB
MMC: SUNXI SD/MMC: 0
SF: Detected w25q256 with page size 256 Bytes, erase size 4 KiB, total 32 MiB
*** Warning - bad CRC, using default environment
Setting up a 480x272 lcd console (overscan 0x0)
In: serial@1c25000
Out: serial@1c25000
Err: serial@1c25000
Net: No ethernet found.
starting USB...
No controllers found
Hit any key to stop autoboot: 0
SF: Detected w25q256 with page size 256 Bytes, erase size 4 KiB, total 32 MiB
device 0 offset 0x100000, size 0x4000
SF: 16384 bytes @ 0x100000 Read: OK
device 0 offset 0x110000, size 0x400000
SF: 4194304 bytes @ 0x110000 Read: OK
## Flattened Device Tree blob at 80c00000
Booting using the fdt blob at 0x80c00000
Loading Device Tree to 816fa000, end 816ff2ac ... OK
Starting kernel ...
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.15.0-rc8-licheepi-nano+ (root@kali) (gcc version 7.2.1 20171011 (Linaro GCC 7.2-2017.11)) #9 Wed Aug 19 11:27:29 CST 2020
[ 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: 16002
[ 0.000000] Kernel command line: console=ttyS0,115200 panic=5 rootwait root=/dev/mtdblock3 rw rootfstype=jffs2 mem=63M vt.global_cursor_default=0
[ 0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[ 0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[ 0.000000] Memory: 54132K/64512K available (6144K kernel code, 239K rwdata, 1440K rodata, 1024K init, 249K bss, 10380K reserved, 0K cma-reserved, 0K highmem)
[ 0.000000] Virtual kernel memory layout:
[ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
[ 0.000000] fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
[ 0.000000] vmalloc : 0xc4000000 - 0xff800000 ( 952 MB)
[ 0.000000] lowmem : 0xc0000000 - 0xc3f00000 ( 63 MB)
[ 0.000000] pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB)
[ 0.000000] modules : 0xbf000000 - 0xbfe00000 ( 14 MB)
[ 0.000000] .text : 0x(ptrval) - 0x(ptrval) (7136 kB)
[ 0.000000] .init : 0x(ptrval) - 0x(ptrval) (1024 kB)
[ 0.000000] .data : 0x(ptrval) - 0x(ptrval) ( 240 kB)
[ 0.000000] .bss : 0x(ptrval) - 0x(ptrval) ( 250 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.000046] 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.000672] Console: colour dummy device 80x30
[ 0.000763] Calibrating delay loop... 203.16 BogoMIPS (lpj=1015808)
[ 0.070232] pid_max: default: 32768 minimum: 301
[ 0.070547] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.070586] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.072030] CPU: Testing write buffer coherency: ok
[ 0.073727] Setting up static identity map for 0x80100000 - 0x80100058
[ 0.076270] devtmpfs: initialized
[ 0.083570] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.083628] futex hash table entries: 256 (order: -1, 3072 bytes)
[ 0.083891] pinctrl core: initialized pinctrl subsystem
[ 0.085894] NET: Registered protocol family 16
[ 0.087458] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.089228] cpuidle: using governor menu
[ 0.115483] SCSI subsystem initialized
[ 0.115808] usbcore: registered new interface driver usbfs
[ 0.115950] usbcore: registered new interface driver hub
[ 0.116159] usbcore: registered new device driver usb
[ 0.116601] pps_core: LinuxPPS API ver. 1 registered
[ 0.116625] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[ 0.116685] PTP clock support registered
[ 0.117166] Advanced Linux Sound Architecture Driver Initialized.
[ 0.118785] clocksource: Switched to clocksource timer
[ 0.145414] NET: Registered protocol family 2
[ 0.146831] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.146903] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.146952] TCP: Hash tables configured (established 1024 bind 1024)
[ 0.147231] UDP hash table entries: 256 (order: 0, 4096 bytes)
[ 0.147283] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[ 0.147750] NET: Registered protocol family 1
[ 0.149091] RPC: Registered named UNIX socket transport module.
[ 0.149133] RPC: Registered udp transport module.
[ 0.149149] RPC: Registered tcp transport module.
[ 0.149165] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 0.151493] NetWinder Floating Point Emulator V0.97 (double precision)
[ 0.153315] Initialise system trusted keyrings
[ 0.153867] workingset: timestamp_bits=30 max_order=14 bucket_order=0
[ 0.171364] NFS: Registering the id_resolver key type
[ 0.171443] Key type id_resolver registered
[ 0.171465] Key type id_legacy registered
[ 0.171580] jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
[ 0.186212] Key type asymmetric registered
[ 0.186254] Asymmetric key parser 'x509' registered
[ 0.186465] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
[ 0.186497] io scheduler noop registered
[ 0.186515] io scheduler deadline registered
[ 0.187310] io scheduler cfq registered (default)
[ 0.187343] io scheduler mq-deadline registered
[ 0.187362] io scheduler kyber registered
[ 0.188500] sun4i-usb-phy 1c13400.phy: Couldn't request ID GPIO
[ 0.198197] suniv-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver
[ 0.370515] Serial: 8250/16550 driver, 8 ports, IRQ sharing disabled
[ 0.377175] console [ttyS0] disabled
[ 0.397427] 1c25000.serial: ttyS0 at MMIO 0x1c25000 (irq = 24, base_baud = 6250000) is a 16550A
[ 0.873969] console [ttyS0] enabled
[ 0.884796] panel-simple panel: panel supply power not found, using dummy regulator
[ 0.923334] brd: module loaded
[ 0.945187] loop: module loaded
[ 0.949281] SCSI Media Changer driver v0.25
[ 0.956943] m25p80 spi0.0: found w25q256, expected w25q128
[ 0.962765] m25p80 spi0.0: w25q256 (32768 Kbytes)
[ 0.968433] 4 ofpart partitions found on MTD device spi0.0
[ 0.974040] Creating 4 MTD partitions on "spi0.0":
[ 0.978898] 0x000000000000-0x000000100000 : "u-boot"
[ 0.987799] rfd_ftl: no RFD magic found in 'u-boot'
[ 0.994981] ftl_cs: FTL header not found.
[ 1.000713] 0x000000100000-0x000000110000 : "dtb"
[ 1.006713] ftl_cs: FTL header not found.
[ 1.012357] 0x000000110000-0x000000510000 : "kernel"
[ 1.028545] rfd_ftl: no RFD magic found in 'kernel'
[ 1.035754] ftl_cs: FTL header not found.
[ 1.041453] 0x000000510000-0x000001000000 : "rootfs"
[ 1.074700] rfd_ftl: no RFD magic found in 'rootfs'
[ 1.081911] ftl_cs: FTL header not found.
[ 1.088050] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 1.094706] ehci-platform: EHCI generic platform driver
[ 1.100315] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 1.106536] ohci-platform: OHCI generic platform driver
[ 1.112234] usbcore: registered new interface driver usb-storage
[ 1.119248] udc-core: couldn't find an available UDC - added [g_cdc] to list of pending drivers
[ 1.128303] i2c /dev entries driver
[ 1.134632] input: ns2009_ts as /devices/platform/soc/1c27000.twi/i2c-0/0-0048/input/input0
[ 1.198904] sunxi-mmc 1c0f000.mmc: base:0xdca4e2c9 irq:19
[ 1.206388] usbcore: registered new interface driver usbhid
[ 1.212088] usbhid: USB HID core driver
[ 1.234775] NET: Registered protocol family 17
[ 1.239587] Key type dns_resolver registered
[ 1.246229] Loading compiled-in X.509 certificates
[ 1.259679] suniv-pinctrl 1c20800.pinctrl: pin PD0 already requested by 1c27000.twi; cannot claim for 1c0c000.lcd-controller
[ 1.270999] suniv-pinctrl 1c20800.pinctrl: pin-96 (1c0c000.lcd-controller) status -22
[ 1.278881] suniv-pinctrl 1c20800.pinctrl: could not request pin 96 (PD0) from group PD0 on device 1c20800.pinctrl
[ 1.289334] sun4i-tcon 1c0c000.lcd-controller: Error applying setting, reverse things back
[ 1.297629] sun4i-tcon: probe of 1c0c000.lcd-controller failed with error -22
[ 1.306354] usb_phy_generic usb_phy_generic.0.auto: usb_phy_generic.0.auto supply vcc not found, using dummy regulator
[ 1.318239] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver
[ 1.324165] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 1
[ 1.334445] hub 1-0:1.0: USB hub found
[ 1.338961] hub 1-0:1.0: 1 port detected
[ 1.345821] using random self ethernet address
[ 1.350409] using random host ethernet address
[ 1.356619] usb0: HOST MAC 72:d3:b8:20:13:73
[ 1.361146] usb0: MAC 8a:c6:a6:dc:9e:63
[ 1.365089] g_cdc gadget: CDC Composite Gadget, version: King Kamehameha Day 2008
[ 1.372650] g_cdc gadget: g_cdc ready
[ 1.377875] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[ 1.395405] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[ 1.402223] vcc3v3: disabling
[ 1.405202] ALSA device list:
[ 1.408167] #0: Loopback 1
[ 1.411932] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[ 1.420633] cfg80211: failed to load regulatory.db
[ 1.500288] random: crng init done
[ 3.005526] VFS: Mounted root (jffs2 filesystem) on device 31:3.
[ 3.013471] devtmpfs: mounted
[ 3.020982] Freeing unused kernel memory: 1024K
Starting logging: OK
Starting mdev...
modprobe: can't change directory to '/lib/modules': No such file or directory
Initializing random number generator... done.
Starting network: OK
Welcome to King
离线
看log确实没有framebuffer相关记录了,是不是改了dts?
离线
dts增加了 twi0 和 pio 是不是和 屏幕驱动有冲突呢?
离线
我对比了一下,发现这段初始化frame buffer device的时候,PD0被twi占用了,导致没有fb0。我在改改试试。
多谢 流氓兔,小二大佬^_^
这是正常的
[ 1.227428] sun4i-drm display-engine: bound 1e60000.display-backend (ops 0xc0739c38)
[ 1.236224] sun4i-drm display-engine: bound 1c0c000.lcd-controller (ops 0xc0738f1c)
[ 1.244009] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[ 1.250666] [drm] No driver support for vblank timestamp query.
[ 1.304634] Console: switching to colour frame buffer device 60x34
[ 1.328041] sun4i-drm display-engine: fb0: frame buffer device
[ 1.335169] [drm] Initialized sun4i-drm 1.0.0 20150629 for display-engine on minor 0
这是不正常的
[ 1.259679] suniv-pinctrl 1c20800.pinctrl: pin PD0 already requested by 1c27000.twi; cannot claim for 1c0c000.lcd-controller
[ 1.270999] suniv-pinctrl 1c20800.pinctrl: pin-96 (1c0c000.lcd-controller) status -22
[ 1.278881] suniv-pinctrl 1c20800.pinctrl: could not request pin 96 (PD0) from group PD0 on device 1c20800.pinctrl
[ 1.289334] sun4i-tcon 1c0c000.lcd-controller: Error applying setting, reverse things back
[ 1.297629] sun4i-tcon: probe of 1c0c000.lcd-controller failed with error -22
离线
将 twi0 的引脚从 "PD0", "PD12" 改为 "PE11", "PE12" 后屏幕显示正常,不过触摸不好使,一直报错
[ 288.328130] i2c i2c-0: mv64xxx: I2C bus locked, block: 1, time_left: 0
[ 288.334689] input input0: Poll touch data failed: -110
我在研究研究
离线
我看原理图上NS2009硬件 TWI0 SCK 接 PD0 , TWI0SDA 接 PD12 没问题。
suniv.dtsi中PD0 PD12 已经定义为lcd_rgb666_pins,
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";
};
离线
好的,我接上拉电阻试试
离线
校准了吗?不校准没法用
离线
多谢诸位相助,感谢小二大佬指点!
将 "PD0", "PD12" 从lcd_rgb666_pins中删除, 将twi0_pins的引脚定义为"PD0", "PD12",make clean 后重新编译 设备树,linux内核后,屏幕显示也好使,触摸也有数据了。
lcd_rgb666_pins: lcd-rgb666-pins {
pins = "PD1", "PD2", "PD3", "PD4",
"PD5", "PD6", "PD7", "PD8", "PD9",
"PD10", "PD11", "PD13", "PD14",
"PD15", "PD16", "PD17", "PD18", "PD19",
"PD20", "PD21";
function = "lcd";
};
twi0_pins: twi0-pin-pd {
pins = "PD0", "PD12";
function = "i2c0";
};
离线
嗯嗯,少了PD0 PD12 两个,用于I2C获取触摸输入了。跑LVGL程序感觉没有色差啥的
离线