linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jose Abreu <Jose.Abreu@synopsys.com>
To: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>,
	<dri-devel@lists.freedesktop.org>
Cc: Andy Yan <andy.yan@rock-chips.com>,
	Fabio Estevam <fabio.estevam@freescale.com>,
	Jose Abreu <Jose.Abreu@synopsys.com>,
	"Kieran Bingham" <kieran.bingham@ideasonboard.com>,
	Russell King <rmk+kernel@arm.linux.org.uk>,
	Ulrich Hecht <ulrich.hecht@gmail.com>,
	Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>,
	<linux-renesas-soc@vger.kernel.org>
Subject: Re: [PATCH v2 15/29] drm: bridge: dw-hdmi: Handle overflow workaround based on device version
Date: Tue, 20 Dec 2016 11:32:07 +0000	[thread overview]
Message-ID: <1d559621-12c9-c41c-f9d4-9ed3c62e3453@synopsys.com> (raw)
In-Reply-To: <20161220013400.28317-16-laurent.pinchart+renesas@ideasonboard.com>

Hi Laurent,


On 20-12-2016 01:33, Laurent Pinchart wrote:
> Use the device version queried at runtime instead of the device type
> provided through platform data to handle the overflow workaround. This
> will make support of other SoCs integrating the same HDMI TX controller
> version easier.
>
> Among the supported platforms only i.MX6DL and i.MX6Q have been
> identified as needing the workaround. Disabling it on Rockchip RK3288
> (which integrates a v2.00a controller) didn't produce any error or
> artifact.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

Reviewed-by: Jose Abreu <joabreu@synopsys.com>

Best regards,
Jose Miguel Abreu
> ---
>  drivers/gpu/drm/bridge/dw-hdmi.c | 46 ++++++++++++++++++++++++++++------------
>  1 file changed, 33 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/dw-hdmi.c b/drivers/gpu/drm/bridge/dw-hdmi.c
> index 730a7558d4d4..f4faa14213e5 100644
> --- a/drivers/gpu/drm/bridge/dw-hdmi.c
> +++ b/drivers/gpu/drm/bridge/dw-hdmi.c
> @@ -117,8 +117,10 @@ struct dw_hdmi {
>  	struct drm_connector connector;
>  	struct drm_bridge bridge;
>  
> -	struct platform_device *audio;
>  	enum dw_hdmi_devtype dev_type;
> +	unsigned int version;
> +
> +	struct platform_device *audio;
>  	struct device *dev;
>  	struct clk *isfr_clk;
>  	struct clk *iahb_clk;
> @@ -1323,19 +1325,38 @@ static void hdmi_enable_audio_clk(struct dw_hdmi *hdmi)
>  /* Workaround to clear the overflow condition */
>  static void dw_hdmi_clear_overflow(struct dw_hdmi *hdmi)
>  {
> -	int count;
> +	unsigned int count;
> +	unsigned int i;
>  	u8 val;
>  
> -	/* TMDS software reset */
> -	hdmi_writeb(hdmi, (u8)~HDMI_MC_SWRSTZ_TMDSSWRST_REQ, HDMI_MC_SWRSTZ);
> +	/*
> +	 * Under some circumstances the Frame Composer arithmetic unit can miss
> +	 * an FC register write due to being busy processing the previous one.
> +	 * The issue can be worked around by issuing a TMDS software reset and
> +	 * then write one of the FC registers several times.
> +	 *
> +	 * The number of iterations matters and depends on the HDMI TX revision
> +	 * (and possibly on the platform). So far only i.MX6Q (v1.30a) and
> +	 * i.MX6DL (v1.31a) have been identified as needing the workaround, with
> +	 * 4 and 1 iterations respectively.
> +	 */
>  
> -	val = hdmi_readb(hdmi, HDMI_FC_INVIDCONF);
> -	if (hdmi->dev_type == IMX6DL_HDMI) {
> -		hdmi_writeb(hdmi, val, HDMI_FC_INVIDCONF);
> +	switch (hdmi->version) {
> +	case 0x130a:
> +		count = 4;
> +		break;
> +	case 0x131a:
> +		count = 1;
> +		break;
> +	default:
>  		return;
>  	}
>  
> -	for (count = 0; count < 4; count++)
> +	/* TMDS software reset */
> +	hdmi_writeb(hdmi, (u8)~HDMI_MC_SWRSTZ_TMDSSWRST_REQ, HDMI_MC_SWRSTZ);
> +
> +	val = hdmi_readb(hdmi, HDMI_FC_INVIDCONF);
> +	for (i = 0; i < count; i++)
>  		hdmi_writeb(hdmi, val, HDMI_FC_INVIDCONF);
>  }
>  
> @@ -1832,7 +1853,6 @@ __dw_hdmi_probe(struct platform_device *pdev,
>  	int irq;
>  	int ret;
>  	u32 val = 1;
> -	u16 version;
>  	u8 prod_id0;
>  	u8 prod_id1;
>  	u8 config0;
> @@ -1917,21 +1937,21 @@ __dw_hdmi_probe(struct platform_device *pdev,
>  	}
>  
>  	/* Product and revision IDs */
> -	version = (hdmi_readb(hdmi, HDMI_DESIGN_ID) << 8)
> -		| (hdmi_readb(hdmi, HDMI_REVISION_ID) << 0);
> +	hdmi->version = (hdmi_readb(hdmi, HDMI_DESIGN_ID) << 8)
> +		      | (hdmi_readb(hdmi, HDMI_REVISION_ID) << 0);
>  	prod_id0 = hdmi_readb(hdmi, HDMI_PRODUCT_ID0);
>  	prod_id1 = hdmi_readb(hdmi, HDMI_PRODUCT_ID1);
>  
>  	if (prod_id0 != HDMI_PRODUCT_ID0_HDMI_TX ||
>  	    (prod_id1 & ~HDMI_PRODUCT_ID1_HDCP) != HDMI_PRODUCT_ID1_HDMI_TX) {
>  		dev_err(dev, "Unsupported HDMI controller (%04x:%02x:%02x)\n",
> -			version, prod_id0, prod_id1);
> +			hdmi->version, prod_id0, prod_id1);
>  		ret = -ENODEV;
>  		goto err_iahb;
>  	}
>  
>  	dev_info(dev, "Detected HDMI TX controller v%x.%03x %s HDCP\n",
> -		 version >> 12, version & 0xfff,
> +		 hdmi->version >> 12, hdmi->version & 0xfff,
>  		 prod_id1 & HDMI_PRODUCT_ID1_HDCP ? "with" : "without");
>  
>  	initialize_hdmi_ih_mutes(hdmi);

  reply	other threads:[~2016-12-20 11:32 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-20  1:33 [PATCH v2 00/29] R-Car Gen3 HDMI output support Laurent Pinchart
2016-12-20  1:33 ` [PATCH v2 01/29] drm: bridge: dw-hdmi: Merge __hdmi_phy_i2c_write and hdmi_phy_i2c_write Laurent Pinchart
2016-12-20  1:33 ` [PATCH v2 02/29] drm: bridge: dw-hdmi: Remove unneeded arguments to bind/unbind functions Laurent Pinchart
2016-12-20  1:33 ` [PATCH v2 03/29] drm: bridge: dw-hdmi: Remove unused function parameter Laurent Pinchart
2016-12-20  1:33 ` [PATCH v2 04/29] drm: bridge: dw-hdmi: Embed drm_bridge in struct dw_hdmi Laurent Pinchart
2016-12-20  1:33 ` [PATCH v2 05/29] drm: bridge: dw-hdmi: Remove encoder field from " Laurent Pinchart
2016-12-20  1:33 ` [PATCH v2 06/29] drm: bridge: dw-hdmi: Don't forward HPD events to DRM core before attach Laurent Pinchart
2016-12-20  1:33 ` [PATCH v2 07/29] drm: bridge: dw-hdmi: Move IRQ and IO resource allocation to common code Laurent Pinchart
2016-12-20  1:33 ` [PATCH v2 08/29] drm: bridge: dw-hdmi: Reorder functions to prepare for next commit Laurent Pinchart
2016-12-20  1:33 ` [PATCH v2 09/29] drm: bridge: dw-hdmi: Create connector in the bridge attach operation Laurent Pinchart
2016-12-20  1:33 ` [PATCH v2 10/29] drm: bridge: dw-hdmi: Implement DRM bridge registration Laurent Pinchart
2016-12-20  1:33 ` [PATCH v2 11/29] drm: bridge: dw-hdmi: Remove PHY configuration resolution parameter Laurent Pinchart
2016-12-20  1:33 ` [PATCH v2 12/29] drm: bridge: dw-hdmi: Rename CONF0 SPARECTRL bit to SVSRET Laurent Pinchart
2016-12-20 10:58   ` Jose Abreu
2016-12-20  1:33 ` [PATCH v2 13/29] drm: bridge: dw-hdmi: Reject invalid product IDs Laurent Pinchart
2016-12-20 10:59   ` Jose Abreu
2016-12-20  1:33 ` [PATCH v2 14/29] drm: bridge: dw-hdmi: Detect AHB audio DMA using correct register Laurent Pinchart
2016-12-20 11:00   ` Jose Abreu
2016-12-20  1:33 ` [PATCH v2 15/29] drm: bridge: dw-hdmi: Handle overflow workaround based on device version Laurent Pinchart
2016-12-20 11:32   ` Jose Abreu [this message]
2016-12-20  1:33 ` [PATCH v2 16/29] drm: bridge: dw-hdmi: Detect PHY type at runtime Laurent Pinchart
2016-12-20 11:39   ` Jose Abreu
2016-12-20 13:11     ` Laurent Pinchart
2016-12-20 15:01       ` Jose Abreu
2017-01-05  0:15         ` Laurent Pinchart
2017-01-05 10:33           ` Jose Abreu
2017-01-05 11:44             ` Laurent Pinchart
2017-01-05 14:27               ` Jose Abreu
2016-12-20  1:33 ` [PATCH v2 17/29] drm: bridge: dw-hdmi: Refactor PHY power handling Laurent Pinchart
2016-12-20 11:45   ` Russell King - ARM Linux
2016-12-20 12:17     ` Jose Abreu
2017-01-05 12:29       ` Laurent Pinchart
2017-01-05 15:06         ` Jose Abreu
2017-01-05 15:33           ` Laurent Pinchart
2017-01-06  1:48             ` Laurent Pinchart
2017-01-06 10:07               ` Jose Abreu
2017-01-06 14:52                 ` Laurent Pinchart
2017-03-01 11:09           ` Laurent Pinchart
2017-03-01 16:25             ` Jose Abreu
2017-03-01 22:47               ` Laurent Pinchart
2016-12-20 13:50     ` Laurent Pinchart
2016-12-20  1:33 ` [PATCH v2 18/29] drm: bridge: dw-hdmi: Move CSC configuration out of PHY code Laurent Pinchart
2016-12-20  1:33 ` [PATCH v2 19/29] drm: bridge: dw-hdmi: Add support for custom PHY configuration Laurent Pinchart
2016-12-20  1:33 ` [PATCH v2 20/29] drm: bridge: dw-hdmi: Remove device type from platform data Laurent Pinchart
2016-12-20  1:33 ` [PATCH v2 21/29] dt-bindings: display: dw-hdmi: Clean up DT bindings documentation Laurent Pinchart
2016-12-20  1:33 ` [PATCH v2 22/29] dt-bindings: display: renesas: Add R-Car Gen3 HDMI TX DT bindings Laurent Pinchart
2016-12-20  1:33 ` [PATCH v2 23/29] drm: rcar-du: Add Gen3 HDMI encoder support Laurent Pinchart
2016-12-20  1:33 ` [PATCH v2 24/29] drm: rcar-du: Skip disabled outputs Laurent Pinchart
2016-12-20  1:33 ` [PATCH v2 25/29] drm: rcar-du: Add DPLL support Laurent Pinchart
2016-12-20  1:33 ` [PATCH v2 26/29] drm: rcar-du: Add HDMI outputs to R8A7795 device description Laurent Pinchart
2016-12-20  1:33 ` [PATCH v2 27/29] arm64: dts: r8a7795: Add HDMI encoder support Laurent Pinchart
2016-12-20  1:33 ` [PATCH v2 28/29] arm64: dts: r8a7795: salvator-x: Enable HDMI outputs Laurent Pinchart
2016-12-20  1:34 ` [PATCH v2 29/29] arm64: dts: r8a7795: salvator-x: Add DU1 and DU2 external dot clocks 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=1d559621-12c9-c41c-f9d4-9ed3c62e3453@synopsys.com \
    --to=jose.abreu@synopsys.com \
    --cc=andy.yan@rock-chips.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=fabio.estevam@freescale.com \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=laurent.pinchart+renesas@ideasonboard.com \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=rmk+kernel@arm.linux.org.uk \
    --cc=ulrich.hecht@gmail.com \
    --cc=vladimir_zapolskiy@mentor.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 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).