From patchwork Fri Nov 16 17:18:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Priit Laes X-Patchwork-Id: 10686713 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 3D30817EE for ; Fri, 16 Nov 2018 17:20:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2A5F02D137 for ; Fri, 16 Nov 2018 17:20:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1EAAD2D17D; Fri, 16 Nov 2018 17:20:00 +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=-2.8 required=2.0 tests=BAYES_00,DKIM_ADSP_ALL, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW autolearn=ham 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 680082D137 for ; Fri, 16 Nov 2018 17:19:59 +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=VX3DdZ/3J8xH9QTvxlhqBQe7KWhYq4cxkZ7Ykzf9biQ=; b=mKLpZ38ttSQJWg QsmyRTZVxt9slcS7HNzpjhUn8OdzfIU3KBR1qMXe8z62sulMm0NDgdwlL0S6dF48MyswgY/rKbfO6 dhzOGgJrhWgCBsjTJc6GJgDSknSh4tsiOIMz/O2bi2+CMlLPbQP0MxQ0UvHrehvz08hDYyos+N4bt S7GbeXQVewUe7HwmOJWX4ZZt5O3D1rFWNuzSafuzdRgPuEDP18V/E7k7U3n+f0/26jvomg8kkTUDC Tq3B1TXykLAYkB8U6nrnv1UAzFw74NI4XbXnBuE3v5F4YjXW6Dz6BkEJir45pdqJC5Xd2+yRV/vVp GSH2v6RJxi+byzudl6iw==; 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 1gNhme-00008t-Lr; Fri, 16 Nov 2018 17:19:56 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gNhmd-00008j-1d for linux-arm-kernel@bombadil.infradead.org; Fri, 16 Nov 2018 17:19:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=vDRGVj6oqxvzZk1B1UG9mHx8yi0TJplZYgp67boGwrg=; b=gx4esE5Uj6jXgi2GLLna3cAON9 hEVumiBR9ApGgXUW+z7d4Hf2tFYVNOxtUkalK/yAwtSmdbwwADyOaCBeBIv2WlGUgJpn1qmJtcp4c nEoJiD6pf4UT2AczzZ+JtTSI+VuokZLwSqw8JsTb/O1nrjFinxZ840gb7p2SjgAQl2WlQnC0CgbbU 6jOcdxiKjshm902dzLCRjm8vngj42i1cy7vuJUg8DmiXmmY5NHLyx9DmTzUegSDjSfCZ5KTcErELs WolJ6sL478UAGD9xoFHiKVTlsLX/UqoAT2WEVuWvrq/tWAkbvY624vSDkfY7KBi8wRWyViJzubq28 ECWxSA6Q==; Received: from plaes.org ([188.166.43.21]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gNhmZ-0004Zt-GE for linux-arm-kernel@lists.infradead.org; Fri, 16 Nov 2018 17:19:53 +0000 Received: from localhost (157-101-157-37.dyn.estpak.ee [37.157.101.157]) by plaes.org (Postfix) with ESMTPSA id 7648E404F6; Fri, 16 Nov 2018 17:18:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=plaes.org; s=mail; t=1542388717; bh=+bpN4ZwqqQUjowASMeuVjR5rPF6JMyGtwaoRGh+mgJU=; h=From:To:Cc:Subject:Date:From; b=V8+sUwS7vTk2MF4DZ/e74bFIV4iBC1ztMqCv7t3nyGntT+/I1CNvI8iQndRnotH1/ smDEefqtBA5NNh/M8Lpah+3kR2Gf3eJPXn0IITuxf4NBET/vZw3QFS/1sxR+dNrA7K 45p2prgk7gWXUikApFSU5e+Zs5pSlD2ermNFEds9P+7uQHUt2GRzxoNN66dJstUl9H nyJaBEDAFw9nslcir0ITg2UGm9aIMvXXWaaAVwidsCj7f+7CVXrii2HO35NHVOaOto LQoCPuuGtxgrGfWvyvfdtsK+1RG+10TWFcRgFZk5blsy6DYUQffuSnqX7W7BFufJIv X5azkuUxk0sng== From: Priit Laes To: Maxime Ripard , Chen-Yu Tsai , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH] drm/sun4i: hdmi: Improve compatibility with non-hotplug capable connectors Date: Fri, 16 Nov 2018 19:18:29 +0200 Message-Id: <20181116171830.23465-1-plaes@plaes.org> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181116_171951_637427_B34C2251 X-CRM114-Status: GOOD ( 11.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mats Lundberg , Priit Laes , Priit Laes Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Priit Laes Even though HDMI connector features hotplug detect pin (HPD), there are devices that which do not support it. For these devices fall back to additional check on I2C bus. Of course, there might be also devices that do not wire DDC pins too, so we don't really know whether cable has been connected. Signed-off-by: Priit Laes Signed-off-by: Priit Laes --- drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c index 061d2e0d9011..bded09af1340 100644 --- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c @@ -238,14 +238,18 @@ sun4i_hdmi_connector_detect(struct drm_connector *connector, bool force) struct sun4i_hdmi *hdmi = drm_connector_to_sun4i_hdmi(connector); unsigned long reg; - if (readl_poll_timeout(hdmi->base + SUN4I_HDMI_HPD_REG, reg, + if (!readl_poll_timeout(hdmi->base + SUN4I_HDMI_HPD_REG, reg, reg & SUN4I_HDMI_HPD_HIGH, 0, 500000)) { - cec_phys_addr_invalidate(hdmi->cec_adap); - return connector_status_disconnected; + return connector_status_connected; } - return connector_status_connected; + if (!IS_ERR(hdmi->i2c) && drm_probe_ddc(hdmi->i2c)) + return connector_status_connected; + + cec_phys_addr_invalidate(hdmi->cec_adap); + + return connector_status_unknown; } static const struct drm_connector_funcs sun4i_hdmi_connector_funcs = {