From afcdeee1b5f37ab7377a516de9bea307c01baee7 Mon Sep 17 00:00:00 2001 From: Sandy Huang Date: Mon, 16 Apr 2018 14:44:30 +0800 Subject: [PATCH] drm/rockchip: update rockchip_drm_platform_shutdown The reason to implement shutdown is for the fake shutdown on the box product. but after implement this function, panel will still display overlay plane for about two second when power off. so we directly close crtc instead of rockchip_drm_sys_suspend() when shutdown. Change-Id: I60ed3e541e022ad828fd535828fe264aabd40ecb Signed-off-by: Sandy Huang --- drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c index 40eb85456cb2..4407a91a8572 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c @@ -1264,7 +1264,6 @@ static void rockchip_drm_set_property_default(struct drm_device *drm) state = drm_atomic_helper_duplicate_state(drm, conf->acquire_ctx); if (!state) { DRM_ERROR("failed to alloc atomic state\n"); - ret = -ENOMEM; goto err_unlock; } state->acquire_ctx = conf->acquire_ctx; @@ -1680,6 +1679,7 @@ static struct drm_driver rockchip_drm_driver = { .minor = DRIVER_MINOR, }; +#ifdef CONFIG_PM_SLEEP static void rockchip_drm_fb_suspend(struct drm_device *drm) { struct rockchip_drm_private *priv = drm->dev_private; @@ -1723,7 +1723,6 @@ static int rockchip_drm_sys_suspend(struct device *dev) return 0; } -#ifdef CONFIG_PM_SLEEP static int rockchip_drm_sys_resume(struct device *dev) { struct drm_device *drm = dev_get_drvdata(dev); @@ -1866,8 +1865,24 @@ static int rockchip_drm_platform_remove(struct platform_device *pdev) static void rockchip_drm_platform_shutdown(struct platform_device *pdev) { struct device *dev = &pdev->dev; + struct drm_crtc *crtc; + struct drm_device *drm; + struct rockchip_drm_private *priv; - rockchip_drm_sys_suspend(dev); + drm = dev_get_drvdata(dev); + if (!drm) { + DRM_ERROR("%s: Failed to get drm device!\n", __func__); + return; + } + + priv = drm->dev_private; + drm_for_each_crtc(crtc, drm) { + int pipe = drm_crtc_index(crtc); + + if (priv->crtc_funcs[pipe] && + priv->crtc_funcs[pipe]->crtc_close) + priv->crtc_funcs[pipe]->crtc_close(crtc); + } } static const struct of_device_id rockchip_drm_dt_ids[] = {