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