[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1578471540-43322-1-git-send-email-tiantao6@hisilicon.com>
Date: Wed, 8 Jan 2020 16:19:00 +0800
From: Tian Tao <tiantao6@...ilicon.com>
To: <puck.chen@...ilicon.com>, <airlied@...ux.ie>, <daniel@...ll.ch>,
<tzimmermann@...e.de>, <kraxel@...hat.com>,
<alexander.deucher@....com>, <tglx@...utronix.de>,
<dri-devel@...ts.freedesktop.org>, <xinliang.liu@...aro.org>,
<linux-kernel@...r.kernel.org>
CC: <linuxarm@...wei.com>
Subject: [PATCH] drm/hisilicon: add the mode_valid function
add mode_valid function, and we can also use it to make suse the resolution
is valid.
Signed-off-by: Tian Tao <tiantao6@...ilicon.com>
Signed-off-by: Gong junjie <gongjunjie2@...wei.com>
---
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
index 843d784..6cb7a79 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
@@ -242,6 +242,25 @@ static void hibmc_crtc_atomic_disable(struct drm_crtc *crtc,
hibmc_set_current_gate(priv, reg);
}
+enum drm_mode_status hibmc_crtc_mode_valid(struct drm_crtc *crtc,
+ const struct drm_display_mode *mode)
+{
+ int i = 0;
+ int vrefresh = drm_mode_vrefresh(mode);
+
+ if (vrefresh < 59 || vrefresh > 61)
+ return MODE_NOMODE;
+
+ for (i = 0; i < ARRAY_SIZE(hibmc_pll_table); i++) {
+ if (hibmc_pll_table[i].hdisplay == mode->hdisplay &&
+ hibmc_pll_table[i].vdisplay == mode->vdisplay)
+ return MODE_OK;
+ }
+
+ return MODE_NOMODE;
+}
+
+
static unsigned int format_pll_reg(void)
{
unsigned int pllreg = 0;
@@ -510,6 +529,7 @@ static const struct drm_crtc_helper_funcs hibmc_crtc_helper_funcs = {
.atomic_flush = hibmc_crtc_atomic_flush,
.atomic_enable = hibmc_crtc_atomic_enable,
.atomic_disable = hibmc_crtc_atomic_disable,
+ .mode_valid = hibmc_crtc_mode_valid,
};
int hibmc_de_init(struct hibmc_drm_private *priv)
--
2.7.4
Powered by blists - more mailing lists