From: Jani Nikula <jani.nikula@linux.intel.com>
To: "Kahola, Mika" <mika.kahola@intel.com>,
"intel-gfx@lists.freedesktop.org"
<intel-gfx@lists.freedesktop.org>
Subject: Re: [Intel-gfx] [PATCH 3/4] drm/i915/display/dg2: Sanitize CD clock
Date: Thu, 18 Nov 2021 13:28:31 +0200 [thread overview]
Message-ID: <87y25lk8io.fsf@intel.com> (raw)
In-Reply-To: <bb9e5efce1a647ad9b4dd0ad4d0ce9aa@intel.com>
On Thu, 18 Nov 2021, "Kahola, Mika" <mika.kahola@intel.com> wrote:
>> -----Original Message-----
>> From: Jani Nikula <jani.nikula@linux.intel.com>
>> Sent: Thursday, November 18, 2021 12:12 PM
>> To: Kahola, Mika <mika.kahola@intel.com>; intel-gfx@lists.freedesktop.org
>> Subject: Re: [Intel-gfx] [PATCH 3/4] drm/i915/display/dg2: Sanitize CD clock
>>
>> On Thu, 18 Nov 2021, Mika Kahola <mika.kahola@intel.com> wrote:
>> > In case of CD clock squashing the divider is always 1. We don't need
>> > to calculate the divider in use so let's skip that for DG2.
>> >
>> > v2: Drop unnecessary local variable (Ville)
>> > v3: Avoid if-else structure (Ville)
>> > [v4: vsyrjala: Fix cd2x divider calculation (Uma),
>> > Introduce 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 | 15 ++++++++++++---
>> > 1 file changed, 12 insertions(+), 3 deletions(-)
>> >
>> > diff --git a/drivers/gpu/drm/i915/display/intel_cdclk.c
>> > b/drivers/gpu/drm/i915/display/intel_cdclk.c
>> > index 630a53d4f882..e8c58779c2a8 100644
>> > --- a/drivers/gpu/drm/i915/display/intel_cdclk.c
>> > +++ b/drivers/gpu/drm/i915/display/intel_cdclk.c
>> > @@ -1212,6 +1212,11 @@ static void skl_cdclk_uninit_hw(struct
>> drm_i915_private *dev_priv)
>> > skl_set_cdclk(dev_priv, &cdclk_config, INVALID_PIPE); }
>> >
>> > +static bool has_cdclk_squasher(struct drm_i915_private *i915) {
>> > + return IS_DG2(i915);
>> > +}
>>
>> The obvious problem is that you use this function already in patch 2.
>
> I couldn't find the original cover-letter and hence the patches might have slipped in wrong order. Thanks for pointing that out!
>
>>
>> I'm also not sure we want to start sprinkling the has_ or HAS_ query stuff all over
>> the place in .c. files. Or if we do, we should do it in a more planned manner, not
>> by starting to sneak these in.
>
> Well, what would be the alternative? How we should handle the cases
> where a feature is supported by a platform and perhaps platforms in
> the future?
I mean the current approach is to add the feature check macros in
i915_drv.h instead of spreading them everywhere. It may not be the best
approach, and we may want to revisit that in the future, but at the
moment that's where we put them.
BR,
Jani.
>
> Cheers,
> Mika
>>
>> BR,
>> Jani.
>>
>> > +
>> > static const struct intel_cdclk_vals bxt_cdclk_table[] = {
>> > { .refclk = 19200, .cdclk = 144000, .divider = 8, .ratio = 60 },
>> > { .refclk = 19200, .cdclk = 288000, .divider = 4, .ratio = 60 }, @@
>> > -1750,7 +1755,7 @@ static void bxt_set_cdclk(struct drm_i915_private
>> > *dev_priv, static void bxt_sanitize_cdclk(struct drm_i915_private
>> > *dev_priv) {
>> > u32 cdctl, expected;
>> > - int cdclk, vco;
>> > + int cdclk, clock, vco;
>> >
>> > intel_update_cdclk(dev_priv);
>> > intel_dump_cdclk_config(&dev_priv->cdclk.hw, "Current CDCLK"); @@
>> > -1786,8 +1791,12 @@ static void bxt_sanitize_cdclk(struct drm_i915_private
>> *dev_priv)
>> > expected = skl_cdclk_decimal(cdclk);
>> >
>> > /* Figure out what CD2X divider we should be using for this cdclk */
>> > - expected |= bxt_cdclk_cd2x_div_sel(dev_priv,
>> > - dev_priv->cdclk.hw.cdclk,
>> > + if (has_cdclk_squasher(dev_priv))
>> > + clock = dev_priv->cdclk.hw.vco / 2;
>> > + else
>> > + clock = dev_priv->cdclk.hw.cdclk;
>> > +
>> > + expected |= bxt_cdclk_cd2x_div_sel(dev_priv, clock,
>> > dev_priv->cdclk.hw.vco);
>> >
>> > /*
>>
>> --
>> Jani Nikula, Intel Open Source Graphics Center
--
Jani Nikula, Intel Open Source Graphics Center
next prev parent reply other threads:[~2021-11-18 11:28 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-18 8:54 [Intel-gfx] [PATCH 0/4] drm/i915/display/dg2: Add CD clock squashing Mika Kahola
2021-11-18 8:54 ` [Intel-gfx] [PATCH 1/4] drm/i915/display/dg2: Introduce CD clock squashing table Mika Kahola
2021-11-18 8:54 ` [Intel-gfx] [PATCH 2/4] drm/i915/display/dg2: Read CD clock from squasher table Mika Kahola
2021-11-18 8:54 ` [Intel-gfx] [PATCH 3/4] drm/i915/display/dg2: Sanitize CD clock Mika Kahola
2021-11-18 10:12 ` Jani Nikula
2021-11-18 11:22 ` Kahola, Mika
2021-11-18 11:28 ` Jani Nikula [this message]
2021-11-18 8:54 ` [Intel-gfx] [PATCH 4/4] drm/i915/display/dg2: Set CD clock squashing registers Mika Kahola
2021-11-18 13:42 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915/display/dg2: Add CD clock squashing Patchwork
2021-11-18 13:43 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2021-11-18 14:12 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2021-11-19 0:47 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y25lk8io.fsf@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=mika.kahola@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox