Commit d51309b4 authored by Jani Nikula's avatar Jani Nikula

drm/i915: move and group cdclk under display.cdclk

Move display cdclk related members under drm_i915_private display
sub-struct.
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Reviewed-by: default avatarLucas De Marchi <lucas.demarchi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/7df23655be5dc70fb1a2b43ce41e1682e40395d8.1661779055.git.jani.nikula@intel.com
parent 7249dfcb
...@@ -202,7 +202,7 @@ bool hsw_crtc_state_ips_capable(const struct intel_crtc_state *crtc_state) ...@@ -202,7 +202,7 @@ bool hsw_crtc_state_ips_capable(const struct intel_crtc_state *crtc_state)
* Should measure whether using a lower cdclk w/o IPS * Should measure whether using a lower cdclk w/o IPS
*/ */
if (IS_BROADWELL(i915) && if (IS_BROADWELL(i915) &&
crtc_state->pixel_rate > i915->max_cdclk_freq * 95 / 100) crtc_state->pixel_rate > i915->display.cdclk.max_cdclk_freq * 95 / 100)
return false; return false;
return true; return true;
......
...@@ -532,7 +532,7 @@ static unsigned int calc_hblank_early_prog(struct intel_encoder *encoder, ...@@ -532,7 +532,7 @@ static unsigned int calc_hblank_early_prog(struct intel_encoder *encoder,
h_total = crtc_state->hw.adjusted_mode.crtc_htotal; h_total = crtc_state->hw.adjusted_mode.crtc_htotal;
pixel_clk = crtc_state->hw.adjusted_mode.crtc_clock; pixel_clk = crtc_state->hw.adjusted_mode.crtc_clock;
vdsc_bpp = crtc_state->dsc.compressed_bpp; vdsc_bpp = crtc_state->dsc.compressed_bpp;
cdclk = i915->cdclk.hw.cdclk; cdclk = i915->display.cdclk.hw.cdclk;
/* fec= 0.972261, using rounding multiplier of 1000000 */ /* fec= 0.972261, using rounding multiplier of 1000000 */
fec_coeff = 972261; fec_coeff = 972261;
link_clk = crtc_state->port_clock; link_clk = crtc_state->port_clock;
...@@ -971,7 +971,7 @@ void intel_audio_cdclk_change_post(struct drm_i915_private *i915) ...@@ -971,7 +971,7 @@ void intel_audio_cdclk_change_post(struct drm_i915_private *i915)
struct aud_ts_cdclk_m_n aud_ts; struct aud_ts_cdclk_m_n aud_ts;
if (DISPLAY_VER(i915) >= 13) { if (DISPLAY_VER(i915) >= 13) {
get_aud_ts_cdclk_m_n(i915->cdclk.hw.ref, i915->cdclk.hw.cdclk, &aud_ts); get_aud_ts_cdclk_m_n(i915->display.cdclk.hw.ref, i915->display.cdclk.hw.cdclk, &aud_ts);
intel_de_write(i915, AUD_TS_CDCLK_N, aud_ts.n); intel_de_write(i915, AUD_TS_CDCLK_N, aud_ts.n);
intel_de_write(i915, AUD_TS_CDCLK_M, aud_ts.m | AUD_TS_CDCLK_M_EN); intel_de_write(i915, AUD_TS_CDCLK_M, aud_ts.m | AUD_TS_CDCLK_M_EN);
...@@ -1119,7 +1119,7 @@ static int i915_audio_component_get_cdclk_freq(struct device *kdev) ...@@ -1119,7 +1119,7 @@ static int i915_audio_component_get_cdclk_freq(struct device *kdev)
if (drm_WARN_ON_ONCE(&dev_priv->drm, !HAS_DDI(dev_priv))) if (drm_WARN_ON_ONCE(&dev_priv->drm, !HAS_DDI(dev_priv)))
return -ENODEV; return -ENODEV;
return dev_priv->cdclk.hw.cdclk; return dev_priv->display.cdclk.hw.cdclk;
} }
/* /*
......
...@@ -1113,7 +1113,7 @@ static u32 i9xx_hz_to_pwm(struct intel_connector *connector, u32 pwm_freq_hz) ...@@ -1113,7 +1113,7 @@ static u32 i9xx_hz_to_pwm(struct intel_connector *connector, u32 pwm_freq_hz)
if (IS_PINEVIEW(dev_priv)) if (IS_PINEVIEW(dev_priv))
clock = KHz(RUNTIME_INFO(dev_priv)->rawclk_freq); clock = KHz(RUNTIME_INFO(dev_priv)->rawclk_freq);
else else
clock = KHz(dev_priv->cdclk.hw.cdclk); clock = KHz(dev_priv->display.cdclk.hw.cdclk);
return DIV_ROUND_CLOSEST(clock, pwm_freq_hz * 32); return DIV_ROUND_CLOSEST(clock, pwm_freq_hz * 32);
} }
...@@ -1131,7 +1131,7 @@ static u32 i965_hz_to_pwm(struct intel_connector *connector, u32 pwm_freq_hz) ...@@ -1131,7 +1131,7 @@ static u32 i965_hz_to_pwm(struct intel_connector *connector, u32 pwm_freq_hz)
if (IS_G4X(dev_priv)) if (IS_G4X(dev_priv))
clock = KHz(RUNTIME_INFO(dev_priv)->rawclk_freq); clock = KHz(RUNTIME_INFO(dev_priv)->rawclk_freq);
else else
clock = KHz(dev_priv->cdclk.hw.cdclk); clock = KHz(dev_priv->display.cdclk.hw.cdclk);
return DIV_ROUND_CLOSEST(clock, pwm_freq_hz * 128); return DIV_ROUND_CLOSEST(clock, pwm_freq_hz * 128);
} }
......
This diff is collapsed.
...@@ -77,9 +77,9 @@ intel_atomic_get_cdclk_state(struct intel_atomic_state *state); ...@@ -77,9 +77,9 @@ intel_atomic_get_cdclk_state(struct intel_atomic_state *state);
#define to_intel_cdclk_state(x) container_of((x), struct intel_cdclk_state, base) #define to_intel_cdclk_state(x) container_of((x), struct intel_cdclk_state, base)
#define intel_atomic_get_old_cdclk_state(state) \ #define intel_atomic_get_old_cdclk_state(state) \
to_intel_cdclk_state(intel_atomic_get_old_global_obj_state(state, &to_i915(state->base.dev)->cdclk.obj)) to_intel_cdclk_state(intel_atomic_get_old_global_obj_state(state, &to_i915(state->base.dev)->display.cdclk.obj))
#define intel_atomic_get_new_cdclk_state(state) \ #define intel_atomic_get_new_cdclk_state(state) \
to_intel_cdclk_state(intel_atomic_get_new_global_obj_state(state, &to_i915(state->base.dev)->cdclk.obj)) to_intel_cdclk_state(intel_atomic_get_new_global_obj_state(state, &to_i915(state->base.dev)->display.cdclk.obj))
int intel_cdclk_init(struct drm_i915_private *dev_priv); int intel_cdclk_init(struct drm_i915_private *dev_priv);
......
...@@ -2659,7 +2659,7 @@ static int intel_crtc_compute_pipe_mode(struct intel_crtc_state *crtc_state) ...@@ -2659,7 +2659,7 @@ static int intel_crtc_compute_pipe_mode(struct intel_crtc_state *crtc_state)
intel_mode_from_crtc_timings(pipe_mode, pipe_mode); intel_mode_from_crtc_timings(pipe_mode, pipe_mode);
if (DISPLAY_VER(i915) < 4) { if (DISPLAY_VER(i915) < 4) {
clock_limit = i915->max_cdclk_freq * 9 / 10; clock_limit = i915->display.cdclk.max_cdclk_freq * 9 / 10;
/* /*
* Enable double wide mode when the dot clock * Enable double wide mode when the dot clock
...@@ -8394,11 +8394,11 @@ void intel_modeset_init_hw(struct drm_i915_private *i915) ...@@ -8394,11 +8394,11 @@ void intel_modeset_init_hw(struct drm_i915_private *i915)
if (!HAS_DISPLAY(i915)) if (!HAS_DISPLAY(i915))
return; return;
cdclk_state = to_intel_cdclk_state(i915->cdclk.obj.state); cdclk_state = to_intel_cdclk_state(i915->display.cdclk.obj.state);
intel_update_cdclk(i915); intel_update_cdclk(i915);
intel_cdclk_dump_config(i915, &i915->cdclk.hw, "Current CDCLK"); intel_cdclk_dump_config(i915, &i915->display.cdclk.hw, "Current CDCLK");
cdclk_state->logical = cdclk_state->actual = i915->cdclk.hw; cdclk_state->logical = cdclk_state->actual = i915->display.cdclk.hw;
} }
static int sanitize_watermarks_add_affected(struct drm_atomic_state *state) static int sanitize_watermarks_add_affected(struct drm_atomic_state *state)
...@@ -8760,7 +8760,7 @@ int intel_modeset_init_nogem(struct drm_i915_private *i915) ...@@ -8760,7 +8760,7 @@ int intel_modeset_init_nogem(struct drm_i915_private *i915)
intel_hdcp_component_init(i915); intel_hdcp_component_init(i915);
if (i915->max_cdclk_freq == 0) if (i915->display.cdclk.max_cdclk_freq == 0)
intel_update_max_cdclk(i915); intel_update_max_cdclk(i915);
/* /*
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include <linux/wait.h> #include <linux/wait.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include "intel_cdclk.h"
#include "intel_display.h" #include "intel_display.h"
#include "intel_dmc.h" #include "intel_dmc.h"
#include "intel_dpll_mgr.h" #include "intel_dpll_mgr.h"
...@@ -25,6 +26,7 @@ struct i915_hdcp_comp_master; ...@@ -25,6 +26,7 @@ struct i915_hdcp_comp_master;
struct intel_atomic_state; struct intel_atomic_state;
struct intel_audio_funcs; struct intel_audio_funcs;
struct intel_cdclk_funcs; struct intel_cdclk_funcs;
struct intel_cdclk_vals;
struct intel_color_funcs; struct intel_color_funcs;
struct intel_crtc; struct intel_crtc;
struct intel_crtc_state; struct intel_crtc_state;
...@@ -230,6 +232,18 @@ struct intel_display { ...@@ -230,6 +232,18 @@ struct intel_display {
} max[6]; } max[6];
} bw; } bw;
struct {
/* The current hardware cdclk configuration */
struct intel_cdclk_config hw;
/* cdclk, divider, and ratio table from bspec */
const struct intel_cdclk_vals *table;
struct intel_global_obj obj;
unsigned int max_cdclk_freq;
} cdclk;
struct { struct {
/* list of fbdev register on this device */ /* list of fbdev register on this device */
struct intel_fbdev *fbdev; struct intel_fbdev *fbdev;
......
...@@ -1310,7 +1310,7 @@ static void hsw_restore_lcpll(struct drm_i915_private *dev_priv) ...@@ -1310,7 +1310,7 @@ static void hsw_restore_lcpll(struct drm_i915_private *dev_priv)
intel_uncore_forcewake_put(&dev_priv->uncore, FORCEWAKE_ALL); intel_uncore_forcewake_put(&dev_priv->uncore, FORCEWAKE_ALL);
intel_update_cdclk(dev_priv); intel_update_cdclk(dev_priv);
intel_cdclk_dump_config(dev_priv, &dev_priv->cdclk.hw, "Current CDCLK"); intel_cdclk_dump_config(dev_priv, &dev_priv->display.cdclk.hw, "Current CDCLK");
} }
/* /*
......
...@@ -972,7 +972,7 @@ void gen9_disable_dc_states(struct drm_i915_private *dev_priv) ...@@ -972,7 +972,7 @@ void gen9_disable_dc_states(struct drm_i915_private *dev_priv)
intel_cdclk_get_cdclk(dev_priv, &cdclk_config); intel_cdclk_get_cdclk(dev_priv, &cdclk_config);
/* Can't read out voltage_level so can't use intel_cdclk_changed() */ /* Can't read out voltage_level so can't use intel_cdclk_changed() */
drm_WARN_ON(&dev_priv->drm, drm_WARN_ON(&dev_priv->drm,
intel_cdclk_needs_modeset(&dev_priv->cdclk.hw, intel_cdclk_needs_modeset(&dev_priv->display.cdclk.hw,
&cdclk_config)); &cdclk_config));
gen9_assert_dbuf_enabled(dev_priv); gen9_assert_dbuf_enabled(dev_priv);
......
...@@ -720,7 +720,7 @@ static u16 intel_dp_dsc_get_output_bpp(struct drm_i915_private *i915, ...@@ -720,7 +720,7 @@ static u16 intel_dp_dsc_get_output_bpp(struct drm_i915_private *i915,
if (bigjoiner) { if (bigjoiner) {
u32 max_bpp_bigjoiner = u32 max_bpp_bigjoiner =
i915->max_cdclk_freq * 48 / i915->display.cdclk.max_cdclk_freq * 48 /
intel_dp_mode_to_fec_clock(mode_clock); intel_dp_mode_to_fec_clock(mode_clock);
bits_per_pixel = min(bits_per_pixel, max_bpp_bigjoiner); bits_per_pixel = min(bits_per_pixel, max_bpp_bigjoiner);
...@@ -1546,7 +1546,7 @@ static int intel_dp_dsc_compute_config(struct intel_dp *intel_dp, ...@@ -1546,7 +1546,7 @@ static int intel_dp_dsc_compute_config(struct intel_dp *intel_dp,
* is greater than the maximum Cdclock and if slice count is even * is greater than the maximum Cdclock and if slice count is even
* then we need to use 2 VDSC instances. * then we need to use 2 VDSC instances.
*/ */
if (adjusted_mode->crtc_clock > dev_priv->max_cdclk_freq || if (adjusted_mode->crtc_clock > dev_priv->display.cdclk.max_cdclk_freq ||
pipe_config->bigjoiner_pipes) { pipe_config->bigjoiner_pipes) {
if (pipe_config->dsc.slice_count < 2) { if (pipe_config->dsc.slice_count < 2) {
drm_dbg_kms(&dev_priv->drm, drm_dbg_kms(&dev_priv->drm,
......
...@@ -86,7 +86,7 @@ static u32 ilk_get_aux_clock_divider(struct intel_dp *intel_dp, int index) ...@@ -86,7 +86,7 @@ static u32 ilk_get_aux_clock_divider(struct intel_dp *intel_dp, int index)
* divide by 2000 and use that * divide by 2000 and use that
*/ */
if (dig_port->aux_ch == AUX_CH_A) if (dig_port->aux_ch == AUX_CH_A)
freq = dev_priv->cdclk.hw.cdclk; freq = dev_priv->display.cdclk.hw.cdclk;
else else
freq = RUNTIME_INFO(dev_priv)->rawclk_freq; freq = RUNTIME_INFO(dev_priv)->rawclk_freq;
return DIV_ROUND_CLOSEST(freq, 2000); return DIV_ROUND_CLOSEST(freq, 2000);
......
...@@ -1858,7 +1858,7 @@ static int skl_ddi_pll_get_freq(struct drm_i915_private *i915, ...@@ -1858,7 +1858,7 @@ static int skl_ddi_pll_get_freq(struct drm_i915_private *i915,
static void skl_update_dpll_ref_clks(struct drm_i915_private *i915) static void skl_update_dpll_ref_clks(struct drm_i915_private *i915)
{ {
/* No SSC ref */ /* No SSC ref */
i915->display.dpll.ref_clks.nssc = i915->cdclk.hw.ref; i915->display.dpll.ref_clks.nssc = i915->display.cdclk.hw.ref;
} }
static void skl_dump_hw_state(struct drm_i915_private *dev_priv, static void skl_dump_hw_state(struct drm_i915_private *dev_priv,
...@@ -3967,7 +3967,7 @@ static void mg_pll_disable(struct drm_i915_private *dev_priv, ...@@ -3967,7 +3967,7 @@ static void mg_pll_disable(struct drm_i915_private *dev_priv,
static void icl_update_dpll_ref_clks(struct drm_i915_private *i915) static void icl_update_dpll_ref_clks(struct drm_i915_private *i915)
{ {
/* No SSC ref */ /* No SSC ref */
i915->display.dpll.ref_clks.nssc = i915->cdclk.hw.ref; i915->display.dpll.ref_clks.nssc = i915->display.cdclk.hw.ref;
} }
static void icl_dump_hw_state(struct drm_i915_private *dev_priv, static void icl_dump_hw_state(struct drm_i915_private *dev_priv,
......
...@@ -32,7 +32,7 @@ static void intel_crtc_disable_noatomic(struct intel_crtc *crtc, ...@@ -32,7 +32,7 @@ static void intel_crtc_disable_noatomic(struct intel_crtc *crtc,
struct intel_bw_state *bw_state = struct intel_bw_state *bw_state =
to_intel_bw_state(i915->display.bw.obj.state); to_intel_bw_state(i915->display.bw.obj.state);
struct intel_cdclk_state *cdclk_state = struct intel_cdclk_state *cdclk_state =
to_intel_cdclk_state(i915->cdclk.obj.state); to_intel_cdclk_state(i915->display.cdclk.obj.state);
struct intel_dbuf_state *dbuf_state = struct intel_dbuf_state *dbuf_state =
to_intel_dbuf_state(i915->dbuf.obj.state); to_intel_dbuf_state(i915->dbuf.obj.state);
struct intel_crtc_state *crtc_state = struct intel_crtc_state *crtc_state =
...@@ -415,7 +415,7 @@ static void readout_plane_state(struct drm_i915_private *i915) ...@@ -415,7 +415,7 @@ static void readout_plane_state(struct drm_i915_private *i915)
static void intel_modeset_readout_hw_state(struct drm_i915_private *i915) static void intel_modeset_readout_hw_state(struct drm_i915_private *i915)
{ {
struct intel_cdclk_state *cdclk_state = struct intel_cdclk_state *cdclk_state =
to_intel_cdclk_state(i915->cdclk.obj.state); to_intel_cdclk_state(i915->display.cdclk.obj.state);
struct intel_dbuf_state *dbuf_state = struct intel_dbuf_state *dbuf_state =
to_intel_dbuf_state(i915->dbuf.obj.state); to_intel_dbuf_state(i915->dbuf.obj.state);
enum pipe pipe; enum pipe pipe;
......
...@@ -504,8 +504,8 @@ void intel_gt_pm_frequency_dump(struct intel_gt *gt, struct drm_printer *p) ...@@ -504,8 +504,8 @@ void intel_gt_pm_frequency_dump(struct intel_gt *gt, struct drm_printer *p)
drm_puts(p, "no P-state info available\n"); drm_puts(p, "no P-state info available\n");
} }
drm_printf(p, "Current CD clock frequency: %d kHz\n", i915->cdclk.hw.cdclk); drm_printf(p, "Current CD clock frequency: %d kHz\n", i915->display.cdclk.hw.cdclk);
drm_printf(p, "Max CD clock frequency: %d kHz\n", i915->max_cdclk_freq); drm_printf(p, "Max CD clock frequency: %d kHz\n", i915->display.cdclk.max_cdclk_freq);
drm_printf(p, "Max pixel clock frequency: %d kHz\n", i915->max_dotclk_freq); drm_printf(p, "Max pixel clock frequency: %d kHz\n", i915->max_dotclk_freq);
intel_runtime_pm_put(uncore->rpm, wakeref); intel_runtime_pm_put(uncore->rpm, wakeref);
......
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
#include <drm/drm_connector.h> #include <drm/drm_connector.h>
#include <drm/ttm/ttm_device.h> #include <drm/ttm/ttm_device.h>
#include "display/intel_cdclk.h"
#include "display/intel_display.h" #include "display/intel_display.h"
#include "display/intel_display_core.h" #include "display/intel_display_core.h"
#include "display/intel_display_power.h" #include "display/intel_display_power.h"
...@@ -74,9 +73,6 @@ ...@@ -74,9 +73,6 @@
struct drm_i915_clock_gating_funcs; struct drm_i915_clock_gating_funcs;
struct drm_i915_gem_object; struct drm_i915_gem_object;
struct drm_i915_private; struct drm_i915_private;
struct intel_cdclk_config;
struct intel_cdclk_state;
struct intel_cdclk_vals;
struct intel_connector; struct intel_connector;
struct intel_dp; struct intel_dp;
struct intel_encoder; struct intel_encoder;
...@@ -339,23 +335,12 @@ struct drm_i915_private { ...@@ -339,23 +335,12 @@ struct drm_i915_private {
unsigned int fsb_freq, mem_freq, is_ddr3; unsigned int fsb_freq, mem_freq, is_ddr3;
unsigned int skl_preferred_vco_freq; unsigned int skl_preferred_vco_freq;
unsigned int max_cdclk_freq;
unsigned int max_dotclk_freq; unsigned int max_dotclk_freq;
unsigned int hpll_freq; unsigned int hpll_freq;
unsigned int fdi_pll_freq; unsigned int fdi_pll_freq;
unsigned int czclk_freq; unsigned int czclk_freq;
struct {
/* The current hardware cdclk configuration */
struct intel_cdclk_config hw;
/* cdclk, divider, and ratio table from bspec */
const struct intel_cdclk_vals *table;
struct intel_global_obj obj;
} cdclk;
struct { struct {
/* The current hardware dbuf configuration */ /* The current hardware dbuf configuration */
u8 enabled_slices; u8 enabled_slices;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment