Jani Nikula | 696173b | 2019-04-05 14:00:15 +0300 | [diff] [blame] | 1 | /* SPDX-License-Identifier: MIT */ |
| 2 | /* |
| 3 | * Copyright © 2019 Intel Corporation |
| 4 | */ |
| 5 | |
| 6 | #ifndef __INTEL_PM_H__ |
| 7 | #define __INTEL_PM_H__ |
| 8 | |
| 9 | #include <linux/types.h> |
| 10 | |
Ville Syrjälä | 47a1495 | 2021-01-22 22:56:30 +0200 | [diff] [blame] | 11 | #include "display/intel_display.h" |
Ville Syrjälä | 3cf43cd | 2020-02-25 19:11:13 +0200 | [diff] [blame] | 12 | #include "display/intel_global_state.h" |
| 13 | |
Ville Syrjälä | 47a1495 | 2021-01-22 22:56:30 +0200 | [diff] [blame] | 14 | #include "i915_drv.h" |
Jani Nikula | ecbb5fb | 2019-04-29 15:29:37 +0300 | [diff] [blame] | 15 | #include "i915_reg.h" |
| 16 | |
Jani Nikula | 696173b | 2019-04-05 14:00:15 +0300 | [diff] [blame] | 17 | struct drm_device; |
| 18 | struct drm_i915_private; |
| 19 | struct i915_request; |
Maarten Lankhorst | 855e0d6 | 2019-06-28 10:55:13 +0200 | [diff] [blame] | 20 | struct intel_atomic_state; |
Jani Nikula | 8e6b13a | 2021-08-18 13:11:07 +0300 | [diff] [blame] | 21 | struct intel_bw_state; |
Jani Nikula | 696173b | 2019-04-05 14:00:15 +0300 | [diff] [blame] | 22 | struct intel_crtc; |
| 23 | struct intel_crtc_state; |
| 24 | struct intel_plane; |
Jani Nikula | 696173b | 2019-04-05 14:00:15 +0300 | [diff] [blame] | 25 | struct skl_ddb_entry; |
| 26 | struct skl_pipe_wm; |
| 27 | struct skl_wm_level; |
| 28 | |
| 29 | void intel_init_clock_gating(struct drm_i915_private *dev_priv); |
| 30 | void intel_suspend_hw(struct drm_i915_private *dev_priv); |
| 31 | int ilk_wm_max_level(const struct drm_i915_private *dev_priv); |
Jani Nikula | 696173b | 2019-04-05 14:00:15 +0300 | [diff] [blame] | 32 | void intel_init_pm(struct drm_i915_private *dev_priv); |
| 33 | void intel_init_clock_gating_hooks(struct drm_i915_private *dev_priv); |
| 34 | void intel_pm_setup(struct drm_i915_private *dev_priv); |
Jani Nikula | 696173b | 2019-04-05 14:00:15 +0300 | [diff] [blame] | 35 | void g4x_wm_get_hw_state(struct drm_i915_private *dev_priv); |
| 36 | void vlv_wm_get_hw_state(struct drm_i915_private *dev_priv); |
| 37 | void ilk_wm_get_hw_state(struct drm_i915_private *dev_priv); |
| 38 | void skl_wm_get_hw_state(struct drm_i915_private *dev_priv); |
Stanislav Lisovskiy | 0f0f9ae | 2020-02-03 01:06:29 +0200 | [diff] [blame] | 39 | u8 intel_enabled_dbuf_slices_mask(struct drm_i915_private *dev_priv); |
Jani Nikula | 696173b | 2019-04-05 14:00:15 +0300 | [diff] [blame] | 40 | void skl_pipe_ddb_get_hw_state(struct intel_crtc *crtc, |
| 41 | struct skl_ddb_entry *ddb_y, |
| 42 | struct skl_ddb_entry *ddb_uv); |
Stanislav Lisovskiy | cd19154 | 2020-05-20 18:00:58 +0300 | [diff] [blame] | 43 | void skl_ddb_get_hw_state(struct drm_i915_private *dev_priv); |
Stanislav Lisovskiy | cd19154 | 2020-05-20 18:00:58 +0300 | [diff] [blame] | 44 | u32 skl_ddb_dbuf_slice_mask(struct drm_i915_private *dev_priv, |
| 45 | const struct skl_ddb_entry *entry); |
Jani Nikula | 696173b | 2019-04-05 14:00:15 +0300 | [diff] [blame] | 46 | void skl_pipe_wm_get_hw_state(struct intel_crtc *crtc, |
| 47 | struct skl_pipe_wm *out); |
| 48 | void g4x_wm_sanitize(struct drm_i915_private *dev_priv); |
| 49 | void vlv_wm_sanitize(struct drm_i915_private *dev_priv); |
Stanislav Lisovskiy | d8d5afe | 2020-05-13 12:38:13 +0300 | [diff] [blame] | 50 | bool intel_can_enable_sagv(struct drm_i915_private *dev_priv, |
| 51 | const struct intel_bw_state *bw_state); |
Stanislav Lisovskiy | 680e1af | 2020-04-15 17:39:04 +0300 | [diff] [blame] | 52 | void intel_sagv_pre_plane_update(struct intel_atomic_state *state); |
| 53 | void intel_sagv_post_plane_update(struct intel_atomic_state *state); |
Ville Syrjälä | 5516e89 | 2021-02-26 17:32:03 +0200 | [diff] [blame] | 54 | const struct skl_wm_level *skl_plane_wm_level(const struct skl_pipe_wm *pipe_wm, |
| 55 | enum plane_id plane_id, |
| 56 | int level); |
| 57 | const struct skl_wm_level *skl_plane_trans_wm(const struct skl_pipe_wm *pipe_wm, |
| 58 | enum plane_id plane_id); |
Jani Nikula | 696173b | 2019-04-05 14:00:15 +0300 | [diff] [blame] | 59 | bool skl_wm_level_equals(const struct skl_wm_level *l1, |
| 60 | const struct skl_wm_level *l2); |
| 61 | bool skl_ddb_allocation_overlaps(const struct skl_ddb_entry *ddb, |
| 62 | const struct skl_ddb_entry *entries, |
| 63 | int num_entries, int ignore_idx); |
| 64 | void skl_write_plane_wm(struct intel_plane *plane, |
| 65 | const struct intel_crtc_state *crtc_state); |
| 66 | void skl_write_cursor_wm(struct intel_plane *plane, |
| 67 | const struct intel_crtc_state *crtc_state); |
Ville Syrjälä | 60aca57 | 2019-11-27 21:05:51 +0200 | [diff] [blame] | 68 | bool ilk_disable_lp_wm(struct drm_i915_private *dev_priv); |
Jani Nikula | 696173b | 2019-04-05 14:00:15 +0300 | [diff] [blame] | 69 | void intel_init_ipc(struct drm_i915_private *dev_priv); |
| 70 | void intel_enable_ipc(struct drm_i915_private *dev_priv); |
| 71 | |
Jani Nikula | d13616d | 2019-06-06 15:22:00 +0300 | [diff] [blame] | 72 | bool intel_set_memory_cxsr(struct drm_i915_private *dev_priv, bool enable); |
Jani Nikula | ecbb5fb | 2019-04-29 15:29:37 +0300 | [diff] [blame] | 73 | |
Ville Syrjälä | 3cf43cd | 2020-02-25 19:11:13 +0200 | [diff] [blame] | 74 | struct intel_dbuf_state { |
| 75 | struct intel_global_state base; |
| 76 | |
Ville Syrjälä | 47a1495 | 2021-01-22 22:56:30 +0200 | [diff] [blame] | 77 | struct skl_ddb_entry ddb[I915_MAX_PIPES]; |
Ville Syrjälä | ef79d62 | 2021-01-22 22:56:32 +0200 | [diff] [blame] | 78 | unsigned int weight[I915_MAX_PIPES]; |
| 79 | u8 slices[I915_MAX_PIPES]; |
Ville Syrjälä | 3cf43cd | 2020-02-25 19:11:13 +0200 | [diff] [blame] | 80 | u8 enabled_slices; |
| 81 | u8 active_pipes; |
Vandita Kulkarni | f4dc008 | 2021-05-18 17:06:17 -0700 | [diff] [blame] | 82 | bool joined_mbus; |
Ville Syrjälä | 3cf43cd | 2020-02-25 19:11:13 +0200 | [diff] [blame] | 83 | }; |
| 84 | |
Ville Syrjälä | 3cf43cd | 2020-02-25 19:11:13 +0200 | [diff] [blame] | 85 | struct intel_dbuf_state * |
| 86 | intel_atomic_get_dbuf_state(struct intel_atomic_state *state); |
| 87 | |
| 88 | #define to_intel_dbuf_state(x) container_of((x), struct intel_dbuf_state, base) |
| 89 | #define intel_atomic_get_old_dbuf_state(state) \ |
| 90 | to_intel_dbuf_state(intel_atomic_get_old_global_obj_state(state, &to_i915(state->base.dev)->dbuf.obj)) |
| 91 | #define intel_atomic_get_new_dbuf_state(state) \ |
| 92 | to_intel_dbuf_state(intel_atomic_get_new_global_obj_state(state, &to_i915(state->base.dev)->dbuf.obj)) |
| 93 | |
| 94 | int intel_dbuf_init(struct drm_i915_private *dev_priv); |
Ville Syrjälä | c7c0e7e | 2020-02-25 19:11:15 +0200 | [diff] [blame] | 95 | void intel_dbuf_pre_plane_update(struct intel_atomic_state *state); |
| 96 | void intel_dbuf_post_plane_update(struct intel_atomic_state *state); |
Ville Syrjälä | 3cf43cd | 2020-02-25 19:11:13 +0200 | [diff] [blame] | 97 | |
Jani Nikula | 696173b | 2019-04-05 14:00:15 +0300 | [diff] [blame] | 98 | #endif /* __INTEL_PM_H__ */ |