drm/sun4i: Force the mixer rate at 150MHz
authorMaxime Ripard <maxime.ripard@free-electrons.com>
Thu, 21 Dec 2017 11:02:31 +0000 (12:02 +0100)
committerMaxime Ripard <maxime.ripard@free-electrons.com>
Thu, 4 Jan 2018 19:04:32 +0000 (20:04 +0100)
It seems like the mixer can only run properly when clocked at 150MHz. In
order to have something more robust than simply a fire-and-forget
assigned-clocks-rate, let's put that in the code.

Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/f5f05307972ed05250e8094b302d68b9e7e167f6.1513854122.git-series.maxime.ripard@free-electrons.com
drivers/gpu/drm/sun4i/sun8i_mixer.c
drivers/gpu/drm/sun4i/sun8i_mixer.h

index 29ceeb016d728f26fa90d431dd064273bfd9195e..3a610a87cbd21a69a417f1f5e3285ab599cebfb4 100644 (file)
@@ -398,6 +398,15 @@ static int sun8i_mixer_bind(struct device *dev, struct device *master,
                ret = PTR_ERR(mixer->mod_clk);
                goto err_disable_bus_clk;
        }
+
+       /*
+        * It seems that we need to enforce that rate for whatever
+        * reason for the mixer to be functional. Make sure it's the
+        * case.
+        */
+       if (mixer->cfg->mod_rate)
+               clk_set_rate(mixer->mod_clk, mixer->cfg->mod_rate);
+
        clk_prepare_enable(mixer->mod_clk);
 
        list_add_tail(&mixer->engine.list, &drv->engine_list);
@@ -474,6 +483,7 @@ static const struct sun8i_mixer_cfg sun8i_v3s_mixer_cfg = {
        .ui_num = 1,
        .scaler_mask = 0x3,
        .ccsc = 0,
+       .mod_rate = 150000000,
 };
 
 static const struct of_device_id sun8i_mixer_of_table[] = {
index bc58040a88f915dd231fcc780b0808cc5ec2908f..f34e70c42adf4707cee223d4bd8d9b1437f05a45 100644 (file)
@@ -121,12 +121,15 @@ struct de2_fmt_info {
  *     Set value to 0 if this is first mixer or second mixer with VEP support.
  *     Set value to 1 if this is second mixer without VEP support. Other values
  *     are invalid.
+ * @mod_rate: module clock rate that needs to be set in order to have
+ *     a functional block.
  */
 struct sun8i_mixer_cfg {
        int             vi_num;
        int             ui_num;
        int             scaler_mask;
        int             ccsc;
+       unsigned long   mod_rate;
 };
 
 struct sun8i_mixer {