Skip to content

Commit 11173ac

Browse files
balajitkLuis Henriques
authored andcommitted
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 <[email protected]>
1 parent cf7b4a0 commit 11173ac

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

arch/arm/mach-omap2/hwspinlocks.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@
3939
#define LOCK_BASE_OFFSET 0x0800
4040
#define LOCK_OFFSET(i) (LOCK_BASE_OFFSET + 0x4 * (i))
4141

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+
4250
/* Initialization function */
4351
int __init hwspinlocks_init(void)
4452
{
@@ -63,7 +71,8 @@ int __init hwspinlocks_init(void)
6371
pdata->lock_base_offset = LOCK_BASE_OFFSET;
6472

6573
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);
6776

6877
return retval;
6978
}

arch/arm/plat-omap/hwspinlock.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ int hwspinlock_lock(struct hwspinlock *handle)
116116
if (WARN_ON(in_irq()))
117117
return -EPERM;
118118

119-
if (pm_runtime_get(&handle->pdev->dev) < 0)
119+
if (pm_runtime_get_sync(&handle->pdev->dev) < 0)
120120
return -ENODEV;
121121

122122
/* Attempt to acquire the lock by reading from it */
@@ -139,14 +139,14 @@ int hwspinlock_trylock(struct hwspinlock *handle)
139139
if (WARN_ON(in_irq()))
140140
return -EPERM;
141141

142-
if (pm_runtime_get(&handle->pdev->dev) < 0)
142+
if (pm_runtime_get_sync(&handle->pdev->dev) < 0)
143143
return -ENODEV;
144144

145145
/* Attempt to acquire the lock by reading from it */
146146
retval = readl(handle->lock_reg);
147147

148148
if (retval == HWSPINLOCK_BUSY)
149-
pm_runtime_put(&handle->pdev->dev);
149+
pm_runtime_put_sync(&handle->pdev->dev);
150150

151151
return retval;
152152
}
@@ -161,7 +161,7 @@ int hwspinlock_unlock(struct hwspinlock *handle)
161161
/* Release it by writing 0 to it */
162162
writel(0, handle->lock_reg);
163163

164-
pm_runtime_put(&handle->pdev->dev);
164+
pm_runtime_put_sync(&handle->pdev->dev);
165165

166166
return 0;
167167
}
@@ -288,6 +288,7 @@ static int __devinit hwspinlock_probe(struct platform_device *pdev)
288288
hwspinlocks[id].lock_reg = io_base + pdata->
289289
lock_base_offset + sizeof(u32) * id;
290290
}
291+
pm_runtime_enable(&pdev->dev);
291292

292293
return 0;
293294
}

0 commit comments

Comments
 (0)