diff options
author | Shawn Guo <shawn.guo@linaro.org> | 2017-01-09 06:25:42 -0500 |
---|---|---|
committer | Sean Paul <seanpaul@chromium.org> | 2017-01-18 09:21:06 -0500 |
commit | ffec8925836caf1e91dce9c37c322c363eef58b3 (patch) | |
tree | 4a435bfe209fcf59b2a255f668d3fa006a373178 /drivers/gpu | |
parent | b8bf6836bf00419e9b714ea70fbd8315b118c3bf (diff) |
drm: mediatek: use crtc helper drm_crtc_from_index()
Use drm_crtc_from_index() to find drm_crtc for given index, so that we
do not need to maintain a pointer array in struct mtk_drm_private.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Cc: CK Hu <ck.hu@mediatek.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/1483961145-18453-4-git-send-email-shawnguo@kernel.org
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 9 | ||||
-rw-r--r-- | drivers/gpu/drm/mediatek/mtk_drm_drv.h | 1 |
2 files changed, 4 insertions, 6 deletions
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c index 01a21dd835b5..a73de1e669c2 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_crtc.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_crtc.c | |||
@@ -170,8 +170,8 @@ static void mtk_drm_crtc_mode_set_nofb(struct drm_crtc *crtc) | |||
170 | 170 | ||
171 | int mtk_drm_crtc_enable_vblank(struct drm_device *drm, unsigned int pipe) | 171 | int mtk_drm_crtc_enable_vblank(struct drm_device *drm, unsigned int pipe) |
172 | { | 172 | { |
173 | struct mtk_drm_private *priv = drm->dev_private; | 173 | struct drm_crtc *crtc = drm_crtc_from_index(drm, pipe); |
174 | struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(priv->crtc[pipe]); | 174 | struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc); |
175 | struct mtk_ddp_comp *ovl = mtk_crtc->ddp_comp[0]; | 175 | struct mtk_ddp_comp *ovl = mtk_crtc->ddp_comp[0]; |
176 | 176 | ||
177 | mtk_ddp_comp_enable_vblank(ovl, &mtk_crtc->base); | 177 | mtk_ddp_comp_enable_vblank(ovl, &mtk_crtc->base); |
@@ -181,8 +181,8 @@ int mtk_drm_crtc_enable_vblank(struct drm_device *drm, unsigned int pipe) | |||
181 | 181 | ||
182 | void mtk_drm_crtc_disable_vblank(struct drm_device *drm, unsigned int pipe) | 182 | void mtk_drm_crtc_disable_vblank(struct drm_device *drm, unsigned int pipe) |
183 | { | 183 | { |
184 | struct mtk_drm_private *priv = drm->dev_private; | 184 | struct drm_crtc *crtc = drm_crtc_from_index(drm, pipe); |
185 | struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(priv->crtc[pipe]); | 185 | struct mtk_drm_crtc *mtk_crtc = to_mtk_crtc(crtc); |
186 | struct mtk_ddp_comp *ovl = mtk_crtc->ddp_comp[0]; | 186 | struct mtk_ddp_comp *ovl = mtk_crtc->ddp_comp[0]; |
187 | 187 | ||
188 | mtk_ddp_comp_disable_vblank(ovl); | 188 | mtk_ddp_comp_disable_vblank(ovl); |
@@ -588,7 +588,6 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev, | |||
588 | goto unprepare; | 588 | goto unprepare; |
589 | drm_mode_crtc_set_gamma_size(&mtk_crtc->base, MTK_LUT_SIZE); | 589 | drm_mode_crtc_set_gamma_size(&mtk_crtc->base, MTK_LUT_SIZE); |
590 | drm_crtc_enable_color_mgmt(&mtk_crtc->base, 0, false, MTK_LUT_SIZE); | 590 | drm_crtc_enable_color_mgmt(&mtk_crtc->base, 0, false, MTK_LUT_SIZE); |
591 | priv->crtc[pipe] = &mtk_crtc->base; | ||
592 | priv->num_pipes++; | 591 | priv->num_pipes++; |
593 | 592 | ||
594 | return 0; | 593 | return 0; |
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.h b/drivers/gpu/drm/mediatek/mtk_drm_drv.h index aa9389446785..df322a7a5fcb 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.h +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.h | |||
@@ -32,7 +32,6 @@ struct mtk_drm_private { | |||
32 | struct drm_device *drm; | 32 | struct drm_device *drm; |
33 | struct device *dma_dev; | 33 | struct device *dma_dev; |
34 | 34 | ||
35 | struct drm_crtc *crtc[MAX_CRTC]; | ||
36 | unsigned int num_pipes; | 35 | unsigned int num_pipes; |
37 | 36 | ||
38 | struct device_node *mutex_node; | 37 | struct device_node *mutex_node; |