From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 42B92CA5FA3 for ; Mon, 28 Sep 2026 16:22:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Tqgsh7ezBrCiF/e0GkvssqPeCJvqCBDQzBUaw0XcIro=; b=RMNJRllNKdu78cj9qO1ONDfLwY lujddgpSiMDXaSLJ3fJTE/R/WMnKzvz9Wc55S2+x689r9QZ56h/jVs6VpjfSsVLZ5c7aT9qwEjcvr l/eMk2jJnt0/IRwC35kyLyoxwaKfNVE668A/umO0rM3+IfG278QC2D807KxtqKFFxWXdNNKD1A289 D9MgocO/0e7McLgenmC/isUi80JomAbEQmkW6aHEIzIpMXYGdDoChd/BZ13OX1bUB6ChXFLLGyAry dKwJGF98Ke3DOshVLMWGYHDGqBBNRDau7MdFn5HBsIAWsrJdB6fJKrTNK1Q3EuXrD1h92tIR/B8TU 5BqVexOQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1xBE7q-000000010fr-03ZY; Mon, 28 Sep 2026 16:22:46 +0000 Received: from sea.source.kernel.org ([172.234.252.31]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1xBE7T-000000010Vm-3oxX; Mon, 28 Sep 2026 16:22:23 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id A169744009; Mon, 28 Sep 2026 16:22:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 741221F000FF; Mon, 28 Sep 2026 16:22:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1790612543; bh=Tqgsh7ezBrCiF/e0GkvssqPeCJvqCBDQzBUaw0XcIro=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=M+zThmMzTERby8av/lDezTU9D0Jnr9mNiFLFLf/KUBdC4PVZRIct8rvfqjnxayIsG yvu9qDeukxBg5/r1DWGIql5Wi+Y88au3wsvad1hc9YxvoWCGOFccVQqpy4rSowzJXH BX6rhQXleMhYQr/Ao/5hSxq58Te5JMxwckB+nElXovWXoODRrVkG5jUVqzGjyW3FvQ 1y2EyXeOZltbsn3e/YQA6odCIiaoMxbaOEg1oTnigpGso9uYp2jVjbaI+BjY8CgZ3T rY8fIaRHqL/J385t2U0IbFZq/JG6NCT9+FrCo+cRZc7Jv7lKcmgAh0WNrnKufNIIpW DmseDD1giKDVw== From: Maxime Ripard Date: Mon, 28 Sep 2026 18:22:02 +0200 Subject: [PATCH 2/6] drm/panel: Add generic MIPI-DSI panel driver with BPF init sequences MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20260928-drm-mipi-dsi-panel-ebpf-v1-2-5244926aace4@kernel.org> References: <20260928-drm-mipi-dsi-panel-ebpf-v1-0-5244926aace4@kernel.org> In-Reply-To: <20260928-drm-mipi-dsi-panel-ebpf-v1-0-5244926aace4@kernel.org> To: Neil Armstrong , Jessica Zhang , David Airlie , Simona Vetter , Maarten Lankhorst , Thomas Zimmermann , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Florian Fainelli , Broadcom internal kernel review list Cc: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Luca Ceresoli , Albert Esteve , Dave Stevenson , Javier Martinez Canillas , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, llvm@lists.linux.dev, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Maxime Ripard , Benjamin Tissoires X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=52734; i=mripard@kernel.org; h=from:subject:message-id; bh=Sq7nSAYIRm06azl54O3bdnaM/2w84alz0rWLGc/+Dz0=; b=owGbwMvMwCmsHn9OcpHtvjLG02pJDFm7phi+vVv36+CC0jnu1+3k9K/K8/9i3Nv3OFZkYtGhb 4Jmb0/e7pjKwiDMySArpsjyRCbs9PL2xVUO9it/wMxhZQIZwsDFKQAT6WBmrDNZoys14V+xTvOe 1r1Gjrb5sRKsBv4zk6+2Rd55O2kex+Ujk0T0gzq8XXluXyj1z2GTZawvZXj2Ytnr7CmfdhdnljA x7GB/udtsedTyrfkfD3xcWZih33ZXi19v4lb5nXcdwm/+1y4GAA== X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Most MIPI-DSI panel drivers reimplement the same boilerplate with only the init sequence and power-on/off timing varying. However, each new panel still requires a kernel driver, creating a tension between OEMs and distributions. OEMs need to support new panels swiftly to accommodate sourcing and production issues, while distributions can take years to ship a new kernel. Replace per-panel modules with a single generic driver whose panel-specific behavior is provided by BPF programs loaded from userspace, following the HID-BPF model (drivers/hid/bpf/). The driver registers a drm_bridge that remains disconnected until a BPF program attaches, at which point the connector appears and the display pipeline comes up. This also allows users to force- enable the pipeline when it makes sense for their setup. Sleepable kfuncs are exposed to control regulators, GPIOs, and send and receive DSI data. The rest of the boilerplate is handled by the driver directly. Sysfs attributes expose the link configuration so that a userspace BPF loader can match programs to panels without parsing the device tree. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/panel/Kconfig | 3 + drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/bpf/Kconfig | 28 ++ drivers/gpu/drm/panel/bpf/Makefile | 10 + .../gpu/drm/panel/bpf/panel-bpf-mipi-dsi-core.c | 452 +++++++++++++++++++++ .../gpu/drm/panel/bpf/panel-bpf-mipi-dsi-kfuncs.c | 278 +++++++++++++ drivers/gpu/drm/panel/bpf/panel-bpf-mipi-dsi-ops.c | 242 +++++++++++ .../gpu/drm/panel/bpf/panel-bpf-mipi-dsi-trace.c | 4 + .../gpu/drm/panel/bpf/panel-bpf-mipi-dsi-trace.h | 246 +++++++++++ drivers/gpu/drm/panel/bpf/panel-bpf-mipi-dsi.h | 264 ++++++++++++ include/drm/drm_panel_dsi_bpf.h | 50 +++ 11 files changed, 1578 insertions(+) diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig index 747f47347521..d885fc4a8eb7 100644 --- a/drivers/gpu/drm/panel/Kconfig +++ b/drivers/gpu/drm/panel/Kconfig @@ -1438,6 +1438,9 @@ config DRM_PANEL_XINPENG_XPP055C272 depends on BACKLIGHT_CLASS_DEVICE help Say Y here if you want to enable support for the Xinpeng XPP055C272 controller for 720x1280 LCD panels with MIPI/RGB/SPI system interfaces. + +source "drivers/gpu/drm/panel/bpf/Kconfig" + endmenu diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile index f2c9c80a218f..729394961101 100644 --- a/drivers/gpu/drm/panel/Makefile +++ b/drivers/gpu/drm/panel/Makefile @@ -8,10 +8,11 @@ obj-$(CONFIG_DRM_PANEL_BOE_BF060Y8M_AJ0) += panel-boe-bf060y8m-aj0.o obj-$(CONFIG_DRM_PANEL_BOE_HIMAX8279D) += panel-boe-himax8279d.o obj-$(CONFIG_DRM_PANEL_BOE_TD4320) += panel-boe-td4320.o obj-$(CONFIG_DRM_PANEL_BOE_TH101MB31UIG002_28A) += panel-boe-th101mb31ig002-28a.o obj-$(CONFIG_DRM_PANEL_BOE_TV101WUM_LL2) += panel-boe-tv101wum-ll2.o obj-$(CONFIG_DRM_PANEL_BOE_TV101WUM_NL6) += panel-boe-tv101wum-nl6.o +obj-$(CONFIG_DRM_PANEL_BPF) += bpf/ obj-$(CONFIG_DRM_PANEL_CHIPONE_ICNA35XX) += panel-chipone-icna35xx.o obj-$(CONFIG_DRM_PANEL_CHIPWEALTH_CH13726A) += panel-chipwealth-ch13726a.o obj-$(CONFIG_DRM_PANEL_DSI_CM) += panel-dsi-cm.o obj-$(CONFIG_DRM_PANEL_LVDS) += panel-lvds.o obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o diff --git a/drivers/gpu/drm/panel/bpf/Kconfig b/drivers/gpu/drm/panel/bpf/Kconfig new file mode 100644 index 000000000000..2331e9fc26cc --- /dev/null +++ b/drivers/gpu/drm/panel/bpf/Kconfig @@ -0,0 +1,28 @@ +# SPDX-License-Identifier: GPL-2.0 + +config DRM_PANEL_BPF + tristate "eBPF-backed panels" + depends on DRM && DRM_PANEL + depends on BPF_SYSCALL + help + TODO + +menu "eBPF Display Panels" + depends on DRM_PANEL_BPF + +config DRM_PANEL_BPF_MIPI_DSI + tristate "Generic BPF-based MIPI-DSI panel" + depends on BACKLIGHT_CLASS_DEVICE + depends on BPF_SYSCALL + depends on DRM_MIPI_DSI + depends on OF + select VIDEOMODE_HELPERS + help + Generic MIPI-DSI panel driver that delegates panel-specific + power sequencing and DSI init commands to BPF programs loaded + from userspace. + + Enable this if you want to support MIPI-DSI panels without + panel-specific kernel drivers. + +endmenu diff --git a/drivers/gpu/drm/panel/bpf/Makefile b/drivers/gpu/drm/panel/bpf/Makefile new file mode 100644 index 000000000000..07c68ca2eb69 --- /dev/null +++ b/drivers/gpu/drm/panel/bpf/Makefile @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: GPL-2.0 + +obj-$(CONFIG_DRM_PANEL_BPF_MIPI_DSI) += panel-bpf-mipi-dsi.o + +panel-bpf-mipi-dsi-y := panel-bpf-mipi-dsi-core.o \ + panel-bpf-mipi-dsi-kfuncs.o \ + panel-bpf-mipi-dsi-ops.o \ + panel-bpf-mipi-dsi-trace.o + +CFLAGS_panel-bpf-mipi-dsi-trace.o := -I$(src) diff --git a/drivers/gpu/drm/panel/bpf/panel-bpf-mipi-dsi-core.c b/drivers/gpu/drm/panel/bpf/panel-bpf-mipi-dsi-core.c new file mode 100644 index 000000000000..585f3cc5fda9 --- /dev/null +++ b/drivers/gpu/drm/panel/bpf/panel-bpf-mipi-dsi-core.c @@ -0,0 +1,452 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Generic MIPI-DSI panel driver with BPF-based init sequences + * + * Copyright (C) 2026 + * + * A single generic MIPI-DSI panel driver where the panel-specific + * power sequencing and DSI init commands are provided by BPF + * struct_ops programs loaded from userspace, following the HID-BPF + * model (drivers/hid/bpf/). + * + * This file handles DT resource acquisition, drm_bridge registration, + * and dispatching bridge callbacks to BPF programs. Panel DT nodes + * use a fallback compatible: + * + * compatible = "elida,kd35t133", "panel-mipi-dsi-bpf"; + * + * The driver matches on "panel-mipi-dsi-bpf". The panel's OF node + * path is stored as panel_id for BPF matching. New panels only need + * a DT overlay and a BPF program — no kernel driver. + * + * See panel-bpf-mipi-dsi-ops.c for the struct_ops binding logic and + * panel-bpf-mipi-dsi-kfuncs.c for the kfunc interface. + */ + +#include +#include +#include +#include +#include +#include + +#include