Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright © 2008-2017 Intel Corporation
0003  *
0004  * Permission is hereby granted, free of charge, to any person obtaining a
0005  * copy of this software and associated documentation files (the "Software"),
0006  * to deal in the Software without restriction, including without limitation
0007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
0008  * and/or sell copies of the Software, and to permit persons to whom the
0009  * Software is furnished to do so, subject to the following conditions:
0010  *
0011  * The above copyright notice and this permission notice (including the next
0012  * paragraph) shall be included in all copies or substantial portions of the
0013  * Software.
0014  *
0015  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0016  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0017  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
0018  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
0019  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
0020  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
0021  * IN THE SOFTWARE.
0022  *
0023  */
0024 
0025 #ifndef _INTEL_OPREGION_H_
0026 #define _INTEL_OPREGION_H_
0027 
0028 #include <linux/workqueue.h>
0029 #include <linux/pci.h>
0030 
0031 struct drm_i915_private;
0032 struct intel_connector;
0033 struct intel_encoder;
0034 
0035 struct opregion_header;
0036 struct opregion_acpi;
0037 struct opregion_swsci;
0038 struct opregion_asle;
0039 struct opregion_asle_ext;
0040 
0041 struct intel_opregion {
0042     struct opregion_header *header;
0043     struct opregion_acpi *acpi;
0044     struct opregion_swsci *swsci;
0045     u32 swsci_gbda_sub_functions;
0046     u32 swsci_sbcb_sub_functions;
0047     struct opregion_asle *asle;
0048     struct opregion_asle_ext *asle_ext;
0049     void *rvda;
0050     void *vbt_firmware;
0051     const void *vbt;
0052     u32 vbt_size;
0053     u32 *lid_state;
0054     struct work_struct asle_work;
0055     struct notifier_block acpi_notifier;
0056 };
0057 
0058 #define OPREGION_SIZE            (8 * 1024)
0059 
0060 #ifdef CONFIG_ACPI
0061 
0062 int intel_opregion_setup(struct drm_i915_private *dev_priv);
0063 
0064 void intel_opregion_register(struct drm_i915_private *dev_priv);
0065 void intel_opregion_unregister(struct drm_i915_private *dev_priv);
0066 
0067 void intel_opregion_resume(struct drm_i915_private *dev_priv);
0068 void intel_opregion_suspend(struct drm_i915_private *dev_priv,
0069                 pci_power_t state);
0070 
0071 void intel_opregion_asle_intr(struct drm_i915_private *dev_priv);
0072 int intel_opregion_notify_encoder(struct intel_encoder *intel_encoder,
0073                   bool enable);
0074 int intel_opregion_notify_adapter(struct drm_i915_private *dev_priv,
0075                   pci_power_t state);
0076 int intel_opregion_get_panel_type(struct drm_i915_private *dev_priv);
0077 struct edid *intel_opregion_get_edid(struct intel_connector *connector);
0078 
0079 bool intel_opregion_headless_sku(struct drm_i915_private *i915);
0080 
0081 #else /* CONFIG_ACPI*/
0082 
0083 static inline int intel_opregion_setup(struct drm_i915_private *dev_priv)
0084 {
0085     return 0;
0086 }
0087 
0088 static inline void intel_opregion_register(struct drm_i915_private *dev_priv)
0089 {
0090 }
0091 
0092 static inline void intel_opregion_unregister(struct drm_i915_private *dev_priv)
0093 {
0094 }
0095 
0096 static inline void intel_opregion_resume(struct drm_i915_private *dev_priv)
0097 {
0098 }
0099 
0100 static inline void intel_opregion_suspend(struct drm_i915_private *dev_priv,
0101                       pci_power_t state)
0102 {
0103 }
0104 
0105 static inline void intel_opregion_asle_intr(struct drm_i915_private *dev_priv)
0106 {
0107 }
0108 
0109 static inline int
0110 intel_opregion_notify_encoder(struct intel_encoder *intel_encoder, bool enable)
0111 {
0112     return 0;
0113 }
0114 
0115 static inline int
0116 intel_opregion_notify_adapter(struct drm_i915_private *dev, pci_power_t state)
0117 {
0118     return 0;
0119 }
0120 
0121 static inline int intel_opregion_get_panel_type(struct drm_i915_private *dev)
0122 {
0123     return -ENODEV;
0124 }
0125 
0126 static inline struct edid *
0127 intel_opregion_get_edid(struct intel_connector *connector)
0128 {
0129     return NULL;
0130 }
0131 
0132 static inline bool intel_opregion_headless_sku(struct drm_i915_private *i915)
0133 {
0134     return false;
0135 }
0136 
0137 #endif /* CONFIG_ACPI */
0138 
0139 #endif