* [Intel-gfx] [PATCH] drm/i915/display/dg2: Set CD clock squashing registers
@ 2021-11-17 15:19 Mika Kahola
2021-11-17 22:05 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for " Patchwork
0 siblings, 1 reply; 3+ messages in thread
From: Mika Kahola @ 2021-11-17 15:19 UTC (permalink / raw)
To: intel-gfx
Set CD clock squashing registers based on selected CD clock.
v2: use slk_cdclk_decimal() to compute decimal values instead of a
specific table (Ville)
Set waveform based on CD clock table (Ville)
Drop unnecessary local variable (Ville)
v3: Correct function naming (Ville)
Correct if-else structure (Ville)
[v4: vsyrjala: Fix spaces vs. tabs]
[v5: vsyrjala: Fix cd2x divider calculation (Uma),
Add warn to waveform lookup (Uma),
Handle bypass freq in waveform lookup,
Generalize waveform handling in bxt_set_cdclk()]
Signed-off-by: Mika Kahola <mika.kahola@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
drivers/gpu/drm/i915/display/intel_cdclk.c | 41 +++++++++++++++++++++-
drivers/gpu/drm/i915/i915_reg.h | 8 +++++
2 files changed, 48 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/display/intel_cdclk.c b/drivers/gpu/drm/i915/display/intel_cdclk.c
index 91c19e0a98d7..69bdec6abf1e 100644
--- a/drivers/gpu/drm/i915/display/intel_cdclk.c
+++ b/drivers/gpu/drm/i915/display/intel_cdclk.c
@@ -1626,6 +1626,26 @@ static u32 bxt_cdclk_cd2x_div_sel(struct drm_i915_private *dev_priv,
}
}
+static u32 cdclk_squash_waveform(struct drm_i915_private *dev_priv,
+ int cdclk)
+{
+ const struct intel_cdclk_vals *table = dev_priv->cdclk.table;
+ int i;
+
+ if (cdclk == dev_priv->cdclk.hw.bypass)
+ return 0;
+
+ for (i = 0; table[i].refclk; i++)
+ if (table[i].refclk == dev_priv->cdclk.hw.ref &&
+ table[i].cdclk == cdclk)
+ return table[i].waveform;
+
+ drm_WARN(&dev_priv->drm, 1, "cdclk %d not valid for refclk %u\n",
+ cdclk, dev_priv->cdclk.hw.ref);
+
+ return 0xffff;
+}
+
static void bxt_set_cdclk(struct drm_i915_private *dev_priv,
const struct intel_cdclk_config *cdclk_config,
enum pipe pipe)
@@ -1633,6 +1653,8 @@ static void bxt_set_cdclk(struct drm_i915_private *dev_priv,
int cdclk = cdclk_config->cdclk;
int vco = cdclk_config->vco;
u32 val;
+ u16 waveform;
+ int clock;
int ret;
/* Inform power controller of upcoming frequency change. */
@@ -1676,7 +1698,24 @@ static void bxt_set_cdclk(struct drm_i915_private *dev_priv,
bxt_de_pll_enable(dev_priv, vco);
}
- val = bxt_cdclk_cd2x_div_sel(dev_priv, cdclk, vco) |
+ waveform = cdclk_squash_waveform(dev_priv, cdclk);
+
+ if (waveform)
+ clock = vco / 2;
+ else
+ clock = cdclk;
+
+ if (has_cdclk_squasher(dev_priv)) {
+ u32 squash_ctl = 0;
+
+ if (waveform)
+ squash_ctl = CDCLK_SQUASH_ENABLE |
+ CDCLK_SQUASH_WINDOW_SIZE(0xf) | waveform;
+
+ intel_de_write(dev_priv, CDCLK_SQUASH_CTL, squash_ctl);
+ }
+
+ val = bxt_cdclk_cd2x_div_sel(dev_priv, clock, vco) |
bxt_cdclk_cd2x_pipe(dev_priv, pipe) |
skl_cdclk_decimal(cdclk);
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index f15ffc53e858..cfedbca0b5d3 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -10649,6 +10649,14 @@ enum skl_power_gate {
#define BXT_CDCLK_SSA_PRECHARGE_ENABLE (1 << 16)
#define CDCLK_FREQ_DECIMAL_MASK (0x7ff)
+/* CDCLK_SQUASH_CTL */
+#define CDCLK_SQUASH_CTL _MMIO(0x46008)
+#define CDCLK_SQUASH_ENABLE REG_BIT(31)
+#define CDCLK_SQUASH_WINDOW_SIZE_MASK REG_GENMASK(27, 24)
+#define CDCLK_SQUASH_WINDOW_SIZE(x) REG_FIELD_PREP(CDCLK_SQUASH_WINDOW_SIZE_MASK, (x))
+#define CDCLK_SQUASH_WAVEFORM_MASK REG_GENMASK(15, 0)
+#define CDCLK_SQUASH_WAVEFORM(x) REG_FIELD_PREP(CDCLK_SQUASH_WAVEFORM_MASK, (x))
+
/* LCPLL_CTL */
#define LCPLL1_CTL _MMIO(0x46010)
#define LCPLL2_CTL _MMIO(0x46014)
--
2.27.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [Intel-gfx] ✗ Fi.CI.BUILD: failure for drm/i915/display/dg2: Set CD clock squashing registers
2021-11-17 15:19 [Intel-gfx] [PATCH] drm/i915/display/dg2: Set CD clock squashing registers Mika Kahola
@ 2021-11-17 22:05 ` Patchwork
2021-11-18 8:34 ` Kahola, Mika
0 siblings, 1 reply; 3+ messages in thread
From: Patchwork @ 2021-11-17 22:05 UTC (permalink / raw)
To: Mika Kahola; +Cc: intel-gfx
== Series Details ==
Series: drm/i915/display/dg2: Set CD clock squashing registers
URL : https://patchwork.freedesktop.org/series/97033/
State : failure
== Summary ==
CALL scripts/checksyscalls.sh
CALL scripts/atomic/check-atomics.sh
DESCEND objtool
CHK include/generated/compile.h
CC [M] drivers/gpu/drm/i915/display/intel_cdclk.o
drivers/gpu/drm/i915/display/intel_cdclk.c: In function ‘cdclk_squash_waveform’:
drivers/gpu/drm/i915/display/intel_cdclk.c:1641:19: error: ‘const struct intel_cdclk_vals’ has no member named ‘waveform’
return table[i].waveform;
^
drivers/gpu/drm/i915/display/intel_cdclk.c: In function ‘bxt_set_cdclk’:
drivers/gpu/drm/i915/display/intel_cdclk.c:1708:6: error: implicit declaration of function ‘has_cdclk_squasher’ [-Werror=implicit-function-declaration]
if (has_cdclk_squasher(dev_priv)) {
^~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
scripts/Makefile.build:287: recipe for target 'drivers/gpu/drm/i915/display/intel_cdclk.o' failed
make[4]: *** [drivers/gpu/drm/i915/display/intel_cdclk.o] Error 1
scripts/Makefile.build:549: recipe for target 'drivers/gpu/drm/i915' failed
make[3]: *** [drivers/gpu/drm/i915] Error 2
scripts/Makefile.build:549: recipe for target 'drivers/gpu/drm' failed
make[2]: *** [drivers/gpu/drm] Error 2
scripts/Makefile.build:549: recipe for target 'drivers/gpu' failed
make[1]: *** [drivers/gpu] Error 2
Makefile:1846: recipe for target 'drivers' failed
make: *** [drivers] Error 2
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Intel-gfx] ✗ Fi.CI.BUILD: failure for drm/i915/display/dg2: Set CD clock squashing registers
2021-11-17 22:05 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for " Patchwork
@ 2021-11-18 8:34 ` Kahola, Mika
0 siblings, 0 replies; 3+ messages in thread
From: Kahola, Mika @ 2021-11-18 8:34 UTC (permalink / raw)
To: intel-gfx@lists.freedesktop.org
Please ignore this. These CD clock squashing patches needs to be sent as a series.
> -----Original Message-----
> From: Patchwork <patchwork@emeril.freedesktop.org>
> Sent: Thursday, November 18, 2021 12:06 AM
> To: Kahola, Mika <mika.kahola@intel.com>
> Cc: intel-gfx@lists.freedesktop.org
> Subject: ✗ Fi.CI.BUILD: failure for drm/i915/display/dg2: Set CD clock squashing
> registers
>
> == Series Details ==
>
> Series: drm/i915/display/dg2: Set CD clock squashing registers
> URL : https://patchwork.freedesktop.org/series/97033/
> State : failure
>
> == Summary ==
>
> CALL scripts/checksyscalls.sh
> CALL scripts/atomic/check-atomics.sh
> DESCEND objtool
> CHK include/generated/compile.h
> CC [M] drivers/gpu/drm/i915/display/intel_cdclk.o
> drivers/gpu/drm/i915/display/intel_cdclk.c: In function
> ‘cdclk_squash_waveform’:
> drivers/gpu/drm/i915/display/intel_cdclk.c:1641:19: error: ‘const struct
> intel_cdclk_vals’ has no member named ‘waveform’
> return table[i].waveform;
> ^
> drivers/gpu/drm/i915/display/intel_cdclk.c: In function ‘bxt_set_cdclk’:
> drivers/gpu/drm/i915/display/intel_cdclk.c:1708:6: error: implicit declaration of
> function ‘has_cdclk_squasher’ [-Werror=implicit-function-declaration]
> if (has_cdclk_squasher(dev_priv)) {
> ^~~~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors
> scripts/Makefile.build:287: recipe for target
> 'drivers/gpu/drm/i915/display/intel_cdclk.o' failed
> make[4]: *** [drivers/gpu/drm/i915/display/intel_cdclk.o] Error 1
> scripts/Makefile.build:549: recipe for target 'drivers/gpu/drm/i915' failed
> make[3]: *** [drivers/gpu/drm/i915] Error 2
> scripts/Makefile.build:549: recipe for target 'drivers/gpu/drm' failed
> make[2]: *** [drivers/gpu/drm] Error 2
> scripts/Makefile.build:549: recipe for target 'drivers/gpu' failed
> make[1]: *** [drivers/gpu] Error 2
> Makefile:1846: recipe for target 'drivers' failed
> make: *** [drivers] Error 2
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-11-18 8:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-17 15:19 [Intel-gfx] [PATCH] drm/i915/display/dg2: Set CD clock squashing registers Mika Kahola
2021-11-17 22:05 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for " Patchwork
2021-11-18 8:34 ` Kahola, Mika
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox