intel_opregion.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. #ifndef _INTEL_OPREGION_H_
  25. #define _INTEL_OPREGION_H_
  26. #include <linux/workqueue.h>
  27. #include <linux/pci.h>
  28. struct drm_i915_private;
  29. struct intel_encoder;
  30. struct opregion_header;
  31. struct opregion_acpi;
  32. struct opregion_swsci;
  33. struct opregion_asle;
  34. struct intel_opregion {
  35. struct opregion_header *header;
  36. struct opregion_acpi *acpi;
  37. struct opregion_swsci *swsci;
  38. u32 swsci_gbda_sub_functions;
  39. u32 swsci_sbcb_sub_functions;
  40. struct opregion_asle *asle;
  41. void *rvda;
  42. void *vbt_firmware;
  43. const void *vbt;
  44. u32 vbt_size;
  45. u32 *lid_state;
  46. struct work_struct asle_work;
  47. };
  48. #define OPREGION_SIZE (8 * 1024)
  49. #ifdef CONFIG_ACPI
  50. int intel_opregion_setup(struct drm_i915_private *dev_priv);
  51. void intel_opregion_register(struct drm_i915_private *dev_priv);
  52. void intel_opregion_unregister(struct drm_i915_private *dev_priv);
  53. void intel_opregion_asle_intr(struct drm_i915_private *dev_priv);
  54. int intel_opregion_notify_encoder(struct intel_encoder *intel_encoder,
  55. bool enable);
  56. int intel_opregion_notify_adapter(struct drm_i915_private *dev_priv,
  57. pci_power_t state);
  58. int intel_opregion_get_panel_type(struct drm_i915_private *dev_priv);
  59. #else /* CONFIG_ACPI*/
  60. static inline int intel_opregion_setup(struct drm_i915_private *dev_priv)
  61. {
  62. return 0;
  63. }
  64. static inline void intel_opregion_register(struct drm_i915_private *dev_priv)
  65. {
  66. }
  67. static inline void intel_opregion_unregister(struct drm_i915_private *dev_priv)
  68. {
  69. }
  70. static inline void intel_opregion_asle_intr(struct drm_i915_private *dev_priv)
  71. {
  72. }
  73. static inline int
  74. intel_opregion_notify_encoder(struct intel_encoder *intel_encoder, bool enable)
  75. {
  76. return 0;
  77. }
  78. static inline int
  79. intel_opregion_notify_adapter(struct drm_i915_private *dev, pci_power_t state)
  80. {
  81. return 0;
  82. }
  83. static inline int intel_opregion_get_panel_type(struct drm_i915_private *dev)
  84. {
  85. return -ENODEV;
  86. }
  87. #endif /* CONFIG_ACPI */
  88. #endif