blob: d665bf77ae80b5365041818c69a7ce963daf7e4f [file] [log] [blame]
Jani Nikula696173b2019-04-05 14:00:15 +03001/* 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ä3cf43cd2020-02-25 19:11:13 +020011#include "display/intel_global_state.h"
12
Jani Nikulaecbb5fb2019-04-29 15:29:37 +030013#include "i915_reg.h"
Stanislav Lisovskiy97288892020-04-30 22:17:57 +030014#include "display/intel_bw.h"
Jani Nikulaecbb5fb2019-04-29 15:29:37 +030015
Jani Nikula696173b2019-04-05 14:00:15 +030016struct drm_device;
17struct drm_i915_private;
18struct i915_request;
Maarten Lankhorst855e0d62019-06-28 10:55:13 +020019struct intel_atomic_state;
Jani Nikula696173b2019-04-05 14:00:15 +030020struct intel_crtc;
21struct intel_crtc_state;
22struct intel_plane;
Jani Nikula696173b2019-04-05 14:00:15 +030023struct skl_ddb_entry;
24struct skl_pipe_wm;
25struct skl_wm_level;
26
27void intel_init_clock_gating(struct drm_i915_private *dev_priv);
28void intel_suspend_hw(struct drm_i915_private *dev_priv);
29int ilk_wm_max_level(const struct drm_i915_private *dev_priv);
30void intel_update_watermarks(struct intel_crtc *crtc);
31void intel_init_pm(struct drm_i915_private *dev_priv);
32void intel_init_clock_gating_hooks(struct drm_i915_private *dev_priv);
33void intel_pm_setup(struct drm_i915_private *dev_priv);
Jani Nikula696173b2019-04-05 14:00:15 +030034void g4x_wm_get_hw_state(struct drm_i915_private *dev_priv);
35void vlv_wm_get_hw_state(struct drm_i915_private *dev_priv);
36void ilk_wm_get_hw_state(struct drm_i915_private *dev_priv);
37void skl_wm_get_hw_state(struct drm_i915_private *dev_priv);
Stanislav Lisovskiy0f0f9ae2020-02-03 01:06:29 +020038u8 intel_enabled_dbuf_slices_mask(struct drm_i915_private *dev_priv);
Jani Nikula696173b2019-04-05 14:00:15 +030039void skl_pipe_ddb_get_hw_state(struct intel_crtc *crtc,
40 struct skl_ddb_entry *ddb_y,
41 struct skl_ddb_entry *ddb_uv);
Stanislav Lisovskiycd191542020-05-20 18:00:58 +030042void skl_ddb_get_hw_state(struct drm_i915_private *dev_priv);
43u16 intel_get_ddb_size(struct drm_i915_private *dev_priv);
44u32 skl_ddb_dbuf_slice_mask(struct drm_i915_private *dev_priv,
45 const struct skl_ddb_entry *entry);
Jani Nikula696173b2019-04-05 14:00:15 +030046void skl_pipe_wm_get_hw_state(struct intel_crtc *crtc,
47 struct skl_pipe_wm *out);
48void g4x_wm_sanitize(struct drm_i915_private *dev_priv);
49void vlv_wm_sanitize(struct drm_i915_private *dev_priv);
Stanislav Lisovskiyd8d5afe2020-05-13 12:38:13 +030050bool intel_can_enable_sagv(struct drm_i915_private *dev_priv,
51 const struct intel_bw_state *bw_state);
Jani Nikula696173b2019-04-05 14:00:15 +030052int intel_enable_sagv(struct drm_i915_private *dev_priv);
53int intel_disable_sagv(struct drm_i915_private *dev_priv);
Stanislav Lisovskiy680e1af2020-04-15 17:39:04 +030054void intel_sagv_pre_plane_update(struct intel_atomic_state *state);
55void intel_sagv_post_plane_update(struct intel_atomic_state *state);
Jani Nikula696173b2019-04-05 14:00:15 +030056bool skl_wm_level_equals(const struct skl_wm_level *l1,
57 const struct skl_wm_level *l2);
58bool skl_ddb_allocation_overlaps(const struct skl_ddb_entry *ddb,
59 const struct skl_ddb_entry *entries,
60 int num_entries, int ignore_idx);
61void skl_write_plane_wm(struct intel_plane *plane,
62 const struct intel_crtc_state *crtc_state);
63void skl_write_cursor_wm(struct intel_plane *plane,
64 const struct intel_crtc_state *crtc_state);
Ville Syrjälä60aca572019-11-27 21:05:51 +020065bool ilk_disable_lp_wm(struct drm_i915_private *dev_priv);
Jani Nikula696173b2019-04-05 14:00:15 +030066void intel_init_ipc(struct drm_i915_private *dev_priv);
67void intel_enable_ipc(struct drm_i915_private *dev_priv);
68
Jani Nikulad13616d2019-06-06 15:22:00 +030069bool intel_set_memory_cxsr(struct drm_i915_private *dev_priv, bool enable);
Jani Nikulaecbb5fb2019-04-29 15:29:37 +030070
Ville Syrjälä3cf43cd2020-02-25 19:11:13 +020071struct intel_dbuf_state {
72 struct intel_global_state base;
73
74 u8 enabled_slices;
75 u8 active_pipes;
76};
77
78int intel_dbuf_init(struct drm_i915_private *dev_priv);
79
80struct intel_dbuf_state *
81intel_atomic_get_dbuf_state(struct intel_atomic_state *state);
82
83#define to_intel_dbuf_state(x) container_of((x), struct intel_dbuf_state, base)
84#define intel_atomic_get_old_dbuf_state(state) \
85 to_intel_dbuf_state(intel_atomic_get_old_global_obj_state(state, &to_i915(state->base.dev)->dbuf.obj))
86#define intel_atomic_get_new_dbuf_state(state) \
87 to_intel_dbuf_state(intel_atomic_get_new_global_obj_state(state, &to_i915(state->base.dev)->dbuf.obj))
88
89int intel_dbuf_init(struct drm_i915_private *dev_priv);
Ville Syrjäläc7c0e7e2020-02-25 19:11:15 +020090void intel_dbuf_pre_plane_update(struct intel_atomic_state *state);
91void intel_dbuf_post_plane_update(struct intel_atomic_state *state);
Ville Syrjälä3cf43cd2020-02-25 19:11:13 +020092
Jani Nikula696173b2019-04-05 14:00:15 +030093#endif /* __INTEL_PM_H__ */