xref: /linux/drivers/gpu/drm/i915/display/intel_opregion.h (revision c5288cda69ee2d8607f5026bd599a5cebf0ee783)
1 /*
2  * Copyright © 2008-2017 Intel Corporation
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice (including the next
12  * paragraph) shall be included in all copies or substantial portions of the
13  * Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21  * IN THE SOFTWARE.
22  *
23  */
24 
25 #ifndef _INTEL_OPREGION_H_
26 #define _INTEL_OPREGION_H_
27 
28 #include <linux/pci.h>
29 #include <linux/types.h>
30 
31 struct drm_i915_private;
32 struct intel_connector;
33 struct intel_encoder;
34 
35 #ifdef CONFIG_ACPI
36 
37 int intel_opregion_setup(struct drm_i915_private *dev_priv);
38 void intel_opregion_cleanup(struct drm_i915_private *i915);
39 
40 void intel_opregion_register(struct drm_i915_private *dev_priv);
41 void intel_opregion_unregister(struct drm_i915_private *dev_priv);
42 
43 void intel_opregion_resume(struct drm_i915_private *dev_priv);
44 void intel_opregion_suspend(struct drm_i915_private *dev_priv,
45 			    pci_power_t state);
46 
47 bool intel_opregion_asle_present(struct drm_i915_private *i915);
48 void intel_opregion_asle_intr(struct drm_i915_private *dev_priv);
49 int intel_opregion_notify_encoder(struct intel_encoder *intel_encoder,
50 				  bool enable);
51 int intel_opregion_notify_adapter(struct drm_i915_private *dev_priv,
52 				  pci_power_t state);
53 int intel_opregion_get_panel_type(struct drm_i915_private *dev_priv);
54 const struct drm_edid *intel_opregion_get_edid(struct intel_connector *connector);
55 
56 bool intel_opregion_vbt_present(struct drm_i915_private *i915);
57 const void *intel_opregion_get_vbt(struct drm_i915_private *i915, size_t *size);
58 
59 bool intel_opregion_headless_sku(struct drm_i915_private *i915);
60 
61 void intel_opregion_debugfs_register(struct drm_i915_private *i915);
62 
63 #else /* CONFIG_ACPI*/
64 
65 static inline int intel_opregion_setup(struct drm_i915_private *dev_priv)
66 {
67 	return 0;
68 }
69 
70 static inline void intel_opregion_cleanup(struct drm_i915_private *i915)
71 {
72 }
73 
74 static inline void intel_opregion_register(struct drm_i915_private *dev_priv)
75 {
76 }
77 
78 static inline void intel_opregion_unregister(struct drm_i915_private *dev_priv)
79 {
80 }
81 
82 static inline void intel_opregion_resume(struct drm_i915_private *dev_priv)
83 {
84 }
85 
86 static inline void intel_opregion_suspend(struct drm_i915_private *dev_priv,
87 					  pci_power_t state)
88 {
89 }
90 
91 static inline bool intel_opregion_asle_present(struct drm_i915_private *i915)
92 {
93 	return false;
94 }
95 
96 static inline void intel_opregion_asle_intr(struct drm_i915_private *dev_priv)
97 {
98 }
99 
100 static inline int
101 intel_opregion_notify_encoder(struct intel_encoder *intel_encoder, bool enable)
102 {
103 	return 0;
104 }
105 
106 static inline int
107 intel_opregion_notify_adapter(struct drm_i915_private *dev, pci_power_t state)
108 {
109 	return 0;
110 }
111 
112 static inline int intel_opregion_get_panel_type(struct drm_i915_private *dev)
113 {
114 	return -ENODEV;
115 }
116 
117 static inline const struct drm_edid *
118 intel_opregion_get_edid(struct intel_connector *connector)
119 {
120 	return NULL;
121 }
122 
123 static inline bool intel_opregion_vbt_present(struct drm_i915_private *i915)
124 {
125 	return false;
126 }
127 
128 static inline const void *
129 intel_opregion_get_vbt(struct drm_i915_private *i915, size_t *size)
130 {
131 	return NULL;
132 }
133 
134 static inline bool intel_opregion_headless_sku(struct drm_i915_private *i915)
135 {
136 	return false;
137 }
138 
139 static inline void intel_opregion_debugfs_register(struct drm_i915_private *i915)
140 {
141 }
142 
143 #endif /* CONFIG_ACPI */
144 
145 #endif
146