From aa8a8c7e4641ebcef02dd6fa387ca334857367f4 Mon Sep 17 00:00:00 2001 From: Luca Ceresoli Date: Wed, 16 Sep 2026 15:45:28 +0200 Subject: drm/bridge: panel: move all code to drm_panel.c Work is in progress for every drm_panel to embed a drm_bridge, replacing the panel_bridge entirely. However most of the panel_bridge code will be reused for the drm_bridge embedded into the drm_panel, so just move the code there. Adapt users of the moved functions to include drm_panel.h when necessary. No functional changes, just moving code around. Suggested-by: Maxime Ripard Acked-by: Maxime Ripard Link: https://patch.msgid.link/20260916-drm-bridge-every-panel-v3-4-83afb4f1a707@bootlin.com Signed-off-by: Luca Ceresoli --- include/drm/drm_bridge.h | 52 ----------------------------------------------- include/drm/drm_of.h | 1 + include/drm/drm_panel.h | 53 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 52 deletions(-) (limited to 'include') diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h index 77b3ffe69230..4c4032961c4a 100644 --- a/include/drm/drm_bridge.h +++ b/include/drm/drm_bridge.h @@ -1522,58 +1522,6 @@ void drm_bridge_hpd_disable(struct drm_bridge *bridge); void drm_bridge_hpd_notify(struct drm_bridge *bridge, enum drm_connector_status status); -#ifdef CONFIG_DRM_PANEL_BRIDGE -bool drm_bridge_is_panel(const struct drm_bridge *bridge); -struct drm_bridge *drm_panel_bridge_add(struct drm_panel *panel); -struct drm_bridge *drm_panel_bridge_add_typed(struct drm_panel *panel, - u32 connector_type); -void drm_panel_bridge_remove(struct drm_bridge *bridge); -int drm_panel_bridge_set_orientation(struct drm_connector *connector, - struct drm_bridge *bridge); -struct drm_bridge *devm_drm_panel_bridge_add(struct device *dev, - struct drm_panel *panel); -struct drm_bridge *devm_drm_panel_bridge_add_typed(struct device *dev, - struct drm_panel *panel, - u32 connector_type); -struct drm_bridge *drmm_panel_bridge_add(struct drm_device *drm, - struct drm_panel *panel); -struct drm_connector *drm_panel_bridge_connector(struct drm_bridge *bridge); -#else -static inline bool drm_bridge_is_panel(const struct drm_bridge *bridge) -{ - return false; -} - -static inline int drm_panel_bridge_set_orientation(struct drm_connector *connector, - struct drm_bridge *bridge) -{ - return -EINVAL; -} -#endif - -#if defined(CONFIG_OF) && defined(CONFIG_DRM_PANEL_BRIDGE) -struct drm_bridge *devm_drm_of_get_bridge(struct device *dev, struct device_node *node, - u32 port, u32 endpoint); -struct drm_bridge *drmm_of_get_bridge(struct drm_device *drm, struct device_node *node, - u32 port, u32 endpoint); -#else -static inline struct drm_bridge *devm_drm_of_get_bridge(struct device *dev, - struct device_node *node, - u32 port, - u32 endpoint) -{ - return ERR_PTR(-ENODEV); -} - -static inline struct drm_bridge *drmm_of_get_bridge(struct drm_device *drm, - struct device_node *node, - u32 port, - u32 endpoint) -{ - return ERR_PTR(-ENODEV); -} -#endif - void devm_drm_put_bridge(struct device *dev, struct drm_bridge *bridge); void drm_bridge_debugfs_params(struct dentry *root); diff --git a/include/drm/drm_of.h b/include/drm/drm_of.h index f6dad2c6e9b9..002ba1b18eb1 100644 --- a/include/drm/drm_of.h +++ b/include/drm/drm_of.h @@ -7,6 +7,7 @@ #if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_DRM_PANEL_BRIDGE) #include #include +#include #endif struct component_master_ops; diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h index 34fcbcdda2c8..bede046fb281 100644 --- a/include/drm/drm_panel.h +++ b/include/drm/drm_panel.h @@ -35,6 +35,7 @@ struct dentry; struct device_node; struct drm_bridge; struct drm_connector; +struct drm_device; struct drm_panel_follower; struct drm_panel; struct display_timing; @@ -394,4 +395,56 @@ static inline int drm_panel_of_backlight(struct drm_panel *panel) } #endif +#ifdef CONFIG_DRM_PANEL_BRIDGE +bool drm_bridge_is_panel(const struct drm_bridge *bridge); +struct drm_bridge *drm_panel_bridge_add(struct drm_panel *panel); +struct drm_bridge *drm_panel_bridge_add_typed(struct drm_panel *panel, + u32 connector_type); +void drm_panel_bridge_remove(struct drm_bridge *bridge); +int drm_panel_bridge_set_orientation(struct drm_connector *connector, + struct drm_bridge *bridge); +struct drm_bridge *devm_drm_panel_bridge_add(struct device *dev, + struct drm_panel *panel); +struct drm_bridge *devm_drm_panel_bridge_add_typed(struct device *dev, + struct drm_panel *panel, + u32 connector_type); +struct drm_bridge *drmm_panel_bridge_add(struct drm_device *drm, + struct drm_panel *panel); +struct drm_connector *drm_panel_bridge_connector(struct drm_bridge *bridge); +#else +static inline bool drm_bridge_is_panel(const struct drm_bridge *bridge) +{ + return false; +} + +static inline int drm_panel_bridge_set_orientation(struct drm_connector *connector, + struct drm_bridge *bridge) +{ + return -EINVAL; +} +#endif + +#if defined(CONFIG_OF) && defined(CONFIG_DRM_PANEL_BRIDGE) +struct drm_bridge *devm_drm_of_get_bridge(struct device *dev, struct device_node *node, + u32 port, u32 endpoint); +struct drm_bridge *drmm_of_get_bridge(struct drm_device *drm, struct device_node *node, + u32 port, u32 endpoint); +#else +static inline struct drm_bridge *devm_drm_of_get_bridge(struct device *dev, + struct device_node *node, + u32 port, + u32 endpoint) +{ + return ERR_PTR(-ENODEV); +} + +static inline struct drm_bridge *drmm_of_get_bridge(struct drm_device *drm, + struct device_node *node, + u32 port, + u32 endpoint) +{ + return ERR_PTR(-ENODEV); +} +#endif + #endif -- cgit v1.2.3