Skip to content

Commit a1eb080

Browse files
lumagvireshk
authored andcommitted
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>
1 parent 6240aaa commit a1eb080

1 file changed

Lines changed: 26 additions & 2 deletions

File tree

drivers/cpufreq/qcom-cpufreq-hw.c

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,17 +423,39 @@ static int qcom_cpufreq_hw_lmh_init(struct cpufreq_policy *policy, int index)
423423
return 0;
424424
}
425425

426-
static void qcom_cpufreq_hw_lmh_exit(struct qcom_cpufreq_data *data)
426+
static int qcom_cpufreq_hw_cpu_online(struct cpufreq_policy *policy)
427427
{
428+
struct qcom_cpufreq_data *data = policy->driver_data;
429+
struct platform_device *pdev = cpufreq_get_driver_data();
430+
int ret;
431+
432+
ret = irq_set_affinity_hint(data->throttle_irq, policy->cpus);
433+
if (ret)
434+
dev_err(&pdev->dev, "Failed to set CPU affinity of %s[%d]\n",
435+
data->irq_name, data->throttle_irq);
436+
437+
return ret;
438+
}
439+
440+
static int qcom_cpufreq_hw_cpu_offline(struct cpufreq_policy *policy)
441+
{
442+
struct qcom_cpufreq_data *data = policy->driver_data;
443+
428444
if (data->throttle_irq <= 0)
429-
return;
445+
return 0;
430446

431447
mutex_lock(&data->throttle_lock);
432448
data->cancel_throttle = true;
433449
mutex_unlock(&data->throttle_lock);
434450

435451
cancel_delayed_work_sync(&data->throttle_work);
436452
irq_set_affinity_hint(data->throttle_irq, NULL);
453+
454+
return 0;
455+
}
456+
457+
static void qcom_cpufreq_hw_lmh_exit(struct qcom_cpufreq_data *data)
458+
{
437459
free_irq(data->throttle_irq, data);
438460
}
439461

@@ -590,6 +612,8 @@ static struct cpufreq_driver cpufreq_qcom_hw_driver = {
590612
.get = qcom_cpufreq_hw_get,
591613
.init = qcom_cpufreq_hw_cpu_init,
592614
.exit = qcom_cpufreq_hw_cpu_exit,
615+
.online = qcom_cpufreq_hw_cpu_online,
616+
.offline = qcom_cpufreq_hw_cpu_offline,
593617
.register_em = cpufreq_register_em_with_opp,
594618
.fast_switch = qcom_cpufreq_hw_fast_switch,
595619
.name = "qcom-cpufreq-hw",

0 commit comments

Comments
 (0)