[PATCH 05/10] drm/panel: Create attach and detach callbacks

Sam Ravnborg sam at ravnborg.org
Tue Jul 20 19:53:59 UTC 2021


On Tue, Jul 20, 2021 at 03:45:20PM +0200, Maxime Ripard wrote:
> In order to make the probe order expectation more consistent between
> bridges, let's create attach and detach hooks for the panels as well to
> match what is there for bridges.

This is a partally revert of:
87154ff86bf6 ("drm: Remove unnecessary drm_panel_attach and drm_panel_detach")

The chanelog should say so - and please try to re-use the documentation
from the revert. We do not want non-documneted operations in
drm_panel_funcs.

	Sam

> 
> Signed-off-by: Maxime Ripard <maxime at cerno.tech>
> ---
>  drivers/gpu/drm/drm_panel.c | 20 ++++++++++++++++++++
>  include/drm/drm_panel.h     |  6 ++++++
>  2 files changed, 26 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c
> index f634371c717a..23bca798a2f3 100644
> --- a/drivers/gpu/drm/drm_panel.c
> +++ b/drivers/gpu/drm/drm_panel.c
> @@ -223,6 +223,26 @@ int drm_panel_get_modes(struct drm_panel *panel,
>  }
>  EXPORT_SYMBOL(drm_panel_get_modes);
>  
> +int drm_panel_attach(struct drm_panel *panel)
> +{
> +	if (!panel)
> +		return -EINVAL;
> +
> +	if (panel->funcs && panel->funcs->attach)
> +		return panel->funcs->attach(panel);
> +
> +	return -EOPNOTSUPP;
> +}
> +
> +void drm_panel_detach(struct drm_panel *panel)
> +{
> +	if (!panel)
> +		return;
> +
> +	if (panel->funcs && panel->funcs->detach)
> +		panel->funcs->detach(panel);
> +}
> +
>  #ifdef CONFIG_OF
>  /**
>   * of_drm_find_panel - look up a panel using a device tree node
> diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h
> index 4602f833eb51..b9201d520754 100644
> --- a/include/drm/drm_panel.h
> +++ b/include/drm/drm_panel.h
> @@ -68,6 +68,9 @@ enum drm_panel_orientation;
>   * does not need to implement the functionality to enable/disable backlight.
>   */
>  struct drm_panel_funcs {
> +	int (*attach)(struct drm_panel *panel);
> +	void (*detach)(struct drm_panel *panel);
> +
>  	/**
>  	 * @prepare:
>  	 *
> @@ -180,6 +183,9 @@ void drm_panel_init(struct drm_panel *panel, struct device *dev,
>  void drm_panel_add(struct drm_panel *panel);
>  void drm_panel_remove(struct drm_panel *panel);
>  
> +int drm_panel_attach(struct drm_panel *panel);
> +void drm_panel_detach(struct drm_panel *panel);
> +
>  int drm_panel_prepare(struct drm_panel *panel);
>  int drm_panel_unprepare(struct drm_panel *panel);
>  
> -- 
> 2.31.1


More information about the dri-devel mailing list