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
31struct drm_i915_private;
32struct intel_connector;
33struct intel_encoder;
34
35#ifdef CONFIG_ACPI
36
37int intel_opregion_setup(struct drm_i915_private *dev_priv);
38void intel_opregion_cleanup(struct drm_i915_private *i915);
39
40void intel_opregion_register(struct drm_i915_private *dev_priv);
41void intel_opregion_unregister(struct drm_i915_private *dev_priv);
42
43void intel_opregion_resume(struct drm_i915_private *dev_priv);
44void intel_opregion_suspend(struct drm_i915_private *dev_priv,
45			    pci_power_t state);
46
47bool intel_opregion_asle_present(struct drm_i915_private *i915);
48void intel_opregion_asle_intr(struct drm_i915_private *dev_priv);
49int intel_opregion_notify_encoder(struct intel_encoder *intel_encoder,
50				  bool enable);
51int intel_opregion_notify_adapter(struct drm_i915_private *dev_priv,
52				  pci_power_t state);
53int intel_opregion_get_panel_type(struct drm_i915_private *dev_priv);
54const struct drm_edid *intel_opregion_get_edid(struct intel_connector *connector);
55
56const void *intel_opregion_get_vbt(struct drm_i915_private *i915, size_t *size);
57
58bool intel_opregion_headless_sku(struct drm_i915_private *i915);
59
60void intel_opregion_debugfs_register(struct drm_i915_private *i915);
61
62#else /* CONFIG_ACPI*/
63
64static inline int intel_opregion_setup(struct drm_i915_private *dev_priv)
65{
66	return 0;
67}
68
69static inline void intel_opregion_cleanup(struct drm_i915_private *i915)
70{
71}
72
73static inline void intel_opregion_register(struct drm_i915_private *dev_priv)
74{
75}
76
77static inline void intel_opregion_unregister(struct drm_i915_private *dev_priv)
78{
79}
80
81static inline void intel_opregion_resume(struct drm_i915_private *dev_priv)
82{
83}
84
85static inline void intel_opregion_suspend(struct drm_i915_private *dev_priv,
86					  pci_power_t state)
87{
88}
89
90static inline bool intel_opregion_asle_present(struct drm_i915_private *i915)
91{
92	return false;
93}
94
95static inline void intel_opregion_asle_intr(struct drm_i915_private *dev_priv)
96{
97}
98
99static inline int
100intel_opregion_notify_encoder(struct intel_encoder *intel_encoder, bool enable)
101{
102	return 0;
103}
104
105static inline int
106intel_opregion_notify_adapter(struct drm_i915_private *dev, pci_power_t state)
107{
108	return 0;
109}
110
111static inline int intel_opregion_get_panel_type(struct drm_i915_private *dev)
112{
113	return -ENODEV;
114}
115
116static inline const struct drm_edid *
117intel_opregion_get_edid(struct intel_connector *connector)
118{
119	return NULL;
120}
121
122static inline const void *
123intel_opregion_get_vbt(struct drm_i915_private *i915, size_t *size)
124{
125	return NULL;
126}
127
128static inline bool intel_opregion_headless_sku(struct drm_i915_private *i915)
129{
130	return false;
131}
132
133static inline void intel_opregion_debugfs_register(struct drm_i915_private *i915)
134{
135}
136
137#endif /* CONFIG_ACPI */
138
139#endif
140