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.86k stars 494 forks source link

Want to add RA8835/SED1335 display #172

Closed dyezepchik closed 9 years ago

dyezepchik commented 10 years ago

I'm trying to add a RA8835/SED1335 support

when I build modules I get this

make: Entering directory '/home/pi/linux-94a382fed1a5ec303eef9e1f3439df8f759ba60c' CC [M] drivers/video/fbtft/fb_ra8835.o Building modules, stage 2. MODPOST 4 modules WARNING: "dynamic_pr_debug" [drivers/video/fbtft/fbtft_device.ko] undefined! WARNING: "fb_sys_read" [drivers/video/fbtft/fbtft.ko] undefined! WARNING: "sys_copyarea" [drivers/video/fbtft/fbtft.ko] undefined! WARNING: "sys_fillrect" [drivers/video/fbtft/fbtft.ko] undefined! WARNING: "sys_imageblit" [drivers/video/fbtft/fbtft.ko] undefined! WARNING: "fb_sys_write" [drivers/video/fbtft/fbtft.ko] undefined! WARNING: "dynamic_dev_dbg" [drivers/video/fbtft/fbtft.ko] undefined! WARNING: "fb_deferred_io_cleanup" [drivers/video/fbtft/fbtft.ko] undefined! WARNING: "fb_deferred_io_init" [drivers/video/fbtft/fbtft.ko] undefined! CC drivers/video/fbtft/fb_ra8835.mod.o LD [M] drivers/video/fbtft/fb_ra8835.ko make: Leaving directory '/home/pi/linux-94a382fed1a5ec303eef9e1f3439df8f759ba60c'

and then Error: could not insert module /home/pi/linux/drivers/video/fbtft/fb_ra8835.ko: Invalid parameters

What do I do wrong? I'm trying to do everything according to your Development guide

dyezepchik commented 10 years ago

this was probably because of kernel version mismatch now the modules are built but I have another problem: Error: could not insert module /home/pi/linux/drivers/video/fbtft/fb_ra8835.ko: Invalid parameters still looking for the reason why

notro commented 10 years ago

Error: could not insert module /home/pi/linux/drivers/video/fbtft/fb_ra8835.ko: Invalid parameters

Are you passing arguments to fb_ra8835 when you are loading it with modprobe? Does dmesg tell you more?

dyezepchik commented 9 years ago

the problem is not solved yet. I had some other things to do and now I'm back to this. I'm using cross compiler for building kernel on the ubuntu. Can I ask for a guide how to cross compile fbtft module correctly? Thank you

notro commented 9 years ago

You add FBTFT as specified in the README and build the kernel as you would any other Pi kernel (I have updated the README with 3.15 instructions).

dyezepchik commented 9 years ago

Finally I installed my driver. I'm registering my driver: sudo modprobe fbtft_device name=ra8835 then dmesg tells: [ 737.643173] fbtft_device: SPI devices registered: [ 737.643212] fbtft_device: 'fb' Platform devices registered: [ 737.643246] fbtft_device: bcm2708_fb id=-1 pdata? no [ 737.643537] fbtft_device: GPIOS used by 'ra8835': [ 737.643557] fbtft_device: 'reset' = GPIO24 [ 737.643567] fbtft_device: 'dc' = GPIO7 [ 737.643576] fbtft_device: 'wr' = GPIO5 [ 737.643585] fbtft_device: 'cs' = GPIO22 [ 737.643593] fbtft_device: 'db00' = GPIO8 [ 737.643602] fbtft_device: 'db01' = GPIO10 [ 737.643611] fbtft_device: 'db02' = GPIO11 [ 737.643619] fbtft_device: 'db03' = GPIO12 [ 737.643628] fbtft_device: 'db04' = GPIO13 [ 737.643637] fbtft_device: 'db05' = GPIO15 [ 737.643647] fbtft_device: 'db06' = GPIO16 [ 737.643656] fbtft_device: 'db07' = GPIO18 [ 737.643664] fbtft_device: 'fb' Platform devices registered: [ 737.643688] fbtft_device: bcm2708_fb id=-1 pdata? no

Then I'm trying to test it with X windows: FRAMEBUFFER=/dev/fb1 startx or the console: con2fbmap 1 1

But when I startx a fatal error occures: Module g2d_23 not found and nothing happens after that when I'm mapping console to fb: ioctl FBIOPUT_CON2FBMAP: Invalid argument

I'm working through SSH Can you tell me how can I test loaded module for my lcd? Thank you

dyezepchik commented 9 years ago

I forgot to Change fb0 to fb1 sudo nano /usr/share/X11/xorg.conf.d/99-fbturbo.conf

After I did this and reboot I tried to startx again:

Fatal server error: no screens found

Please consult the The X.Org Foundation support at http://wiki.x.org for help. Please also check the log file at "/var/log/Xorg.0.log" for additional information.

Server terminated with error (1). Closing log file. xinit: giving up xinit: unable to connect to X server: Bad file descriptor xinit: server error

con2fbmap 1 1 returns the same error

dyezepchik commented 9 years ago

/var/log/Xorg.0.log says open /dev/fb1: No such file or directory

notro commented 9 years ago

Your dmesg output only shows the loading of fbftft_device and not the driver. This is how it looks for a driver I just tested:

[    3.802041] graphics fb1: fb_ili9340 frame buffer, 320x240, 150 KiB video memory, 4 KiB DMA buffer memory, fps=25, spi0.0 at 32 MHz

If you use the correct MODULE_ALIAS in your driver, it should load automatically. If not just load it manually.

Module g2d_23 not found

You can ignore this

dyezepchik commented 9 years ago

I don't get this string in dmesg. I've checked aliases, names ad so on... and this is what I get now: [ 1820.367480] fbtft_device: 'fb' Platform devices registered: [ 1820.367514] fbtft_device: bcm2708_fb id=-1 pdata? no [ 1820.370623] fbtft_device: GPIOS used by 'ra8835': [ 1820.370663] fbtft_device: 'reset' = GPIO24 [ 1820.370674] fbtft_device: 'dc' = GPIO7 [ 1820.370683] fbtft_device: 'wr' = GPIO5 [ 1820.370692] fbtft_device: 'cs' = GPIO22 [ 1820.370701] fbtft_device: 'db00' = GPIO8 [ 1820.370709] fbtft_device: 'db01' = GPIO10 [ 1820.370718] fbtft_device: 'db02' = GPIO11 [ 1820.370727] fbtft_device: 'db03' = GPIO12 [ 1820.370735] fbtft_device: 'db04' = GPIO13 [ 1820.370744] fbtft_device: 'db05' = GPIO15 [ 1820.370752] fbtft_device: 'db06' = GPIO16 [ 1820.370761] fbtft_device: 'db07' = GPIO18 [ 1820.370769] fbtft_device: 'fb' Platform devices registered: [ 1820.370799] fbtft_device: bcm2708_fb id=-1 pdata? no [ 1820.370879] fbtft_device: fb_ra8835 id=0 pdata? yes

How could I load it manually and how do I check why doesn's it start automatically? If this string doesn't appear "[ 3.802041] graphics fb1: " it means that framebuffer is not registered with the kernel? As I can see in your description: ret = register_framebuffer(fb_info); if (ret < 0) goto reg_fail;

I'm sorry for my noob's questions. May be I should read "how it works" more carefully, but not everything is clear for me there. And I know I'm trying to get this all working with my limited knowledges in linux.

By the way, what about this: "# Change fb0 to fb1 sudo nano /usr/share/X11/xorg.conf.d/99-fbturbo.conf " Should I do it or not and why/where does it matter?

notro commented 9 years ago

sudo modprobe fbtft_device name=ra8875

This command loads a kernel which adds a platform device (description) instructing the driver how to interact with the display controller: https://github.com/notro/fbtft/wiki/fbtft_device

sudo modprobe fb_ra8835

This will load the kernel module, which contains the driver (functionality), which the previous device will attach to (probe): https://github.com/notro/fbtft/wiki/How-it-works

dyezepchik commented 9 years ago

I'm doing something wrong and I can not see what exactly... how could I debug it and find the place where error occurs?

notro commented 9 years ago

Do this and post back the result:

sudo dmesg -C
sudo modprobe --first-time fbtft_device name=ra8875 debug=7
sudo modprobe --first-time fb_ra8835
lsmod
dmesg
dyezepchik commented 9 years ago

finally something changed on the screen...

pi@raspberrypi ~/linux $ lsmod Module Size Used by fb_ra8835 2870 0 fbtft_device 35699 0 fbtft 30810 2 fb_ra8835,fbtft_device syscopyarea 2999 1 fbtft sysfillrect 3294 1 fbtft sysimgblt 2124 1 fbtft fb_sys_fops 1435 1 fbtft snd_bcm2835 19496 0 snd_soc_bcm2708_i2s 6186 0 regmap_mmio 2818 1 snd_soc_bcm2708_i2s snd_soc_core 146249 1 snd_soc_bcm2708_i2s snd_compress 12594 1 snd_soc_core regmap_i2c 1661 1 snd_soc_core snd_pcm_dmaengine 5505 1 snd_soc_core regmap_spi 1913 1 snd_soc_core snd_pcm 83853 3 snd_bcm2835,snd_soc_core,snd_pcm_dmaengine snd_page_alloc 5140 1 snd_pcm snd_seq 55476 0 snd_seq_device 6465 1 snd_seq snd_timer 20981 2 snd_pcm,snd_seq leds_gpio 2079 0 led_class 4373 1 leds_gpio snd 62252 7 snd_bcm2835,snd_soc_core,snd_timer,snd_pcm,snd_seq,snd_seq_device,snd_compress

[ 538.071338] fbtft_device: 'fb' Platform devices registered: [ 538.071365] fbtft_device: bcm2708_fb id=-1 pdata? no [ 538.071448] fbtft_device: fb_ra8835 id=0 pdata? yes [ 538.103026] fb_ra8835 fb_ra8835.0: fbtft_request_gpios: 'reset' = GPIO24 [ 538.103074] fb_ra8835 fb_ra8835.0: fbtft_request_gpios: 'dc' = GPIO7 [ 538.103098] fb_ra8835 fb_ra8835.0: fbtft_request_gpios: 'wr' = GPIO5 [ 538.103120] fb_ra8835 fb_ra8835.0: fbtft_request_gpios: 'cs' = GPIO22 [ 538.103146] fb_ra8835 fb_ra8835.0: fbtft_request_gpios: 'db00' = GPIO8 [ 538.103170] fb_ra8835 fb_ra8835.0: fbtft_request_gpios: 'db01' = GPIO10 [ 538.103193] fb_ra8835 fb_ra8835.0: fbtft_request_gpios: 'db02' = GPIO11 [ 538.103215] fb_ra8835 fb_ra8835.0: fbtft_request_gpios: 'db03' = GPIO12 [ 538.103236] fb_ra8835 fb_ra8835.0: fbtft_request_gpios: 'db04' = GPIO13 [ 538.103258] fb_ra8835 fb_ra8835.0: fbtft_request_gpios: 'db05' = GPIO15 [ 538.103279] fb_ra8835 fb_ra8835.0: fbtft_request_gpios: 'db06' = GPIO16 [ 538.103302] fb_ra8835 fb_ra8835.0: fbtft_request_gpios: 'db07' = GPIO18 [ 538.103319] fb_ra8835 fb_ra8835.0: fbtft_verify_gpios() [ 538.103334] fb_ra8835 fb_ra8835.0: init_display() [ 538.103348] fb_ra8835 fb_ra8835.0: fbtft_reset() [ 538.226293] fb_ra8835 fb_ra8835.0: Display update: 4212 kB/s (2.225 ms), fps=0 (0.000 ms) [ 538.227555] graphics fb1: fb_ra8835 frame buffer, 320x240, 9 KiB video memory, fps=20

I'll go on debugging...

dyezepchik commented 9 years ago

I suppose now I need to correct my setup routines for the display

notro commented 9 years ago

Closing issue since there has been no activity for more than 2 months. Reopen if needed.