From patchwork Fri Mar 15 09:54:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 10854391 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 779B313B5 for ; Fri, 15 Mar 2019 09:54:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5BAB82886E for ; Fri, 15 Mar 2019 09:54:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4F93428A01; Fri, 15 Mar 2019 09:54:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EDAAD2886E for ; Fri, 15 Mar 2019 09:54:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=9u+0DedUrODJ4DyAWLfRBJ9Nc5oKx37xAh6Z604pyU4=; b=phUXacTqPSY7bf zisPLdEYPc62muoYrpIre0v1Pz+xPMl01vVx7FjFjgZrTV0yQC5tWQyWb/KJuzKFTVqCo1febTvky PYymEIW1H4dUjH6beE096ve99bkRjR5CBEnZl9BVUUxjakWk4hIdp/nfw9PGRFWcmQQZ+SlM4OY1P Aj9R7n68PX7MAXeUSH0dIYqRYGCuQgQ8LSlcqabg24ZNOo4TGUSdZz3RWxqRB+64TRmIrVW3UlAzm yWtbTaHRYXvEnNBLL0Lw2ZbWXDaYjKheZgWUyfM9uZF0oXxWTj5616cgFHTv9mzx/j77dMu5FL4OS Euv79WSxqSdxv73qaL0g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h4jXg-0005k7-U6; Fri, 15 Mar 2019 09:54:20 +0000 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h4jXd-0005jP-Tm for linux-rockchip@lists.infradead.org; Fri, 15 Mar 2019 09:54:19 +0000 Received: by mail-wm1-x344.google.com with SMTP id t124so5359610wma.4 for ; Fri, 15 Mar 2019 02:54:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=nMNxuBFkfxH/Pp2e0D/vuUTdP7DiCTna/TvHjdOEJW8=; b=Fcid22Crd69kN12+21PzsGaZiUWPHL/S7LQ+Q7zdeJQedXWw0GXjWDnDQodjY/epoY 62EN2SZ2ZClyJ6PUCbOG3Onx2T18oolqENLp5T3DbXnxRW5G0SzBy6f1pyA1380ksDwm x6+imSAGVCUpATIpi68qxfiX4tYMHwou6gJgHO+eYGYvWpX6O1NhixeprfsJsB+CFMiV EKfsBAGjQ8FyR1KtZ6AuqbHAmU3BfA6fdvG5RppdvpCYrq6vFO/RhEDoDR57xzvo0PDS N3AqFxS+N7WAhCh0iMqsIogIkfbmiTT+hIf+hx436I1GwMq+Jgo+6kKhW4CbDswdHDCl 3Y/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=nMNxuBFkfxH/Pp2e0D/vuUTdP7DiCTna/TvHjdOEJW8=; b=KhnsnTVRCzwjV64lc+H88M0OMZ4/7UQmJ86SBtDmjJxspLGHf3SKW5A9tMRH2bHkqN 6jkEiYUCfdZgqEECsadgZKeUyKse4ZGUy6GQH3jPO4Xq1ffyg1Z9q+2InGSqMNj6k+DR hyeeS8U8VSsK4fDrGiT8V4PNUTwPw1Ylf2MI4aD6CCjq90JDF4XdixISXFWHoj3EivOS c2W15ndEIv59m82hP//BVHy5HAwO0V3o9pKNOS/nV2fvlMtA+QI575JH92f+zDfKAoeQ cBakdiZCTLmh1EuqE33vk2xIrQjeTBS8bgIKFna9h/1W/IDoFfn+IqbGOILQ0mChGfft qgNQ== X-Gm-Message-State: APjAAAX2JCvAbE2ivC4J7SGRRBgi5BEPqMtPUAwtP17D4QNKvsYQimkG 5LVqcXPxq3HS82L4vPXKOY9Y/A== X-Google-Smtp-Source: APXvYqzpk9rciGy4Ra3i/qZ/fk86Vn9cwD5fHgaNEEQyBoEC3t7vAj+buGrW4QGk/PwPpTxt4tEbEA== X-Received: by 2002:a1c:eb1a:: with SMTP id j26mr1399768wmh.43.1552643656162; Fri, 15 Mar 2019 02:54:16 -0700 (PDT) Received: from bender.baylibre.local (lmontsouris-657-1-212-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.gmail.com with ESMTPSA id c202sm1683958wme.38.2019.03.15.02.54.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 15 Mar 2019 02:54:15 -0700 (PDT) From: Neil Armstrong To: a.hajda@samsung.com, Laurent.pinchart@ideasonboard.com, heiko@sntech.de, robh@kernel.org Subject: [PATCH] drm/bridge: dw-hdmi: disable SCDC configuration for invalid setups Date: Fri, 15 Mar 2019 10:54:14 +0100 Message-Id: <20190315095414.28520-1-narmstrong@baylibre.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190315_025417_965053_A2E89425 X-CRM114-Status: GOOD ( 14.62 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jernej.skrabec@siol.net, Neil Armstrong , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, linux-amlogic@lists.infradead.org Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This patch is an attempt to limit HDMI 2.0 SCDC setup when : - the SoC embeds an HDMI 1.4 only controller - the EDID supports SCDC but not scrambling - the EDID supports SCDC scrambling but not for low TMDS bit rates, while only supporting low TMDS bit rates This to avoid communicating with the SCDC DDC slave uncessary, and setting the DW-HDMI TMDS Scrambler setup when not supported by the underlying hardware. Reported-by: Rob Herring Fixes: 264fce6cc2c1 ("drm/bridge: dw-hdmi: Add SCDC and TMDS Scrambling support") Signed-off-by: Neil Armstrong Tested-by: Rob Herring Reviewed-by: Andrzej Hajda --- Rob, this patch should also solve your issue with your 11' display, could you test it ? If this works, I will focus on the underlying issue where the RK3399 SoC freezes in your setup. Thanks, Neil drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 34 ++++++++++++++++++++--- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index a63e5f0dae56..db761329a1e3 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -1037,6 +1037,31 @@ void dw_hdmi_phy_i2c_write(struct dw_hdmi *hdmi, unsigned short data, } EXPORT_SYMBOL_GPL(dw_hdmi_phy_i2c_write); +/* Filter out invalid setups to avoid configuring SCDC and scrambling */ +static bool dw_hdmi_support_scdc(struct dw_hdmi *hdmi) +{ + struct drm_display_info *display = &hdmi->connector.display_info; + + /* Completely disable SCDC support for older controllers */ + if (hdmi->version < 0x200a) + return false; + + /* Disable if SCDC is not supported, or if an HF-VSDB block is absent */ + if (!display->hdmi.scdc.supported || + !display->hdmi.scdc.scrambling.supported) + return false; + + /* + * Disable if display only support low TMDS rates and scrambling + * for low rates is not supported either + */ + if (!display->hdmi.scdc.scrambling.low_rates && + display->max_tmds_clock <= 340000) + return false; + + return true; +} + /* * HDMI2.0 Specifies the following procedure for High TMDS Bit Rates: * - The Source shall suspend transmission of the TMDS clock and data @@ -1055,7 +1080,7 @@ void dw_hdmi_set_high_tmds_clock_ratio(struct dw_hdmi *hdmi) unsigned long mtmdsclock = hdmi->hdmi_data.video_mode.mtmdsclock; /* Control for TMDS Bit Period/TMDS Clock-Period Ratio */ - if (hdmi->connector.display_info.hdmi.scdc.supported) { + if (dw_hdmi_support_scdc(hdmi)) { if (mtmdsclock > HDMI14_MAX_TMDSCLK) drm_scdc_set_high_tmds_clock_ratio(hdmi->ddc, 1); else @@ -1579,8 +1604,9 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi, /* Set up HDMI_FC_INVIDCONF */ inv_val = (hdmi->hdmi_data.hdcp_enable || - vmode->mtmdsclock > HDMI14_MAX_TMDSCLK || - hdmi_info->scdc.scrambling.low_rates ? + (dw_hdmi_support_scdc(hdmi) && + (vmode->mtmdsclock > HDMI14_MAX_TMDSCLK || + hdmi_info->scdc.scrambling.low_rates)) ? HDMI_FC_INVIDCONF_HDCP_KEEPOUT_ACTIVE : HDMI_FC_INVIDCONF_HDCP_KEEPOUT_INACTIVE); @@ -1646,7 +1672,7 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi, } /* Scrambling Control */ - if (hdmi_info->scdc.supported) { + if (dw_hdmi_support_scdc(hdmi)) { if (vmode->mtmdsclock > HDMI14_MAX_TMDSCLK || hdmi_info->scdc.scrambling.low_rates) { /*