diff options
author | Balaji T K <balajitk@ti.com> | 2010-08-04 12:21:24 -0400 |
---|---|---|
committer | Paolo Pisati <paolo.pisati@canonical.com> | 2012-08-17 04:19:09 -0400 |
commit | f6a15045415cb7ad5073aeca17440a3a2db48504 (patch) | |
tree | d63f10b90280c745dfc37af7f7d88eaf68777ffa | |
parent | 3d7ae8d546e5cdec1ac0c242dd36395d4f1aea3c (diff) |
omap:hwspinlocks add pm_runtime_enable
Add pm_runtime_enable to hwspinlock_probe
change pm_runtime_get to pm_runtime_get_sync
Signed-off-by: Balaji T K <balajitk@ti.com>
-rw-r--r-- | arch/arm/mach-omap2/hwspinlocks.c | 11 | ||||
-rw-r--r-- | arch/arm/plat-omap/hwspinlock.c | 9 |
2 files changed, 15 insertions, 5 deletions
diff --git a/arch/arm/mach-omap2/hwspinlocks.c b/arch/arm/mach-omap2/hwspinlocks.c index f0f05e1d983..9206baac49a 100644 --- a/arch/arm/mach-omap2/hwspinlocks.c +++ b/arch/arm/mach-omap2/hwspinlocks.c | |||
@@ -39,6 +39,14 @@ | |||
39 | #define LOCK_BASE_OFFSET 0x0800 | 39 | #define LOCK_BASE_OFFSET 0x0800 |
40 | #define LOCK_OFFSET(i) (LOCK_BASE_OFFSET + 0x4 * (i)) | 40 | #define LOCK_OFFSET(i) (LOCK_BASE_OFFSET + 0x4 * (i)) |
41 | 41 | ||
42 | struct omap_device_pm_latency omap_spinlock_latency[] = { | ||
43 | { | ||
44 | .deactivate_func = omap_device_idle_hwmods, | ||
45 | .activate_func = omap_device_enable_hwmods, | ||
46 | .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST, | ||
47 | } | ||
48 | }; | ||
49 | |||
42 | /* Initialization function */ | 50 | /* Initialization function */ |
43 | int __init hwspinlocks_init(void) | 51 | int __init hwspinlocks_init(void) |
44 | { | 52 | { |
@@ -63,7 +71,8 @@ int __init hwspinlocks_init(void) | |||
63 | pdata->lock_base_offset = LOCK_BASE_OFFSET; | 71 | pdata->lock_base_offset = LOCK_BASE_OFFSET; |
64 | 72 | ||
65 | omap_device_build(pdev_name, 0, oh, pdata, | 73 | omap_device_build(pdev_name, 0, oh, pdata, |
66 | sizeof(struct hwspinlock_plat_info), NULL, 0, false); | 74 | sizeof(struct hwspinlock_plat_info), omap_spinlock_latency, |
75 | ARRAY_SIZE(omap_spinlock_latency), false); | ||
67 | 76 | ||
68 | return retval; | 77 | return retval; |
69 | } | 78 | } |
diff --git a/arch/arm/plat-omap/hwspinlock.c b/arch/arm/plat-omap/hwspinlock.c index 1883add0c34..8191390e9b5 100644 --- a/arch/arm/plat-omap/hwspinlock.c +++ b/arch/arm/plat-omap/hwspinlock.c | |||
@@ -116,7 +116,7 @@ int hwspinlock_lock(struct hwspinlock *handle) | |||
116 | if (WARN_ON(in_irq())) | 116 | if (WARN_ON(in_irq())) |
117 | return -EPERM; | 117 | return -EPERM; |
118 | 118 | ||
119 | if (pm_runtime_get(&handle->pdev->dev) < 0) | 119 | if (pm_runtime_get_sync(&handle->pdev->dev) < 0) |
120 | return -ENODEV; | 120 | return -ENODEV; |
121 | 121 | ||
122 | /* Attempt to acquire the lock by reading from it */ | 122 | /* Attempt to acquire the lock by reading from it */ |
@@ -139,14 +139,14 @@ int hwspinlock_trylock(struct hwspinlock *handle) | |||
139 | if (WARN_ON(in_irq())) | 139 | if (WARN_ON(in_irq())) |
140 | return -EPERM; | 140 | return -EPERM; |
141 | 141 | ||
142 | if (pm_runtime_get(&handle->pdev->dev) < 0) | 142 | if (pm_runtime_get_sync(&handle->pdev->dev) < 0) |
143 | return -ENODEV; | 143 | return -ENODEV; |
144 | 144 | ||
145 | /* Attempt to acquire the lock by reading from it */ | 145 | /* Attempt to acquire the lock by reading from it */ |
146 | retval = readl(handle->lock_reg); | 146 | retval = readl(handle->lock_reg); |
147 | 147 | ||
148 | if (retval == HWSPINLOCK_BUSY) | 148 | if (retval == HWSPINLOCK_BUSY) |
149 | pm_runtime_put(&handle->pdev->dev); | 149 | pm_runtime_put_sync(&handle->pdev->dev); |
150 | 150 | ||
151 | return retval; | 151 | return retval; |
152 | } | 152 | } |
@@ -161,7 +161,7 @@ int hwspinlock_unlock(struct hwspinlock *handle) | |||
161 | /* Release it by writing 0 to it */ | 161 | /* Release it by writing 0 to it */ |
162 | writel(0, handle->lock_reg); | 162 | writel(0, handle->lock_reg); |
163 | 163 | ||
164 | pm_runtime_put(&handle->pdev->dev); | 164 | pm_runtime_put_sync(&handle->pdev->dev); |
165 | 165 | ||
166 | return 0; | 166 | return 0; |
167 | } | 167 | } |
@@ -288,6 +288,7 @@ static int __devinit hwspinlock_probe(struct platform_device *pdev) | |||
288 | hwspinlocks[id].lock_reg = io_base + pdata-> | 288 | hwspinlocks[id].lock_reg = io_base + pdata-> |
289 | lock_base_offset + sizeof(u32) * id; | 289 | lock_base_offset + sizeof(u32) * id; |
290 | } | 290 | } |
291 | pm_runtime_enable(&pdev->dev); | ||
291 | 292 | ||
292 | return 0; | 293 | return 0; |
293 | } | 294 | } |