cpufreq: qcom-hw: provide online/offline operations

Provide lightweight online and offline operations. This saves us from
parsing and tearing down the OPP tables each time the CPU is put online
or offline.

Tested-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
Reviewed-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
This commit is contained in:
Dmitry Baryshkov 2022-03-26 18:51:53 +03:00 committed by Viresh Kumar
parent 6240aaad75
commit a1eb080a04

View File

@ -423,10 +423,26 @@ static int qcom_cpufreq_hw_lmh_init(struct cpufreq_policy *policy, int index)
return 0; return 0;
} }
static void qcom_cpufreq_hw_lmh_exit(struct qcom_cpufreq_data *data) static int qcom_cpufreq_hw_cpu_online(struct cpufreq_policy *policy)
{ {
struct qcom_cpufreq_data *data = policy->driver_data;
struct platform_device *pdev = cpufreq_get_driver_data();
int ret;
ret = irq_set_affinity_hint(data->throttle_irq, policy->cpus);
if (ret)
dev_err(&pdev->dev, "Failed to set CPU affinity of %s[%d]\n",
data->irq_name, data->throttle_irq);
return ret;
}
static int qcom_cpufreq_hw_cpu_offline(struct cpufreq_policy *policy)
{
struct qcom_cpufreq_data *data = policy->driver_data;
if (data->throttle_irq <= 0) if (data->throttle_irq <= 0)
return; return 0;
mutex_lock(&data->throttle_lock); mutex_lock(&data->throttle_lock);
data->cancel_throttle = true; data->cancel_throttle = true;
@ -434,6 +450,12 @@ static void qcom_cpufreq_hw_lmh_exit(struct qcom_cpufreq_data *data)
cancel_delayed_work_sync(&data->throttle_work); cancel_delayed_work_sync(&data->throttle_work);
irq_set_affinity_hint(data->throttle_irq, NULL); irq_set_affinity_hint(data->throttle_irq, NULL);
return 0;
}
static void qcom_cpufreq_hw_lmh_exit(struct qcom_cpufreq_data *data)
{
free_irq(data->throttle_irq, data); free_irq(data->throttle_irq, data);
} }
@ -590,6 +612,8 @@ static struct cpufreq_driver cpufreq_qcom_hw_driver = {
.get = qcom_cpufreq_hw_get, .get = qcom_cpufreq_hw_get,
.init = qcom_cpufreq_hw_cpu_init, .init = qcom_cpufreq_hw_cpu_init,
.exit = qcom_cpufreq_hw_cpu_exit, .exit = qcom_cpufreq_hw_cpu_exit,
.online = qcom_cpufreq_hw_cpu_online,
.offline = qcom_cpufreq_hw_cpu_offline,
.register_em = cpufreq_register_em_with_opp, .register_em = cpufreq_register_em_with_opp,
.fast_switch = qcom_cpufreq_hw_fast_switch, .fast_switch = qcom_cpufreq_hw_fast_switch,
.name = "qcom-cpufreq-hw", .name = "qcom-cpufreq-hw",