Revert "Revert "change the slp_global_lock to the tgl""
[platform/adaptation/spreadtrum/libtbm-sprd.git] / src / tbm_bufmgr_tgl.h
1 /**************************************************************************
2  *
3  * libtbm
4  *
5  * Copyright 2012 Samsung Electronics co., Ltd. All Rights Reserved.
6  *
7  * Contact: SooChan Lim <sc1.lim@samsung.com>, Sangjin Lee <lsj119@samsung.com>
8  * Boram Park <boram1288.park@samsung.com>, Changyeon Lee <cyeon.lee@samsung.com>
9  *
10  * Permission is hereby granted, free of charge, to any person obtaining a
11  * copy of this software and associated documentation files (the
12  * "Software"), to deal in the Software without restriction, including
13  * without limitation the rights to use, copy, modify, merge, publish,
14  * distribute, sub license, and/or sell copies of the Software, and to
15  * permit persons to whom the Software is furnished to do so, subject to
16  * the following conditions:
17  *
18  * The above copyright notice and this permission notice (including the
19  * next paragraph) shall be included in all copies or substantial portions
20  * of the Software.
21  *
22  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
23  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
25  * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
26  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
27  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
28  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29  *
30  * **************************************************************************/
31
32 #ifndef __TBM_BUFMGR_TGL_H__
33 #define __TBM_BUFMGR_TGL_H__
34
35 #include <linux/ioctl.h>
36
37 static char tgl_devfile[] = "/dev/tgl";
38
39 #define TGL_IOCTL_BASE          0x32
40 #define TGL_IO(nr)                      _IO(TGL_IOCTL_BASE, nr)
41 #define TGL_IOR(nr, type)       _IOR(TGL_IOCTL_BASE, nr, type)
42 #define TGL_IOW(nr, type)       _IOW(TGL_IOCTL_BASE, nr, type)
43 #define TGL_IOWR(nr, type)      _IOWR(TGL_IOCTL_BASE, nr, type)
44
45 /**
46  * struct tgl_ver_data - tgl version data structure
47  * @major: major version
48  * @minor: minor version
49  */
50 struct tgl_ver_data {
51         unsigned int major;
52         unsigned int minor;
53 };
54
55 /**
56  * struct tgl_reg_data - tgl  data structure
57  * @key: lookup key
58  * @timeout_ms: timeout value for waiting event
59  */
60 struct tgl_reg_data {
61         unsigned int key;
62         unsigned int timeout_ms;
63 };
64
65 enum tgl_type_data {
66         TGL_TYPE_NONE = 0,
67         TGL_TYPE_READ = (1 << 0),
68         TGL_TYPE_WRITE = (1 << 1),
69 };
70
71 /**
72  * struct tgl_lock_data - tgl lock data structure
73  * @key: lookup key
74  * @type: lock type that is in tgl_type_data
75  */
76 struct tgl_lock_data {
77         unsigned int key;
78         enum tgl_type_data type;
79 };
80
81 enum tgl_status_data {
82         TGL_STATUS_UNLOCKED,
83         TGL_STATUS_LOCKED,
84 };
85
86 /**
87  * struct tgl_usr_data - tgl user data structure
88  * @key: lookup key
89  * @data1: user data 1
90  * @data2: user data 2
91  * @status: lock status that is in tgl_status_data
92  */
93 struct tgl_usr_data {
94         unsigned int key;
95         unsigned int data1;
96         unsigned int data2;
97         enum tgl_status_data status;
98 };
99
100 enum {
101         _TGL_GET_VERSION,
102         _TGL_REGISTER,
103         _TGL_UNREGISTER,
104         _TGL_LOCK,
105         _TGL_UNLOCK,
106         _TGL_SET_DATA,
107         _TGL_GET_DATA,
108 };
109
110 /* get version information */
111 #define TGL_IOCTL_GET_VERSION   TGL_IOR(_TGL_GET_VERSION, struct tgl_ver_data)
112 /* register key */
113 #define TGL_IOCTL_REGISTER              TGL_IOW(_TGL_REGISTER, struct tgl_reg_data)
114 /* unregister key */
115 #define TGL_IOCTL_UNREGISTER    TGL_IOW(_TGL_UNREGISTER, struct tgl_reg_data)
116 /* lock with key */
117 #define TGL_IOCTL_LOCK                  TGL_IOW(_TGL_LOCK, struct tgl_lock_data)
118 /* unlock with key */
119 #define TGL_IOCTL_UNLOCK                TGL_IOW(_TGL_UNLOCK, struct tgl_lock_data)
120 /* set user data with key */
121 #define TGL_IOCTL_SET_DATA              TGL_IOW(_TGL_SET_DATA, struct tgl_usr_data)
122 /* get user data with key */
123 #define TGL_IOCTL_GET_DATA              TGL_IOR(_TGL_GET_DATA, struct tgl_usr_data)
124
125 #endif /* __TBM_BUFMGR_TGL_H__ */