From ae9a616649c4c28bcaa1054081ebac436c921043 Mon Sep 17 00:00:00 2001 From: Daeyeong Lee Date: Tue, 13 Feb 2018 20:25:25 +0900 Subject: [PATCH] [COMMON] soc: samsung: topology: Add cpu_coregroup_energy Change-Id: Id4217ed4887e37a74971a35c6a3c931ddeafbbd6 Signed-off-by: Daeyeong Lee --- drivers/soc/samsung/exynos-topology.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/soc/samsung/exynos-topology.c b/drivers/soc/samsung/exynos-topology.c index 559511766d85..9e358b3ce4ef 100644 --- a/drivers/soc/samsung/exynos-topology.c +++ b/drivers/soc/samsung/exynos-topology.c @@ -302,10 +302,23 @@ const struct sched_group_energy * const cpu_core_energy(int cpu) } static inline -const struct sched_group_energy * const cpu_cluster_energy(int cpu) +const struct sched_group_energy * const cpu_coregroup_energy(int cpu) { struct sched_group_energy *sge = sge_array[cpu][SD_LEVEL1]; + if (!sge) { + pr_warn("Invalid sched_group_energy for Coregroup%d\n", cpu); + return NULL; + } + + return sge; +} + +static inline +const struct sched_group_energy * const cpu_cluster_energy(int cpu) +{ + struct sched_group_energy *sge = sge_array[cpu][SD_LEVEL2]; + if (!sge) { pr_warn("Invalid sched_group_energy for Cluster%d\n", cpu); return NULL; @@ -317,7 +330,7 @@ const struct sched_group_energy * const cpu_cluster_energy(int cpu) static inline const struct sched_group_energy * const cpu_system_energy(int cpu) { - struct sched_group_energy *sge = sge_array[cpu][SD_LEVEL2]; + struct sched_group_energy *sge = sge_array[cpu][SD_LEVEL3]; if (!sge) { pr_warn("Invalid sched_group_energy for System%d\n", cpu); @@ -331,7 +344,7 @@ static struct sched_domain_topology_level arm64_topology[] = { #ifdef CONFIG_SCHED_MC { cpu_coregroup_mask, core_flags, cpu_core_energy, SD_INIT_NAME(MC) }, #endif - { cpu_cluster_mask, cluster_flags, SD_INIT_NAME(DSU) }, + { cpu_cluster_mask, cluster_flags, cpu_coregroup_energy, SD_INIT_NAME(DSU) }, { cpu_cpu_mask, cpu_flags, cpu_cluster_energy, SD_INIT_NAME(DIE) }, { cpu_cpu_mask, NULL, cpu_system_energy, SD_INIT_NAME(SYS) }, { NULL, } -- 2.20.1