1 /* SPDX-License-Identifier: MIT */ 2 /* 3 * Copyright © 2023 Intel Corporation 4 */ 5 6 #ifndef __INTEL_PMDEMAND_H__ 7 #define __INTEL_PMDEMAND_H__ 8 9 #include "intel_display_limits.h" 10 #include "intel_global_state.h" 11 12 struct drm_i915_private; 13 struct intel_atomic_state; 14 struct intel_crtc_state; 15 struct intel_encoder; 16 struct intel_plane_state; 17 18 struct pmdemand_params { 19 u16 qclk_gv_bw; 20 u8 voltage_index; 21 u8 qclk_gv_index; 22 u8 active_pipes; 23 u8 active_dbufs; 24 /* Total number of non type C active phys from active_phys_mask */ 25 u8 active_phys; 26 u8 plls; 27 u16 cdclk_freq_mhz; 28 /* max from ddi_clocks[] */ 29 u16 ddiclk_max; 30 u8 scalers; 31 }; 32 33 struct intel_pmdemand_state { 34 struct intel_global_state base; 35 36 /* Maintain a persistent list of port clocks across all crtcs */ 37 int ddi_clocks[I915_MAX_PIPES]; 38 39 /* Maintain a persistent list of non type C phys mask */ 40 u16 active_combo_phys_mask; 41 42 /* Parameters to be configured in the pmdemand registers */ 43 struct pmdemand_params params; 44 }; 45 46 #define to_intel_pmdemand_state(global_state) \ 47 container_of_const((global_state), struct intel_pmdemand_state, base) 48 49 void intel_pmdemand_init_early(struct drm_i915_private *i915); 50 int intel_pmdemand_init(struct drm_i915_private *i915); 51 void intel_pmdemand_init_pmdemand_params(struct drm_i915_private *i915, 52 struct intel_pmdemand_state *pmdemand_state); 53 void intel_pmdemand_update_port_clock(struct drm_i915_private *i915, 54 struct intel_pmdemand_state *pmdemand_state, 55 enum pipe pipe, int port_clock); 56 void intel_pmdemand_update_phys_mask(struct drm_i915_private *i915, 57 struct intel_encoder *encoder, 58 struct intel_pmdemand_state *pmdemand_state, 59 bool clear_bit); 60 void intel_pmdemand_program_dbuf(struct drm_i915_private *i915, 61 u8 dbuf_slices); 62 void intel_pmdemand_pre_plane_update(struct intel_atomic_state *state); 63 void intel_pmdemand_post_plane_update(struct intel_atomic_state *state); 64 int intel_pmdemand_atomic_check(struct intel_atomic_state *state); 65 66 #endif /* __INTEL_PMDEMAND_H__ */ 67