[PATCH v2 4/7] drm/panfrost: Add support for a second regulator for the GPU
From: Nicolas Boichat
Date: Wed Jan 08 2020 - 00:24:18 EST
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@xxxxxxxxxxxx>
---
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