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