diff options
| author | Bryan Huntsman <bryanh@codeaurora.org> | 2014-12-19 12:57:55 -0800 |
|---|---|---|
| committer | Arvin Quilao <arquilao@gmail.com> | 2017-03-07 04:09:21 +0000 |
| commit | cd34bed271b7b0a92310d96367a268d29dba85c8 (patch) | |
| tree | 588282f7ea146d0026c8bb2f171ff69becb7ff2e | |
| parent | 99ac21bdf91a1d7dc1d39342d50aff9142229d4e (diff) | |
qcom: core_ctl: Add support functions for core_ctl
Add support functions for core control driver. Also introduce
Kconfig for enabling core_ctl.
Change-Id: Ic127b6ed7d9450338883b13d9c42abfe49ff8b35
Signed-off-by: Bryan Huntsman <bryanh@codeaurora.org>
| -rw-r--r-- | drivers/soc/qcom/Kconfig | 8 | ||||
| -rw-r--r-- | drivers/soc/qcom/Makefile | 1 | ||||
| -rw-r--r-- | drivers/soc/qcom/core_ctl_helper.c | 62 | ||||
| -rw-r--r-- | include/soc/qcom/core_ctl.h | 25 |
4 files changed, 96 insertions, 0 deletions
diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig index bccf3a151f0..d9e670d2f24 100644 --- a/drivers/soc/qcom/Kconfig +++ b/drivers/soc/qcom/Kconfig @@ -546,6 +546,14 @@ config MSM_PACMAN This driver allows reconfiguration of the Bus Access Manager Low Speed Peripheral (BLSP) ownership. +config MSM_CORE_CTL_HELPER + tristate "Core control helper functions for dynamically hotplug CPUs" + help + Provide helper functions for core control driver. Core control + driver dynamicatlly hotplugs CPUs from kernel based on current + system load and state. It also supports limiting min and + max online CPUs from userspace. + config MSM_PERFORMANCE tristate "Core control driver to support userspace hotplug requests" help diff --git a/drivers/soc/qcom/Makefile b/drivers/soc/qcom/Makefile index 2621f65fc7e..c5b8a460fb7 100644 --- a/drivers/soc/qcom/Makefile +++ b/drivers/soc/qcom/Makefile @@ -56,6 +56,7 @@ obj-$(CONFIG_MSM_OCMEM) += ocmem.o ocmem_allocator.o ocmem_notifier.o obj-$(CONFIG_MSM_OCMEM) += ocmem_sched.o ocmem_api.o ocmem_rdm.o ocmem_core.o obj-$(CONFIG_MSM_PERFORMANCE) += msm_performance.o +obj-$(CONFIG_MSM_CORE_CTL_HELPER) += core_ctl_helper.o ifdef CONFIG_MSM_SUBSYSTEM_RESTART obj-y += subsystem_notif.o diff --git a/drivers/soc/qcom/core_ctl_helper.c b/drivers/soc/qcom/core_ctl_helper.c new file mode 100644 index 00000000000..3b25d9811cf --- /dev/null +++ b/drivers/soc/qcom/core_ctl_helper.c @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2014, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include <linux/cpu.h> +#include <linux/cpufreq.h> +#include <linux/ktime.h> +#include <linux/hrtimer.h> +#include <linux/module.h> +#include <linux/init.h> +#include <soc/qcom/core_ctl.h> + +void core_ctl_block_hotplug(void) +{ + get_online_cpus(); +} +EXPORT_SYMBOL(core_ctl_block_hotplug); + +void core_ctl_unblock_hotplug(void) +{ + put_online_cpus(); +} +EXPORT_SYMBOL(core_ctl_unblock_hotplug); + +s64 core_ctl_get_time(void) +{ + return ktime_to_ms(ktime_get()); +} +EXPORT_SYMBOL(core_ctl_get_time); + +struct cpufreq_policy *core_ctl_get_policy(int cpu) +{ + return cpufreq_cpu_get(cpu); +} +EXPORT_SYMBOL(core_ctl_get_policy); + +void core_ctl_put_policy(struct cpufreq_policy *policy) +{ + cpufreq_cpu_put(policy); +} +EXPORT_SYMBOL(core_ctl_put_policy); + +struct device *core_ctl_find_cpu_device(unsigned cpu) +{ + return get_cpu_device(cpu); +} +EXPORT_SYMBOL(core_ctl_find_cpu_device); + +int __ref core_ctl_online_core(unsigned int cpu) +{ + return cpu_up(cpu); +} +EXPORT_SYMBOL(core_ctl_online_core); diff --git a/include/soc/qcom/core_ctl.h b/include/soc/qcom/core_ctl.h new file mode 100644 index 00000000000..01f55e53cd4 --- /dev/null +++ b/include/soc/qcom/core_ctl.h @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2014, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef __SOC_QCOM_CORE_CTL_H +#define __SOC_QCOM_CORE_CTL_H + +extern void core_ctl_block_hotplug(void); +extern void core_ctl_unblock_hotplug(void); +extern s64 core_ctl_get_time(void); +extern struct cpufreq_policy *core_ctl_get_policy(int cpu); +extern void core_ctl_put_policy(struct cpufreq_policy *policy); +extern struct device *core_ctl_find_cpu_device(unsigned cpu); +extern int core_ctl_online_core(unsigned int cpu); + +#endif |
