mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-07 12:25:00 -04:00
PM / devfreq: Remove dependencies between sysfs nodes and suspend count
This change reverts commit5e33579a6a("devfreq: Do not allow tunable updates when device is suspended") and commitdb4f4a0933("PM/devfreq: Do not switch governors from sysfs when device is suspended"). Userspace updates to sysfs nodes like governor and polling_interval are currently not allowed when there is a non-zero suspend count. This requirement existed in the past due to hardware dependencies in some devfreq drivers. However, these hardware dependencies should be handled by the relevant devfreq drivers rather than the devfreq framework so remove the suspend count checks in these devfreq framework sysfs APIs. Change-Id: I8010b519d72784a6b90955acc7899c1a520aa7e7 Signed-off-by: Amir Vajid <avajid@codeaurora.org>
This commit is contained in:
parent
378eb426d0
commit
ba4792aae1
1 changed files with 17 additions and 35 deletions
|
|
@ -888,31 +888,30 @@ EXPORT_SYMBOL(devm_devfreq_remove_device);
|
|||
*/
|
||||
int devfreq_suspend_device(struct devfreq *devfreq)
|
||||
{
|
||||
int ret = 0;
|
||||
int ret;
|
||||
|
||||
if (!devfreq)
|
||||
return -EINVAL;
|
||||
|
||||
event_mutex_lock(devfreq);
|
||||
if (atomic_inc_return(&devfreq->suspend_count) > 1)
|
||||
goto unlock_out;
|
||||
return 0;
|
||||
|
||||
if (devfreq->governor) {
|
||||
event_mutex_lock(devfreq);
|
||||
ret = devfreq->governor->event_handler(devfreq,
|
||||
DEVFREQ_GOV_SUSPEND, NULL);
|
||||
event_mutex_unlock(devfreq);
|
||||
if (ret)
|
||||
goto unlock_out;
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (devfreq->suspend_freq) {
|
||||
ret = devfreq_set_target(devfreq, devfreq->suspend_freq, 0);
|
||||
if (ret)
|
||||
goto unlock_out;
|
||||
return ret;
|
||||
}
|
||||
|
||||
unlock_out:
|
||||
event_mutex_unlock(devfreq);
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(devfreq_suspend_device);
|
||||
|
||||
|
|
@ -926,31 +925,30 @@ EXPORT_SYMBOL(devfreq_suspend_device);
|
|||
*/
|
||||
int devfreq_resume_device(struct devfreq *devfreq)
|
||||
{
|
||||
int ret = 0;
|
||||
int ret;
|
||||
|
||||
if (!devfreq)
|
||||
return -EINVAL;
|
||||
|
||||
event_mutex_lock(devfreq);
|
||||
if (atomic_dec_return(&devfreq->suspend_count) >= 1)
|
||||
goto unlock_out;
|
||||
return 0;
|
||||
|
||||
if (devfreq->resume_freq) {
|
||||
ret = devfreq_set_target(devfreq, devfreq->resume_freq, 0);
|
||||
if (ret)
|
||||
goto unlock_out;
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (devfreq->governor) {
|
||||
event_mutex_lock(devfreq);
|
||||
ret = devfreq->governor->event_handler(devfreq,
|
||||
DEVFREQ_GOV_RESUME, NULL);
|
||||
event_mutex_unlock(devfreq);
|
||||
if (ret)
|
||||
goto unlock_out;
|
||||
return ret;
|
||||
}
|
||||
|
||||
unlock_out:
|
||||
event_mutex_unlock(devfreq);
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(devfreq_resume_device);
|
||||
|
||||
|
|
@ -1155,10 +1153,6 @@ static ssize_t governor_store(struct device *dev, struct device_attribute *attr,
|
|||
}
|
||||
|
||||
event_mutex_lock(df);
|
||||
if (atomic_read(&df->suspend_count) > 0) {
|
||||
ret = -EINVAL;
|
||||
goto gov_stop_out;
|
||||
}
|
||||
if (df->governor) {
|
||||
ret = df->governor->event_handler(df, DEVFREQ_GOV_STOP, NULL);
|
||||
if (ret) {
|
||||
|
|
@ -1275,16 +1269,14 @@ static ssize_t polling_interval_store(struct device *dev,
|
|||
unsigned int value;
|
||||
int ret;
|
||||
|
||||
if (!df->governor)
|
||||
return -EINVAL;
|
||||
|
||||
ret = sscanf(buf, "%u", &value);
|
||||
if (ret != 1)
|
||||
return -EINVAL;
|
||||
|
||||
event_mutex_lock(df);
|
||||
if (!df->governor || atomic_read(&df->suspend_count) > 0) {
|
||||
dev_warn(dev, "device suspended, operation not allowed\n");
|
||||
event_mutex_unlock(df);
|
||||
return -EINVAL;
|
||||
}
|
||||
df->governor->event_handler(df, DEVFREQ_GOV_INTERVAL, &value);
|
||||
ret = count;
|
||||
event_mutex_unlock(df);
|
||||
|
|
@ -1305,11 +1297,6 @@ static ssize_t min_freq_store(struct device *dev, struct device_attribute *attr,
|
|||
return -EINVAL;
|
||||
|
||||
event_mutex_lock(df);
|
||||
if (atomic_read(&df->suspend_count) > 0) {
|
||||
dev_warn(dev, "device suspended, min freq not allowed\n");
|
||||
event_mutex_unlock(df);
|
||||
return -EINVAL;
|
||||
}
|
||||
mutex_lock(&df->lock);
|
||||
|
||||
if (value) {
|
||||
|
|
@ -1356,11 +1343,6 @@ static ssize_t max_freq_store(struct device *dev, struct device_attribute *attr,
|
|||
return -EINVAL;
|
||||
|
||||
event_mutex_lock(df);
|
||||
if (atomic_read(&df->suspend_count) > 0) {
|
||||
event_mutex_unlock(df);
|
||||
dev_warn(dev, "device suspended, max freq not allowed\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
mutex_lock(&df->lock);
|
||||
|
||||
if (value) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue