Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 245364
b: refs/heads/master
c: 38ade3a
h: refs/heads/master
v: v3
  • Loading branch information
Rafael J. Wysocki committed Apr 28, 2011
1 parent 01187e0 commit d9ae5fd
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 19 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: 69c9dd1ecf446ad8a830e4afc539a2a1adc85b78
refs/heads/master: 38ade3a1fa0421c12627c7b48c33e89414fc9b76
25 changes: 18 additions & 7 deletions trunk/arch/arm/mach-shmobile/pm_runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ static void platform_pm_runtime_bug(struct device *dev,
dev_err(dev, "runtime pm suspend before resume\n");
}

int platform_pm_runtime_suspend(struct device *dev)
static int default_platform_runtime_suspend(struct device *dev)
{
struct pm_runtime_data *prd = __to_prd(dev);

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

platform_pm_runtime_bug(dev, prd);

Expand All @@ -82,11 +82,11 @@ int platform_pm_runtime_suspend(struct device *dev)
return 0;
}

int platform_pm_runtime_resume(struct device *dev)
static int default_platform_runtime_resume(struct device *dev)
{
struct pm_runtime_data *prd = __to_prd(dev);

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

platform_pm_runtime_init(dev, prd);

Expand All @@ -98,12 +98,21 @@ int platform_pm_runtime_resume(struct device *dev)
return 0;
}

int platform_pm_runtime_idle(struct device *dev)
static int default_platform_runtime_idle(struct device *dev)
{
/* suspend synchronously to disable clocks immediately */
return pm_runtime_suspend(dev);
}

static struct dev_power_domain default_power_domain = {
.ops = {
.runtime_suspend = default_platform_runtime_suspend,
.runtime_resume = default_platform_runtime_resume,
.runtime_idle = default_platform_runtime_idle,
USE_PLATFORM_PM_SLEEP_OPS
},
};

static int platform_bus_notify(struct notifier_block *nb,
unsigned long action, void *data)
{
Expand All @@ -114,10 +123,12 @@ static int platform_bus_notify(struct notifier_block *nb,

if (action == BUS_NOTIFY_BIND_DRIVER) {
prd = devres_alloc(__devres_release, sizeof(*prd), GFP_KERNEL);
if (prd)
if (prd) {
devres_add(dev, prd);
else
dev->pwr_domain = &default_power_domain;
} else {
dev_err(dev, "unable to alloc memory for runtime pm\n");
}
}

return 0;
Expand Down
33 changes: 22 additions & 11 deletions trunk/arch/sh/kernel/cpu/shmobile/pm_runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,15 @@ void platform_pm_runtime_suspend_idle(void)
queue_work(pm_wq, &hwblk_work);
}

int platform_pm_runtime_suspend(struct device *dev)
static int default_platform_runtime_suspend(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct pdev_archdata *ad = &pdev->archdata;
unsigned long flags;
int hwblk = ad->hwblk_id;
int ret = 0;

dev_dbg(dev, "platform_pm_runtime_suspend() [%d]\n", hwblk);
dev_dbg(dev, "%s() [%d]\n", __func__, hwblk);

/* ignore off-chip platform devices */
if (!hwblk)
Expand Down Expand Up @@ -183,20 +183,20 @@ int platform_pm_runtime_suspend(struct device *dev)
mutex_unlock(&ad->mutex);

out:
dev_dbg(dev, "platform_pm_runtime_suspend() [%d] returns %d\n",
hwblk, ret);
dev_dbg(dev, "%s() [%d] returns %d\n",
__func__, hwblk, ret);

return ret;
}

int platform_pm_runtime_resume(struct device *dev)
static int default_platform_runtime_resume(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct pdev_archdata *ad = &pdev->archdata;
int hwblk = ad->hwblk_id;
int ret = 0;

dev_dbg(dev, "platform_pm_runtime_resume() [%d]\n", hwblk);
dev_dbg(dev, "%s() [%d]\n", __func__, hwblk);

/* ignore off-chip platform devices */
if (!hwblk)
Expand Down Expand Up @@ -228,19 +228,19 @@ int platform_pm_runtime_resume(struct device *dev)
*/
mutex_unlock(&ad->mutex);
out:
dev_dbg(dev, "platform_pm_runtime_resume() [%d] returns %d\n",
hwblk, ret);
dev_dbg(dev, "%s() [%d] returns %d\n",
__func__, hwblk, ret);

return ret;
}

int platform_pm_runtime_idle(struct device *dev)
static int default_platform_runtime_idle(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
int hwblk = pdev->archdata.hwblk_id;
int ret = 0;

dev_dbg(dev, "platform_pm_runtime_idle() [%d]\n", hwblk);
dev_dbg(dev, "%s() [%d]\n", __func__, hwblk);

/* ignore off-chip platform devices */
if (!hwblk)
Expand All @@ -252,10 +252,19 @@ int platform_pm_runtime_idle(struct device *dev)
/* suspend synchronously to disable clocks immediately */
ret = pm_runtime_suspend(dev);
out:
dev_dbg(dev, "platform_pm_runtime_idle() [%d] done!\n", hwblk);
dev_dbg(dev, "%s() [%d] done!\n", __func__, hwblk);
return ret;
}

static struct dev_power_domain default_power_domain = {
.ops = {
.runtime_suspend = default_platform_runtime_suspend,
.runtime_resume = default_platform_runtime_resume,
.runtime_idle = default_platform_runtime_idle,
USE_PLATFORM_PM_SLEEP_OPS
},
};

static int platform_bus_notify(struct notifier_block *nb,
unsigned long action, void *data)
{
Expand All @@ -276,6 +285,7 @@ static int platform_bus_notify(struct notifier_block *nb,
hwblk_disable(hwblk_info, hwblk);
/* make sure driver re-inits itself once */
__set_bit(PDEV_ARCHDATA_FLAG_INIT, &pdev->archdata.flags);
dev->pwr_domain = &default_power_domain;
break;
/* TODO: add BUS_NOTIFY_BIND_DRIVER and increase idle count */
case BUS_NOTIFY_BOUND_DRIVER:
Expand All @@ -289,6 +299,7 @@ static int platform_bus_notify(struct notifier_block *nb,
__set_bit(PDEV_ARCHDATA_FLAG_INIT, &pdev->archdata.flags);
break;
case BUS_NOTIFY_DEL_DEVICE:
dev->pwr_domain = NULL;
break;
}
return 0;
Expand Down

0 comments on commit d9ae5fd

Please sign in to comment.