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: 9277051 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 8944260780 for ; Fri, 12 Aug 2016 14:15:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7ABA628A23 for ; Fri, 12 Aug 2016 14:15:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6F70E28A22; Fri, 12 Aug 2016 14:15:25 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5941628A22 for ; Fri, 12 Aug 2016 14:15:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751392AbcHLOPY (ORCPT ); Fri, 12 Aug 2016 10:15:24 -0400 Received: from pandora.armlinux.org.uk ([78.32.30.218]:34045 "EHLO pandora.armlinux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751010AbcHLOPX (ORCPT ); Fri, 12 Aug 2016 10:15:23 -0400 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 Cc: dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org 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 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.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) {