Skip to content

Commit a260f56

Browse files
Jason-JH.LinChun-Kuang Hu
authored andcommitted
drm/mediatek: Add encoder_index interface for mtk_ddp_comp_funcs
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> Reviewed-by: CK Hu <ck.hu@mediatek.com> Link: https://patchwork.kernel.org/project/dri-devel/patch/20231004024013.18956-5-jason-jh.lin@mediatek.com/ Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
1 parent ebba096 commit a260f56

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,14 @@ struct mtk_ddp_comp_funcs {
8080
void (*disconnect)(struct device *dev, struct device *mmsys_dev, unsigned int next);
8181
void (*add)(struct device *dev, struct mtk_mutex *mutex);
8282
void (*remove)(struct device *dev, struct mtk_mutex *mutex);
83+
unsigned int (*encoder_index)(struct device *dev);
8384
};
8485

8586
struct mtk_ddp_comp {
8687
struct device *dev;
8788
int irq;
8889
unsigned int id;
90+
int encoder_index;
8991
const struct mtk_ddp_comp_funcs *funcs;
9092
};
9193

@@ -275,6 +277,12 @@ static inline bool mtk_ddp_comp_disconnect(struct mtk_ddp_comp *comp, struct dev
275277
return false;
276278
}
277279

280+
static inline void mtk_ddp_comp_encoder_index_set(struct mtk_ddp_comp *comp)
281+
{
282+
if (comp->funcs && comp->funcs->encoder_index)
283+
comp->encoder_index = (int)comp->funcs->encoder_index(comp->dev);
284+
}
285+
278286
int mtk_ddp_comp_get_id(struct device_node *node,
279287
enum mtk_ddp_comp_type comp_type);
280288
unsigned int mtk_drm_find_possible_crtc_by_comp(struct drm_device *drm,

0 commit comments

Comments
 (0)