Skip to contentSkip to conversation

gpu/drm/exynos: Convert drm_atomic_helper_suspend/resume()

PATCH Applied Souptick Joarder 2 participants 4 messages Aug 2, 2018 – Sep 21, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 gpu/drm/exynos: Convert drm_atomic_helper_suspend/resume()

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.

---
v2: Address Inki Dae's comment. Remove ret variable
from both suspend/resume function.

v3: Tested by Marek. Updated the change log.

v4: removing the return as exynos_drm_resume()
now returns void.

 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(-)
drivers/gpu/drm/exynos/exynos_drm_drv.c +2 -24
index b599f74..6f76baf 100644
@@ -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);
+	drm_mode_config_helper_resume(drm_dev);
 }
 
 static const struct dev_pm_ops exynos_drm_pm_ops = {
drivers/gpu/drm/exynos/exynos_drm_drv.h +0 -1
index c737c4b..7349e7c 100644
@@ -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;
drivers/gpu/drm/exynos/exynos_drm_fbdev.c +0 -17
index 132dd52..918dd2c 100644
@@ -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();
-}
drivers/gpu/drm/exynos/exynos_drm_fbdev.h +0 -10
index b338472..6840b6a 100644
@@ -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
Signature · 1 line
1.9.1
#1 lore raw
Quoted 8 lines · Souptick Joarder

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.

Quoted 6 lines

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

Can we get this patch in queue for 4.20 ? Not yet available in linux-next.

Quoted 127 lines

---
v2: Address Inki Dae's comment. Remove ret variable
from both suspend/resume function.

v3: Tested by Marek. Updated the change log.

v4: removing the return as exynos_drm_resume()
now returns void.

 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(-)
drivers/gpu/drm/exynos/exynos_drm_drv.c +2 -24
index b599f74..6f76baf 100644
@@ -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);
+       drm_mode_config_helper_resume(drm_dev);
 }
 
 static const struct dev_pm_ops exynos_drm_pm_ops = {
drivers/gpu/drm/exynos/exynos_drm_drv.h +0 -1
index c737c4b..7349e7c 100644
@@ -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;
drivers/gpu/drm/exynos/exynos_drm_fbdev.c +0 -17
index 132dd52..918dd2c 100644
@@ -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();
-}
drivers/gpu/drm/exynos/exynos_drm_fbdev.h +0 -11
index b338472..6840b6a 100644
@@ -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

#2 lore raw

Hi Inki,

Quoted 10 lines · Souptick Joarder
Quoted 8 lines · Souptick Joarder

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.

Quoted 8 lines
Quoted 6 lines

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

Can we get this patch in queue for 4.20 ? Not yet available in linux-next.

Is this patch queued for 4.20 ?

Quoted 127 lines
Quoted 127 lines

---
v2: Address Inki Dae's comment. Remove ret variable
from both suspend/resume function.

v3: Tested by Marek. Updated the change log.

v4: removing the return as exynos_drm_resume()
now returns void.

 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(-)
drivers/gpu/drm/exynos/exynos_drm_drv.c +2 -24
index b599f74..6f76baf 100644
@@ -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);
+       drm_mode_config_helper_resume(drm_dev);
 }
 
 static const struct dev_pm_ops exynos_drm_pm_ops = {
drivers/gpu/drm/exynos/exynos_drm_drv.h +0 -1
index c737c4b..7349e7c 100644
@@ -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;
drivers/gpu/drm/exynos/exynos_drm_fbdev.c +0 -17
index 132dd52..918dd2c 100644
@@ -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();
-}
drivers/gpu/drm/exynos/exynos_drm_fbdev.h +0 -11
index b338472..6840b6a 100644
@@ -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

maintainer Applied
#3 lore raw

Hi Joarder,

Quoted 15 lines · Souptick Joarder

Hi Inki,

Quoted 13 lines · Souptick Joarder
Quoted 11 lines · Souptick Joarder

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.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

Can we get this patch in queue for 4.20 ? Not yet available in linux-next.

Is this patch queued for 4.20 ?

Queued already to exynos-drm-next below so please wait. I will have pull-request soon.
https://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git/log/?h=exynos-drm-next

Thanks,
Inki Dae

Quoted 130 lines
Quoted 128 lines
Quoted 128 lines

---
v2: Address Inki Dae's comment. Remove ret variable
from both suspend/resume function.

v3: Tested by Marek. Updated the change log.

v4: removing the return as exynos_drm_resume()
now returns void.

 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(-)
drivers/gpu/drm/exynos/exynos_drm_drv.c +2 -24
index b599f74..6f76baf 100644
@@ -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);
+       drm_mode_config_helper_resume(drm_dev);
 }
 
 static const struct dev_pm_ops exynos_drm_pm_ops = {
drivers/gpu/drm/exynos/exynos_drm_drv.h +0 -1
index c737c4b..7349e7c 100644
@@ -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;
drivers/gpu/drm/exynos/exynos_drm_fbdev.c +0 -17
index 132dd52..918dd2c 100644
@@ -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();
-}
drivers/gpu/drm/exynos/exynos_drm_fbdev.h +0 -11
index b338472..6840b6a 100644
@@ -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