[PATCH v2 4/6] drm/fsl-dcu: Use drm_mode_config_helper_suspend/resume()

Stefan Agner stefan at agner.ch
Thu Nov 9 14:34:21 UTC 2017


On 2017-11-06 20:18, Noralf Trønnes wrote:
> Replace driver's code with the generic helpers that do the same thing.

Tested using:
echo devices > /sys/power/pm_test
echo freeze > /sys/power/state


Note, currently I do get, but even without this patches, so this is
something else:

[  930.992433] ------------[ cut here ]------------
[  930.992494] WARNING: CPU: 0 PID: 361 at
drivers/gpu/drm/drm_atomic_helper.c:1249
drm_atomic_helper_wait_for_vblanks.part.1+0x284/0x288
[  930.992502] [CRTC:28:crtc-0] vblank wait timed out


Tested-by: Stefan Agner <stefan at agner.ch>
Acked-by: Stefan Agner <stefan at agner.ch>

Will you take the patch through drm-misc?

--
Stefan



> 
> Cc: Stefan Agner <stefan at agner.ch>
> Cc: Alison Wang <alison.wang at freescale.com>
> Signed-off-by: Noralf Trønnes <noralf at tronnes.org>
> ---
>  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 24 ++++++------------------
>  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h |  1 -
>  2 files changed, 6 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> index 58e9e0601a61..1a9ee657bbac 100644
> --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> @@ -27,6 +27,7 @@
>  #include <drm/drm_crtc_helper.h>
>  #include <drm/drm_fb_cma_helper.h>
>  #include <drm/drm_gem_cma_helper.h>
> +#include <drm/drm_modeset_helper.h>
>  
>  #include "fsl_dcu_drm_crtc.h"
>  #include "fsl_dcu_drm_drv.h"
> @@ -188,26 +189,17 @@ static struct drm_driver fsl_dcu_drm_driver = {
>  static int fsl_dcu_drm_pm_suspend(struct device *dev)
>  {
>  	struct fsl_dcu_drm_device *fsl_dev = dev_get_drvdata(dev);
> +	int ret;
>  
>  	if (!fsl_dev)
>  		return 0;
>  
>  	disable_irq(fsl_dev->irq);
> -	drm_kms_helper_poll_disable(fsl_dev->drm);
>  
> -	console_lock();
> -	drm_fbdev_cma_set_suspend(fsl_dev->fbdev, 1);
> -	console_unlock();
> -
> -	fsl_dev->state = drm_atomic_helper_suspend(fsl_dev->drm);
> -	if (IS_ERR(fsl_dev->state)) {
> -		console_lock();
> -		drm_fbdev_cma_set_suspend(fsl_dev->fbdev, 0);
> -		console_unlock();
> -
> -		drm_kms_helper_poll_enable(fsl_dev->drm);
> +	ret = drm_mode_config_helper_suspend(fsl_dev->drm);
> +	if (ret) {
>  		enable_irq(fsl_dev->irq);
> -		return PTR_ERR(fsl_dev->state);
> +		return ret;
>  	}
>  
>  	clk_disable_unprepare(fsl_dev->pix_clk);
> @@ -233,13 +225,9 @@ static int fsl_dcu_drm_pm_resume(struct device *dev)
>  	if (fsl_dev->tcon)
>  		fsl_tcon_bypass_enable(fsl_dev->tcon);
>  	fsl_dcu_drm_init_planes(fsl_dev->drm);
> -	drm_atomic_helper_resume(fsl_dev->drm, fsl_dev->state);
>  
> -	console_lock();
> -	drm_fbdev_cma_set_suspend(fsl_dev->fbdev, 0);
> -	console_unlock();
> +	drm_mode_config_helper_resume(fsl_dev->drm);
>  
> -	drm_kms_helper_poll_enable(fsl_dev->drm);
>  	enable_irq(fsl_dev->irq);
>  
>  	return 0;
> diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
> b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
> index da9bfd432ca6..93bfb98012d4 100644
> --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
> +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
> @@ -196,7 +196,6 @@ struct fsl_dcu_drm_device {
>  	struct drm_encoder encoder;
>  	struct fsl_dcu_drm_connector connector;
>  	const struct fsl_dcu_soc_data *soc;
> -	struct drm_atomic_state *state;
>  };
>  
>  int fsl_dcu_drm_modeset_init(struct fsl_dcu_drm_device *fsl_dev);


More information about the dri-devel mailing list