From d6c5805db37d42d29e190b7f2dc49ed8e4545e00 Mon Sep 17 00:00:00 2001 From: John Audia Date: Wed, 11 Dec 2024 15:06:30 -0500 Subject: [PATCH] bcm27xx/bcm2712: add RP1 drivers via kmods Add kmods for the following RP1 options that not all users will necessarily need or want compiled in: * Composite video * Display video * LED control * PWM control * Serial video Build system: x86/64 Build-tested: bcm2712/RPi5B Run-tested: bcm2712/RPi5B Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/17233 Signed-off-by: Robert Marko --- target/linux/bcm27xx/modules/other.mk | 37 +++++++++++++ target/linux/bcm27xx/modules/video.mk | 78 +++++++++++++++++++++++++++ 2 files changed, 115 insertions(+) diff --git a/target/linux/bcm27xx/modules/other.mk b/target/linux/bcm27xx/modules/other.mk index 99b71d4d69..5a69000748 100644 --- a/target/linux/bcm27xx/modules/other.mk +++ b/target/linux/bcm27xx/modules/other.mk @@ -53,3 +53,40 @@ define KernelPackage/smi-bcm2835-dev/description endef $(eval $(call KernelPackage,smi-bcm2835-dev)) + + +define KernelPackage/pwm-pio-rp1 + SUBMENU:=$(OTHER_MENU) + TITLE:=RP1 PWM support + KCONFIG:=CONFIG_PWM_PIO_RP1 + FILES:=$(LINUX_DIR)/drivers/pwm/pwm-pio-rp1.ko + AUTOLOAD:=$(call AutoLoad,21,pwm-pio-rp1) + DEPENDS:=@TARGET_bcm27xx_bcm2712 +endef + +define KernelPackage/pwm-pio-rp1/description + Enables precise control of PWM signals for tasks like motor control, + LED dimming, and audio signal generation. Leveraging PIO allows for + higher accuracy and flexibility in PWM signal generation compared + to traditional hardware timers. +endef + +$(eval $(call KernelPackage,pwm-pio-rp1)) + + +define KernelPackage/ws2812-pio-rp1 + SUBMENU:=$(OTHER_MENU) + TITLE:=RP1 PIO-base WS2812 driver + KCONFIG:=CONFIG_WS2812_PIO_RP1 + FILES:=$(LINUX_DIR)/drivers/misc/ws2812-pio-rp1.ko + AUTOLOAD:=$(call AutoLoad,21,ws2812-pio-rp1) + DEPENDS:=@TARGET_bcm27xx_bcm2712 +endef + +define KernelPackage/ws2812-pio-rp1/description + Driver for the WS2812 (NeoPixel) LEDs using the RP1 PIO hardware. + The driver creates a character device to which rgbw pixels may be + written. Single-byte writes to offset 0 set the brightness at runtime. +endef + +$(eval $(call KernelPackage,ws2812-pio-rp1)) diff --git a/target/linux/bcm27xx/modules/video.mk b/target/linux/bcm27xx/modules/video.mk index b9af0b3e0f..8e2b19bd87 100644 --- a/target/linux/bcm27xx/modules/video.mk +++ b/target/linux/bcm27xx/modules/video.mk @@ -115,3 +115,81 @@ define KernelPackage/vchiq-mmal-bcm2835/description endef $(eval $(call KernelPackage,vchiq-mmal-bcm2835)) + + +define KernelPackage/drm-rp1-dsi + SUBMENU:=$(VIDEO_MENU) + TITLE:=RP1 Display Serial Interface for Video + KCONFIG:= \ + CONFIG_DRM_RP1_DSI \ + CONFIG_DRM_GEM_DMA_HELPER \ + CONFIG_DRM_KMS_HELPER \ + CONFIG_DRM_MIPI_DSI=y \ + CONFIG_DRM_VRAM_HELPER=n \ + CONFIG_DRM_TTM=n \ + CONFIG_DRM_TTM_HELPER=n \ + CONFIG_GENERIC_PHY_MIPI_DPHY=n \ + CONFIG_DRM_WERROR=n + FILES:=$(LINUX_DIR)/drivers/gpu/drm/rp1/rp1-dsi/drm-rp1-dsi.ko + AUTOLOAD:=$(call AutoLoad,67,drm-rp1-dsi) + DEPENDS:=@TARGET_bcm27xx_bcm2712 +kmod-drm-vc4 +endef + +define KernelPackage/drm-rp1-dsi/description + This module manages the DSI for driving high-resolution LCD panels + such as the official Raspberry Pi displays or other screens that + use the DSI interface. +endef + +$(eval $(call KernelPackage,drm-rp1-dsi)) + + +define KernelPackage/drm-rp1-dpi + SUBMENU:=$(VIDEO_MENU) + TITLE:=RP1 Display Parallel Interface for Video + KCONFIG:= \ + CONFIG_DRM_RP1_DPI \ + CONFIG_DRM_GEM_DMA_HELPER \ + CONFIG_DRM_KMS_HELPER \ + CONFIG_DRM_VRAM_HELPER=n \ + CONFIG_DRM_TTM=n \ + CONFIG_DRM_TTM_HELPER=n + FILES:=$(LINUX_DIR)/drivers/gpu/drm/rp1/rp1-dpi/drm-rp1-dpi.ko + AUTOLOAD:=$(call AutoLoad,67,drm-rp1-dpi) + DEPENDS:=@TARGET_bcm27xx_bcm2712 +kmod-drm-vc4 +endef + +define KernelPackage/drm-rp1-dpi/description + This module is or driving displays using the DPI standard. + Useful for interfacing with custom or low-level LCD panels + that require parallel RGB signals. Provides direct control + over the timing and signal driving of raw LCD panels. + Typically used in maker projects or with non-HDMI displays. +endef + +$(eval $(call KernelPackage,drm-rp1-dpi)) + + +define KernelPackage/drm-rp1-vec + SUBMENU:=$(VIDEO_MENU) + TITLE:=RP1 Display Composite Video + KCONFIG:= \ + CONFIG_DRM_RP1_VEC \ + CONFIG_DRM_GEM_DMA_HELPER \ + CONFIG_DRM_KMS_HELPER \ + CONFIG_DRM_VRAM_HELPER=n \ + CONFIG_DRM_TTM=n \ + CONFIG_DRM_TTM_HELPER=n + FILES:=$(LINUX_DIR)/drivers/gpu/drm/rp1/rp1-vec/drm-rp1-vec.ko + AUTOLOAD:=$(call AutoLoad,67,drm-rp1-vec) + DEPENDS:=@TARGET_bcm27xx_bcm2712 +kmod-drm-vc4 +endef + +define KernelPackage/drm-rp1-vec/description + This module is used for composite video output, which is typically + transmitted through the RCA jack. Primary use is onnecting older + TVs or monitors that rely on analog signals via a composite interface. + Handles standard-definition analog signals in NTSC and PAL. +endef + +$(eval $(call KernelPackage,drm-rp1-vec)) -- 2.30.2