On the STiH418, a new clock (proc_mixer) must be enabled in order
to have the plane mixers properly behaving.  Add a new
st,stih418-compositor in order to describe the planes/mixers
available on this platform.

Signed-off-by: Alain Volmat <avol...@me.com>
---
 drivers/gpu/drm/sti/sti_compositor.c | 26 ++++++++++++++++++++++++++
 drivers/gpu/drm/sti/sti_compositor.h |  2 ++
 drivers/gpu/drm/sti/sti_crtc.c       | 11 +++++++++++
 3 files changed, 39 insertions(+)

diff --git a/drivers/gpu/drm/sti/sti_compositor.c 
b/drivers/gpu/drm/sti/sti_compositor.c
index 4bd7e305ab75..dfea3c1191a6 100644
--- a/drivers/gpu/drm/sti/sti_compositor.c
+++ b/drivers/gpu/drm/sti/sti_compositor.c
@@ -43,6 +43,23 @@ static const struct sti_compositor_data 
stih407_compositor_data = {
        },
 };
 
+/*
+ * stiH418 compositor properties
+ */
+static const struct sti_compositor_data stih418_compositor_data = {
+       .nb_subdev = 8,
+       .subdev_desc = {
+                       {STI_GPDPLUS_SUBDEV, (int)STI_GDP_0, 0x00000},
+                       {STI_GPDPLUS_SUBDEV, (int)STI_GDP_1, 0x10000},
+                       {STI_GPDPLUS_SUBDEV, (int)STI_GDP_2, 0x20000},
+                       {STI_GPDPLUS_SUBDEV, (int)STI_GDP_3, 0x30000},
+                       {STI_GPD_SUBDEV, (int)STI_GDP_4, 0x40000},
+                       {STI_GPD_SUBDEV, (int)STI_GDP_5, 0x50000},
+                       {STI_MIXER_MAIN_SUBDEV, STI_MIXER_MAIN, 0x100000},
+                       {STI_MIXER_AUX_SUBDEV, STI_MIXER_AUX, 0x110000},
+       },
+};
+
 void sti_compositor_debugfs_init(struct sti_compositor *compo,
                                 struct drm_minor *minor)
 {
@@ -169,6 +186,9 @@ static const struct of_device_id compositor_of_match[] = {
        {
                .compatible = "st,stih407-compositor",
                .data = &stih407_compositor_data,
+       }, {
+               .compatible = "st,stih418-compositor",
+               .data = &stih418_compositor_data,
        }, {
                /* end node */
        }
@@ -236,6 +256,12 @@ static int sti_compositor_probe(struct platform_device 
*pdev)
                return PTR_ERR(compo->clk_pix_aux);
        }
 
+       compo->clk_proc_mixer = devm_clk_get_optional(dev, "proc_mixer");
+       if (IS_ERR(compo->clk_proc_mixer)) {
+               DRM_ERROR("Cannot get proc_mixer clock\n");
+               return PTR_ERR(compo->clk_proc_mixer);
+       }
+
        /* Get reset resources */
        compo->rst_main = devm_reset_control_get_shared(dev, "compo-main");
        /* Take compo main out of reset */
diff --git a/drivers/gpu/drm/sti/sti_compositor.h 
b/drivers/gpu/drm/sti/sti_compositor.h
index 62545210b96d..fdc655f78579 100644
--- a/drivers/gpu/drm/sti/sti_compositor.h
+++ b/drivers/gpu/drm/sti/sti_compositor.h
@@ -57,6 +57,7 @@ struct sti_compositor_data {
  * @clk_compo_aux: clock for aux compo
  * @clk_pix_main: pixel clock for main path
  * @clk_pix_aux: pixel clock for aux path
+ * @clk_proc_mixer: clock for the mixers
  * @rst_main: reset control of the main path
  * @rst_aux: reset control of the aux path
  * @mixer: array of mixers
@@ -72,6 +73,7 @@ struct sti_compositor {
        struct clk *clk_compo_aux;
        struct clk *clk_pix_main;
        struct clk *clk_pix_aux;
+       struct clk *clk_proc_mixer;
        struct reset_control *rst_main;
        struct reset_control *rst_aux;
        struct sti_mixer *mixer[STI_MAX_MIXER];
diff --git a/drivers/gpu/drm/sti/sti_crtc.c b/drivers/gpu/drm/sti/sti_crtc.c
index 3c7154f2d5f3..d93764e99b0e 100644
--- a/drivers/gpu/drm/sti/sti_crtc.c
+++ b/drivers/gpu/drm/sti/sti_crtc.c
@@ -67,6 +67,12 @@ sti_crtc_mode_set(struct drm_crtc *crtc, struct 
drm_display_mode *mode)
                pix_clk = compo->clk_pix_aux;
        }
 
+       /* Enable the mixer processing clock (if applicable) */
+       if (clk_prepare_enable(compo->clk_proc_mixer)) {
+               DRM_INFO("Failed to prepare/enable processing mixer clk\n");
+               goto proc_mixer_error;
+       }
+
        /* Prepare and enable the compo IP clock */
        if (clk_prepare_enable(compo_clk)) {
                DRM_INFO("Failed to prepare/enable compositor clk\n");
@@ -97,6 +103,8 @@ sti_crtc_mode_set(struct drm_crtc *crtc, struct 
drm_display_mode *mode)
 pix_error:
        clk_disable_unprepare(compo_clk);
 compo_error:
+       clk_disable_unprepare(compo->clk_proc_mixer);
+proc_mixer_error:
        return -EINVAL;
 }
 
@@ -122,6 +130,9 @@ static void sti_crtc_disable(struct drm_crtc *crtc)
                clk_disable_unprepare(compo->clk_compo_aux);
        }
 
+       /* Disable the mixer clock (if applicable) */
+       clk_disable_unprepare(compo->clk_proc_mixer);
+
        mixer->status = STI_MIXER_DISABLED;
 }
 
-- 
2.34.1

Reply via email to