1/* $NetBSD: intel_opregion.h,v 1.6 2024/04/16 14:34:01 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#include <linux/acpi.h> 33 34struct drm_i915_private; 35struct intel_encoder; 36 37struct opregion_header; 38struct opregion_acpi; 39struct opregion_swsci; 40struct opregion_asle; 41 42struct intel_opregion { 43 struct opregion_header *header; 44 struct opregion_acpi *acpi; 45 struct opregion_swsci *swsci; 46 u32 swsci_gbda_sub_functions; 47 u32 swsci_sbcb_sub_functions; 48 struct opregion_asle *asle; 49 void *rvda; 50 void *vbt_firmware; 51 const void *vbt; 52 u32 vbt_size; 53 u32 *lid_state; 54 struct work_struct asle_work; 55#ifdef __NetBSD__ 56 struct acpidisp_notifier *acpi_notifier; 57#else 58 struct notifier_block acpi_notifier; 59#endif 60}; 61 62#define OPREGION_SIZE (8 * 1024) 63 64#ifdef CONFIG_ACPI 65 66int intel_opregion_setup(struct drm_i915_private *dev_priv); 67 68void intel_opregion_register(struct drm_i915_private *dev_priv); 69void intel_opregion_unregister(struct drm_i915_private *dev_priv); 70 71void intel_opregion_resume(struct drm_i915_private *dev_priv); 72void intel_opregion_suspend(struct drm_i915_private *dev_priv, 73 pci_power_t state); 74 75void intel_opregion_asle_intr(struct drm_i915_private *dev_priv); 76int intel_opregion_notify_encoder(struct intel_encoder *intel_encoder, 77 bool enable); 78int intel_opregion_notify_adapter(struct drm_i915_private *dev_priv, 79 pci_power_t state); 80int intel_opregion_get_panel_type(struct drm_i915_private *dev_priv); 81 82#else /* CONFIG_ACPI*/ 83 84static inline int intel_opregion_setup(struct drm_i915_private *dev_priv) 85{ 86 return 0; 87} 88 89static inline void intel_opregion_register(struct drm_i915_private *dev_priv) 90{ 91} 92 93static inline void intel_opregion_unregister(struct drm_i915_private *dev_priv) 94{ 95} 96 97static inline void intel_opregion_resume(struct drm_i915_private *dev_priv) 98{ 99} 100 101static inline void intel_opregion_suspend(struct drm_i915_private *dev_priv, 102 pci_power_t state) 103{ 104} 105 106static inline void intel_opregion_asle_intr(struct drm_i915_private *dev_priv) 107{ 108} 109 110static inline int 111intel_opregion_notify_encoder(struct intel_encoder *intel_encoder, bool enable) 112{ 113 return 0; 114} 115 116static inline int 117intel_opregion_notify_adapter(struct drm_i915_private *dev, pci_power_t state) 118{ 119 return 0; 120} 121 122static inline int intel_opregion_get_panel_type(struct drm_i915_private *dev) 123{ 124 return -ENODEV; 125} 126 127#endif /* CONFIG_ACPI */ 128 129#endif 130