Commit cddddc06 authored by Michael Riesch's avatar Michael Riesch Committed by Heiko Stuebner

drm/rockchip: vop2: use symmetric function pair vop2_{create,destroy}_crtcs

Let the function name vop2_create_crtcs reflect that the function creates
multiple CRTCS. Also, use a symmetric function pair to create and destroy
the CRTCs and the corresponding planes.
Signed-off-by: default avatarMichael Riesch <michael.riesch@wolfvision.net>
Reviewed-by: default avatarSascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: default avatarHeiko Stuebner <heiko@sntech.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20230124054706.3921383-5-michael.riesch@wolfvision.net
parent 03db8f25
......@@ -2245,7 +2245,7 @@ static struct vop2_video_port *find_vp_without_primary(struct vop2 *vop2)
#define NR_LAYERS 6
static int vop2_create_crtc(struct vop2 *vop2)
static int vop2_create_crtcs(struct vop2 *vop2)
{
const struct vop2_data *vop2_data = vop2->data;
struct drm_device *drm = vop2->drm;
......@@ -2371,15 +2371,25 @@ static int vop2_create_crtc(struct vop2 *vop2)
return 0;
}
static void vop2_destroy_crtc(struct drm_crtc *crtc)
static void vop2_destroy_crtcs(struct vop2 *vop2)
{
of_node_put(crtc->port);
struct drm_device *drm = vop2->drm;
struct list_head *crtc_list = &drm->mode_config.crtc_list;
struct list_head *plane_list = &drm->mode_config.plane_list;
struct drm_crtc *crtc, *tmpc;
struct drm_plane *plane, *tmpp;
list_for_each_entry_safe(plane, tmpp, plane_list, head)
drm_plane_cleanup(plane);
/*
* Destroy CRTC after vop2_plane_destroy() since vop2_disable_plane()
* references the CRTC.
*/
list_for_each_entry_safe(crtc, tmpc, crtc_list, head) {
of_node_put(crtc->port);
drm_crtc_cleanup(crtc);
}
}
static struct reg_field vop2_cluster_regs[VOP2_WIN_MAX_REG] = {
......@@ -2683,7 +2693,7 @@ static int vop2_bind(struct device *dev, struct device *master, void *data)
if (ret)
return ret;
ret = vop2_create_crtc(vop2);
ret = vop2_create_crtcs(vop2);
if (ret)
return ret;
......@@ -2697,19 +2707,10 @@ static int vop2_bind(struct device *dev, struct device *master, void *data)
static void vop2_unbind(struct device *dev, struct device *master, void *data)
{
struct vop2 *vop2 = dev_get_drvdata(dev);
struct drm_device *drm = vop2->drm;
struct list_head *plane_list = &drm->mode_config.plane_list;
struct list_head *crtc_list = &drm->mode_config.crtc_list;
struct drm_crtc *crtc, *tmpc;
struct drm_plane *plane, *tmpp;
pm_runtime_disable(dev);
list_for_each_entry_safe(plane, tmpp, plane_list, head)
drm_plane_cleanup(plane);
list_for_each_entry_safe(crtc, tmpc, crtc_list, head)
vop2_destroy_crtc(crtc);
vop2_destroy_crtcs(vop2);
}
const struct component_ops vop2_component_ops = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment