From patchwork Fri Oct 26 14:43:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10659103 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 75EDE14DE for ; Mon, 29 Oct 2018 11:11:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 66B4529724 for ; Mon, 29 Oct 2018 11:11:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 57F9B29870; Mon, 29 Oct 2018 11:11:20 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED 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 07C6329724 for ; Mon, 29 Oct 2018 11:11:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0A34589D5B; Mon, 29 Oct 2018 11:10:36 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by gabe.freedesktop.org (Postfix) with ESMTPS id 035786E4A7 for ; Fri, 26 Oct 2018 14:45:43 +0000 (UTC) Received: by mail-pg1-x543.google.com with SMTP id z2-v6so660631pgp.0 for ; Fri, 26 Oct 2018 07:45:42 -0700 (PDT) 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:mime-version:content-transfer-encoding; bh=hFXSuNqrssYbWTTz3HCAz9AYQlGBmTmtTIlmYuYmHlg=; b=sdI538qCwrj5P6ysPznIRIe74+0x2pVsBQ1Gy7JqZNn2iJMOlWnLcT4hGepODvsVBa YH3nIvzEdxjJ8Q/Ffc/kbYQf3zzPR4pVd1QAUdPgoYVRrIshwbnXtJezrvCm36OPlEGH WEOVNsKlEqd8yZeZOaGJYWsmXvO825o43S3rzmR50pOT3I8Yqp363PhMa+nqDHE5mTck JFhRPT2HEoWaEDEvdBzktjez6wwz2W7RhMjI6rcdb1HJ/GenAmwmXll38TtRzCquDTiD bLLgtli7f9GkYrSd9X6wsid4hydFZj1N/+y4m7PRxNKHqK+T7cIK4yR6XCw81KMPkGMu qjIg== X-Gm-Message-State: AGRZ1gK9ejaBfn836MTLDUzHbmRghc4E+2v7KTBkJscI9SSg5z+WadA3 H3cOsmik4iPDHrBR4D2EIdyeqw== X-Google-Smtp-Source: AJdET5fpKXQ9TMHJ93fYydde3aZ5tiYcPMcXp1K5AadZV/Op5N1E1lv427KgTgLNdNnB7ESJQ0yxnw== X-Received: by 2002:a63:df03:: with SMTP id u3-v6mr3640604pgg.362.1540565142552; Fri, 26 Oct 2018 07:45:42 -0700 (PDT) Received: from localhost.localdomain ([27.7.51.1]) by smtp.gmail.com with ESMTPSA id z22-v6sm12044467pgv.24.2018.10.26.07.45.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Oct 2018 07:45:42 -0700 (PDT) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Icenowy Zheng , Jernej Skrabec , Vasily Khoruzhick , Rob Herring , Mark Rutland , Catalin Marinas , Will Deacon , David Airlie , dri-devel@lists.freedesktop.org, Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, Michael Trimarchi , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: [PATCH v3 16/25] drm/sun4i: sun6i_mipi_dsi: Add support for VCC-DSI voltage regulator Date: Fri, 26 Oct 2018 20:13:35 +0530 Message-Id: <20181026144344.27778-17-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181026144344.27778-1-jagan@amarulasolutions.com> References: <20181026144344.27778-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 29 Oct 2018 11:10:30 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jagan Teki Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Some boards have VCC-DSI pin connected to voltage regulator which may not be turned on by default. Add support for such boards by adding voltage regulator handling code to MIPI DSI driver. Signed-off-by: Jagan Teki Tested-by: Jagan Teki --- Changes for v3: - new patch Changes for v2: - none drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 14 ++++++++++++++ drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h | 3 +++ 2 files changed, 17 insertions(+) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index 42bd7506abaf..bc57343592e0 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -949,6 +949,12 @@ static int sun6i_dsi_bind(struct device *dev, struct device *master, dsi->drv = drv; + ret = regulator_enable(dsi->regulator); + if (ret) { + dev_err(dev, "Failed to enable regulator\n"); + return ret; + } + drm_encoder_helper_add(&dsi->encoder, &sun6i_dsi_enc_helper_funcs); ret = drm_encoder_init(drm, @@ -980,6 +986,7 @@ static int sun6i_dsi_bind(struct device *dev, struct device *master, err_cleanup_connector: drm_encoder_cleanup(&dsi->encoder); + regulator_disable(dsi->regulator); return ret; } @@ -989,6 +996,7 @@ static void sun6i_dsi_unbind(struct device *dev, struct device *master, struct sun6i_dsi *dsi = dev_get_drvdata(dev); drm_panel_detach(dsi->panel); + regulator_disable(dsi->regulator); } static const struct component_ops sun6i_dsi_ops = { @@ -1022,6 +1030,12 @@ static int sun6i_dsi_probe(struct platform_device *pdev) return PTR_ERR(base); } + dsi->regulator = devm_regulator_get(dev, "vcc-dsi"); + if (IS_ERR(dsi->regulator)) { + dev_err(dev, "Couldn't get regulator\n"); + return PTR_ERR(dsi->regulator); + } + dsi->regs = devm_regmap_init_mmio_clk(dev, "bus", base, &sun6i_dsi_regmap_config); if (IS_ERR(dsi->regs)) { diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h index 597b62227019..0df60f84bab3 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h @@ -13,6 +13,8 @@ #include #include +#include + struct sun6i_dphy { struct clk *bus_clk; struct clk *mod_clk; @@ -32,6 +34,7 @@ struct sun6i_dsi { struct clk *bus_clk; struct clk *mod_clk; struct regmap *regs; + struct regulator *regulator; struct reset_control *reset; struct sun6i_dphy *dphy;