Commit fa70db3f authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

Merge branches 'pm-core', 'pm-clk', 'pm-domains' and 'pm-pci'

* pm-core:
  PM / runtime: Asynchronous "idle" in pm_runtime_allow()
  PM / runtime: print error when activating a child to unactive parent

* pm-clk:
  PM / clk: Add support for adding a specific clock from device-tree
  PM / clk: export symbols for existing pm_clk_<...> API fcns

* pm-domains:
  PM / Domains: Convert pm_genpd_init() to return an error code
  PM / Domains: Stop/start devices during system PM suspend/resume in genpd
  PM / Domains: Allow runtime PM during system PM phases
  PM / Runtime: Avoid resuming devices again in pm_runtime_force_resume()
  PM / Domains: Remove redundant pm_request_idle() call in genpd
  PM / Domains: Remove redundant wrapper functions for system PM
  PM / Domains: Allow genpd to power on during system PM phases

* pm-pci:
  PCI / PM: check all fields in pci_set_platform_pm()
...@@ -121,6 +121,7 @@ int pm_clk_add(struct device *dev, const char *con_id) ...@@ -121,6 +121,7 @@ int pm_clk_add(struct device *dev, const char *con_id)
{ {
return __pm_clk_add(dev, con_id, NULL); return __pm_clk_add(dev, con_id, NULL);
} }
EXPORT_SYMBOL_GPL(pm_clk_add);
/** /**
* pm_clk_add_clk - Start using a device clock for power management. * pm_clk_add_clk - Start using a device clock for power management.
...@@ -136,8 +137,41 @@ int pm_clk_add_clk(struct device *dev, struct clk *clk) ...@@ -136,8 +137,41 @@ int pm_clk_add_clk(struct device *dev, struct clk *clk)
{ {
return __pm_clk_add(dev, NULL, clk); return __pm_clk_add(dev, NULL, clk);
} }
EXPORT_SYMBOL_GPL(pm_clk_add_clk);
/**
* of_pm_clk_add_clk - Start using a device clock for power management.
* @dev: Device whose clock is going to be used for power management.
* @name: Name of clock that is going to be used for power management.
*
* Add the clock described in the 'clocks' device-tree node that matches
* with the 'name' provided, to the list of clocks used for the power
* management of @dev. On success, returns 0. Returns a negative error
* code if the clock is not found or cannot be added.
*/
int of_pm_clk_add_clk(struct device *dev, const char *name)
{
struct clk *clk;
int ret;
if (!dev || !dev->of_node || !name)
return -EINVAL;
clk = of_clk_get_by_name(dev->of_node, name);
if (IS_ERR(clk))
return PTR_ERR(clk);
ret = pm_clk_add_clk(dev, clk);
if (ret) {
clk_put(clk);
return ret;
}
return 0;
}
EXPORT_SYMBOL_GPL(of_pm_clk_add_clk);
/** /**
* of_pm_clk_add_clks - Start using device clock(s) for power management. * of_pm_clk_add_clks - Start using device clock(s) for power management.
* @dev: Device whose clock(s) is going to be used for power management. * @dev: Device whose clock(s) is going to be used for power management.
...@@ -192,6 +226,7 @@ int of_pm_clk_add_clks(struct device *dev) ...@@ -192,6 +226,7 @@ int of_pm_clk_add_clks(struct device *dev)
return ret; return ret;
} }
EXPORT_SYMBOL_GPL(of_pm_clk_add_clks);
/** /**
* __pm_clk_remove - Destroy PM clock entry. * __pm_clk_remove - Destroy PM clock entry.
...@@ -252,6 +287,7 @@ void pm_clk_remove(struct device *dev, const char *con_id) ...@@ -252,6 +287,7 @@ void pm_clk_remove(struct device *dev, const char *con_id)
__pm_clk_remove(ce); __pm_clk_remove(ce);
} }
EXPORT_SYMBOL_GPL(pm_clk_remove);
/** /**
* pm_clk_remove_clk - Stop using a device clock for power management. * pm_clk_remove_clk - Stop using a device clock for power management.
...@@ -285,6 +321,7 @@ void pm_clk_remove_clk(struct device *dev, struct clk *clk) ...@@ -285,6 +321,7 @@ void pm_clk_remove_clk(struct device *dev, struct clk *clk)
__pm_clk_remove(ce); __pm_clk_remove(ce);
} }
EXPORT_SYMBOL_GPL(pm_clk_remove_clk);
/** /**
* pm_clk_init - Initialize a device's list of power management clocks. * pm_clk_init - Initialize a device's list of power management clocks.
...@@ -299,6 +336,7 @@ void pm_clk_init(struct device *dev) ...@@ -299,6 +336,7 @@ void pm_clk_init(struct device *dev)
if (psd) if (psd)
INIT_LIST_HEAD(&psd->clock_list); INIT_LIST_HEAD(&psd->clock_list);
} }
EXPORT_SYMBOL_GPL(pm_clk_init);
/** /**
* pm_clk_create - Create and initialize a device's list of PM clocks. * pm_clk_create - Create and initialize a device's list of PM clocks.
...@@ -311,6 +349,7 @@ int pm_clk_create(struct device *dev) ...@@ -311,6 +349,7 @@ int pm_clk_create(struct device *dev)
{ {
return dev_pm_get_subsys_data(dev); return dev_pm_get_subsys_data(dev);
} }
EXPORT_SYMBOL_GPL(pm_clk_create);
/** /**
* pm_clk_destroy - Destroy a device's list of power management clocks. * pm_clk_destroy - Destroy a device's list of power management clocks.
...@@ -345,6 +384,7 @@ void pm_clk_destroy(struct device *dev) ...@@ -345,6 +384,7 @@ void pm_clk_destroy(struct device *dev)
__pm_clk_remove(ce); __pm_clk_remove(ce);
} }
} }
EXPORT_SYMBOL_GPL(pm_clk_destroy);
/** /**
* pm_clk_suspend - Disable clocks in a device's PM clock list. * pm_clk_suspend - Disable clocks in a device's PM clock list.
...@@ -375,6 +415,7 @@ int pm_clk_suspend(struct device *dev) ...@@ -375,6 +415,7 @@ int pm_clk_suspend(struct device *dev)
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(pm_clk_suspend);
/** /**
* pm_clk_resume - Enable clocks in a device's PM clock list. * pm_clk_resume - Enable clocks in a device's PM clock list.
...@@ -400,6 +441,7 @@ int pm_clk_resume(struct device *dev) ...@@ -400,6 +441,7 @@ int pm_clk_resume(struct device *dev)
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(pm_clk_resume);
/** /**
* pm_clk_notify - Notify routine for device addition and removal. * pm_clk_notify - Notify routine for device addition and removal.
...@@ -480,6 +522,7 @@ int pm_clk_runtime_suspend(struct device *dev) ...@@ -480,6 +522,7 @@ int pm_clk_runtime_suspend(struct device *dev)
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(pm_clk_runtime_suspend);
int pm_clk_runtime_resume(struct device *dev) int pm_clk_runtime_resume(struct device *dev)
{ {
...@@ -495,6 +538,7 @@ int pm_clk_runtime_resume(struct device *dev) ...@@ -495,6 +538,7 @@ int pm_clk_runtime_resume(struct device *dev)
return pm_generic_runtime_resume(dev); return pm_generic_runtime_resume(dev);
} }
EXPORT_SYMBOL_GPL(pm_clk_runtime_resume);
#else /* !CONFIG_PM_CLK */ #else /* !CONFIG_PM_CLK */
...@@ -598,3 +642,4 @@ void pm_clk_add_notifier(struct bus_type *bus, ...@@ -598,3 +642,4 @@ void pm_clk_add_notifier(struct bus_type *bus,
clknb->nb.notifier_call = pm_clk_notify; clknb->nb.notifier_call = pm_clk_notify;
bus_register_notifier(bus, &clknb->nb); bus_register_notifier(bus, &clknb->nb);
} }
EXPORT_SYMBOL_GPL(pm_clk_add_notifier);
This diff is collapsed.
...@@ -1045,10 +1045,14 @@ int __pm_runtime_set_status(struct device *dev, unsigned int status) ...@@ -1045,10 +1045,14 @@ int __pm_runtime_set_status(struct device *dev, unsigned int status)
*/ */
if (!parent->power.disable_depth if (!parent->power.disable_depth
&& !parent->power.ignore_children && !parent->power.ignore_children
&& parent->power.runtime_status != RPM_ACTIVE) && parent->power.runtime_status != RPM_ACTIVE) {
dev_err(dev, "runtime PM trying to activate child device %s but parent (%s) is not active\n",
dev_name(dev),
dev_name(parent));
error = -EBUSY; error = -EBUSY;
else if (dev->power.runtime_status == RPM_SUSPENDED) } else if (dev->power.runtime_status == RPM_SUSPENDED) {
atomic_inc(&parent->power.child_count); atomic_inc(&parent->power.child_count);
}
spin_unlock(&parent->power.lock); spin_unlock(&parent->power.lock);
...@@ -1256,7 +1260,7 @@ void pm_runtime_allow(struct device *dev) ...@@ -1256,7 +1260,7 @@ void pm_runtime_allow(struct device *dev)
dev->power.runtime_auto = true; dev->power.runtime_auto = true;
if (atomic_dec_and_test(&dev->power.usage_count)) if (atomic_dec_and_test(&dev->power.usage_count))
rpm_idle(dev, RPM_AUTO); rpm_idle(dev, RPM_AUTO | RPM_ASYNC);
out: out:
spin_unlock_irq(&dev->power.lock); spin_unlock_irq(&dev->power.lock);
...@@ -1506,6 +1510,9 @@ int pm_runtime_force_resume(struct device *dev) ...@@ -1506,6 +1510,9 @@ int pm_runtime_force_resume(struct device *dev)
goto out; goto out;
} }
if (!pm_runtime_status_suspended(dev))
goto out;
ret = pm_runtime_set_active(dev); ret = pm_runtime_set_active(dev);
if (ret) if (ret)
goto out; goto out;
......
...@@ -421,29 +421,6 @@ static int acp_suspend(void *handle) ...@@ -421,29 +421,6 @@ static int acp_suspend(void *handle)
static int acp_resume(void *handle) static int acp_resume(void *handle)
{ {
int i, ret;
struct acp_pm_domain *apd;
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
/* return early if no ACP */
if (!adev->acp.acp_genpd)
return 0;
/* SMU block will power on ACP irrespective of ACP runtime status.
* Power off explicitly based on genpd ACP runtime status so that ACP
* hw and ACP-genpd status are in sync.
* 'suspend_power_off' represents "Power status before system suspend"
*/
if (adev->acp.acp_genpd->gpd.suspend_power_off == true) {
apd = container_of(&adev->acp.acp_genpd->gpd,
struct acp_pm_domain, gpd);
for (i = 4; i >= 0 ; i--) {
ret = acp_suspend_tile(apd->cgs_dev, ACP_TILE_P1 + i);
if (ret)
pr_err("ACP tile %d tile suspend failed\n", i);
}
}
return 0; return 0;
} }
......
...@@ -530,8 +530,8 @@ static const struct pci_platform_pm_ops *pci_platform_pm; ...@@ -530,8 +530,8 @@ static const struct pci_platform_pm_ops *pci_platform_pm;
int pci_set_platform_pm(const struct pci_platform_pm_ops *ops) int pci_set_platform_pm(const struct pci_platform_pm_ops *ops)
{ {
if (!ops->is_manageable || !ops->set_state || !ops->choose_state if (!ops->is_manageable || !ops->set_state || !ops->choose_state ||
|| !ops->sleep_wake) !ops->sleep_wake || !ops->run_wake || !ops->need_resume)
return -EINVAL; return -EINVAL;
pci_platform_pm = ops; pci_platform_pm = ops;
return 0; return 0;
......
...@@ -42,6 +42,7 @@ extern int pm_clk_create(struct device *dev); ...@@ -42,6 +42,7 @@ extern int pm_clk_create(struct device *dev);
extern void pm_clk_destroy(struct device *dev); extern void pm_clk_destroy(struct device *dev);
extern int pm_clk_add(struct device *dev, const char *con_id); extern int pm_clk_add(struct device *dev, const char *con_id);
extern int pm_clk_add_clk(struct device *dev, struct clk *clk); extern int pm_clk_add_clk(struct device *dev, struct clk *clk);
extern int of_pm_clk_add_clk(struct device *dev, const char *name);
extern int of_pm_clk_add_clks(struct device *dev); extern int of_pm_clk_add_clks(struct device *dev);
extern void pm_clk_remove(struct device *dev, const char *con_id); extern void pm_clk_remove(struct device *dev, const char *con_id);
extern void pm_clk_remove_clk(struct device *dev, struct clk *clk); extern void pm_clk_remove_clk(struct device *dev, struct clk *clk);
......
...@@ -57,7 +57,6 @@ struct generic_pm_domain { ...@@ -57,7 +57,6 @@ struct generic_pm_domain {
unsigned int device_count; /* Number of devices */ unsigned int device_count; /* Number of devices */
unsigned int suspended_count; /* System suspend device counter */ unsigned int suspended_count; /* System suspend device counter */
unsigned int prepared_count; /* Suspend counter of prepared devices */ unsigned int prepared_count; /* Suspend counter of prepared devices */
bool suspend_power_off; /* Power status before system suspend */
int (*power_off)(struct generic_pm_domain *domain); int (*power_off)(struct generic_pm_domain *domain);
int (*power_on)(struct generic_pm_domain *domain); int (*power_on)(struct generic_pm_domain *domain);
struct gpd_dev_ops dev_ops; struct gpd_dev_ops dev_ops;
...@@ -128,8 +127,8 @@ extern int pm_genpd_add_subdomain(struct generic_pm_domain *genpd, ...@@ -128,8 +127,8 @@ extern int pm_genpd_add_subdomain(struct generic_pm_domain *genpd,
struct generic_pm_domain *new_subdomain); struct generic_pm_domain *new_subdomain);
extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd, extern int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
struct generic_pm_domain *target); struct generic_pm_domain *target);
extern void pm_genpd_init(struct generic_pm_domain *genpd, extern int pm_genpd_init(struct generic_pm_domain *genpd,
struct dev_power_governor *gov, bool is_off); struct dev_power_governor *gov, bool is_off);
extern struct dev_power_governor simple_qos_governor; extern struct dev_power_governor simple_qos_governor;
extern struct dev_power_governor pm_domain_always_on_gov; extern struct dev_power_governor pm_domain_always_on_gov;
...@@ -164,9 +163,10 @@ static inline int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd, ...@@ -164,9 +163,10 @@ static inline int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
{ {
return -ENOSYS; return -ENOSYS;
} }
static inline void pm_genpd_init(struct generic_pm_domain *genpd, static inline int pm_genpd_init(struct generic_pm_domain *genpd,
struct dev_power_governor *gov, bool is_off) struct dev_power_governor *gov, bool is_off)
{ {
return -ENOSYS;
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment