diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
commit | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch) | |
tree | a8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /Documentation/hwspinlock.txt | |
parent | 406089d01562f1e2bf9f089fd7637009ebaad589 (diff) |
Patched in Tegra support.
Diffstat (limited to 'Documentation/hwspinlock.txt')
-rw-r--r-- | Documentation/hwspinlock.txt | 60 |
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 | ||
228 | 4. API for implementors | 228 | 4. 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 | ||
246 | 5. Important structs | 243 | 5. struct hwspinlock |
247 | 244 | ||
248 | struct hwspinlock_device is a device which usually contains a bank | 245 | This struct represents an hwspinlock instance. It is registered by the |
249 | of hardware locks. It is registered by the underlying hwspinlock | 246 | underlying hwspinlock implementation using the hwspin_lock_register() API. |
250 | implementation 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 | */ | ||
260 | struct 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 | |||
268 | struct hwspinlock_device contains an array of hwspinlock structs, each | ||
269 | of 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 | */ |
277 | struct hwspinlock { | 257 | struct 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 | ||
283 | When registering a bank of locks, the hwspinlock driver only needs to | 265 | The underlying implementation is responsible to assign the dev, ops, id and |
284 | set the priv members of the locks. The rest of the members are set and | 266 | owner members. The lock member, OTOH, is initialized and used by the hwspinlock |
285 | initialized by the hwspinlock core itself. | 267 | core. |
286 | 268 | ||
287 | 6. Implementation callbacks | 269 | 6. Implementation callbacks |
288 | 270 | ||