lkml.org 
[lkml]   [2020]   [Jan]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2 4/7] drm/panfrost: Add support for a second regulator for the GPU
Date
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@chromium.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
\
 
 \ /
  Last update: 2020-01-08 06:25    [W:0.244 / U:0.268 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site