From patchwork Tue Nov 13 11:16:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10680327 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 0FC4A14E2 for ; Tue, 13 Nov 2018 11:21:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F232029A6E for ; Tue, 13 Nov 2018 11:21:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E54AA2A3BA; Tue, 13 Nov 2018 11:21:27 +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=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW 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 88D5F29A6E for ; Tue, 13 Nov 2018 11:21:27 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version: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=3ELU2FpzoX1TDQbHzrWcERSSGule9jfxCRVxk3uwTS0=; b=FZJ+RWct77j7lP WLJyBkd1tQBpT8tEYeZQ6eReJeSS1Q4pEgzM+GLdbK/P3tEDGWaCUOOw7gXBd2QaaLWfLL9bK5dba KmQZqmh7WuDfVoCr+zl8Z/PLeGsrNJ1hIIb1hz/hd+wfwTlOrZcTE9cAsRtPSOrt37UsbqFQwfkou a/FEHq/cCzS7RDTJKy2lICUyx1A2oEpDUKYfc4jkLHkY65A/d1Wnl1hcdp8jV5ZsKxOXTuUGiz67m u+UT/P25H79KsRhN5fLsdaLexMKJwwSyjyzO8L0KToCVHjrOnA+bDUjMflfQwNjrJGyEax+jpEaCH Y6FJcRt2H8O2sjM0viwQ==; 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 1gMWkx-0003u1-CS; Tue, 13 Nov 2018 11:21:19 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gMWiQ-0000Fy-1W for linux-arm-kernel@lists.infradead.org; Tue, 13 Nov 2018 11:18:47 +0000 Received: by mail-pf1-x444.google.com with SMTP id s9-v6so5866866pfm.13 for ; Tue, 13 Nov 2018 03:18:31 -0800 (PST) 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 :mime-version:content-transfer-encoding; bh=OkLnvoOX4ZeeFgDP21cZlyAYt8eoNNgptp85ozSuxkM=; b=hIlJQVhVUdQcaqiwZ8zMD9S/GTPcfU6bGult6R0AmcVzWlMLUbeG3105tQrLOAYyXU yuu/MRK3A+caQcXCMNfAzdWQ0xzQGCaAVnjXCU0bdc47FRKo2002zGOEXkYBrjtmS5Vi S0683JP7LD80DGI7FN52fsFhJT4RBqaH7Qp4Q= 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=OkLnvoOX4ZeeFgDP21cZlyAYt8eoNNgptp85ozSuxkM=; b=YgWefm3J3lmnGwxxzAF1oMfzdOfx1zneDrIceQcdhCIRcBDIL6JYrG3I0H6CMTnGz0 Z9ajYiB1nlZQ6zRXKFZzxMyyCzciAAJktzPowmNo3qVcT/72SB/oOUoyF8B4J3N5dei7 VKg17sCj9wCEAPBqk9cc2Fwsqxi6e4OQDQmXzQMx3ZtLt7TWkFjbZiZCXEIplM8DMrIK B0YMIXiLUxhs2C5fJXYe1HGdWVA73EzKPLNANF+zH6c6DZq2q2WFDbVkt2s0IGSLiSQM 1NXTO2njAxBYB7jYfBHwIFu+ay2MYv9Std/gLdmgsRUBx6GVFG/UfCmkMowO0rWtFZeb yrFA== X-Gm-Message-State: AGRZ1gKU/e/YEEJBrLpIvxhzpjzQjxNwJxiMIGb0NDJwqNGStioc0L9I 8Ad0hc9ylWLOoBr2mPAinZ3rtQ== X-Google-Smtp-Source: AJdET5e4RQjmGf7Y5LCHGUZh9GSy6Fvzs9Y4bDH3tpboGx83iiu0Jce0FHPu48sC2J1+B+Be+HoBMA== X-Received: by 2002:a63:dd55:: with SMTP id g21mr4294702pgj.86.1542107910969; Tue, 13 Nov 2018 03:18:30 -0800 (PST) Received: from localhost.localdomain ([2401:4900:3670:3f11:bc71:2ef7:4a39:e260]) by smtp.gmail.com with ESMTPSA id 27-v6sm28531377pfm.36.2018.11.13.03.18.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 03:18:30 -0800 (PST) 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, linux-amarula@amarulasolutions.com Subject: [PATCH v4 16/26] drm/sun4i: sun6i_mipi_dsi: Add support for VCC-DSI voltage regulator Date: Tue, 13 Nov 2018 16:46:23 +0530 Message-Id: <20181113111633.20189-17-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181113111633.20189-1-jagan@amarulasolutions.com> References: <20181113111633.20189-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181113_031842_091225_495F78D1 X-CRM114-Status: GOOD ( 15.81 ) 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: Jagan Teki 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 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 --- 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 703722f7c81b..2ea33db61ae1 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -1026,6 +1026,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 VCC-DSI supply\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)) { @@ -1107,6 +1113,13 @@ static int sun6i_dsi_remove(struct platform_device *pdev) static int __maybe_unused sun6i_dsi_runtime_resume(struct device *dev) { struct sun6i_dsi *dsi = dev_get_drvdata(dev); + int err; + + err = regulator_enable(dsi->regulator); + if (err) { + dev_err(dsi->dev, "failed to enable VCC-DSI supply: %d\n", err); + return err; + } reset_control_deassert(dsi->reset); if (dsi->variant->has_mod_clk) @@ -1141,6 +1154,7 @@ static int __maybe_unused sun6i_dsi_runtime_suspend(struct device *dev) if (dsi->variant->has_mod_clk) clk_disable_unprepare(dsi->mod_clk); reset_control_assert(dsi->reset); + regulator_disable(dsi->regulator); return 0; } 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;