The mainline kernel includes a panel driver for the 7" touchscreen. A device tree diff to enable it exists. An overlay was planned, but it's still nowhere to be found. Plus, the touch input and backlight drivers are not included in the mainline kernel.
Turns out, it's really easy to compile the input/backlight drivers out of tree! They don't depend on anything that's not upstreamed.
This repo includes copies of these modules and a device tree.
make modules
sudo make installsudo insmod /lib/modules/$(uname -r)/extra/rpi-ft5406.ko.gz
sudo insmod /lib/modules/$(uname -r)/extra/rpi_backlight.ko.gz
dtc -I dts -O dtb -o upstream.dtb upstream.dtsThe included device tree is for the Pi 3 B, if you're on 2 or whatever, you'll need to make your own:
- Decompile the upstream dtb for your Pi (
dtc -I dtb -O dts...) - Add labels:
firmware {->firmware: firmware {gpio@7e200000 {->gpio: gpio@7e200000 {dsi@7e700000 {->dsi1: dsi@7e700000 {
- Add the
i2c_dsi: i2csection and modify thedsi1: dsi@7e700000section (don't forget to removestatus = "disabled";) like in that diff, using appropriate gpio numbers (they're shown there as&i2c_dsiblocks for various Pis' separate files, just take the gpio numbers and modify them inline in thei2c_dsi: i2csection) - Add the
rpi_ft5406andrpi_backlightsections from myupstream.dts - Finally, compile!
Look at the diff linked above, it has different numbers for different Pis.
Depends on your distro and way of booting.
For netbooting from U-Boot, something like this:
tftp ${kernel_addr_r} /Image
tftp ${fdt_addr_r} /upstream.dtb
tftp ${ramdisk_addr_r} /initramfs-linux.img
booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r}
For loading from the firmware, in config.txt:
device_tree=upstream.dtb