Skip to contentSkip to conversation

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

PATCH In review Souptick Joarder 2 participants 3 messages Jul 18, 2018 – Jul 24, 2018

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

PATCH 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.

---
 drivers/gpu/drm/exynos/exynos_drm_drv.c   | 32 ++++++++++---------------------
 drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 17 ----------------
 drivers/gpu/drm/exynos/exynos_drm_fbdev.h | 10 ----------
 3 files changed, 10 insertions(+), 49 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_drv.c +10 -22
index a81b4a5..1996ff7 100644
@@ -151,39 +151,27 @@ 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;
+	int ret = 0;
 
-	if (pm_runtime_suspended(dev) || !drm_dev)
-		return 0;
+	if (pm_runtime_suspended(dev))
+		return ret;
 
-	private = drm_dev->dev_private;
+	ret = drm_mode_config_helper_suspend(drm_dev);
 
-	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 ret;
 }
 
 static int exynos_drm_resume(struct device *dev)
 {
 	struct drm_device *drm_dev = dev_get_drvdata(dev);
-	struct exynos_drm_private *private;
+	int ret = 0;
 
-	if (pm_runtime_suspended(dev) || !drm_dev)
-		return 0;
+	if (pm_runtime_suspended(dev))
+		return ret;
 
-	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);
+	ret = drm_mode_config_helper_resume(drm_dev);
 
-	return 0;
+	return ret;
 }
 #endif
 
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
maintainer
#1 lore raw

Hi,

2018년 07월 19일 05:49에 Souptick Joarder 이(가) 쓴 글:

Quoted 20 lines

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.

---
 drivers/gpu/drm/exynos/exynos_drm_drv.c   | 32 ++++++++++---------------------
 drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 17 ----------------
 drivers/gpu/drm/exynos/exynos_drm_fbdev.h | 10 ----------
 3 files changed, 10 insertions(+), 49 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_drv.c +0 -0
index a81b4a5..1996ff7 100644

drivers/gpu/drm/exynos/exynos_drm_drv.c static void exynos_drm_postclose(struct drm_device *dev, struct drm_file *file) · line 157

Quoted 8 lines
drivers/gpu/drm/exynos/exynos_drm_drv.c +1 -3
@@ -151,39 +151,27 @@ 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;
+	int ret = 0;
 
-	if (pm_runtime_suspended(dev) || !drm_dev)
-		return 0;

You removes '!drm_dev' not related to this patch.

drivers/gpu/drm/exynos/exynos_drm_drv.c static void exynos_drm_postclose(struct drm_device *dev, struct drm_file *file) · line 159

Quoted 5 lines
drivers/gpu/drm/exynos/exynos_drm_drv.c +3 -1
+	if (pm_runtime_suspended(dev))
+		return ret;
 
-	private = drm_dev->dev_private;
+	ret = drm_mode_config_helper_suspend(drm_dev);

Just return drm_mode_config_helper_suspend(drm_dev);

Quoted 14 lines
drivers/gpu/drm/exynos/exynos_drm_drv.c +1 -10
-	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 ret;
 }
 

drivers/gpu/drm/exynos/exynos_drm_drv.c static void exynos_drm_postclose(struct drm_device *dev, struct drm_file *file) · line 170

Quoted 10 lines
drivers/gpu/drm/exynos/exynos_drm_drv.c +3 -3
 static int exynos_drm_resume(struct device *dev)
 {
 	struct drm_device *drm_dev = dev_get_drvdata(dev);
-	struct exynos_drm_private *private;
+	int ret = 0;
 
-	if (pm_runtime_suspended(dev) || !drm_dev)
-		return 0;
+	if (pm_runtime_suspended(dev))
+		return ret;

Ditto. You removes '!drm_dev' not related to this patch.

drivers/gpu/drm/exynos/exynos_drm_drv.c static void exynos_drm_postclose(struct drm_device *dev, struct drm_file *file) · line 172

Quoted 6 lines
drivers/gpu/drm/exynos/exynos_drm_drv.c +1 -4
-	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);
+	ret = drm_mode_config_helper_resume(drm_dev);

Ditto. return drm_mode_config_helper_resume(drm_dev);

With this patch, you could remove 'int ret' declaration including one from exynos_drm_suspend.

Thanks,
Inki Dae

Quoted 60 lines
drivers/gpu/drm/exynos/exynos_drm_drv.c +1 -1
-	return 0;
+	return ret;
 }
 #endif
 
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
#2 lore raw
Quoted 29 lines · Inki Dae

Hi,

2018년 07월 19일 05:49에 Souptick Joarder 이(가) 쓴 글:

Quoted 26 lines

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.

---
 drivers/gpu/drm/exynos/exynos_drm_drv.c   | 32 ++++++++++---------------------
 drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 17 ----------------
 drivers/gpu/drm/exynos/exynos_drm_fbdev.h | 10 ----------
 3 files changed, 10 insertions(+), 49 deletions(-)
drivers/gpu/drm/exynos/exynos_drm_drv.c +1 -1
index a81b4a5..1996ff7 100644
@@ -151,39 +151,27 @@ 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;
+     int ret = 0;
 
Quoted 4 lines

drivers/gpu/drm/exynos/exynos_drm_drv.c static void exynos_drm_postclose(struct drm_device *dev, struct drm_file *file) · line 157

Quoted 2 lines
drivers/gpu/drm/exynos/exynos_drm_drv.c +0 -2
-     if (pm_runtime_suspended(dev) || !drm_dev)
-             return 0;

You removes '!drm_dev' not related to this patch.

The same has been checked inside drm_mode_config_helper_suspend(), so we should avoid double check.

Quoted 8 lines

drivers/gpu/drm/exynos/exynos_drm_drv.c static void exynos_drm_postclose(struct drm_device *dev, struct drm_file *file) · line 159

Quoted 6 lines
drivers/gpu/drm/exynos/exynos_drm_drv.c +3 -1
+     if (pm_runtime_suspended(dev))
+             return ret;
 
-     private = drm_dev->dev_private;
+     ret = drm_mode_config_helper_suspend(drm_dev);

Just return drm_mode_config_helper_suspend(drm_dev);

Ok

Quoted 21 lines
Quoted 21 lines
drivers/gpu/drm/exynos/exynos_drm_drv.c +2 -11
-     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 ret;
 }
 
 static int exynos_drm_resume(struct device *dev)
 {
      struct drm_device *drm_dev = dev_get_drvdata(dev);
-     struct exynos_drm_private *private;
+     int ret = 0;
 
Quoted 6 lines

drivers/gpu/drm/exynos/exynos_drm_drv.c static void exynos_drm_postclose(struct drm_device *dev, struct drm_file *file) · line 157

Quoted 4 lines
drivers/gpu/drm/exynos/exynos_drm_drv.c +2 -2
-     if (pm_runtime_suspended(dev) || !drm_dev)
-             return 0;
+     if (pm_runtime_suspended(dev))
+             return ret;

Ditto. You removes '!drm_dev' not related to this patch.

Same reason mentioned above to remove '!drm_dev'

Quoted 11 lines

drivers/gpu/drm/exynos/exynos_drm_drv.c static void exynos_drm_postclose(struct drm_device *dev, struct drm_file *file) · line 172

Quoted 7 lines
drivers/gpu/drm/exynos/exynos_drm_drv.c +1 -4
-     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);
+     ret = drm_mode_config_helper_resume(drm_dev);

Ditto. return drm_mode_config_helper_resume(drm_dev);

With this patch, you could remove 'int ret' declaration including one from exynos_drm_suspend.

Ok, I will add this in v2.

Quoted 64 lines

Thanks,
Inki Dae

Quoted 60 lines
drivers/gpu/drm/exynos/exynos_drm_drv.c +1 -1
-     return 0;
+     return ret;
 }
 #endif
 
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