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