|
23 | 23 | #include <linux/nvmem-consumer.h>
|
24 | 24 | #include <linux/of.h>
|
25 | 25 | #include <linux/platform_device.h>
|
| 26 | +#include <linux/pm.h> |
26 | 27 | #include <linux/pm_domain.h>
|
27 | 28 | #include <linux/pm_opp.h>
|
28 | 29 | #include <linux/pm_runtime.h>
|
@@ -426,6 +427,18 @@ static const struct qcom_cpufreq_match_data match_data_ipq8074 = {
|
426 | 427 | .get_version = qcom_cpufreq_ipq8074_name_version,
|
427 | 428 | };
|
428 | 429 |
|
| 430 | +static void qcom_cpufreq_suspend_virt_devs(struct qcom_cpufreq_drv *drv, unsigned int cpu) |
| 431 | +{ |
| 432 | + const char * const *name = drv->data->genpd_names; |
| 433 | + int i; |
| 434 | + |
| 435 | + if (!drv->cpus[cpu].virt_devs) |
| 436 | + return; |
| 437 | + |
| 438 | + for (i = 0; *name; i++, name++) |
| 439 | + device_set_awake_path(drv->cpus[cpu].virt_devs[i]); |
| 440 | +} |
| 441 | + |
429 | 442 | static void qcom_cpufreq_put_virt_devs(struct qcom_cpufreq_drv *drv, unsigned int cpu)
|
430 | 443 | {
|
431 | 444 | const char * const *name = drv->data->genpd_names;
|
@@ -578,11 +591,25 @@ static void qcom_cpufreq_remove(struct platform_device *pdev)
|
578 | 591 | }
|
579 | 592 | }
|
580 | 593 |
|
| 594 | +static int qcom_cpufreq_suspend(struct device *dev) |
| 595 | +{ |
| 596 | + struct qcom_cpufreq_drv *drv = dev_get_drvdata(dev); |
| 597 | + unsigned int cpu; |
| 598 | + |
| 599 | + for_each_possible_cpu(cpu) |
| 600 | + qcom_cpufreq_suspend_virt_devs(drv, cpu); |
| 601 | + |
| 602 | + return 0; |
| 603 | +} |
| 604 | + |
| 605 | +static DEFINE_SIMPLE_DEV_PM_OPS(qcom_cpufreq_pm_ops, qcom_cpufreq_suspend, NULL); |
| 606 | + |
581 | 607 | static struct platform_driver qcom_cpufreq_driver = {
|
582 | 608 | .probe = qcom_cpufreq_probe,
|
583 | 609 | .remove_new = qcom_cpufreq_remove,
|
584 | 610 | .driver = {
|
585 | 611 | .name = "qcom-cpufreq-nvmem",
|
| 612 | + .pm = pm_sleep_ptr(&qcom_cpufreq_pm_ops), |
586 | 613 | },
|
587 | 614 | };
|
588 | 615 |
|
|
0 commit comments