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: <59b186dc70934320e9af6b2b916b5253fdaff444.camel@pengutronix.de>
Date:   Mon, 24 Apr 2023 08:53:00 +0200
From:   Lucas Stach <l.stach@...gutronix.de>
To:     Adam Ford <aford173@...il.com>, dri-devel@...ts.freedesktop.org
Cc:     m.szyprowski@...sung.com, aford@...conembedded.com,
        dario.binacchi@...rulasolutions.com,
        Inki Dae <inki.dae@...sung.com>,
        Jagan Teki <jagan@...rulasolutions.com>,
        Andrzej Hajda <andrzej.hajda@...el.com>,
        Neil Armstrong <neil.armstrong@...aro.org>,
        Robert Foss <rfoss@...nel.org>,
        Laurent Pinchart <Laurent.pinchart@...asonboard.com>,
        Jonas Karlman <jonas@...boo.se>,
        Jernej Skrabec <jernej.skrabec@...il.com>,
        David Airlie <airlied@...il.com>,
        Daniel Vetter <daniel@...ll.ch>, Marek Vasut <marex@...x.de>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH V2 2/6] drm: bridge: samsung-dsim: Fix PMS Calculator on
 imx8m[mnp]

Am Sonntag, dem 23.04.2023 um 07:12 -0500 schrieb Adam Ford:
> According to Table 13-45 of the i.MX8M Mini Reference Manual, the min
> and max values for M and the frequency range for the VCO_out
> calculator were incorrect.  This information was contradicted in other
> parts of the mini, nano and plus manuals.  After reaching out to my
> NXP Rep, when confronting him about discrepencies in the Nano manual,
> he responded with:
>  "Yes it is definitely wrong, the one that is part
>   of the NOTE in MIPI_DPHY_M_PLLPMS register table against PMS_P,
>   PMS_M and PMS_S is not correct. I will report this to Doc team,
>   the one customer should be take into account is the Table 13-40
>   DPHY PLL Parameters and the Note above."
> 
> These updated values also match what is used in the NXP downstream
> kernel.
> 
> To fix this, make new variables to hold the min and max values of m
> and the minimum value of VCO_out, and update the PMS calculator to
> use these new variables instead of using hard-coded values to keep
> the backwards compatibility with other parts using this driver.
> 
> Fixes: 4d562c70c4dc ("drm: bridge: samsung-dsim: Add i.MX8M Mini/Nano support")
> Signed-off-by: Adam Ford <aford173@...il.com>

Reviewed-by: Lucas Stach <l.stach@...gutronix.de>

> ---
>  drivers/gpu/drm/bridge/samsung-dsim.c | 22 ++++++++++++++++++++--
>  include/drm/bridge/samsung-dsim.h     |  3 +++
>  2 files changed, 23 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c
> index 2be3b58624c3..adb9c13c5f7f 100644
> --- a/drivers/gpu/drm/bridge/samsung-dsim.c
> +++ b/drivers/gpu/drm/bridge/samsung-dsim.c
> @@ -405,6 +405,9 @@ static const struct samsung_dsim_driver_data exynos3_dsi_driver_data = {
>  	.num_bits_resol = 11,
>  	.pll_p_offset = 13,
>  	.reg_values = reg_values,
> +	.m_min = 41,
> +	.m_max = 125,
> +	.vco_min = 500,
>  };
>  
>  static const struct samsung_dsim_driver_data exynos4_dsi_driver_data = {
> @@ -418,6 +421,9 @@ static const struct samsung_dsim_driver_data exynos4_dsi_driver_data = {
>  	.num_bits_resol = 11,
>  	.pll_p_offset = 13,
>  	.reg_values = reg_values,
> +	.m_min = 41,
> +	.m_max = 125,
> +	.vco_min = 500,
>  };
>  
>  static const struct samsung_dsim_driver_data exynos5_dsi_driver_data = {
> @@ -429,6 +435,9 @@ static const struct samsung_dsim_driver_data exynos5_dsi_driver_data = {
>  	.num_bits_resol = 11,
>  	.pll_p_offset = 13,
>  	.reg_values = reg_values,
> +	.m_min = 41,
> +	.m_max = 125,
> +	.vco_min = 500,
>  };
>  
>  static const struct samsung_dsim_driver_data exynos5433_dsi_driver_data = {
> @@ -441,6 +450,9 @@ static const struct samsung_dsim_driver_data exynos5433_dsi_driver_data = {
>  	.num_bits_resol = 12,
>  	.pll_p_offset = 13,
>  	.reg_values = exynos5433_reg_values,
> +	.m_min = 41,
> +	.m_max = 125,
> +	.vco_min = 500,
>  };
>  
>  static const struct samsung_dsim_driver_data exynos5422_dsi_driver_data = {
> @@ -453,6 +465,9 @@ static const struct samsung_dsim_driver_data exynos5422_dsi_driver_data = {
>  	.num_bits_resol = 12,
>  	.pll_p_offset = 13,
>  	.reg_values = exynos5422_reg_values,
> +	.m_min = 41,
> +	.m_max = 125,
> +	.vco_min = 500,
>  };
>  
>  static const struct samsung_dsim_driver_data imx8mm_dsi_driver_data = {
> @@ -469,6 +484,9 @@ static const struct samsung_dsim_driver_data imx8mm_dsi_driver_data = {
>  	 */
>  	.pll_p_offset = 14,
>  	.reg_values = imx8mm_dsim_reg_values,
> +	.m_min = 64,
> +	.m_max = 1023,
> +	.vco_min = 1050,
>  };
>  
>  static const struct samsung_dsim_driver_data *
> @@ -547,12 +565,12 @@ static unsigned long samsung_dsim_pll_find_pms(struct samsung_dsim *dsi,
>  			tmp = (u64)fout * (_p << _s);
>  			do_div(tmp, fin);
>  			_m = tmp;
> -			if (_m < 41 || _m > 125)
> +			if (_m < driver_data->m_min || _m > driver_data->m_max)
>  				continue;
>  
>  			tmp = (u64)_m * fin;
>  			do_div(tmp, _p);
> -			if (tmp < 500 * MHZ ||
> +			if (tmp < driver_data->vco_min  * MHZ ||
>  			    tmp > driver_data->max_freq * MHZ)
>  				continue;
>  
> diff --git a/include/drm/bridge/samsung-dsim.h b/include/drm/bridge/samsung-dsim.h
> index ba5484de2b30..a088d84579bc 100644
> --- a/include/drm/bridge/samsung-dsim.h
> +++ b/include/drm/bridge/samsung-dsim.h
> @@ -59,6 +59,9 @@ struct samsung_dsim_driver_data {
>  	unsigned int num_bits_resol;
>  	unsigned int pll_p_offset;
>  	const unsigned int *reg_values;
> +	u16 m_min;
> +	u16 m_max;
> +	u64 vco_min;
>  };
>  
>  struct samsung_dsim_host_ops {

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ