aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmit Daniel Kachhap <amit.kachhap@arm.com>2017-07-14 12:07:21 +0100
committerArvind Chauhan <arvind.chauhan@arm.com>2017-10-31 13:10:41 +0530
commit0aecb74c2c5cb22f4add6e1003180c3c8cbe05d6 (patch)
tree917f2d05e1c1dd5a505b7dd33ccea65cec02b10d
parent455d6cab9457ac76fc0aad2d23079186dcf3b33e (diff)
drivers: gpu: arm: add dvfs driver for gpu opp
Change-Id: I325f413fcc820ccfa0073f702279e97bb8b571cd Signed-off-by: Amit Daniel Kachhap <amit.kachhap@arm.com> Signed-off-by: Tushar Khandelwal <tushar.khandelwal@arm.com> [Resolved merge conflicts] Signed-off-by: Arvind Chauhan <arvind.chauhan@arm.com>
-rw-r--r--drivers/gpu/arm/midgard/platform/devicetree/Kbuild3
-rw-r--r--drivers/gpu/arm/midgard/platform/devicetree/scmi_mali_opp.c58
2 files changed, 60 insertions, 1 deletions
diff --git a/drivers/gpu/arm/midgard/platform/devicetree/Kbuild b/drivers/gpu/arm/midgard/platform/devicetree/Kbuild
index d40d7982ff04..802d7ba4a75f 100644
--- a/drivers/gpu/arm/midgard/platform/devicetree/Kbuild
+++ b/drivers/gpu/arm/midgard/platform/devicetree/Kbuild
@@ -15,4 +15,5 @@
mali_kbase-y += \
$(MALI_PLATFORM_DIR)/mali_kbase_config_devicetree.o \
- $(MALI_PLATFORM_DIR)/mali_kbase_runtime_pm.o
+ $(MALI_PLATFORM_DIR)/mali_kbase_runtime_pm.o \
+ $(MALI_PLATFORM_DIR)/scmi_mali_opp.o
diff --git a/drivers/gpu/arm/midgard/platform/devicetree/scmi_mali_opp.c b/drivers/gpu/arm/midgard/platform/devicetree/scmi_mali_opp.c
new file mode 100644
index 000000000000..2564416ecef3
--- /dev/null
+++ b/drivers/gpu/arm/midgard/platform/devicetree/scmi_mali_opp.c
@@ -0,0 +1,58 @@
+/*
+ *
+ * (C) COPYRIGHT 2017 ARM Limited. All rights reserved.
+ *
+ * This program is free software and is provided to you under the terms of the
+ * GNU General Public License version 2 as published by the Free Software
+ * Foundation, and any use by you of this program is subject to the terms
+ * of such GNU licence.
+ *
+ * A copy of the licence is included with the program, and can also be obtained
+ * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/of_platform.h>
+#include <linux/platform_device.h>
+#include <linux/pm_opp.h>
+#include <linux/scmi_protocol.h>
+#include <linux/version.h>
+
+static int scmi_gpu_opps_probe(struct platform_device *pdev)
+{
+ struct device_node *np;
+ struct platform_device *gpu_pdev;
+ int err;
+
+ np = of_find_node_by_name(NULL, "gpu");
+ if (!np) {
+ dev_err(&pdev->dev, "Failed to find DT entry for Mali\n");
+ return -EFAULT;
+ }
+
+ gpu_pdev = of_find_device_by_node(np);
+ if (!gpu_pdev) {
+ dev_err(&pdev->dev, "Failed to find device for Mali\n");
+ of_node_put(np);
+ return -EFAULT;
+ }
+
+ of_node_put(np);
+
+ return err;
+}
+
+
+static struct platform_driver scmi_gpu_opp_driver = {
+ .driver = {
+ .name = "scmi_gpu_opp",
+ },
+ .probe = scmi_gpu_opps_probe,
+};
+module_platform_driver(scmi_gpu_opp_driver);
+
+MODULE_AUTHOR("Amit Kachhap <amit.kachhap@arm.com>");
+MODULE_DESCRIPTION("ARM SCMI GPU opp driver");
+MODULE_LICENSE("GPL v2");