From c448bcd0746dc252cee265cf30db7238f9d0c86f Mon Sep 17 00:00:00 2001 From: Madhavan Krishnan Date: Fri, 16 Oct 2020 09:31:28 +0200 Subject: [PATCH] libcamera: Enabled camera overlays define based Added imx219.dtbo file in the overlays, and added dtoverlay in /boot/config.txt define based. To enable Sony Raspberry pi camera imx219 sensor, need to set the variable RASPBERRYPI_CAMERA_V2 as 1. In future, we can add any camera overlays here to support and use them with libcamera. Signed-off-by: Madhavan Krishnan (cherry picked from commit b70c7b9021e37ec765f4db9aac0e0e76f617cbac) Signed-off-by: Ricardo Salveti --- conf/machine/include/rpi-base.inc | 1 + docs/extra-build-config.md | 14 ++++++++++++++ recipes-bsp/bootfiles/rpi-config_git.bb | 6 ++++++ recipes-kernel/linux/linux-raspberrypi.inc | 3 ++- 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/conf/machine/include/rpi-base.inc b/conf/machine/include/rpi-base.inc index cd6d0b0..d4a25a4 100644 --- a/conf/machine/include/rpi-base.inc +++ b/conf/machine/include/rpi-base.inc @@ -42,6 +42,7 @@ RPI_KERNEL_DEVICETREE_OVERLAYS ?= " \ overlays/w1-gpio.dtbo \ overlays/gpio-ir.dtbo \ overlays/gpio-ir-tx.dtbo \ + overlays/imx219.dtbo \ " RPI_KERNEL_DEVICETREE ?= " \ diff --git a/docs/extra-build-config.md b/docs/extra-build-config.md index 8460184..921dcc5 100644 --- a/docs/extra-build-config.md +++ b/docs/extra-build-config.md @@ -326,3 +326,17 @@ option: # Raspberry Pi 7\" display/touch screen \n \ lcd_rotate=2 \n \ ' +## Enable Raspberrypi Camera V2 + +RaspberryPi does not have the unicam device ( RaspberryPi Camera ) enabled by default. +Because this unicam device ( bcm2835-unicam ) as of now is used by libcamera opensource. +So we have to explicitly set in local.conf. + + RASPBERRYPI_CAMERA_V2 = "1" + +This will add the device tree overlays imx219 ( RaspberryPi Camera sensor V2 driver ) to config.txt. +Also, this will enable adding Contiguous Memory Allocation value in the cmdline.txt. + +Ref.: +* +* diff --git a/recipes-bsp/bootfiles/rpi-config_git.bb b/recipes-bsp/bootfiles/rpi-config_git.bb index 9489951..e1c330d 100644 --- a/recipes-bsp/bootfiles/rpi-config_git.bb +++ b/recipes-bsp/bootfiles/rpi-config_git.bb @@ -178,6 +178,12 @@ do_deploy() { echo "dtoverlay=${VC4DTBO}" >> ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt fi + # Choose Camera Sensor to be used, default imx219 sensor + if [ "${RASPBERRYPI_CAMERA_V2}" = "1" ]; then + echo "# Enable Sony RaspberryPi Camera" >> ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt + echo "dtoverlay=imx219" >> ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt + fi + # Waveshare "C" 1024x600 7" Rev2.1 IPS capacitive touch (http://www.waveshare.com/7inch-HDMI-LCD-C.htm) if [ "${WAVESHARE_1024X600_C_2_1}" = "1" ]; then echo "# Waveshare \"C\" 1024x600 7\" Rev2.1 IPS capacitive touch screen" >> ${DEPLOYDIR}/${BOOTFILES_DIR_NAME}/config.txt diff --git a/recipes-kernel/linux/linux-raspberrypi.inc b/recipes-kernel/linux/linux-raspberrypi.inc index 3219a23..4e0d4d0 100644 --- a/recipes-kernel/linux/linux-raspberrypi.inc +++ b/recipes-kernel/linux/linux-raspberrypi.inc @@ -27,7 +27,8 @@ LINUX_VERSION_EXTENSION ?= "" # CMDLINE for raspberrypi SERIAL = "${@oe.utils.conditional("ENABLE_UART", "1", "console=serial0,115200", "", d)}" -CMDLINE ?= "dwc_otg.lpm_enable=0 ${SERIAL} root=/dev/mmcblk0p2 rootfstype=ext4 rootwait" +CMA ?= "${@oe.utils.conditional("RASPBERRYPI_CAMERA_V2", "1", "cma=64M", "", d)}" +CMDLINE ?= "dwc_otg.lpm_enable=0 ${SERIAL} root=/dev/mmcblk0p2 rootfstype=ext4 rootwait ${CMA}" # Add the kernel debugger over console kernel command line option if enabled CMDLINE_append = ' ${@oe.utils.conditional("ENABLE_KGDB", "1", "kgdboc=serial0,115200", "", d)}'