[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200108052337.65916-5-drinkcat@chromium.org>
Date: Wed, 8 Jan 2020 13:23:34 +0800
From: Nicolas Boichat <drinkcat@...omium.org>
To: Rob Herring <robh+dt@...nel.org>
Cc: David Airlie <airlied@...ux.ie>, Daniel Vetter <daniel@...ll.ch>,
Mark Rutland <mark.rutland@....com>,
Matthias Brugger <matthias.bgg@...il.com>,
Tomeu Vizoso <tomeu.vizoso@...labora.com>,
Steven Price <steven.price@....com>,
Alyssa Rosenzweig <alyssa.rosenzweig@...labora.com>,
Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
dri-devel@...ts.freedesktop.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org, hsinyi@...omium.org
Subject: [PATCH v2 4/7] drm/panfrost: Add support for a second regulator for the GPU
Some GPUs, namely, the bifrost/g72 part on MT8183, have a second
regulator for their SRAM, let's add support for that.
Signed-off-by: Nicolas Boichat <drinkcat@...omium.org>
---
drivers/gpu/drm/panfrost/panfrost_device.c | 21 +++++++++++++++++++++
drivers/gpu/drm/panfrost/panfrost_device.h | 1 +
2 files changed, 22 insertions(+)
diff --git a/drivers/gpu/drm/panfrost/panfrost_device.c b/drivers/gpu/drm/panfrost/panfrost_device.c
index 238fb6d54df4732..a0b0a6fef8b4e63 100644
--- a/drivers/gpu/drm/panfrost/panfrost_device.c
+++ b/drivers/gpu/drm/panfrost/panfrost_device.c
@@ -102,12 +102,33 @@ static int panfrost_regulator_init(struct panfrost_device *pfdev)
return ret;
}
+ pfdev->regulator_sram = devm_regulator_get_optional(pfdev->dev, "sram");
+ if (IS_ERR(pfdev->regulator_sram)) {
+ ret = PTR_ERR(pfdev->regulator_sram);
+ dev_err(pfdev->dev, "failed to get SRAM regulator: %d\n", ret);
+ goto err;
+ }
+
+ if (pfdev->regulator_sram) {
+ ret = regulator_enable(pfdev->regulator_sram);
+ if (ret < 0) {
+ dev_err(pfdev->dev,
+ "failed to enable SRAM regulator: %d\n", ret);
+ goto err;
+ }
+ }
+
return 0;
+
+err:
+ regulator_disable(pfdev->regulator);
+ return ret;
}
static void panfrost_regulator_fini(struct panfrost_device *pfdev)
{
regulator_disable(pfdev->regulator);
+ regulator_disable(pfdev->regulator_sram);
}
int panfrost_device_init(struct panfrost_device *pfdev)
diff --git a/drivers/gpu/drm/panfrost/panfrost_device.h b/drivers/gpu/drm/panfrost/panfrost_device.h
index 06713811b92cdf7..a124334d69e7e93 100644
--- a/drivers/gpu/drm/panfrost/panfrost_device.h
+++ b/drivers/gpu/drm/panfrost/panfrost_device.h
@@ -60,6 +60,7 @@ struct panfrost_device {
struct clk *clock;
struct clk *bus_clock;
struct regulator *regulator;
+ struct regulator *regulator_sram;
struct reset_control *rstc;
struct panfrost_features features;
--
2.24.1.735.g03f4e72817-goog
Powered by blists - more mailing lists