Re: [Intel-gfx] [PATCH 06/11] drm/i915: refactor pll code out into intel_dpll.c

2020-12-16 Thread Jani Nikula
On Fri, 11 Dec 2020, Dave Airlie  wrote:
> From: Dave Airlie 
>
> This pulls a large chunk of the pll calculation code out of
> intel_display.c to a new file.
>
> One function makse sense to be an inline, otherwise this
> is pretty much a straight copy cover. also all the
> remaining hooks for g45 and older end up the same now.

This duplicates intel_panel_use_ssc, otherwise LGTM. Fixed up locally,
along with the intel_dpll.h fix to pass CI.

BR,
Jani.


>
> Signed-off-by: Dave Airlie 
> ---
>  drivers/gpu/drm/i915/Makefile |1 +
>  drivers/gpu/drm/i915/display/intel_display.c  | 1394 +
>  drivers/gpu/drm/i915/display/intel_display.h  |3 +
>  .../drm/i915/display/intel_display_types.h|5 +
>  drivers/gpu/drm/i915/display/intel_dpll.c | 1371 
>  drivers/gpu/drm/i915/display/intel_dpll.h |   22 +
>  6 files changed, 1413 insertions(+), 1383 deletions(-)
>  create mode 100644 drivers/gpu/drm/i915/display/intel_dpll.c
>  create mode 100644 drivers/gpu/drm/i915/display/intel_dpll.h
>
> diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
> index ffec257702af..5d533de16335 100644
> --- a/drivers/gpu/drm/i915/Makefile
> +++ b/drivers/gpu/drm/i915/Makefile
> @@ -202,6 +202,7 @@ i915-y += \
>   display/intel_display.o \
>   display/intel_display_power.o \
>   display/intel_dpio_phy.o \
> + display/intel_dpll.o \
>   display/intel_dpll_mgr.o \
>   display/intel_dsb.o \
>   display/intel_fbc.o \
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c 
> b/drivers/gpu/drm/i915/display/intel_display.c
> index 5dfec950c144..a0d9cd7b4e34 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -48,6 +48,7 @@
>  #include "display/intel_display_debugfs.h"
>  #include "display/intel_dp.h"
>  #include "display/intel_dp_mst.h"
> +#include "display/intel_dpll.h"
>  #include "display/intel_dpll_mgr.h"
>  #include "display/intel_dsi.h"
>  #include "display/intel_dvo.h"
> @@ -114,17 +115,6 @@ static void ilk_pfit_enable(const struct 
> intel_crtc_state *crtc_state);
>  static void intel_modeset_setup_hw_state(struct drm_device *dev,
>struct drm_modeset_acquire_ctx *ctx);
>  
> -struct intel_limit {
> - struct {
> - int min, max;
> - } dot, vco, n, m, m1, m2, p, p1;
> -
> - struct {
> - int dot_limit;
> - int p2_slow, p2_fast;
> - } p2;
> -};
> -
>  /* returns HPLL frequency in kHz */
>  int vlv_get_hpll_vco(struct drm_i915_private *dev_priv)
>  {
> @@ -192,271 +182,6 @@ static u32 intel_fdi_link_freq(struct drm_i915_private 
> *dev_priv,
>   return dev_priv->fdi_pll_freq;
>  }
>  
> -static const struct intel_limit intel_limits_i8xx_dac = {
> - .dot = { .min = 25000, .max = 35 },
> - .vco = { .min = 908000, .max = 1512000 },
> - .n = { .min = 2, .max = 16 },
> - .m = { .min = 96, .max = 140 },
> - .m1 = { .min = 18, .max = 26 },
> - .m2 = { .min = 6, .max = 16 },
> - .p = { .min = 4, .max = 128 },
> - .p1 = { .min = 2, .max = 33 },
> - .p2 = { .dot_limit = 165000,
> - .p2_slow = 4, .p2_fast = 2 },
> -};
> -
> -static const struct intel_limit intel_limits_i8xx_dvo = {
> - .dot = { .min = 25000, .max = 35 },
> - .vco = { .min = 908000, .max = 1512000 },
> - .n = { .min = 2, .max = 16 },
> - .m = { .min = 96, .max = 140 },
> - .m1 = { .min = 18, .max = 26 },
> - .m2 = { .min = 6, .max = 16 },
> - .p = { .min = 4, .max = 128 },
> - .p1 = { .min = 2, .max = 33 },
> - .p2 = { .dot_limit = 165000,
> - .p2_slow = 4, .p2_fast = 4 },
> -};
> -
> -static const struct intel_limit intel_limits_i8xx_lvds = {
> - .dot = { .min = 25000, .max = 35 },
> - .vco = { .min = 908000, .max = 1512000 },
> - .n = { .min = 2, .max = 16 },
> - .m = { .min = 96, .max = 140 },
> - .m1 = { .min = 18, .max = 26 },
> - .m2 = { .min = 6, .max = 16 },
> - .p = { .min = 4, .max = 128 },
> - .p1 = { .min = 1, .max = 6 },
> - .p2 = { .dot_limit = 165000,
> - .p2_slow = 14, .p2_fast = 7 },
> -};
> -
> -static const struct intel_limit intel_limits_i9xx_sdvo = {
> - .dot = { .min = 2, .max = 40 },
> - .vco = { .min = 140, .max = 280 },
> - .n = { .min = 1, .max = 6 },
> - .m = { .min = 70, .max = 120 },
> - .m1 = { .min = 8, .max = 18 },
> - .m2 = { .min = 3, .max = 7 },
> - .p = { .min = 5, .max = 80 },
> - .p1 = { .min = 1, .max = 8 },
> - .p2 = { .dot_limit = 20,
> - .p2_slow = 10, .p2_fast = 5 },
> -};
> -
> -static const struct intel_limit intel_limits_i9xx_lvds = {
> - .dot = { .min = 2, .max = 40 },
> - .vco = { .min = 140, .max = 280 },
> - .n = { .min = 1, .max = 6 },
> - .m = { .min = 70, .max = 120 },
> - .m1 = { .min = 

[Intel-gfx] [PATCH 06/11] drm/i915: refactor pll code out into intel_dpll.c

2020-12-10 Thread Dave Airlie
From: Dave Airlie 

This pulls a large chunk of the pll calculation code out of
intel_display.c to a new file.

One function makse sense to be an inline, otherwise this
is pretty much a straight copy cover. also all the
remaining hooks for g45 and older end up the same now.

Signed-off-by: Dave Airlie 
---
 drivers/gpu/drm/i915/Makefile |1 +
 drivers/gpu/drm/i915/display/intel_display.c  | 1394 +
 drivers/gpu/drm/i915/display/intel_display.h  |3 +
 .../drm/i915/display/intel_display_types.h|5 +
 drivers/gpu/drm/i915/display/intel_dpll.c | 1371 
 drivers/gpu/drm/i915/display/intel_dpll.h |   22 +
 6 files changed, 1413 insertions(+), 1383 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/display/intel_dpll.c
 create mode 100644 drivers/gpu/drm/i915/display/intel_dpll.h

diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index ffec257702af..5d533de16335 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -202,6 +202,7 @@ i915-y += \
display/intel_display.o \
display/intel_display_power.o \
display/intel_dpio_phy.o \
+   display/intel_dpll.o \
display/intel_dpll_mgr.o \
display/intel_dsb.o \
display/intel_fbc.o \
diff --git a/drivers/gpu/drm/i915/display/intel_display.c 
b/drivers/gpu/drm/i915/display/intel_display.c
index 5dfec950c144..a0d9cd7b4e34 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -48,6 +48,7 @@
 #include "display/intel_display_debugfs.h"
 #include "display/intel_dp.h"
 #include "display/intel_dp_mst.h"
+#include "display/intel_dpll.h"
 #include "display/intel_dpll_mgr.h"
 #include "display/intel_dsi.h"
 #include "display/intel_dvo.h"
@@ -114,17 +115,6 @@ static void ilk_pfit_enable(const struct intel_crtc_state 
*crtc_state);
 static void intel_modeset_setup_hw_state(struct drm_device *dev,
 struct drm_modeset_acquire_ctx *ctx);
 
-struct intel_limit {
-   struct {
-   int min, max;
-   } dot, vco, n, m, m1, m2, p, p1;
-
-   struct {
-   int dot_limit;
-   int p2_slow, p2_fast;
-   } p2;
-};
-
 /* returns HPLL frequency in kHz */
 int vlv_get_hpll_vco(struct drm_i915_private *dev_priv)
 {
@@ -192,271 +182,6 @@ static u32 intel_fdi_link_freq(struct drm_i915_private 
*dev_priv,
return dev_priv->fdi_pll_freq;
 }
 
-static const struct intel_limit intel_limits_i8xx_dac = {
-   .dot = { .min = 25000, .max = 35 },
-   .vco = { .min = 908000, .max = 1512000 },
-   .n = { .min = 2, .max = 16 },
-   .m = { .min = 96, .max = 140 },
-   .m1 = { .min = 18, .max = 26 },
-   .m2 = { .min = 6, .max = 16 },
-   .p = { .min = 4, .max = 128 },
-   .p1 = { .min = 2, .max = 33 },
-   .p2 = { .dot_limit = 165000,
-   .p2_slow = 4, .p2_fast = 2 },
-};
-
-static const struct intel_limit intel_limits_i8xx_dvo = {
-   .dot = { .min = 25000, .max = 35 },
-   .vco = { .min = 908000, .max = 1512000 },
-   .n = { .min = 2, .max = 16 },
-   .m = { .min = 96, .max = 140 },
-   .m1 = { .min = 18, .max = 26 },
-   .m2 = { .min = 6, .max = 16 },
-   .p = { .min = 4, .max = 128 },
-   .p1 = { .min = 2, .max = 33 },
-   .p2 = { .dot_limit = 165000,
-   .p2_slow = 4, .p2_fast = 4 },
-};
-
-static const struct intel_limit intel_limits_i8xx_lvds = {
-   .dot = { .min = 25000, .max = 35 },
-   .vco = { .min = 908000, .max = 1512000 },
-   .n = { .min = 2, .max = 16 },
-   .m = { .min = 96, .max = 140 },
-   .m1 = { .min = 18, .max = 26 },
-   .m2 = { .min = 6, .max = 16 },
-   .p = { .min = 4, .max = 128 },
-   .p1 = { .min = 1, .max = 6 },
-   .p2 = { .dot_limit = 165000,
-   .p2_slow = 14, .p2_fast = 7 },
-};
-
-static const struct intel_limit intel_limits_i9xx_sdvo = {
-   .dot = { .min = 2, .max = 40 },
-   .vco = { .min = 140, .max = 280 },
-   .n = { .min = 1, .max = 6 },
-   .m = { .min = 70, .max = 120 },
-   .m1 = { .min = 8, .max = 18 },
-   .m2 = { .min = 3, .max = 7 },
-   .p = { .min = 5, .max = 80 },
-   .p1 = { .min = 1, .max = 8 },
-   .p2 = { .dot_limit = 20,
-   .p2_slow = 10, .p2_fast = 5 },
-};
-
-static const struct intel_limit intel_limits_i9xx_lvds = {
-   .dot = { .min = 2, .max = 40 },
-   .vco = { .min = 140, .max = 280 },
-   .n = { .min = 1, .max = 6 },
-   .m = { .min = 70, .max = 120 },
-   .m1 = { .min = 8, .max = 18 },
-   .m2 = { .min = 3, .max = 7 },
-   .p = { .min = 7, .max = 98 },
-   .p1 = { .min = 1, .max = 8 },
-   .p2 = { .dot_limit = 112000,
-   .p2_slow = 14, .p2_fast = 7 },
-};
-
-
-static const struct intel_limit intel_limits_g4x_sdvo = {
-   .dot = {