From patchwork Fri Jul 8 05:55:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Archit Taneja X-Patchwork-Id: 9220063 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 1AFE06044F for ; Fri, 8 Jul 2016 05:56:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0D81B28454 for ; Fri, 8 Jul 2016 05:56:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0263D28456; Fri, 8 Jul 2016 05:56:12 +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.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AE02C28454 for ; Fri, 8 Jul 2016 05:56:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B63846E894; Fri, 8 Jul 2016 05:56:10 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from smtp.codeaurora.org (smtp.codeaurora.org [198.145.29.96]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0AA5F6E894 for ; Fri, 8 Jul 2016 05:56:08 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1000) id F156661180; Fri, 8 Jul 2016 05:56:07 +0000 (UTC) Received: from localhost (unknown [202.46.23.61]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: architt@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id C4FBD611A4; Fri, 8 Jul 2016 05:56:05 +0000 (UTC) From: Archit Taneja To: robdclark@gmail.com, andy.gross@linaro.org Subject: [PATCH 2/4] drm/msm/hdmi: Use more DT friendly GPIO names Date: Fri, 8 Jul 2016 11:25:52 +0530 Message-Id: <1467957354-7620-3-git-send-email-architt@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1467957354-7620-1-git-send-email-architt@codeaurora.org> References: <1467957354-7620-1-git-send-email-architt@codeaurora.org> Cc: devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.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 Update the gpio name parsing code to try to search for without the "qcom,hdmi-tx-" prefix. The older downstream bindings that expect "qcom,hdmi-tx-xyz" or "qcom,hdmi-tx-xyz-gpio" would work as the property name would work as before. Update the binding doc. Add an entry for the missing hpd and lpm gpios. Cc: Rob Herring Cc: devicetree@vger.kernel.org Signed-off-by: Archit Taneja --- Documentation/devicetree/bindings/display/msm/hdmi.txt | 6 ++++-- drivers/gpu/drm/msm/hdmi/hdmi.c | 16 ++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/display/msm/hdmi.txt b/Documentation/devicetree/bindings/display/msm/hdmi.txt index b63f614..4da1abd 100644 --- a/Documentation/devicetree/bindings/display/msm/hdmi.txt +++ b/Documentation/devicetree/bindings/display/msm/hdmi.txt @@ -23,8 +23,10 @@ Required properties: - phy-names: the name of the corresponding PHY device Optional properties: -- qcom,hdmi-tx-mux-en-gpio: hdmi mux enable pin -- qcom,hdmi-tx-mux-sel-gpio: hdmi mux select pin +- hpd-gpio: hdmi hpd pin +- mux-en-gpio: hdmi mux enable pin +- mux-sel-gpio: hdmi mux select pin +- mux-lpm-gpio: hdmi mux lpm pin - power-domains: reference to the power domain(s), if available. - pinctrl-names: the pin control state names; should contain "default" - pinctrl-0: the default pinctrl state (active) diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c index 51b9ea5..d48305f 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c @@ -422,11 +422,27 @@ static const struct { static int msm_hdmi_get_gpio(struct device_node *of_node, const char *name) { int gpio = of_get_named_gpio(of_node, name, 0); + + /* + * This is complicated mainly because we want the downstream kernel + * DT files working with the upstream kernel. We first try with the + * names as listed above in the table. We then append "gpio" to it and + * try again. We finally try the DT bindings as they would be in + * upstream dtsi files by stripping off the "qcom,hdmi-tx-" prefix. + * We'll get rid of this when we don't rely on downstream bindings. + */ if (gpio < 0) { char name2[32]; snprintf(name2, sizeof(name2), "%s-gpio", name); gpio = of_get_named_gpio(of_node, name2, 0); if (gpio < 0) { + char name3[32]; + + if (sscanf(name2, "qcom,hdmi-tx-%s", name3)) + gpio = of_get_named_gpio(of_node, name3, 0); + } + + if (gpio < 0) { DBG("failed to get gpio: %s (%d)", name, gpio); gpio = -1; }