18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: MIT */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright © 2019 Intel Corporation 48c2ecf20Sopenharmony_ci */ 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ci#ifndef __I915_IRQ_H__ 78c2ecf20Sopenharmony_ci#define __I915_IRQ_H__ 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#include <linux/ktime.h> 108c2ecf20Sopenharmony_ci#include <linux/types.h> 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci#include "display/intel_display.h" 138c2ecf20Sopenharmony_ci#include "i915_reg.h" 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_cistruct drm_crtc; 168c2ecf20Sopenharmony_cistruct drm_device; 178c2ecf20Sopenharmony_cistruct drm_display_mode; 188c2ecf20Sopenharmony_cistruct drm_i915_private; 198c2ecf20Sopenharmony_cistruct intel_crtc; 208c2ecf20Sopenharmony_cistruct intel_uncore; 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_civoid intel_irq_init(struct drm_i915_private *dev_priv); 238c2ecf20Sopenharmony_civoid intel_irq_fini(struct drm_i915_private *dev_priv); 248c2ecf20Sopenharmony_ciint intel_irq_install(struct drm_i915_private *dev_priv); 258c2ecf20Sopenharmony_civoid intel_irq_uninstall(struct drm_i915_private *dev_priv); 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ciu32 i915_pipestat_enable_mask(struct drm_i915_private *dev_priv, 288c2ecf20Sopenharmony_ci enum pipe pipe); 298c2ecf20Sopenharmony_civoid 308c2ecf20Sopenharmony_cii915_enable_pipestat(struct drm_i915_private *dev_priv, enum pipe pipe, 318c2ecf20Sopenharmony_ci u32 status_mask); 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_civoid 348c2ecf20Sopenharmony_cii915_disable_pipestat(struct drm_i915_private *dev_priv, enum pipe pipe, 358c2ecf20Sopenharmony_ci u32 status_mask); 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_civoid valleyview_enable_display_irqs(struct drm_i915_private *dev_priv); 388c2ecf20Sopenharmony_civoid valleyview_disable_display_irqs(struct drm_i915_private *dev_priv); 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_civoid i915_hotplug_interrupt_update(struct drm_i915_private *dev_priv, 418c2ecf20Sopenharmony_ci u32 mask, 428c2ecf20Sopenharmony_ci u32 bits); 438c2ecf20Sopenharmony_civoid ilk_update_display_irq(struct drm_i915_private *dev_priv, 448c2ecf20Sopenharmony_ci u32 interrupt_mask, 458c2ecf20Sopenharmony_ci u32 enabled_irq_mask); 468c2ecf20Sopenharmony_cistatic inline void 478c2ecf20Sopenharmony_ciilk_enable_display_irq(struct drm_i915_private *dev_priv, u32 bits) 488c2ecf20Sopenharmony_ci{ 498c2ecf20Sopenharmony_ci ilk_update_display_irq(dev_priv, bits, bits); 508c2ecf20Sopenharmony_ci} 518c2ecf20Sopenharmony_cistatic inline void 528c2ecf20Sopenharmony_ciilk_disable_display_irq(struct drm_i915_private *dev_priv, u32 bits) 538c2ecf20Sopenharmony_ci{ 548c2ecf20Sopenharmony_ci ilk_update_display_irq(dev_priv, bits, 0); 558c2ecf20Sopenharmony_ci} 568c2ecf20Sopenharmony_civoid bdw_update_pipe_irq(struct drm_i915_private *dev_priv, 578c2ecf20Sopenharmony_ci enum pipe pipe, 588c2ecf20Sopenharmony_ci u32 interrupt_mask, 598c2ecf20Sopenharmony_ci u32 enabled_irq_mask); 608c2ecf20Sopenharmony_cistatic inline void bdw_enable_pipe_irq(struct drm_i915_private *dev_priv, 618c2ecf20Sopenharmony_ci enum pipe pipe, u32 bits) 628c2ecf20Sopenharmony_ci{ 638c2ecf20Sopenharmony_ci bdw_update_pipe_irq(dev_priv, pipe, bits, bits); 648c2ecf20Sopenharmony_ci} 658c2ecf20Sopenharmony_cistatic inline void bdw_disable_pipe_irq(struct drm_i915_private *dev_priv, 668c2ecf20Sopenharmony_ci enum pipe pipe, u32 bits) 678c2ecf20Sopenharmony_ci{ 688c2ecf20Sopenharmony_ci bdw_update_pipe_irq(dev_priv, pipe, bits, 0); 698c2ecf20Sopenharmony_ci} 708c2ecf20Sopenharmony_civoid ibx_display_interrupt_update(struct drm_i915_private *dev_priv, 718c2ecf20Sopenharmony_ci u32 interrupt_mask, 728c2ecf20Sopenharmony_ci u32 enabled_irq_mask); 738c2ecf20Sopenharmony_cistatic inline void 748c2ecf20Sopenharmony_ciibx_enable_display_interrupt(struct drm_i915_private *dev_priv, u32 bits) 758c2ecf20Sopenharmony_ci{ 768c2ecf20Sopenharmony_ci ibx_display_interrupt_update(dev_priv, bits, bits); 778c2ecf20Sopenharmony_ci} 788c2ecf20Sopenharmony_cistatic inline void 798c2ecf20Sopenharmony_ciibx_disable_display_interrupt(struct drm_i915_private *dev_priv, u32 bits) 808c2ecf20Sopenharmony_ci{ 818c2ecf20Sopenharmony_ci ibx_display_interrupt_update(dev_priv, bits, 0); 828c2ecf20Sopenharmony_ci} 838c2ecf20Sopenharmony_ci 848c2ecf20Sopenharmony_civoid gen5_enable_gt_irq(struct drm_i915_private *dev_priv, u32 mask); 858c2ecf20Sopenharmony_civoid gen5_disable_gt_irq(struct drm_i915_private *dev_priv, u32 mask); 868c2ecf20Sopenharmony_civoid gen11_reset_rps_interrupts(struct drm_i915_private *dev_priv); 878c2ecf20Sopenharmony_civoid gen6_reset_rps_interrupts(struct drm_i915_private *dev_priv); 888c2ecf20Sopenharmony_civoid gen6_enable_rps_interrupts(struct drm_i915_private *dev_priv); 898c2ecf20Sopenharmony_civoid gen6_disable_rps_interrupts(struct drm_i915_private *dev_priv); 908c2ecf20Sopenharmony_civoid gen6_rps_reset_ei(struct drm_i915_private *dev_priv); 918c2ecf20Sopenharmony_ciu32 gen6_sanitize_rps_pm_mask(const struct drm_i915_private *i915, u32 mask); 928c2ecf20Sopenharmony_ci 938c2ecf20Sopenharmony_civoid intel_runtime_pm_disable_interrupts(struct drm_i915_private *dev_priv); 948c2ecf20Sopenharmony_civoid intel_runtime_pm_enable_interrupts(struct drm_i915_private *dev_priv); 958c2ecf20Sopenharmony_cibool intel_irqs_enabled(struct drm_i915_private *dev_priv); 968c2ecf20Sopenharmony_civoid intel_synchronize_irq(struct drm_i915_private *i915); 978c2ecf20Sopenharmony_ci 988c2ecf20Sopenharmony_ciint intel_get_crtc_scanline(struct intel_crtc *crtc); 998c2ecf20Sopenharmony_civoid gen8_irq_power_well_post_enable(struct drm_i915_private *dev_priv, 1008c2ecf20Sopenharmony_ci u8 pipe_mask); 1018c2ecf20Sopenharmony_civoid gen8_irq_power_well_pre_disable(struct drm_i915_private *dev_priv, 1028c2ecf20Sopenharmony_ci u8 pipe_mask); 1038c2ecf20Sopenharmony_ci 1048c2ecf20Sopenharmony_cibool intel_crtc_get_vblank_timestamp(struct drm_crtc *crtc, int *max_error, 1058c2ecf20Sopenharmony_ci ktime_t *vblank_time, bool in_vblank_irq); 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_ciu32 i915_get_vblank_counter(struct drm_crtc *crtc); 1088c2ecf20Sopenharmony_ciu32 g4x_get_vblank_counter(struct drm_crtc *crtc); 1098c2ecf20Sopenharmony_ci 1108c2ecf20Sopenharmony_ciint i8xx_enable_vblank(struct drm_crtc *crtc); 1118c2ecf20Sopenharmony_ciint i915gm_enable_vblank(struct drm_crtc *crtc); 1128c2ecf20Sopenharmony_ciint i965_enable_vblank(struct drm_crtc *crtc); 1138c2ecf20Sopenharmony_ciint ilk_enable_vblank(struct drm_crtc *crtc); 1148c2ecf20Sopenharmony_ciint bdw_enable_vblank(struct drm_crtc *crtc); 1158c2ecf20Sopenharmony_civoid i8xx_disable_vblank(struct drm_crtc *crtc); 1168c2ecf20Sopenharmony_civoid i915gm_disable_vblank(struct drm_crtc *crtc); 1178c2ecf20Sopenharmony_civoid i965_disable_vblank(struct drm_crtc *crtc); 1188c2ecf20Sopenharmony_civoid ilk_disable_vblank(struct drm_crtc *crtc); 1198c2ecf20Sopenharmony_civoid bdw_disable_vblank(struct drm_crtc *crtc); 1208c2ecf20Sopenharmony_ci 1218c2ecf20Sopenharmony_civoid gen2_irq_reset(struct intel_uncore *uncore); 1228c2ecf20Sopenharmony_civoid gen3_irq_reset(struct intel_uncore *uncore, i915_reg_t imr, 1238c2ecf20Sopenharmony_ci i915_reg_t iir, i915_reg_t ier); 1248c2ecf20Sopenharmony_ci 1258c2ecf20Sopenharmony_civoid gen2_irq_init(struct intel_uncore *uncore, 1268c2ecf20Sopenharmony_ci u32 imr_val, u32 ier_val); 1278c2ecf20Sopenharmony_civoid gen3_irq_init(struct intel_uncore *uncore, 1288c2ecf20Sopenharmony_ci i915_reg_t imr, u32 imr_val, 1298c2ecf20Sopenharmony_ci i915_reg_t ier, u32 ier_val, 1308c2ecf20Sopenharmony_ci i915_reg_t iir); 1318c2ecf20Sopenharmony_ci 1328c2ecf20Sopenharmony_ci#define GEN8_IRQ_RESET_NDX(uncore, type, which) \ 1338c2ecf20Sopenharmony_ci({ \ 1348c2ecf20Sopenharmony_ci unsigned int which_ = which; \ 1358c2ecf20Sopenharmony_ci gen3_irq_reset((uncore), GEN8_##type##_IMR(which_), \ 1368c2ecf20Sopenharmony_ci GEN8_##type##_IIR(which_), GEN8_##type##_IER(which_)); \ 1378c2ecf20Sopenharmony_ci}) 1388c2ecf20Sopenharmony_ci 1398c2ecf20Sopenharmony_ci#define GEN3_IRQ_RESET(uncore, type) \ 1408c2ecf20Sopenharmony_ci gen3_irq_reset((uncore), type##IMR, type##IIR, type##IER) 1418c2ecf20Sopenharmony_ci 1428c2ecf20Sopenharmony_ci#define GEN2_IRQ_RESET(uncore) \ 1438c2ecf20Sopenharmony_ci gen2_irq_reset(uncore) 1448c2ecf20Sopenharmony_ci 1458c2ecf20Sopenharmony_ci#define GEN8_IRQ_INIT_NDX(uncore, type, which, imr_val, ier_val) \ 1468c2ecf20Sopenharmony_ci({ \ 1478c2ecf20Sopenharmony_ci unsigned int which_ = which; \ 1488c2ecf20Sopenharmony_ci gen3_irq_init((uncore), \ 1498c2ecf20Sopenharmony_ci GEN8_##type##_IMR(which_), imr_val, \ 1508c2ecf20Sopenharmony_ci GEN8_##type##_IER(which_), ier_val, \ 1518c2ecf20Sopenharmony_ci GEN8_##type##_IIR(which_)); \ 1528c2ecf20Sopenharmony_ci}) 1538c2ecf20Sopenharmony_ci 1548c2ecf20Sopenharmony_ci#define GEN3_IRQ_INIT(uncore, type, imr_val, ier_val) \ 1558c2ecf20Sopenharmony_ci gen3_irq_init((uncore), \ 1568c2ecf20Sopenharmony_ci type##IMR, imr_val, \ 1578c2ecf20Sopenharmony_ci type##IER, ier_val, \ 1588c2ecf20Sopenharmony_ci type##IIR) 1598c2ecf20Sopenharmony_ci 1608c2ecf20Sopenharmony_ci#define GEN2_IRQ_INIT(uncore, imr_val, ier_val) \ 1618c2ecf20Sopenharmony_ci gen2_irq_init((uncore), imr_val, ier_val) 1628c2ecf20Sopenharmony_ci 1638c2ecf20Sopenharmony_ci#endif /* __I915_IRQ_H__ */ 164