#include <linux/time.h>
#include <drm/drm_fixed.h>
#include "soc/intel_dram.h"
#include "hsw_ips.h"
#include "i915_reg.h"
#include "intel_atomic.h"
#include "intel_atomic_plane.h"
#include "intel_audio.h"
#include "intel_bw.h"
#include "intel_cdclk.h"
#include "intel_crtc.h"
#include "intel_de.h"
#include "intel_dp.h"
#include "intel_display_types.h"
#include "intel_mchbar_regs.h"
#include "intel_pci_config.h"
#include "intel_pcode.h"
#include "intel_psr.h"
#include "intel_vdsc.h"
#include "skl_watermark.h"
#include "skl_watermark_regs.h"
#include "vlv_sideband.h"
struct intel_cdclk_funcs { … };
void intel_cdclk_get_cdclk(struct drm_i915_private *dev_priv,
struct intel_cdclk_config *cdclk_config)
{ … }
static void intel_cdclk_set_cdclk(struct drm_i915_private *dev_priv,
const struct intel_cdclk_config *cdclk_config,
enum pipe pipe)
{ … }
static int intel_cdclk_modeset_calc_cdclk(struct intel_atomic_state *state)
{ … }
static u8 intel_cdclk_calc_voltage_level(struct drm_i915_private *dev_priv,
int cdclk)
{ … }
static void fixed_133mhz_get_cdclk(struct drm_i915_private *dev_priv,
struct intel_cdclk_config *cdclk_config)
{ … }
static void fixed_200mhz_get_cdclk(struct drm_i915_private *dev_priv,
struct intel_cdclk_config *cdclk_config)
{ … }
static void fixed_266mhz_get_cdclk(struct drm_i915_private *dev_priv,
struct intel_cdclk_config *cdclk_config)
{ … }
static void fixed_333mhz_get_cdclk(struct drm_i915_private *dev_priv,
struct intel_cdclk_config *cdclk_config)
{ … }
static void fixed_400mhz_get_cdclk(struct drm_i915_private *dev_priv,
struct intel_cdclk_config *cdclk_config)
{ … }
static void fixed_450mhz_get_cdclk(struct drm_i915_private *dev_priv,
struct intel_cdclk_config *cdclk_config)
{ … }
static void i85x_get_cdclk(struct drm_i915_private *dev_priv,
struct intel_cdclk_config *cdclk_config)
{ … }
static void i915gm_get_cdclk(struct drm_i915_private *dev_priv,
struct intel_cdclk_config *cdclk_config)
{ … }
static void i945gm_get_cdclk(struct drm_i915_private *dev_priv,
struct intel_cdclk_config *cdclk_config)
{ … }
static unsigned int intel_hpll_vco(struct drm_i915_private *dev_priv)
{ … }
static void g33_get_cdclk(struct drm_i915_private *dev_priv,
struct intel_cdclk_config *cdclk_config)
{ … }
static void pnv_get_cdclk(struct drm_i915_private *dev_priv,
struct intel_cdclk_config *cdclk_config)
{ … }
static void i965gm_get_cdclk(struct drm_i915_private *dev_priv,
struct intel_cdclk_config *cdclk_config)
{ … }
static void gm45_get_cdclk(struct drm_i915_private *dev_priv,
struct intel_cdclk_config *cdclk_config)
{ … }
static void hsw_get_cdclk(struct drm_i915_private *dev_priv,
struct intel_cdclk_config *cdclk_config)
{ … }
static int vlv_calc_cdclk(struct drm_i915_private *dev_priv, int min_cdclk)
{ … }
static u8 vlv_calc_voltage_level(struct drm_i915_private *dev_priv, int cdclk)
{ … }
static void vlv_get_cdclk(struct drm_i915_private *dev_priv,
struct intel_cdclk_config *cdclk_config)
{ … }
static void vlv_program_pfi_credits(struct drm_i915_private *dev_priv)
{ … }
static void vlv_set_cdclk(struct drm_i915_private *dev_priv,
const struct intel_cdclk_config *cdclk_config,
enum pipe pipe)
{ … }
static void chv_set_cdclk(struct drm_i915_private *dev_priv,
const struct intel_cdclk_config *cdclk_config,
enum pipe pipe)
{ … }
static int bdw_calc_cdclk(int min_cdclk)
{ … }
static u8 bdw_calc_voltage_level(int cdclk)
{ … }
static void bdw_get_cdclk(struct drm_i915_private *dev_priv,
struct intel_cdclk_config *cdclk_config)
{ … }
static u32 bdw_cdclk_freq_sel(int cdclk)
{ … }
static void bdw_set_cdclk(struct drm_i915_private *dev_priv,
const struct intel_cdclk_config *cdclk_config,
enum pipe pipe)
{ … }
static int skl_calc_cdclk(int min_cdclk, int vco)
{ … }
static u8 skl_calc_voltage_level(int cdclk)
{ … }
static void skl_dpll0_update(struct drm_i915_private *dev_priv,
struct intel_cdclk_config *cdclk_config)
{ … }
static void skl_get_cdclk(struct drm_i915_private *dev_priv,
struct intel_cdclk_config *cdclk_config)
{ … }
static int skl_cdclk_decimal(int cdclk)
{ … }
static void skl_set_preferred_cdclk_vco(struct drm_i915_private *i915, int vco)
{ … }
static u32 skl_dpll0_link_rate(struct drm_i915_private *dev_priv, int vco)
{ … }
static void skl_dpll0_enable(struct drm_i915_private *dev_priv, int vco)
{ … }
static void skl_dpll0_disable(struct drm_i915_private *dev_priv)
{ … }
static u32 skl_cdclk_freq_sel(struct drm_i915_private *dev_priv,
int cdclk, int vco)
{ … }
static void skl_set_cdclk(struct drm_i915_private *dev_priv,
const struct intel_cdclk_config *cdclk_config,
enum pipe pipe)
{ … }
static void skl_sanitize_cdclk(struct drm_i915_private *dev_priv)
{ … }
static void skl_cdclk_init_hw(struct drm_i915_private *dev_priv)
{ … }
static void skl_cdclk_uninit_hw(struct drm_i915_private *dev_priv)
{ … }
struct intel_cdclk_vals { … };
static const struct intel_cdclk_vals bxt_cdclk_table[] = …;
static const struct intel_cdclk_vals glk_cdclk_table[] = …;
static const struct intel_cdclk_vals icl_cdclk_table[] = …;
static const struct intel_cdclk_vals rkl_cdclk_table[] = …;
static const struct intel_cdclk_vals adlp_a_step_cdclk_table[] = …;
static const struct intel_cdclk_vals adlp_cdclk_table[] = …;
static const struct intel_cdclk_vals rplu_cdclk_table[] = …;
static const struct intel_cdclk_vals dg2_cdclk_table[] = …;
static const struct intel_cdclk_vals mtl_cdclk_table[] = …;
static const struct intel_cdclk_vals xe2lpd_cdclk_table[] = …;
static const struct intel_cdclk_vals xe2hpd_cdclk_table[] = …;
static const int cdclk_squash_len = …;
static int cdclk_squash_divider(u16 waveform)
{ … }
static int cdclk_divider(int cdclk, int vco, u16 waveform)
{ … }
static int bxt_calc_cdclk(struct drm_i915_private *dev_priv, int min_cdclk)
{ … }
static int bxt_calc_cdclk_pll_vco(struct drm_i915_private *dev_priv, int cdclk)
{ … }
static u8 bxt_calc_voltage_level(int cdclk)
{ … }
static u8 calc_voltage_level(int cdclk, int num_voltage_levels,
const int voltage_level_max_cdclk[])
{ … }
static u8 icl_calc_voltage_level(int cdclk)
{ … }
static u8 ehl_calc_voltage_level(int cdclk)
{ … }
static u8 tgl_calc_voltage_level(int cdclk)
{ … }
static u8 rplu_calc_voltage_level(int cdclk)
{ … }
static void icl_readout_refclk(struct drm_i915_private *dev_priv,
struct intel_cdclk_config *cdclk_config)
{ … }
static void bxt_de_pll_readout(struct drm_i915_private *dev_priv,
struct intel_cdclk_config *cdclk_config)
{ … }
static void bxt_get_cdclk(struct drm_i915_private *dev_priv,
struct intel_cdclk_config *cdclk_config)
{ … }
static void bxt_de_pll_disable(struct drm_i915_private *dev_priv)
{ … }
static void bxt_de_pll_enable(struct drm_i915_private *dev_priv, int vco)
{ … }
static void icl_cdclk_pll_disable(struct drm_i915_private *dev_priv)
{ … }
static void icl_cdclk_pll_enable(struct drm_i915_private *dev_priv, int vco)
{ … }
static void adlp_cdclk_pll_crawl(struct drm_i915_private *dev_priv, int vco)
{ … }
static u32 bxt_cdclk_cd2x_pipe(struct drm_i915_private *dev_priv, enum pipe pipe)
{ … }
static u32 bxt_cdclk_cd2x_div_sel(struct drm_i915_private *dev_priv,
int cdclk, int vco, u16 waveform)
{ … }
static u16 cdclk_squash_waveform(struct drm_i915_private *dev_priv,
int cdclk)
{ … }
static void icl_cdclk_pll_update(struct drm_i915_private *i915, int vco)
{ … }
static void bxt_cdclk_pll_update(struct drm_i915_private *i915, int vco)
{ … }
static void dg2_cdclk_squash_program(struct drm_i915_private *i915,
u16 waveform)
{ … }
static bool cdclk_pll_is_unknown(unsigned int vco)
{ … }
static bool mdclk_source_is_cdclk_pll(struct drm_i915_private *i915)
{ … }
static u32 xe2lpd_mdclk_source_sel(struct drm_i915_private *i915)
{ … }
int intel_mdclk_cdclk_ratio(struct drm_i915_private *i915,
const struct intel_cdclk_config *cdclk_config)
{ … }
static void xe2lpd_mdclk_cdclk_ratio_program(struct drm_i915_private *i915,
const struct intel_cdclk_config *cdclk_config)
{ … }
static bool cdclk_compute_crawl_and_squash_midpoint(struct drm_i915_private *i915,
const struct intel_cdclk_config *old_cdclk_config,
const struct intel_cdclk_config *new_cdclk_config,
struct intel_cdclk_config *mid_cdclk_config)
{ … }
static bool pll_enable_wa_needed(struct drm_i915_private *dev_priv)
{ … }
static u32 bxt_cdclk_ctl(struct drm_i915_private *i915,
const struct intel_cdclk_config *cdclk_config,
enum pipe pipe)
{ … }
static void _bxt_set_cdclk(struct drm_i915_private *dev_priv,
const struct intel_cdclk_config *cdclk_config,
enum pipe pipe)
{ … }
static void bxt_set_cdclk(struct drm_i915_private *dev_priv,
const struct intel_cdclk_config *cdclk_config,
enum pipe pipe)
{ … }
static void bxt_sanitize_cdclk(struct drm_i915_private *dev_priv)
{ … }
static void bxt_cdclk_init_hw(struct drm_i915_private *dev_priv)
{ … }
static void bxt_cdclk_uninit_hw(struct drm_i915_private *dev_priv)
{ … }
void intel_cdclk_init_hw(struct drm_i915_private *i915)
{ … }
void intel_cdclk_uninit_hw(struct drm_i915_private *i915)
{ … }
static bool intel_cdclk_can_crawl_and_squash(struct drm_i915_private *i915,
const struct intel_cdclk_config *a,
const struct intel_cdclk_config *b)
{ … }
static bool intel_cdclk_can_crawl(struct drm_i915_private *dev_priv,
const struct intel_cdclk_config *a,
const struct intel_cdclk_config *b)
{ … }
static bool intel_cdclk_can_squash(struct drm_i915_private *dev_priv,
const struct intel_cdclk_config *a,
const struct intel_cdclk_config *b)
{ … }
bool intel_cdclk_clock_changed(const struct intel_cdclk_config *a,
const struct intel_cdclk_config *b)
{ … }
static bool intel_cdclk_can_cd2x_update(struct drm_i915_private *dev_priv,
const struct intel_cdclk_config *a,
const struct intel_cdclk_config *b)
{ … }
static bool intel_cdclk_changed(const struct intel_cdclk_config *a,
const struct intel_cdclk_config *b)
{ … }
void intel_cdclk_dump_config(struct drm_i915_private *i915,
const struct intel_cdclk_config *cdclk_config,
const char *context)
{ … }
static void intel_pcode_notify(struct drm_i915_private *i915,
u8 voltage_level,
u8 active_pipe_count,
u16 cdclk,
bool cdclk_update_valid,
bool pipe_count_update_valid)
{ … }
static void intel_set_cdclk(struct drm_i915_private *dev_priv,
const struct intel_cdclk_config *cdclk_config,
enum pipe pipe, const char *context)
{ … }
static void intel_cdclk_pcode_pre_notify(struct intel_atomic_state *state)
{ … }
static void intel_cdclk_pcode_post_notify(struct intel_atomic_state *state)
{ … }
bool intel_cdclk_is_decreasing_later(struct intel_atomic_state *state)
{ … }
void
intel_set_cdclk_pre_plane_update(struct intel_atomic_state *state)
{ … }
void
intel_set_cdclk_post_plane_update(struct intel_atomic_state *state)
{ … }
static int intel_pixel_rate_to_cdclk(const struct intel_crtc_state *crtc_state)
{ … }
static int intel_planes_min_cdclk(const struct intel_crtc_state *crtc_state)
{ … }
static int intel_vdsc_min_cdclk(const struct intel_crtc_state *crtc_state)
{ … }
int intel_crtc_compute_min_cdclk(const struct intel_crtc_state *crtc_state)
{ … }
static int intel_compute_min_cdclk(struct intel_atomic_state *state)
{ … }
static int bxt_compute_min_voltage_level(struct intel_atomic_state *state)
{ … }
static int vlv_modeset_calc_cdclk(struct intel_atomic_state *state)
{ … }
static int bdw_modeset_calc_cdclk(struct intel_atomic_state *state)
{ … }
static int skl_dpll0_vco(struct intel_atomic_state *state)
{ … }
static int skl_modeset_calc_cdclk(struct intel_atomic_state *state)
{ … }
static int bxt_modeset_calc_cdclk(struct intel_atomic_state *state)
{ … }
static int fixed_modeset_calc_cdclk(struct intel_atomic_state *state)
{ … }
static struct intel_global_state *intel_cdclk_duplicate_state(struct intel_global_obj *obj)
{ … }
static void intel_cdclk_destroy_state(struct intel_global_obj *obj,
struct intel_global_state *state)
{ … }
static const struct intel_global_state_funcs intel_cdclk_funcs = …;
struct intel_cdclk_state *
intel_atomic_get_cdclk_state(struct intel_atomic_state *state)
{ … }
int intel_cdclk_atomic_check(struct intel_atomic_state *state,
bool *need_cdclk_calc)
{ … }
int intel_cdclk_state_set_joined_mbus(struct intel_atomic_state *state, bool joined_mbus)
{ … }
int intel_cdclk_init(struct drm_i915_private *dev_priv)
{ … }
static bool intel_cdclk_need_serialize(struct drm_i915_private *i915,
const struct intel_cdclk_state *old_cdclk_state,
const struct intel_cdclk_state *new_cdclk_state)
{ … }
int intel_modeset_calc_cdclk(struct intel_atomic_state *state)
{ … }
static int intel_compute_max_dotclk(struct drm_i915_private *dev_priv)
{ … }
void intel_update_max_cdclk(struct drm_i915_private *dev_priv)
{ … }
void intel_update_cdclk(struct drm_i915_private *dev_priv)
{ … }
static int dg1_rawclk(struct drm_i915_private *dev_priv)
{ … }
static int cnp_rawclk(struct drm_i915_private *dev_priv)
{ … }
static int pch_rawclk(struct drm_i915_private *dev_priv)
{ … }
static int vlv_hrawclk(struct drm_i915_private *dev_priv)
{ … }
static int i9xx_hrawclk(struct drm_i915_private *i915)
{ … }
u32 intel_read_rawclk(struct drm_i915_private *dev_priv)
{ … }
static int i915_cdclk_info_show(struct seq_file *m, void *unused)
{ … }
DEFINE_SHOW_ATTRIBUTE(…);
void intel_cdclk_debugfs_register(struct drm_i915_private *i915)
{ … }
static const struct intel_cdclk_funcs rplu_cdclk_funcs = …;
static const struct intel_cdclk_funcs tgl_cdclk_funcs = …;
static const struct intel_cdclk_funcs ehl_cdclk_funcs = …;
static const struct intel_cdclk_funcs icl_cdclk_funcs = …;
static const struct intel_cdclk_funcs bxt_cdclk_funcs = …;
static const struct intel_cdclk_funcs skl_cdclk_funcs = …;
static const struct intel_cdclk_funcs bdw_cdclk_funcs = …;
static const struct intel_cdclk_funcs chv_cdclk_funcs = …;
static const struct intel_cdclk_funcs vlv_cdclk_funcs = …;
static const struct intel_cdclk_funcs hsw_cdclk_funcs = …;
static const struct intel_cdclk_funcs fixed_400mhz_cdclk_funcs = …;
static const struct intel_cdclk_funcs ilk_cdclk_funcs = …;
static const struct intel_cdclk_funcs gm45_cdclk_funcs = …;
static const struct intel_cdclk_funcs i965gm_cdclk_funcs = …;
static const struct intel_cdclk_funcs pnv_cdclk_funcs = …;
static const struct intel_cdclk_funcs g33_cdclk_funcs = …;
static const struct intel_cdclk_funcs i945gm_cdclk_funcs = …;
static const struct intel_cdclk_funcs i915gm_cdclk_funcs = …;
static const struct intel_cdclk_funcs i915g_cdclk_funcs = …;
static const struct intel_cdclk_funcs i865g_cdclk_funcs = …;
static const struct intel_cdclk_funcs i85x_cdclk_funcs = …;
static const struct intel_cdclk_funcs i845g_cdclk_funcs = …;
static const struct intel_cdclk_funcs i830_cdclk_funcs = …;
void intel_init_cdclk_hooks(struct drm_i915_private *dev_priv)
{ … }