From patchwork Tue Mar 21 15:12:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 9636771 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 F312660216 for ; Tue, 21 Mar 2017 15:12:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E816A28329 for ; Tue, 21 Mar 2017 15:12:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DC8252833B; Tue, 21 Mar 2017 15:12:56 +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 5BA8928329 for ; Tue, 21 Mar 2017 15:12:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 858D76E715; Tue, 21 Mar 2017 15:12:55 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x236.google.com (mail-wm0-x236.google.com [IPv6:2a00:1450:400c:c09::236]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4DD7D6E717 for ; Tue, 21 Mar 2017 15:12:51 +0000 (UTC) Received: by mail-wm0-x236.google.com with SMTP id t189so14863294wmt.1 for ; Tue, 21 Mar 2017 08:12:51 -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:in-reply-to:references; bh=4hM5ohDOfz3lI87ijSEFdfAA5iXRy2qwrt0n7XKDqZY=; b=S/WItNGXwmGyF3bm0JtN6PUIuwfbff1w3+WmfKjHOlgscRrnqGLGpxWkU1o1CJgysh JfzI0d4GZIEWWbb8JUgadtIF4upGeMh/az1wfPLFl2/ou5lFsFUzW5bef4Fja+vUBbH1 baxb5D5dCQQ5iUqrtY69b6oQ2YD/dy9Mlt7CerA30M1I9vmVO0vaaGU+8D38SVLKHhxs RwHCNFN+VWK/TDTuHk03Fc1LKlc/+suVc2Rstj4CM76/4IK2QLwOqyvw+mJRXxgntkOJ 4/J6EX+fBCB5sRhp5CPrUZHoT0SPII2ElII9Dfr7tbQln3fxYhHKG1+xu3IZ0aH8Zltu sekQ== 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:in-reply-to :references; bh=4hM5ohDOfz3lI87ijSEFdfAA5iXRy2qwrt0n7XKDqZY=; b=nyrA+1G7QZOrX/JtXzAC9TiXfO+EA12g1rCpVeTE0xQVMhA2ujeHswrUpFtHFmxVWv 8qzthnGjy4mtPrANCZqP3MwuYNJw5tLLOQaOvs5rWT3xZhFYaO+cZ3GwQcLoXfWh9jqc rtnbVRVBL8cB/mDA3M0VNyWWEwnYIL+5zdHXjawcdzZLC2P0Em/ujscAgMkE+BV3oeaA xT48yn+e1M66NNSqBY5+3iekwWJ2b1HohGdPaEwipZ6JzKmmgVbUtFN51pwoQMBu57M7 0qzkYv7Tc+Y2XKjemmusnIcfr6tGpTOqxYpv9y0JzsnrYgJS5St4zH8HdUAttepbwfYv jYnw== X-Gm-Message-State: AFeK/H2ru1fdqnaKutrpOEh/oU0a4oUX6zyUj1+UM8vO9+Zwe/2lZsttgNidiGPUYbcSNxWM X-Received: by 10.28.210.212 with SMTP id j203mr3109585wmg.93.1490109169873; Tue, 21 Mar 2017 08:12:49 -0700 (PDT) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id h65sm23655794wrh.32.2017.03.21.08.12.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 21 Mar 2017 08:12:49 -0700 (PDT) From: Neil Armstrong To: dri-devel@lists.freedesktop.org, laurent.pinchart+renesas@ideasonboard.com, architt@codeaurora.org Subject: [PATCH v4 1/6] drm: bridge: dw-hdmi: Extract PHY interrupt setup to a function Date: Tue, 21 Mar 2017 16:12:36 +0100 Message-Id: <1490109161-20529-2-git-send-email-narmstrong@baylibre.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1490109161-20529-1-git-send-email-narmstrong@baylibre.com> References: <1490109161-20529-1-git-send-email-narmstrong@baylibre.com> Cc: Jose.Abreu@synopsys.com, Neil Armstrong , kieran.bingham@ideasonboard.com, linux-kernel@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-media@vger.kernel.org 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: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Laurent Pinchart In preparation for adding PHY operations to handle RX SENSE and HPD, group all the PHY interrupt setup code in a single location and extract it to a separate function. Signed-off-by: Laurent Pinchart Signed-off-by: Neil Armstrong Reviewed-by: Jose Abreu --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 50 ++++++++++++++----------------- 1 file changed, 23 insertions(+), 27 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index af93f7a..f82750a 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -1559,7 +1559,7 @@ static int dw_hdmi_setup(struct dw_hdmi *hdmi, struct drm_display_mode *mode) } /* Wait until we are registered to enable interrupts */ -static int dw_hdmi_fb_registered(struct dw_hdmi *hdmi) +static void dw_hdmi_fb_registered(struct dw_hdmi *hdmi) { hdmi_writeb(hdmi, HDMI_PHY_I2CM_INT_ADDR_DONE_POL, HDMI_PHY_I2CM_INT_ADDR); @@ -1567,15 +1567,6 @@ static int dw_hdmi_fb_registered(struct dw_hdmi *hdmi) hdmi_writeb(hdmi, HDMI_PHY_I2CM_CTLINT_ADDR_NAC_POL | HDMI_PHY_I2CM_CTLINT_ADDR_ARBITRATION_POL, HDMI_PHY_I2CM_CTLINT_ADDR); - - /* enable cable hot plug irq */ - hdmi_writeb(hdmi, hdmi->phy_mask, HDMI_PHY_MASK0); - - /* Clear Hotplug interrupts */ - hdmi_writeb(hdmi, HDMI_IH_PHY_STAT0_HPD | HDMI_IH_PHY_STAT0_RX_SENSE, - HDMI_IH_PHY_STAT0); - - return 0; } static void initialize_hdmi_ih_mutes(struct dw_hdmi *hdmi) @@ -1693,6 +1684,26 @@ static void dw_hdmi_update_phy_mask(struct dw_hdmi *hdmi) hdmi_writeb(hdmi, hdmi->phy_mask, HDMI_PHY_MASK0); } +static void dw_hdmi_phy_setup_hpd(struct dw_hdmi *hdmi) +{ + /* + * Configure the PHY RX SENSE and HPD interrupts polarities and clear + * any pending interrupt. + */ + hdmi_writeb(hdmi, HDMI_PHY_HPD | HDMI_PHY_RX_SENSE, HDMI_PHY_POL0); + hdmi_writeb(hdmi, HDMI_IH_PHY_STAT0_HPD | HDMI_IH_PHY_STAT0_RX_SENSE, + HDMI_IH_PHY_STAT0); + + /* Enable cable hot plug irq. */ + hdmi_writeb(hdmi, hdmi->phy_mask, HDMI_PHY_MASK0); + + /* Clear and unmute interrupts. */ + hdmi_writeb(hdmi, HDMI_IH_PHY_STAT0_HPD | HDMI_IH_PHY_STAT0_RX_SENSE, + HDMI_IH_PHY_STAT0); + hdmi_writeb(hdmi, ~(HDMI_IH_PHY_STAT0_HPD | HDMI_IH_PHY_STAT0_RX_SENSE), + HDMI_IH_MUTE_PHY_STAT0); +} + static enum drm_connector_status dw_hdmi_connector_detect(struct drm_connector *connector, bool force) { @@ -2204,29 +2215,14 @@ static int dw_hdmi_detect_phy(struct dw_hdmi *hdmi) hdmi->ddc = NULL; } - /* - * Configure registers related to HDMI interrupt - * generation before registering IRQ. - */ - hdmi_writeb(hdmi, HDMI_PHY_HPD | HDMI_PHY_RX_SENSE, HDMI_PHY_POL0); - - /* Clear Hotplug interrupts */ - hdmi_writeb(hdmi, HDMI_IH_PHY_STAT0_HPD | HDMI_IH_PHY_STAT0_RX_SENSE, - HDMI_IH_PHY_STAT0); - hdmi->bridge.driver_private = hdmi; hdmi->bridge.funcs = &dw_hdmi_bridge_funcs; #ifdef CONFIG_OF hdmi->bridge.of_node = pdev->dev.of_node; #endif - ret = dw_hdmi_fb_registered(hdmi); - if (ret) - goto err_iahb; - - /* Unmute interrupts */ - hdmi_writeb(hdmi, ~(HDMI_IH_PHY_STAT0_HPD | HDMI_IH_PHY_STAT0_RX_SENSE), - HDMI_IH_MUTE_PHY_STAT0); + dw_hdmi_fb_registered(hdmi); + dw_hdmi_phy_setup_hpd(hdmi); memset(&pdevinfo, 0, sizeof(pdevinfo)); pdevinfo.parent = dev;