Skip to contentSkip to conversation

linux: add fbtft kernel extension

RFC Superseded Peter Seiderer 4 participants 8 messages Dec 30, 2014 – Dec 31, 2014

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

... sorry for the resend, file linux/linux-ext-fbtft.mk was missing.

First draft of a patch adding fbtft framebuffer drivers to buildroot.

My first attempt was using the out of tree kernel modules compile (as suggested by Yann E. MORIN [1]) which is already (partly) supported by the fbtft source, but I failed to enable some needed kernel configurations e.g FB_DEFERRED_IO (did not survive the oldconfig/silentoldconfig step when not referenced in tree, workaround is to enable a built in feature with the same preferences [2]).

The second attempt is the linux-ext approach (as presented here).

I am unsure if the enabling of CONFIG_SPI_BCM2708 belongs into linux.mk or should go into raspberrypi_defconfig or belongs into the appropriate Readme?

The second question is about the 25 submodules of fbtft (at the moment only FB_TFT_ILI9340 and FB_TFT_ILI9341 are enabled). Should every submodule be configurable or should all submodules be enabled by default?

There is an adafruit fork of the fbtft repository [4] with some adfruit specific enhancements...

Regards,
Peter

Tested with RaspberryPi B+ and PiTFT Mini Kit - 320x240 2.8" TFT (see [5] and [6]) and the following configuration changes:

- cmdline.txt: add 'fbcon=map:10 fbcon=font:VGA8x8'
- add /etc/modules-load.d/fbtft.conf with 'fbtft_device'
- add /etc/modprobe.d/00-fbtft.conf with 'options fbtft_device name=adafruit28 rotate=90 gpios=dc:25'

[1] http://lists.busybox.net/pipermail/buildroot/2014-December/115770.html
[2] https://github.com/notro/fbtft/issues/209#issuecomment-68191514
[3] http://www.adafruit.com/products/1983
[4] https://github.com/adafruit/adafruit-rpi-fbtft
[5] http://h65951.serverkompetenz.net/PeterSeiderer/upload/PiTFT_2_8_ct/Image9893.jpg
[6] http://h65951.serverkompetenz.net/PeterSeiderer/upload/PiTFT_2_8_ct/Image9897.jpg

Peter Seiderer (1):
linux: add fbtft kernel extension

 linux/Config.ext.in      | 10 ++++++++++
 linux/linux-ext-fbtft.mk | 25 +++++++++++++++++++++++++
 linux/linux.mk           |  9 +++++++++
 package/Config.in        |  1 +
 package/fbtft/Config.in  | 13 +++++++++++++
 package/fbtft/fbtft.mk   | 11 +++++++++++
 6 files changed, 69 insertions(+)
 create mode 100644 linux/linux-ext-fbtft.mk
 create mode 100644 package/fbtft/Config.in
 create mode 100644 package/fbtft/fbtft.mk
Signature · 1 line
2.1.2
#1 lore raw

RFC v2 1/1 linux: add fbtft kernel extension

---
 linux/Config.ext.in      | 10 ++++++++++
 linux/linux-ext-fbtft.mk | 25 +++++++++++++++++++++++++
 linux/linux.mk           |  9 +++++++++
 package/Config.in        |  1 +
 package/fbtft/Config.in  | 13 +++++++++++++
 package/fbtft/fbtft.mk   | 11 +++++++++++
 6 files changed, 69 insertions(+)
 create mode 100644 linux/linux-ext-fbtft.mk
 create mode 100644 package/fbtft/Config.in
 create mode 100644 package/fbtft/fbtft.mk
linux/Config.ext.in +10 -0
index 40c4684..583c250 100644
@@ -42,4 +42,14 @@ config BR2_LINUX_KERNEL_EXT_RTAI_PATCH
 	help
 	  Optionally, explicitly specify the RTAI patch to use.
 
+# fbtft
+config BR2_LINUX_KERNEL_EXT_FBTFT
+	bool "fbtft patch"
+	select BR2_PACKAGE_FBTFT
+	help
+	  Linux Framebuffer drivers for small TFT LCD display modules,
+	  e.g. Adafruit PiTFT displays for Raspberry Pi.
+
+	  https://github.com/notro/fbtft
+
 endmenu
linux/linux-ext-fbtft.mk new file +25 -0
new file mode 100644
index 0000000..30b9ab4
@@ -0,0 +1,25 @@
+################################################################################
+# Linux fbtft extensions
+#
+# Patch the linux kernel with fbtft extension
+################################################################################
+
+ifeq ($(BR2_LINUX_KERNEL_EXT_FBTFT),y)
+# Add dependency to fbtft package (download helper for the fbtft source)
+LINUX_DEPENDENCIES += fbtft
+
+define FBTFT_PREPARE_KERNEL
+	mkdir $(LINUX_DIR)/drivers/video/fbtft
+	$(INSTALL) $(FBTFT_DIR)/*.h \
+		$(FBTFT_DIR)/*.c \
+		$(FBTFT_DIR)/Makefile \
+		$(FBTFT_DIR)/Kconfig \
+		$(FBTFT_DIR)/README \
+		$(LINUX_DIR)/drivers/video/fbtft
+	echo 'source "drivers/video/fbtft/Kconfig"' >>  $(LINUX_DIR)/drivers/video/Kconfig
+	echo 'obj-y += fbtft/' >> $(LINUX_DIR)/drivers/video/Makefile
+endef
+
+LINUX_PRE_PATCH_HOOKS += FBTFT_PREPARE_KERNEL
+
+endif #BR2_LINUX_KERNEL_EXT_FBTFT
linux/linux.mk +9 -0
index 8256641..1fc0159 100644
@@ -196,6 +196,15 @@ define LINUX_CONFIGURE_CMDS
 		$(call KCONFIG_ENABLE_OPT,CONFIG_DEVTMPFS_MOUNT,$(@D)/.config))
 	$(if $(BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV),
 		$(call KCONFIG_ENABLE_OPT,CONFIG_INOTIFY_USER,$(@D)/.config))
+	$(if $(BR2_LINUX_KERNEL_EXT_FBTFT),
+		$(call KCONFIG_ENABLE_OPT,CONFIG_FB,$(@D)/.config)
+		$(call KCONFIG_SET_OPT,CONFIG_FB_TFT,m,$(@D)/.config)
+		$(call KCONFIG_SET_OPT,CONFIG_FB_TFT_ILI9340,m,$(@D)/.config)
+		$(call KCONFIG_SET_OPT,CONFIG_FB_TFT_ILI9341,m,$(@D)/.config)
+		$(call KCONFIG_SET_OPT,CONFIG_FB_TFT_FBTFT_DEVICE,m,$(@D)/.config)
+		$(call KCONFIG_ENABLE_OPT,CONFIG_SPI,$(@D)/.config)
+		$(call KCONFIG_ENABLE_OPT,CONFIG_SPI_BCM2708,$(@D)/.config)
+		$(call KCONFIG_ENABLE_OPT,CONFIG_GPIOLIB,$(@D)/.config))
 	$(if $(BR2_PACKAGE_KTAP),
 		$(call KCONFIG_ENABLE_OPT,CONFIG_DEBUG_FS,$(@D)/.config)
 		$(call KCONFIG_ENABLE_OPT,CONFIG_EVENT_TRACING,$(@D)/.config)
package/Config.in +1 -0
index 3b37bb2..c658a28 100644
@@ -311,6 +311,7 @@ endif
 	source "package/evemu/Config.in"
 	source "package/evtest/Config.in"
 	source "package/fan-ctrl/Config.in"
+	source "package/fbtft/Config.in"
 	source "package/fconfig/Config.in"
 	source "package/fis/Config.in"
 	source "package/flashrom/Config.in"
package/fbtft/Config.in new file +13 -0
new file mode 100644
index 0000000..eceea85
@@ -0,0 +1,13 @@
+config BR2_PACKAGE_FBTFT
+	bool "fbtft"
+	depends on BR2_LINUX_KERNEL
+	help
+	  Linux Framebuffer drivers for small TFT LCD display modules,
+	  e.g. Adafruit PiTFT displays for Raspberry Pi.
+
+	  This is only the download helper for the kernel patch.
+
+	  https://github.com/notro/fbtft
+
+comment "fbtft needs a Linux kernel to be built"
+	depends on !BR2_LINUX_KERNEL
package/fbtft/fbtft.mk new file +11 -0
new file mode 100644
index 0000000..9f46bdb
@@ -0,0 +1,11 @@
+################################################################################
+#
+# fbtft
+#
+################################################################################
+
+FBTFT_VERSION = 274035404701245e7491c0c6471c5b72ade4d491
+FBTFT_SITE = $(call github,notro,fbtft,$(FBTFT_VERSION))
+FBTFT_LICENSE = GPLv2+
+
+$(eval $(generic-package))
Signature · 1 line
2.1.2
#2 lore raw
In reply to Peter Seiderer

Peter, All,

On 2014-12-30 20:58 +0100, Peter Seiderer spake thusly:

Quoted 1 line

... sorry for the resend, file linux/linux-ext-fbtft.mk was missing.

No problem, I've marked the first iteration as "Syuperseded" in our Patchwork.

Quoted 1 line

First draft of a patch adding fbtft framebuffer drivers to buildroot.

Thanks! :-)

Quoted 7 lines

My first attempt was using the out of tree kernel modules compile (as suggested by Yann E. MORIN [1]) which is already (partly) supported by the fbtft source, but I failed to enable some needed kernel configurations e.g FB_DEFERRED_IO (did not survive the oldconfig/silentoldconfig step when not referenced in tree, workaround is to enable a built in feature with the same preferences [2]).

OK, I'll be looking at it, to see why it fails. Don't expect much before next week-end (actually, that will be next year, too! :-) ) because, well, New Year celebrations, boring stuff like that, which I'm socially obliged to attend... ;-)

Regards,
Yann E. MORIN.

Quoted 48 lines

The second attempt is the linux-ext approach (as presented here).

I am unsure if the enabling of CONFIG_SPI_BCM2708 belongs into linux.mk or should go into raspberrypi_defconfig or belongs into the appropriate Readme?

The second question is about the 25 submodules of fbtft (at the moment only FB_TFT_ILI9340 and FB_TFT_ILI9341 are enabled). Should every submodule be configurable or should all submodules be enabled by default?

There is an adafruit fork of the fbtft repository [4] with some adfruit specific enhancements...

Regards,
Peter

Tested with RaspberryPi B+ and PiTFT Mini Kit - 320x240 2.8" TFT (see [5] and [6]) and the following configuration changes:

- cmdline.txt: add 'fbcon=map:10 fbcon=font:VGA8x8'
- add /etc/modules-load.d/fbtft.conf with 'fbtft_device'
- add /etc/modprobe.d/00-fbtft.conf with 'options fbtft_device name=adafruit28 rotate=90 gpios=dc:25'

[1] http://lists.busybox.net/pipermail/buildroot/2014-December/115770.html
[2] https://github.com/notro/fbtft/issues/209#issuecomment-68191514
[3] http://www.adafruit.com/products/1983
[4] https://github.com/adafruit/adafruit-rpi-fbtft
[5] http://h65951.serverkompetenz.net/PeterSeiderer/upload/PiTFT_2_8_ct/Image9893.jpg
[6] http://h65951.serverkompetenz.net/PeterSeiderer/upload/PiTFT_2_8_ct/Image9897.jpg

Peter Seiderer (1):
linux: add fbtft kernel extension

 linux/Config.ext.in      | 10 ++++++++++
 linux/linux-ext-fbtft.mk | 25 +++++++++++++++++++++++++
 linux/linux.mk           |  9 +++++++++
 package/Config.in        |  1 +
 package/fbtft/Config.in  | 13 +++++++++++++
 package/fbtft/fbtft.mk   | 11 +++++++++++
 6 files changed, 69 insertions(+)
 create mode 100644 linux/linux-ext-fbtft.mk
 create mode 100644 package/fbtft/Config.in
 create mode 100644 package/fbtft/fbtft.mk
Signature · 1 line
2.1.2
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#3 lore raw

Hello Yann,

Quoted 26 lines

Gesendet: Dienstag, 30. Dezember 2014 um 23:36 Uhr
Von: "Yann E. MORIN" <[email protected]>
An: "Peter Seiderer" <[email protected]>
Cc: buildroot at busybox.net, loucrittenden63 at gmail.com, "Thomas Petazzoni" <[email protected]>
Betreff: Re: [RFC v2] linux: add fbtft kernel extension

Peter, All,

On 2014-12-30 20:58 +0100, Peter Seiderer spake thusly:

Quoted 1 line

... sorry for the resend, file linux/linux-ext-fbtft.mk was missing.

No problem, I've marked the first iteration as "Syuperseded" in our Patchwork.

Quoted 1 line

First draft of a patch adding fbtft framebuffer drivers to buildroot.

Thanks! :-)

Quoted 7 lines

My first attempt was using the out of tree kernel modules compile (as suggested by Yann E. MORIN [1]) which is already (partly) supported by the fbtft source, but I failed to enable some needed kernel configurations e.g FB_DEFERRED_IO (did not survive the oldconfig/silentoldconfig step when not referenced in tree, workaround is to enable a built in feature with the same preferences [2]).

Quoted 5 lines

OK, I'll be looking at it, to see why it fails. Don't expect much before next week-end (actually, that will be next year, too! :-) ) because, well, New Year celebrations, boring stuff like that, which I'm socially obliged to attend... ;-)

...as a little help my patch file for the first attempt (after the duplication of the KCONFIG_ENABLE_OPT calls after the call to oldconfig I gave up and tried the second approach)...

Regards,
Peter

Quoted 48 lines

Regards,
Yann E. MORIN.

Quoted 45 lines

The second attempt is the linux-ext approach (as presented here).

I am unsure if the enabling of CONFIG_SPI_BCM2708 belongs into linux.mk or should go into raspberrypi_defconfig or belongs into the appropriate Readme?

The second question is about the 25 submodules of fbtft (at the moment only FB_TFT_ILI9340 and FB_TFT_ILI9341 are enabled). Should every submodule be configurable or should all submodules be enabled by default?

There is an adafruit fork of the fbtft repository [4] with some adfruit specific enhancements...

Regards,
Peter

Tested with RaspberryPi B+ and PiTFT Mini Kit - 320x240 2.8" TFT (see [5] and [6]) and the following configuration changes:

- cmdline.txt: add 'fbcon=map:10 fbcon=font:VGA8x8'
- add /etc/modules-load.d/fbtft.conf with 'fbtft_device'
- add /etc/modprobe.d/00-fbtft.conf with 'options fbtft_device name=adafruit28 rotate=90 gpios=dc:25'

[1] http://lists.busybox.net/pipermail/buildroot/2014-December/115770.html
[2] https://github.com/notro/fbtft/issues/209#issuecomment-68191514
[3] http://www.adafruit.com/products/1983
[4] https://github.com/adafruit/adafruit-rpi-fbtft
[5] http://h65951.serverkompetenz.net/PeterSeiderer/upload/PiTFT_2_8_ct/Image9893.jpg
[6] http://h65951.serverkompetenz.net/PeterSeiderer/upload/PiTFT_2_8_ct/Image9897.jpg

Peter Seiderer (1):
linux: add fbtft kernel extension

 linux/Config.ext.in      | 10 ++++++++++
 linux/linux-ext-fbtft.mk | 25 +++++++++++++++++++++++++
 linux/linux.mk           |  9 +++++++++
 package/Config.in        |  1 +
 package/fbtft/Config.in  | 13 +++++++++++++
 package/fbtft/fbtft.mk   | 11 +++++++++++
 6 files changed, 69 insertions(+)
 create mode 100644 linux/linux-ext-fbtft.mk
 create mode 100644 package/fbtft/Config.in
 create mode 100644 package/fbtft/fbtft.mk
Quoted 12 lines
Quoted 3 lines
Signature · 1 line
2.1.2
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: commit-a3501eb.patch
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20141231/854c2fe5/attachment.ksh>

#4 lore raw
In reply to Yann E. MORIN

Peter, All,

On 2014-12-30 23:36 +0100, Yann E. MORIN spake thusly:

Quoted 9 lines

On 2014-12-30 20:58 +0100, Peter Seiderer spake thusly:

Quoted 7 lines

My first attempt was using the out of tree kernel modules compile (as suggested by Yann E. MORIN [1]) which is already (partly) supported by the fbtft source, but I failed to enable some needed kernel configurations e.g FB_DEFERRED_IO (did not survive the oldconfig/silentoldconfig step when not referenced in tree, workaround is to enable a built in feature with the same preferences [2]).

Quoted 4 lines

OK, I'll be looking at it, to see why it fails. Don't expect much before next week-end (actually, that will be next year, too! :-) ) because, well, New Year celebrations, boring stuff like that, which I'm socially obliged to attend... ;-)

OK, so it seems it will not be possible to biuld it as an out-of-tree module, after all. DAmn, that's really, really bad... :-(

So, here's why: the code uses FB-related functions that are built from separate source files, most of them conditionalised to a Kconfig symbol. But those symbols are promptless, and can only be selected.

Thus, unless another frambuffer implementation is enabled, that selects them, they wonlt be enabled, and thus the corresponding source files will not be built, and the needed functions will not be in the Kernel (neither built-in, nor in a module).

Moreover, one of the symbol, CONFIG_FB_BACKLIGHT, can only be selected by PCI-dependent symbols (DRM stuff, like radeon or nouvea), or SuperH dependent symbols (for some SuperH framebuffers).

Almost all needed symbols can be selected by cheating, and selecting the virtual framebuffer, but that's not a real sane option. And we'd still miss two symbols anyway.

So, for now, I'd say we can only use it as a linux-extension.

That's sad, real sad... :-(

The proper solution would be to patch the kernel to add a kind of "framebuffer library for external FB drivers" (a bit like we have in the "Library routines" sub-menu for CRC and a few other functions, that would select all the hidden knobs for helper functions, and build them (built-in or module), and send that patch upstream.

But I'll have a deeper look later this week-end.

Happy New Year, have nice celebrations in the coming days! :-)

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#5 lore raw

Dear Yann E. MORIN,

Quoted 12 lines · Yann E. MORIN

OK, so it seems it will not be possible to biuld it as an out-of-tree module, after all. DAmn, that's really, really bad... :-(

So, here's why: the code uses FB-related functions that are built from separate source files, most of them conditionalised to a Kconfig symbol. But those symbols are promptless, and can only be selected.

Thus, unless another frambuffer implementation is enabled, that selects them, they wonlt be enabled, and thus the corresponding source files will not be built, and the needed functions will not be in the Kernel (neither built-in, nor in a module).

Quoted 7 lines

Moreover, one of the symbol, CONFIG_FB_BACKLIGHT, can only be selected by PCI-dependent symbols (DRM stuff, like radeon or nouvea), or SuperH dependent symbols (for some SuperH framebuffers).

Almost all needed symbols can be selected by cheating, and selecting the virtual framebuffer, but that's not a real sane option. And we'd still miss two symbols anyway.

Hum, indeed, that is a very good reason why external modules cannot work. Thanks for the analysis.

Quoted 5 lines

The proper solution would be to patch the kernel to add a kind of "framebuffer library for external FB drivers" (a bit like we have in the "Library routines" sub-menu for CRC and a few other functions, that would select all the hidden knobs for helper functions, and build them (built-in or module), and send that patch upstream.

No the proper solution would be for those fbtft people to submit their drivers to the upstream kernel. But of course, since those drivers are developed by RasberryPi folks, they cannot play with the normal open-source rules of contributing things upstream: they *have* to do some utter crap and do everything in their own fork.

Sigh. RasberryPi is definitely the worst platform ever when it comes to learning embedded Linux.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#6 lore raw

Hello,

Quoted 5 lines · Thomas Petazzoni

No the proper solution would be for those fbtft people to submit their drivers to the upstream kernel. But of course, since those drivers are developed by RasberryPi folks, they cannot play with the normal open-source rules of contributing things upstream: they *have* to do some utter crap and do everything in their own fork.

So, I've just submitted a proposal to include those drivers to the staging tree of the Linux kernel:

http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/2014-December/063195.html

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#7 lore raw

Hi Thomas:

FYI, Notro started a rewrite of fbtft aiming at kernel inclusion here:

https://github.com/notro/fbdbi/wiki

Sincerely, Angelo

2014-12-31 10:14 GMT+01:00 Thomas Petazzoni
<[email protected]>:

Quoted 26 lines

Hello,

Quoted 5 lines · Thomas Petazzoni

No the proper solution would be for those fbtft people to submit their drivers to the upstream kernel. But of course, since those drivers are developed by RasberryPi folks, they cannot play with the normal open-source rules of contributing things upstream: they *have* to do some utter crap and do everything in their own fork.

So, I've just submitted a proposal to include those drivers to the staging tree of the Linux kernel:

http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/2014-December/063195.html

Best regards,

Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

Signature · 1 line
Profile: http://it.linkedin.com/in/compagnucciangelo