Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 256927
b: refs/heads/master
c: b7b9592
h: refs/heads/master
i:
  256925: 3580b93
  256923: 18caa8a
  256919: 7983f2f
  256911: 2dc38e8
  256895: 4a4774f
v: v3
  • Loading branch information
Rafael J. Wysocki committed Jul 2, 2011
1 parent ec9689c commit d2ff02d
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d4f2d87a8b46c14c4307c690c92bd08229f66ecf
refs/heads/master: b7b95920aa2e89e655afe9913ee0e55855ceda90
60 changes: 59 additions & 1 deletion trunk/drivers/base/power/clock_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <linux/slab.h>
#include <linux/err.h>

#ifdef CONFIG_PM_RUNTIME
#ifdef CONFIG_PM

struct pm_runtime_clk_data {
struct list_head clock_list;
Expand Down Expand Up @@ -191,6 +191,10 @@ void pm_runtime_clk_destroy(struct device *dev)
kfree(prd);
}

#endif /* CONFIG_PM */

#ifdef CONFIG_PM_RUNTIME

/**
* pm_runtime_clk_acquire - Acquire a device clock.
* @dev: Device whose clock is to be acquired.
Expand Down Expand Up @@ -330,6 +334,60 @@ static int pm_runtime_clk_notify(struct notifier_block *nb,

#else /* !CONFIG_PM_RUNTIME */

#ifdef CONFIG_PM

/**
* pm_runtime_clk_suspend - Disable clocks in a device's PM clock list.
* @dev: Device to disable the clocks for.
*/
int pm_runtime_clk_suspend(struct device *dev)
{
struct pm_runtime_clk_data *prd = __to_prd(dev);
struct pm_clock_entry *ce;

dev_dbg(dev, "%s()\n", __func__);

/* If there is no driver, the clocks are already disabled. */
if (!prd || !dev->driver)
return 0;

mutex_lock(&prd->lock);

list_for_each_entry_reverse(ce, &prd->clock_list, node)
clk_disable(ce->clk);

mutex_unlock(&prd->lock);

return 0;
}

/**
* pm_runtime_clk_resume - Enable clocks in a device's PM clock list.
* @dev: Device to enable the clocks for.
*/
int pm_runtime_clk_resume(struct device *dev)
{
struct pm_runtime_clk_data *prd = __to_prd(dev);
struct pm_clock_entry *ce;

dev_dbg(dev, "%s()\n", __func__);

/* If there is no driver, the clocks should remain disabled. */
if (!prd || !dev->driver)
return 0;

mutex_lock(&prd->lock);

list_for_each_entry(ce, &prd->clock_list, node)
clk_enable(ce->clk);

mutex_unlock(&prd->lock);

return 0;
}

#endif /* CONFIG_PM */

/**
* enable_clock - Enable a device clock.
* @dev: Device whose clock is to be enabled.
Expand Down
2 changes: 1 addition & 1 deletion trunk/include/linux/pm_runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ struct pm_clk_notifier_block {
char *con_ids[];
};

#ifdef CONFIG_PM_RUNTIME_CLK
#ifdef CONFIG_PM_CLK
extern int pm_runtime_clk_init(struct device *dev);
extern void pm_runtime_clk_destroy(struct device *dev);
extern int pm_runtime_clk_add(struct device *dev, const char *con_id);
Expand Down
4 changes: 2 additions & 2 deletions trunk/kernel/power/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,9 @@ config PM_OPP
implementations a ready to use framework to manage OPPs.
For more information, read <file:Documentation/power/opp.txt>

config PM_RUNTIME_CLK
config PM_CLK
def_bool y
depends on PM_RUNTIME && HAVE_CLK
depends on PM && HAVE_CLK

config PM_GENERIC_DOMAINS
bool
Expand Down

0 comments on commit d2ff02d

Please sign in to comment.