lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240415-venomous-enthusiastic-wildebeest-a7a446@houat>
Date: Mon, 15 Apr 2024 09:40:47 +0200
From: Maxime Ripard <mripard@...nel.org>
To: Jayesh Choudhary <j-choudhary@...com>
Cc: andrzej.hajda@...el.com, neil.armstrong@...aro.org, rfoss@...nel.org, 
	Laurent.pinchart@...asonboard.com, jonas@...boo.se, jernej.skrabec@...il.com, 
	maarten.lankhorst@...ux.intel.com, tzimmermann@...e.de, airlied@...il.com, daniel@...ll.ch, 
	dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drm/bridge: sii902x: Fix mode_valid hook

Hi,

On Mon, Apr 08, 2024 at 01:44:35PM +0530, Jayesh Choudhary wrote:
> Currently, mode_valid hook returns all mode as valid. Add the check
> for the maximum and minimum pixel clock that the bridge can support
> while validating a mode.
> 
> Signed-off-by: Jayesh Choudhary <j-choudhary@...com>
> ---
>  drivers/gpu/drm/bridge/sii902x.c | 16 +++++++++++++++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/bridge/sii902x.c b/drivers/gpu/drm/bridge/sii902x.c
> index 8f84e98249c7..658819199c84 100644
> --- a/drivers/gpu/drm/bridge/sii902x.c
> +++ b/drivers/gpu/drm/bridge/sii902x.c
> @@ -163,6 +163,16 @@
>  
>  #define SII902X_AUDIO_PORT_INDEX		3
>  
> +/*
> + * The maximum resolution supported by the HDMI bridge is 1080p@...z
> + * and 1920x1200 requiring a pixel clock of 165MHz and the minimum
> + * resolution supported is 480p@...z requiring a pixel clock of 25MHz
> + *
> + * (drm_display_mode clock is in kHz)
> + */
> +#define SII902X_MIN_PIXEL_CLOCK			25000
> +#define SII902X_MAX_PIXEL_CLOCK			165000
> +

You should probably add a KHZ suffix or something to make it obvious.
The natural unit for a frequency is Hertz.

>  struct sii902x {
>  	struct i2c_client *i2c;
>  	struct regmap *regmap;
> @@ -313,7 +323,11 @@ static int sii902x_get_modes(struct drm_connector *connector)
>  static enum drm_mode_status sii902x_mode_valid(struct drm_connector *connector,
>  					       struct drm_display_mode *mode)
>  {
> -	/* TODO: check mode */
> +	if (mode->clock < SII902X_MIN_PIXEL_CLOCK)
> +		return MODE_CLOCK_LOW;
> +
> +	if (mode->clock > SII902X_MAX_PIXEL_CLOCK)
> +		return MODE_CLOCK_HIGH;
>  
>  	return MODE_OK;
>  }

It's something you should do in atomic_check too

Maxime

Download attachment "signature.asc" of type "application/pgp-signature" (274 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ