aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/hwspinlock.txt
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
commit8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch)
treea8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /Documentation/hwspinlock.txt
parent406089d01562f1e2bf9f089fd7637009ebaad589 (diff)
Patched in Tegra support.
Diffstat (limited to 'Documentation/hwspinlock.txt')
-rw-r--r--Documentation/hwspinlock.txt60
1 files changed, 21 insertions, 39 deletions
diff --git a/Documentation/hwspinlock.txt b/Documentation/hwspinlock.txt
index a903ee5e977..69966813d59 100644
--- a/Documentation/hwspinlock.txt
+++ b/Documentation/hwspinlock.txt
@@ -227,62 +227,44 @@ int hwspinlock_example2(void)
227 227
2284. API for implementors 2284. API for implementors
229 229
230 int hwspin_lock_register(struct hwspinlock_device *bank, struct device *dev, 230 int hwspin_lock_register(struct hwspinlock *hwlock);
231 const struct hwspinlock_ops *ops, int base_id, int num_locks);
232 - to be called from the underlying platform-specific implementation, in 231 - to be called from the underlying platform-specific implementation, in
233 order to register a new hwspinlock device (which is usually a bank of 232 order to register a new hwspinlock instance. Should be called from
234 numerous locks). Should be called from a process context (this function 233 a process context (this function might sleep).
235 might sleep).
236 Returns 0 on success, or appropriate error code on failure. 234 Returns 0 on success, or appropriate error code on failure.
237 235
238 int hwspin_lock_unregister(struct hwspinlock_device *bank); 236 struct hwspinlock *hwspin_lock_unregister(unsigned int id);
239 - to be called from the underlying vendor-specific implementation, in order 237 - to be called from the underlying vendor-specific implementation, in order
240 to unregister an hwspinlock device (which is usually a bank of numerous 238 to unregister an existing (and unused) hwspinlock instance.
241 locks).
242 Should be called from a process context (this function might sleep). 239 Should be called from a process context (this function might sleep).
243 Returns the address of hwspinlock on success, or NULL on error (e.g. 240 Returns the address of hwspinlock on success, or NULL on error (e.g.
244 if the hwspinlock is sill in use). 241 if the hwspinlock is sill in use).
245 242
2465. Important structs 2435. struct hwspinlock
247 244
248struct hwspinlock_device is a device which usually contains a bank 245This struct represents an hwspinlock instance. It is registered by the
249of hardware locks. It is registered by the underlying hwspinlock 246underlying hwspinlock implementation using the hwspin_lock_register() API.
250implementation using the hwspin_lock_register() API.
251 247
252/** 248/**
253 * struct hwspinlock_device - a device which usually spans numerous hwspinlocks 249 * struct hwspinlock - vendor-specific hwspinlock implementation
254 * @dev: underlying device, will be used to invoke runtime PM api 250 *
255 * @ops: platform-specific hwspinlock handlers 251 * @dev: underlying device, will be used with runtime PM api
256 * @base_id: id index of the first lock in this device 252 * @ops: vendor-specific hwspinlock handlers
257 * @num_locks: number of locks in this device 253 * @id: a global, unique, system-wide, index of the lock.
258 * @lock: dynamically allocated array of 'struct hwspinlock'
259 */
260struct hwspinlock_device {
261 struct device *dev;
262 const struct hwspinlock_ops *ops;
263 int base_id;
264 int num_locks;
265 struct hwspinlock lock[0];
266};
267
268struct hwspinlock_device contains an array of hwspinlock structs, each
269of which represents a single hardware lock:
270
271/**
272 * struct hwspinlock - this struct represents a single hwspinlock instance
273 * @bank: the hwspinlock_device structure which owns this lock
274 * @lock: initialized and used by hwspinlock core 254 * @lock: initialized and used by hwspinlock core
275 * @priv: private data, owned by the underlying platform-specific hwspinlock drv 255 * @owner: underlying implementation module, used to maintain module ref count
276 */ 256 */
277struct hwspinlock { 257struct hwspinlock {
278 struct hwspinlock_device *bank; 258 struct device *dev;
259 const struct hwspinlock_ops *ops;
260 int id;
279 spinlock_t lock; 261 spinlock_t lock;
280 void *priv; 262 struct module *owner;
281}; 263};
282 264
283When registering a bank of locks, the hwspinlock driver only needs to 265The underlying implementation is responsible to assign the dev, ops, id and
284set the priv members of the locks. The rest of the members are set and 266owner members. The lock member, OTOH, is initialized and used by the hwspinlock
285initialized by the hwspinlock core itself. 267core.
286 268
2876. Implementation callbacks 2696. Implementation callbacks
288 270