Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2393203imu; Thu, 24 Jan 2019 12:00:52 -0800 (PST) X-Google-Smtp-Source: ALg8bN56p6b4Ooyibjnnt6EEeO2yOAhcU38LZvVOTYjZvmntN82lXlhEY8V0RGcPxFxXQ3V1hQab X-Received: by 2002:a62:5182:: with SMTP id f124mr7970815pfb.238.1548360052014; Thu, 24 Jan 2019 12:00:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548360051; cv=none; d=google.com; s=arc-20160816; b=iJEM0Ey/Mu8yRNmDVVMKvu+qDRrOnEIsTN/r0w2HbvZCWdvNHrErROWmlHapirWz12 KE+xx0/peuGV7D9KJTnF5BqOFByQOGzpZCvdMwKoF0e/EhkUIrwJ6tc4yYLEMkvaVx/G j28Hs3p+9tpiaTIAWmqj95reR6sEH34L7Nzc4/UjxdTVutRve+O2yxrmfy5V367v7s1b 1T+aYXl1z1j+0+5F8h6O/r3iHlCV8pjs0pG9K0ixtVHJGbRiQ44Plb0iFRpdgsfQGGzG 7OuNVbn6c1yzQFxOxv63hYeyE9bDQfvShORxFc06g0Y4nSUBCPu+KZKgBxwVVbNubWDV zrTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=MNcVG7JjZJxYSjToIwzsBT7cF1LnDkJMtO8vjjM/iYI=; b=y/ZHp7AvJwPfJvyNcXol+pr8fgjZUj2NRb4T6W3bfpwWBjE6azPp/wghIwh45fal2l mEeGGeO09jziuwIHxMqRN+gTtmYScFN1ZsmRvSO6bVzz71pprb4bDAJhrB9UNi4NNyqa SK3mCacTlP+85oIu3coYVDBpCjX/7y7UU2EIv9eqsdlZAhsEwHd2xt7LDgtx0ED+DznN GE3SsL/JfTwQeJVEQfMOLo7E93D8o65cWDGXbeDPXhArefCCT88whilpl1haDhAsTI+y YRQS1XpLnNn5euAZZGprFr4809Ox34jMtO3nF0PHZv3NOWTtW+ade+Cr334vxCPbaYld aNow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=M0xo5hHQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d4si22986133pla.58.2019.01.24.12.00.36; Thu, 24 Jan 2019 12:00:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=M0xo5hHQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732314AbfAXUAa (ORCPT + 99 others); Thu, 24 Jan 2019 15:00:30 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:43708 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731678AbfAXUA2 (ORCPT ); Thu, 24 Jan 2019 15:00:28 -0500 Received: by mail-pf1-f196.google.com with SMTP id w73so3515920pfk.10 for ; Thu, 24 Jan 2019 12:00:28 -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=MNcVG7JjZJxYSjToIwzsBT7cF1LnDkJMtO8vjjM/iYI=; b=M0xo5hHQFL0meWnF0pmr5OQUf9Hqaz0UB3gfOzmleILi9XCpEOkGIioJrBKOYsBgdJ K+tdO5kFAonmFJ4uq/vBMttkV+fxKzs/zsrfrX5xrm+48bOYaHGbq1zgWbzmnopxZNl+ uVQy+wwlBg2OPnKVoVmL9rGB96ny5/FV+qNmI= 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=MNcVG7JjZJxYSjToIwzsBT7cF1LnDkJMtO8vjjM/iYI=; b=R2UEh0n0iCuu5uCe2jQUP0Jxv2+LrOJEhETwIXDVot+EBTdL3mjcemAg9xuzFiIIv0 emrajwxRVsfkMjn3ObquXicZeWfqB3Rao/AKBHS5qqAsukpeQO1iANvJBLimQ05buWCA TeMVhffK0Y0Gha++EaKStlVOG8b1Gpynh9IHXlupOWBeWRR62jlnNKSW7tR9z0m35pGh hwstSLHDR/qhnB0ZxOX/MGilYxJ+blO2hd7UxQNNjd2L6gETi1FaKwjLVQUY4KX8cPEn 3YvKJqleQsLTG8C9I3cMWSKYdAOGcCgP3ggdFN61wtT+MFXcADWc7czzb1eaAMmu9JPh /Low== X-Gm-Message-State: AJcUukeSY10ek90DNlXuSjWB8vUpJMVMUpeqLYew13O9+Mj21yHa3V9t 0g3UbRE7DXDu+IBtTv9HruZJQA== X-Received: by 2002:a62:44d8:: with SMTP id m85mr7989017pfi.164.1548360027770; Thu, 24 Jan 2019 12:00:27 -0800 (PST) Received: from localhost.localdomain ([115.97.179.75]) by smtp.gmail.com with ESMTPSA id x11sm61637003pfe.72.2019.01.24.12.00.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Jan 2019 12:00:27 -0800 (PST) From: Jagan Teki To: Maxime Ripard , David Airlie , Daniel Vetter , Chen-Yu Tsai , Michael Turquette , Rob Herring , Mark Rutland Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, Michael Trimarchi , linux-amarula@amarulasolutions.com, linux-sunxi@googlegroups.com, Jagan Teki Subject: [PATCH v6 13/22] drm/sun4i: sun6i_mipi_dsi: Add support for VCC-DSI voltage regulator Date: Fri, 25 Jan 2019 01:28:51 +0530 Message-Id: <20190124195900.22620-14-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190124195900.22620-1-jagan@amarulasolutions.com> References: <20190124195900.22620-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 3d7c03161954..9be414131460 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -1107,6 +1107,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)) { @@ -1183,6 +1189,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); clk_prepare_enable(dsi->mod_clk); @@ -1215,6 +1228,7 @@ static int __maybe_unused sun6i_dsi_runtime_suspend(struct device *dev) 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 257cca660da0..06cce0d0d3ad 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; @@ -28,6 +30,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; -- 2.18.0.321.gffc6fa0e3