linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/hisilicon: add the mode_valid function
@ 2020-01-08  8:19 Tian Tao
  2020-01-08  8:48 ` Thomas Zimmermann
  0 siblings, 1 reply; 3+ messages in thread
From: Tian Tao @ 2020-01-08  8:19 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, and we can also use it to make suse the resolution
is valid.

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Signed-off-by: Gong junjie <gongjunjie2@huawei.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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/hisilicon: add the mode_valid function
  2020-01-08  8:19 [PATCH] drm/hisilicon: add the mode_valid function Tian Tao
@ 2020-01-08  8:48 ` Thomas Zimmermann
  2020-01-08  8:58   ` 答复: " tiantao (H)
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Zimmermann @ 2020-01-08  8:48 UTC (permalink / raw)
  To: Tian Tao, puck.chen, airlied, daniel, kraxel, alexander.deucher,
	tglx, dri-devel, xinliang.liu, linux-kernel
  Cc: linuxarm


[-- Attachment #1.1: Type: text/plain, Size: 2376 bytes --]

Hi,

here are a few more nits to fix.

Am 08.01.20 um 09:19 schrieb Tian Tao:
> add mode_valid function, and we can also use it to make suse the resolution
> is valid.

Start with capital 'Add' and make it a simple sentence. Change 'suse' to
'sure'

> 
> Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
> Signed-off-by: Gong junjie <gongjunjie2@huawei.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)

Please declare this function as static.

> +{
> +	int i = 0;
> +	int vrefresh = drm_mode_vrefresh(mode);
> +
> +	if (vrefresh < 59 || vrefresh > 61)
> +		return MODE_NOMODE;

I'd return MODE_NOCLOCK or MODE_CLOCK_RANGE.

> +
> +	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;

Maybe return MODE_BAD. MODE_NOMODE apparently refers to a descriptive
string for the mode.

> +}
> +
> +

One one empty line please.

With these fixes applied, you can add my

Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>

Best regards
Thomas


>  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)
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* 答复: [PATCH] drm/hisilicon: add the mode_valid function
  2020-01-08  8:48 ` Thomas Zimmermann
@ 2020-01-08  8:58   ` tiantao (H)
  0 siblings, 0 replies; 3+ messages in thread
From: tiantao (H) @ 2020-01-08  8:58 UTC (permalink / raw)
  To: Thomas Zimmermann, Chenfeng (puck),
	airlied, daniel, kraxel, alexander.deucher, tglx, dri-devel,
	xinliang.liu, linux-kernel
  Cc: Linuxarm

Hi Thomas Zimmermann:

	I will modify this patch and send v2 as you suggested.
	Thank you very much.

Best

-----邮件原件-----
发件人: Thomas Zimmermann [mailto:tzimmermann@suse.de] 
发送时间: 2020年1月8日 16:49
收件人: tiantao (H) <tiantao6@hisilicon.com>; Chenfeng (puck) <puck.chen@hisilicon.com>; airlied@linux.ie; daniel@ffwll.ch; kraxel@redhat.com; alexander.deucher@amd.com; tglx@linutronix.de; dri-devel@lists.freedesktop.org; xinliang.liu@linaro.org; linux-kernel@vger.kernel.org
抄送: Linuxarm <linuxarm@huawei.com>
主题: Re: [PATCH] drm/hisilicon: add the mode_valid function

Hi,

here are a few more nits to fix.

Am 08.01.20 um 09:19 schrieb Tian Tao:
> add mode_valid function, and we can also use it to make suse the 
> resolution is valid.

Start with capital 'Add' and make it a simple sentence. Change 'suse' to 'sure'

> 
> Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
> Signed-off-by: Gong junjie <gongjunjie2@huawei.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)

Please declare this function as static.

> +{
> +	int i = 0;
> +	int vrefresh = drm_mode_vrefresh(mode);
> +
> +	if (vrefresh < 59 || vrefresh > 61)
> +		return MODE_NOMODE;

I'd return MODE_NOCLOCK or MODE_CLOCK_RANGE.

> +
> +	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;

Maybe return MODE_BAD. MODE_NOMODE apparently refers to a descriptive string for the mode.

> +}
> +
> +

One one empty line please.

With these fixes applied, you can add my

Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>

Best regards
Thomas


>  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)
> 

--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-01-08  8:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-08  8:19 [PATCH] drm/hisilicon: add the mode_valid function Tian Tao
2020-01-08  8:48 ` Thomas Zimmermann
2020-01-08  8:58   ` 答复: " tiantao (H)

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).