All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-gfx] [PATCH] drm/i915/display/dg2: Read CD clock from squasher table
@ 2021-11-17 15:18 Mika Kahola
  2021-11-17 21:27 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for " Patchwork
  0 siblings, 1 reply; 3+ messages in thread
From: Mika Kahola @ 2021-11-17 15:18 UTC (permalink / raw)
  To: intel-gfx

To calculate CD clock with squasher unit, we set CD clock ratio to fixed value of 34.
The CD clock value is read from CD clock squasher table.

BSpec: 54034

v2: Read ratio from register (Ville)
    Drop unnecessary local variable (Ville)
    Get CD clock from the given table
v3: Calculate CD clock frequency based on waveform bit pattern (Ville)
[v4: vsyrjala: Actually do a proper blind readout from the hardware]
[v5: vsyrjala: Use has_cdclk_squasher()]

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 | 17 ++++++++++++++++-
 1 file changed, 16 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..ee48a6b87184 100644
--- a/drivers/gpu/drm/i915/display/intel_cdclk.c
+++ b/drivers/gpu/drm/i915/display/intel_cdclk.c
@@ -1454,6 +1454,7 @@ static void bxt_de_pll_readout(struct drm_i915_private *dev_priv,
 static void bxt_get_cdclk(struct drm_i915_private *dev_priv,
 			  struct intel_cdclk_config *cdclk_config)
 {
+	u32 squash_ctl = 0;
 	u32 divider;
 	int div;
 
@@ -1491,7 +1492,21 @@ static void bxt_get_cdclk(struct drm_i915_private *dev_priv,
 		return;
 	}
 
-	cdclk_config->cdclk = DIV_ROUND_CLOSEST(cdclk_config->vco, div);
+	if (has_cdclk_squasher(dev_priv))
+		squash_ctl = intel_de_read(dev_priv, CDCLK_SQUASH_CTL);
+
+	if (squash_ctl & CDCLK_SQUASH_ENABLE) {
+		u16 waveform;
+		int size;
+
+		size = REG_FIELD_GET(CDCLK_SQUASH_WINDOW_SIZE_MASK, squash_ctl) + 1;
+		waveform = REG_FIELD_GET(CDCLK_SQUASH_WAVEFORM_MASK, squash_ctl) >> (16 - size);
+
+		cdclk_config->cdclk = DIV_ROUND_CLOSEST(hweight16(waveform) *
+							cdclk_config->vco, size * div);
+	} else {
+		cdclk_config->cdclk = DIV_ROUND_CLOSEST(cdclk_config->vco, div);
+	}
 
  out:
 	/*
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Intel-gfx] ✗ Fi.CI.BUILD: failure for drm/i915/display/dg2: Read CD clock from squasher table
  2021-11-17 15:18 [Intel-gfx] [PATCH] drm/i915/display/dg2: Read CD clock from squasher table Mika Kahola
@ 2021-11-17 21:27 ` Patchwork
  2021-11-18  8:34   ` Kahola, Mika
  0 siblings, 1 reply; 3+ messages in thread
From: Patchwork @ 2021-11-17 21:27 UTC (permalink / raw)
  To: Mika Kahola; +Cc: intel-gfx

== Series Details ==

Series: drm/i915/display/dg2: Read CD clock from squasher table
URL   : https://patchwork.freedesktop.org/series/97031/
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 ‘bxt_get_cdclk’:
drivers/gpu/drm/i915/display/intel_cdclk.c:1495:6: error: implicit declaration of function ‘has_cdclk_squasher’ [-Werror=implicit-function-declaration]
  if (has_cdclk_squasher(dev_priv))
      ^~~~~~~~~~~~~~~~~~
drivers/gpu/drm/i915/display/intel_cdclk.c:1496:40: error: ‘CDCLK_SQUASH_CTL’ undeclared (first use in this function); did you mean ‘CDCLK_CTL’?
   squash_ctl = intel_de_read(dev_priv, CDCLK_SQUASH_CTL);
                                        ^~~~~~~~~~~~~~~~
                                        CDCLK_CTL
drivers/gpu/drm/i915/display/intel_cdclk.c:1496:40: note: each undeclared identifier is reported only once for each function it appears in
drivers/gpu/drm/i915/display/intel_cdclk.c:1498:19: error: ‘CDCLK_SQUASH_ENABLE’ undeclared (first use in this function); did you mean ‘ICL_CSC_ENABLE’?
  if (squash_ctl & CDCLK_SQUASH_ENABLE) {
                   ^~~~~~~~~~~~~~~~~~~
                   ICL_CSC_ENABLE
In file included from <command-line>:
drivers/gpu/drm/i915/display/intel_cdclk.c:1502:24: error: ‘CDCLK_SQUASH_WINDOW_SIZE_MASK’ undeclared (first use in this function); did you mean ‘ACPI_EBDA_WINDOW_SIZE’?
   size = REG_FIELD_GET(CDCLK_SQUASH_WINDOW_SIZE_MASK, squash_ctl) + 1;
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
././include/linux/compiler_types.h:315:9: note: in definition of macro ‘__compiletime_assert’
   if (!(condition))     \
         ^~~~~~~~~
././include/linux/compiler_types.h:335:2: note: in expansion of macro ‘_compiletime_assert’
  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
  ^~~~~~~~~~~~~~~~~~~
./include/linux/build_bug.h:39:37: note: in expansion of macro ‘compiletime_assert’
 #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                     ^~~~~~~~~~~~~~~~~~
./include/linux/bitfield.h:46:3: note: in expansion of macro ‘BUILD_BUG_ON_MSG’
   BUILD_BUG_ON_MSG(!__builtin_constant_p(_mask),  \
   ^~~~~~~~~~~~~~~~
./include/linux/bitfield.h:108:3: note: in expansion of macro ‘__BF_FIELD_CHECK’
   __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
   ^~~~~~~~~~~~~~~~
./drivers/gpu/drm/i915/i915_reg.h:179:44: note: in expansion of macro ‘FIELD_GET’
 #define REG_FIELD_GET(__mask, __val) ((u32)FIELD_GET(__mask, __val))
                                            ^~~~~~~~~
drivers/gpu/drm/i915/display/intel_cdclk.c:1502:10: note: in expansion of macro ‘REG_FIELD_GET’
   size = REG_FIELD_GET(CDCLK_SQUASH_WINDOW_SIZE_MASK, squash_ctl) + 1;
          ^~~~~~~~~~~~~
drivers/gpu/drm/i915/display/intel_cdclk.c:1503:28: error: ‘CDCLK_SQUASH_WAVEFORM_MASK’ undeclared (first use in this function); did you mean ‘CDCLK_FREQ_SEL_MASK’?
   waveform = REG_FIELD_GET(CDCLK_SQUASH_WAVEFORM_MASK, squash_ctl) >> (16 - size);
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~
././include/linux/compiler_types.h:315:9: note: in definition of macro ‘__compiletime_assert’
   if (!(condition))     \
         ^~~~~~~~~
././include/linux/compiler_types.h:335:2: note: in expansion of macro ‘_compiletime_assert’
  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
  ^~~~~~~~~~~~~~~~~~~
./include/linux/build_bug.h:39:37: note: in expansion of macro ‘compiletime_assert’
 #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
                                     ^~~~~~~~~~~~~~~~~~
./include/linux/bitfield.h:46:3: note: in expansion of macro ‘BUILD_BUG_ON_MSG’
   BUILD_BUG_ON_MSG(!__builtin_constant_p(_mask),  \
   ^~~~~~~~~~~~~~~~
./include/linux/bitfield.h:108:3: note: in expansion of macro ‘__BF_FIELD_CHECK’
   __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
   ^~~~~~~~~~~~~~~~
./drivers/gpu/drm/i915/i915_reg.h:179:44: note: in expansion of macro ‘FIELD_GET’
 #define REG_FIELD_GET(__mask, __val) ((u32)FIELD_GET(__mask, __val))
                                            ^~~~~~~~~
drivers/gpu/drm/i915/display/intel_cdclk.c:1503:14: note: in expansion of macro ‘REG_FIELD_GET’
   waveform = REG_FIELD_GET(CDCLK_SQUASH_WAVEFORM_MASK, squash_ctl) >> (16 - size);
              ^~~~~~~~~~~~~
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: Read CD clock from squasher table
  2021-11-17 21:27 ` [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

Please ignore this. These CD clock squashing patches needs to be sent as a series.

> -----Original Message-----
> From: Patchwork <patchwork@emeril.freedesktop.org>
> Sent: Wednesday, November 17, 2021 11:28 PM
> To: Kahola, Mika <mika.kahola@intel.com>
> Cc: intel-gfx@lists.freedesktop.org
> Subject: ✗ Fi.CI.BUILD: failure for drm/i915/display/dg2: Read CD clock from
> squasher table
> 
> == Series Details ==
> 
> Series: drm/i915/display/dg2: Read CD clock from squasher table
> URL   : https://patchwork.freedesktop.org/series/97031/
> 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 ‘bxt_get_cdclk’:
> drivers/gpu/drm/i915/display/intel_cdclk.c:1495:6: error: implicit declaration of
> function ‘has_cdclk_squasher’ [-Werror=implicit-function-declaration]
>   if (has_cdclk_squasher(dev_priv))
>       ^~~~~~~~~~~~~~~~~~
> drivers/gpu/drm/i915/display/intel_cdclk.c:1496:40: error:
> ‘CDCLK_SQUASH_CTL’ undeclared (first use in this function); did you mean
> ‘CDCLK_CTL’?
>    squash_ctl = intel_de_read(dev_priv, CDCLK_SQUASH_CTL);
>                                         ^~~~~~~~~~~~~~~~
>                                         CDCLK_CTL
> drivers/gpu/drm/i915/display/intel_cdclk.c:1496:40: note: each undeclared
> identifier is reported only once for each function it appears in
> drivers/gpu/drm/i915/display/intel_cdclk.c:1498:19: error:
> ‘CDCLK_SQUASH_ENABLE’ undeclared (first use in this function); did you mean
> ‘ICL_CSC_ENABLE’?
>   if (squash_ctl & CDCLK_SQUASH_ENABLE) {
>                    ^~~~~~~~~~~~~~~~~~~
>                    ICL_CSC_ENABLE
> In file included from <command-line>:
> drivers/gpu/drm/i915/display/intel_cdclk.c:1502:24: error:
> ‘CDCLK_SQUASH_WINDOW_SIZE_MASK’ undeclared (first use in this function);
> did you mean ‘ACPI_EBDA_WINDOW_SIZE’?
>    size = REG_FIELD_GET(CDCLK_SQUASH_WINDOW_SIZE_MASK, squash_ctl) +
> 1;
>                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ././include/linux/compiler_types.h:315:9: note: in definition of macro
> ‘__compiletime_assert’
>    if (!(condition))     \
>          ^~~~~~~~~
> ././include/linux/compiler_types.h:335:2: note: in expansion of macro
> ‘_compiletime_assert’
>   _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
>   ^~~~~~~~~~~~~~~~~~~
> ./include/linux/build_bug.h:39:37: note: in expansion of macro
> ‘compiletime_assert’
>  #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
>                                      ^~~~~~~~~~~~~~~~~~
> ./include/linux/bitfield.h:46:3: note: in expansion of macro
> ‘BUILD_BUG_ON_MSG’
>    BUILD_BUG_ON_MSG(!__builtin_constant_p(_mask),  \
>    ^~~~~~~~~~~~~~~~
> ./include/linux/bitfield.h:108:3: note: in expansion of macro
> ‘__BF_FIELD_CHECK’
>    __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
>    ^~~~~~~~~~~~~~~~
> ./drivers/gpu/drm/i915/i915_reg.h:179:44: note: in expansion of macro
> ‘FIELD_GET’
>  #define REG_FIELD_GET(__mask, __val) ((u32)FIELD_GET(__mask, __val))
>                                             ^~~~~~~~~
> drivers/gpu/drm/i915/display/intel_cdclk.c:1502:10: note: in expansion of
> macro ‘REG_FIELD_GET’
>    size = REG_FIELD_GET(CDCLK_SQUASH_WINDOW_SIZE_MASK, squash_ctl) +
> 1;
>           ^~~~~~~~~~~~~
> drivers/gpu/drm/i915/display/intel_cdclk.c:1503:28: error:
> ‘CDCLK_SQUASH_WAVEFORM_MASK’ undeclared (first use in this function); did
> you mean ‘CDCLK_FREQ_SEL_MASK’?
>    waveform = REG_FIELD_GET(CDCLK_SQUASH_WAVEFORM_MASK, squash_ctl)
> >> (16 - size);
>                             ^~~~~~~~~~~~~~~~~~~~~~~~~~
> ././include/linux/compiler_types.h:315:9: note: in definition of macro
> ‘__compiletime_assert’
>    if (!(condition))     \
>          ^~~~~~~~~
> ././include/linux/compiler_types.h:335:2: note: in expansion of macro
> ‘_compiletime_assert’
>   _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
>   ^~~~~~~~~~~~~~~~~~~
> ./include/linux/build_bug.h:39:37: note: in expansion of macro
> ‘compiletime_assert’
>  #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
>                                      ^~~~~~~~~~~~~~~~~~
> ./include/linux/bitfield.h:46:3: note: in expansion of macro
> ‘BUILD_BUG_ON_MSG’
>    BUILD_BUG_ON_MSG(!__builtin_constant_p(_mask),  \
>    ^~~~~~~~~~~~~~~~
> ./include/linux/bitfield.h:108:3: note: in expansion of macro
> ‘__BF_FIELD_CHECK’
>    __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
>    ^~~~~~~~~~~~~~~~
> ./drivers/gpu/drm/i915/i915_reg.h:179:44: note: in expansion of macro
> ‘FIELD_GET’
>  #define REG_FIELD_GET(__mask, __val) ((u32)FIELD_GET(__mask, __val))
>                                             ^~~~~~~~~
> drivers/gpu/drm/i915/display/intel_cdclk.c:1503:14: note: in expansion of
> macro ‘REG_FIELD_GET’
>    waveform = REG_FIELD_GET(CDCLK_SQUASH_WAVEFORM_MASK, squash_ctl)
> >> (16 - size);
>               ^~~~~~~~~~~~~
> 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:18 [Intel-gfx] [PATCH] drm/i915/display/dg2: Read CD clock from squasher table Mika Kahola
2021-11-17 21:27 ` [Intel-gfx] ✗ Fi.CI.BUILD: failure for " Patchwork
2021-11-18  8:34   ` Kahola, Mika

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.