aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxime Ripard <maxime.ripard@free-electrons.com>2017-12-21 06:02:31 -0500
committerMaxime Ripard <maxime.ripard@free-electrons.com>2018-01-04 14:04:32 -0500
commitedea372bd205a30385d4ffbf51afdac62bba478b (patch)
tree68334f7e4cbc95af7b1557c47ef87e20d3b0186e
parent104fe24a5f9361e5a30733a5c127e84879bd362d (diff)
drm/sun4i: Force the mixer rate at 150MHz
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
-rw-r--r--drivers/gpu/drm/sun4i/sun8i_mixer.c10
-rw-r--r--drivers/gpu/drm/sun4i/sun8i_mixer.h3
2 files changed, 13 insertions, 0 deletions
diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c b/drivers/gpu/drm/sun4i/sun8i_mixer.c
index 29ceeb016d72..3a610a87cbd2 100644
--- a/drivers/gpu/drm/sun4i/sun8i_mixer.c
+++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c
@@ -398,6 +398,15 @@ static int sun8i_mixer_bind(struct device *dev, struct device *master,
398 ret = PTR_ERR(mixer->mod_clk); 398 ret = PTR_ERR(mixer->mod_clk);
399 goto err_disable_bus_clk; 399 goto err_disable_bus_clk;
400 } 400 }
401
402 /*
403 * It seems that we need to enforce that rate for whatever
404 * reason for the mixer to be functional. Make sure it's the
405 * case.
406 */
407 if (mixer->cfg->mod_rate)
408 clk_set_rate(mixer->mod_clk, mixer->cfg->mod_rate);
409
401 clk_prepare_enable(mixer->mod_clk); 410 clk_prepare_enable(mixer->mod_clk);
402 411
403 list_add_tail(&mixer->engine.list, &drv->engine_list); 412 list_add_tail(&mixer->engine.list, &drv->engine_list);
@@ -474,6 +483,7 @@ static const struct sun8i_mixer_cfg sun8i_v3s_mixer_cfg = {
474 .ui_num = 1, 483 .ui_num = 1,
475 .scaler_mask = 0x3, 484 .scaler_mask = 0x3,
476 .ccsc = 0, 485 .ccsc = 0,
486 .mod_rate = 150000000,
477}; 487};
478 488
479static const struct of_device_id sun8i_mixer_of_table[] = { 489static const struct of_device_id sun8i_mixer_of_table[] = {
diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.h b/drivers/gpu/drm/sun4i/sun8i_mixer.h
index bc58040a88f9..f34e70c42adf 100644
--- a/drivers/gpu/drm/sun4i/sun8i_mixer.h
+++ b/drivers/gpu/drm/sun4i/sun8i_mixer.h
@@ -121,12 +121,15 @@ struct de2_fmt_info {
121 * Set value to 0 if this is first mixer or second mixer with VEP support. 121 * Set value to 0 if this is first mixer or second mixer with VEP support.
122 * Set value to 1 if this is second mixer without VEP support. Other values 122 * Set value to 1 if this is second mixer without VEP support. Other values
123 * are invalid. 123 * are invalid.
124 * @mod_rate: module clock rate that needs to be set in order to have
125 * a functional block.
124 */ 126 */
125struct sun8i_mixer_cfg { 127struct sun8i_mixer_cfg {
126 int vi_num; 128 int vi_num;
127 int ui_num; 129 int ui_num;
128 int scaler_mask; 130 int scaler_mask;
129 int ccsc; 131 int ccsc;
132 unsigned long mod_rate;
130}; 133};
131 134
132struct sun8i_mixer { 135struct sun8i_mixer {