@@ -268,6 +268,9 @@ static void _remove_devfreq(struct devfreq *devfreq, bool skip)
devfreq->being_removed = true;
+ if (devfreq->profile->enable_dev_pm_qos)
+ dev_pm_qos_remove_notifier(devfreq->dev.parent,
+ &devfreq->qos_nb);
if (devfreq->profile->qos_type)
pm_qos_remove_notifier(devfreq->profile->qos_type,
&devfreq->qos_nb);
@@ -484,13 +487,13 @@ struct devfreq *devfreq_add_device(struct device *dev,
devfreq->nb.notifier_call = devfreq_notifier_call;
devfreq->qos_nb.notifier_call = devfreq_qos_notifier_call;
- /* Check the sanity of qos_list/qos_type */
- if (profile->qos_type || profile->qos_list) {
-
- if (WARN(!profile->qos_type || !profile->qos_list,
+ /* Check the sanity of QoS handling specifications */
+ if (profile->qos_type || profile->enable_dev_pm_qos ||
+ profile->qos_list) {
+ if (WARN(!profile->qos_list ||
+ (!profile->qos_type && !profile->enable_dev_pm_qos),
"QoS requirement partially omitted for %s.\n",
dev_name(dev))) {
-
err = -EINVAL;
goto err_dev;
}
@@ -498,7 +501,6 @@ struct devfreq *devfreq_add_device(struct device *dev,
if (WARN(!profile->qos_list[0].freq,
"The first QoS requirement is the end of list for %s.\n",
dev_name(dev))) {
-
err = -EINVAL;
goto err_dev;
}
@@ -535,7 +537,11 @@ struct devfreq *devfreq_add_device(struct device *dev,
}
}
- pm_qos_add_notifier(profile->qos_type, &devfreq->qos_nb);
+ if (profile->qos_type)
+ pm_qos_add_notifier(profile->qos_type,
+ &devfreq->qos_nb);
+ if (profile->enable_dev_pm_qos)
+ dev_pm_qos_add_notifier(dev, &devfreq->qos_nb);
}
devfreq->trans_table = devm_kzalloc(dev, sizeof(unsigned int) *
@@ -580,7 +586,9 @@ out:
err_init:
device_unregister(&devfreq->dev);
err_qos_add:
- if (profile->qos_type || profile->qos_list)
+ if (profile->enable_dev_pm_qos)
+ dev_pm_qos_remove_notifier(dev, &devfreq->qos_nb);
+ if (profile->qos_type)
pm_qos_remove_notifier(profile->qos_type, &devfreq->qos_nb);
err_dev:
mutex_unlock(&devfreq->lock);
Added support of per-dev PM-QoS request handling in devfreq core. Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com> --- drivers/devfreq/devfreq.c | 24 ++++++++++++++++-------- 1 files changed, 16 insertions(+), 8 deletions(-)