xref: /OK3568_Linux_fs/kernel/drivers/gpu/arm/midgard/protected_mode_switcher.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  *
3*4882a593Smuzhiyun  * (C) COPYRIGHT 2017 ARM Limited. All rights reserved.
4*4882a593Smuzhiyun  *
5*4882a593Smuzhiyun  * This program is free software and is provided to you under the terms of the
6*4882a593Smuzhiyun  * GNU General Public License version 2 as published by the Free Software
7*4882a593Smuzhiyun  * Foundation, and any use by you of this program is subject to the terms
8*4882a593Smuzhiyun  * of such GNU licence.
9*4882a593Smuzhiyun  *
10*4882a593Smuzhiyun  * A copy of the licence is included with the program, and can also be obtained
11*4882a593Smuzhiyun  * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
12*4882a593Smuzhiyun  * Boston, MA  02110-1301, USA.
13*4882a593Smuzhiyun  *
14*4882a593Smuzhiyun  */
15*4882a593Smuzhiyun 
16*4882a593Smuzhiyun 
17*4882a593Smuzhiyun 
18*4882a593Smuzhiyun #ifndef _PROTECTED_MODE_SWITCH_H_
19*4882a593Smuzhiyun #define _PROTECTED_MODE_SWITCH_H_
20*4882a593Smuzhiyun 
21*4882a593Smuzhiyun struct protected_mode_device;
22*4882a593Smuzhiyun 
23*4882a593Smuzhiyun /**
24*4882a593Smuzhiyun  * struct protected_mode_ops - Callbacks for protected mode switch operations
25*4882a593Smuzhiyun  *
26*4882a593Smuzhiyun  * @protected_mode_enable:  Callback to enable protected mode for device
27*4882a593Smuzhiyun  * @protected_mode_disable: Callback to disable protected mode for device
28*4882a593Smuzhiyun  */
29*4882a593Smuzhiyun struct protected_mode_ops {
30*4882a593Smuzhiyun 	/**
31*4882a593Smuzhiyun 	 * protected_mode_enable() - Enable protected mode on device
32*4882a593Smuzhiyun 	 * @dev:	The struct device
33*4882a593Smuzhiyun 	 *
34*4882a593Smuzhiyun 	 * Return: 0 on success, non-zero on error
35*4882a593Smuzhiyun 	 */
36*4882a593Smuzhiyun 	int (*protected_mode_enable)(
37*4882a593Smuzhiyun 			struct protected_mode_device *protected_dev);
38*4882a593Smuzhiyun 
39*4882a593Smuzhiyun 	/**
40*4882a593Smuzhiyun 	 * protected_mode_disable() - Disable protected mode on device, and
41*4882a593Smuzhiyun 	 *                            reset device
42*4882a593Smuzhiyun 	 * @dev:	The struct device
43*4882a593Smuzhiyun 	 *
44*4882a593Smuzhiyun 	 * Return: 0 on success, non-zero on error
45*4882a593Smuzhiyun 	 */
46*4882a593Smuzhiyun 	int (*protected_mode_disable)(
47*4882a593Smuzhiyun 			struct protected_mode_device *protected_dev);
48*4882a593Smuzhiyun };
49*4882a593Smuzhiyun 
50*4882a593Smuzhiyun /**
51*4882a593Smuzhiyun  * struct protected_mode_device - Device structure for protected mode devices
52*4882a593Smuzhiyun  *
53*4882a593Smuzhiyun  * @ops  - Callbacks associated with this device
54*4882a593Smuzhiyun  * @data - Pointer to device private data
55*4882a593Smuzhiyun  *
56*4882a593Smuzhiyun  * This structure should be registered with the platform device using
57*4882a593Smuzhiyun  * platform_set_drvdata().
58*4882a593Smuzhiyun  */
59*4882a593Smuzhiyun struct protected_mode_device {
60*4882a593Smuzhiyun 	struct protected_mode_ops ops;
61*4882a593Smuzhiyun 	void *data;
62*4882a593Smuzhiyun };
63*4882a593Smuzhiyun 
64*4882a593Smuzhiyun #endif /* _PROTECTED_MODE_SWITCH_H_ */
65