Package version up to 3.0.3
[platform/adaptation/spreadtrum/libtbm-sprd.git] / src / libtbm-sprd / 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/slp_global_lock";
38 static char tgl_devfile1[] = "/dev/tgl";
39
40 #define TGL_IOCTL_BASE          0x32
41 #define TGL_IO(nr)                      _IO(TGL_IOCTL_BASE, nr)
42 #define TGL_IOR(nr, type)       _IOR(TGL_IOCTL_BASE, nr, type)
43 #define TGL_IOW(nr, type)       _IOW(TGL_IOCTL_BASE, nr, type)
44 #define TGL_IOWR(nr, type)      _IOWR(TGL_IOCTL_BASE, nr, type)
45
46 /**
47  * struct tgl_ver_data - tgl version data structure
48  * @major: major version
49  * @minor: minor version
50  */
51 struct tgl_ver_data {
52         unsigned int major;
53         unsigned int minor;
54 };
55
56 /**
57  * struct tgl_reg_data - tgl  data structure
58  * @key: lookup key
59  * @timeout_ms: timeout value for waiting event
60  */
61 struct tgl_reg_data {
62         unsigned int key;
63         unsigned int timeout_ms;
64 };
65
66 enum tgl_type_data {
67         TGL_TYPE_NONE = 0,
68         TGL_TYPE_READ = (1 << 0),
69         TGL_TYPE_WRITE = (1 << 1),
70 };
71
72 /**
73  * struct tgl_lock_data - tgl lock data structure
74  * @key: lookup key
75  * @type: lock type that is in tgl_type_data
76  */
77 struct tgl_lock_data {
78         unsigned int key;
79         enum tgl_type_data type;
80 };
81
82 enum tgl_status_data {
83         TGL_STATUS_UNLOCKED,
84         TGL_STATUS_LOCKED,
85 };
86
87 /**
88  * struct tgl_usr_data - tgl user data structure
89  * @key: lookup key
90  * @data1: user data 1
91  * @data2: user data 2
92  * @status: lock status that is in tgl_status_data
93  */
94 struct tgl_usr_data {
95         unsigned int key;
96         unsigned int data1;
97         unsigned int data2;
98         enum tgl_status_data status;
99 };
100
101 enum {
102         _TGL_GET_VERSION,
103         _TGL_REGISTER,
104         _TGL_UNREGISTER,
105         _TGL_LOCK,
106         _TGL_UNLOCK,
107         _TGL_SET_DATA,
108         _TGL_GET_DATA,
109 };
110
111 /* get version information */
112 #define TGL_IOCTL_GET_VERSION   TGL_IOR(_TGL_GET_VERSION, struct tgl_ver_data)
113 /* register key */
114 #define TGL_IOCTL_REGISTER              TGL_IOW(_TGL_REGISTER, struct tgl_reg_data)
115 /* unregister key */
116 #define TGL_IOCTL_UNREGISTER    TGL_IOW(_TGL_UNREGISTER, struct tgl_reg_data)
117 /* lock with key */
118 #define TGL_IOCTL_LOCK                  TGL_IOW(_TGL_LOCK, struct tgl_lock_data)
119 /* unlock with key */
120 #define TGL_IOCTL_UNLOCK                TGL_IOW(_TGL_UNLOCK, struct tgl_lock_data)
121 /* set user data with key */
122 #define TGL_IOCTL_SET_DATA              TGL_IOW(_TGL_SET_DATA, struct tgl_usr_data)
123 /* get user data with key */
124 #define TGL_IOCTL_GET_DATA              TGL_IOR(_TGL_GET_DATA, struct tgl_usr_data)
125
126 #endif /* __TBM_BUFMGR_TGL_H__ */