notro / fbtft

Linux Framebuffer drivers for small TFT LCD display modules. Development has moved to https://git.kernel.org/cgit/linux/kernel/git/gregkh/staging.git/tree/drivers/staging/fbtft?h=staging-testing
1.84k stars 496 forks source link

Support for Waveshare 3.5 Spotpear #215

Closed sudobrew closed 2 years ago

sudobrew commented 9 years ago

Hello, I have been attempting to set up a Waveshare 3.5 Spotpear , but all I have been getting is a blank bright white screen. I'm was hoping someone with a bit more experience would have more insight.

http://www.amazon.com/Waveshare-Raspberry-Resistive-Interface-Rapsberry-pi/dp/B00OZLG2YS

From the manufacturer: 1,17 - 3.3V 2,4 - 5V 3,5,7,8,10,12,13,15,16 - NC 6,9,14,20,25 - GND 11 - TP_IRQ (Touch Panel interrupt) 18 - LCD_RS (Instructions / Data Register Selection) 19 - LCD_SI / TP_SI (SPI data input) 21 - TP_SO (SPI data output) 22 - RST (Reset) 23 - LCD_SCK / TP_SCK (SPI clock) 24 - LCD_CS (LCD chip selection) 26 TP_CS (Touch Panel chip selection)

I have tried a few variations of: sudo modprobe fbtft_device custom name=fb_ili9341 speed=48000000 gpios=dc:18,reset:22 bgr=1 rotate=270 width=480 height=320

But so far all I get is the HDMI to freeze and the LCD remains bright white.

I was following this forum: https://github.com/notro/rpi-firmware/issues/6 but the solutions provided don't seem to work with this different display. I have the image provided from the manufacturer, but I would rather use the standard Raspian image.

ghost commented 9 years ago

@syl01 have you tried https://github.com/swkim01/waveshare-dtoverlays i get my waveshare 3.5a work by adding this dtoverlay

syl01 commented 9 years ago

@nathan-wu I have tried one whole day switching between dtoverlay=waveshare35a and dtoverlay=ads7846 in config.txt. I have follow exactly on setting up the waveshare35a as stated in the link but no luck. So sad! My touch screen just doesn't respond. I have check my debug log as attached and it seem the waceshare35a are loaded correctly. Is there anything that I set wrongly? One funny senerio that I notice from my setting is only when i issue startx command then my display will transfer from HDMI to the LCD screen. I have chance the setting from fb0 to fb1 but somehow there is nothing display on my LCD until i issue startx.

img_6615

syl01 commented 9 years ago

@nathan-wu

Good News!!! My luck have finally come. Thanks so much nathan.!!! :-) The problem with me is the flex cable problem. I have take out the flexcable and then put it back to try my luck and it just work perfectly... One last question from me, I have problem with cursor that flip whcih mean I pen down on left but cursor go to right. After I do a calibration, it work fine. The calibration screen ask me to save the section to /etc/X11/xorg.conf.d/99-calibration.conf to make it permanent. I have created the file but the problem is after reboot then the setting will gone. Do you encounter that ? Thank you very much. :-)

juhovh commented 9 years ago

@syl01 try /usr/share/X11/xorg.conf.d/99-calibration.conf instead

epicnerdrage commented 8 years ago

Can someone please help me?

I also have the waveshare 3.5 spotpear and I have followed all of the advice here (thanks to everyone!).

I am using the retropie image and it boots fine, but I am still only getting the emulationstation to show on HDMI despite changing settings to FB1.

When my device boots, the screen initializes from bright white to black, but I dont see anything. If I console in and startx then I get the retropie console showing on the LCD, but still no emulationstation.

Here is the wall of text from DMESG, can anyone tell me whats going on? I really need the system to boot to LCD.

pi@retropie ~ $ dmesg [ 0.000000] Booting Linux on physical CPU 0xf00 [ 0.000000] Initializing cgroup subsys cpuset [ 0.000000] Initializing cgroup subsys cpu [ 0.000000] Initializing cgroup subsys cpuacct [ 0.000000] Linux version 4.0.7-v7+ (pi@raspi2) (gcc version 4.8.3 20140106 (prerelease) (crosstool-NG linaro-1.13.1-4.8-2014.01 - Linaro GCC 2013.11) ) #1 SMP PREEMPT Sat Jul 11 20:44:05 CEST 2015 [ 0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d [ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache [ 0.000000] Machine model: Raspberry Pi 2 Model B Rev 1.1 [ 0.000000] cma: Reserved 8 MiB at 0x2e800000 [ 0.000000] Memory policy: Data cache writealloc [ 0.000000] On node 0 totalpages: 192512 [ 0.000000] free_area_init_node: node 0, pgdat 808404c0, node_mem_map ae156000 [ 0.000000] Normal zone: 1692 pages used for memmap [ 0.000000] Normal zone: 0 pages reserved [ 0.000000] Normal zone: 192512 pages, LIFO batch:31 [ 0.000000] [bcm2709_smp_init_cpus] enter (8660->f3003010) [ 0.000000] [bcm2709_smp_init_cpus] ncores=4 [ 0.000000] PERCPU: Embedded 11 pages/cpu @ae11d000 s16128 r8192 d20736 u45056 [ 0.000000] pcpu-alloc: s16128 r8192 d20736 u45056 alloc=11*4096 [ 0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3 [ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 190820 [ 0.000000] Kernel command line: dma.dmachans=0x7f35 bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2709.boardrev=0xa01041 bcm2709.serial=0xd7f5e728 smsc95xx.macaddr=B8:27:EB:F5:E7:28 bcm2708_fb.fbswap=1 bcm2709.disk_led_gpio=47 bcm2709.disk_led_active_low=0 sdhci-bcm2708.emmc_clock_freq=250000000 vc_mem.mem_base=0x3dc00000 vc_mem.mem_size=0x3f000000 dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait [ 0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes) [ 0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes) [ 0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes) [ 0.000000] Memory: 744784K/770048K available (5885K kernel code, 378K rwdata, 1784K rodata, 400K init, 757K bss, 17072K reserved, 8192K cma-reserved) [ 0.000000] Virtual kernel memory layout: [ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB) [ 0.000000] fixmap : 0xffc00000 - 0xfff00000 (3072 kB) [ 0.000000] vmalloc : 0xaf800000 - 0xff000000 (1272 MB) [ 0.000000] lowmem : 0x80000000 - 0xaf000000 ( 752 MB) [ 0.000000] modules : 0x7f000000 - 0x80000000 ( 16 MB) [ 0.000000] .text : 0x80008000 - 0x8078575c (7670 kB) [ 0.000000] .init : 0x80786000 - 0x807ea000 ( 400 kB) [ 0.000000] .data : 0x807ea000 - 0x80848a64 ( 379 kB) [ 0.000000] .bss : 0x80848a64 - 0x809061cc ( 758 kB) [ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1 [ 0.000000] Preemptible hierarchical RCU implementation. [ 0.000000] Additional per-CPU info printed with stalls. [ 0.000000] NR_IRQS:608 [ 0.000000] Architected cp15 timer(s) running at 19.20MHz (virt). [ 0.000014] sched_clock: 56 bits at 19MHz, resolution 52ns, wraps every 3579139424256ns [ 0.000036] Switching to timer-based delay loop, resolution 52ns [ 0.000315] Console: colour dummy device 80x30 [ 0.002012] console [tty1] enabled [ 0.002078] Calibrating delay loop (skipped), value calculated using timer frequency.. 38.40 BogoMIPS (lpj=192000) [ 0.002181] pid_max: default: 32768 minimum: 301 [ 0.002557] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes) [ 0.002626] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes) [ 0.003937] Initializing cgroup subsys blkio [ 0.004024] Initializing cgroup subsys memory [ 0.004097] Initializing cgroup subsys devices [ 0.004159] Initializing cgroup subsys freezer [ 0.004234] Initializing cgroup subsys net_cls [ 0.004357] CPU: Testing write buffer coherency: ok [ 0.004479] ftrace: allocating 20007 entries in 59 pages [ 0.053342] CPU0: update cpu_capacity 1024 [ 0.053425] CPU0: thread -1, cpu 0, socket 15, mpidr 80000f00 [ 0.053473] [bcm2709_smp_prepare_cpus] enter [ 0.053629] Setting up static identity map for 0x54ef70 - 0x54efa4 [ 0.113225] [bcm2709_boot_secondary] cpu:1 started (0) 17 [ 0.113531] [bcm2709_secondary_init] enter cpu:1 [ 0.113585] CPU1: update cpu_capacity 1024 [ 0.113595] CPU1: thread -1, cpu 1, socket 15, mpidr 80000f01 [ 0.133206] [bcm2709_boot_secondary] cpu:2 started (0) 18 [ 0.133459] [bcm2709_secondary_init] enter cpu:2 [ 0.133492] CPU2: update cpu_capacity 1024 [ 0.133500] CPU2: thread -1, cpu 2, socket 15, mpidr 80000f02 [ 0.153246] [bcm2709_boot_secondary] cpu:3 started (0) 17 [ 0.153490] [bcm2709_secondary_init] enter cpu:3 [ 0.153520] CPU3: update cpu_capacity 1024 [ 0.153528] CPU3: thread -1, cpu 3, socket 15, mpidr 80000f03 [ 0.153621] Brought up 4 CPUs [ 0.153756] SMP: Total of 4 processors activated (153.60 BogoMIPS). [ 0.153798] CPU: All CPU(s) started in SVC mode. [ 0.154841] devtmpfs: initialized [ 0.174491] VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 5 [ 0.175774] pinctrl core: initialized pinctrl subsystem [ 0.180806] NET: Registered protocol family 16 [ 0.186630] DMA: preallocated 4096 KiB pool for atomic coherent allocations [ 0.187875] bcm2709.uart_clock = 3000000 [ 0.192426] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers. [ 0.192498] hw-breakpoint: maximum watchpoint size is 8 bytes. [ 0.192670] Serial: AMBA PL011 UART driver [ 0.192899] 3f201000.uart: ttyAMA0 at MMIO 0x3f201000 (irq = 83, base_baud = 0) is a PL011 rev2 [ 0.674226] console [ttyAMA0] enabled [ 0.678692] bcm2708_vcio 3f00b880.mailbox: mailbox at f300b880 [ 0.755526] bcm2708-dmaengine 3f007000.dma: DMA legacy API manager at f3007000, dmachans=0x7f35 [ 0.764885] bcm2708-dmaengine 3f007000.dma: Load BCM2835 DMA engine driver [ 0.771792] bcm2708-dmaengine 3f007000.dma: dma_debug:0 [ 0.777172] bcm_power: Broadcom power driver [ 0.781468] bcm_power_open() -> 0 [ 0.784801] bcm_power_request(0, 8) [ 0.813983] bcm_mailbox_read -> 00000080, 0 [ 0.818217] bcm_power_request -> 0 [ 0.822276] SCSI subsystem initialized [ 0.826301] usbcore: registered new interface driver usbfs [ 0.831942] usbcore: registered new interface driver hub [ 0.837416] usbcore: registered new device driver usb [ 0.844464] Switched to clocksource arch_sys_counter [ 0.879267] FS-Cache: Loaded [ 0.882569] CacheFiles: Loaded [ 0.897206] NET: Registered protocol family 2 [ 0.902884] TCP established hash table entries: 8192 (order: 3, 32768 bytes) [ 0.910149] TCP bind hash table entries: 8192 (order: 4, 65536 bytes) [ 0.916857] TCP: Hash tables configured (established 8192 bind 8192) [ 0.923340] TCP: reno registered [ 0.926629] UDP hash table entries: 512 (order: 2, 16384 bytes) [ 0.932624] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes) [ 0.939471] NET: Registered protocol family 1 [ 0.944281] RPC: Registered named UNIX socket transport module. [ 0.950309] RPC: Registered udp transport module. [ 0.955074] RPC: Registered tcp transport module. [ 0.959799] RPC: Registered tcp NFSv4.1 backchannel transport module. [ 0.967417] hw perfevents: enabled with armv7_cortex_a7 PMU driver, 5 counters available [ 0.977006] futex hash table entries: 1024 (order: 4, 65536 bytes) [ 0.998519] VFS: Disk quotas dquot_6.5.2 [ 1.002831] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes) [ 1.012616] FS-Cache: Netfs 'nfs' registered for caching [ 1.019119] NFS: Registering the id_resolver key type [ 1.024264] Key type id_resolver registered [ 1.028499] Key type id_legacy registered [ 1.035396] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252) [ 1.043017] io scheduler noop registered [ 1.047008] io scheduler deadline registered (default) [ 1.052485] io scheduler cfq registered [ 1.058875] BCM2708FB: allocated DMA memory eec00000 [ 1.063899] BCM2708FB: allocated DMA channel 0 @ f3007000 [ 1.075122] Console: switching to colour frame buffer device 82x26 [ 1.086603] Serial: 8250/16550 driver, 0 ports, IRQ sharing disabled [ 1.094919] uart-pl011 3f201000.uart: no DMA platform data [ 1.102425] KGDB: Registered I/O driver kgdboc [ 1.145255] vc-cma: Videocore CMA driver [ 1.150840] vc-cma: vc_cma_base = 0x00000000 [ 1.157171] vc-cma: vc_cma_size = 0x00000000 (0 MiB) [ 1.164111] vc-cma: vc_cma_initial = 0x00000000 (0 MiB) [ 1.171244] vc-mem: phys_addr:0x00000000 mem_base=0x3dc00000 mem_size:0x3f000000(1008 MiB) [ 1.198039] brd: module loaded [ 1.211907] loop: module loaded [ 1.217573] vchiq: vchiq_init_state: slot_zero = 0xaec80000, is_master = 0 [ 1.226981] Loading iSCSI transport class v2.0-870. [ 1.234298] usbcore: registered new interface driver smsc95xx [ 1.241647] dwc_otg: version 3.00a 10-AUG-2012 (platform bus) [ 1.449243] Core Release: 2.80a [ 1.453870] Setting default values for core params [ 1.460265] Finished setting default values for core params [ 1.667785] Using Buffer DMA mode [ 1.672636] Periodic Transfer Interrupt Enhancement - disabled [ 1.680054] Multiprocessor Interrupt Enhancement - disabled [ 1.687201] OTG VER PARAM: 0, OTG VER FLAG: 0 [ 1.693081] Dedicated Tx FIFOs mode [ 1.698420] WARN::dwc_otg_hcd_init:1047: FIQ DMA bounce buffers: virt = 0xaec14000 dma = 0xeec14000 len=9024 [ 1.711467] FIQ FSM acceleration enabled for : [ 1.711467] Non-periodic Split Transactions [ 1.711467] Periodic Split Transactions [ 1.711467] High-Speed Isochronous Endpoints [ 1.734641] dwc_otg: Microframe scheduler enabled [ 1.734705] WARN::hcd_init_fiq:412: FIQ on core 1 at 0x803f3b68 [ 1.742251] WARN::hcd_init_fiq:413: FIQ ASM at 0x803f3ec4 length 36 [ 1.750157] WARN::hcd_init_fiq:438: MPHI regs_base at 0xaf89a000 [ 1.757818] dwc_otg 3f980000.usb: DWC OTG Controller [ 1.764385] dwc_otg 3f980000.usb: new USB bus registered, assigned bus number 1 [ 1.773364] dwc_otg 3f980000.usb: irq 32, io mem 0x00000000 [ 1.780576] Init: Port Power? op_state=1 [ 1.786059] Init: Power Port (0) [ 1.791073] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002 [ 1.799475] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1 [ 1.808294] usb usb1: Product: DWC OTG Controller [ 1.814564] usb usb1: Manufacturer: Linux 4.0.7-v7+ dwc_otg_hcd [ 1.822033] usb usb1: SerialNumber: 3f980000.usb [ 1.829042] hub 1-0:1.0: USB hub found [ 1.834360] hub 1-0:1.0: 1 port detected [ 1.840230] dwc_otg: FIQ enabled [ 1.840244] dwc_otg: NAK holdoff enabled [ 1.840255] dwc_otg: FIQ split-transaction FSM enabled [ 1.840296] Module dwc_common_port init [ 1.840672] usbcore: registered new interface driver usb-storage [ 1.848450] mousedev: PS/2 mouse device common for all mice [ 1.856463] bcm2835-cpufreq: min=600000 max=900000 [ 1.863020] Driver 'mmcblk' needs updating - please use bus_type methods [ 1.871435] sdhci: Secure Digital Host Controller Interface driver [ 1.879244] sdhci: Copyright(c) Pierre Ossman [ 1.885651] mmc-bcm2835 3f300000.mmc: mmc_debug:0 mmc_debug2:0 [ 1.893105] mmc-bcm2835 3f300000.mmc: DMA channels allocated [ 1.934808] sdhci-pltfm: SDHCI platform and OF driver helper [ 1.949123] ledtrig-cpu: registered to indicate activity on CPUs [ 1.957029] hidraw: raw HID events driver (C) Jiri Kosina [ 1.965351] usbcore: registered new interface driver usbhid [ 1.973584] usbhid: USB HID core driver [ 1.981521] TCP: cubic registered [ 1.986488] Initializing XFRM netlink socket [ 1.993496] NET: Registered protocol family 17 [ 2.001834] Key type dns_resolver registered [ 2.008243] Registering SWP/SWPB emulation handler [ 2.015612] registered taskstats version 1 [ 2.021472] vc-sm: Videocore shared memory driver

[ 2.033959] [vc_sm_connected_init]: end - returning 0 [ 2.034638] Indeed it is in host mode hprt0 = 00021501 [ 2.049043] Waiting for root device /dev/mmcblk0p2... [ 2.063153] mmc0: host does not support reading read-only switch, assuming write-enable [ 2.077914] mmc0: new high speed SDHC card at address aaaa [ 2.085520] mmcblk0: mmc0:aaaa SL32G 29.7 GiB [ 2.093064] mmcblk0: p1 p2 [ 2.191006] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null) [ 2.202345] VFS: Mounted root (ext4 filesystem) readonly on device 179:2. [ 2.214590] usb 1-1: new high-speed USB device number 2 using dwc_otg [ 2.220608] devtmpfs: mounted [ 2.221334] Freeing unused kernel memory: 400K (80786000 - 807ea000) [ 2.235598] Indeed it is in host mode hprt0 = 00001101 [ 2.434901] usb 1-1: New USB device found, idVendor=0424, idProduct=9514 [ 2.443502] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0 [ 2.453464] hub 1-1:1.0: USB hub found [ 2.459219] hub 1-1:1.0: 5 ports detected [ 2.744713] usb 1-1.1: new high-speed USB device number 3 using dwc_otg [ 2.865026] usb 1-1.1: New USB device found, idVendor=0424, idProduct=ec00 [ 2.874173] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0 [ 2.886988] smsc95xx v1.0.4 [ 2.948984] smsc95xx 1-1.1:1.0 eth0: register 'smsc95xx' at usb-3f980000.usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:f5:e7:28 [ 3.380207] udevd[177]: starting version 175 [ 3.956534] bcm2708_spi 3f204000.spi: DMA channel 2 at address 0xf3007200 with irq 77 [ 3.979185] bcm2708_spi 3f204000.spi: DMA channel 4 at address 0xf3007400 with irq 20 [ 4.025092] ads7846 spi0.1: touchscreen, irq 497 [ 4.032958] input: ADS7846 Touchscreen as /devices/platform/soc/3f204000.spi/spi_master/spi0/spi0.1/input/input0 [ 4.085947] fbtft: module is from the staging directory, the quality is unknown, you have been warned. [ 4.102917] fb_ili9486: module is from the staging directory, the quality is unknown, you have been warned. [ 4.120338] fbtft_of_value: regwidth = 16 [ 4.130658] fbtft_of_value: buswidth = 8 [ 4.137729] fbtft_of_value: debug = 0 [ 4.143723] fbtft_of_value: rotate = 90 [ 4.149613] fbtft_of_value: fps = 30 [ 4.709569] graphics fb1: fb_ili9486 frame buffer, 480x320, 300 KiB video memory, 4 KiB DMA buffer memory, fps=33, spi0.0 at 16 MHz [ 4.725246] bcm2708_spi 3f204000.spi: SPI Controller at 0x3f204000 (irq 80) [ 4.734147] bcm2708_spi 3f204000.spi: SPI Controller running in dma mode [ 6.357635] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null) [ 6.589561] random: fbi urandom read with 119 bits of entropy available [ 6.695385] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null) [ 7.373206] random: nonblocking pool is initialized [ 7.418006] i2c /dev entries driver [ 7.468399] flexfb: module is from the staging directory, the quality is unknown, you have been warned. [ 7.527001] fbtft_device: module is from the staging directory, the quality is unknown, you have been warned. [ 7.538350] fbtft_device: SPI devices registered: [ 7.543813] fbtft_device: ads7846 spi0.1 2000kHz 8 bits mode=0x00 [ 7.550512] fbtft_device: ili9486 spi0.0 16000kHz 8 bits mode=0x00 [ 7.557189] fbtft_device: 'fb' Platform devices registered: [ 7.562863] fbtft_device: soc:fb id=-1 pdata? no [ 7.568008] argument 'rotate' illegal value: 360. Setting it to 0. [ 7.574196] fbtft_device: Deleting spi0.0 [ 8.116489] graphics fb1: flexfb frame buffer, 480x320, 300 KiB video memory, 4 KiB DMA buffer memory, fps=20, spi0.0 at 16 MHz [ 8.130386] fbtft_device: GPIOS used by 'flexfb': [ 8.135287] fbtft_device: 'reset' = GPIO25 [ 8.139689] fbtft_device: 'dc' = GPIO24 [ 8.143802] fbtft_device: SPI devices registered: [ 8.148668] fbtft_device: ads7846 spi0.1 2000kHz 8 bits mode=0x00 [ 8.155219] fbtft_device: flexfb spi0.0 16000kHz 8 bits mode=0x00 [ 12.278214] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup [ 13.858555] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0xC1E1 [ 15.869132] Adding 102396k swap on /var/swap. Priority:-1 extents:1 across:102396k SSFS [ 16.434447] Bluetooth: Core ver 2.20 [ 16.434674] NET: Registered protocol family 31 [ 16.434692] Bluetooth: HCI device and connection manager initialized [ 16.434727] Bluetooth: HCI socket layer initialized [ 16.434753] Bluetooth: L2CAP socket layer initialized [ 16.434806] Bluetooth: SCO socket layer initialized [ 16.457082] Bluetooth: RFCOMM TTY layer initialized [ 16.457137] Bluetooth: RFCOMM socket layer initialized [ 16.457172] Bluetooth: RFCOMM ver 1.11 [ 16.463165] Bluetooth: BNEP (Ethernet Emulation) ver 1.3 [ 16.463195] Bluetooth: BNEP filters: protocol multicast [ 16.463227] Bluetooth: BNEP socket layer initialized pi@retropie ~ $

MunhozThiago commented 8 years ago

Hello guys,

First thank you for discussing this topic and @notro for the amazing work on fbtft!

I've bought one of these chinese LCDs, named KeDei, on AliExpress.

The problem is the same of almost everyone: the screen works only wih their kernel image (which they call driver) or full raspbian image. My setup requires updated linux kernel version (4.1+) because of the other drivers I'm using and also because I want to use Ubuntu Mate, not Raspbian.

In their page, they say that the pin assignment is the same described by @sudobrew

1,17 - 3.3V
2,4 - 5V
3,5,7,8,10,12,13,15,16 - NC
6,9,14,20,25 - GND
11 - TP_IRQ (Touch Panel interrupt)
18 - LCD_RS (Instructions / Data Register Selection)
19 - LCD_SI / TP_SI (SPI data input)
21 - TP_SO (SPI data output)
22 - RST (Reset)
23 - LCD_SCK / TP_SCK (SPI clock)
24 - LCD_CS (LCD chip selection)
26 TP_CS (Touch Panel chip selection)

But even after trying everything here and on other threads I'm still not able to setup the LCD by using FBTFT. Other people commented on the selling page saying that it is possible, without any other information about how. Some commented that the ILI9341 driver should work.

I've already tried also to find by lsmod and dmesg what drivers they use on the custom raspbian kernel image, but it seems that they are using another driver, still using ILI9341.

In fact, the only three posts that give some tips are listed below, although none of them have helped me in setting up the LCD correctly.

  1. http://heikki.virekunnas.fi/2015/raspberry-pi-tft/
  2. http://futurice.com/blog/id-like-to-have-some-lcd-on-my-pi
  3. http://marcosgildavid.blogspot.pt/2014/02/getting-ili9341-spi-screen-working-on.html

Could you please give me some advice in how to solve this? I think that if we can find the right way to setup the modprobe could lead us to a solution. Maybe something like the code @fergie4000 created for @sudobrew

modprobe flexfb  width=320  height=480  regwidth=16 init=-1,0xb0,0x0,-1,0x11,-2,250,-1,0x3A,0x55,-1,0xC2,0x44,-1,0xC5,0x00,0x00,0x00,0x00,-1,0xE0,0x0F,0x1F,0x1C,0x0C,0x0F,0x08,0x48,0x98,0x37,0x0A,0x13,0x04,0x11,0x0D,0x00,-1,0xE1,0x0F,0x32,0x2E,0x0B,0x0D,0x05,0x47,0x75,0x37,0x06,0x10,0x03,0x24,0x20,0x00,-1,0xE2,0x0F,0x32,0x2E,0x0B,0x0D,0x05,0x47,0x75,0x37,0x06,0x10,0x03,0x24,0x20,0x00,-1,0x36,0x28,-1,0x11,-1,0x29,-3
modprobe fbtft_device debug=3 rotate=90 name=flexfb speed=16000000 gpios=reset:25,dc:24

Thank you in advance and hope you guys could help me!

Update: here is the patch file available by the seller (if it helps)

diff -uNr ubuntu_project/rpi-35-res/arch/arm/mach-bcm2708/bcm2708.c ubuntu_project/rpi-35-dis/arch/arm/mach-bcm2708/bcm2708.c
--- ubuntu_project/rpi-35-res/arch/arm/mach-bcm2708/bcm2708.c   2015-08-16 16:33:13.412428475 +0800
+++ ubuntu_project/rpi-35-dis/arch/arm/mach-bcm2708/bcm2708.c   2015-06-07 22:23:36.303695000 +0800
@@ -315,7 +315,10 @@
    {},
 };

-
+static struct platform_device bcm2708_ili9341= {
+   .name = "ili9341",
+   .id = 0,
+};

@@ -606,11 +609,11 @@
        .start = BSC1_BASE,
        .end = BSC1_BASE + SZ_256 - 1,
        .flags = IORESOURCE_MEM,
-   }, {
+   },/* {
        .start = INTERRUPT_I2C,
        .end = INTERRUPT_I2C,
        .flags = IORESOURCE_IRQ,
-   }
+   }*/
 };

 static struct platform_device bcm2708_bsc1_device = {
@@ -876,7 +879,7 @@
    bcm_register_device_dt(&w1_device);
 #endif
    bcm_register_device(&bcm2708_systemtimer_device);
-
+   bcm_register_device(&bcm2708_ili9341);
    bcm_register_device(&bcm2708_fb_device);
    bcm_register_device(&bcm2708_usb_device);
    bcm_register_device(&bcm2708_uart1_device);
diff -uNr ubuntu_project/rpi-35-res/arch/arm/mach-bcm2709/bcm2709.c ubuntu_project/rpi-35-dis/arch/arm/mach-bcm2709/bcm2709.c
--- ubuntu_project/rpi-35-res/arch/arm/mach-bcm2709/bcm2709.c   2015-08-16 16:32:27.196199301 +0800
+++ ubuntu_project/rpi-35-dis/arch/arm/mach-bcm2709/bcm2709.c   2015-06-17 00:38:04.542293000 +0800
@@ -265,7 +265,10 @@
     }
 };

-
+static struct platform_device bcm2708_ili9341= {
+   .name = "ili9341",
+   .id = 0,
+};

 static struct platform_device bcm2708_dmaman_device = {
@@ -607,11 +610,11 @@
        .start = BSC0_BASE,
        .end = BSC0_BASE + SZ_256 - 1,
        .flags = IORESOURCE_MEM,
-   }, {
+   }, /*{
        .start = INTERRUPT_I2C,
        .end = INTERRUPT_I2C,
        .flags = IORESOURCE_IRQ,
-   }
+   }*/
 };

 static struct platform_device bcm2708_bsc0_device = {
@@ -627,11 +630,11 @@
        .start = BSC1_BASE,
        .end = BSC1_BASE + SZ_256 - 1,
        .flags = IORESOURCE_MEM,
-   }, {
+   }, /*{
        .start = INTERRUPT_I2C,
        .end = INTERRUPT_I2C,
        .flags = IORESOURCE_IRQ,
-   }
+   }*/
 };

 static struct platform_device bcm2708_bsc1_device = {
@@ -898,7 +901,7 @@
    bcm_register_device(&bcm2708_systemtimer_device);
 #endif
    bcm_register_device(&bcm2708_fb_device);
-   
+   bcm_register_device(&bcm2708_ili9341);
    bcm_register_device(&bcm2708_usb_device);
    bcm_register_device(&bcm2708_uart1_device);
    bcm_register_device(&bcm2708_powerman_device);
diff -uNr ubuntu_project/rpi-35-res/drivers/video/fbdev/ili9341.c ubuntu_project/rpi-35-dis/drivers/video/fbdev/ili9341.c
--- ubuntu_project/rpi-35-res/drivers/video/fbdev/ili9341.c 1970-01-01 08:00:00.000000000 +0800
+++ ubuntu_project/rpi-35-dis/drivers/video/fbdev/ili9341.c 2015-10-05 00:35:47.206366173 +0800
@@ -0,0 +1,1259 @@
+/*
+ * ili9341 Framebuffer
+ *
+ * ToDo: Fix this text vv
+ *
+ * Original: Copyright (c) 2009 Jean-Christian de Rivaz
+ *
+ * Console support, 320x240 instead of 240x320:
+ * Copyright (c) 2012 Jeroen Domburg <jeroen@spritesmods.com>
+ *
+ * Bits and pieces borrowed from the fsl-ili9341.c:
+ * Copyright (C) 2010-2011 Freescale Semiconductor, Inc. All Rights Reserved.
+ * Author: Alison Wang <b18965@freescale.com>
+ *         Jason Jin <Jason.jin@freescale.com>
+ *    kedei <310953417@qq.com>
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * The Solomon Systech ili9341 chip drive TFT screen up to 240x320. 
+ *
+ * For direct I/O-mode:
+ *
+ * This driver expect the SSD1286 to be connected to a 16 bits local bus
+ * and to be set in the 16 bits parallel interface mode. To use it you must
+ * define in your board file a struct platform_device with a name set to
+ * "ili9341" and a struct resource array with two IORESOURCE_MEM: the first
+ * for the control register; the second for the data register.
+ *
+ *
+ * LCDs in their own, native SPI mode aren't supported yet, mostly because I 
+ * can't get my hands on a cheap one.
+ */
+
+//#define DEBUG
+
+#include <linux/kernel.h>
+#include <linux/device.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/mm.h>
+#include <linux/vmalloc.h>
+#include <linux/fb.h>
+#include <asm/io.h>
+#include <linux/delay.h>
+#include <mach/platform.h>
+#include <linux/input/mt.h>
+#include <linux/kthread.h>
+#include <linux/sched.h>
+#include <mach/irqs.h>
+#include <linux/irq.h>
+
+
+
+#define LCD_NCS 4
+#define LCD_NWR 17
+#define LCD_D10 22
+#define LCD_D13 10
+#define LCD_D15 9
+#define LCD_D16 11
+
+#define LCD_RS 18
+#define LCD_D11 23
+#define LCD_D12 24
+#define LCD_D14 25
+#define LCD_D17 8
+#define LCD_NRST 7
+
+#define UPSIDEDOWN
+
+
+static volatile bool lcd_bool = true;
+static volatile bool tsc_bool = false;
+static unsigned char value_j = 0;
+
+struct ili9341_page {
+   unsigned short x;
+   unsigned short y;
+   unsigned short *buffer;
+   unsigned short *oldbuffer;
+   unsigned short len;
+   int must_update;
+};
+
+struct ili9341 {
+   struct device *dev;
+   struct fb_info *info;
+   unsigned int pages_count;
+   struct ili9341_page *pages;
+   unsigned long pseudo_palette[17];
+   int backlight;
+};
+
+struct ts_event {
+    int    x;
+    int    y;
+    long   z1, z2;
+    int    flag;
+};
+static struct ts_event tsc;
+static void __iomem *lcd_spi_base;
+#define GPIOSET(no, ishigh)    { if (ishigh) set|=(1<<no); else reset|=(1<<no); } while(0)
+
+
+
+#define  TS_START  0X80
+#define  TS_X      0XD3
+#define  TS_Y      0X93
+#define  TS_Z1     0XB3
+#define  TS_Z2     0XC3
+
+#define SPI_CS         0x00
+#define SPI_FIFO       0x04
+#define SPI_CLK            0x08
+#define SPI_DLEN       0x0c
+#define SPI_LTOH       0x10
+#define SPI_DC         0x14
+
+
+#define SPI_CS_LEN_LONG        0x02000000
+#define SPI_CS_DMA_LEN     0x01000000
+#define SPI_CS_CSPOL2      0x00800000
+#define SPI_CS_CSPOL1      0x00400000
+#define SPI_CS_CSPOL0      0x00200000
+#define SPI_CS_RXF     0x00100000
+#define SPI_CS_RXR     0x00080000
+#define SPI_CS_TXD     0x00040000
+#define SPI_CS_RXD     0x00020000
+#define SPI_CS_DONE        0x00010000
+#define SPI_CS_LEN     0x00002000
+#define SPI_CS_REN     0x00001000
+#define SPI_CS_ADCS        0x00000800
+#define SPI_CS_INTR        0x00000400
+#define SPI_CS_INTD        0x00000200
+#define SPI_CS_DMAEN       0x00000100
+#define SPI_CS_TA      0x00000080
+#define SPI_CS_CSPOL       0x00000040
+#define SPI_CS_CLEAR_RX        0x00000020
+#define SPI_CS_CLEAR_TX        0x00000010
+#define SPI_CS_CPOL        0x00000008
+#define SPI_CS_CPHA        0x00000004
+#define SPI_CS_CS_10       0x00000002
+#define SPI_CS_CS_01       0x00000001
+
+#define SPI_CS_TXTX        0X000000B0
+
+#define RESET      0X00
+#define CMD_BE     0X11
+#define CMD_AF     0X1B
+
+#define DATE_BE        0X15
+#define DATE_AF        0X1F
+
+
+#define TSC_IRQ        25
+struct input_dev *input_dev;
+
+static u32  cs ;
+static u32  tsc_cs ;
+
+static void spi_init_pinmode(void)
+{
+#define INP_GPIO(g) *(gpio+((g)/10)) &= ~(7<<(((g)%10)*3))
+#define SET_GPIO_ALT(g,a) *(gpio+(((g)/10))) |= (((a)<=3?(a)+4:(a)==4?3:2)<<(((g)%10)*3))
+
+   int pin;
+   u32 *gpio = ioremap(GPIO_BASE, SZ_16K);
+
+   for (pin = 7; pin <= 11; pin++) {
+       INP_GPIO(pin);      
+       SET_GPIO_ALT(pin, 0);   
+   }
+
+   iounmap(gpio);
+
+#undef INP_GPIO
+#undef SET_GPIO_ALT
+}
+
+static spi_sss(unsigned char _data)
+{
+
+   writel( readl(lcd_spi_base+SPI_CS)|SPI_CS_CLEAR_RX | SPI_CS_CLEAR_TX,lcd_spi_base+SPI_CS);
+
+   writel( readl(lcd_spi_base+SPI_CS)|SPI_CS_TA,lcd_spi_base+SPI_CS);
+
+   while (!(readl(lcd_spi_base+SPI_CS)&SPI_CS_TXD));
+
+   writel(_data,lcd_spi_base+SPI_FIFO);
+   while(!(readl(lcd_spi_base+SPI_CS)&SPI_CS_DONE));
+
+   
+}
+
+static  void spi_transform(unsigned char *spi_buff)
+{  
+   while(tsc_bool);
+   
+   lcd_bool = true;
+   if(tsc_bool)
+   {
+       while(tsc_bool);
+   }
+   
+   writel(cs|SPI_CS_TXTX,lcd_spi_base+SPI_CS);
+
+   while(!(readl(lcd_spi_base+SPI_CS)&SPI_CS_TXD));
+   
+   writel(0x00,lcd_spi_base+SPI_FIFO);
+   writel((unsigned char)*(spi_buff),lcd_spi_base+SPI_FIFO);
+   writel((unsigned char)*(spi_buff+1),lcd_spi_base+SPI_FIFO);
+   writel((unsigned char)*(spi_buff+2),lcd_spi_base+SPI_FIFO);
+
+   while(!(readl(lcd_spi_base+SPI_CS)&SPI_CS_DONE));
+   
+   lcd_bool = false;
+   
+}
+
+static inline void tsc_transform(unsigned char *spi_buff)
+{
+
+   
+   writel(tsc_cs|SPI_CS_TXTX,lcd_spi_base+SPI_CS); 
+
+   for (;!(readl(lcd_spi_base+SPI_CS)&SPI_CS_TXD););
+
+   writel(0x00,lcd_spi_base+SPI_FIFO);
+   writel((unsigned char)*(spi_buff),lcd_spi_base+SPI_FIFO);
+   writel((unsigned char)*(spi_buff+1),lcd_spi_base+SPI_FIFO);
+   writel((unsigned char)*(spi_buff+2),lcd_spi_base+SPI_FIFO);
+
+   for(;!(readl(lcd_spi_base+SPI_CS)&SPI_CS_DONE););
+}
+static unsigned char _cmd[3],_data[3],_tsc[3];
+
+
+void LCD_RESET(void)
+{
+   _cmd[0] = 0x00;
+   _cmd[1] = 0x00;
+   _cmd[2] = 0x00;
+   spi_transform(_cmd);
+}
+
+void LCD_NORESET(void)
+{
+   _cmd[0] = 0x00;
+   _cmd[1] = 0x00;
+   _cmd[2] = 0x01;
+   spi_transform(_cmd);
+}
+
+
+static inline void  cmd(unsigned  short cmd)
+{
+   _cmd[0] = (unsigned char)(cmd>>8);
+   _cmd[1] = (unsigned char)cmd;
+   _cmd[2] = CMD_BE;
+   spi_transform(_cmd);
+   
+   _cmd[2] = CMD_AF;
+   spi_transform(_cmd);
+}
+
+
+static inline void w_data(unsigned  short data)
+{
+
+
+   _data[0] = (unsigned char)(data>>8);
+   _data[1] = (unsigned char)data;
+   _data[2] = DATE_BE;
+   spi_transform(_data);
+
+   _data[2] = DATE_AF;
+   spi_transform(_data);
+
+   
+}
+
+
+static inline void w_rgb(unsigned  short data)
+{
+   _data[0] = (unsigned char)(data>>8);
+   _data[1] = (unsigned char)data;
+   _data[2] = DATE_BE;
+   spi_transform(_data);
+
+   _data[2] = DATE_AF;
+   spi_transform(_data);
+
+}
+
+
+
+
+
+void iinntt(void)
+{
+    
+   LCD_NORESET();
+   mdelay(50);
+   LCD_RESET();
+   msleep(100);
+   
+   LCD_NORESET();
+   mdelay(50);
+       cmd(0x0000);
+   mdelay(10);
+
+cmd(0x11); 
+mdelay(120);  
+
+cmd(0xEE);
+w_data(0x02);  
+w_data(0x01);  
+w_data(0x02);  
+w_data(0x01);  
+
+cmd(0xED);
+w_data(0x00);  
+w_data(0x00);  
+w_data(0x9A);  
+w_data(0x9A);  
+w_data(0x9B);  
+w_data(0x9B);  
+w_data(0x00);  
+w_data(0x00);  
+w_data(0x00);  
+w_data(0x00);  
+w_data(0xAE);  
+w_data(0xAE);  
+w_data(0x01);  
+w_data(0xA2);  
+w_data(0x00);  
+
+cmd(0xB4);
+w_data(0x00); 
+
+cmd(0xC0); 
+w_data(0x10); 
+w_data(0x3B); 
+w_data(0x00);   
+w_data(0x02); 
+w_data(0x11);  
+
+cmd(0xC1);
+w_data(0x10);
+
+cmd(0xC8);
+w_data(0x00); 
+w_data(0x46); 
+w_data(0x12);
+w_data(0x20); 
+w_data(0x0c);
+w_data(0x00); 
+w_data(0x56); 
+w_data(0x12);
+w_data(0x67); 
+w_data(0x02); 
+w_data(0x00);
+w_data(0x0c); 
+
+cmd(0xD0); 
+w_data(0x44);
+w_data(0x42); 
+w_data(0x06);
+
+cmd(0xD1);
+w_data(0x43); 
+w_data(0x16);
+
+cmd(0xD2);  
+w_data(0x04);  
+w_data(0x22); 
+
+cmd(0xD3);  
+w_data(0x04);  
+w_data(0x12);  
+
+cmd(0xD4);  
+w_data(0x07);  
+w_data(0x12);  
+
+cmd(0xE9); 
+w_data(0x00);
+
+cmd(0xC5);
+w_data(0x08); 
+
+cmd(0X0036);
+w_data(0X006a);
+
+cmd(0X003A);
+w_data(0X0055);
+
+cmd(0X002A);
+w_data(0X0000);
+w_data(0X0000);
+w_data(0X0001);
+w_data(0X003F);
+
+cmd(0X002B);
+w_data(0X0000);
+w_data(0X0000);
+w_data(0X0001);
+w_data(0X00E0);
+mdelay(120);
+
+cmd(0X0021);
+
+cmd(0x35);
+w_data(0x00);
+
+}
+
+static int tscscreem_open(struct input_dev *input_dev)
+{
+   return 0;
+}
+
+static void tscscreem_close(struct input_dev *input_dev)
+{
+   
+}
+
+#define GPIO_ALT_OFFSET(g) ((((g)/10))*4)
+#define GPIO_ALT_VAL(a, g) ((a)<<(((g)%10)*3))
+static inline void tscscreem_set_input(int gpio) 
+{
+   unsigned int v;
+   v=readl(__io_address(GPIO_BASE+GPIO_ALT_OFFSET(gpio)));
+   v&=~GPIO_ALT_VAL(0x7, gpio); 
+   writel(v, __io_address(GPIO_BASE+GPIO_ALT_OFFSET(gpio)));
+}
+
+unsigned  char ts_num;
+
+static void touch_read(void)
+{
+   long  temp_max,temp_min,j,temp,temp_value,temp_x,temp_y,temp_z1,temp_z2;
+   tsc_start:
+   while(lcd_bool);
+       tsc_bool = true;
+   msleep(3);
+   if(lcd_bool)
+   {
+       tsc_bool = false;
+       goto tsc_start;
+   }
+   writel(32,lcd_spi_base+SPI_CLK);
+   tsc.flag =0;
+
+   _tsc[0] = TS_X;
+   tsc_transform(_tsc);
+   readl(lcd_spi_base+SPI_FIFO);
+   readl(lcd_spi_base+SPI_FIFO);
+   temp_max  = readl(lcd_spi_base+SPI_FIFO)<<4;
+   temp_max |= readl(lcd_spi_base+SPI_FIFO)>>4;
+   temp_min  = temp_max;
+   temp_value= temp_max;
+   for(j = 0;j < 20;j++)
+   {
+       tsc_transform(_tsc);
+       if((readl(__io_address(GPIO_BASE+0x34))&(1<<TSC_IRQ)))   
+       {
+           
+           writel(8,lcd_spi_base+SPI_CLK);
+           msleep(1);
+           tsc_bool = false;
+           tsc.flag = 1;
+           return;
+       }
+       readl(lcd_spi_base+SPI_FIFO);
+       readl(lcd_spi_base+SPI_FIFO);
+       temp  = readl(lcd_spi_base+SPI_FIFO)<<4;
+       temp |= readl(lcd_spi_base+SPI_FIFO)>>4;
+       if(temp_max<temp)   temp_max = temp;
+       if(temp_min>temp)   temp_min = temp;
+       temp_value += temp;
+   }
+   
+   temp_y =2088-((temp_value-temp_max-temp_min)/19) ;
+
+   _tsc[0] = TS_Y;
+   tsc_transform(_tsc);
+   readl(lcd_spi_base+SPI_FIFO);
+   readl(lcd_spi_base+SPI_FIFO);
+   temp_max  = readl(lcd_spi_base+SPI_FIFO)<<4;
+   temp_max |= readl(lcd_spi_base+SPI_FIFO)>>4;
+   temp_min  = temp_max;
+   temp_value= temp_max;
+   for(j = 0;j < 20;j++)
+   {
+       tsc_transform(_tsc);
+       if((readl(__io_address(GPIO_BASE+0x34))&(1<<TSC_IRQ)))   
+       {
+           
+           writel(8,lcd_spi_base+SPI_CLK);
+           msleep(1);
+           tsc_bool = false;
+           tsc.flag = 1;
+           return;
+       }
+       readl(lcd_spi_base+SPI_FIFO);
+       readl(lcd_spi_base+SPI_FIFO);
+       temp  = readl(lcd_spi_base+SPI_FIFO)<<4;
+       temp |= readl(lcd_spi_base+SPI_FIFO)>>4;
+       if(temp_max<temp)   temp_max = temp;
+       if(temp_min>temp)   temp_min = temp;
+       temp_value += temp;
+   }
+   
+   temp_x =(temp_value-temp_max-temp_min)/19;
+
+
+   _tsc[0] = TS_Z1;
+   tsc_transform(_tsc);
+   temp_value++;
+   readl(lcd_spi_base+SPI_FIFO);
+   readl(lcd_spi_base+SPI_FIFO);
+   temp_max  = readl(lcd_spi_base+SPI_FIFO)<<4;
+   temp_max |= readl(lcd_spi_base+SPI_FIFO)>>4;
+   temp_min  = temp_max;
+   temp_value= temp_max;
+   for(j = 0;j < 20;j++)
+   {
+       tsc_transform(_tsc);
+       if((readl(__io_address(GPIO_BASE+0x34))&(1<<TSC_IRQ)))   
+       {
+           
+           writel(8,lcd_spi_base+SPI_CLK);
+           msleep(1);
+           tsc_bool = false;
+           tsc.flag = 1;
+           return;
+       }
+       readl(lcd_spi_base+SPI_FIFO);
+       readl(lcd_spi_base+SPI_FIFO);
+       temp  = readl(lcd_spi_base+SPI_FIFO)<<4;
+       temp |= readl(lcd_spi_base+SPI_FIFO)>>4;
+       if(temp_max<temp)   temp_max = temp;
+       if(temp_min>temp)   temp_min = temp;
+       temp_value += temp;
+   }
+   tsc.z1 = (temp_value-temp_max-temp_min)/30;
+   _tsc[0] = TS_START;
+   tsc_transform(_tsc);
+   if(tsc.z1 < 10)
+   {
+       
+       
+       writel(8,lcd_spi_base+SPI_CLK);
+       msleep(1);
+       tsc_bool = false;
+       tsc.z1 = 0;
+       return ;
+   }
+   tsc.x = temp_x;
+   tsc.y = temp_y;
+
+   writel(8,lcd_spi_base+SPI_CLK);
+   tsc_bool = false;
+}
+
+void test_ts(void)
+{
+   while(1)
+   {   
+       if(!(readl(__io_address(GPIO_BASE+0x34))&(1<<TSC_IRQ)))
+       {
+           touch_read();
+           printk("x %d",tsc.x);
+           printk(" y %d",tsc.y);
+           printk(" z1 %d\n",tsc.z1);
+       }
+   }
+}
+
+static void tsc_do_tasklet(unsigned long param)
+{
+   if((readl(__io_address(GPIO_BASE+0x34))&(1<<TSC_IRQ))) return;
+   tsc.z2 = 0;
+   while(!(readl(__io_address(GPIO_BASE+0x34))&(1<<TSC_IRQ)))
+   {   
+       tsc.z1 = 0;
+       touch_read();
+       if(tsc.flag)    continue;
+       if(tsc.z1&&((tsc.z2 > (tsc.z1+6))||(tsc.z2 < (tsc.z1-6))))
+       {
+           tsc.z2 = tsc.z1;
+           input_report_abs(input_dev, ABS_X, tsc.x);
+           input_report_abs(input_dev, ABS_Y, tsc.y);
+           input_report_key(input_dev, BTN_TOUCH, 1);  
+           input_report_abs(input_dev, ABS_PRESSURE, 0);  
+           input_sync(input_dev);
+       }
+       msleep(10);
+   }
+   { 
+       input_report_abs(input_dev, ABS_X, tsc.x);
+       input_report_abs(input_dev, ABS_Y, tsc.y);
+       input_report_key(input_dev, BTN_TOUCH, 0);  
+       input_report_abs(input_dev, ABS_PRESSURE, 1);  
+           input_sync(input_dev);
+   }
+   return;
+};
+
+
+static int thread_process(void* param)
+{
+   while(1)
+   {
+       msleep(30);
+       if(!(readl(__io_address(GPIO_BASE+0x34))&(1<<TSC_IRQ)))
+       {
+            tsc_do_tasklet(0x00);
+       }
+
+   }
+   return 0;
+};
+
+static struct task_struct* tsc_thread = NULL;
+
+static tsc_init(void)
+{
+   int ret = 0;
+
+   input_dev = input_allocate_device();
+   if(!input_dev){
+       ret = -ENOMEM;
+       goto out;
+   }
+   _tsc[1] = 0;
+   _tsc[2] = 0;
+   input_dev->name = "KeDei";
+
+   input_dev->open = tscscreem_open;
+   input_dev->close = tscscreem_close;
+
+   input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
+   input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
+
+   input_set_abs_params(input_dev, ABS_X, 75,1905, 0, 0);
+   input_set_abs_params(input_dev, ABS_Y, 100,1988, 0, 0);
+   input_set_abs_params(input_dev, ABS_PRESSURE, 0,0,1, 0);
+
+   ret = input_register_device(input_dev);
+   if (ret)
+   { 
+       goto out;
+   }
+   
+
+   tsc_thread = kthread_create(thread_process, NULL, "tsc_thread");
+
+   mdelay(400);
+   wake_up_process(tsc_thread);    
+
+   return 0;
+   out:
+       input_free_device(input_dev);
+       return ret;
+}
+
+
+
+static  void spi_init(void)
+{
+   spi_init_pinmode();
+
+   tscscreem_set_input(TSC_IRQ);
+
+   writel(0,lcd_spi_base+SPI_CS);
+
+   writel(readl(lcd_spi_base+SPI_CS)|SPI_CS_CLEAR_RX | SPI_CS_CLEAR_TX,lcd_spi_base+SPI_CS);
+
+   cs  |= SPI_CS_CPOL; 
+   cs  |= SPI_CS_CPHA; 
+   cs  |= SPI_CS_LEN_LONG;
+   tsc_cs  = cs;
+   cs  |= SPI_CS_CS_01;
+   
+   writel(8,lcd_spi_base+SPI_CLK);
+
+   writel(readl(lcd_spi_base+SPI_CS)|cs,lcd_spi_base+SPI_CS);
+   
+   int i ;
+
+   iinntt();
+
+   tsc_init();
+
+
+}
+
+
+static inline void ili9341_write_byte(unsigned char data, int rs)
+{
+}
+
+
+
+static  void ili9341_set_area(int x, int y) {
+
+   cmd(0x002b);   
+   w_data(y>>8); 
+   w_data(0x00ff&y);  
+   w_data(0x0001); 
+   w_data(0x003f);
+
+   cmd(0x002a);    
+   w_data(x>>8); 
+   w_data(0x00ff&x); 
+   w_data(0x0001); 
+   w_data(0x00df);
+   cmd(0x002c); 
+}
+
+static void ili9341_setptr(struct ili9341 *item, int x, int y) {
+
+   cmd(0x002b);    
+   w_data(0x0000); 
+   w_data(0x0000); 
+   w_data(0x0001); 
+   w_data(0x003f);
+
+   cmd(0x002a);    
+   w_data(0x0000); 
+   w_data(0x0000); 
+   w_data(0x0001); 
+   w_data(0x00df);
+   cmd(0x002c); 
+}
+
+static void ili9341_copy(struct ili9341 *item, unsigned int index)
+{
+   unsigned short x;
+   unsigned short y;
+   unsigned short *buffer;
+   unsigned short *oldbuffer;
+   unsigned int len;
+   unsigned int count;
+   int sendNewPos=1;
+   x = item->pages[index].x;
+   y = item->pages[index].y;
+   buffer = item->pages[index].buffer;
+   oldbuffer = item->pages[index].oldbuffer;
+   len = item->pages[index].len;
+   for (count = 0; count < len; count++) {
+       if (buffer[count]==oldbuffer[count]) {
+           sendNewPos=1;
+       } else {
+           if (sendNewPos) {
+               ili9341_set_area(x,y);
+               sendNewPos=0;
+           }
+           w_rgb(buffer[count]);
+           oldbuffer[count]=buffer[count];
+       }
+       x++;
+       if (x >= item->info->var.xres) {
+           y++;
+           x=0;
+           ili9341_set_area(x,y);
+       }
+       
+   }
+
+}
+
+static void ili9341_copy_t(struct ili9341 *item, unsigned int index)
+{
+   unsigned short x;
+   unsigned short y;
+   unsigned short *buffer;
+   unsigned short *oldbuffer;
+   unsigned int len;
+   unsigned int count;
+   int sendNewPos=1;
+   x = item->pages[index].x;
+   y = item->pages[index].y;
+   buffer = item->pages[index].buffer;
+   oldbuffer = item->pages[index].oldbuffer;
+   len = item->pages[index].len;
+
+   
+   for (count = 0; count < len; count++) 
+   {
+       w_rgb(buffer[count]);
+       oldbuffer[count]=buffer[count];
+   }
+
+}
+
+
+static void ili9341_update_all(struct ili9341 *item)
+{
+   unsigned short i;
+   struct fb_deferred_io *fbdefio = item->info->fbdefio;
+   for (i = 0; i < item->pages_count; i++) {
+       item->pages[i].must_update=1;
+   }
+   schedule_delayed_work(&item->info->deferred_work, fbdefio->delay);
+}
+
+static void ili9341_update(struct fb_info *info, struct list_head *pagelist)
+{
+   struct ili9341 *item = (struct ili9341 *)info->par;
+   struct page *page;
+   int i;
+   list_for_each_entry(page, pagelist, lru) {
+       item->pages[page->index].must_update=1;
+   }
+
+   if(value_j > 5)
+   {
+       for (i=0; i<item->pages_count; i++) {
+           if (item->pages[i].must_update) {
+               item->pages[i].must_update=0;
+               ili9341_copy(item, i);
+           }
+       }
+   }
+   else
+   {
+       
+       ili9341_setptr(item,0,0);
+       
+       for (i=0; i<item->pages_count; i++) {
+           
+           item->pages[i].must_update=0;
+           ili9341_copy_t(item, i);
+           
+       }
+
+       if(value_j == 0)
+       {
+           cmd(0x29); 
+           mdelay(5);
+       }
+
+       value_j++;
+   }
+
+
+}
+
+
+static void __init ili9341_setup(struct ili9341 *item)
+{
+   unsigned short *buffer;
+   unsigned short *oldbuffer;
+   unsigned int len;
+   int i,j,count;
+   ili9341_setptr(item, 0, 0);
+   for (x=0; x<320*480; x++) 
+       w_rgb(item->pages[0].oldbuffer[x]);
+}
+
+static int __init ili9341_video_alloc(struct ili9341 *item)
+{
+   unsigned int frame_size;
+
+   dev_dbg(item->dev, "%s: item=0x%p\n", __func__, (void *)item);
+
+   frame_size = item->info->fix.line_length * item->info->var.yres;
+   dev_dbg(item->dev, "%s: item=0x%p frame_size=%u\n",
+       __func__, (void *)item, frame_size);
+
+   item->pages_count = frame_size / PAGE_SIZE;
+   if ((item->pages_count * PAGE_SIZE) < frame_size) {
+       item->pages_count++;
+   }
+   dev_dbg(item->dev, "%s: item=0x%p pages_count=%u\n",
+       __func__, (void *)item, item->pages_count);
+
+   item->info->fix.smem_len = item->pages_count * PAGE_SIZE;
+   item->info->fix.smem_start =
+       (unsigned long)vmalloc(item->info->fix.smem_len);
+   if (!item->info->fix.smem_start) {
+       dev_err(item->dev, "%s: unable to vmalloc\n", __func__);
+       return -ENOMEM;
+   }
+   memset((void *)item->info->fix.smem_start, 0, item->info->fix.smem_len);
+
+   return 0;
+}
+
+static void ili9341_video_free(struct ili9341 *item)
+{
+   dev_dbg(item->dev, "%s: item=0x%p\n", __func__, (void *)item);
+
+   kfree((void *)item->info->fix.smem_start);
+}
+
+static int __init ili9341_pages_alloc(struct ili9341 *item)
+{
+   unsigned short pixels_per_page;
+   unsigned short yoffset_per_page;
+   unsigned short xoffset_per_page;
+   unsigned int index;
+   unsigned short x = 0;
+   unsigned short y = 0;
+   unsigned short *buffer;
+   unsigned short *oldbuffer;
+   unsigned int len;
+
+   dev_dbg(item->dev, "%s: item=0x%p\n", __func__, (void *)item);
+
+   item->pages = kmalloc(item->pages_count * sizeof(struct ili9341_page),
+                 GFP_KERNEL);
+   if (!item->pages) {
+       dev_err(item->dev, "%s: unable to kmalloc for ili9341_page\n",
+           __func__);
+       return -ENOMEM;
+   }
+
+   pixels_per_page = PAGE_SIZE / (item->info->var.bits_per_pixel / 8);
+   yoffset_per_page = pixels_per_page / item->info->var.xres;
+   xoffset_per_page = pixels_per_page -
+       (yoffset_per_page * item->info->var.xres);
+   dev_dbg(item->dev, "%s: item=0x%p pixels_per_page=%hu "
+       "yoffset_per_page=%hu xoffset_per_page=%hu\n",
+       __func__, (void *)item, pixels_per_page,
+       yoffset_per_page, xoffset_per_page);
+
+   oldbuffer = kmalloc(item->pages_count * pixels_per_page * 2,
+                 GFP_KERNEL);
+   if (!oldbuffer) {
+       dev_err(item->dev, "%s: unable to kmalloc for ili9341_page oldbuffer\n",
+           __func__);
+       return -ENOMEM;
+   }
+
+   buffer = (unsigned short *)item->info->fix.smem_start;
+   for (index = 0; index < item->pages_count; index++) {
+       len = (item->info->var.xres * item->info->var.yres) -
+           (index * pixels_per_page);
+       if (len > pixels_per_page) {
+           len = pixels_per_page;
+       }
+       dev_dbg(item->dev,
+           "%s: page[%d]: x=%3hu y=%3hu buffer=0x%p len=%3hu\n",
+           __func__, index, x, y, buffer, len);
+       item->pages[index].x = x;
+       item->pages[index].y = y;
+       item->pages[index].buffer = buffer;
+       item->pages[index].oldbuffer = oldbuffer;
+       item->pages[index].len = len;
+
+       x += xoffset_per_page;
+       if (x >= item->info->var.xres) {
+           y++;
+           x -= item->info->var.xres;
+       }
+       y += yoffset_per_page;
+       buffer += pixels_per_page;
+       oldbuffer += pixels_per_page;
+   }
+
+   return 0;
+}
+
+static void ili9341_pages_free(struct ili9341 *item)
+{
+   dev_dbg(item->dev, "%s: item=0x%p\n", __func__, (void *)item);
+
+   kfree(item->pages);
+}
+
+static inline __u32 CNVT_TOHW(__u32 val, __u32 width)
+{
+   return ((val<<width) + 0x7FFF - val)>>16;
+}
+
+static int ili9341_setcolreg(unsigned regno,
+                  unsigned red, unsigned green, unsigned blue,
+                  unsigned transp, struct fb_info *info)
+{
+   int ret = 1;
+
+   
+   if (info->var.grayscale)
+       red = green = blue = (19595 * red + 38470 * green +
+                     7471 * blue) >> 16;
+   switch (info->fix.visual) {
+   case FB_VISUAL_TRUECOLOR:
+       if (regno < 16) {
+           u32 *pal = info->pseudo_palette;
+           u32 value;
+
+           red = CNVT_TOHW(red, info->var.red.length);
+           green = CNVT_TOHW(green, info->var.green.length);
+           blue = CNVT_TOHW(blue, info->var.blue.length);
+           transp = CNVT_TOHW(transp, info->var.transp.length);
+
+           value = (red << info->var.red.offset) |
+               (green << info->var.green.offset) |
+               (blue << info->var.blue.offset) |
+               (transp << info->var.transp.offset);
+
+           pal[regno] = value;
+           ret = 0;
+       }
+       break;
+   case FB_VISUAL_STATIC_PSEUDOCOLOR:
+   case FB_VISUAL_PSEUDOCOLOR:
+       break;
+   }
+   return ret;
+}
+
+static int ili9341_blank(int blank_mode, struct fb_info *info)
+{
+   struct ili9341 *item = (struct ili9341 *)info->par;
+   if (blank_mode == FB_BLANK_UNBLANK)
+       item->backlight=1;
+   else
+       item->backlight=0;
+   
+   item->pages[0].must_update=1;
+   schedule_delayed_work(&info->deferred_work, 0);
+   return 0;
+}
+
+static void ili9341_touch(struct fb_info *info, int x, int y, int w, int h) 
+{
+   struct fb_deferred_io *fbdefio = info->fbdefio;
+   struct ili9341 *item = (struct ili9341 *)info->par;
+   int i, ystart, yend;
+   if (fbdefio) {
+       //Touch the pages the y-range hits, so the deferred io will update them.
+       for (i=0; i<item->pages_count; i++) {
+           ystart=item->pages[i].y;
+           yend=item->pages[i].y+(item->pages[i].len/info->fix.line_length)+1;
+           if (!((y+h)<ystart || y>yend)) {
+               item->pages[i].must_update=1;
+           }
+       }
+       //Schedule the deferred IO to kick in after a delay.
+       schedule_delayed_work(&info->deferred_work, fbdefio->delay);
+   }
+}
+
+static void ili9341_fillrect(struct fb_info *p, const struct fb_fillrect *rect) 
+{
+   sys_fillrect(p, rect);
+   ili9341_touch(p, rect->dx, rect->dy, rect->width, rect->height);
+}
+
+static void ili9341_imageblit(struct fb_info *p, const struct fb_image *image) 
+{
+   sys_imageblit(p, image);
+   ili9341_touch(p, image->dx, image->dy, image->width, image->height);
+}
+
+static void ili9341_copyarea(struct fb_info *p, const struct fb_copyarea *area) 
+{
+   sys_copyarea(p, area);
+   ili9341_touch(p, area->dx, area->dy, area->width, area->height);
+}
+
+static ssize_t ili9341_write(struct fb_info *p, const char __user *buf, 
+               size_t count, loff_t *ppos) 
+{
+   ssize_t res;
+   res = fb_sys_write(p, buf, count, ppos);
+   ili9341_touch(p, 0, 0, p->var.xres, p->var.yres);
+   return res;
+}
+
+static struct fb_ops ili9341_fbops = {
+   .owner        = THIS_MODULE,
+   .fb_read      = fb_sys_read,
+   .fb_write     = ili9341_write,
+   .fb_fillrect  = ili9341_fillrect,
+   .fb_copyarea  = ili9341_copyarea,
+   .fb_imageblit = ili9341_imageblit,
+   .fb_setcolreg   = ili9341_setcolreg,
+   .fb_blank   = ili9341_blank,
+};
+
+static struct fb_fix_screeninfo ili9341_fix __initdata = {
+   .id          = "ili9341",
+   .type        = FB_TYPE_PACKED_PIXELS,
+   .visual      = FB_VISUAL_TRUECOLOR,
+   .accel       = FB_ACCEL_NONE,
+   .line_length = 480 * 2,
+};
+
+static struct fb_var_screeninfo ili9341_var __initdata = {
+   .xres       = 480,
+   .yres       = 320,
+   .xres_virtual   = 480,
+   .yres_virtual   = 320,
+   .width      = 480,
+   .height     = 320,
+   .bits_per_pixel = 16,
+   .red        = {11, 5, 0},
+   .green      = {5, 6, 0},
+   .blue       = {0, 5, 0},
+   .activate   = FB_ACTIVATE_NOW,
+   .vmode      = FB_VMODE_NONINTERLACED,
+};
+
+static struct fb_deferred_io ili9341_defio = {
+        .delay          = HZ /25,//25
+        .deferred_io    = &ili9341_update,
+};
+
+static int __init ili9341_probe(struct platform_device *dev)
+{
+   int ret = 0;
+   struct ili9341 *item;
+   struct fb_info *info;
+
+   lcd_spi_base = ioremap(SPI0_BASE, SZ_256 - 1);   //spi map
+   spi_init();
+
+
+
+   dev_dbg(&dev->dev, "%s\n", __func__);
+
+   item = kzalloc(sizeof(struct ili9341), GFP_KERNEL);
+   if (!item) {
+       dev_err(&dev->dev,
+           "%s: unable to kzalloc for ili9341\n", __func__);
+       ret = -ENOMEM;
+       goto out;
+   }
+   item->dev = &dev->dev;
+   dev_set_drvdata(&dev->dev, item);
+   item->backlight=1;
+
+
+   info = framebuffer_alloc(sizeof(struct ili9341), &dev->dev);
+   if (!info) {
+       ret = -ENOMEM;
+       dev_err(&dev->dev,
+           "%s: unable to framebuffer_alloc\n", __func__);
+       goto out_item;
+   }
+   info->pseudo_palette = &item->pseudo_palette;
+   item->info = info;
+   info->par = item;
+   info->dev = &dev->dev;
+   info->fbops = &ili9341_fbops;
+   info->flags = FBINFO_FLAG_DEFAULT|FBINFO_VIRTFB;
+   info->fix = ili9341_fix;
+   info->var = ili9341_var;
+
+   ret = ili9341_video_alloc(item);
+   if (ret) {
+       dev_err(&dev->dev,
+           "%s: unable to ili9341_video_alloc\n", __func__);
+       goto out_info;
+   }
+   info->screen_base = (char __iomem *)item->info->fix.smem_start;
+
+   ret = ili9341_pages_alloc(item);
+   if (ret < 0) {
+       dev_err(&dev->dev,
+           "%s: unable to ili9341_pages_init\n", __func__);
+       goto out_video;
+   }
+
+   info->fbdefio = &ili9341_defio;
+   fb_deferred_io_init(info);
+
+   ret = register_framebuffer(info);
+   if (ret < 0) {
+       dev_err(&dev->dev,
+           "%s: unable to register_frambuffer\n", __func__);
+       goto out_pages;
+   }
+   
+   ili9341_update_all(item);
+   return ret;
+
+out_pages:
+   ili9341_pages_free(item);
+out_video:
+   ili9341_video_free(item);
+out_info:
+   framebuffer_release(info);
+out_item:
+   kfree(item);
+out:
+   return ret;
+}
+
+
+static void __exit ili9341_remove(struct platform_device *dev)
+{
+   struct fb_info *info = dev_get_drvdata(&dev->dev);
+   struct ili9341 *item = (struct ili9341 *)info->par;
+   
+   LCD_RESET();
+   unregister_framebuffer(info);
+   ili9341_pages_free(item);
+   ili9341_video_free(item);
+   framebuffer_release(info);
+   kfree(item);
+
+}
+
+#ifdef CONFIG_PM
+static int ili9341_suspend(struct platform_device *dev, pm_message_t state)
+{
+   return 0;
+}
+
+static int ili9341_resume(struct platform_device *dev)
+{
+// struct fb_info *info = dev_get_drvdata(&spi->dev);
+// struct ili9341 *item = (struct ili9341 *)info->par;
+   /* leave sleep mode */
+// ili9341_reg_set(item, ili9341_REG_SLEEP_MODE, 0x0000);
+   return 0;
+}
+#else
+#define ili9341_suspend NULL
+#define ili9341_resume NULL
+#endif
+
+static struct platform_driver ili9341_driver = {
+   .probe = ili9341_probe,
+   .driver = {
+          .name = "ili9341",
+          },
+};
+
+static int __init ili9341_init(void)
+{
+   int ret = 0;
+
+   pr_debug("%s\n", __func__);
+
+   ret = platform_driver_register(&ili9341_driver);
+   if (ret) {
+       pr_err("%s: unable to platform_driver_register\n", __func__);
+   }
+
+   return ret;
+}
+
+module_init(ili9341_init);
+//module_remove(ili9341_remove);
+module_exit(ili9341_remove);
+
+
+MODULE_DESCRIPTION("ili9341 LCD Driver");
+MODULE_AUTHOR("Jeroen Domburg <jeroen@spritesmods.com>");
+MODULE_LICENSE("GPL");
diff -uNr ubuntu_project/rpi-35-res/drivers/video/fbdev/ili9341.c~ ubuntu_project/rpi-35-dis/drivers/video/fbdev/ili9341.c~
--- ubuntu_project/rpi-35-res/drivers/video/fbdev/ili9341.c~    1970-01-01 08:00:00.000000000 +0800
+++ ubuntu_project/rpi-35-dis/drivers/video/fbdev/ili9341.c~    2015-10-05 00:30:30.752796965 +0800
@@ -0,0 +1,1259 @@
+/*
+ * ili9341 Framebuffer
+ *
+ * ToDo: Fix this text vv
+ *
+ * Original: Copyright (c) 2009 Jean-Christian de Rivaz
+ *
+ * Console support, 320x240 instead of 240x320:
+ * Copyright (c) 2012 Jeroen Domburg <jeroen@spritesmods.com>
+ *
+ * Bits and pieces borrowed from the fsl-ili9341.c:
+ * Copyright (C) 2010-2011 Freescale Semiconductor, Inc. All Rights Reserved.
+ * Author: Alison Wang <b18965@freescale.com>
+ *         Jason Jin <Jason.jin@freescale.com>
+ *    kedei <310953417@qq.com>
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * The Solomon Systech ili9341 chip drive TFT screen up to 240x320. 
+ *
+ * For direct I/O-mode:
+ *
+ * This driver expect the SSD1286 to be connected to a 16 bits local bus
+ * and to be set in the 16 bits parallel interface mode. To use it you must
+ * define in your board file a struct platform_device with a name set to
+ * "ili9341" and a struct resource array with two IORESOURCE_MEM: the first
+ * for the control register; the second for the data register.
+ *
+ *
+ * LCDs in their own, native SPI mode aren't supported yet, mostly because I 
+ * can't get my hands on a cheap one.
+ */
+
+//#define DEBUG
+
+#include <linux/kernel.h>
+#include <linux/device.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/mm.h>
+#include <linux/vmalloc.h>
+#include <linux/fb.h>
+#include <asm/io.h>
+#include <linux/delay.h>
+#include <mach/platform.h>
+#include <linux/input/mt.h>
+#include <linux/kthread.h>
+#include <linux/sched.h>
+#include <mach/irqs.h>
+#include <linux/irq.h>
+
+
+
+#define LCD_NCS 4
+#define LCD_NWR 17
+#define LCD_D10 22
+#define LCD_D13 10
+#define LCD_D15 9
+#define LCD_D16 11
+
+#define LCD_RS 18
+#define LCD_D11 23
+#define LCD_D12 24
+#define LCD_D14 25
+#define LCD_D17 8
+#define LCD_NRST 7
+
+#define UPSIDEDOWN
+
+
+static volatile bool lcd_bool = true;
+static volatile bool tsc_bool = false;
+static unsigned char value_j = 0;
+
+struct ili9341_page {
+   unsigned short x;
+   unsigned short y;
+   unsigned short *buffer;
+   unsigned short *oldbuffer;
+   unsigned short len;
+   int must_update;
+};
+
+struct ili9341 {
+   struct device *dev;
+   struct fb_info *info;
+   unsigned int pages_count;
+   struct ili9341_page *pages;
+   unsigned long pseudo_palette[17];
+   int backlight;
+};
+
+struct ts_event {
+    int    x;
+    int    y;
+    long   z1, z2;
+    int    flag;
+};
+static struct ts_event tsc;
+static void __iomem *lcd_spi_base;
+#define GPIOSET(no, ishigh)    { if (ishigh) set|=(1<<no); else reset|=(1<<no); } while(0)
+
+
+
+#define  TS_START  0X80
+#define  TS_X      0XD3
+#define  TS_Y      0X93
+#define  TS_Z1     0XB3
+#define  TS_Z2     0XC3
+
+#define SPI_CS         0x00
+#define SPI_FIFO       0x04
+#define SPI_CLK            0x08
+#define SPI_DLEN       0x0c
+#define SPI_LTOH       0x10
+#define SPI_DC         0x14
+
+
+#define SPI_CS_LEN_LONG        0x02000000
+#define SPI_CS_DMA_LEN     0x01000000
+#define SPI_CS_CSPOL2      0x00800000
+#define SPI_CS_CSPOL1      0x00400000
+#define SPI_CS_CSPOL0      0x00200000
+#define SPI_CS_RXF     0x00100000
+#define SPI_CS_RXR     0x00080000
+#define SPI_CS_TXD     0x00040000
+#define SPI_CS_RXD     0x00020000
+#define SPI_CS_DONE        0x00010000
+#define SPI_CS_LEN     0x00002000
+#define SPI_CS_REN     0x00001000
+#define SPI_CS_ADCS        0x00000800
+#define SPI_CS_INTR        0x00000400
+#define SPI_CS_INTD        0x00000200
+#define SPI_CS_DMAEN       0x00000100
+#define SPI_CS_TA      0x00000080
+#define SPI_CS_CSPOL       0x00000040
+#define SPI_CS_CLEAR_RX        0x00000020
+#define SPI_CS_CLEAR_TX        0x00000010
+#define SPI_CS_CPOL        0x00000008
+#define SPI_CS_CPHA        0x00000004
+#define SPI_CS_CS_10       0x00000002
+#define SPI_CS_CS_01       0x00000001
+
+#define SPI_CS_TXTX        0X000000B0
+
+#define RESET      0X00
+#define CMD_BE     0X11
+#define CMD_AF     0X1B
+
+#define DATE_BE        0X15
+#define DATE_AF        0X1F
+
+
+#define TSC_IRQ        25
+struct input_dev *input_dev;
+
+static u32  cs ;
+static u32  tsc_cs ;
+
+static void spi_init_pinmode(void)
+{
+#define INP_GPIO(g) *(gpio+((g)/10)) &= ~(7<<(((g)%10)*3))
+#define SET_GPIO_ALT(g,a) *(gpio+(((g)/10))) |= (((a)<=3?(a)+4:(a)==4?3:2)<<(((g)%10)*3))
+
+   int pin;
+   u32 *gpio = ioremap(GPIO_BASE, SZ_16K);
+
+   for (pin = 7; pin <= 11; pin++) {
+       INP_GPIO(pin);      
+       SET_GPIO_ALT(pin, 0);   
+   }
+
+   iounmap(gpio);
+
+#undef INP_GPIO
+#undef SET_GPIO_ALT
+}
+
+static spi_sss(unsigned char _data)
+{
+
+   writel( readl(lcd_spi_base+SPI_CS)|SPI_CS_CLEAR_RX | SPI_CS_CLEAR_TX,lcd_spi_base+SPI_CS);
+
+   writel( readl(lcd_spi_base+SPI_CS)|SPI_CS_TA,lcd_spi_base+SPI_CS);
+
+   while (!(readl(lcd_spi_base+SPI_CS)&SPI_CS_TXD));
+
+   writel(_data,lcd_spi_base+SPI_FIFO);
+   while(!(readl(lcd_spi_base+SPI_CS)&SPI_CS_DONE));
+
+   
+}
+
+static  void spi_transform(unsigned char *spi_buff)
+{  
+   while(tsc_bool);
+   
+   lcd_bool = true;
+   if(tsc_bool)
+   {
+       while(tsc_bool);
+   }
+   
+   writel(cs|SPI_CS_TXTX,lcd_spi_base+SPI_CS);
+
+   while(!(readl(lcd_spi_base+SPI_CS)&SPI_CS_TXD));
+   
+   writel(0x00,lcd_spi_base+SPI_FIFO);
+   writel((unsigned char)*(spi_buff),lcd_spi_base+SPI_FIFO);
+   writel((unsigned char)*(spi_buff+1),lcd_spi_base+SPI_FIFO);
+   writel((unsigned char)*(spi_buff+2),lcd_spi_base+SPI_FIFO);
+
+   while(!(readl(lcd_spi_base+SPI_CS)&SPI_CS_DONE));
+   
+   lcd_bool = false;
+   
+}
+
+static inline void tsc_transform(unsigned char *spi_buff)
+{
+
+   
+   writel(tsc_cs|SPI_CS_TXTX,lcd_spi_base+SPI_CS); 
+
+   for (;!(readl(lcd_spi_base+SPI_CS)&SPI_CS_TXD););
+
+   writel(0x00,lcd_spi_base+SPI_FIFO);
+   writel((unsigned char)*(spi_buff),lcd_spi_base+SPI_FIFO);
+   writel((unsigned char)*(spi_buff+1),lcd_spi_base+SPI_FIFO);
+   writel((unsigned char)*(spi_buff+2),lcd_spi_base+SPI_FIFO);
+
+   for(;!(readl(lcd_spi_base+SPI_CS)&SPI_CS_DONE););
+}
+static unsigned char _cmd[3],_data[3],_tsc[3];
+
+
+void LCD_RESET(void)
+{
+   _cmd[0] = 0x00;
+   _cmd[1] = 0x00;
+   _cmd[2] = 0x00;
+   spi_transform(_cmd);
+}
+
+void LCD_NORESET(void)
+{
+   _cmd[0] = 0x00;
+   _cmd[1] = 0x00;
+   _cmd[2] = 0x01;
+   spi_transform(_cmd);
+}
+
+
+static inline void  cmd(unsigned  short cmd)
+{
+   _cmd[0] = (unsigned char)(cmd>>8);
+   _cmd[1] = (unsigned char)cmd;
+   _cmd[2] = CMD_BE;
+   spi_transform(_cmd);
+   
+   _cmd[2] = CMD_AF;
+   spi_transform(_cmd);
+}
+
+
+static inline void w_data(unsigned  short data)
+{
+
+
+   _data[0] = (unsigned char)(data>>8);
+   _data[1] = (unsigned char)data;
+   _data[2] = DATE_BE;
+   spi_transform(_data);
+
+   _data[2] = DATE_AF;
+   spi_transform(_data);
+
+   
+}
+
+
+static inline void w_rgb(unsigned  short data)
+{
+   _data[0] = (unsigned char)(data>>8);
+   _data[1] = (unsigned char)data;
+   _data[2] = DATE_BE;
+   spi_transform(_data);
+
+   _data[2] = DATE_AF;
+   spi_transform(_data);
+
+}
+
+
+
+
+
+void iinntt(void)
+{
+    
+   LCD_NORESET();
+   mdelay(50);
+   LCD_RESET();
+   msleep(100);
+   
+   LCD_NORESET();
+   mdelay(50);
+       cmd(0x0000);
+   mdelay(10);
+
+cmd(0x11); 
+mdelay(120);  
+
+cmd(0xEE);
+w_data(0x02);  
+w_data(0x01);  
+w_data(0x02);  
+w_data(0x01);  
+
+cmd(0xED);
+w_data(0x00);  
+w_data(0x00);  
+w_data(0x9A);  
+w_data(0x9A);  
+w_data(0x9B);  
+w_data(0x9B);  
+w_data(0x00);  
+w_data(0x00);  
+w_data(0x00);  
+w_data(0x00);  
+w_data(0xAE);  
+w_data(0xAE);  
+w_data(0x01);  
+w_data(0xA2);  
+w_data(0x00);  
+
+cmd(0xB4);
+w_data(0x00); 
+
+cmd(0xC0); 
+w_data(0x10); 
+w_data(0x3B); 
+w_data(0x00);   
+w_data(0x02); 
+w_data(0x11);  
+
+cmd(0xC1);
+w_data(0x10);
+
+cmd(0xC8);
+w_data(0x00); 
+w_data(0x46); 
+w_data(0x12);
+w_data(0x20); 
+w_data(0x0c);
+w_data(0x00); 
+w_data(0x56); 
+w_data(0x12);
+w_data(0x67); 
+w_data(0x02); 
+w_data(0x00);
+w_data(0x0c); 
+
+cmd(0xD0); 
+w_data(0x44);
+w_data(0x42); 
+w_data(0x06);
+
+cmd(0xD1);
+w_data(0x43); 
+w_data(0x16);
+
+cmd(0xD2);  
+w_data(0x04);  
+w_data(0x22); 
+
+cmd(0xD3);  
+w_data(0x04);  
+w_data(0x12);  
+
+cmd(0xD4);  
+w_data(0x07);  
+w_data(0x12);  
+
+cmd(0xE9); 
+w_data(0x00);
+
+cmd(0xC5);
+w_data(0x08); 
+
+cmd(0X0036);
+w_data(0X006a);
+
+cmd(0X003A);
+w_data(0X0055);
+
+cmd(0X002A);
+w_data(0X0000);
+w_data(0X0000);
+w_data(0X0001);
+w_data(0X003F);
+
+cmd(0X002B);
+w_data(0X0000);
+w_data(0X0000);
+w_data(0X0001);
+w_data(0X00E0);
+mdelay(120);
+
+cmd(0X0021);
+
+cmd(0x35);
+w_data(0x00);
+
+}
+
+static int tscscreem_open(struct input_dev *input_dev)
+{
+   return 0;
+}
+
+static void tscscreem_close(struct input_dev *input_dev)
+{
+   
+}
+
+#define GPIO_ALT_OFFSET(g) ((((g)/10))*4)
+#define GPIO_ALT_VAL(a, g) ((a)<<(((g)%10)*3))
+static inline void tscscreem_set_input(int gpio) 
+{
+   unsigned int v;
+   v=readl(__io_address(GPIO_BASE+GPIO_ALT_OFFSET(gpio)));
+   v&=~GPIO_ALT_VAL(0x7, gpio); 
+   writel(v, __io_address(GPIO_BASE+GPIO_ALT_OFFSET(gpio)));
+}
+
+unsigned  char ts_num;
+
+static void touch_read(void)
+{
+   long  temp_max,temp_min,j,temp,temp_value,temp_x,temp_y,temp_z1,temp_z2;
+   tsc_start:
+   while(lcd_bool);
+       tsc_bool = true;
+   msleep(3);
+   if(lcd_bool)
+   {
+       tsc_bool = false;
+       goto tsc_start;
+   }
+   writel(32,lcd_spi_base+SPI_CLK);
+   tsc.flag =0;
+
+   _tsc[0] = TS_X;
+   tsc_transform(_tsc);
+   readl(lcd_spi_base+SPI_FIFO);
+   readl(lcd_spi_base+SPI_FIFO);
+   temp_max  = readl(lcd_spi_base+SPI_FIFO)<<4;
+   temp_max |= readl(lcd_spi_base+SPI_FIFO)>>4;
+   temp_min  = temp_max;
+   temp_value= temp_max;
+   for(j = 0;j < 20;j++)
+   {
+       tsc_transform(_tsc);
+       if((readl(__io_address(GPIO_BASE+0x34))&(1<<TSC_IRQ)))   
+       {
+           
+           writel(8,lcd_spi_base+SPI_CLK);
+           msleep(1);
+           tsc_bool = false;
+           tsc.flag = 1;
+           return;
+       }
+       readl(lcd_spi_base+SPI_FIFO);
+       readl(lcd_spi_base+SPI_FIFO);
+       temp  = readl(lcd_spi_base+SPI_FIFO)<<4;
+       temp |= readl(lcd_spi_base+SPI_FIFO)>>4;
+       if(temp_max<temp)   temp_max = temp;
+       if(temp_min>temp)   temp_min = temp;
+       temp_value += temp;
+   }
+   
+   temp_y =2088-((temp_value-temp_max-temp_min)/19) ;
+
+   _tsc[0] = TS_Y;
+   tsc_transform(_tsc);
+   readl(lcd_spi_base+SPI_FIFO);
+   readl(lcd_spi_base+SPI_FIFO);
+   temp_max  = readl(lcd_spi_base+SPI_FIFO)<<4;
+   temp_max |= readl(lcd_spi_base+SPI_FIFO)>>4;
+   temp_min  = temp_max;
+   temp_value= temp_max;
+   for(j = 0;j < 20;j++)
+   {
+       tsc_transform(_tsc);
+       if((readl(__io_address(GPIO_BASE+0x34))&(1<<TSC_IRQ)))   
+       {
+           
+           writel(8,lcd_spi_base+SPI_CLK);
+           msleep(1);
+           tsc_bool = false;
+           tsc.flag = 1;
+           return;
+       }
+       readl(lcd_spi_base+SPI_FIFO);
+       readl(lcd_spi_base+SPI_FIFO);
+       temp  = readl(lcd_spi_base+SPI_FIFO)<<4;
+       temp |= readl(lcd_spi_base+SPI_FIFO)>>4;
+       if(temp_max<temp)   temp_max = temp;
+       if(temp_min>temp)   temp_min = temp;
+       temp_value += temp;
+   }
+   
+   temp_x =(temp_value-temp_max-temp_min)/19;
+
+
+   _tsc[0] = TS_Z1;
+   tsc_transform(_tsc);
+   temp_value++;
+   readl(lcd_spi_base+SPI_FIFO);
+   readl(lcd_spi_base+SPI_FIFO);
+   temp_max  = readl(lcd_spi_base+SPI_FIFO)<<4;
+   temp_max |= readl(lcd_spi_base+SPI_FIFO)>>4;
+   temp_min  = temp_max;
+   temp_value= temp_max;
+   for(j = 0;j < 20;j++)
+   {
+       tsc_transform(_tsc);
+       if((readl(__io_address(GPIO_BASE+0x34))&(1<<TSC_IRQ)))   
+       {
+           
+           writel(8,lcd_spi_base+SPI_CLK);
+           msleep(1);
+           tsc_bool = false;
+           tsc.flag = 1;
+           return;
+       }
+       readl(lcd_spi_base+SPI_FIFO);
+       readl(lcd_spi_base+SPI_FIFO);
+       temp  = readl(lcd_spi_base+SPI_FIFO)<<4;
+       temp |= readl(lcd_spi_base+SPI_FIFO)>>4;
+       if(temp_max<temp)   temp_max = temp;
+       if(temp_min>temp)   temp_min = temp;
+       temp_value += temp;
+   }
+   tsc.z1 = (temp_value-temp_max-temp_min)/30;
+   _tsc[0] = TS_START;
+   tsc_transform(_tsc);
+   if(tsc.z1 < 10)
+   {
+       
+       
+       writel(8,lcd_spi_base+SPI_CLK);
+       msleep(1);
+       tsc_bool = false;
+       tsc.z1 = 0;
+       return ;
+   }
+   tsc.x = temp_x;
+   tsc.y = temp_y;
+
+   writel(8,lcd_spi_base+SPI_CLK);
+   tsc_bool = false;
+}
+
+void test_ts(void)
+{
+   while(1)
+   {   
+       if(!(readl(__io_address(GPIO_BASE+0x34))&(1<<TSC_IRQ)))
+       {
+           touch_read();
+           printk("x %d",tsc.x);
+           printk(" y %d",tsc.y);
+           printk(" z1 %d\n",tsc.z1);
+       }
+   }
+}
+
+static void tsc_do_tasklet(unsigned long param)
+{
+   if((readl(__io_address(GPIO_BASE+0x34))&(1<<TSC_IRQ))) return;
+   tsc.z2 = 0;
+   while(!(readl(__io_address(GPIO_BASE+0x34))&(1<<TSC_IRQ)))
+   {   
+       tsc.z1 = 0;
+       touch_read();
+       if(tsc.flag)    continue;
+       if(tsc.z1&&((tsc.z2 > (tsc.z1+6))||(tsc.z2 < (tsc.z1-6))))
+       {
+           tsc.z2 = tsc.z1;
+           input_report_abs(input_dev, ABS_X, tsc.x);
+           input_report_abs(input_dev, ABS_Y, tsc.y);
+           input_report_key(input_dev, BTN_TOUCH, 1);  
+           input_report_abs(input_dev, ABS_PRESSURE, 0);  
+           input_sync(input_dev);
+       }
+       msleep(10);
+   }
+   { 
+       input_report_abs(input_dev, ABS_X, tsc.x);
+       input_report_abs(input_dev, ABS_Y, tsc.y);
+       input_report_key(input_dev, BTN_TOUCH, 0);  
+       input_report_abs(input_dev, ABS_PRESSURE, 1);  
+           input_sync(input_dev);
+   }
+   return;
+};
+
+
+static int thread_process(void* param)
+{
+   while(1)
+   {
+       msleep(30);
+       if(!(readl(__io_address(GPIO_BASE+0x34))&(1<<TSC_IRQ)))
+       {
+            tsc_do_tasklet(0x00);
+       }
+
+   }
+   return 0;
+};
+
+static struct task_struct* tsc_thread = NULL;
+
+static tsc_init(void)
+{
+   int ret = 0;
+
+   input_dev = input_allocate_device();
+   if(!input_dev){
+       ret = -ENOMEM;
+       goto out;
+   }
+   _tsc[1] = 0;
+   _tsc[2] = 0;
+   input_dev->name = "KeDei";
+
+   input_dev->open = tscscreem_open;
+   input_dev->close = tscscreem_close;
+
+   input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
+   input_dev->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
+
+   input_set_abs_params(input_dev, ABS_X, 75,1905, 0, 0);
+   input_set_abs_params(input_dev, ABS_Y, 100,1988, 0, 0);
+   input_set_abs_params(input_dev, ABS_PRESSURE, 0,0,1, 0);
+
+   ret = input_register_device(input_dev);
+   if (ret)
+   { 
+       goto out;
+   }
+   
+
+   tsc_thread = kthread_create(thread_process, NULL, "tsc_thread");
+
+   mdelay(400);
+   wake_up_process(tsc_thread);    
+
+   return 0;
+   out:
+       input_free_device(input_dev);
+       return ret;
+}
+
+
+
+static  void spi_init(void)
+{
+   spi_init_pinmode();
+
+   tscscreem_set_input(TSC_IRQ);
+
+   writel(0,lcd_spi_base+SPI_CS);
+
+   writel(readl(lcd_spi_base+SPI_CS)|SPI_CS_CLEAR_RX | SPI_CS_CLEAR_TX,lcd_spi_base+SPI_CS);
+
+   cs  |= SPI_CS_CPOL; 
+   cs  |= SPI_CS_CPHA; 
+   cs  |= SPI_CS_LEN_LONG;
+   tsc_cs  = cs;
+   cs  |= SPI_CS_CS_01;
+   
+   writel(8,lcd_spi_base+SPI_CLK);
+
+   writel(readl(lcd_spi_base+SPI_CS)|cs,lcd_spi_base+SPI_CS);
+   
+   int i ;
+
+   iinntt();
+
+   tsc_init();
+
+
+}
+
+
+static inline void ili9341_write_byte(unsigned char data, int rs)
+{
+}
+
+
+
+static  void ili9341_set_area(int x, int y) {
+
+   cmd(0x002b);   
+   w_data(y>>8); 
+   w_data(0x00ff&y);  
+   w_data(0x0001); 
+   w_data(0x003f);
+
+   cmd(0x002a);    
+   w_data(x>>8); 
+   w_data(0x00ff&x); 
+   w_data(0x0001); 
+   w_data(0x00df);
+   cmd(0x002c); 
+}
+
+static void ili9341_setptr(struct ili9341 *item, int x, int y) {
+
+   cmd(0x002b);    
+   w_data(0x0000); 
+   w_data(0x0000); 
+   w_data(0x0001); 
+   w_data(0x003f);
+
+   cmd(0x002a);    
+   w_data(0x0000); 
+   w_data(0x0000); 
+   w_data(0x0001); 
+   w_data(0x00df);
+   cmd(0x002c); 
+}
+
+static void ili9341_copy(struct ili9341 *item, unsigned int index)
+{
+   unsigned short x;
+   unsigned short y;
+   unsigned short *buffer;
+   unsigned short *oldbuffer;
+   unsigned int len;
+   unsigned int count;
+   int sendNewPos=1;
+   x = item->pages[index].x;
+   y = item->pages[index].y;
+   buffer = item->pages[index].buffer;
+   oldbuffer = item->pages[index].oldbuffer;
+   len = item->pages[index].len;
+   for (count = 0; count < len; count++) {
+       if (buffer[count]==oldbuffer[count]) {
+           sendNewPos=1;
+       } else {
+           if (sendNewPos) {
+               ili9341_set_area(x,y);
+               sendNewPos=0;
+           }
+           w_rgb(buffer[count]);
+           oldbuffer[count]=buffer[count];
+       }
+       x++;
+       if (x >= item->info->var.xres) {
+           y++;
+           x=0;
+           ili9341_set_area(x,y);
+       }
+       
+   }
+
+}
+
+static void ili9341_copy_t(struct ili9341 *item, unsigned int index)
+{
+   unsigned short x;
+   unsigned short y;
+   unsigned short *buffer;
+   unsigned short *oldbuffer;
+   unsigned int len;
+   unsigned int count;
+   int sendNewPos=1;
+   x = item->pages[index].x;
+   y = item->pages[index].y;
+   buffer = item->pages[index].buffer;
+   oldbuffer = item->pages[index].oldbuffer;
+   len = item->pages[index].len;
+
+   
+   for (count = 0; count < len; count++) 
+   {
+       w_rgb(buffer[count]);
+       oldbuffer[count]=buffer[count];
+   }
+
+}
+
+
+static void ili9341_update_all(struct ili9341 *item)
+{
+   unsigned short i;
+   struct fb_deferred_io *fbdefio = item->info->fbdefio;
+   for (i = 0; i < item->pages_count; i++) {
+       item->pages[i].must_update=1;
+   }
+   schedule_delayed_work(&item->info->deferred_work, fbdefio->delay);
+}
+
+static void ili9341_update(struct fb_info *info, struct list_head *pagelist)
+{
+   struct ili9341 *item = (struct ili9341 *)info->par;
+   struct page *page;
+   int i;
+   list_for_each_entry(page, pagelist, lru) {
+       item->pages[page->index].must_update=1;
+   }
+
+   if(value_j > 5)
+   {
+       for (i=0; i<item->pages_count; i++) {
+           if (item->pages[i].must_update) {
+               item->pages[i].must_update=0;
+               ili9341_copy(item, i);
+           }
+       }
+   }
+   else
+   {
+       
+       ili9341_setptr(item,0,0);
+       
+       for (i=0; i<item->pages_count; i++) {
+           
+           item->pages[i].must_update=0;
+           ili9341_copy_t(item, i);
+           
+       }
+
+       if(value_j == 0)
+       {
+           cmd(0x29); 
+           mdelay(5);
+       }
+
+       value_j++;
+   }
+
+
+}
+
+
+static void __init ili9341_setup(struct ili9341 *item)
+{
+   unsigned short *buffer;
+   unsigned short *oldbuffer;
+   unsigned int len;
+   int i,j,count;
+   ili9341_setptr(item, 0, 0);
+   for (x=0; x<320*480; x++) 
+       w_rgb(item->pages[0].oldbuffer[x]);
+}
+
+static int __init ili9341_video_alloc(struct ili9341 *item)
+{
+   unsigned int frame_size;
+
+   dev_dbg(item->dev, "%s: item=0x%p\n", __func__, (void *)item);
+
+   frame_size = item->info->fix.line_length * item->info->var.yres;
+   dev_dbg(item->dev, "%s: item=0x%p frame_size=%u\n",
+       __func__, (void *)item, frame_size);
+
+   item->pages_count = frame_size / PAGE_SIZE;
+   if ((item->pages_count * PAGE_SIZE) < frame_size) {
+       item->pages_count++;
+   }
+   dev_dbg(item->dev, "%s: item=0x%p pages_count=%u\n",
+       __func__, (void *)item, item->pages_count);
+
+   item->info->fix.smem_len = item->pages_count * PAGE_SIZE;
+   item->info->fix.smem_start =
+       (unsigned long)vmalloc(item->info->fix.smem_len);
+   if (!item->info->fix.smem_start) {
+       dev_err(item->dev, "%s: unable to vmalloc\n", __func__);
+       return -ENOMEM;
+   }
+   memset((void *)item->info->fix.smem_start, 0, item->info->fix.smem_len);
+
+   return 0;
+}
+
+static void ili9341_video_free(struct ili9341 *item)
+{
+   dev_dbg(item->dev, "%s: item=0x%p\n", __func__, (void *)item);
+
+   kfree((void *)item->info->fix.smem_start);
+}
+
+static int __init ili9341_pages_alloc(struct ili9341 *item)
+{
+   unsigned short pixels_per_page;
+   unsigned short yoffset_per_page;
+   unsigned short xoffset_per_page;
+   unsigned int index;
+   unsigned short x = 0;
+   unsigned short y = 0;
+   unsigned short *buffer;
+   unsigned short *oldbuffer;
+   unsigned int len;
+
+   dev_dbg(item->dev, "%s: item=0x%p\n", __func__, (void *)item);
+
+   item->pages = kmalloc(item->pages_count * sizeof(struct ili9341_page),
+                 GFP_KERNEL);
+   if (!item->pages) {
+       dev_err(item->dev, "%s: unable to kmalloc for ili9341_page\n",
+           __func__);
+       return -ENOMEM;
+   }
+
+   pixels_per_page = PAGE_SIZE / (item->info->var.bits_per_pixel / 8);
+   yoffset_per_page = pixels_per_page / item->info->var.xres;
+   xoffset_per_page = pixels_per_page -
+       (yoffset_per_page * item->info->var.xres);
+   dev_dbg(item->dev, "%s: item=0x%p pixels_per_page=%hu "
+       "yoffset_per_page=%hu xoffset_per_page=%hu\n",
+       __func__, (void *)item, pixels_per_page,
+       yoffset_per_page, xoffset_per_page);
+
+   oldbuffer = kmalloc(item->pages_count * pixels_per_page * 2,
+                 GFP_KERNEL);
+   if (!oldbuffer) {
+       dev_err(item->dev, "%s: unable to kmalloc for ili9341_page oldbuffer\n",
+           __func__);
+       return -ENOMEM;
+   }
+
+   buffer = (unsigned short *)item->info->fix.smem_start;
+   for (index = 0; index < item->pages_count; index++) {
+       len = (item->info->var.xres * item->info->var.yres) -
+           (index * pixels_per_page);
+       if (len > pixels_per_page) {
+           len = pixels_per_page;
+       }
+       dev_dbg(item->dev,
+           "%s: page[%d]: x=%3hu y=%3hu buffer=0x%p len=%3hu\n",
+           __func__, index, x, y, buffer, len);
+       item->pages[index].x = x;
+       item->pages[index].y = y;
+       item->pages[index].buffer = buffer;
+       item->pages[index].oldbuffer = oldbuffer;
+       item->pages[index].len = len;
+
+       x += xoffset_per_page;
+       if (x >= item->info->var.xres) {
+           y++;
+           x -= item->info->var.xres;
+       }
+       y += yoffset_per_page;
+       buffer += pixels_per_page;
+       oldbuffer += pixels_per_page;
+   }
+
+   return 0;
+}
+
+static void ili9341_pages_free(struct ili9341 *item)
+{
+   dev_dbg(item->dev, "%s: item=0x%p\n", __func__, (void *)item);
+
+   kfree(item->pages);
+}
+
+static inline __u32 CNVT_TOHW(__u32 val, __u32 width)
+{
+   return ((val<<width) + 0x7FFF - val)>>16;
+}
+
+static int ili9341_setcolreg(unsigned regno,
+                  unsigned red, unsigned green, unsigned blue,
+                  unsigned transp, struct fb_info *info)
+{
+   int ret = 1;
+
+   
+   if (info->var.grayscale)
+       red = green = blue = (19595 * red + 38470 * green +
+                     7471 * blue) >> 16;
+   switch (info->fix.visual) {
+   case FB_VISUAL_TRUECOLOR:
+       if (regno < 16) {
+           u32 *pal = info->pseudo_palette;
+           u32 value;
+
+           red = CNVT_TOHW(red, info->var.red.length);
+           green = CNVT_TOHW(green, info->var.green.length);
+           blue = CNVT_TOHW(blue, info->var.blue.length);
+           transp = CNVT_TOHW(transp, info->var.transp.length);
+
+           value = (red << info->var.red.offset) |
+               (green << info->var.green.offset) |
+               (blue << info->var.blue.offset) |
+               (transp << info->var.transp.offset);
+
+           pal[regno] = value;
+           ret = 0;
+       }
+       break;
+   case FB_VISUAL_STATIC_PSEUDOCOLOR:
+   case FB_VISUAL_PSEUDOCOLOR:
+       break;
+   }
+   return ret;
+}
+
+static int ili9341_blank(int blank_mode, struct fb_info *info)
+{
+   struct ili9341 *item = (struct ili9341 *)info->par;
+   if (blank_mode == FB_BLANK_UNBLANK)
+       item->backlight=1;
+   else
+       item->backlight=0;
+   
+   item->pages[0].must_update=1;
+   schedule_delayed_work(&info->deferred_work, 0);
+   return 0;
+}
+
+static void ili9341_touch(struct fb_info *info, int x, int y, int w, int h) 
+{
+   struct fb_deferred_io *fbdefio = info->fbdefio;
+   struct ili9341 *item = (struct ili9341 *)info->par;
+   int i, ystart, yend;
+   if (fbdefio) {
+       //Touch the pages the y-range hits, so the deferred io will update them.
+       for (i=0; i<item->pages_count; i++) {
+           ystart=item->pages[i].y;
+           yend=item->pages[i].y+(item->pages[i].len/info->fix.line_length)+1;
+           if (!((y+h)<ystart || y>yend)) {
+               item->pages[i].must_update=1;
+           }
+       }
+       //Schedule the deferred IO to kick in after a delay.
+       schedule_delayed_work(&info->deferred_work, fbdefio->delay);
+   }
+}
+
+static void ili9341_fillrect(struct fb_info *p, const struct fb_fillrect *rect) 
+{
+   sys_fillrect(p, rect);
+   ili9341_touch(p, rect->dx, rect->dy, rect->width, rect->height);
+}
+
+static void ili9341_imageblit(struct fb_info *p, const struct fb_image *image) 
+{
+   sys_imageblit(p, image);
+   ili9341_touch(p, image->dx, image->dy, image->width, image->height);
+}
+
+static void ili9341_copyarea(struct fb_info *p, const struct fb_copyarea *area) 
+{
+   sys_copyarea(p, area);
+   ili9341_touch(p, area->dx, area->dy, area->width, area->height);
+}
+
+static ssize_t ili9341_write(struct fb_info *p, const char __user *buf, 
+               size_t count, loff_t *ppos) 
+{
+   ssize_t res;
+   res = fb_sys_write(p, buf, count, ppos);
+   ili9341_touch(p, 0, 0, p->var.xres, p->var.yres);
+   return res;
+}
+
+static struct fb_ops ili9341_fbops = {
+   .owner        = THIS_MODULE,
+   .fb_read      = fb_sys_read,
+   .fb_write     = ili9341_write,
+   .fb_fillrect  = ili9341_fillrect,
+   .fb_copyarea  = ili9341_copyarea,
+   .fb_imageblit = ili9341_imageblit,
+   .fb_setcolreg   = ili9341_setcolreg,
+   .fb_blank   = ili9341_blank,
+};
+
+static struct fb_fix_screeninfo ili9341_fix __initdata = {
+   .id          = "ili9341",
+   .type        = FB_TYPE_PACKED_PIXELS,
+   .visual      = FB_VISUAL_TRUECOLOR,
+   .accel       = FB_ACCEL_NONE,
+   .line_length = 480 * 2,
+};
+
+static struct fb_var_screeninfo ili9341_var __initdata = {
+   .xres       = 480,
+   .yres       = 320,
+   .xres_virtual   = 480,
+   .yres_virtual   = 320,
+   .width      = 480,
+   .height     = 320,
+   .bits_per_pixel = 16,
+   .red        = {11, 5, 0},
+   .green      = {5, 6, 0},
+   .blue       = {0, 5, 0},
+   .activate   = FB_ACTIVATE_NOW,
+   .vmode      = FB_VMODE_NONINTERLACED,
+};
+
+static struct fb_deferred_io ili9341_defio = {
+        .delay          = HZ /25,//25
+        .deferred_io    = &ili9341_update,
+};
+
+static int __init ili9341_probe(struct platform_device *dev)
+{
+   int ret = 0;
+   struct ili9341 *item;
+   struct fb_info *info;
+
+   lcd_spi_base = ioremap(SPI0_BASE, SZ_256 - 1);   //spi map
+   spi_init();
+
+
+
+   dev_dbg(&dev->dev, "%s\n", __func__);
+
+   item = kzalloc(sizeof(struct ili9341), GFP_KERNEL);
+   if (!item) {
+       dev_err(&dev->dev,
+           "%s: unable to kzalloc for ili9341\n", __func__);
+       ret = -ENOMEM;
+       goto out;
+   }
+   item->dev = &dev->dev;
+   dev_set_drvdata(&dev->dev, item);
+   item->backlight=1;
+
+
+   info = framebuffer_alloc(sizeof(struct ili9341), &dev->dev);
+   if (!info) {
+       ret = -ENOMEM;
+       dev_err(&dev->dev,
+           "%s: unable to framebuffer_alloc\n", __func__);
+       goto out_item;
+   }
+   info->pseudo_palette = &item->pseudo_palette;
+   item->info = info;
+   info->par = item;
+   info->dev = &dev->dev;
+   info->fbops = &ili9341_fbops;
+   info->flags = FBINFO_FLAG_DEFAULT|FBINFO_VIRTFB;
+   info->fix = ili9341_fix;
+   info->var = ili9341_var;
+
+   ret = ili9341_video_alloc(item);
+   if (ret) {
+       dev_err(&dev->dev,
+           "%s: unable to ili9341_video_alloc\n", __func__);
+       goto out_info;
+   }
+   info->screen_base = (char __iomem *)item->info->fix.smem_start;
+
+   ret = ili9341_pages_alloc(item);
+   if (ret < 0) {
+       dev_err(&dev->dev,
+           "%s: unable to ili9341_pages_init\n", __func__);
+       goto out_video;
+   }
+
+   info->fbdefio = &ili9341_defio;
+   fb_deferred_io_init(info);
+
+   ret = register_framebuffer(info);
+   if (ret < 0) {
+       dev_err(&dev->dev,
+           "%s: unable to register_frambuffer\n", __func__);
+       goto out_pages;
+   }
+   
+   ili9341_update_all(item);
+   return ret;
+
+out_pages:
+   ili9341_pages_free(item);
+out_video:
+   ili9341_video_free(item);
+out_info:
+   framebuffer_release(info);
+out_item:
+   kfree(item);
+out:
+   return ret;
+}
+
+
+static void __exit ili9341_remove(struct platform_device *dev)
+{
+   struct fb_info *info = dev_get_drvdata(&dev->dev);
+   struct ili9341 *item = (struct ili9341 *)info->par;
+   
+   LCD_RESET();
+   unregister_framebuffer(info);
+   ili9341_pages_free(item);
+   ili9341_video_free(item);
+   framebuffer_release(info);
+   kfree(item);
+
+}
+
+#ifdef CONFIG_PM
+static int ili9341_suspend(struct platform_device *dev, pm_message_t state)
+{
+   return 0;
+}
+
+static int ili9341_resume(struct platform_device *dev)
+{
+// struct fb_info *info = dev_get_drvdata(&spi->dev);
+// struct ili9341 *item = (struct ili9341 *)info->par;
+   /* leave sleep mode */
+// ili9341_reg_set(item, ili9341_REG_SLEEP_MODE, 0x0000);
+   return 0;
+}
+#else
+#define ili9341_suspend NULL
+#define ili9341_resume NULL
+#endif
+
+static struct platform_driver ili9341_driver = {
+   .probe = ili9341_probe,
+   .driver = {
+          .name = "ili9341",
+          },
+};
+
+static int __init ili9341_init(void)
+{
+   int ret = 0;
+
+   pr_debug("%s\n", __func__);
+
+   ret = platform_driver_register(&ili9341_driver);
+   if (ret) {
+       pr_err("%s: unable to platform_driver_register\n", __func__);
+   }
+
+   return ret;
+}
+
+module_init(ili9341_init);
+//module_remove(ili9341_remove);
+module_exit(ili9341_remove);
+
+
+MODULE_DESCRIPTION("ili9341 LCD Driver");
+MODULE_AUTHOR("Jeroen Domburg <jeroen@spritesmods.com>");
+MODULE_LICENSE("GPL");
diff -uNr ubuntu_project/rpi-35-res/drivers/video/fbdev/Kconfig ubuntu_project/rpi-35-dis/drivers/video/fbdev/Kconfig
--- ubuntu_project/rpi-35-res/drivers/video/fbdev/Kconfig   2015-08-16 16:34:26.228789552 +0800
+++ ubuntu_project/rpi-35-dis/drivers/video/fbdev/Kconfig   2015-04-16 21:59:52.545325000 +0800
@@ -239,6 +239,19 @@
      will be called bcm2708_fb.

+config FB_ILI9341
+   tristate "ILI9341 connected to Raspberry Pi GPIO support"
+   depends on FB
+   select FB_SYS_FILLRECT
+   select FB_SYS_COPYAREA
+   select FB_SYS_IMAGEBLIT
+   select FB_SYS_FOPS
+   select FB_DEFERRED_IO
+   help
+     This driver implements a framebuffer on an LCD controlled by a
+     ILI9341 (or compatible) controller connected to the GPIO of the 
+     Raspberry Pi.
+
 config FB_GRVGA
    tristate "Aeroflex Gaisler framebuffer support"
    depends on FB && SPARC
diff -uNr ubuntu_project/rpi-35-res/drivers/video/fbdev/Kconfig~ ubuntu_project/rpi-35-dis/drivers/video/fbdev/Kconfig~
--- ubuntu_project/rpi-35-res/drivers/video/fbdev/Kconfig~  2015-08-16 16:34:25.972788282 +0800
+++ ubuntu_project/rpi-35-dis/drivers/video/fbdev/Kconfig~  2015-04-16 21:59:52.253324000 +0800
@@ -239,6 +239,19 @@
      will be called bcm2708_fb.

+config FB_ILI9341
+   tristate "ILI9341 connected to Raspberry Pi GPIO support"
+   depends on FB
+   select FB_SYS_FILLRECT
+   select FB_SYS_COPYAREA
+   select FB_SYS_IMAGEBLIT
+   select FB_SYS_FOPS
+   select FB_DEFERRED_IO
+   help
+     This driver implements a framebuffer on an LCD controlled by a
+     ILI9341 (or compatible) controller connected to the GPIO of the 
+     Raspberry Pi.
+
 config FB_GRVGA
    tristate "Aeroflex Gaisler framebuffer support"
    depends on FB && SPARC
diff -uNr ubuntu_project/rpi-35-res/drivers/video/fbdev/Makefile ubuntu_project/rpi-35-dis/drivers/video/fbdev/Makefile
--- ubuntu_project/rpi-35-res/drivers/video/fbdev/Makefile  2015-08-16 16:34:00.624662588 +0800
+++ ubuntu_project/rpi-35-dis/drivers/video/fbdev/Makefile  2015-04-16 22:00:29.593509000 +0800
@@ -130,6 +130,7 @@
 obj-$(CONFIG_FB_MSM)              += msm/
 obj-$(CONFIG_FB_NUC900)           += nuc900fb.o
 obj-$(CONFIG_FB_JZ4740)          += jz4740_fb.o
+obj-$(CONFIG_FB_ILI9341)     += ili9341.o
 obj-$(CONFIG_FB_PUV3_UNIGFX)      += fb-puv3.o
 obj-$(CONFIG_FB_HYPERV)          += hyperv_fb.o
 obj-$(CONFIG_FB_OPENCORES)   += ocfb.o
diff -uNr ubuntu_project/rpi-35-res/drivers/video/fbdev/Makefile~ ubuntu_project/rpi-35-dis/drivers/video/fbdev/Makefile~
--- ubuntu_project/rpi-35-res/drivers/video/fbdev/Makefile~ 2015-08-16 16:34:00.428661616 +0800
+++ ubuntu_project/rpi-35-dis/drivers/video/fbdev/Makefile~ 2015-04-16 22:00:29.453508000 +0800
@@ -130,6 +130,7 @@
 obj-$(CONFIG_FB_MSM)              += msm/
 obj-$(CONFIG_FB_NUC900)           += nuc900fb.o
 obj-$(CONFIG_FB_JZ4740)          += jz4740_fb.o
+obj-$(CONFIG_FB_ILI9341)     += ili9341.o
 obj-$(CONFIG_FB_PUV3_UNIGFX)      += fb-puv3.o
 obj-$(CONFIG_FB_HYPERV)          += hyperv_fb.o
 obj-$(CONFIG_FB_OPENCORES)   += ocfb.o
MunhozThiago commented 8 years ago

From the seller's image:

DMESG

[    0.000000] Booting Linux on physical CPU 0xf00
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Initializing cgroup subsys cpuacct
[    0.000000] Linux version 3.18.9-v7 (lgh@lgh-ThinkPad-X200) (gcc version 4.7.1 20120402 (prerelease) (crosstool-NG 1.15.2) ) #7 SMP PREEMPT Sun Jun 28 09:33:18 CST 2015
[    0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] Machine: BCM2709
[    0.000000] cma: Reserved 8 MiB at 0x3a800000
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] On node 0 totalpages: 241664
[    0.000000] free_area_init_node: node 0, pgdat 8081e640, node_mem_map ba093000
[    0.000000]   Normal zone: 1888 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 241664 pages, LIFO batch:31
[    0.000000] [bcm2709_smp_init_cpus] enter (8600->f3003010)
[    0.000000] [bcm2709_smp_init_cpus] ncores=4
[    0.000000] PERCPU: Embedded 10 pages/cpu @ba066000 s12224 r8192 d20544 u40960
[    0.000000] pcpu-alloc: s12224 r8192 d20544 u40960 alloc=10*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3 
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 239776
[    0.000000] Kernel command line: dma.dmachans=0x7f35 bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2709.boardrev=0xa01041 bcm2709.serial=0x5f4ffe1a smsc95xx.macaddr=B8:27:EB:4F:FE:1A bcm2708_fb.fbswap=1 bcm2709.disk_led_gpio=47 bcm2709.disk_led_active_low=0 sdhci-bcm2708.emmc_clock_freq=250000000 vc_mem.mem_base=0x3dc00000 vc_mem.mem_size=0x3f000000  dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
[    0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[    0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Memory: 940800K/966656K available (5759K kernel code, 401K rwdata, 1760K rodata, 392K init, 771K bss, 25856K reserved)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xffe00000   (2048 kB)
[    0.000000]     vmalloc : 0xbb800000 - 0xff000000   (1080 MB)
[    0.000000]     lowmem  : 0x80000000 - 0xbb000000   ( 944 MB)
[    0.000000]     modules : 0x7f000000 - 0x80000000   (  16 MB)
[    0.000000]       .text : 0x80008000 - 0x8075feb4   (7520 kB)
[    0.000000]       .init : 0x80760000 - 0x807c2000   ( 392 kB)
[    0.000000]       .data : 0x807c2000 - 0x808267f4   ( 402 kB)
[    0.000000]        .bss : 0x808267f4 - 0x808e77e4   ( 772 kB)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] Preemptible hierarchical RCU implementation.
[    0.000000] NR_IRQS:608
[    0.000000] Architected cp15 timer(s) running at 19.20MHz (virt).
[    0.000013] sched_clock: 56 bits at 19MHz, resolution 52ns, wraps every 3579139424256ns
[    0.000036] Switching to timer-based delay loop, resolution 52ns
[    0.000328] Console: colour dummy device 80x30
[    0.002134] console [tty1] enabled
[    0.002191] Calibrating delay loop (skipped), value calculated using timer frequency.. 38.40 BogoMIPS (lpj=192000)
[    0.002288] pid_max: default: 32768 minimum: 301
[    0.002748] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.002818] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.004162] Initializing cgroup subsys memory
[    0.004256] Initializing cgroup subsys devices
[    0.004322] Initializing cgroup subsys freezer
[    0.004379] Initializing cgroup subsys net_cls
[    0.004437] Initializing cgroup subsys blkio
[    0.004580] CPU: Testing write buffer coherency: ok
[    0.004700] ftrace: allocating 20075 entries in 59 pages
[    0.054633] missing device node for CPU 0
[    0.054714] missing device node for CPU 1
[    0.054747] missing device node for CPU 2
[    0.054777] missing device node for CPU 3
[    0.054818] CPU0: thread -1, cpu 0, socket 15, mpidr 80000f00
[    0.054859] [bcm2709_smp_prepare_cpus] enter
[    0.055029] Setting up static identity map for 0x52f398 - 0x52f3f0
[    0.114670] [bcm2709_boot_secondary] cpu:1 started (0) 18
[    0.114982] CPU1: Booted secondary processor
[    0.114989] [bcm2709_secondary_init] enter cpu:1
[    0.115044] CPU1: thread -1, cpu 1, socket 15, mpidr 80000f01
[    0.134649] [bcm2709_boot_secondary] cpu:2 started (0) 18
[    0.134896] CPU2: Booted secondary processor
[    0.134903] [bcm2709_secondary_init] enter cpu:2
[    0.134936] CPU2: thread -1, cpu 2, socket 15, mpidr 80000f02
[    0.154686] [bcm2709_boot_secondary] cpu:3 started (0) 18
[    0.154923] CPU3: Booted secondary processor
[    0.154930] [bcm2709_secondary_init] enter cpu:3
[    0.154966] CPU3: thread -1, cpu 3, socket 15, mpidr 80000f03
[    0.155064] Brought up 4 CPUs
[    0.155180] SMP: Total of 4 processors activated (153.60 BogoMIPS).
[    0.155218] CPU: All CPU(s) started in SVC mode.
[    0.156253] devtmpfs: initialized
[    0.182175] VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 5
[    0.184392] pinctrl core: initialized pinctrl subsystem
[    0.185220] NET: Registered protocol family 16
[    0.190989] DMA: preallocated 4096 KiB pool for atomic coherent allocations
[    0.214478] cpuidle: using governor ladder
[    0.244510] cpuidle: using governor menu
[    0.245099] bcm2709.uart_clock = 3000000
[    0.247790] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
[    0.247849] hw-breakpoint: maximum watchpoint size is 8 bytes.
[    0.247909] mailbox: Broadcom VideoCore Mailbox driver
[    0.248038] bcm2708_vcio: mailbox at f300b880
[    0.248438] bcm_power: Broadcom power driver
[    0.248480] bcm_power_open() -> 0
[    0.248509] bcm_power_request(0, 8)
[    0.749216] bcm_mailbox_read -> 00000080, 0
[    0.749252] bcm_power_request -> 0
[    0.749397] Serial: AMBA PL011 UART driver
[    0.749547] dev:f1: ttyAMA0 at MMIO 0x3f201000 (irq = 83, base_baud = 0) is a PL011 rev3
[    1.260301] console [ttyAMA0] enabled
[    1.338087] SCSI subsystem initialized
[    1.342093] usbcore: registered new interface driver usbfs
[    1.347761] usbcore: registered new interface driver hub
[    1.353222] usbcore: registered new device driver usb
[    1.360308] Switched to clocksource arch_sys_counter
[    1.395386] FS-Cache: Loaded
[    1.398644] CacheFiles: Loaded
[    1.413939] NET: Registered protocol family 2
[    1.419762] TCP established hash table entries: 8192 (order: 3, 32768 bytes)
[    1.427008] TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
[    1.433682] TCP: Hash tables configured (established 8192 bind 8192)
[    1.440155] TCP: reno registered
[    1.443434] UDP hash table entries: 512 (order: 2, 16384 bytes)
[    1.449424] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
[    1.456168] NET: Registered protocol family 1
[    1.461046] RPC: Registered named UNIX socket transport module.
[    1.466996] RPC: Registered udp transport module.
[    1.471798] RPC: Registered tcp transport module.
[    1.476520] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    1.484179] bcm2708_dma: DMA manager at f3007000
[    1.488952] bcm2708_gpio: bcm2708_gpio_probe 807ed1d8
[    1.494826] vc-mem: phys_addr:0x00000000 mem_base=0x3dc00000 mem_size:0x3f000000(1008 MiB)
[    1.504822] futex hash table entries: 1024 (order: 4, 65536 bytes)
[    1.511338] audit: initializing netlink subsys (disabled)
[    1.516816] audit: type=2000 audit(1.289:1): initialized
[    1.538462] VFS: Disk quotas dquot_6.5.2
[    1.542830] Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    1.552413] FS-Cache: Netfs 'nfs' registered for caching
[    1.558720] NFS: Registering the id_resolver key type
[    1.563904] Key type id_resolver registered
[    1.568104] Key type id_legacy registered
[    1.573416] msgmni has been set to 1853
[    1.579047] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
[    1.586782] io scheduler noop registered
[    1.590765] io scheduler deadline registered (default)
[    1.596269] io scheduler cfq registered
[    1.911132] input: KeDei.taobao.com as /devices/virtual/input/input0
[    2.321038] Console: switching to colour frame buffer device 60x40
[    2.334871] bcm2708-dmaengine bcm2708-dmaengine: Load BCM2835 DMA engine driver
[    2.346825] uart-pl011 dev:f1: no DMA platform data
[    2.360961] vc-cma: Videocore CMA driver
[    2.367070] vc-cma: vc_cma_base      = 0x00000000
[    2.373993] vc-cma: vc_cma_size      = 0x00000000 (0 MiB)
[    2.381596] vc-cma: vc_cma_initial   = 0x00000000 (0 MiB)
[    2.401367] brd: module loaded
[    2.412786] loop: module loaded
[    2.418491] vchiq: vchiq_init_state: slot_zero = 0xba800000, is_master = 0
[    2.430726] Loading iSCSI transport class v2.0-870.
[    2.438801] usbcore: registered new interface driver smsc95xx
[    2.448947] dwc_otg: version 3.00a 10-AUG-2012 (platform bus)
[    2.659505] Core Release: 2.80a
[    2.664917] Setting default values for core params
[    2.671956] Finished setting default values for core params
[    2.882357] Using Buffer DMA mode
[    2.887944] Periodic Transfer Interrupt Enhancement - disabled
[    2.898230] Multiprocessor Interrupt Enhancement - disabled
[    2.908306] OTG VER PARAM: 0, OTG VER FLAG: 0
[    2.915020] Dedicated Tx FIFOs mode
[    2.922611] WARN::dwc_otg_hcd_init:1047: FIQ DMA bounce buffers: virt = 0xbac04000 dma = 0xfac04000 len=9024
[    2.937123] FIQ FSM acceleration enabled for :
[    2.937123] Non-periodic Split Transactions
[    2.937123] Periodic Split Transactions
[    2.937123] High-Speed Isochronous Endpoints
[    2.962531] dwc_otg: Microframe scheduler enabled
[    2.962642] WARN::hcd_init_fiq:412: FIQ on core 1 at 0x803df06c
[    2.972913] WARN::hcd_init_fiq:413: FIQ ASM at 0x803df3b8 length 36
[    2.983678] WARN::hcd_init_fiq:438: MPHI regs_base at 0xbb85e000
[    2.994294] dwc_otg bcm2708_usb: DWC OTG Controller
[    3.001592] dwc_otg bcm2708_usb: new USB bus registered, assigned bus number 1
[    3.013503] dwc_otg bcm2708_usb: irq 32, io mem 0x00000000
[    3.023678] Init: Port Power? op_state=1
[    3.029927] Init: Power Port (0)
[    3.035775] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[    3.047173] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    3.059068] usb usb1: Product: DWC OTG Controller
[    3.066159] usb usb1: Manufacturer: Linux 3.18.9-v7 dwc_otg_hcd
[    3.076687] usb usb1: SerialNumber: bcm2708_usb
[    3.084657] hub 1-0:1.0: USB hub found
[    3.090832] hub 1-0:1.0: 1 port detected
[    3.097643] dwc_otg: FIQ enabled
[    3.097658] dwc_otg: NAK holdoff enabled
[    3.097669] dwc_otg: FIQ split-transaction FSM enabled
[    3.097716] Module dwc_common_port init
[    3.098227] usbcore: registered new interface driver usb-storage
[    3.109346] mousedev: PS/2 mouse device common for all mice
[    3.120435] bcm2835-cpufreq: min=600000 max=900000
[    3.128065] sdhci: Secure Digital Host Controller Interface driver
[    3.139133] sdhci: Copyright(c) Pierre Ossman
[    3.146163] DMA channels allocated for the MMC driver
[    3.190407] Load BCM2835 MMC driver
[    3.199038] sdhci-pltfm: SDHCI platform and OF driver helper
[    3.210004] ledtrig-cpu: registered to indicate activity on CPUs
[    3.221068] hidraw: raw HID events driver (C) Jiri Kosina
[    3.227987] mmc0: host does not support reading read-only switch, assuming write-enable
[    3.230165] mmc0: new high speed SDHC card at address 0007
[    3.230946] mmcblk0: mmc0:0007 SD16G 14.4 GiB 
[    3.232582]  mmcblk0: p1 p2
[    3.265050] usbcore: registered new interface driver usbhid
[    3.275622] usbhid: USB HID core driver
[    3.282404] TCP: cubic registered
[    3.288231] Initializing XFRM netlink socket
[    3.290529] Indeed it is in host mode hprt0 = 00021501
[    3.302655] NET: Registered protocol family 17
[    3.309780] Key type dns_resolver registered
[    3.317158] Registering SWP/SWPB emulation handler
[    3.325642] registered taskstats version 1
[    3.332503] vc-sm: Videocore shared memory driver
[    3.339593] [vc_sm_connected_init]: start
[    3.346923] [vc_sm_connected_init]: end - returning 0
[    3.470451] usb 1-1: new high-speed USB device number 2 using dwc_otg
[    3.481849] Indeed it is in host mode hprt0 = 00001101
[    3.680694] usb 1-1: New USB device found, idVendor=0424, idProduct=9514
[    3.692278] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    3.705419] hub 1-1:1.0: USB hub found
[    3.711777] hub 1-1:1.0: 5 ports detected
[    3.990459] usb 1-1.1: new high-speed USB device number 3 using dwc_otg
[    4.100681] usb 1-1.1: New USB device found, idVendor=0424, idProduct=ec00
[    4.112368] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    4.127566] smsc95xx v1.0.4
[    4.194164] smsc95xx 1-1.1:1.0 eth0: register 'smsc95xx' at usb-bcm2708_usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:4f:fe:1a
[    4.450453] usb 1-1.2: new full-speed USB device number 4 using dwc_otg
[    4.542991] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[    4.556232] VFS: Mounted root (ext4 filesystem) on device 179:2.
[    4.568528] devtmpfs: mounted
[    4.574901] Freeing unused kernel memory: 392K (80760000 - 807c2000)
[    4.599267] usb 1-1.2: New USB device found, idVendor=0a12, idProduct=0001
[    4.611433] usb 1-1.2: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[    4.624061] usb 1-1.2: Product: CSR8510 A10
[    4.710577] usb 1-1.3: new high-speed USB device number 5 using dwc_otg
[    4.831543] usb 1-1.3: New USB device found, idVendor=148f, idProduct=7601
[    4.843726] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    4.856436] usb 1-1.3: Product: 802.11 n WLAN
[    4.863512] usb 1-1.3: Manufacturer: MediaTek
[    4.870697] usb 1-1.3: SerialNumber: 1.0
[    5.110583] usb 1-1.5: new high-speed USB device number 6 using dwc_otg
[    5.301732] usb 1-1.5: New USB device found, idVendor=1908, idProduct=2310
[    5.314185] usb 1-1.5: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    5.328421] usb 1-1.5: Product: USB2.0 PC CAMERA
[    5.336193] usb 1-1.5: Manufacturer: Generic
[    5.344095] usb 1-1.5: SerialNumber: 20100331010203
[    5.796243] udevd[175]: starting version 175
[    6.229577] bcm2708_i2c bcm2708_i2c.1: could not get IRQ
[    6.639752] media: Linux media interface: v0.10
[    6.757992] Linux video capture interface: v2.00
[    6.797262] Bluetooth: Core ver 2.19
[    6.848077] NET: Registered protocol family 31
[    6.900535] Bluetooth: HCI device and connection manager initialized
[    6.964423] uvcvideo: Found UVC 1.00 device USB2.0 PC CAMERA (1908:2310)
[    6.989390] Bluetooth: HCI socket layer initialized
[    7.019325] Bluetooth: L2CAP socket layer initialized
[    7.043021] input: USB2.0 PC CAMERA as /devices/platform/bcm2708_usb/usb1/1-1/1-1.5/1-1.5:1.0/input/input1
[    7.080292] Bluetooth: SCO socket layer initialized
[    7.097558] usbcore: registered new interface driver uvcvideo
[    7.122299] usbcore: registered new interface driver snd-usb-audio
[    7.148007] usbcore: registered new interface driver btusb
[    7.169162] USB Video Class driver (1.1.1)
[    7.458989] random: nonblocking pool is initialized
[   12.531850] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[   12.859165] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[   17.314261] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup
[   18.717989] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0x4DE1
[   23.072671] Adding 102396k swap on /var/swap.  Priority:-1 extents:2 across:2101240k SSFS

LSMOD

Module                  Size  Used by
snd_bcm2835            18739  0 
ecb                     2031  1 
btusb                  20561  0 
evdev                   9894  4 
joydev                  8923  0 
snd_usb_audio         105250  0 
snd_hwdep               5917  1 snd_usb_audio
snd_usbmidi_lib        19380  1 snd_usb_audio
snd_seq_midi            4370  0 
uvcvideo               70175  0 
snd_seq_midi_event      5371  1 snd_seq_midi
videobuf2_vmalloc       3033  1 uvcvideo
videobuf2_memops        1540  1 videobuf2_vmalloc
videobuf2_core         33588  1 uvcvideo
v4l2_common             4565  1 videobuf2_core
snd_rawmidi            18122  2 snd_usbmidi_lib,snd_seq_midi
videodev              121832  3 uvcvideo,v4l2_common,videobuf2_core
bluetooth             283385  2 btusb
rfkill                 16600  1 bluetooth
media                  11521  2 uvcvideo,videodev
snd_soc_bcm2708_i2s     6448  0 
regmap_mmio             2961  1 snd_soc_bcm2708_i2s
snd_soc_core          139781  1 snd_soc_bcm2708_i2s
snd_compress            7579  1 snd_soc_core
snd_pcm_dmaengine       3335  1 snd_soc_core
snd_pcm                74726  4 snd_bcm2835,snd_usb_audio,snd_soc_core,snd_pcm_dmaengine
snd_seq                52859  2 snd_seq_midi_event,snd_seq_midi
snd_seq_device          5597  3 snd_seq,snd_rawmidi,snd_seq_midi
snd_timer              17616  2 snd_pcm,snd_seq
snd                    51452  11 snd_bcm2835,snd_usb_audio,snd_soc_core,snd_hwdep,snd_timer,snd_pcm,snd_seq,snd_rawmidi,snd_usbmidi_lib,snd_seq_device,snd_compress
i2c_bcm2708             4946  0 
kronikabuse commented 8 years ago

Raspberry pi 2 with Wavwshare 3.5(A) lcd. I followed all the instructions I could find. The screen works for me but not the touchscreen part. lsmod Module Size Used by ads7846 10636 0 fbtft_device 34613 0 flexfb 14438 3 fbtft 34490 2 flexfb,fbtft_device fb_sys_fops 1565 1 fbtft syscopyarea 3105 1 fbtft sysfillrect 3584 1 fbtft sysimgblt 2278 1 fbtft snd_bcm2835 22339 0 snd_pcm 92165 1 snd_bcm2835 snd_seq 62016 0 snd_seq_device 8184 1 snd_seq snd_timer 23475 2 snd_pcm,snd_seq snd 67406 5 snd_bcm2835,snd_timer,snd_pcm,snd_seq,snd_seq_device 8192cu 569588 0 spi_bcm2708 8696 0 uio_pdrv_genirq 3682 0 uio 9989 1 uio_pdrv_genirq evdev 11386 4 sg 22023 0 joydev 9774 0

dmesg [ 0.000000] Booting Linux on physical CPU 0x0 [ 0.000000] Initializing cgroup subsys cpuset [ 0.000000] Initializing cgroup subsys cpu [ 0.000000] Initializing cgroup subsys cpuacct [ 0.000000] Linux version 4.0.7+ (pi@raspi2) (gcc version 4.8.3 20140106 (prerelease) (crosstool-NG linaro-1.13.1-4.8-2014.01 - Linaro GCC 2013.11) ) #1 PREEMPT Sat Jul 11 20:08:42 CEST 2015 [ 0.000000] CPU: ARMv6-compatible processor [410fb767] revision 7 (ARMv7), cr=00c5387d [ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruction cache [ 0.000000] Machine model: Raspberry Pi Model B Plus Rev 1.2 [ 0.000000] cma: Reserved 8 MiB at 0x17800000 [ 0.000000] Memory policy: Data cache writeback [ 0.000000] On node 0 totalpages: 98304 [ 0.000000] free_area_init_node: node 0, pgdat c08732bc, node_mem_map d7493000 [ 0.000000] Normal zone: 864 pages used for memmap [ 0.000000] Normal zone: 0 pages reserved [ 0.000000] Normal zone: 98304 pages, LIFO batch:31 [ 0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768 [ 0.000000] pcpu-alloc: [0] 0 [ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 97440 [ 0.000000] Kernel command line: dma.dmachans=0x7f35 bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2708.boardrev=0x10 bcm2708.serial=0x27ff26f5 smsc95xx.macaddr=B8:27:EB:FF:26:F5 bcm2708_fb.fbswap=1 bcm2708.disk_led_gpio=47 bcm2708.disk_led_active_low=0 sdhci-bcm2708.emmc_clock_freq=250000000 vc_mem.mem_base=0x1ec00000 vc_mem.mem_size=0x20000000 dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait fbtft_device.custom fbtft_device.name=flexfb fbtft_device.gpios=dc:24,reset:25 fbtft_device.bgr=1 fbtft_device.speed=16000000 fbcon=map:10 fbcon=font:ProFont6x11 logo.nologo dma.dmachans=0x7f35 console=tty1 consoleblank=0 fbtft_device.fps=50 fbtft_device.rotate=0 fbcon=map:10 [ 0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes) [ 0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes) [ 0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes) [ 0.000000] Memory: 371648K/393216K available (6063K kernel code, 333K rwdata, 1908K rodata, 348K init, 720K bss, 13376K reserved, 8192K cma-reserved) [ 0.000000] Virtual kernel memory layout: [ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB) [ 0.000000] fixmap : 0xffc00000 - 0xfff00000 (3072 kB) [ 0.000000] vmalloc : 0xd8800000 - 0xff000000 ( 616 MB) [ 0.000000] lowmem : 0xc0000000 - 0xd8000000 ( 384 MB) [ 0.000000] modules : 0xbf000000 - 0xc0000000 ( 16 MB) [ 0.000000] .text : 0xc0008000 - 0xc07d0fcc (7972 kB) [ 0.000000] .init : 0xc07d1000 - 0xc0828000 ( 348 kB) [ 0.000000] .data : 0xc0828000 - 0xc087b674 ( 334 kB) [ 0.000000] .bss : 0xc087b674 - 0xc092f778 ( 721 kB) [ 0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1 [ 0.000000] Preemptible hierarchical RCU implementation. [ 0.000000] Additional per-CPU info printed with stalls. [ 0.000000] NR_IRQS:522 [ 0.000027] sched_clock: 32 bits at 1000kHz, resolution 1000ns, wraps every 2147483648000ns [ 0.000076] Switching to timer-based delay loop, resolution 1000ns [ 0.000348] Console: colour dummy device 80x30 [ 0.001809] console [tty1] enabled [ 0.001873] Calibrating delay loop (skipped), value calculated using timer frequency.. 2.00 BogoMIPS (lpj=10000) [ 0.001972] pid_max: default: 32768 minimum: 301 [ 0.002337] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes) [ 0.002417] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes) [ 0.003491] Initializing cgroup subsys blkio [ 0.003587] Initializing cgroup subsys memory [ 0.003660] Initializing cgroup subsys devices [ 0.003728] Initializing cgroup subsys freezer [ 0.003792] Initializing cgroup subsys net_cls [ 0.003922] CPU: Testing write buffer coherency: ok [ 0.004048] ftrace: allocating 19591 entries in 58 pages [ 0.111746] Setting up static identity map for 0x57dcd8 - 0x57dd10 [ 0.114363] devtmpfs: initialized [ 0.121872] VFP support v0.3: implementor 41 architecture 1 part 20 variant b rev 5 [ 0.124007] pinctrl core: initialized pinctrl subsystem [ 0.128222] NET: Registered protocol family 16 [ 0.134344] DMA: preallocated 4096 KiB pool for atomic coherent allocations [ 0.136400] bcm2708.uart_clock = 3000000 [ 0.141000] hw-breakpoint: found 6 breakpoint and 1 watchpoint registers. [ 0.141090] hw-breakpoint: maximum watchpoint size is 4 bytes. [ 0.141287] Serial: AMBA PL011 UART driver [ 0.141692] 20201000.uart: ttyAMA0 at MMIO 0x20201000 (irq = 83, base_baud = 0) is a PL011 rev2 [ 0.534199] console [ttyAMA0] enabled [ 0.538831] bcm2708_vcio 2000b880.mailbox: mailbox at f200b880 [ 0.617283] bcm2708-dmaengine 20007000.dma: DMA legacy API manager at f2007000, dmachans=0x7f35 [ 0.626837] bcm2708-dmaengine 20007000.dma: Load BCM2835 DMA engine driver [ 0.633775] bcm2708-dmaengine 20007000.dma: dma_debug:0 [ 0.639253] bcm_power: Broadcom power driver [ 0.643575] bcm_power_open() -> 0 [ 0.646918] bcm_power_request(0, 8) [ 0.676160] bcm_mailbox_read -> 00000080, 0 [ 0.680388] bcm_power_request -> 0 [ 0.684652] SCSI subsystem initialized [ 0.688810] usbcore: registered new interface driver usbfs [ 0.694572] usbcore: registered new interface driver hub [ 0.700104] usbcore: registered new device driver usb [ 0.707924] Switched to clocksource stc [ 0.739259] FS-Cache: Loaded [ 0.742579] CacheFiles: Loaded [ 0.761952] NET: Registered protocol family 2 [ 0.767828] TCP established hash table entries: 4096 (order: 2, 16384 bytes) [ 0.775278] TCP bind hash table entries: 4096 (order: 2, 16384 bytes) [ 0.781914] TCP: Hash tables configured (established 4096 bind 4096) [ 0.788434] TCP: reno registered [ 0.791717] UDP hash table entries: 256 (order: 0, 4096 bytes) [ 0.797603] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes) [ 0.804312] NET: Registered protocol family 1 [ 0.809412] RPC: Registered named UNIX socket transport module. [ 0.815406] RPC: Registered udp transport module. [ 0.820263] RPC: Registered tcp transport module. [ 0.825011] RPC: Registered tcp NFSv4.1 backchannel transport module. [ 0.833277] hw perfevents: enabled with armv6_1176 PMU driver, 3 counters available [ 0.842468] futex hash table entries: 256 (order: -1, 3072 bytes) [ 0.864592] VFS: Disk quotas dquot_6.5.2 [ 0.869147] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes) [ 0.878865] FS-Cache: Netfs 'nfs' registered for caching [ 0.885944] NFS: Registering the id_resolver key type [ 0.891271] Key type id_resolver registered [ 0.895504] Key type id_legacy registered [ 0.903259] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252) [ 0.911334] io scheduler noop registered [ 0.915338] io scheduler deadline registered (default) [ 0.921084] io scheduler cfq registered [ 0.927383] BCM2708FB: allocated DMA memory 57c00000 [ 0.932729] BCM2708FB: allocated DMA channel 0 @ f2007000 [ 0.943338] Console: switching to colour frame buffer device 82x26 [ 0.955321] Serial: 8250/16550 driver, 0 ports, IRQ sharing disabled [ 0.964363] uart-pl011 20201000.uart: no DMA platform data [ 0.973317] vc-cma: Videocore CMA driver [ 0.979497] vc-cma: vc_cma_base = 0x00000000 [ 0.986227] vc-cma: vc_cma_size = 0x00000000 (0 MiB) [ 0.993710] vc-cma: vc_cma_initial = 0x00000000 (0 MiB) [ 1.001554] vc-mem: phys_addr:0x00000000 mem_base=0x1ec00000 mem_size:0x20000000(512 MiB) [ 1.033331] brd: module loaded [ 1.048393] loop: module loaded [ 1.054685] vchiq: vchiq_init_state: slot_zero = 0xd7c80000, is_master = 0 [ 1.065114] Loading iSCSI transport class v2.0-870. [ 1.073759] usbcore: registered new interface driver smsc95xx [ 1.081837] dwc_otg: version 3.00a 10-AUG-2012 (platform bus) [ 1.289885] Core Release: 2.80a [ 1.294998] Setting default values for core params [ 1.301855] Finished setting default values for core params [ 1.509710] Using Buffer DMA mode [ 1.514997] Periodic Transfer Interrupt Enhancement - disabled [ 1.522787] Multiprocessor Interrupt Enhancement - disabled [ 1.530338] OTG VER PARAM: 0, OTG VER FLAG: 0 [ 1.536635] Dedicated Tx FIFOs mode [ 1.542645] WARN::dwc_otg_hcd_init:1047: FIQ DMA bounce buffers: virt = 0xd7c14000 dma = 0x57c14000 len=9024 [ 1.556598] FIQ FSM acceleration enabled for : [ 1.556598] Non-periodic Split Transactions [ 1.556598] Periodic Split Transactions [ 1.556598] High-Speed Isochronous Endpoints [ 1.581046] dwc_otg: Microframe scheduler enabled [ 1.581165] WARN::hcd_init_fiq:412: FIQ on core 0 at 0xc0416fc8 [ 1.589105] WARN::hcd_init_fiq:413: FIQ ASM at 0xc04172a0 length 36 [ 1.597370] WARN::hcd_init_fiq:438: MPHI regs_base at 0xd8896000 [ 1.605525] dwc_otg 20980000.usb: DWC OTG Controller [ 1.612632] dwc_otg 20980000.usb: new USB bus registered, assigned bus number 1 [ 1.622083] dwc_otg 20980000.usb: irq 32, io mem 0x00000000 [ 1.629765] Init: Port Power? op_state=1 [ 1.635710] Init: Power Port (0) [ 1.641342] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002 [ 1.650242] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1 [ 1.659535] usb usb1: Product: DWC OTG Controller [ 1.666215] usb usb1: Manufacturer: Linux 4.0.7+ dwc_otg_hcd [ 1.673881] usb usb1: SerialNumber: 20980000.usb [ 1.681605] hub 1-0:1.0: USB hub found [ 1.687458] hub 1-0:1.0: 1 port detected [ 1.694097] dwc_otg: FIQ enabled [ 1.694122] dwc_otg: NAK holdoff enabled [ 1.694135] dwc_otg: FIQ split-transaction FSM enabled [ 1.694206] Module dwc_common_port init [ 1.694792] usbcore: registered new interface driver usb-storage [ 1.703420] mousedev: PS/2 mouse device common for all mice [ 1.712467] bcm2835-cpufreq: min=700000 max=900000 [ 1.719771] Driver 'mmcblk' needs updating - please use bus_type methods [ 1.728750] sdhci: Secure Digital Host Controller Interface driver [ 1.736900] sdhci: Copyright(c) Pierre Ossman [ 1.743885] mmc-bcm2835 20300000.mmc: mmc_debug:0 mmc_debug2:0 [ 1.751791] mmc-bcm2835 20300000.mmc: DMA channels allocated [ 1.798366] sdhci-pltfm: SDHCI platform and OF driver helper [ 1.806756] ledtrig-cpu: registered to indicate activity on CPUs [ 1.817413] hidraw: raw HID events driver (C) Jiri Kosina [ 1.829698] usbcore: registered new interface driver usbhid [ 1.837298] usbhid: USB HID core driver [ 1.845727] TCP: cubic registered [ 1.853249] Initializing XFRM netlink socket [ 1.861719] NET: Registered protocol family 17 [ 1.869524] Key type dns_resolver registered [ 1.878251] registered taskstats version 1 [ 1.884698] vc-sm: Videocore shared memory driver [ 1.891645] Indeed it is in host mode hprt0 = 00021501

[ 1.926396] [vc_sm_connected_init]: end - returning 0 [ 1.938672] mmc0: host does not support reading read-only switch, assuming write-enable [ 1.959727] Waiting for root device /dev/mmcblk0p2... [ 1.980736] mmc0: new high speed SDHC card at address 0007 [ 1.998638] mmcblk0: mmc0:0007 SD08G 7.42 GiB [ 2.011291] mmcblk0: p1 p2 [ 2.086383] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null) [ 2.098821] VFS: Mounted root (ext4 filesystem) readonly on device 179:2. [ 2.109755] devtmpfs: mounted [ 2.115997] Freeing unused kernel memory: 348K (c07d1000 - c0828000) [ 2.128197] usb 1-1: new high-speed USB device number 2 using dwc_otg [ 2.137759] Indeed it is in host mode hprt0 = 00001101 [ 2.348593] usb 1-1: New USB device found, idVendor=0424, idProduct=9514 [ 2.357600] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0 [ 2.368764] hub 1-1:1.0: USB hub found [ 2.374947] hub 1-1:1.0: 5 ports detected [ 2.658237] usb 1-1.1: new high-speed USB device number 3 using dwc_otg [ 2.768746] usb 1-1.1: New USB device found, idVendor=0424, idProduct=ec00 [ 2.788232] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0 [ 2.809885] smsc95xx v1.0.4 [ 2.875361] smsc95xx 1-1.1:1.0 eth0: register 'smsc95xx' at usb-20980000.usb-1.1, smsc95xx USB 2.0 Ethernet, b8:27:eb:ff:26:f5 [ 2.988237] usb 1-1.2: new high-speed USB device number 4 using dwc_otg [ 3.110288] usb 1-1.2: New USB device found, idVendor=0bda, idProduct=8176 [ 3.128137] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 3.148203] usb 1-1.2: Product: 802.11n WLAN Adapter [ 3.155634] usb 1-1.2: Manufacturer: Realtek [ 3.176084] usb 1-1.2: SerialNumber: 00e04c000001 [ 3.288306] usb 1-1.3: new high-speed USB device number 5 using dwc_otg [ 3.399214] usb 1-1.3: New USB device found, idVendor=0781, idProduct=5530 [ 3.418203] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 3.427883] usb 1-1.3: Product: Cruzer [ 3.448115] usb 1-1.3: Manufacturer: SanDisk [ 3.454661] usb 1-1.3: SerialNumber: 20042204901DC371645B [ 3.479318] usb-storage 1-1.3:1.0: USB Mass Storage device detected [ 3.505819] scsi host0: usb-storage 1-1.3:1.0 [ 3.758314] usb 1-1.4: new low-speed USB device number 6 using dwc_otg [ 3.895108] usb 1-1.4: New USB device found, idVendor=04f3, idProduct=01a4 [ 3.918135] usb 1-1.4: New USB device strings: Mfr=0, Product=2, SerialNumber=0 [ 3.927762] usb 1-1.4: Product: 2.4G RF Keyboard & Mouse [ 3.957791] input: 2.4G RF Keyboard & Mouse as /devices/platform/soc/20980000.usb/usb1/1-1/1-1.4/1-1.4:1.0/0003:04F3:01A4.0001/input/input0 [ 4.048536] hid-generic 0003:04F3:01A4.0001: input,hidraw0: USB HID v1.10 Keyboard [2.4G RF Keyboard & Mouse] on usb-20980000.usb-1.4/input0 [ 4.091625] udevd[164]: starting version 175 [ 4.133054] input: 2.4G RF Keyboard & Mouse as /devices/platform/soc/20980000.usb/usb1/1-1/1-1.4/1-1.4:1.1/0003:04F3:01A4.0002/input/input1 [ 4.239487] hid-generic 0003:04F3:01A4.0002: input,hiddev0,hidraw1: USB HID v1.10 Mouse [2.4G RF Keyboard & Mouse] on usb-20980000.usb-1.4/input1 [ 4.509669] scsi 0:0:0:0: Direct-Access SanDisk Cruzer 1.10 PQ: 0 ANSI: 2 [ 4.543015] sd 0:0:0:0: [sda] 15633408 512-byte logical blocks: (8.00 GB/7.45 GiB) [ 4.589836] sd 0:0:0:0: [sda] Write Protect is off [ 4.597294] sd 0:0:0:0: [sda] Mode Sense: 03 00 00 00 [ 4.611209] sd 0:0:0:0: [sda] No Caching mode page found [ 4.636583] sd 0:0:0:0: [sda] Assuming drive cache: write through [ 4.672243] sda: sda1 [ 4.696808] sd 0:0:0:0: [sda] Attached SCSI removable disk [ 5.495158] sd 0:0:0:0: Attached scsi generic sg0 type 0 [ 6.089414] random: nonblocking pool is initialized [ 7.536440] bcm2708_spi 20204000.spi: DMA channel 2 at address 0xf2007200 with irq 77 [ 7.689325] bcm2708_spi 20204000.spi: DMA channel 4 at address 0xf2007400 with irq 20 [ 7.932765] bcm2708_spi 20204000.spi: SPI Controller at 0x20204000 (irq 80) [ 7.992066] bcm2708_spi 20204000.spi: SPI Controller running in dma mode [ 9.045780] usbcore: registered new interface driver rtl8192cu [ 11.950014] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null) [ 12.403391] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null) [ 13.551612] fbtft: module is from the staging directory, the quality is unknown, you have been warned. [ 13.578811] flexfb: module is from the staging directory, the quality is unknown, you have been warned. [ 13.716486] fbtft_device: module is from the staging directory, the quality is unknown, you have been warned. [ 13.735615] fbtft_device: SPI devices registered: [ 13.753575] fbtft_device: spidev spi0.0 500kHz 8 bits mode=0x00 [ 13.771810] fbtft_device: spidev spi0.1 500kHz 8 bits mode=0x00 [ 13.780666] fbtft_device: 'fb' Platform devices registered: [ 13.788896] fbtft_device: soc:fb id=-1 pdata? no [ 13.796221] fbtft_device: Deleting spi0.0 [ 13.806516] flexfb spi0.0: fbtft_request_gpios: 'reset' = GPIO25 [ 13.828281] flexfb spi0.0: fbtft_request_gpios: 'dc' = GPIO24 [ 13.836320] flexfb spi0.0: flexfb_verify_gpios_dc() [ 13.853851] flexfb spi0.0: fbtft_init_display() [ 13.860767] flexfb spi0.0: fbtft_reset() [ 13.986741] flexfb spi0.0: init: write(0xB0) 0x00 [ 13.993798] flexfb spi0.0: init: write(0x11) [ 14.000287] flexfb spi0.0: init: mdelay(250) [ 14.283313] flexfb spi0.0: init: write(0x3A) 0x55 [ 14.290298] flexfb spi0.0: init: write(0xC2) 0x44 [ 14.297075] flexfb spi0.0: init: write(0xC5) 0x00 0x00 0x00 0x00 [ 14.305283] flexfb spi0.0: init: write(0xE0) 0x0F 0x1F 0x1C 0x0C 0x0F 0x08 0x48 0x98 0x37 0x0A 0x13 0x04 0x11 0x0D 0x00 [ 14.320162] flexfb spi0.0: init: write(0xE1) 0x0F 0x32 0x2E 0x0B 0x0D 0x05 0x47 0x75 0x37 0x06 0x10 0x03 0x24 0x20 0x00 [ 14.335035] flexfb spi0.0: init: write(0xE2) 0x0F 0x32 0x2E 0x0B 0x0D 0x05 0x47 0x75 0x37 0x06 0x10 0x03 0x24 0x20 0x00 [ 14.349982] flexfb spi0.0: init: write(0x36) 0x28 [ 14.356877] flexfb spi0.0: init: write(0x11) [ 14.363254] flexfb spi0.0: init: write(0x29) [ 14.540503] flexfb spi0.0: Display update: 1753 kB/s (170.976 ms), fps=0 (0.000 ms) [ 14.551871] flexfb spi0.0: fbtft_register_backlight() [ 14.558899] flexfb spi0.0: fbtft_register_backlight(): led pin not set, exiting. [ 14.689351] graphics fb1: flexfb frame buffer, 480x320, 300 KiB video memory, 4 KiB DMA buffer memory, fps=50, spi0.0 at 16 MHz [ 14.711403] fbtft_device: GPIOS used by 'flexfb': [ 14.718328] fbtft_device: 'reset' = GPIO25 [ 14.724592] fbtft_device: 'dc' = GPIO24 [ 14.730721] fbtft_device: SPI devices registered: [ 14.737394] fbtft_device: spidev spi0.1 500kHz 8 bits mode=0x00 [ 14.747126] fbtft_device: flexfb spi0.0 16000kHz 8 bits mode=0x00 [ 24.924340] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup [ 36.519036] Adding 102396k swap on /var/swap. Priority:-1 extents:1 across:102396k SSFS [ 58.348524] FAT-fs (sda1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.

ElViruZ commented 8 years ago

Hello, I have a Waveshare Spotpear 3.5 Zoll Display. My R-Pi2 Runs Raspbian. if i try:

sudo modprobe flexfb width=320 height=480 regwidth=16 init=-1,0xb0,0x0,-1,0x11,-2,250,-1,0x3A,0x55,-1,0xC2,0x44,-1,0xC5,0x00,0x00,0x00,0x00,-1,0xE0,0x0F,0x1F,0x1C,0x0C,0x0F,0x08,0x48,0x98,0x37,0x0A,0x13,0x04,0x11,0x0D,0x00,-1,0xE1,0x0F,0x32,0x2E,0x0B,0x0D,0x05,0x47,0x75,0x37,0x06,0x10,0x03,0x24,0x20,0x00,-1,0xE2,0x0F,0x32,0x2E,0x0B,0x0D,0x05,0x47,0x75,0x37,0x06,0x10,0x03,0x24,0x20,0x00,-1,0x36,0x28,-1,0x11,-1,0x29,-3 sudo modprobe fbtft_device debug=3 rotate=90 name=flexfb speed=16000000 gpios=reset:25,dc:24

my display work and i can use startx, but after reboot its only white. i added in /etc/modules and /boot/cmdline.txt

Found solution: http://www.spotpear.com/learn/EN/raspberry-pi/Raspberry-Pi-LCD/Drive-the-LCD.html

pawelfalkowski commented 8 years ago

I'm new to the RPi business, running RPi 2 and clean Raspbian Jessie. Thanks to all the advices in that thread, following juhovh's blog entry http://futurice.com/blog/id-like-to-have-some-lcd-on-my-pi, notro's wiki https://github.com/notro/fbtft/wiki#make-it-permanent-debian-jessie-arch-linux-systemd and this discussion https://github.com/notro/fbtft/issues/365 I managed to make 3.5 Spotpear work.

The only issue I had was that all the colors were off (pink leaves, and stuff) and the image was fuzzy. The solution was to set speed=8000000, but I'm wondering if that's the only workaround or if there is a way to leave the speed at 16000000 while having colors right and image crisp and clear.

root42 commented 8 years ago

I have a 3.5" Waveshare LCD as well. Currently using the manual modprobe / systemd method in rc.local to get it working. However, it would be nice to have official overlay support. Is there any progress on this part?

aleksandaratanasov commented 8 years ago

Hi! I did everything that was suggested by @sudobrew and it works great (still have to see if I can get the touch working). For some reason though I have to explicitly run sudo modprobe fbtft_device debug=3 rotate=90 .... I have checked and this along with the definition for the device flextb is in my /etc/modules but it doesn't load. I also see that dmesg | grep graphics doesn't return anything whatsoever. I have the Rasbpian Jessie Lite and had to install LXDE manually. Maybe this has something to do with all this though using the image provided by the manufacturer allows me to even not load the UI and stick to the terminal which I can see on the screen without any issue (obviously touch is not working there :P). Any advice what I'm doing wrong?

@root42 will it be a problem if you share what exactly you did with rc.local?

cryogen89 commented 8 years ago

I tried what someone suggested for my WaveShare 4" LCD screen, here's my results.

After doing everything in proper order I am stuck on a black screen on my LCD, but apparently my touchscreen decided to be somewhat nice and work (although the controls are inverted). I have the Raspberry Pi 3 B+ so that's been my main testbed. I have been playing with the speed on line:

modprobe fbtft_device name=flexfb debug=3 rotate=0 speed=16000000 gpios=reset:25,dc:24

Any tips?

KaosCreator69 commented 8 years ago

Thanks @notro and @sudobrew followed all kinds of instructions and I am sure I am missing something simple. With Sudobrew steps to get his working works like a charm(testing) BUT cannot seem to figure out this Step 6 #Add to file /etc/modules was able to create fbtft.conf under modprob.d and such... Is there something different for the adding flexfb width=320 height=480 regwidth=16 init=-1,0xb0,0x0,-1,0x11,-2,250,-1,0x3A,0x55,-1,0xC2,0x44,-1,0xC5,0x00,0x00,0x00,0x00,-1,0xE0,0x0F,0x1F,0x1C,0x0C,0x0F,0x08,0x48,0x98,0x37,0x0A,0x13,0x04,0x11,0x0D,0x00,-1,0xE1,0x0F,0x32,0x2E,0x0B,0x0D,0x05,0x47,0x75,0x37,0x06,0x10,0x03,0x24,0x20,0x00,-1,0xE2,0x0F,0x32,0x2E,0x0B,0x0D,0x05,0x47,0x75,0x37,0x06,0x10,0x03,0x24,0x20,0x00,-1,0x36,0x28,-1,0x11,-1,0x29,-3 to a conf ...where would a person add this?

FYI using most recent Raspian/Jessie and did the rpi-update, etc.

Dooh! RTFM lol, anyways... https://github.com/notro/fbtft/issues/365 and https://github.com/notro/fbtft/wiki#make-it-permanent-debian-jessie-arch-linux-systemd All working as it should, glad to get it running on the newest raspian and now to conquer other distros.

ghost commented 8 years ago

Got my Raspberry Pi 3 model B to work with a 3.5" WaveShare SpotPear TFT touchscreen LCD (A) after a lot of tweaks. I'll be uploading a Frozen image soon for those who are still having problems.

nerdrageUK commented 8 years ago

@Githog that would be amazing thanks!

jor3l commented 7 years ago

@Githog any updates? looking forward to it. thanks!

ghost commented 7 years ago

@jor3l my most sincere apologies...i realized that i expanded the file system before freezing the image and i'm using a 32GB micro SD - I figured uploading a 32GB file won't make any sense. I'll work on an 8GB image within the next few days and drop the download link. I attached an image of my success so you guys know it's real :D img_0613

jor3l commented 7 years ago

@Githog haha no prob, I'll just keep trying until that. Congrats btw and nice truck 👍

jor3l commented 7 years ago

Got it working, this is what I did on a fresh install of Jessie:

Update firmware with:

sudo rpi-update

Enable SPI in raspi-config

sudo raspi-config

Then go to advanced, SPI and enable it

sudo nano /etc/rc.local

and add:

sudo modprobe flexfb  width=320  height=480  regwidth=16 init=-1,0xb0,0x0,-1,0x11,-2,250,-1,0x3A,0x55,-1,0xC2,0x44,-1,0xC5,0x00,0x00,0x00,0x00,-1,0xE0,0x0F,0x1F,0x1C,0x0C,0x0F,0x08,0x48,0x98,0x37,0x0A,0x13,0x04,0x11,0x0D,0x00,-1,0xE1,0x0F,0x32,0x2E,0x0B,0x0D,0x05,0x47,0x75,0x37,0x06,0x10,0x03,0x24,0x20,0x00,-1,0xE2,0x0F,0x32,0x2E,0x0B,0x0D,0x05,0x47,0x75,0x37,0x06,0x10,0x03,0x24,0x20,0x00,-1,0x36,0x28,-1,0x11,-1,0x29,-3
sudo modprobe fbtft_device debug=3 rotate=90 name=flexfb speed=16000000 gpios=reset:25,dc:24

To edit the boot process:

sudo nano /boot/cmdline.txt:

change everything to:

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait fbtft_device.custom fbtft_device.name=flexfb fbtft_device.gpios=dc:24,reset:25 fbtft_device.bgr=1 fbtft_device.speed=16000000 fbcon=map:10 fbcon=font:ProFont6x11 logo.nologo dma.dmachans=0x7f35 console=tty1 consoleblank=0 fbtft_device.fps=50 fbtft_device.rotate=0

Then run:

sudo nano /usr/share/X11/xorg.conf.d/99-fbturbo.conf:

in fbturbo change fb0 to fb1 and then run:

sudo nano /boot/config.txt

here add this line: (or search for dtoverlay and change it)

dtoverlay=ads7846,speed=500000,penirq=17,swapxy=1

then run this to add touch support:

sudo /usr/share/X11/xorg.conf.d/99-calibration.conf

add this to the 99-calibration file:

Section "InputClass"
        Identifier      "calibration"
        MatchProduct    "ADS7846 Touchscreen"
        Option  "Calibration"   "3900 240 240 3900"
EndSection
ghost commented 7 years ago

@jor3l Oh yay! congrats!

Ryanphs commented 7 years ago

Purely out of interest, has anyone got this going with Noobs? I really like the idea of having more than one OS on my PI but getting the screen working with Raspbian as well.

snail71 commented 7 years ago

@jor3l Great work. I have been trying to get this working. Followed your steps and bingo!

CoderFX commented 7 years ago

@jor3l ADS7846 Touchscreen? Does this work on Waveshare 3.5 Spotpear?

jor3l commented 7 years ago

@coderfx yeah that's the one I have, LCD (A) V3

CoderFX commented 7 years ago

@jor3l did you get touch to work?

jor3l commented 7 years ago

@coderfx everything works, did you follow my instructions?

CoderFX commented 7 years ago

@jor3l yes, I just did everything according to your instructions and now RPi 3 does not even boot - can't ssh into it, shows black screen, sometimes with stuck pointer in the middle.

jor3l commented 7 years ago

@coderfx hope you didn't lose data, was it a fresh install? Send me a message over twitter I think I have a backup that works, same @

CoderFX commented 7 years ago

@jor3l no worries ;) I'm playing around with fresh install + few configs backed up. I'm more worried about my microSD card because re-writing it so many times per day trying to make this work. So current status is that Waveshare 3.5 Spotpear screen works fine on RPi v3, but touch is not working.

dmesg | grep spi

[ 4.740789] ads7846 spi0.1: touchscreen, irq 183 [ 4.741507] input: ADS7846 Touchscreen as /devices/platform/soc/3f204000.spi/spi_master/spi0/spi0.1/input/input2 [ 5.320007] graphics fb1: fb_ili9486 frame buffer, 480x320, 300 KiB video memory, 32 KiB DMA buffer memory, fps=33, spi0.0 at 15 MHz

ads7846 is on spi0.1 and fb_ili9486 is on spi0.0 <- is this how it should be?

cat /etc/modules

snd-bcm2835 spi-bcm2708 i2c-bcm2708 i2c-dev fbtft_device name=waveshare35a gpios=dc:22,reset:27 speed=48000000

cat /usr/share/X11/xorg.conf.d/99-fbturbo.conf

Section "Device" Identifier "Allwinner A10/A13 FBDEV" Driver "fbturbo" Option "fbdev" "/dev/fb1" Option "SwapbuffersWait" "true" EndSection

cat /usr/share/X11/xorg.conf.d/99-calibration.conf

Section "InputClass" Identifier "calibration" MatchProduct "ADS7846 Touchscreen" Option "Calibration" "3897 292 369 3844" EndSection

Default Waveshare's settings: dmesg | grep spi

[ 6.843751] spi-bcm2835 3f204000.spi: chipselect 1 already in use [ 6.843776] spi_master spi0: spi_device register error /soc/spi@7e204000/waveshare35a-ts@1 [ 6.843797] spi_master spi0: Failed to create SPI device for /soc/spi@7e204000/waveshare35a-ts@1 [ 7.449711] ads7846 spi0.1: touchscreen, irq 183 [ 7.451342] input: ADS7846 Touchscreen as /devices/platform/soc/3f204000.spi/spi_master/spi0/spi0.1/input/input2 [ 7.477848] pinctrl-bcm2835 3f200000.gpio: pin gpio17 already requested by spi0.1; cannot claim for spi0.0 [ 7.477871] pinctrl-bcm2835 3f200000.gpio: pin-17 (spi0.0) status -22 [ 7.477900] fb_ili9486 spi0.0: Error applying setting, reverse things back [ 8.097309] graphics fb1: fb_ili9486 frame buffer, 480x320, 300 KiB video memory, 32 KiB DMA buffer memory, fps=33, spi0.0 at 15 MHz

Touch not working due to incorrect pin-17 settings?

@notro can you help?

notro commented 7 years ago

Check /proc/interrupts to see if touching is generating interrupts.

CoderFX commented 7 years ago

cat /proc/interrupts

      CPU0       CPU1       CPU2       CPU3

16: 0 0 0 0 bcm2836-timer 0 Edge arch_timer 17: 4254 3054 3317 4649 bcm2836-timer 1 Edge arch_timer 23: 18 0 0 0 ARMCTRL-level 1 Edge 3f00b880.mailbox 24: 369 0 0 0 ARMCTRL-level 2 Edge VCHIQ doorbell 39: 1 0 0 0 ARMCTRL-level 41 Edge 46: 0 0 0 0 ARMCTRL-level 48 Edge bcm2708_fb dma 48: 5437 0 0 0 ARMCTRL-level 50 Edge DMA IRQ 50: 0 0 0 0 ARMCTRL-level 52 Edge DMA IRQ 51: 453 0 0 0 ARMCTRL-level 53 Edge DMA IRQ 54: 453 0 0 0 ARMCTRL-level 56 Edge DMA IRQ 59: 8671 0 0 0 ARMCTRL-level 61 Edge serial 62: 130036 0 0 0 ARMCTRL-level 64 Edge dwc_otg, dwc_otg_pcd, dwc_otg_hcd:usb1 79: 0 0 0 0 ARMCTRL-level 81 Edge 3f200000.gpio:bank0 80: 0 0 0 0 ARMCTRL-level 82 Edge 3f200000.gpio:bank1 83: 0 0 0 0 ARMCTRL-level 85 Edge 3f804000.i2c 84: 0 0 0 0 ARMCTRL-level 86 Edge 3f204000.spi 86: 519 0 0 0 ARMCTRL-level 88 Edge mmc0 87: 4981 0 0 0 ARMCTRL-level 89 Edge uart-pl011 92: 6031 0 0 0 ARMCTRL-level 94 Edge mmc1 183: 0 0 0 0 pinctrl-bcm2835 17 Edge ads7846 FIQ: usb_fiq IPI0: 0 0 0 0 CPU wakeup interrupts IPI1: 0 0 0 0 Timer broadcast interrupts IPI2: 4688 14081 7897 10279 Rescheduling interrupts IPI3: 11 15 16 11 Function call interrupts IPI4: 1 7 3 0 Single function call interrupts IPI5: 0 0 0 0 CPU stop interrupts IPI6: 0 0 0 0 IRQ work interrupts IPI7: 0 0 0 0 completion interrupts

notro commented 7 years ago

No interrupts generated:

183: 0 0 0 0 pinctrl-bcm2835 17 Edge ads7846
norfskate commented 7 years ago

K, this has been an incredible forum with tonnes of good info, however after trying everything here for four days straight i am still stuck!

So, at my wits-end i am here to ask for a very large favour:

Would someone with the exact same hardware as me (and who has succeeded in making it all work) be so kind as to put together a disk image for me to copy and use?

If so I'd be very grateful!

Details are as thus: I have a Raspberry Pi 3 B, a Waveshare SpotPear 3.5inch RPi LCD (A) V3 and a SanDisk 32GB microSDHC class 4 memory card. And I wish to install BerryBoot V2.0 with Raspbian Jessie (I'll add other OS's myself later)

If you can get me that far that'd amazing!

Thank you greatly in advance!

Levantinyx commented 7 years ago

@CoderFX did you manage to get it working from where you were at? The messegas are nearly exactly the same as I am getting right now on Raspi 2 B running latest Raspbian Jessie.

CN-P5 commented 7 years ago

make

LiqwdE commented 7 years ago

Ok guys, been reading this post and others. But I have a problem.

I'm running a Pi 3, 32bg SD, Fresh install of RPi-35inch-LCD-Raspbian-160728.img (Raspbian). Its a premade image from waveshare.

Its boots and loads to GUI fine. Everything seems to work great. With one problem. When I use framebuffer copy to FB1 with mplayer or omxplayer I get what seems like 1 FPS. You can almost see the frame building from 1 to the next. Anyone got any ideas?

gwpl commented 7 years ago

I have the samr! Ialways thought that it is limitation of interface, and that onoy hdmi waveshare displays can go smoother. (i.e. that this class of displays is aimed for control panels na dother low-framerate applications). Will be happy to read if I am wrong and someone has solution that works smoother!

Grzegorz

Piszę z telefonu, więc przepraszam za formę i ew. literówki/błędy. I am writing from phone, so please forgive my thumbs for typos or short form.

28.02.2017 5:13 AM "LiqwdE" notifications@github.com napisał(a):

Ok guys, been reading this post and others. But I have a problem.

I'm running a Pi 3, 32bg SD, Fresh install of RPi-35inch-LCD-Raspbian-160728.img (Raspbian). Its a premade image from waveshare.

Its boots and loads to GUI fine. Everything seems to work great. With one problem. When I use framebuffer copy to FB1 with mplayer or omxplayer I get what seems like 1 FPS. You can almost see the frame building from 1 to the next. Anyone got any ideas?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/notro/fbtft/issues/215#issuecomment-282937112, or mute the thread https://github.com/notifications/unsubscribe-auth/AANg26uRWqkhpBfnJfstwBuSw5wtBIKCks5rg57SgaJpZM4DOnXV .

LiqwdE commented 7 years ago

Ok, this is my update. When using the premade waveshare image, there us actually a setting missing. In the /boot/config.txt near the bottom you have fbtft_device=waveshare35a and another after it. If you add speed=27000000 after waveshare35a you can crank up the speed.

Now, it's true you'll never get 60fps HDMI quality through your gpio to tft. This can get you to a fairly smooth and watchable experience. I don't know how to clock the fps, but I would say it's around 15fps mark.

cmseal commented 7 years ago

Has anyone been able to try the 3.5 B? Using the waveshare driver works fine on an RPi 3, including touch (just needing calibration), with the latest Raspbian image. Only issue is that the colours appear inverted :(

gwpl commented 7 years ago

Give a try to xcalib -i -a if inverts colors and helps

elBoz73 commented 7 years ago

Hi, I try to replace my squeeezeboxplayer using raspeberry pi 3, picore player (tinycore linux) and my waveshare 3.5. I tried all procedure I known but I still have a white screen (the HDMI is working correctly). do you have a procedure for tiny core ( kernel 4.4.39) that I could use without having X11 installed? thanks for your help

davecrump commented 7 years ago

I am using a Waveshare 3.5inch RPi LCD (A) touchscreen display on an RPi3 for this project. It has worked perfectly with Jessie Lite 2016-11-25 and rpi-update until the kernel was bumped to 4.9.y (about 21 Feb 17). After the kernel update, the display does not get loaded during boot, although the touch sensor still works. dmesg reports: "fb_ili9486: probe of spi0.0 failed with error -22" It works perfectly again after a kernel rollback to 4.4.50. Grateful for any suggestions. Dave

davecrump commented 7 years ago

Reference my post above about problems loading the Waveshare 3.5inch RPi LCD (A) touchscreen display with kernel 4.9.y. I traced it to the fact that I was trying to load the waveshare touchscreen overlay and the touchscreen driver overlay. What I did not realise is that the waveshare overlay already includes the touchscreen driver. Kernel 4.9.y seems to handle this differently to kernel 4.4.50 and throws a fatal error. I cured the problem by commenting out the duplicate touchscreen overlay. Dave

elBoz73 commented 7 years ago

Thanks dave, It seems that I need to create a new tft file depending on the kernel version. I will try to create a development environment with a virtual box and find a procedure to create my tft file. If some one has the procedure it would help me a lot ( I never did it). ElBoz

amrithmmh commented 6 years ago

Im using rasberry pi 3 with waveshare 3.5(B) but plymouth only works in hdmi +monitor not the waveshare LCD how to fix it? i am really new and i tried reading all the above comments but i cannot understand much

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.