All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: "Ricardo Cañuelo" <ricardo.canuelo@collabora.com>
Cc: kernel@collabora.com, devicetree@vger.kernel.org,
	dri-devel@lists.freedesktop.org,
	linux-arm-kernel@lists.infradead.org, jason@lakedaemon.net,
	tomi.valkeinen@ti.com, robh+dt@kernel.org, airlied@linux.ie,
	shawnguo@kernel.org
Subject: Re: [PATCH v2 4/4] drm/bridge: tfp410: Fix setup and hold time calculation
Date: Fri, 29 May 2020 00:46:07 +0300	[thread overview]
Message-ID: <20200528214607.GB14756@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20200514143612.2094-5-ricardo.canuelo@collabora.com>

Hi Ricardo,

Thank you for the patch.

On Thu, May 14, 2020 at 04:36:12PM +0200, Ricardo Cañuelo wrote:
> The tfp410 has a data de-skew feature that allows the user to compensate
> the skew between IDCK and the pixel data and control signals.
> 
> In the driver, the setup and hold times are calculated from the de-skew
> value. This retrieves the deskew value from the DT using the proper
> datatype and range check as described by the binding (u32 from 0 to 7)
> and fixes the calculation of the setup and hold times.

How about mentioning that the fix results from a change in the DT
bindings ? Otherwise it sounds it was a bug in the driver.

I would also mention that the patch fixes the min() calculation, which
was clearly wrong. I think I would have split this in two patches.

With this addressed,

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> Signed-off-by: Ricardo Cañuelo <ricardo.canuelo@collabora.com>
> ---
>  drivers/gpu/drm/bridge/ti-tfp410.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/ti-tfp410.c b/drivers/gpu/drm/bridge/ti-tfp410.c
> index e3eb6364c0f7..21d99b4ea0c9 100644
> --- a/drivers/gpu/drm/bridge/ti-tfp410.c
> +++ b/drivers/gpu/drm/bridge/ti-tfp410.c
> @@ -220,7 +220,7 @@ static int tfp410_parse_timings(struct tfp410 *dvi, bool i2c)
>  	struct device_node *ep;
>  	u32 pclk_sample = 0;
>  	u32 bus_width = 24;
> -	s32 deskew = 0;
> +	u32 deskew = 0;
>  
>  	/* Start with defaults. */
>  	*timings = tfp410_default_timings;
> @@ -274,12 +274,12 @@ static int tfp410_parse_timings(struct tfp410 *dvi, bool i2c)
>  	}
>  
>  	/* Get the setup and hold time from vendor-specific properties. */
> -	of_property_read_u32(dvi->dev->of_node, "ti,deskew", (u32 *)&deskew);
> -	if (deskew < -4 || deskew > 3)
> +	of_property_read_u32(dvi->dev->of_node, "ti,deskew", &deskew);
> +	if (deskew > 7)
>  		return -EINVAL;
>  
> -	timings->setup_time_ps = min(0, 1200 - 350 * deskew);
> -	timings->hold_time_ps = min(0, 1300 + 350 * deskew);
> +	timings->setup_time_ps = 1200 - 350 * ((s32)deskew - 4);
> +	timings->hold_time_ps = max(0, 1300 + 350 * ((s32)deskew - 4));
>  
>  	return 0;
>  }

-- 
Regards,

Laurent Pinchart

WARNING: multiple messages have this Message-ID (diff)
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: "Ricardo Cañuelo" <ricardo.canuelo@collabora.com>
Cc: devicetree@vger.kernel.org, jason@lakedaemon.net,
	airlied@linux.ie, dri-devel@lists.freedesktop.org,
	robh+dt@kernel.org, tomi.valkeinen@ti.com, kernel@collabora.com,
	shawnguo@kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 4/4] drm/bridge: tfp410: Fix setup and hold time calculation
Date: Fri, 29 May 2020 00:46:07 +0300	[thread overview]
Message-ID: <20200528214607.GB14756@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20200514143612.2094-5-ricardo.canuelo@collabora.com>

Hi Ricardo,

Thank you for the patch.

On Thu, May 14, 2020 at 04:36:12PM +0200, Ricardo Cañuelo wrote:
> The tfp410 has a data de-skew feature that allows the user to compensate
> the skew between IDCK and the pixel data and control signals.
> 
> In the driver, the setup and hold times are calculated from the de-skew
> value. This retrieves the deskew value from the DT using the proper
> datatype and range check as described by the binding (u32 from 0 to 7)
> and fixes the calculation of the setup and hold times.

How about mentioning that the fix results from a change in the DT
bindings ? Otherwise it sounds it was a bug in the driver.

I would also mention that the patch fixes the min() calculation, which
was clearly wrong. I think I would have split this in two patches.

With this addressed,

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> Signed-off-by: Ricardo Cañuelo <ricardo.canuelo@collabora.com>
> ---
>  drivers/gpu/drm/bridge/ti-tfp410.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/ti-tfp410.c b/drivers/gpu/drm/bridge/ti-tfp410.c
> index e3eb6364c0f7..21d99b4ea0c9 100644
> --- a/drivers/gpu/drm/bridge/ti-tfp410.c
> +++ b/drivers/gpu/drm/bridge/ti-tfp410.c
> @@ -220,7 +220,7 @@ static int tfp410_parse_timings(struct tfp410 *dvi, bool i2c)
>  	struct device_node *ep;
>  	u32 pclk_sample = 0;
>  	u32 bus_width = 24;
> -	s32 deskew = 0;
> +	u32 deskew = 0;
>  
>  	/* Start with defaults. */
>  	*timings = tfp410_default_timings;
> @@ -274,12 +274,12 @@ static int tfp410_parse_timings(struct tfp410 *dvi, bool i2c)
>  	}
>  
>  	/* Get the setup and hold time from vendor-specific properties. */
> -	of_property_read_u32(dvi->dev->of_node, "ti,deskew", (u32 *)&deskew);
> -	if (deskew < -4 || deskew > 3)
> +	of_property_read_u32(dvi->dev->of_node, "ti,deskew", &deskew);
> +	if (deskew > 7)
>  		return -EINVAL;
>  
> -	timings->setup_time_ps = min(0, 1200 - 350 * deskew);
> -	timings->hold_time_ps = min(0, 1300 + 350 * deskew);
> +	timings->setup_time_ps = 1200 - 350 * ((s32)deskew - 4);
> +	timings->hold_time_ps = max(0, 1300 + 350 * ((s32)deskew - 4));
>  
>  	return 0;
>  }

-- 
Regards,

Laurent Pinchart

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: "Ricardo Cañuelo" <ricardo.canuelo@collabora.com>
Cc: devicetree@vger.kernel.org, jason@lakedaemon.net,
	airlied@linux.ie, dri-devel@lists.freedesktop.org,
	robh+dt@kernel.org, tomi.valkeinen@ti.com, kernel@collabora.com,
	shawnguo@kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 4/4] drm/bridge: tfp410: Fix setup and hold time calculation
Date: Fri, 29 May 2020 00:46:07 +0300	[thread overview]
Message-ID: <20200528214607.GB14756@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20200514143612.2094-5-ricardo.canuelo@collabora.com>

Hi Ricardo,

Thank you for the patch.

On Thu, May 14, 2020 at 04:36:12PM +0200, Ricardo Cañuelo wrote:
> The tfp410 has a data de-skew feature that allows the user to compensate
> the skew between IDCK and the pixel data and control signals.
> 
> In the driver, the setup and hold times are calculated from the de-skew
> value. This retrieves the deskew value from the DT using the proper
> datatype and range check as described by the binding (u32 from 0 to 7)
> and fixes the calculation of the setup and hold times.

How about mentioning that the fix results from a change in the DT
bindings ? Otherwise it sounds it was a bug in the driver.

I would also mention that the patch fixes the min() calculation, which
was clearly wrong. I think I would have split this in two patches.

With this addressed,

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> Signed-off-by: Ricardo Cañuelo <ricardo.canuelo@collabora.com>
> ---
>  drivers/gpu/drm/bridge/ti-tfp410.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/ti-tfp410.c b/drivers/gpu/drm/bridge/ti-tfp410.c
> index e3eb6364c0f7..21d99b4ea0c9 100644
> --- a/drivers/gpu/drm/bridge/ti-tfp410.c
> +++ b/drivers/gpu/drm/bridge/ti-tfp410.c
> @@ -220,7 +220,7 @@ static int tfp410_parse_timings(struct tfp410 *dvi, bool i2c)
>  	struct device_node *ep;
>  	u32 pclk_sample = 0;
>  	u32 bus_width = 24;
> -	s32 deskew = 0;
> +	u32 deskew = 0;
>  
>  	/* Start with defaults. */
>  	*timings = tfp410_default_timings;
> @@ -274,12 +274,12 @@ static int tfp410_parse_timings(struct tfp410 *dvi, bool i2c)
>  	}
>  
>  	/* Get the setup and hold time from vendor-specific properties. */
> -	of_property_read_u32(dvi->dev->of_node, "ti,deskew", (u32 *)&deskew);
> -	if (deskew < -4 || deskew > 3)
> +	of_property_read_u32(dvi->dev->of_node, "ti,deskew", &deskew);
> +	if (deskew > 7)
>  		return -EINVAL;
>  
> -	timings->setup_time_ps = min(0, 1200 - 350 * deskew);
> -	timings->hold_time_ps = min(0, 1300 + 350 * deskew);
> +	timings->setup_time_ps = 1200 - 350 * ((s32)deskew - 4);
> +	timings->hold_time_ps = max(0, 1300 + 350 * ((s32)deskew - 4));
>  
>  	return 0;
>  }

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2020-05-28 21:46 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-14 14:36 [PATCH v2 0/4] dt-bindings: display: ti,tfp410.txt: convert to yaml Ricardo Cañuelo
2020-05-14 14:36 ` Ricardo Cañuelo
2020-05-14 14:36 ` Ricardo Cañuelo
2020-05-14 14:36 ` [PATCH v2 1/4] ARM: dts: dove: Make the DT compliant with the ti,tfp410 binding Ricardo Cañuelo
2020-05-14 14:36   ` [PATCH v2 1/4] ARM: dts: dove: Make the DT compliant with the ti, tfp410 binding Ricardo Cañuelo
2020-05-14 14:36   ` Ricardo Cañuelo
2020-05-28 17:37   ` [PATCH v2 1/4] ARM: dts: dove: Make the DT compliant with the ti,tfp410 binding Rob Herring
2020-05-28 17:37     ` Rob Herring
2020-05-28 17:37     ` Rob Herring
2020-05-28 21:12     ` Laurent Pinchart
2020-05-28 21:12       ` Laurent Pinchart
2020-05-28 21:12       ` Laurent Pinchart
2020-05-14 14:36 ` [PATCH v2 2/4] ARM: dts: ims53: Group port definitions for the dvi-converter Ricardo Cañuelo
2020-05-14 14:36   ` Ricardo Cañuelo
2020-05-14 14:36   ` Ricardo Cañuelo
2020-05-20  2:57   ` Shawn Guo
2020-05-20  2:57     ` Shawn Guo
2020-05-20  2:57     ` Shawn Guo
2020-05-14 14:36 ` [PATCH v2 3/4] dt-bindings: display: ti,tfp410.txt: convert to yaml Ricardo Cañuelo
2020-05-14 14:36   ` Ricardo Cañuelo
2020-05-14 14:36   ` Ricardo Cañuelo
2020-05-28 21:43   ` Laurent Pinchart
2020-05-28 21:43     ` Laurent Pinchart
2020-05-28 21:43     ` Laurent Pinchart
2020-05-14 14:36 ` [PATCH v2 4/4] drm/bridge: tfp410: Fix setup and hold time calculation Ricardo Cañuelo
2020-05-14 14:36   ` Ricardo Cañuelo
2020-05-14 14:36   ` Ricardo Cañuelo
2020-05-28 21:46   ` Laurent Pinchart [this message]
2020-05-28 21:46     ` Laurent Pinchart
2020-05-28 21:46     ` Laurent Pinchart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200528214607.GB14756@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=airlied@linux.ie \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jason@lakedaemon.net \
    --cc=kernel@collabora.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=ricardo.canuelo@collabora.com \
    --cc=robh+dt@kernel.org \
    --cc=shawnguo@kernel.org \
    --cc=tomi.valkeinen@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.