linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] gpu/drm/exynos: Convert drm_atomic_helper_suspend/resume()
@ 2018-08-02 13:21 ` Souptick Joarder
  2018-08-02 13:38   ` Marek Szyprowski
  0 siblings, 1 reply; 5+ messages in thread
From: Souptick Joarder @ 2018-08-02 13:21 UTC (permalink / raw)
  To: inki.dae, jy0922.shim, sw0312.kim, kyungmin.park, airlied, kgene,
	krzk, m.szyprowski, ajitn.linux
  Cc: dri-devel, linux-arm-kernel, linux-samsung-soc, linux-kernel

convert drm_atomic_helper_suspend/resume() to use
drm_mode_config_helper_suspend/resume().

exynos_drm_fbdev_suspend/resume can be removed
as drm_mode_config_helper_suspend/resume has
implement the same in generic way.

Remove suspend_state from exynos_drm_private
struct as it is no more useful.

Signed-off-by: Ajit Negi <ajitn.linux@gmail.com>
Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
v2: Address Inki Dae's comment. Remove ret variable
    from both suspend/resume function.

v3: Tested by Marek. Updated the change log.

 drivers/gpu/drm/exynos/exynos_drm_drv.c   | 26 ++------------------------
 drivers/gpu/drm/exynos/exynos_drm_drv.h   |  1 -
 drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 17 -----------------
 drivers/gpu/drm/exynos/exynos_drm_fbdev.h | 10 ----------
 4 files changed, 2 insertions(+), 52 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index b599f74..d86dd81 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -149,37 +149,15 @@ static void exynos_drm_postclose(struct drm_device *dev, struct drm_file *file)
 static int exynos_drm_suspend(struct device *dev)
 {
 	struct drm_device *drm_dev = dev_get_drvdata(dev);
-	struct exynos_drm_private *private;
-
-	if (!drm_dev)
-		return 0;
-
-	private = drm_dev->dev_private;
-
-	drm_kms_helper_poll_disable(drm_dev);
-	exynos_drm_fbdev_suspend(drm_dev);
-	private->suspend_state = drm_atomic_helper_suspend(drm_dev);
-	if (IS_ERR(private->suspend_state)) {
-		exynos_drm_fbdev_resume(drm_dev);
-		drm_kms_helper_poll_enable(drm_dev);
-		return PTR_ERR(private->suspend_state);
-	}
 
-	return 0;
+	return  drm_mode_config_helper_suspend(drm_dev);
 }
 
 static void exynos_drm_resume(struct device *dev)
 {
 	struct drm_device *drm_dev = dev_get_drvdata(dev);
-	struct exynos_drm_private *private;
-
-	if (!drm_dev)
-		return;
 
-	private = drm_dev->dev_private;
-	drm_atomic_helper_resume(drm_dev, private->suspend_state);
-	exynos_drm_fbdev_resume(drm_dev);
-	drm_kms_helper_poll_enable(drm_dev);
+	return drm_mode_config_helper_resume(drm_dev);
 }
 
 static const struct dev_pm_ops exynos_drm_pm_ops = {
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index c737c4b..7349e7c 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -195,7 +195,6 @@ struct drm_exynos_file_private {
  */
 struct exynos_drm_private {
 	struct drm_fb_helper *fb_helper;
-	struct drm_atomic_state *suspend_state;
 
 	struct device *g2d_dev;
 	struct device *dma_dev;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
index 132dd52..918dd2c 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
@@ -270,20 +270,3 @@ void exynos_drm_fbdev_fini(struct drm_device *dev)
 	private->fb_helper = NULL;
 }
 
-void exynos_drm_fbdev_suspend(struct drm_device *dev)
-{
-	struct exynos_drm_private *private = dev->dev_private;
-
-	console_lock();
-	drm_fb_helper_set_suspend(private->fb_helper, 1);
-	console_unlock();
-}
-
-void exynos_drm_fbdev_resume(struct drm_device *dev)
-{
-	struct exynos_drm_private *private = dev->dev_private;
-
-	console_lock();
-	drm_fb_helper_set_suspend(private->fb_helper, 0);
-	console_unlock();
-}
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.h b/drivers/gpu/drm/exynos/exynos_drm_fbdev.h
index b338472..6840b6a 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.h
@@ -19,8 +19,6 @@
 
 int exynos_drm_fbdev_init(struct drm_device *dev);
 void exynos_drm_fbdev_fini(struct drm_device *dev);
-void exynos_drm_fbdev_suspend(struct drm_device *drm);
-void exynos_drm_fbdev_resume(struct drm_device *drm);
 
 #else
 
@@ -39,14 +37,6 @@ static inline void exynos_drm_fbdev_restore_mode(struct drm_device *dev)
 
 #define exynos_drm_output_poll_changed (NULL)
 
-static inline void exynos_drm_fbdev_suspend(struct drm_device *drm)
-{
-}
-
-static inline void exynos_drm_fbdev_resume(struct drm_device *drm)
-{
-}
-
 #endif
 
 #endif
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v3] gpu/drm/exynos: Convert drm_atomic_helper_suspend/resume()
  2018-08-02 13:21 ` [PATCH v3] gpu/drm/exynos: Convert drm_atomic_helper_suspend/resume() Souptick Joarder
@ 2018-08-02 13:38   ` Marek Szyprowski
  2018-08-02 15:51     ` Souptick Joarder
  0 siblings, 1 reply; 5+ messages in thread
From: Marek Szyprowski @ 2018-08-02 13:38 UTC (permalink / raw)
  To: Souptick Joarder, inki.dae, jy0922.shim, sw0312.kim,
	kyungmin.park, airlied, kgene, krzk, ajitn.linux
  Cc: dri-devel, linux-arm-kernel, linux-samsung-soc, linux-kernel

Hi,

On 2018-08-02 15:21, Souptick Joarder wrote:
> convert drm_atomic_helper_suspend/resume() to use
> drm_mode_config_helper_suspend/resume().
>
> exynos_drm_fbdev_suspend/resume can be removed
> as drm_mode_config_helper_suspend/resume has
> implement the same in generic way.
>
> Remove suspend_state from exynos_drm_private
> struct as it is no more useful.
>
> Signed-off-by: Ajit Negi <ajitn.linux@gmail.com>
> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
> Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
> v2: Address Inki Dae's comment. Remove ret variable
>      from both suspend/resume function.
>
> v3: Tested by Marek. Updated the change log.
>
>   drivers/gpu/drm/exynos/exynos_drm_drv.c   | 26 ++------------------------
>   drivers/gpu/drm/exynos/exynos_drm_drv.h   |  1 -
>   drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 17 -----------------
>   drivers/gpu/drm/exynos/exynos_drm_fbdev.h | 10 ----------
>   4 files changed, 2 insertions(+), 52 deletions(-)
>
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> index b599f74..d86dd81 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> @@ -149,37 +149,15 @@ static void exynos_drm_postclose(struct drm_device *dev, struct drm_file *file)
>   static int exynos_drm_suspend(struct device *dev)
>   {
>   	struct drm_device *drm_dev = dev_get_drvdata(dev);
> -	struct exynos_drm_private *private;
> -
> -	if (!drm_dev)
> -		return 0;
> -
> -	private = drm_dev->dev_private;
> -
> -	drm_kms_helper_poll_disable(drm_dev);
> -	exynos_drm_fbdev_suspend(drm_dev);
> -	private->suspend_state = drm_atomic_helper_suspend(drm_dev);
> -	if (IS_ERR(private->suspend_state)) {
> -		exynos_drm_fbdev_resume(drm_dev);
> -		drm_kms_helper_poll_enable(drm_dev);
> -		return PTR_ERR(private->suspend_state);
> -	}
>   
> -	return 0;
> +	return  drm_mode_config_helper_suspend(drm_dev);
>   }
>   
>   static void exynos_drm_resume(struct device *dev)
>   {
>   	struct drm_device *drm_dev = dev_get_drvdata(dev);
> -	struct exynos_drm_private *private;
> -
> -	if (!drm_dev)
> -		return;
>   
> -	private = drm_dev->dev_private;
> -	drm_atomic_helper_resume(drm_dev, private->suspend_state);
> -	exynos_drm_fbdev_resume(drm_dev);
> -	drm_kms_helper_poll_enable(drm_dev);
> +	return drm_mode_config_helper_resume(drm_dev);

exynos_drm_resume() now returns 'void', so to be strict with
c standard, the return statement should not be used here.

>   }
>   
>   static const struct dev_pm_ops exynos_drm_pm_ops = {
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h
> index c737c4b..7349e7c 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
> +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
> @@ -195,7 +195,6 @@ struct drm_exynos_file_private {
>    */
>   struct exynos_drm_private {
>   	struct drm_fb_helper *fb_helper;
> -	struct drm_atomic_state *suspend_state;
>   
>   	struct device *g2d_dev;
>   	struct device *dma_dev;
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
> index 132dd52..918dd2c 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
> @@ -270,20 +270,3 @@ void exynos_drm_fbdev_fini(struct drm_device *dev)
>   	private->fb_helper = NULL;
>   }
>   
> -void exynos_drm_fbdev_suspend(struct drm_device *dev)
> -{
> -	struct exynos_drm_private *private = dev->dev_private;
> -
> -	console_lock();
> -	drm_fb_helper_set_suspend(private->fb_helper, 1);
> -	console_unlock();
> -}
> -
> -void exynos_drm_fbdev_resume(struct drm_device *dev)
> -{
> -	struct exynos_drm_private *private = dev->dev_private;
> -
> -	console_lock();
> -	drm_fb_helper_set_suspend(private->fb_helper, 0);
> -	console_unlock();
> -}
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.h b/drivers/gpu/drm/exynos/exynos_drm_fbdev.h
> index b338472..6840b6a 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.h
> +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.h
> @@ -19,8 +19,6 @@
>   
>   int exynos_drm_fbdev_init(struct drm_device *dev);
>   void exynos_drm_fbdev_fini(struct drm_device *dev);
> -void exynos_drm_fbdev_suspend(struct drm_device *drm);
> -void exynos_drm_fbdev_resume(struct drm_device *drm);
>   
>   #else
>   
> @@ -39,14 +37,6 @@ static inline void exynos_drm_fbdev_restore_mode(struct drm_device *dev)
>   
>   #define exynos_drm_output_poll_changed (NULL)
>   
> -static inline void exynos_drm_fbdev_suspend(struct drm_device *drm)
> -{
> -}
> -
> -static inline void exynos_drm_fbdev_resume(struct drm_device *drm)
> -{
> -}
> -
>   #endif
>   
>   #endif

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v3] gpu/drm/exynos: Convert drm_atomic_helper_suspend/resume()
  2018-08-02 13:38   ` Marek Szyprowski
@ 2018-08-02 15:51     ` Souptick Joarder
  2018-08-03  7:00       ` Marek Szyprowski
  0 siblings, 1 reply; 5+ messages in thread
From: Souptick Joarder @ 2018-08-02 15:51 UTC (permalink / raw)
  To: Marek Szyprowski
  Cc: Inki Dae, jy0922.shim, sw0312.kim, Kyungmin Park, airlied, kgene,
	krzk, Ajit Linux, dri-devel, linux-arm-kernel, linux-samsung-soc,
	linux-kernel

On Thu, Aug 2, 2018 at 7:08 PM, Marek Szyprowski
<m.szyprowski@samsung.com> wrote:
> Hi,
>
> On 2018-08-02 15:21, Souptick Joarder wrote:
>> convert drm_atomic_helper_suspend/resume() to use
>> drm_mode_config_helper_suspend/resume().
>>
>> exynos_drm_fbdev_suspend/resume can be removed
>> as drm_mode_config_helper_suspend/resume has
>> implement the same in generic way.
>>
>> Remove suspend_state from exynos_drm_private
>> struct as it is no more useful.
>>
>> Signed-off-by: Ajit Negi <ajitn.linux@gmail.com>
>> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
>> Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
>> ---
>> v2: Address Inki Dae's comment. Remove ret variable
>>      from both suspend/resume function.
>>
>> v3: Tested by Marek. Updated the change log.
>>
>>   drivers/gpu/drm/exynos/exynos_drm_drv.c   | 26 ++------------------------
>>   drivers/gpu/drm/exynos/exynos_drm_drv.h   |  1 -
>>   drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 17 -----------------
>>   drivers/gpu/drm/exynos/exynos_drm_fbdev.h | 10 ----------
>>   4 files changed, 2 insertions(+), 52 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
>> index b599f74..d86dd81 100644
>> --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
>> +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
>> @@ -149,37 +149,15 @@ static void exynos_drm_postclose(struct drm_device *dev, struct drm_file *file)
>>   static int exynos_drm_suspend(struct device *dev)
>>   {
>>       struct drm_device *drm_dev = dev_get_drvdata(dev);
>> -     struct exynos_drm_private *private;
>> -
>> -     if (!drm_dev)
>> -             return 0;
>> -
>> -     private = drm_dev->dev_private;
>> -
>> -     drm_kms_helper_poll_disable(drm_dev);
>> -     exynos_drm_fbdev_suspend(drm_dev);
>> -     private->suspend_state = drm_atomic_helper_suspend(drm_dev);
>> -     if (IS_ERR(private->suspend_state)) {
>> -             exynos_drm_fbdev_resume(drm_dev);
>> -             drm_kms_helper_poll_enable(drm_dev);
>> -             return PTR_ERR(private->suspend_state);
>> -     }
>>
>> -     return 0;
>> +     return  drm_mode_config_helper_suspend(drm_dev);
>>   }
>>
>>   static void exynos_drm_resume(struct device *dev)
>>   {
>>       struct drm_device *drm_dev = dev_get_drvdata(dev);
>> -     struct exynos_drm_private *private;
>> -
>> -     if (!drm_dev)
>> -             return;
>>
>> -     private = drm_dev->dev_private;
>> -     drm_atomic_helper_resume(drm_dev, private->suspend_state);
>> -     exynos_drm_fbdev_resume(drm_dev);
>> -     drm_kms_helper_poll_enable(drm_dev);
>> +     return drm_mode_config_helper_resume(drm_dev);
>
> exynos_drm_resume() now returns 'void', so to be strict with
> c standard, the return statement should not be used here.

But in struct dev_pm_ops, it is still defined as

                int (*resume)(struct device *dev);

I think, we need to correct the return type of
exynos_drm_resume() to int.

Although I posted v4.



>
>>   }
>>
>>   static const struct dev_pm_ops exynos_drm_pm_ops = {
>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h
>> index c737c4b..7349e7c 100644
>> --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
>> +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
>> @@ -195,7 +195,6 @@ struct drm_exynos_file_private {
>>    */
>>   struct exynos_drm_private {
>>       struct drm_fb_helper *fb_helper;
>> -     struct drm_atomic_state *suspend_state;
>>
>>       struct device *g2d_dev;
>>       struct device *dma_dev;
>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
>> index 132dd52..918dd2c 100644
>> --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
>> +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
>> @@ -270,20 +270,3 @@ void exynos_drm_fbdev_fini(struct drm_device *dev)
>>       private->fb_helper = NULL;
>>   }
>>
>> -void exynos_drm_fbdev_suspend(struct drm_device *dev)
>> -{
>> -     struct exynos_drm_private *private = dev->dev_private;
>> -
>> -     console_lock();
>> -     drm_fb_helper_set_suspend(private->fb_helper, 1);
>> -     console_unlock();
>> -}
>> -
>> -void exynos_drm_fbdev_resume(struct drm_device *dev)
>> -{
>> -     struct exynos_drm_private *private = dev->dev_private;
>> -
>> -     console_lock();
>> -     drm_fb_helper_set_suspend(private->fb_helper, 0);
>> -     console_unlock();
>> -}
>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.h b/drivers/gpu/drm/exynos/exynos_drm_fbdev.h
>> index b338472..6840b6a 100644
>> --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.h
>> +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.h
>> @@ -19,8 +19,6 @@
>>
>>   int exynos_drm_fbdev_init(struct drm_device *dev);
>>   void exynos_drm_fbdev_fini(struct drm_device *dev);
>> -void exynos_drm_fbdev_suspend(struct drm_device *drm);
>> -void exynos_drm_fbdev_resume(struct drm_device *drm);
>>
>>   #else
>>
>> @@ -39,14 +37,6 @@ static inline void exynos_drm_fbdev_restore_mode(struct drm_device *dev)
>>
>>   #define exynos_drm_output_poll_changed (NULL)
>>
>> -static inline void exynos_drm_fbdev_suspend(struct drm_device *drm)
>> -{
>> -}
>> -
>> -static inline void exynos_drm_fbdev_resume(struct drm_device *drm)
>> -{
>> -}
>> -
>>   #endif
>>
>>   #endif
>
> Best regards
> --
> Marek Szyprowski, PhD
> Samsung R&D Institute Poland
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v3] gpu/drm/exynos: Convert drm_atomic_helper_suspend/resume()
  2018-08-02 15:51     ` Souptick Joarder
@ 2018-08-03  7:00       ` Marek Szyprowski
  2018-08-04 14:32         ` Souptick Joarder
  0 siblings, 1 reply; 5+ messages in thread
From: Marek Szyprowski @ 2018-08-03  7:00 UTC (permalink / raw)
  To: Souptick Joarder
  Cc: Inki Dae, jy0922.shim, sw0312.kim, Kyungmin Park, airlied, kgene,
	krzk, Ajit Linux, dri-devel, linux-arm-kernel, linux-samsung-soc,
	linux-kernel

Hi,

On 2018-08-02 17:51, Souptick Joarder wrote:
> On Thu, Aug 2, 2018 at 7:08 PM, Marek Szyprowski
> <m.szyprowski@samsung.com> wrote:
>> On 2018-08-02 15:21, Souptick Joarder wrote:
>>> convert drm_atomic_helper_suspend/resume() to use
>>> drm_mode_config_helper_suspend/resume().
>>>
>>> exynos_drm_fbdev_suspend/resume can be removed
>>> as drm_mode_config_helper_suspend/resume has
>>> implement the same in generic way.
>>>
>>> Remove suspend_state from exynos_drm_private
>>> struct as it is no more useful.
>>>
>>> Signed-off-by: Ajit Negi <ajitn.linux@gmail.com>
>>> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
>>> Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
>>> ---
>>> v2: Address Inki Dae's comment. Remove ret variable
>>>       from both suspend/resume function.
>>>
>>> v3: Tested by Marek. Updated the change log.
>>>
>>>    drivers/gpu/drm/exynos/exynos_drm_drv.c   | 26 ++------------------------
>>>    drivers/gpu/drm/exynos/exynos_drm_drv.h   |  1 -
>>>    drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 17 -----------------
>>>    drivers/gpu/drm/exynos/exynos_drm_fbdev.h | 10 ----------
>>>    4 files changed, 2 insertions(+), 52 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
>>> index b599f74..d86dd81 100644
>>> --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
>>> +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
>>> @@ -149,37 +149,15 @@ static void exynos_drm_postclose(struct drm_device *dev, struct drm_file *file)
>>>    static int exynos_drm_suspend(struct device *dev)
>>>    {
>>>        struct drm_device *drm_dev = dev_get_drvdata(dev);
>>> -     struct exynos_drm_private *private;
>>> -
>>> -     if (!drm_dev)
>>> -             return 0;
>>> -
>>> -     private = drm_dev->dev_private;
>>> -
>>> -     drm_kms_helper_poll_disable(drm_dev);
>>> -     exynos_drm_fbdev_suspend(drm_dev);
>>> -     private->suspend_state = drm_atomic_helper_suspend(drm_dev);
>>> -     if (IS_ERR(private->suspend_state)) {
>>> -             exynos_drm_fbdev_resume(drm_dev);
>>> -             drm_kms_helper_poll_enable(drm_dev);
>>> -             return PTR_ERR(private->suspend_state);
>>> -     }
>>>
>>> -     return 0;
>>> +     return  drm_mode_config_helper_suspend(drm_dev);
>>>    }
>>>
>>>    static void exynos_drm_resume(struct device *dev)
>>>    {
>>>        struct drm_device *drm_dev = dev_get_drvdata(dev);
>>> -     struct exynos_drm_private *private;
>>> -
>>> -     if (!drm_dev)
>>> -             return;
>>>
>>> -     private = drm_dev->dev_private;
>>> -     drm_atomic_helper_resume(drm_dev, private->suspend_state);
>>> -     exynos_drm_fbdev_resume(drm_dev);
>>> -     drm_kms_helper_poll_enable(drm_dev);
>>> +     return drm_mode_config_helper_resume(drm_dev);
>> exynos_drm_resume() now returns 'void', so to be strict with
>> c standard, the return statement should not be used here.
> But in struct dev_pm_ops, it is still defined as
>
>                  int (*resume)(struct device *dev);
>
> I think, we need to correct the return type of
> exynos_drm_resume() to int.

Nope. After commit dc684af6fc8d ("drm/exynos: Suspend/resume display
pipeline as early/late as possible") exynos_drm_resume() is assigned
to .complete callback, which use 'void' return type, so for now no
more changes are needed.

> Although I posted v4.
>
>
>>>    }
>>>
>>>    static const struct dev_pm_ops exynos_drm_pm_ops = {
>>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h
>>> index c737c4b..7349e7c 100644
>>> --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
>>> +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
>>> @@ -195,7 +195,6 @@ struct drm_exynos_file_private {
>>>     */
>>>    struct exynos_drm_private {
>>>        struct drm_fb_helper *fb_helper;
>>> -     struct drm_atomic_state *suspend_state;
>>>
>>>        struct device *g2d_dev;
>>>        struct device *dma_dev;
>>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
>>> index 132dd52..918dd2c 100644
>>> --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
>>> +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
>>> @@ -270,20 +270,3 @@ void exynos_drm_fbdev_fini(struct drm_device *dev)
>>>        private->fb_helper = NULL;
>>>    }
>>>
>>> -void exynos_drm_fbdev_suspend(struct drm_device *dev)
>>> -{
>>> -     struct exynos_drm_private *private = dev->dev_private;
>>> -
>>> -     console_lock();
>>> -     drm_fb_helper_set_suspend(private->fb_helper, 1);
>>> -     console_unlock();
>>> -}
>>> -
>>> -void exynos_drm_fbdev_resume(struct drm_device *dev)
>>> -{
>>> -     struct exynos_drm_private *private = dev->dev_private;
>>> -
>>> -     console_lock();
>>> -     drm_fb_helper_set_suspend(private->fb_helper, 0);
>>> -     console_unlock();
>>> -}
>>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.h b/drivers/gpu/drm/exynos/exynos_drm_fbdev.h
>>> index b338472..6840b6a 100644
>>> --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.h
>>> +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.h
>>> @@ -19,8 +19,6 @@
>>>
>>>    int exynos_drm_fbdev_init(struct drm_device *dev);
>>>    void exynos_drm_fbdev_fini(struct drm_device *dev);
>>> -void exynos_drm_fbdev_suspend(struct drm_device *drm);
>>> -void exynos_drm_fbdev_resume(struct drm_device *drm);
>>>
>>>    #else
>>>
>>> @@ -39,14 +37,6 @@ static inline void exynos_drm_fbdev_restore_mode(struct drm_device *dev)
>>>
>>>    #define exynos_drm_output_poll_changed (NULL)
>>>
>>> -static inline void exynos_drm_fbdev_suspend(struct drm_device *drm)
>>> -{
>>> -}
>>> -
>>> -static inline void exynos_drm_fbdev_resume(struct drm_device *drm)
>>> -{
>>> -}
>>> -
>>>    #endif
>>>
>>>    #endif
>> Best regards
>> --
>> Marek Szyprowski, PhD
>> Samsung R&D Institute Poland
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v3] gpu/drm/exynos: Convert drm_atomic_helper_suspend/resume()
  2018-08-03  7:00       ` Marek Szyprowski
@ 2018-08-04 14:32         ` Souptick Joarder
  0 siblings, 0 replies; 5+ messages in thread
From: Souptick Joarder @ 2018-08-04 14:32 UTC (permalink / raw)
  To: Marek Szyprowski
  Cc: Inki Dae, jy0922.shim, sw0312.kim, Kyungmin Park, airlied, kgene,
	krzk, Ajit Linux, dri-devel, linux-arm-kernel, linux-samsung-soc,
	linux-kernel

On Fri, Aug 3, 2018 at 12:30 PM, Marek Szyprowski
<m.szyprowski@samsung.com> wrote:
> Hi,
>
> On 2018-08-02 17:51, Souptick Joarder wrote:
>> On Thu, Aug 2, 2018 at 7:08 PM, Marek Szyprowski
>> <m.szyprowski@samsung.com> wrote:
>>> On 2018-08-02 15:21, Souptick Joarder wrote:
>>>> convert drm_atomic_helper_suspend/resume() to use
>>>> drm_mode_config_helper_suspend/resume().
>>>>
>>>> exynos_drm_fbdev_suspend/resume can be removed
>>>> as drm_mode_config_helper_suspend/resume has
>>>> implement the same in generic way.
>>>>
>>>> Remove suspend_state from exynos_drm_private
>>>> struct as it is no more useful.
>>>>
>>>> Signed-off-by: Ajit Negi <ajitn.linux@gmail.com>
>>>> Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
>>>> Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
>>>> ---
>>>> v2: Address Inki Dae's comment. Remove ret variable
>>>>       from both suspend/resume function.
>>>>
>>>> v3: Tested by Marek. Updated the change log.
>>>>
>>>>    drivers/gpu/drm/exynos/exynos_drm_drv.c   | 26 ++------------------------
>>>>    drivers/gpu/drm/exynos/exynos_drm_drv.h   |  1 -
>>>>    drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 17 -----------------
>>>>    drivers/gpu/drm/exynos/exynos_drm_fbdev.h | 10 ----------
>>>>    4 files changed, 2 insertions(+), 52 deletions(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
>>>> index b599f74..d86dd81 100644
>>>> --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
>>>> +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
>>>> @@ -149,37 +149,15 @@ static void exynos_drm_postclose(struct drm_device *dev, struct drm_file *file)
>>>>    static int exynos_drm_suspend(struct device *dev)
>>>>    {
>>>>        struct drm_device *drm_dev = dev_get_drvdata(dev);
>>>> -     struct exynos_drm_private *private;
>>>> -
>>>> -     if (!drm_dev)
>>>> -             return 0;
>>>> -
>>>> -     private = drm_dev->dev_private;
>>>> -
>>>> -     drm_kms_helper_poll_disable(drm_dev);
>>>> -     exynos_drm_fbdev_suspend(drm_dev);
>>>> -     private->suspend_state = drm_atomic_helper_suspend(drm_dev);
>>>> -     if (IS_ERR(private->suspend_state)) {
>>>> -             exynos_drm_fbdev_resume(drm_dev);
>>>> -             drm_kms_helper_poll_enable(drm_dev);
>>>> -             return PTR_ERR(private->suspend_state);
>>>> -     }
>>>>
>>>> -     return 0;
>>>> +     return  drm_mode_config_helper_suspend(drm_dev);
>>>>    }
>>>>
>>>>    static void exynos_drm_resume(struct device *dev)
>>>>    {
>>>>        struct drm_device *drm_dev = dev_get_drvdata(dev);
>>>> -     struct exynos_drm_private *private;
>>>> -
>>>> -     if (!drm_dev)
>>>> -             return;
>>>>
>>>> -     private = drm_dev->dev_private;
>>>> -     drm_atomic_helper_resume(drm_dev, private->suspend_state);
>>>> -     exynos_drm_fbdev_resume(drm_dev);
>>>> -     drm_kms_helper_poll_enable(drm_dev);
>>>> +     return drm_mode_config_helper_resume(drm_dev);
>>> exynos_drm_resume() now returns 'void', so to be strict with
>>> c standard, the return statement should not be used here.
>> But in struct dev_pm_ops, it is still defined as
>>
>>                  int (*resume)(struct device *dev);
>>
>> I think, we need to correct the return type of
>> exynos_drm_resume() to int.
>
> Nope. After commit dc684af6fc8d ("drm/exynos: Suspend/resume display
> pipeline as early/late as possible") exynos_drm_resume() is assigned
> to .complete callback, which use 'void' return type, so for now no
> more changes are needed.

Ok, then v4 is the right candidate to go.

>
>> Although I posted v4.
>>
>>
>>>>    }
>>>>
>>>>    static const struct dev_pm_ops exynos_drm_pm_ops = {
>>>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h
>>>> index c737c4b..7349e7c 100644
>>>> --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
>>>> +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
>>>> @@ -195,7 +195,6 @@ struct drm_exynos_file_private {
>>>>     */
>>>>    struct exynos_drm_private {
>>>>        struct drm_fb_helper *fb_helper;
>>>> -     struct drm_atomic_state *suspend_state;
>>>>
>>>>        struct device *g2d_dev;
>>>>        struct device *dma_dev;
>>>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
>>>> index 132dd52..918dd2c 100644
>>>> --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
>>>> +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c
>>>> @@ -270,20 +270,3 @@ void exynos_drm_fbdev_fini(struct drm_device *dev)
>>>>        private->fb_helper = NULL;
>>>>    }
>>>>
>>>> -void exynos_drm_fbdev_suspend(struct drm_device *dev)
>>>> -{
>>>> -     struct exynos_drm_private *private = dev->dev_private;
>>>> -
>>>> -     console_lock();
>>>> -     drm_fb_helper_set_suspend(private->fb_helper, 1);
>>>> -     console_unlock();
>>>> -}
>>>> -
>>>> -void exynos_drm_fbdev_resume(struct drm_device *dev)
>>>> -{
>>>> -     struct exynos_drm_private *private = dev->dev_private;
>>>> -
>>>> -     console_lock();
>>>> -     drm_fb_helper_set_suspend(private->fb_helper, 0);
>>>> -     console_unlock();
>>>> -}
>>>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.h b/drivers/gpu/drm/exynos/exynos_drm_fbdev.h
>>>> index b338472..6840b6a 100644
>>>> --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.h
>>>> +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.h
>>>> @@ -19,8 +19,6 @@
>>>>
>>>>    int exynos_drm_fbdev_init(struct drm_device *dev);
>>>>    void exynos_drm_fbdev_fini(struct drm_device *dev);
>>>> -void exynos_drm_fbdev_suspend(struct drm_device *drm);
>>>> -void exynos_drm_fbdev_resume(struct drm_device *drm);
>>>>
>>>>    #else
>>>>
>>>> @@ -39,14 +37,6 @@ static inline void exynos_drm_fbdev_restore_mode(struct drm_device *dev)
>>>>
>>>>    #define exynos_drm_output_poll_changed (NULL)
>>>>
>>>> -static inline void exynos_drm_fbdev_suspend(struct drm_device *drm)
>>>> -{
>>>> -}
>>>> -
>>>> -static inline void exynos_drm_fbdev_resume(struct drm_device *drm)
>>>> -{
>>>> -}
>>>> -
>>>>    #endif
>>>>
>>>>    #endif
>>> Best regards
>>> --
>>> Marek Szyprowski, PhD
>>> Samsung R&D Institute Poland
>>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
>>
>
> Best regards
> --
> Marek Szyprowski, PhD
> Samsung R&D Institute Poland
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-08-04 14:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20180802131924epcas4p105dc354b2ee651e70a5e777850222bc5@epcas4p1.samsung.com>
2018-08-02 13:21 ` [PATCH v3] gpu/drm/exynos: Convert drm_atomic_helper_suspend/resume() Souptick Joarder
2018-08-02 13:38   ` Marek Szyprowski
2018-08-02 15:51     ` Souptick Joarder
2018-08-03  7:00       ` Marek Szyprowski
2018-08-04 14:32         ` Souptick Joarder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).