[PATCH v2 3/5] platform/broadcom: Destage VCHIQ interface

Jai Luthra
2025-09-07T09:09:24Z

Destage the VCHIQ interface driver to drivers/platform/raspberrypi.

There is still the remaining TODO item of improving the documentation,
which can be handled post destaging.

Secondly, multimedia drivers like codec and ISP that rely on this
interface need to be upstreamed. And lastly, the drivers that facilitate
the shared memory between VideoCore and Linux, like the vc-sm-cma driver
and vc_mem char driver also need to be upstreamed.

Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com>
---
MAINTAINERS | 1 +
drivers/platform/Kconfig | 2 +
drivers/platform/Makefile | 1 +
drivers/platform/raspberrypi/Kconfig | 50 ++++++++++++++++++++++
drivers/platform/raspberrypi/Makefile | 14 ++++++
.../raspberrypi/vchiq-interface}/TESTING | 0
.../raspberrypi/vchiq-interface}/TODO | 0
.../raspberrypi/vchiq-interface}/vchiq_arm.c | 0
.../raspberrypi/vchiq-interface}/vchiq_bus.c | 0
.../raspberrypi/vchiq-interface}/vchiq_core.c | 0
.../raspberrypi/vchiq-interface}/vchiq_debugfs.c | 0
.../raspberrypi/vchiq-interface}/vchiq_dev.c | 0
.../raspberrypi/vchiq-interface}/vchiq_ioctl.h | 0
drivers/staging/vc04_services/Kconfig | 45 -------------------
drivers/staging/vc04_services/Makefile | 12 ------
15 files changed, 68 insertions(+), 57 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 5f79e377ad707ca65fe01f9882c95f8ab1aaa755..fc74a9e2e5a47b8c82cf68ef7c1fe3d37e2fe89b 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4753,6 +4753,7 @@ S: Maintained
T: git https://github.com/broadcom/stblinux.git
F: Documentation/devicetree/bindings/pci/brcm,stb-pcie.yaml
F: drivers/pci/controller/pcie-brcmstb.c
+F: drivers/platform/raspberrypi/vchiq-interface
F: drivers/staging/vc04_services
F: include/linux/raspberrypi/vchiq*
N: bcm2711
diff --git a/drivers/platform/Kconfig b/drivers/platform/Kconfig
index 960fd6a82450a4c7b97d51ea3bc29795ee74efd1..324c69c63f76d90643736d00d056382f396adbca 100644
--- a/drivers/platform/Kconfig
+++ b/drivers/platform/Kconfig
@@ -18,3 +18,5 @@ source "drivers/platform/surface/Kconfig"
source "drivers/platform/x86/Kconfig"

source "drivers/platform/arm64/Kconfig"
+
+source "drivers/platform/raspberrypi/Kconfig"
diff --git a/drivers/platform/Makefile b/drivers/platform/Makefile
index 19ac54648586eb617af0f8a69e3205bd83e8c35b..b97c54e12459fb8c6395d66bd28235b05a729e82 100644
--- a/drivers/platform/Makefile
+++ b/drivers/platform/Makefile
@@ -13,3 +13,4 @@ obj-$(CONFIG_CHROME_PLATFORMS) += chrome/
obj-$(CONFIG_CZNIC_PLATFORMS) += cznic/
obj-$(CONFIG_SURFACE_PLATFORMS) += surface/
obj-$(CONFIG_ARM64_PLATFORM_DEVICES) += arm64/
+obj-$(CONFIG_BCM_VIDEOCORE) += raspberrypi/
diff --git a/drivers/platform/raspberrypi/Kconfig b/drivers/platform/raspberrypi/Kconfig
new file mode 100644
index 0000000000000000000000000000000000000000..9085e7464ec348fce5ec9f41a9019ab12eee964b
--- /dev/null
+++ b/drivers/platform/raspberrypi/Kconfig
@@ -0,0 +1,50 @@
+# SPDX-License-Identifier: GPL-2.0
+
+menuconfig BCM_VIDEOCORE
+ tristate "Broadcom VideoCore support"
+ depends on OF
+ depends on RASPBERRYPI_FIRMWARE || (COMPILE_TEST && !RASPBERRYPI_FIRMWARE)
+ default y
+ help
+ Support for Broadcom VideoCore services including
+ the BCM2835 family of products which is used
+ by the Raspberry PI.
+
+if BCM_VIDEOCORE
+
+config BCM2835_VCHIQ
+ tristate "BCM2835 VCHIQ"
+ depends on HAS_DMA
+ imply VCHIQ_CDEV
+ help
+ Broadcom BCM2835 and similar SoCs have a VPU called VideoCore.
+ This config enables the VCHIQ driver, which implements a
+ messaging interface between the kernel and the firmware running
+ on VideoCore. Other drivers use this interface to communicate to
+ the VPU. More specifically, the VCHIQ driver is used by
+ audio/video and camera drivers as well as for implementing MMAL
+ API, which is in turn used by several multimedia services on the
+ BCM2835 family of SoCs.
+
+ Defaults to Y when the Broadcom Videocore services are included
+ in the build, N otherwise.
+
+if BCM2835_VCHIQ
+
+config VCHIQ_CDEV
+ bool "VCHIQ Character Driver"
+ help
+ Enable the creation of VCHIQ character driver. The cdev exposes
+ ioctls used by userspace libraries and testing tools to interact
+ with VideoCore, via the VCHIQ core driver (Check BCM2835_VCHIQ
+ for more info).
+
+ This can be set to 'N' if the VideoCore communication is not
+ needed by userspace but only by other kernel modules
+ (like bcm2835-audio).
+
+ If not sure, set this to 'Y'.
+
+endif
+
+endif
diff --git a/drivers/platform/raspberrypi/Makefile b/drivers/platform/raspberrypi/Makefile
new file mode 100644
index 0000000000000000000000000000000000000000..a807571c59a47bb418cbb1dfcc389219d0d0ff22
--- /dev/null
+++ b/drivers/platform/raspberrypi/Makefile
@@ -0,0 +1,14 @@
+# SPDX-License-Identifier: GPL-2.0
+
+obj-$(CONFIG_BCM2835_VCHIQ) += vchiq.o
+
+vchiq-objs := \
+ vchiq-interface/vchiq_core.o \
+ vchiq-interface/vchiq_arm.o \
+ vchiq-interface/vchiq_bus.o \
+ vchiq-interface/vchiq_debugfs.o \
+
+ifdef CONFIG_VCHIQ_CDEV
+vchiq-objs += vchiq-interface/vchiq_dev.o
+endif
+
diff --git a/drivers/staging/vc04_services/interface/TESTING b/drivers/platform/raspberrypi/vchiq-interface/TESTING
similarity index 100%
rename from drivers/staging/vc04_services/interface/TESTING
rename to drivers/platform/raspberrypi/vchiq-interface/TESTING
diff --git a/drivers/staging/vc04_services/interface/TODO b/drivers/platform/raspberrypi/vchiq-interface/TODO
similarity index 100%
rename from drivers/staging/vc04_services/interface/TODO
rename to drivers/platform/raspberrypi/vchiq-interface/TODO
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/platform/raspberrypi/vchiq-interface/vchiq_arm.c
similarity index 100%
rename from drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
rename to drivers/platform/raspberrypi/vchiq-interface/vchiq_arm.c
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.c b/drivers/platform/raspberrypi/vchiq-interface/vchiq_bus.c
similarity index 100%
rename from drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.c
rename to drivers/platform/raspberrypi/vchiq-interface/vchiq_bus.c
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/platform/raspberrypi/vchiq-interface/vchiq_core.c
similarity index 100%
rename from drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
rename to drivers/platform/raspberrypi/vchiq-interface/vchiq_core.c
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c b/drivers/platform/raspberrypi/vchiq-interface/vchiq_debugfs.c
similarity index 100%
rename from drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c
rename to drivers/platform/raspberrypi/vchiq-interface/vchiq_debugfs.c
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c b/drivers/platform/raspberrypi/vchiq-interface/vchiq_dev.c
similarity index 100%
rename from drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c
rename to drivers/platform/raspberrypi/vchiq-interface/vchiq_dev.c
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h b/drivers/platform/raspberrypi/vchiq-interface/vchiq_ioctl.h
similarity index 100%
rename from drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h
rename to drivers/platform/raspberrypi/vchiq-interface/vchiq_ioctl.h
diff --git a/drivers/staging/vc04_services/Kconfig b/drivers/staging/vc04_services/Kconfig
index ccc8e15886482e8caa4aeb12440036183fc9b80c..f599f36c54062416305f49a9bba076c3f91c06d3 100644
--- a/drivers/staging/vc04_services/Kconfig
+++ b/drivers/staging/vc04_services/Kconfig
@@ -1,51 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
-menuconfig BCM_VIDEOCORE
- tristate "Broadcom VideoCore support"
- depends on OF
- depends on RASPBERRYPI_FIRMWARE || (COMPILE_TEST && !RASPBERRYPI_FIRMWARE)
- default y
- help
- Support for Broadcom VideoCore services including
- the BCM2835 family of products which is used
- by the Raspberry PI.
-
if BCM_VIDEOCORE

-config BCM2835_VCHIQ
- tristate "BCM2835 VCHIQ"
- depends on HAS_DMA
- imply VCHIQ_CDEV
- help
- Broadcom BCM2835 and similar SoCs have a VPU called VideoCore.
- This config enables the VCHIQ driver, which implements a
- messaging interface between the kernel and the firmware running
- on VideoCore. Other drivers use this interface to communicate to
- the VPU. More specifically, the VCHIQ driver is used by
- audio/video and camera drivers as well as for implementing MMAL
- API, which is in turn used by several multimedia services on the
- BCM2835 family of SoCs.
-
- Defaults to Y when the Broadcom Videocore services are included
- in the build, N otherwise.
-
-if BCM2835_VCHIQ
-
-config VCHIQ_CDEV
- bool "VCHIQ Character Driver"
- help
- Enable the creation of VCHIQ character driver. The cdev exposes
- ioctls used by userspace libraries and testing tools to interact
- with VideoCore, via the VCHIQ core driver (Check BCM2835_VCHIQ
- for more info).
-
- This can be set to 'N' if the VideoCore communication is not
- needed by userspace but only by other kernel modules
- (like bcm2835-audio).
-
- If not sure, set this to 'Y'.
-
-endif
-
source "drivers/staging/vc04_services/bcm2835-audio/Kconfig"

source "drivers/staging/vc04_services/bcm2835-camera/Kconfig"
diff --git a/drivers/staging/vc04_services/Makefile b/drivers/staging/vc04_services/Makefile
index dad3789522b80420f1f72ca8f740c816fb3d9843..51c9466ec7a28141cf66508f602f43cd89ad408b 100644
--- a/drivers/staging/vc04_services/Makefile
+++ b/drivers/staging/vc04_services/Makefile
@@ -1,16 +1,4 @@
# SPDX-License-Identifier: GPL-2.0
-obj-$(CONFIG_BCM2835_VCHIQ) += vchiq.o
-
-vchiq-objs := \
- interface/vchiq_arm/vchiq_core.o \
- interface/vchiq_arm/vchiq_arm.o \
- interface/vchiq_arm/vchiq_bus.o \
- interface/vchiq_arm/vchiq_debugfs.o \
-
-ifdef CONFIG_VCHIQ_CDEV
-vchiq-objs += interface/vchiq_arm/vchiq_dev.o
-endif
-
obj-$(CONFIG_SND_BCM2835) += bcm2835-audio/
obj-$(CONFIG_VIDEO_BCM2835) += bcm2835-camera/
obj-$(CONFIG_BCM2835_VCHIQ_MMAL) += vchiq-mmal/

--
2.50.1