Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1413563 > unrolled thread

[PATCH v2 0/6] drm/fsl-dcu: suspend/resume rework using atomic helpers

Started byStefan Agner <stefan@agner.ch>
First post2016-06-04 01:00 +0200
Last post2016-06-04 01:00 +0200
Articles 5 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2 0/6] drm/fsl-dcu: suspend/resume rework using atomic helpers Stefan Agner <stefan@agner.ch> - 2016-06-04 01:00 +0200
    [PATCH v2 4/6] drm/fsl-dcu: use clk helpers Stefan Agner <stefan@agner.ch> - 2016-06-04 01:00 +0200
    [PATCH v2 1/6] drm/fb_cma_helper: add suspend helper Stefan Agner <stefan@agner.ch> - 2016-06-04 01:00 +0200
      Re: [PATCH v2 1/6] drm/fb_cma_helper: add suspend helper Daniel Vetter <daniel@ffwll.ch> - 2016-06-04 01:20 +0200
    [PATCH v2 2/6] drm/fsl-dcu: store layer registers in soc_data Stefan Agner <stefan@agner.ch> - 2016-06-04 01:00 +0200

#1413563 — [PATCH v2 0/6] drm/fsl-dcu: suspend/resume rework using atomic helpers

FromStefan Agner <stefan@agner.ch>
Date2016-06-04 01:00 +0200
Subject[PATCH v2 0/6] drm/fsl-dcu: suspend/resume rework using atomic helpers
Message-ID<rG6el-KI-7@gated-at.bofh.it>
This implements suspend/resume using the atomic update supsend/resume
helpers instead of the current implementation which uses regcache. The
code has been tested on a Colibri VF61 using the freeze suspend mode.

This version is a rebase ontop of the fix for the regmap cache issue:
https://lists.freedesktop.org/archives/dri-devel/2016-June/109625.html

Dave, Thierry: Could you have a look at patch 1? If that looks good
for you I will take it through my tree...

Changes since v1:
- Rebase ontop of drm-next + regmap cache fix

Stefan Agner (6):
  drm/fb_cma_helper: add suspend helper
  drm/fsl-dcu: store layer registers in soc_data
  drm/fsl-dcu: move layer initialization to plane file
  drm/fsl-dcu: use clk helpers
  drm/fsl-dcu: implement suspend/resume using atomic helpers
  drm/fsl-dcu: disable vblank events on CRTC disable

 drivers/gpu/drm/drm_fb_cma_helper.c         | 15 +++++++++
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c  | 21 ++++---------
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c   | 47 +++++++++++++++++++++--------
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h   |  2 ++
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c | 16 ++++++++++
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.h |  1 +
 include/drm/drm_fb_cma_helper.h             |  1 +
 7 files changed, 76 insertions(+), 27 deletions(-)

-- 
2.8.2

[toc] | [next] | [standalone]


#1413564 — [PATCH v2 4/6] drm/fsl-dcu: use clk helpers

FromStefan Agner <stefan@agner.ch>
Date2016-06-04 01:00 +0200
Subject[PATCH v2 4/6] drm/fsl-dcu: use clk helpers
Message-ID<rG6em-KI-23@gated-at.bofh.it>
In reply to#1413563
Use clk_prepare_enable and clk_disable_unprepare helpers. This also
fixes a sequence issue in the enable path which lead to a warning
on resume.

Signed-off-by: Stefan Agner <stefan@agner.ch>
---
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 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 9daca1f..06a4d01 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
@@ -232,8 +232,7 @@ static int fsl_dcu_drm_pm_suspend(struct device *dev)
 	drm_kms_helper_poll_disable(fsl_dev->drm);
 	regcache_cache_only(fsl_dev->regmap, true);
 	regcache_mark_dirty(fsl_dev->regmap);
-	clk_disable(fsl_dev->clk);
-	clk_unprepare(fsl_dev->clk);
+	clk_disable_unprepare(fsl_dev->clk);
 
 	return 0;
 }
@@ -246,15 +245,9 @@ static int fsl_dcu_drm_pm_resume(struct device *dev)
 	if (!fsl_dev)
 		return 0;
 
-	ret = clk_enable(fsl_dev->clk);
+	ret = clk_prepare_enable(fsl_dev->clk);
 	if (ret < 0) {
 		dev_err(dev, "failed to enable dcu clk\n");
-		clk_unprepare(fsl_dev->clk);
-		return ret;
-	}
-	ret = clk_prepare(fsl_dev->clk);
-	if (ret < 0) {
-		dev_err(dev, "failed to prepare dcu clk\n");
 		return ret;
 	}
 
-- 
2.8.2

[toc] | [prev] | [next] | [standalone]


#1413565 — [PATCH v2 1/6] drm/fb_cma_helper: add suspend helper

FromStefan Agner <stefan@agner.ch>
Date2016-06-04 01:00 +0200
Subject[PATCH v2 1/6] drm/fb_cma_helper: add suspend helper
Message-ID<rG6em-KI-25@gated-at.bofh.it>
In reply to#1413563
Implement a suspend/resume helper for CMA users which calls
drm_fb_helper_set_suspend.

Suggested-by: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Stefan Agner <stefan@agner.ch>
---
 drivers/gpu/drm/drm_fb_cma_helper.c | 15 +++++++++++++++
 include/drm/drm_fb_cma_helper.h     |  1 +
 2 files changed, 16 insertions(+)

diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c
index 172cafe..6948d82 100644
--- a/drivers/gpu/drm/drm_fb_cma_helper.c
+++ b/drivers/gpu/drm/drm_fb_cma_helper.c
@@ -582,3 +582,18 @@ void drm_fbdev_cma_hotplug_event(struct drm_fbdev_cma *fbdev_cma)
 		drm_fb_helper_hotplug_event(&fbdev_cma->fb_helper);
 }
 EXPORT_SYMBOL_GPL(drm_fbdev_cma_hotplug_event);
+
+/**
+ * drm_fbdev_cma_set_suspend - wrapper around drm_fb_helper_set_suspend
+ * @fbdev_cma: The drm_fbdev_cma struct, may be NULL
+ * @state: desired state, zero to resume, non-zero to suspend
+ *
+ * Calls drm_fb_helper_set_suspend, which is a wrapper around
+ * fb_set_suspend implemented by fbdev core.
+ */
+void drm_fbdev_cma_set_suspend(struct drm_fbdev_cma *fbdev_cma, int state)
+{
+	if (fbdev_cma)
+		drm_fb_helper_set_suspend(&fbdev_cma->fb_helper, state);
+}
+EXPORT_SYMBOL(drm_fbdev_cma_set_suspend);
diff --git a/include/drm/drm_fb_cma_helper.h b/include/drm/drm_fb_cma_helper.h
index fd0dde9..f313211 100644
--- a/include/drm/drm_fb_cma_helper.h
+++ b/include/drm/drm_fb_cma_helper.h
@@ -23,6 +23,7 @@ void drm_fbdev_cma_fini(struct drm_fbdev_cma *fbdev_cma);
 
 void drm_fbdev_cma_restore_mode(struct drm_fbdev_cma *fbdev_cma);
 void drm_fbdev_cma_hotplug_event(struct drm_fbdev_cma *fbdev_cma);
+void drm_fbdev_cma_set_suspend(struct drm_fbdev_cma *fbdev_cma, int state);
 int drm_fbdev_cma_create_with_funcs(struct drm_fb_helper *helper,
 	struct drm_fb_helper_surface_size *sizes,
 	const struct drm_framebuffer_funcs *funcs);
-- 
2.8.2

[toc] | [prev] | [next] | [standalone]


#1413573 — Re: [PATCH v2 1/6] drm/fb_cma_helper: add suspend helper

FromDaniel Vetter <daniel@ffwll.ch>
Date2016-06-04 01:20 +0200
SubjectRe: [PATCH v2 1/6] drm/fb_cma_helper: add suspend helper
Message-ID<rG6xH-167-9@gated-at.bofh.it>
In reply to#1413565
On Fri, Jun 03, 2016 at 03:56:39PM -0700, Stefan Agner wrote:
> Implement a suspend/resume helper for CMA users which calls
> drm_fb_helper_set_suspend.
> 
> Suggested-by: Thierry Reding <thierry.reding@gmail.com>
> Signed-off-by: Stefan Agner <stefan@agner.ch>

Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>

... for merging through fsl-du tree. Just add a small note about it in
your pull request.
-Daniel

> ---
>  drivers/gpu/drm/drm_fb_cma_helper.c | 15 +++++++++++++++
>  include/drm/drm_fb_cma_helper.h     |  1 +
>  2 files changed, 16 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c
> index 172cafe..6948d82 100644
> --- a/drivers/gpu/drm/drm_fb_cma_helper.c
> +++ b/drivers/gpu/drm/drm_fb_cma_helper.c
> @@ -582,3 +582,18 @@ void drm_fbdev_cma_hotplug_event(struct drm_fbdev_cma *fbdev_cma)
>  		drm_fb_helper_hotplug_event(&fbdev_cma->fb_helper);
>  }
>  EXPORT_SYMBOL_GPL(drm_fbdev_cma_hotplug_event);
> +
> +/**
> + * drm_fbdev_cma_set_suspend - wrapper around drm_fb_helper_set_suspend
> + * @fbdev_cma: The drm_fbdev_cma struct, may be NULL
> + * @state: desired state, zero to resume, non-zero to suspend
> + *
> + * Calls drm_fb_helper_set_suspend, which is a wrapper around
> + * fb_set_suspend implemented by fbdev core.
> + */
> +void drm_fbdev_cma_set_suspend(struct drm_fbdev_cma *fbdev_cma, int state)
> +{
> +	if (fbdev_cma)
> +		drm_fb_helper_set_suspend(&fbdev_cma->fb_helper, state);
> +}
> +EXPORT_SYMBOL(drm_fbdev_cma_set_suspend);
> diff --git a/include/drm/drm_fb_cma_helper.h b/include/drm/drm_fb_cma_helper.h
> index fd0dde9..f313211 100644
> --- a/include/drm/drm_fb_cma_helper.h
> +++ b/include/drm/drm_fb_cma_helper.h
> @@ -23,6 +23,7 @@ void drm_fbdev_cma_fini(struct drm_fbdev_cma *fbdev_cma);
>  
>  void drm_fbdev_cma_restore_mode(struct drm_fbdev_cma *fbdev_cma);
>  void drm_fbdev_cma_hotplug_event(struct drm_fbdev_cma *fbdev_cma);
> +void drm_fbdev_cma_set_suspend(struct drm_fbdev_cma *fbdev_cma, int state);
>  int drm_fbdev_cma_create_with_funcs(struct drm_fb_helper *helper,
>  	struct drm_fb_helper_surface_size *sizes,
>  	const struct drm_framebuffer_funcs *funcs);
> -- 
> 2.8.2
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

[toc] | [prev] | [next] | [standalone]


#1413567 — [PATCH v2 2/6] drm/fsl-dcu: store layer registers in soc_data

FromStefan Agner <stefan@agner.ch>
Date2016-06-04 01:00 +0200
Subject[PATCH v2 2/6] drm/fsl-dcu: store layer registers in soc_data
Message-ID<rG6el-KI-19@gated-at.bofh.it>
In reply to#1413563
Store the number of registers per layer in soc_data. This is
more consistent with how the rest of SoC specific data are
handled.

Signed-off-by: Stefan Agner <stefan@agner.ch>
---
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c | 8 ++------
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c  | 2 ++
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h  | 1 +
 3 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c
index 89c0084..b024f90 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_crtc.c
@@ -138,7 +138,7 @@ int fsl_dcu_drm_crtc_create(struct fsl_dcu_drm_device *fsl_dev)
 {
 	struct drm_plane *primary;
 	struct drm_crtc *crtc = &fsl_dev->crtc;
-	unsigned int i, j, reg_num;
+	unsigned int i, j;
 	int ret;
 
 	primary = fsl_dcu_drm_primary_create_plane(fsl_dev->drm);
@@ -154,12 +154,8 @@ int fsl_dcu_drm_crtc_create(struct fsl_dcu_drm_device *fsl_dev)
 
 	drm_crtc_helper_add(crtc, &fsl_dcu_drm_crtc_helper_funcs);
 
-	if (!strcmp(fsl_dev->soc->name, "ls1021a"))
-		reg_num = LS1021A_LAYER_REG_NUM;
-	else
-		reg_num = VF610_LAYER_REG_NUM;
 	for (i = 0; i < fsl_dev->soc->total_layer; i++) {
-		for (j = 1; j <= reg_num; j++)
+		for (j = 1; j <= fsl_dev->soc->layer_regs; j++)
 			regmap_write(fsl_dev->regmap, DCU_CTRLDESCLN(i, j), 0);
 	}
 	regmap_update_bits(fsl_dev->regmap, DCU_DCU_MODE,
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 dc723f7..9daca1f 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
@@ -274,12 +274,14 @@ static const struct fsl_dcu_soc_data fsl_dcu_ls1021a_data = {
 	.name = "ls1021a",
 	.total_layer = 16,
 	.max_layer = 4,
+	.layer_regs = LS1021A_LAYER_REG_NUM,
 };
 
 static const struct fsl_dcu_soc_data fsl_dcu_vf610_data = {
 	.name = "vf610",
 	.total_layer = 64,
 	.max_layer = 6,
+	.layer_regs = VF610_LAYER_REG_NUM,
 };
 
 static const struct of_device_id fsl_dcu_of_match[] = {
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 c275f90..b1bba3a 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h
@@ -175,6 +175,7 @@ struct fsl_dcu_soc_data {
 	unsigned int total_layer;
 	/*max layer number DCU supported*/
 	unsigned int max_layer;
+	unsigned int layer_regs;
 };
 
 struct fsl_dcu_drm_device {
-- 
2.8.2

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web