aboutsummaryrefslogtreecommitdiffstats
path: root/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali/0005-linux-mali_kernel_linux.c-Handle-clock-when-probed-a.patch
blob: 3d78460421fb1ccad26239fd24fe845959642903 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
From e67e20ec6ff0c9720d87844270421453c738066a Mon Sep 17 00:00:00 2001
From: Madhurkiran Harikrishnan <madhurki@xilinx.com>
Date: Thu, 16 Feb 2017 12:15:58 -0800
Subject: [PATCH 5/9] linux/mali_kernel_linux.c: Handle clock when probed and
 removed

This patch will handle the clock through clock
specifier for GPU PP0 and PP1.

Signed-off-by: Madhurkiran Harikrishnan <madhurki@xilinx.com>
Upstream Status: Inappropriate [Xilinx specific]
---
 .../src/devicedrv/mali/linux/mali_kernel_linux.c   | 40 +++++++++++++++++++++-
 1 file changed, 39 insertions(+), 1 deletion(-)

diff --git a/driver/src/devicedrv/mali/linux/mali_kernel_linux.c b/driver/src/devicedrv/mali/linux/mali_kernel_linux.c
index d7893a3..f15fb56 100644
--- linux/mali_kernel_linux.c
+++ b/linux/mali_kernel_linux.c
@@ -45,6 +45,14 @@
 #if defined(CONFIG_MALI400_INTERNAL_PROFILING)
 #include "mali_profiling_internal.h"
 #endif
+
+#if defined(CONFIG_ARCH_ZYNQMP)
+/* Initialize variables for clocks */
+struct clk *clk_gpu;
+struct clk *clk_gpu_pp0;
+struct clk *clk_gpu_pp1;
+#endif
+
 #if defined(CONFIG_MALI400_PROFILING) && defined(CONFIG_MALI_DVFS)
 #include "mali_osk_profiling.h"
 #include "mali_dvfs_policy.h"
@@ -580,7 +588,23 @@ static int mali_probe(struct platform_device *pdev)
 	}
 #endif
 
-
+#if defined(CONFIG_ARCH_ZYNQMP)
+	/* Initialize clocks for GPU and PP */
+	clk_gpu = devm_clk_get(&pdev->dev, "gpu");
+	if (IS_ERR(clk_gpu))
+		return PTR_ERR(clk_gpu);
+	clk_prepare_enable(clk_gpu);
+
+	clk_gpu_pp0 = devm_clk_get(&pdev->dev, "gpu_pp0");
+	if (IS_ERR(clk_gpu_pp0))
+		return PTR_ERR(clk_gpu_pp0);
+	clk_prepare_enable(clk_gpu_pp0);
+
+	clk_gpu_pp1 = devm_clk_get(&pdev->dev, "gpu_pp1");
+	if (IS_ERR(clk_gpu_pp1))
+		return PTR_ERR(clk_gpu_pp1);
+	clk_prepare_enable(clk_gpu_pp1);
+#endif
 	if (_MALI_OSK_ERR_OK == _mali_osk_wq_init()) {
 		/* Initialize the Mali GPU HW specified by pdev */
 		if (_MALI_OSK_ERR_OK == mali_initialize_subsystems()) {
@@ -608,6 +632,12 @@ static int mali_probe(struct platform_device *pdev)
 		_mali_osk_wq_term();
 	}
 
+#if defined(CONFIG_ARCH_ZYNQMP)
+	clk_disable_unprepare(clk_gpu);
+	clk_disable_unprepare(clk_gpu_pp0);
+	clk_disable_unprepare(clk_gpu_pp1);
+#endif
+
 #ifdef CONFIG_MALI_DEVFREQ
 	mali_devfreq_term(mdev);
 devfreq_init_failed:
@@ -673,6 +703,14 @@ static int mali_remove(struct platform_device *pdev)
 	mali_platform_device_deinit(mali_platform_device);
 #endif
 	mali_platform_device = NULL;
+
+#if defined(CONFIG_ARCH_ZYNQMP)
+	/* Remove clock */
+	clk_disable_unprepare(clk_gpu);
+	clk_disable_unprepare(clk_gpu_pp0);
+	clk_disable_unprepare(clk_gpu_pp1);
+#endif
+
 	return 0;
 }
 
-- 
2.7.4