@@ -90,6 +90,8 @@ static inline void device_pm_init(struct device *dev)
extern int dpm_sysfs_add(struct device *dev);
extern void dpm_sysfs_remove(struct device *dev);
+extern int dpm_autosuspend_sysfs_add(struct device *dev);
+extern void dpm_autosuspend_sysfs_remove(struct device *dev);
extern void rpm_sysfs_remove(struct device *dev);
extern int wakeup_sysfs_add(struct device *dev);
extern void wakeup_sysfs_remove(struct device *dev);
@@ -102,6 +104,8 @@ extern void pm_qos_sysfs_remove_flags(struct device *dev);
static inline int dpm_sysfs_add(struct device *dev) { return 0; }
static inline void dpm_sysfs_remove(struct device *dev) {}
+static inline int dpm_autosuspend_sysfs_add(struct device *dev) { return 0; }
+static inline void dpm_autosuspend_sysfs_remove(struct device *dev) {}
static inline void rpm_sysfs_remove(struct device *dev) {}
static inline int wakeup_sysfs_add(struct device *dev) { return 0; }
static inline void wakeup_sysfs_remove(struct device *dev) {}
@@ -1266,6 +1266,12 @@ void __pm_runtime_use_autosuspend(struct device *dev, bool use)
old_use = dev->power.use_autosuspend;
dev->power.use_autosuspend = use;
update_autosuspend(dev, old_delay, old_use);
+
+ if (use)
+ dpm_autosuspend_sysfs_add(dev);
+ else
+ dpm_autosuspend_sysfs_remove(dev);
+
spin_unlock_irq(&dev->power.lock);
}
EXPORT_SYMBOL_GPL(__pm_runtime_use_autosuspend);
@@ -609,15 +609,26 @@ static struct attribute *runtime_attrs[] = {
&dev_attr_control.attr,
&dev_attr_runtime_suspended_time.attr,
&dev_attr_runtime_active_time.attr,
- &dev_attr_autosuspend_delay_ms.attr,
#endif /* CONFIG_PM_RUNTIME */
NULL,
};
+
static struct attribute_group pm_runtime_attr_group = {
.name = power_group_name,
.attrs = runtime_attrs,
};
+static struct attribute *runtime_autosuspend_attrs[] = {
+#ifdef CONFIG_PM_RUNTIME
+ &dev_attr_autosuspend_delay_ms.attr,
+#endif /* CONFIG_PM_RUNTIME */
+};
+
+static struct attribute_group pm_runtime_autosuspend_attr_group = {
+ .name = power_group_name,
+ .attrs = runtime_autosuspend_attrs,
+};
+
static struct attribute *pm_qos_latency_attrs[] = {
#ifdef CONFIG_PM_RUNTIME
&dev_attr_pm_qos_resume_latency_us.attr,
@@ -671,6 +682,12 @@ int dpm_sysfs_add(struct device *dev)
return rc;
}
+int dpm_autosuspend_sysfs_add(struct device *dev)
+{
+ return sysfs_merge_group(&dev->kobj,
+ &pm_runtime_autosuspend_attr_group);
+}
+
int wakeup_sysfs_add(struct device *dev)
{
return sysfs_merge_group(&dev->kobj, &pm_wakeup_attr_group);
@@ -712,3 +729,9 @@ void dpm_sysfs_remove(struct device *dev)
sysfs_unmerge_group(&dev->kobj, &pm_wakeup_attr_group);
sysfs_remove_group(&dev->kobj, &pm_attr_group);
}
+
+void dpm_autosuspend_sysfs_remove(struct device *dev)
+{
+ sysfs_unmerge_group(&dev->kobj,
+ &pm_runtime_autosuspend_attr_group);
+}