* [PATCH v2] drm/hisilicon: Add the mode_valid function
@ 2020-01-08 9:41 Tian Tao
2020-02-27 4:41 ` Xinliang Liu
0 siblings, 1 reply; 2+ messages in thread
From: Tian Tao @ 2020-01-08 9:41 UTC (permalink / raw)
To: puck.chen, airlied, daniel, tzimmermann, kraxel,
alexander.deucher, tglx, dri-devel, xinliang.liu, linux-kernel
Cc: linuxarm
add mode_valid function, we can make sure the resolution is valid.
Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Signed-off-by: Gong junjie <gongjunjie2@huawei.com>
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
---
v2: declare hibmc_crtc_mode_valid as static.
Modify the return value of hibmc_crtc_mode_valid .
---
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c | 19 +++++++++++++++++++
1 file changed, 19 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..675d629 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
@@ -242,6 +242,24 @@ static void hibmc_crtc_atomic_disable(struct drm_crtc *crtc,
hibmc_set_current_gate(priv, reg);
}
+static 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_NOCLOCK;
+
+ 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_BAD;
+}
+
static unsigned int format_pll_reg(void)
{
unsigned int pllreg = 0;
@@ -510,6 +528,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
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] drm/hisilicon: Add the mode_valid function
2020-01-08 9:41 [PATCH v2] drm/hisilicon: Add the mode_valid function Tian Tao
@ 2020-02-27 4:41 ` Xinliang Liu
0 siblings, 0 replies; 2+ messages in thread
From: Xinliang Liu @ 2020-02-27 4:41 UTC (permalink / raw)
To: Tian Tao
Cc: airlied, puck.chen, linux-kernel, dri-devel, linuxarm, kraxel,
tzimmermann, alexander.deucher, tglx
[-- Attachment #1.1: Type: text/plain, Size: 2074 bytes --]
Thanks for the patch.
Applied to drm-misc-next.
On Wed, 8 Jan 2020 at 17:41, Tian Tao <tiantao6@hisilicon.com> wrote:
> add mode_valid function, we can make sure the resolution is valid.
>
> Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
> Signed-off-by: Gong junjie <gongjunjie2@huawei.com>
> Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
>
> ---
> v2: declare hibmc_crtc_mode_valid as static.
> Modify the return value of hibmc_crtc_mode_valid .
> ---
> drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c | 19 +++++++++++++++++++
> 1 file changed, 19 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..675d629 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
> @@ -242,6 +242,24 @@ static void hibmc_crtc_atomic_disable(struct drm_crtc
> *crtc,
> hibmc_set_current_gate(priv, reg);
> }
>
> +static 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_NOCLOCK;
> +
> + 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_BAD;
> +}
> +
> static unsigned int format_pll_reg(void)
> {
> unsigned int pllreg = 0;
> @@ -510,6 +528,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
>
>
[-- Attachment #1.2: Type: text/html, Size: 2862 bytes --]
[-- Attachment #2: Type: text/plain, Size: 160 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-02-27 8:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-08 9:41 [PATCH v2] drm/hisilicon: Add the mode_valid function Tian Tao
2020-02-27 4:41 ` Xinliang Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).