From patchwork Sun Nov 5 16:41:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Bowler X-Patchwork-Id: 10042753 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6F764601EB for ; Mon, 6 Nov 2017 08:32:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5D93A29925 for ; Mon, 6 Nov 2017 08:32:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 528202992D; Mon, 6 Nov 2017 08:32: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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BA60329925 for ; Mon, 6 Nov 2017 08:32:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 35D896E264; Mon, 6 Nov 2017 08:32:08 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x236.google.com (mail-lf0-x236.google.com [IPv6:2a00:1450:4010:c07::236]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7B99989265 for ; Sun, 5 Nov 2017 16:41:09 +0000 (UTC) Received: by mail-lf0-x236.google.com with SMTP id w21so8032397lfc.6 for ; Sun, 05 Nov 2017 08:41:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=draconx-ca.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=UQz54O8kkjsuVhE4aG4PYISf0wcRCURoxr72yrEVo5Q=; b=V9Nn0l2g8Fa8eCH3iyGxyZmE1y08KrmBBA34gYchtkfhBHQThgZI6JweeJFmnrlqci lkcn/7DDA5OVQsFrQq2BJkZ6XWyg5AiTn510HhyJ2idwEFynBcDD5erVDHQsJGLj1+PO 0RQT7wKGfjRQvprbEXNy0vqcqcfNIaZuIQpENzUP/BEAsePypHpBEINuoOXu2UEW5jfX G7jbIGcXVqNYh3WE1ycM0b5Kx6TEt9RBsXthGgmyGKyJl2FW2SMrN1k3YTbsYOgQEV6H +919ivm5c9Xuyq6w0uKTbQdSs2fUiYj4P8Qdg3KuO/Tn6k7pSBcHX3TuCDFL0uFGr8dU NUgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=UQz54O8kkjsuVhE4aG4PYISf0wcRCURoxr72yrEVo5Q=; b=pL7fen4ydSrHcntEdV5eoABryQYNS7hmUle65fPcsDVh7Wxh37l5wpodTIz8N/6JAv ICC4sLUvb/7TL1mv+lip1t+YopeM1TcBzCaeOZ2jYNVOly1hYXH/YEcQCeKdVOhekN8w 5UqLR28YvD0RdS8PPw9otJuyHopRiG988CDuJ6Q8bNqMewxmyp74QNEH/HZgSkT1Dviw mIod699KUJPM99mQ2IiBa8HPvlO29ToDEUSh864v7fMusqiaKfOHnbNVWfkOFxHJvma4 RpjVMXhs0VezwTRfskSfdXiHscYEBmlqIkkeCzFiqVYmJBHAU9ZjLhuY0IQ5KYFfsXOY prCg== X-Gm-Message-State: AJaThX7O/dyQImVcF3Q5jIqrWzOLtdqL7BQgOLDqaeRJvZPQoFUoyPnZ BfIBYCmmMC3s1m3Uj7FRYW1a2sLutG4OhY5pqcnbQA== X-Google-Smtp-Source: ABhQp+RCEFY+eoH9e06LmRu2Q7ibqqPg9YW3FZQqe+cLA69DcEe42mKkExMtj68NtXYtbyGoH5ZsuRhgZ7afiO6QkDQ= X-Received: by 10.25.83.133 with SMTP id h5mr4495801lfl.173.1509900067448; Sun, 05 Nov 2017 08:41:07 -0800 (PST) MIME-Version: 1.0 Received: by 10.179.6.130 with HTTP; Sun, 5 Nov 2017 08:41:06 -0800 (PST) X-Originating-IP: [24.156.181.89] In-Reply-To: References: From: Nick Bowler Date: Sun, 5 Nov 2017 11:41:06 -0500 Message-ID: Subject: Re: PROBLEM: Asus C201 video mode problems on HDMI hotplug (regression) To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org X-Mailman-Approved-At: Mon, 06 Nov 2017 08:32:05 +0000 Cc: Laurent Pinchart X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Hi, I completed bisecting this issue. See below. On 2017-11-02, Nick Bowler wrote: > ~50% of the time after a hotplug, there is a vertical pink bar on the > left of the display area and audio is not working at all. According to > the sink device the display size is 1282x720 which seems pretty wrong > (normal and working situation is 1280x720). > > I posted photos of non-working versus working states here: > > https://imgur.com/a/qhAZG > > Unplugging and plugging the cable again will correct the issue (it seems > to, for the most part, alternate between working and not-working states, > although not always). It always works on power up with the cable initially > connected. > > This is a regression from 4.11, where hotplug works perfectly every time. Bisection implicates the following commit: 181e0ef092a4952aa523c5b9cb21394cf43bcd46 is the first bad commit commit 181e0ef092a4952aa523c5b9cb21394cf43bcd46 Author: Laurent Pinchart Date: Mon Mar 6 01:35:57 2017 +0200 drm: bridge: dw-hdmi: Fix the PHY power up sequence When powering the PHY up we need to wait for the PLL to lock. This is done by polling the TX_PHY_LOCK bit in the HDMI_PHY_STAT0 register (interrupt-based wait could be implemented as well but is likely overkill). The bit is asserted when the PLL locks, but the current code incorrectly waits for the bit to be deasserted. Fix it, and while at it, replace the udelay() with a sleep as the code never runs in non-sleepable context. To be consistent with the power down implementation move the poll loop to the power off function. Signed-off-by: Laurent Pinchart Tested-by: Neil Armstrong Reviewed-by: Jose Abreu Signed-off-by: Archit Taneja Link: http://patchwork.freedesktop.org/patch/msgid/20170305233557.11945-1-laurent.pinchart+renesas@ideasonboard.com :040000 040000 0defad9d1a61c0355f49c679b18eebae2c4b9495 5d260e6db25d6abc1211d61ec3405be99e693a23 M drivers This commit does not revert cleanly, but on top of latest master (which has the problem) I manually changed the relevant code back to its original state and the problem is fixed, like this: Cheers, Nick diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index bf14214fa464..6618aac95a51 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -1100,37 +1100,34 @@ static void dw_hdmi_phy_power_off(struct dw_hdmi *hdmi) static int dw_hdmi_phy_power_on(struct dw_hdmi *hdmi) { - const struct dw_hdmi_phy_data *phy = hdmi->phy.data; - unsigned int i; - u8 val; + u8 val, msec; - if (phy->gen == 1) { - dw_hdmi_phy_enable_powerdown(hdmi, false); + dw_hdmi_phy_enable_powerdown(hdmi, false); - /* Toggle TMDS enable. */ - dw_hdmi_phy_enable_tmds(hdmi, 0); - dw_hdmi_phy_enable_tmds(hdmi, 1); - return 0; - } + /* toggle TMDS enable */ + dw_hdmi_phy_enable_tmds(hdmi, 0); + dw_hdmi_phy_enable_tmds(hdmi, 1); + /* gen2 tx power on */ dw_hdmi_phy_gen2_txpwron(hdmi, 1); dw_hdmi_phy_gen2_pddq(hdmi, 0); /* Wait for PHY PLL lock */ - for (i = 0; i < 5; ++i) { + msec = 5; + do { val = hdmi_readb(hdmi, HDMI_PHY_STAT0) & HDMI_PHY_TX_PHY_LOCK; - if (val) + if (!val) break; - usleep_range(1000, 2000); - } + if (msec == 0) { + dev_err(hdmi->dev, "PHY PLL not locked\n"); + return -ETIMEDOUT; + } - if (!val) { - dev_err(hdmi->dev, "PHY PLL failed to lock\n"); - return -ETIMEDOUT; - } + udelay(1000); + msec--; + } while (1); - dev_dbg(hdmi->dev, "PHY PLL locked %u iterations\n", i); return 0; }