diff mbox series

[v11,4/9] drm/mediatek: Add encoder_index interface for mtk_ddp_comp_funcs

Message ID 20231004024013.18956-5-jason-jh.lin@mediatek.com (mailing list archive)
State New, archived
Headers show
Series Add connector dynamic selection capability | expand

Commit Message

Jason-JH.Lin Oct. 4, 2023, 2:40 a.m. UTC
To support dynamic connector selection function, each ddp_comp need to
get their encoder_index to identify which connector should be selected.

Add encoder_index interface for mtk_ddp_comp_funcs to get the encoder
identifier by drm_encoder_index().
Then drm driver will call mtk_ddp_comp_encoder_index_set() to store the
encoder_index to each ddp_comp in connector routes.

Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

CK Hu (胡俊光) Oct. 6, 2023, 7:15 a.m. UTC | #1
Hi, Jason:

On Wed, 2023-10-04 at 10:40 +0800, Jason-JH.Lin wrote:
> To support dynamic connector selection function, each ddp_comp need
> to
> get their encoder_index to identify which connector should be
> selected.
> 
> Add encoder_index interface for mtk_ddp_comp_funcs to get the encoder
> identifier by drm_encoder_index().
> Then drm driver will call mtk_ddp_comp_encoder_index_set() to store
> the
> encoder_index to each ddp_comp in connector routes.

Reviewed-by: CK Hu <ck.hu@mediatek.com>

> 
> Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com>
> Reviewed-by: AngeloGioacchino Del Regno <
> angelogioacchino.delregno@collabora.com>
> ---
>  drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
> b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
> index febcaeef16a1..0797b3ac75d8 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
> @@ -80,12 +80,14 @@ struct mtk_ddp_comp_funcs {
>  	void (*disconnect)(struct device *dev, struct device
> *mmsys_dev, unsigned int next);
>  	void (*add)(struct device *dev, struct mtk_mutex *mutex);
>  	void (*remove)(struct device *dev, struct mtk_mutex *mutex);
> +	unsigned int (*encoder_index)(struct device *dev);
>  };
>  
>  struct mtk_ddp_comp {
>  	struct device *dev;
>  	int irq;
>  	unsigned int id;
> +	int encoder_index;
>  	const struct mtk_ddp_comp_funcs *funcs;
>  };
>  
> @@ -275,6 +277,12 @@ static inline bool
> mtk_ddp_comp_disconnect(struct mtk_ddp_comp *comp, struct dev
>  	return false;
>  }
>  
> +static inline void mtk_ddp_comp_encoder_index_set(struct
> mtk_ddp_comp *comp)
> +{
> +	if (comp->funcs && comp->funcs->encoder_index)
> +		comp->encoder_index = (int)comp->funcs-
> >encoder_index(comp->dev);
> +}
> +
>  int mtk_ddp_comp_get_id(struct device_node *node,
>  			enum mtk_ddp_comp_type comp_type);
>  unsigned int mtk_drm_find_possible_crtc_by_comp(struct drm_device
> *drm,
diff mbox series

Patch

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
index febcaeef16a1..0797b3ac75d8 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
@@ -80,12 +80,14 @@  struct mtk_ddp_comp_funcs {
 	void (*disconnect)(struct device *dev, struct device *mmsys_dev, unsigned int next);
 	void (*add)(struct device *dev, struct mtk_mutex *mutex);
 	void (*remove)(struct device *dev, struct mtk_mutex *mutex);
+	unsigned int (*encoder_index)(struct device *dev);
 };
 
 struct mtk_ddp_comp {
 	struct device *dev;
 	int irq;
 	unsigned int id;
+	int encoder_index;
 	const struct mtk_ddp_comp_funcs *funcs;
 };
 
@@ -275,6 +277,12 @@  static inline bool mtk_ddp_comp_disconnect(struct mtk_ddp_comp *comp, struct dev
 	return false;
 }
 
+static inline void mtk_ddp_comp_encoder_index_set(struct mtk_ddp_comp *comp)
+{
+	if (comp->funcs && comp->funcs->encoder_index)
+		comp->encoder_index = (int)comp->funcs->encoder_index(comp->dev);
+}
+
 int mtk_ddp_comp_get_id(struct device_node *node,
 			enum mtk_ddp_comp_type comp_type);
 unsigned int mtk_drm_find_possible_crtc_by_comp(struct drm_device *drm,