2 * linux/include/asm-arm/arch-omap/resource.h
3 * Structure definitions for Shared resource Framework
5 * Copyright (C) 2007-2008 Texas Instruments, Inc.
6 * Written by Rajendra Nayak <rnayak@ti.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
12 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
13 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
14 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
20 #ifndef __ARCH_ARM_OMAP_RESOURCE_H
21 #define __ARCH_ARM_OMAP_RESOURCE_H
23 #include <linux/list.h>
24 #include <linux/mutex.h>
25 #include <linux/device.h>
29 #define RES_DEFAULTLEVEL 0x0
31 struct shared_resource_ops
; /* forward declaration */
33 /* Used to model a Shared Multilevel Resource */
34 struct shared_resource
{
37 /* Used to represent the OMAP chip types containing this res */
38 const struct omap_chip_id omap_chip
;
39 /* Total no of users at any point of this resource */
41 /* Current level of this resource */
43 /* Used to store any resource specific data */
45 /* List of all the current users for this resource */
46 struct list_head users_list
;
47 /* Shared resource operations */
48 struct shared_resource_ops
*ops
;
49 struct list_head node
;
52 struct shared_resource_ops
{
53 /* Init function for the resource */
54 void (*init
)(struct shared_resource
*res
);
55 /* Function to change the level of the resource */
56 int (*change_level
)(struct shared_resource
*res
, u32 target_level
);
57 /* Function to validate the requested level of the resource */
58 int (*validate_level
)(struct shared_resource
*res
, u32 target_level
);
61 /* Used to represent a user of a shared resource */
63 /* Device pointer used to uniquely identify the user */
65 /* Current level as requested for the resource by the user */
67 struct list_head node
;
71 extern struct shared_resource
*resources_omap
[];
72 /* Shared resource Framework API's */
73 void resource_init(struct shared_resource
**resources
);
74 int resource_refresh(void);
75 int resource_register(struct shared_resource
*res
);
76 int resource_unregister(struct shared_resource
*res
);
77 int resource_request(const char *name
, struct device
*dev
,
79 int resource_release(const char *name
, struct device
*dev
);
80 int resource_get_level(const char *name
);
82 #endif /* __ARCH_ARM_OMAP_RESOURCE_H */