2019-04-05 14:00:25 +03:00
|
|
|
/* SPDX-License-Identifier: MIT */
|
|
|
|
/*
|
|
|
|
* Copyright © 2019 Intel Corporation
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __INTEL_CDCLK_H__
|
|
|
|
#define __INTEL_CDCLK_H__
|
|
|
|
|
|
|
|
#include <linux/types.h>
|
|
|
|
|
2025-06-25 13:32:34 +03:00
|
|
|
enum pipe;
|
2019-04-05 14:00:25 +03:00
|
|
|
struct intel_atomic_state;
|
2025-06-25 13:32:34 +03:00
|
|
|
struct intel_cdclk_state;
|
2025-03-06 18:34:06 +02:00
|
|
|
struct intel_crtc;
|
2019-04-05 14:00:25 +03:00
|
|
|
struct intel_crtc_state;
|
2024-09-06 17:33:02 +03:00
|
|
|
struct intel_display;
|
2019-04-05 14:00:25 +03:00
|
|
|
|
2021-12-13 13:41:05 +02:00
|
|
|
struct intel_cdclk_config {
|
|
|
|
unsigned int cdclk, vco, ref, bypass;
|
|
|
|
u8 voltage_level;
|
2024-03-12 13:36:37 -03:00
|
|
|
/* This field is only valid for Xe2LPD and above. */
|
|
|
|
bool joined_mbus;
|
2021-12-13 13:41:05 +02:00
|
|
|
};
|
|
|
|
|
2024-09-06 17:33:02 +03:00
|
|
|
void intel_cdclk_init_hw(struct intel_display *display);
|
|
|
|
void intel_cdclk_uninit_hw(struct intel_display *display);
|
|
|
|
void intel_init_cdclk_hooks(struct intel_display *display);
|
|
|
|
void intel_update_max_cdclk(struct intel_display *display);
|
|
|
|
void intel_update_cdclk(struct intel_display *display);
|
|
|
|
u32 intel_read_rawclk(struct intel_display *display);
|
2024-02-14 17:27:20 -03:00
|
|
|
bool intel_cdclk_clock_changed(const struct intel_cdclk_config *a,
|
2020-01-20 19:47:17 +02:00
|
|
|
const struct intel_cdclk_config *b);
|
2024-09-06 17:33:02 +03:00
|
|
|
int intel_mdclk_cdclk_ratio(struct intel_display *display,
|
2024-04-02 18:50:15 +03:00
|
|
|
const struct intel_cdclk_config *cdclk_config);
|
2024-04-02 18:50:13 +03:00
|
|
|
bool intel_cdclk_is_decreasing_later(struct intel_atomic_state *state);
|
2020-01-20 19:47:18 +02:00
|
|
|
void intel_set_cdclk_pre_plane_update(struct intel_atomic_state *state);
|
|
|
|
void intel_set_cdclk_post_plane_update(struct intel_atomic_state *state);
|
2024-09-06 17:33:02 +03:00
|
|
|
void intel_cdclk_dump_config(struct intel_display *display,
|
2022-01-21 15:00:37 +02:00
|
|
|
const struct intel_cdclk_config *cdclk_config,
|
2020-01-20 19:47:17 +02:00
|
|
|
const char *context);
|
2019-09-13 22:31:56 +03:00
|
|
|
int intel_modeset_calc_cdclk(struct intel_atomic_state *state);
|
2024-09-06 17:33:02 +03:00
|
|
|
void intel_cdclk_get_cdclk(struct intel_display *display,
|
2021-09-29 01:57:49 +03:00
|
|
|
struct intel_cdclk_config *cdclk_config);
|
2021-12-09 18:51:22 +02:00
|
|
|
int intel_cdclk_atomic_check(struct intel_atomic_state *state,
|
|
|
|
bool *need_cdclk_calc);
|
2024-03-12 13:36:37 -03:00
|
|
|
int intel_cdclk_state_set_joined_mbus(struct intel_atomic_state *state, bool joined_mbus);
|
2020-01-21 16:03:53 +02:00
|
|
|
struct intel_cdclk_state *
|
|
|
|
intel_atomic_get_cdclk_state(struct intel_atomic_state *state);
|
2025-03-06 18:34:11 +02:00
|
|
|
void intel_cdclk_update_hw_state(struct intel_display *display);
|
2025-03-06 18:34:06 +02:00
|
|
|
void intel_cdclk_crtc_disable_noatomic(struct intel_crtc *crtc);
|
2020-01-21 16:03:53 +02:00
|
|
|
|
2024-03-07 17:18:09 +02:00
|
|
|
#define to_intel_cdclk_state(global_state) \
|
|
|
|
container_of_const((global_state), struct intel_cdclk_state, base)
|
|
|
|
|
2020-01-21 16:03:53 +02:00
|
|
|
#define intel_atomic_get_old_cdclk_state(state) \
|
2024-09-04 15:53:01 +03:00
|
|
|
to_intel_cdclk_state(intel_atomic_get_old_global_obj_state(state, &to_intel_display(state)->cdclk.obj))
|
2020-01-21 16:03:53 +02:00
|
|
|
#define intel_atomic_get_new_cdclk_state(state) \
|
2024-09-04 15:53:01 +03:00
|
|
|
to_intel_cdclk_state(intel_atomic_get_new_global_obj_state(state, &to_intel_display(state)->cdclk.obj))
|
2020-01-21 16:03:53 +02:00
|
|
|
|
2024-09-06 17:33:02 +03:00
|
|
|
int intel_cdclk_init(struct intel_display *display);
|
|
|
|
void intel_cdclk_debugfs_register(struct intel_display *display);
|
2020-01-21 16:03:53 +02:00
|
|
|
|
2025-06-25 13:32:27 +03:00
|
|
|
int intel_cdclk_logical(const struct intel_cdclk_state *cdclk_state);
|
2025-06-25 13:32:33 +03:00
|
|
|
int intel_cdclk_actual(const struct intel_cdclk_state *cdclk_state);
|
|
|
|
int intel_cdclk_actual_voltage_level(const struct intel_cdclk_state *cdclk_state);
|
2025-06-25 13:32:28 +03:00
|
|
|
int intel_cdclk_min_cdclk(const struct intel_cdclk_state *cdclk_state, enum pipe pipe);
|
2025-06-25 13:32:29 +03:00
|
|
|
int intel_cdclk_bw_min_cdclk(const struct intel_cdclk_state *cdclk_state);
|
2025-06-25 13:32:30 +03:00
|
|
|
bool intel_cdclk_pmdemand_needs_update(struct intel_atomic_state *state);
|
2025-06-25 13:32:31 +03:00
|
|
|
void intel_cdclk_force_min_cdclk(struct intel_cdclk_state *cdclk_state, int force_min_cdclk);
|
2025-06-25 13:32:32 +03:00
|
|
|
void intel_cdclk_read_hw(struct intel_display *display);
|
2025-06-25 13:32:27 +03:00
|
|
|
|
2019-04-05 14:00:25 +03:00
|
|
|
#endif /* __INTEL_CDCLK_H__ */
|