From patchwork Fri Aug 12 14:15:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell King X-Patchwork-Id: 9277069 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 6CA7460780 for ; Fri, 12 Aug 2016 14:17:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5E24428A22 for ; Fri, 12 Aug 2016 14:17:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5325128A27; Fri, 12 Aug 2016 14:17:46 +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=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1A11228A22 for ; Fri, 12 Aug 2016 14:17:46 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bYDFx-00087A-FV; Fri, 12 Aug 2016 14:16:17 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:3201:214:fdff:fe10:1be6]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bYDFW-0007pZ-Pz for linux-arm-kernel@lists.infradead.org; Fri, 12 Aug 2016 14:15:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2014; h=Date:Sender:Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References:In-Reply-To; bh=DtYMaFtXwk/Op8saKYVE/DgAOnTUbtbldKj0I6nPGWU=; b=qXMkD8rt1FJVzrcqUaAQ3oo/8sLpHHufdi9t4v8eLHw3J3MVUftCLGisPnqpfTkwWooXbq3XiIXEibIkFbUSA1zrj1UV1e1CeG/2ruCZNfvMmNLEBFWI3xDtVzYx1o9N1QjZjYNRL93mzyI0C0qHcGxVQrae7WmZL08osRDrktM=; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:43340 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1bYDEr-0006as-EB; Fri, 12 Aug 2016 15:15:09 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1bYDEn-0004rl-CH; Fri, 12 Aug 2016 15:15:05 +0100 In-Reply-To: <20160812141421.GB1041@n2100.armlinux.org.uk> References: <20160812141421.GB1041@n2100.armlinux.org.uk> From: Russell King To: David Airlie , Jean-Christophe Plagniol-Villard , Tomi Valkeinen , Hans Verkuil Subject: [PATCH RFC 3/5] drm/bridge: dw_hdmi: add HDMI notifier support MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Fri, 12 Aug 2016 15:15:05 +0100 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160812_071551_342759_1CD7F53E X-CRM114-Status: GOOD ( 10.80 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-fbdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org 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 Add HDMI notifiers to the HDMI bridge driver. Signed-off-by: Russell King --- drivers/gpu/drm/bridge/Kconfig | 1 + drivers/gpu/drm/bridge/dw-hdmi.c | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig index 8f7423f18da5..6d97d9f2b164 100644 --- a/drivers/gpu/drm/bridge/Kconfig +++ b/drivers/gpu/drm/bridge/Kconfig @@ -20,6 +20,7 @@ config DRM_ANALOGIX_ANX78XX config DRM_DW_HDMI tristate select DRM_KMS_HELPER + select HDMI_NOTIFIERS config DRM_DW_HDMI_AHB_AUDIO tristate "Synopsis Designware AHB Audio interface" diff --git a/drivers/gpu/drm/bridge/dw-hdmi.c b/drivers/gpu/drm/bridge/dw-hdmi.c index c9d941283d30..cb6e03efbebf 100644 --- a/drivers/gpu/drm/bridge/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/dw-hdmi.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -1447,9 +1448,11 @@ static int dw_hdmi_connector_get_modes(struct drm_connector *connector) hdmi->sink_is_hdmi = drm_detect_hdmi_monitor(edid); hdmi->sink_has_audio = drm_detect_monitor_audio(edid); drm_mode_connector_update_edid_property(connector, edid); + hdmi_event_new_edid(hdmi->dev, edid, 0); ret = drm_add_edid_modes(connector, edid); /* Store the ELD */ drm_edid_to_eld(connector, edid); + hdmi_event_new_eld(hdmi->dev, connector->eld); kfree(edid); } else { dev_dbg(hdmi->dev, "failed to get edid\n"); @@ -1601,6 +1604,12 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id) dw_hdmi_update_phy_mask(hdmi); } mutex_unlock(&hdmi->mutex); + + if ((phy_stat & (HDMI_PHY_RX_SENSE | HDMI_PHY_HPD)) == 0) + hdmi_event_disconnect(hdmi->dev); + else if ((phy_stat & (HDMI_PHY_RX_SENSE | HDMI_PHY_HPD)) == + (HDMI_IH_PHY_STAT0_RX_SENSE | HDMI_PHY_HPD)) + hdmi_event_connect(hdmi->dev); } if (intr_stat & HDMI_IH_PHY_STAT0_HPD) {