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: 24 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f200.google.com (cartago.priv [10.11.12.1]) by cassiopea (Postfix) with ESMTPS id D11072E5422 for ; Tue, 13 Nov 2018 12:18:32 +0100 (CET) Received: by mail-pf1-f200.google.com with SMTP id x5-v6sf10056491pfn.22 for ; Tue, 13 Nov 2018 03:18:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1542107911; cv=pass; d=google.com; s=arc-20160816; b=S+2zRW35VQZoZBBp81E/iRusCjtkjSculVc2Ei+EP37Rg+Iom8Z82c/J+VeFcOuNJl lB/m4IsGMD6gsTSVjMQu6lKME8dS4F6UevcoPK5H/ZvA9hmRmbfhQ+sb+BdNXHWA0Q20 brvbrNVhfwzbROeUVZXprObd9wgxx/fxkzIgxo2WUtdF9HJLmTVGY+JN2annpfAt7tKA hk3AdZw+hWk2bIyEhQwsJGfUlns8KIO2m7g44R2n5EgugUWpoCUs8fNCVt7WwMWVper5 w2ZmCg4zHHBo0C8X1fkChCXDHAJ3UDv7WSGkG53QOyqz5qEXadvW4/0s5GnWCZAWJHFZ RPUw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=OkLnvoOX4ZeeFgDP21cZlyAYt8eoNNgptp85ozSuxkM=; b=04enkfzj+ILF/fXJE1HkEvuYQyb45b0TUQEkU8gzAuthT3TUGSE6Q0q4scQ1vNiVRI QHr2GJg8bGFjaJQOp4kkiJY1aWQ/EbezzQZrh54tEw+O8V+hjihhGjUpKLB8qQi5lUcw n2xXrpBQcz7jng9vcyvEBqhwHOCeRzTqCnnbahms80DZ6J1ojefB5hK3hZHoQLzeCRSY J7vnr4/5G0vKa4Gwh5l9Hmx0f0mZmUCF8zdU86CIG0/4h2JSRbCrXm7olMKb4erOpvuR inCWGlAJKbolb1XC8Ax5IO6uOaWOpm9ombJNAO6C9I/FGO/YEAbjUxurhBPPK72qBt/I a6yg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=hIlJQVhV; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com 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:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=OkLnvoOX4ZeeFgDP21cZlyAYt8eoNNgptp85ozSuxkM=; b=L4k0aX7R9whFG07FLW0oMa+07lC+tZsR3Q4XSnsK+0j+KQ81EiEDkDOW8iKJ6EddKw qNVz5Ias/4NCMFN2vE7aMRgc5wJKQAfZnhQGOyUFrdG60bAYOSwOJQxKawbVxn308/Hh Um3HsRSofFXvg5Wgbk6xUFoVUE1gDCINwAAL4= 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:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=OkLnvoOX4ZeeFgDP21cZlyAYt8eoNNgptp85ozSuxkM=; b=CIetFrVGdK/Pit3jW0pOSbJCeGtpevcdmryTdgNEJET906+e8qo3ywD+4c1Q1NwFiX MZ6ri2wdr2P2DMcxO0I1+pY2zUYGzm8o0sc1wV8Nt2Fzl7QUsdrEVfb+pwurN6bbYZRC dFfPOAEmmNcS7cUSYD+hQ7cTqvxqup3Wo7px2/qYaQmdx2lYsT9GPEXxGsPLnDyfX/xR iYNu6jrwX/0xGsJiJFROWISnZO0eEWK/OMcs47lsNjrwPCsxWxMzAgCjEA6Ct35NqThH niBD+Ld1hgMk2xWGlGL9H6Re61B/nOvDL+F2m57WtbuCQPWZhwuvpWlFUuvCAmwF49G9 zWWA== X-Gm-Message-State: AGRZ1gI9b5MaXUopp/oP20NnaFNtcyCYB80gNFsMhevHhMNCRkj/r1rh ki/E882Ohq1SO7OnxHrszCBpJcEB X-Google-Smtp-Source: AJdET5d0o4H0uSWFD9KFQkwihAmePN0k13oFZSDR7IX25OKekmBa0gxAG6IrlKysbjbyMAKS54P15g== X-Received: by 2002:a63:2841:: with SMTP id o62mr1553288pgo.93.1542107911548; Tue, 13 Nov 2018 03:18:31 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a62:4494:: with SMTP id m20-v6ls4171272pfi.10.gmail; Tue, 13 Nov 2018 03:18:31 -0800 (PST) X-Received: by 2002:a63:f006:: with SMTP id k6mr4371801pgh.259.1542107911290; Tue, 13 Nov 2018 03:18:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542107911; cv=none; d=google.com; s=arc-20160816; b=Co7C6uyy63k1+NqGVSspNQXquKb8S4EOmrDJ/jtWXIgdxkX7mGDqXUmoazlOPvniQd eIpPl8SnURiJYyNg2+6KGtiA0V+DHkOVwe+p/hoTqknG6r8QAc6rZ4gbHDMQFO15wpfq 0G+lbYh17XuBmu9HfkU49OWChmnhsryXcxrSd+36Cac/ZPh4AiglJ0P164t3ueL/9X1F SqYoKhM8QlsBkeUzYLaXGceOB9RlkGrf7TKD72FeEbxNqNVpFPii782EU57qofkwCMfP TB/ryYIeAUrgfXMGtTxYeSoRgj7eIObvGUpw50G4jsPtcTMTQ07KkqksFRpQuPkUZ6lK l7gA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=OkLnvoOX4ZeeFgDP21cZlyAYt8eoNNgptp85ozSuxkM=; b=0kdKwg3+TFefwz0KbPKBVc+JfHZtiNYdiyK9vGkv4zGWUdKYi28zFHCxmcdFQfOLBq aQz807Eq03IB93H2QDQv2+EgcilyFxLM2eQqD+iGzTqyKJv0yUkw5dakP4Xuyzigb7fQ dMANt5OZT9LiCVMWXUeEzIzBzKTOfry4pzBdUeAV9UfflssMdrrhWkxm/WCX3yKJFgpA vQmgzXTp5Osdbhd2Cz1UlMfXjnUm7JjfMj6N5kwg+mkC/nUHhxmVAlOoqNgFGX2Ni2/2 s37FqL/TG/5sKFcsyDVMDzaAjqlD079wwL2NbLyLlQPonOp+rdbCXxetPt+kLt/vJLiM NbTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=hIlJQVhV; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id z20-v6sor21592887pgv.46.2018.11.13.03.18.31 for (Google Transport Security); Tue, 13 Nov 2018 03:18:31 -0800 (PST) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; 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 Cc: Jagan Teki 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-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=hIlJQVhV; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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;