<div dir="ltr">Thanks for the patch.<br>Applied to drm-misc-next.<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 8 Jan 2020 at 17:41, Tian Tao <<a href="mailto:tiantao6@hisilicon.com">tiantao6@hisilicon.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">add mode_valid function, we can make sure the resolution is valid.<br>
<br>
Signed-off-by: Tian Tao <<a href="mailto:tiantao6@hisilicon.com" target="_blank">tiantao6@hisilicon.com</a>><br>
Signed-off-by: Gong junjie <<a href="mailto:gongjunjie2@huawei.com" target="_blank">gongjunjie2@huawei.com</a>><br>
Reviewed-by: Thomas Zimmermann <<a href="mailto:tzimmermann@suse.de" target="_blank">tzimmermann@suse.de</a>><br>
<br>
---<br>
v2: declare hibmc_crtc_mode_valid as static.<br>
Modify the return value of hibmc_crtc_mode_valid .<br>
---<br>
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c | 19 +++++++++++++++++++<br>
1 file changed, 19 insertions(+)<br>
<br>
diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c<br>
index 843d784..675d629 100644<br>
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c<br>
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c<br>
@@ -242,6 +242,24 @@ static void hibmc_crtc_atomic_disable(struct drm_crtc *crtc,<br>
hibmc_set_current_gate(priv, reg);<br>
}<br>
<br>
+static enum drm_mode_status hibmc_crtc_mode_valid(struct drm_crtc *crtc,<br>
+ const struct drm_display_mode *mode)<br>
+{<br>
+ int i = 0;<br>
+ int vrefresh = drm_mode_vrefresh(mode);<br>
+<br>
+ if (vrefresh < 59 || vrefresh > 61)<br>
+ return MODE_NOCLOCK;<br>
+<br>
+ for (i = 0; i < ARRAY_SIZE(hibmc_pll_table); i++) {<br>
+ if (hibmc_pll_table[i].hdisplay == mode->hdisplay &&<br>
+ hibmc_pll_table[i].vdisplay == mode->vdisplay)<br>
+ return MODE_OK;<br>
+ }<br>
+<br>
+ return MODE_BAD;<br>
+}<br>
+<br>
static unsigned int format_pll_reg(void)<br>
{<br>
unsigned int pllreg = 0;<br>
@@ -510,6 +528,7 @@ static const struct drm_crtc_helper_funcs hibmc_crtc_helper_funcs = {<br>
.atomic_flush = hibmc_crtc_atomic_flush,<br>
.atomic_enable = hibmc_crtc_atomic_enable,<br>
.atomic_disable = hibmc_crtc_atomic_disable,<br>
+ .mode_valid = hibmc_crtc_mode_valid,<br>
};<br>
<br>
int hibmc_de_init(struct hibmc_drm_private *priv)<br>
-- <br>
2.7.4<br>
<br>
</blockquote></div>