From patchwork Mon Apr 30 11:40:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10371663 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 286086032A for ; Mon, 30 Apr 2018 11:59:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 15249289A7 for ; Mon, 30 Apr 2018 11:59:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 082B3289BB; Mon, 30 Apr 2018 11:59: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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable 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 5A417289A7 for ; Mon, 30 Apr 2018 11:59:45 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To: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:List-Owner; bh=eq8Oj9YXdp2TWSxvPdfl5dPhFR7E5vUmQaYUn0Em/jc=; b=X+L7Kt8QNPodsuVHx9OWMFWUi9 xI0m/BVEMXfDDLHq1vPVIJc+3p/d5HXaRdaaq8by2HBTNkut7tSuHfcyh+fiv91ojraHpxNv4vnqB t3qjVYdvaGwDWREnI68kCoIADdUXQBf9ojTGmJ7Rwb27KGDXUZvta3Zt+AyY3CG7lJFkPtBvY3L+9 9CWmwDdWQZT+t7rTLC9bO33jVYtCPToBCgi3TqlHNQQmH6gDBAq0HpuRXEriZB3ItPqsCy64zvbyv I0mfJmvASI0BpAMhDMYKr2pEefREHdK8U9LyOotnmfyB0afYfwVAZxLZtPHUgpKEXTNmTvm/OqXlS mCtwPhOw==; 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 1fD7T1-0000cD-AD; Mon, 30 Apr 2018 11:59:39 +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 1fD7Rg-0008Fx-U3 for linux-arm-kernel@bombadil.infradead.org; Mon, 30 Apr 2018 11:58:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=jFB4gf1Utj1KIZxbtbvpo9BdsJZSspuQL9e3AoWW1oM=; b=IRDHUYrspkiVG4zEZ7w/qpPY0 p1gsT2Tmi9M91F443KVXX7dYkfevosLOQ4/M6UCJr+mk6PduyDhUcwuWtwTa1srIdLSoFq8I9lSWy y/urGKnIhMDj4S0D3kJJC2jlwGkDv001fRE3nnzeehYJCQsD53v11Pk0nZF4Ev50EokdGzmog6bwd XAs8gUkFFIfFMaZSkva82UVw/x0O7pwBeGEdaQlQVSMWM6XVMKwU3AFZ5jXgJ7FK/V3KTA12lF0/1 j7qzB0z6NrHsI8Q3t0vJYUiIx1xldv9jUH4q9g8N4a9aeZ50zgqi2A6X/GhUzWZIzLowuYRUGvmz2 lM9O65rfw==; Received: from mail-pf0-x242.google.com ([2607:f8b0:400e:c00::242]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fD7Cy-0001ic-0Q for linux-arm-kernel@lists.infradead.org; Mon, 30 Apr 2018 11:43:05 +0000 Received: by mail-pf0-x242.google.com with SMTP id j5so6554063pfh.2 for ; Mon, 30 Apr 2018 04:42:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=jFB4gf1Utj1KIZxbtbvpo9BdsJZSspuQL9e3AoWW1oM=; b=YhxKJa1javifVoKZZ+EjRixZtnbvVDa6O7jIXW5lBquCmY6jRW5UYqOfVW6TzjCINl I/N9OINoFhIvrAbB7u7otZwiEv4QsqNB0e3Z8ZoyGKxJIQ8wiycfoZWZ1Tz0i66KyV65 AinDjQe7bc3/KHWU2eopFATC1KF4smFxosZgc= 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=jFB4gf1Utj1KIZxbtbvpo9BdsJZSspuQL9e3AoWW1oM=; b=ibpH+u5c0TkMhDVmVdxLdMBZoGGgghKQF4+kVBktCmVHB7D81cWjdU+GF7b1IZsy+e CnnWU+UuHEQgVOG+h+sADwVRsTjAr2fgqzauV8MWYLhf7VQV0glPrsPu1uzdeqesn3tg OQs3xJIqwB621TqAXk56VWumY+ED/dATeF2l+BClDIuxPrJTau4OAUVRjUjbdmNHe/i5 R46H+wVPri/rdjSaEKp70p9lLgJIThgxNzvDlgrld0VdM+aoLcBbh+yk3gDiAshNerdF 0YSgYat8WIBAnJC4PjdhoDkH8XAtEbuj1IYzN8HTgpYKoDMT54RbBtUe25wXHCu3pK97 N6uw== X-Gm-Message-State: ALQs6tDxPp07D+bIVroJtTXapgikgHtNgoFzR59Ke4W1yxd0e/hrkG6r vF7bj94RZMzZBqDTMFlWLmH71Q== X-Google-Smtp-Source: AB8JxZqSpducheTlFu8hkisYe4C1rpq96Z42VSISpSwk7ymNuuE0lOE/wAPMinmMtUj0PWySY3roYA== X-Received: by 2002:a17:902:82c3:: with SMTP id u3-v6mr12067745plz.83.1525088572353; Mon, 30 Apr 2018 04:42:52 -0700 (PDT) Received: from localhost.localdomain ([183.82.224.14]) by smtp.gmail.com with ESMTPSA id s17sm16762357pfi.165.2018.04.30.04.42.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Apr 2018 04:42:51 -0700 (PDT) From: Jagan Teki To: Maxime Ripard Subject: [PATCH 15/21] drm: sun4i: add support for HVCC regulator for DWC HDMI glue Date: Mon, 30 Apr 2018 17:10:52 +0530 Message-Id: <20180430114058.5061-16-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180430114058.5061-1-jagan@amarulasolutions.com> References: <20180430114058.5061-1-jagan@amarulasolutions.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180430_124304_095477_2018026C X-CRM114-Status: GOOD ( 24.52 ) 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: Mark Rutland , devicetree@vger.kernel.org, Jernej Skrabec , David Airlie , Catalin Marinas , Michael Turquette , linux-sunxi@googlegroups.com, Will Deacon , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Stephen Boyd , Chen-Yu Tsai , Rob Herring , Jagan Teki , Michael Trimarchi , linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Icenowy Zheng MIME-Version: 1.0 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: Icenowy Zheng Allwinner SoCs with DWC HDMI controller have a "HVCC" power pin for the HDMI part, and on some boards it's connected to a dedicated regulator rather than the main 3.3v. Add support for optional HVCC regulator. For boards that doesn't use a dedicated regulator to power it, the default dummy regulator is used. Signed-off-by: Icenowy Zheng Signed-off-by: Jagan Teki --- drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c | 14 ++++++++++++++ drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c index 9f40a44b456b..7c33faff7ad4 100644 --- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c +++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c @@ -73,6 +73,12 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master, if (encoder->possible_crtcs == 0) return -EPROBE_DEFER; + hdmi->vcc_hdmi = devm_regulator_get(dev, "hvcc"); + if (IS_ERR(hdmi->vcc_hdmi)) { + dev_err(dev, "Could not get HDMI power supply\n"); + return PTR_ERR(hdmi->vcc_hdmi); + } + hdmi->rst_ctrl = devm_reset_control_get(dev, "ctrl"); if (IS_ERR(hdmi->rst_ctrl)) { dev_err(dev, "Could not get ctrl reset control\n"); @@ -91,6 +97,12 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master, return ret; } + ret = regulator_enable(hdmi->vcc_hdmi); + if (ret) { + dev_err(dev, "Cannot enable HDMI power supply\n"); + goto err_disable_vcc; + } + ret = clk_prepare_enable(hdmi->clk_tmds); if (ret) { dev_err(dev, "Could not enable tmds clock\n"); @@ -143,6 +155,8 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master, clk_disable_unprepare(hdmi->clk_tmds); err_assert_ctrl_reset: reset_control_assert(hdmi->rst_ctrl); +err_disable_vcc: + regulator_disable(hdmi->vcc_hdmi); return ret; } diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h index 79154f0f674a..c25d75ef9303 100644 --- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h +++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h @@ -10,6 +10,7 @@ #include #include #include +#include #include #define SUN8I_HDMI_PHY_DBG_CTRL_REG 0x0000 @@ -173,6 +174,7 @@ struct sun8i_dw_hdmi { struct drm_encoder encoder; struct sun8i_hdmi_phy *phy; struct dw_hdmi_plat_data plat_data; + struct regulator *vcc_hdmi; struct reset_control *rst_ctrl; };