summaryrefslogtreecommitdiffstats
path: root/meta-eas/recipes-kernel/linux/linux-renesas/0071-arm64-Add-Hikey-energy-model.patch
blob: 891ca92a7ce13ff39ce4c797ccf10f813ab127f0 (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
From 0eeb3c8bc2f3436b44096bd0659050ce301f49ae Mon Sep 17 00:00:00 2001
From: Dietmar Eggemann <dietmar.eggemann@arm.com>
Date: Tue, 16 Aug 2016 14:10:38 +0100
Subject: [PATCH 71/92] arm64: Add Hikey energy model

Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
(cherry picked from commit 75751f967eca10b6cced89831efa39d28699ba37)
Signed-off-by: Gaku Inami <gaku.inami.xw@bp.renesas.com>
---
 arch/arm64/kernel/energy_model.h | 52 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/arch/arm64/kernel/energy_model.h b/arch/arm64/kernel/energy_model.h
index 170dd84..a71c78d 100644
--- a/arch/arm64/kernel/energy_model.h
+++ b/arch/arm64/kernel/energy_model.h
@@ -107,6 +107,52 @@
 	  .cap_states     = cap_states_core_juno_a57,
 };
 
+/* HiKey */
+
+static struct idle_state idle_states_cluster_hikey[] = {
+	{ .power = 107 }, /* arch_cpu_idle() (active idle) = WFI */
+	{ .power = 107 }, /* WFI */
+	{ .power =  47 }, /* cpu-sleep */
+	{ .power =   0 }, /* cluster-sleep */
+};
+
+static struct capacity_state cap_states_cluster_hikey[] = {
+	{ .cap =  178, .power =  16, }, /*  208 MHz */
+	{ .cap =  369, .power =  29, }, /*  432 MHz */
+	{ .cap =  622, .power =  47, }, /*  729 MHz */
+	{ .cap =  819, .power =  75, }, /*  960 MHz */
+	{ .cap = 1024, .power = 112, }, /* 1200 MHz */
+};
+
+static struct sched_group_energy energy_cluster_hikey = {
+	.nr_idle_states = ARRAY_SIZE(idle_states_cluster_hikey),
+	.idle_states    = idle_states_cluster_hikey,
+	.nr_cap_states  = ARRAY_SIZE(cap_states_cluster_hikey),
+	.cap_states     = cap_states_cluster_hikey,
+};
+
+static struct idle_state idle_states_core_hikey[] = {
+	{ .power = 15 }, /* arch_cpu_idle() (active idle) = WFI */
+	{ .power = 15 }, /* WFI */
+	{ .power =  0 }, /* cpu-sleep */
+	{ .power =  0 }, /* cluster-sleep */
+};
+
+static struct capacity_state cap_states_core_hikey[] = {
+	{ .cap =  178, .power =  69, }, /*  208 MHz */
+	{ .cap =  369, .power = 125, }, /*  432 MHz */
+	{ .cap =  622, .power = 224, }, /*  729 MHz */
+	{ .cap =  819, .power = 367, }, /*  960 MHz */
+	{ .cap = 1024, .power = 670, }, /* 1200 MHz */
+};
+
+static struct sched_group_energy energy_core_hikey = {
+	.nr_idle_states = ARRAY_SIZE(idle_states_core_hikey),
+	.idle_states    = idle_states_core_hikey,
+	.nr_cap_states  = ARRAY_SIZE(cap_states_core_hikey),
+	.cap_states     = cap_states_core_hikey,
+};
+
 /* An energy model contains core and cluster sched group energy for 2
  * clusters (cluster id 0 and 1). set_energy_model() relies on this
  * feature. It is enforced by a BUG_ON in energy().
@@ -122,8 +168,14 @@ struct energy_model {
 	{ &energy_cluster_juno_a57, &energy_cluster_juno_a53, },
 };
 
+static struct energy_model hikey_model = {
+	{ &energy_core_hikey, &energy_core_hikey, },
+	{ &energy_cluster_hikey, &energy_cluster_hikey, },
+};
+
 static struct of_device_id model_matches[] = {
 	{ .compatible = "arm,juno", .data = &juno_model },
+	{ .compatible = "hisilicon,hi6220-hikey", .data = &hikey_model },
 	{},
 };
 
-- 
1.9.1