drm/rockchip: vop2: add func rockchip_drm_crtc_standby()

In order to modify the logic, check whether the standby
function is supported by (*crtc_standby). And add the
universal function rockchip_drm_crtc_standby().

Replace vop2_standby() by rockchip_drm_crtc_standby() in
dsi2 driver.

Signed-off-by: Damon Ding <damon.ding@rock-chips.com>
Change-Id: I974780c441fe0e9a8a81f933b3070a727321b589
This commit is contained in:
Damon Ding
2022-02-24 15:32:33 +08:00
committed by Tao Huang
parent 418d20a4f1
commit a2c4bf9e96
5 changed files with 17 additions and 5 deletions

View File

@@ -448,12 +448,12 @@ static void dw_mipi_dsi2_encoder_disable(struct drm_encoder *encoder)
drm_panel_disable(dsi2->panel);
if (!(dsi2->mode_flags & MIPI_DSI_MODE_VIDEO))
vop2_standby(encoder->crtc, 1);
rockchip_drm_crtc_standby(encoder->crtc, 1);
dw_mipi_dsi2_disable(dsi2);
if (!(dsi2->mode_flags & MIPI_DSI_MODE_VIDEO))
vop2_standby(encoder->crtc, 0);
rockchip_drm_crtc_standby(encoder->crtc, 0);
if (dsi2->panel)
drm_panel_unprepare(dsi2->panel);

View File

@@ -919,6 +919,17 @@ void rockchip_drm_dma_detach_device(struct drm_device *drm_dev,
iommu_detach_device(domain, dev);
}
void rockchip_drm_crtc_standby(struct drm_crtc *crtc, bool standby)
{
struct rockchip_drm_private *priv = crtc->dev->dev_private;
int pipe = drm_crtc_index(crtc);
if (pipe < ROCKCHIP_MAX_CRTC &&
priv->crtc_funcs[pipe] &&
priv->crtc_funcs[pipe]->crtc_standby)
priv->crtc_funcs[pipe]->crtc_standby(crtc, standby);
}
int rockchip_register_crtc_funcs(struct drm_crtc *crtc,
const struct rockchip_crtc_funcs *crtc_funcs)
{

View File

@@ -369,6 +369,7 @@ struct rockchip_crtc_funcs {
void (*crtc_send_mcu_cmd)(struct drm_crtc *crtc, u32 type, u32 value);
void (*te_handler)(struct drm_crtc *crtc);
int (*wait_vact_end)(struct drm_crtc *crtc, unsigned int mstimeout);
void (*crtc_standby)(struct drm_crtc *crtc, bool standby);
};
struct rockchip_dclk_pll {
@@ -443,6 +444,7 @@ int rockchip_drm_wait_vact_end(struct drm_crtc *crtc, unsigned int mstimeout);
int rockchip_register_crtc_funcs(struct drm_crtc *crtc,
const struct rockchip_crtc_funcs *crtc_funcs);
void rockchip_unregister_crtc_funcs(struct drm_crtc *crtc);
void rockchip_drm_crtc_standby(struct drm_crtc *crtc, bool standby);
void rockchip_drm_register_sub_dev(struct rockchip_drm_sub_dev *sub_dev);
void rockchip_drm_unregister_sub_dev(struct rockchip_drm_sub_dev *sub_dev);

View File

@@ -1353,7 +1353,6 @@ static inline int interpolate(int x1, int y1, int x2, int y2, int x)
return y1 + (y2 - y1) * (x - x1) / (x2 - x1);
}
extern void vop2_standby(struct drm_crtc *crtc, bool standby);
extern const struct component_ops vop_component_ops;
extern const struct component_ops vop2_component_ops;
#endif /* _ROCKCHIP_DRM_VOP_H */

View File

@@ -920,7 +920,7 @@ static uint64_t vop2_soc_id_fixup(uint64_t soc_id)
}
}
void vop2_standby(struct drm_crtc *crtc, bool standby)
static void vop2_crtc_standby(struct drm_crtc *crtc, bool standby)
{
struct vop2_video_port *vp = to_vop2_video_port(crtc);
struct vop2 *vop2 = vp->vop2;
@@ -932,7 +932,6 @@ void vop2_standby(struct drm_crtc *crtc, bool standby)
VOP_MODULE_SET(vop2, vp, standby, 0);
}
}
EXPORT_SYMBOL(vop2_standby);
static inline const struct vop2_win_regs *vop2_get_win_regs(struct vop2_win *win,
const struct vop_reg *reg)
@@ -5493,6 +5492,7 @@ static const struct rockchip_crtc_funcs private_crtc_funcs = {
.crtc_close = vop2_crtc_close,
.te_handler = vop2_crtc_te_handler,
.wait_vact_end = vop2_crtc_wait_vact_end,
.crtc_standby = vop2_crtc_standby,
};
static bool vop2_crtc_mode_fixup(struct drm_crtc *crtc,