diff mbox

[1/2] drm/sti: load XP70 firmware only once

Message ID 1480950573-24256-2-git-send-email-fabien.dessenne@st.com (mailing list archive)
State New, archived
Headers show

Commit Message

Fabien DESSENNE Dec. 5, 2016, 3:09 p.m. UTC
When a plane is enabled, after having been disabled, do not reload XP70
firmware again, but only register VTG again

Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
---
 drivers/gpu/drm/sti/sti_hqvdp.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Benjamin Gaignard Dec. 7, 2016, 11:10 a.m. UTC | #1
Acked-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>

2016-12-05 16:09 GMT+01:00 Fabien Dessenne <fabien.dessenne@st.com>:
> When a plane is enabled, after having been disabled, do not reload XP70
> firmware again, but only register VTG again
>
> Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
> ---
>  drivers/gpu/drm/sti/sti_hqvdp.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c
> index f88130f..a547723 100644
> --- a/drivers/gpu/drm/sti/sti_hqvdp.c
> +++ b/drivers/gpu/drm/sti/sti_hqvdp.c
> @@ -332,6 +332,7 @@ struct sti_hqvdp_cmd {
>   * @hqvdp_cmd_paddr:   physical address of hqvdp_cmd
>   * @vtg:               vtg for main data path
>   * @xp70_initialized:  true if xp70 is already initialized
> + * @vtg_registered:    true if registered to VTG
>   */
>  struct sti_hqvdp {
>         struct device *dev;
> @@ -347,6 +348,7 @@ struct sti_hqvdp {
>         u32 hqvdp_cmd_paddr;
>         struct sti_vtg *vtg;
>         bool xp70_initialized;
> +       bool vtg_registered;
>  };
>
>  #define to_sti_hqvdp(x) container_of(x, struct sti_hqvdp, plane)
> @@ -771,7 +773,7 @@ static void sti_hqvdp_disable(struct sti_hqvdp *hqvdp)
>                 DRM_ERROR("XP70 could not revert to idle\n");
>
>         hqvdp->plane.status = STI_PLANE_DISABLED;
> -       hqvdp->xp70_initialized = false;
> +       hqvdp->vtg_registered = false;
>  }
>
>  /**
> @@ -1064,10 +1066,11 @@ static int sti_hqvdp_atomic_check(struct drm_plane *drm_plane,
>                 return -EINVAL;
>         }
>
> -       if (!hqvdp->xp70_initialized) {
> +       if (!hqvdp->xp70_initialized)
>                 /* Start HQVDP XP70 coprocessor */
>                 sti_hqvdp_start_xp70(hqvdp);
>
> +       if (!hqvdp->vtg_registered) {
>                 /* Prevent VTG shutdown */
>                 if (clk_prepare_enable(hqvdp->clk_pix_main)) {
>                         DRM_ERROR("Failed to prepare/enable pix main clk\n");
> @@ -1081,6 +1084,7 @@ static int sti_hqvdp_atomic_check(struct drm_plane *drm_plane,
>                         DRM_ERROR("Cannot register VTG notifier\n");
>                         return -EINVAL;
>                 }
> +               hqvdp->vtg_registered = true;
>         }
>
>         DRM_DEBUG_KMS("CRTC:%d (%s) drm plane:%d (%s)\n",
> --
> 2.7.4
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c
index f88130f..a547723 100644
--- a/drivers/gpu/drm/sti/sti_hqvdp.c
+++ b/drivers/gpu/drm/sti/sti_hqvdp.c
@@ -332,6 +332,7 @@  struct sti_hqvdp_cmd {
  * @hqvdp_cmd_paddr:   physical address of hqvdp_cmd
  * @vtg:               vtg for main data path
  * @xp70_initialized:  true if xp70 is already initialized
+ * @vtg_registered:    true if registered to VTG
  */
 struct sti_hqvdp {
 	struct device *dev;
@@ -347,6 +348,7 @@  struct sti_hqvdp {
 	u32 hqvdp_cmd_paddr;
 	struct sti_vtg *vtg;
 	bool xp70_initialized;
+	bool vtg_registered;
 };
 
 #define to_sti_hqvdp(x) container_of(x, struct sti_hqvdp, plane)
@@ -771,7 +773,7 @@  static void sti_hqvdp_disable(struct sti_hqvdp *hqvdp)
 		DRM_ERROR("XP70 could not revert to idle\n");
 
 	hqvdp->plane.status = STI_PLANE_DISABLED;
-	hqvdp->xp70_initialized = false;
+	hqvdp->vtg_registered = false;
 }
 
 /**
@@ -1064,10 +1066,11 @@  static int sti_hqvdp_atomic_check(struct drm_plane *drm_plane,
 		return -EINVAL;
 	}
 
-	if (!hqvdp->xp70_initialized) {
+	if (!hqvdp->xp70_initialized)
 		/* Start HQVDP XP70 coprocessor */
 		sti_hqvdp_start_xp70(hqvdp);
 
+	if (!hqvdp->vtg_registered) {
 		/* Prevent VTG shutdown */
 		if (clk_prepare_enable(hqvdp->clk_pix_main)) {
 			DRM_ERROR("Failed to prepare/enable pix main clk\n");
@@ -1081,6 +1084,7 @@  static int sti_hqvdp_atomic_check(struct drm_plane *drm_plane,
 			DRM_ERROR("Cannot register VTG notifier\n");
 			return -EINVAL;
 		}
+		hqvdp->vtg_registered = true;
 	}
 
 	DRM_DEBUG_KMS("CRTC:%d (%s) drm plane:%d (%s)\n",