18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: MIT */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright © 2019 Intel Corporation
48c2ecf20Sopenharmony_ci */
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci#ifndef __INTEL_PM_H__
78c2ecf20Sopenharmony_ci#define __INTEL_PM_H__
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#include <linux/types.h>
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#include "display/intel_bw.h"
128c2ecf20Sopenharmony_ci#include "display/intel_global_state.h"
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#include "i915_reg.h"
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_cistruct drm_device;
178c2ecf20Sopenharmony_cistruct drm_i915_private;
188c2ecf20Sopenharmony_cistruct i915_request;
198c2ecf20Sopenharmony_cistruct intel_atomic_state;
208c2ecf20Sopenharmony_cistruct intel_crtc;
218c2ecf20Sopenharmony_cistruct intel_crtc_state;
228c2ecf20Sopenharmony_cistruct intel_plane;
238c2ecf20Sopenharmony_cistruct skl_ddb_entry;
248c2ecf20Sopenharmony_cistruct skl_pipe_wm;
258c2ecf20Sopenharmony_cistruct skl_wm_level;
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_civoid intel_init_clock_gating(struct drm_i915_private *dev_priv);
288c2ecf20Sopenharmony_civoid intel_suspend_hw(struct drm_i915_private *dev_priv);
298c2ecf20Sopenharmony_ciint ilk_wm_max_level(const struct drm_i915_private *dev_priv);
308c2ecf20Sopenharmony_civoid intel_update_watermarks(struct intel_crtc *crtc);
318c2ecf20Sopenharmony_civoid intel_init_pm(struct drm_i915_private *dev_priv);
328c2ecf20Sopenharmony_civoid intel_init_clock_gating_hooks(struct drm_i915_private *dev_priv);
338c2ecf20Sopenharmony_civoid intel_pm_setup(struct drm_i915_private *dev_priv);
348c2ecf20Sopenharmony_civoid g4x_wm_get_hw_state(struct drm_i915_private *dev_priv);
358c2ecf20Sopenharmony_civoid vlv_wm_get_hw_state(struct drm_i915_private *dev_priv);
368c2ecf20Sopenharmony_civoid ilk_wm_get_hw_state(struct drm_i915_private *dev_priv);
378c2ecf20Sopenharmony_civoid skl_wm_get_hw_state(struct drm_i915_private *dev_priv);
388c2ecf20Sopenharmony_ciu8 intel_enabled_dbuf_slices_mask(struct drm_i915_private *dev_priv);
398c2ecf20Sopenharmony_civoid skl_pipe_ddb_get_hw_state(struct intel_crtc *crtc,
408c2ecf20Sopenharmony_ci			       struct skl_ddb_entry *ddb_y,
418c2ecf20Sopenharmony_ci			       struct skl_ddb_entry *ddb_uv);
428c2ecf20Sopenharmony_civoid skl_ddb_get_hw_state(struct drm_i915_private *dev_priv);
438c2ecf20Sopenharmony_ciu16 intel_get_ddb_size(struct drm_i915_private *dev_priv);
448c2ecf20Sopenharmony_ciu32 skl_ddb_dbuf_slice_mask(struct drm_i915_private *dev_priv,
458c2ecf20Sopenharmony_ci			    const struct skl_ddb_entry *entry);
468c2ecf20Sopenharmony_civoid skl_pipe_wm_get_hw_state(struct intel_crtc *crtc,
478c2ecf20Sopenharmony_ci			      struct skl_pipe_wm *out);
488c2ecf20Sopenharmony_civoid g4x_wm_sanitize(struct drm_i915_private *dev_priv);
498c2ecf20Sopenharmony_civoid vlv_wm_sanitize(struct drm_i915_private *dev_priv);
508c2ecf20Sopenharmony_cibool intel_can_enable_sagv(struct drm_i915_private *dev_priv,
518c2ecf20Sopenharmony_ci			   const struct intel_bw_state *bw_state);
528c2ecf20Sopenharmony_ciint intel_enable_sagv(struct drm_i915_private *dev_priv);
538c2ecf20Sopenharmony_ciint intel_disable_sagv(struct drm_i915_private *dev_priv);
548c2ecf20Sopenharmony_civoid intel_sagv_pre_plane_update(struct intel_atomic_state *state);
558c2ecf20Sopenharmony_civoid intel_sagv_post_plane_update(struct intel_atomic_state *state);
568c2ecf20Sopenharmony_cibool skl_wm_level_equals(const struct skl_wm_level *l1,
578c2ecf20Sopenharmony_ci			 const struct skl_wm_level *l2);
588c2ecf20Sopenharmony_cibool skl_ddb_allocation_overlaps(const struct skl_ddb_entry *ddb,
598c2ecf20Sopenharmony_ci				 const struct skl_ddb_entry *entries,
608c2ecf20Sopenharmony_ci				 int num_entries, int ignore_idx);
618c2ecf20Sopenharmony_civoid skl_write_plane_wm(struct intel_plane *plane,
628c2ecf20Sopenharmony_ci			const struct intel_crtc_state *crtc_state);
638c2ecf20Sopenharmony_civoid skl_write_cursor_wm(struct intel_plane *plane,
648c2ecf20Sopenharmony_ci			 const struct intel_crtc_state *crtc_state);
658c2ecf20Sopenharmony_cibool ilk_disable_lp_wm(struct drm_i915_private *dev_priv);
668c2ecf20Sopenharmony_civoid intel_init_ipc(struct drm_i915_private *dev_priv);
678c2ecf20Sopenharmony_civoid intel_enable_ipc(struct drm_i915_private *dev_priv);
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_cibool intel_set_memory_cxsr(struct drm_i915_private *dev_priv, bool enable);
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_cistruct intel_dbuf_state {
728c2ecf20Sopenharmony_ci	struct intel_global_state base;
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ci	u8 enabled_slices;
758c2ecf20Sopenharmony_ci	u8 active_pipes;
768c2ecf20Sopenharmony_ci};
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ciint intel_dbuf_init(struct drm_i915_private *dev_priv);
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_cistruct intel_dbuf_state *
818c2ecf20Sopenharmony_ciintel_atomic_get_dbuf_state(struct intel_atomic_state *state);
828c2ecf20Sopenharmony_ci
838c2ecf20Sopenharmony_ci#define to_intel_dbuf_state(x) container_of((x), struct intel_dbuf_state, base)
848c2ecf20Sopenharmony_ci#define intel_atomic_get_old_dbuf_state(state) \
858c2ecf20Sopenharmony_ci	to_intel_dbuf_state(intel_atomic_get_old_global_obj_state(state, &to_i915(state->base.dev)->dbuf.obj))
868c2ecf20Sopenharmony_ci#define intel_atomic_get_new_dbuf_state(state) \
878c2ecf20Sopenharmony_ci	to_intel_dbuf_state(intel_atomic_get_new_global_obj_state(state, &to_i915(state->base.dev)->dbuf.obj))
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ciint intel_dbuf_init(struct drm_i915_private *dev_priv);
908c2ecf20Sopenharmony_civoid intel_dbuf_pre_plane_update(struct intel_atomic_state *state);
918c2ecf20Sopenharmony_civoid intel_dbuf_post_plane_update(struct intel_atomic_state *state);
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci#endif /* __INTEL_PM_H__ */
94