From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Mika Kahola <mika.kahola@intel.com>
Cc: intel-gfx@lists.freedesktop.org, Paulo Zanoni <paulo.r.zanoni@intel.com>
Subject: Re: [PATCH 10/13] drm/i915/cnl: Unify dvfs level selection.
Date: Thu, 5 Oct 2017 07:59:47 -0700 [thread overview]
Message-ID: <20171005145947.hhnzxchf3jevj5dr@intel.com> (raw)
In-Reply-To: <1507123257.3274.51.camel@intel.com>
On Wed, Oct 04, 2017 at 01:20:57PM +0000, Mika Kahola wrote:
> On Tue, 2017-10-03 at 00:06 -0700, Rodrigo Vivi wrote:
> > When port clock is zero or undefined we base our
> > calculation on cdclk. So, same function can be used
> > for port clock == 0 now that we have the same default "2".
> >
> > v2: s/get/new: When documenting "get" sounded ambiguous
> > because we could be getting the current level at pcode.
> >
> > Cc: Mika Kahola <mika.kahola@intel.com>
> > Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
> > Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > ---
> > drivers/gpu/drm/i915/intel_cdclk.c | 28 +++++++++++++----------
> > -----
> > drivers/gpu/drm/i915/intel_dpll_mgr.c | 12 +-----------
> > drivers/gpu/drm/i915/intel_drv.h | 1 +
> > 3 files changed, 15 insertions(+), 26 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_cdclk.c
> > b/drivers/gpu/drm/i915/intel_cdclk.c
> > index 7e9c4444c844..c62d6e752fb7 100644
> > --- a/drivers/gpu/drm/i915/intel_cdclk.c
> > +++ b/drivers/gpu/drm/i915/intel_cdclk.c
> > @@ -1535,12 +1535,22 @@ void cnl_dvfs_post_change(struct
> > drm_i915_private *dev_priv, int level)
> > mutex_unlock(&dev_priv->rps.hw_lock);
> > }
> >
> > +int cnl_dvfs_new_level(int cdclk, int portclk)
> > +{
> > + if (cdclk == 168000 && portclk <= 594000)
> > + return 0;
> > + else if (cdclk == 336000 && portclk <= 594000)
> > + return 1;
> > + else
> > + return 2;
> > +}
> > +
> Maybe we could leave the function name as cnl_get_dvfs_level()?
> The original one is stripped down later in this patch.
Since I was exporting I decided to use the same standard as others
and move dvfs back a bit
so cnl_dvfs_get_level...
But also when I was documenting on the last patch I noticed
that "get level" is kind of ambiguous... which level? the current
or the new? the more natural is current, but this function also
get the new desired/needed.
But I'm open to other suggestions that fix the ambiguity.
>
> > static void cnl_set_cdclk(struct drm_i915_private *dev_priv,
> > const struct intel_cdclk_state
> > *cdclk_state)
> > {
> > int cdclk = cdclk_state->cdclk;
> > int vco = cdclk_state->vco;
> > - u32 val, divider, pcu_ack;
> > + u32 val, divider, level;
> >
> > if (cnl_dvfs_pre_change(dev_priv))
> > return;
> > @@ -1561,19 +1571,6 @@ static void cnl_set_cdclk(struct
> > drm_i915_private *dev_priv,
> > break;
> > }
> >
> > - switch (cdclk) {
> > - case 168000:
> > - pcu_ack = 0;
> > - break;
> > - case 336000:
> > - pcu_ack = 1;
> > - break;
> > - case 528000:
> > - default:
> > - pcu_ack = 2;
> > - break;
> > - }
> > -
> > if (dev_priv->cdclk.hw.vco != 0 &&
> > dev_priv->cdclk.hw.vco != vco)
> > cnl_cdclk_pll_disable(dev_priv);
> > @@ -1590,7 +1587,8 @@ static void cnl_set_cdclk(struct
> > drm_i915_private *dev_priv,
> > I915_WRITE(CDCLK_CTL, val);
> >
> > /* inform PCU of the change */
> > - cnl_dvfs_post_change(dev_priv, pcu_ack);
> > + level = cnl_dvfs_new_level(cdclk, 0);
> > + cnl_dvfs_post_change(dev_priv, level);
> >
> > intel_update_cdclk(dev_priv);
> > }
> > diff --git a/drivers/gpu/drm/i915/intel_dpll_mgr.c
> > b/drivers/gpu/drm/i915/intel_dpll_mgr.c
> > index a71a6c396bbd..0dddbd3a7a97 100644
> > --- a/drivers/gpu/drm/i915/intel_dpll_mgr.c
> > +++ b/drivers/gpu/drm/i915/intel_dpll_mgr.c
> > @@ -1966,16 +1966,6 @@ static const struct intel_dpll_mgr bxt_pll_mgr
> > = {
> > .dump_hw_state = bxt_dump_hw_state,
> > };
> >
> > -static int cnl_get_dvfs_level(int cdclk, int portclk)
> > -{
> > - if (cdclk == 168000 && portclk <= 594000)
> > - return 0;
> > - else if (cdclk == 336000 && portclk <= 594000)
> > - return 1;
> > - else
> > - return 2;
> > -}
> > -
> > static void cnl_ddi_pll_enable(struct drm_i915_private *dev_priv,
> > struct intel_shared_dpll *pll)
> > {
> > @@ -2044,7 +2034,7 @@ static void cnl_ddi_pll_enable(struct
> > drm_i915_private *dev_priv,
> > if (ret == 0) {
> > cdclk = dev_priv->cdclk.hw.cdclk;
> > portclk = intel_ddi_port_clock(dev_priv, pll->id);
> > - level = cnl_get_dvfs_level(cdclk, portclk);
> > + level = cnl_dvfs_new_level(cdclk, portclk);
> > cnl_dvfs_post_change(dev_priv, level);
> > }
> >
> > diff --git a/drivers/gpu/drm/i915/intel_drv.h
> > b/drivers/gpu/drm/i915/intel_drv.h
> > index 934ccf17f8ab..dec11d7b15ab 100644
> > --- a/drivers/gpu/drm/i915/intel_drv.h
> > +++ b/drivers/gpu/drm/i915/intel_drv.h
> > @@ -1325,6 +1325,7 @@ void cnl_init_cdclk(struct drm_i915_private
> > *dev_priv);
> > void cnl_uninit_cdclk(struct drm_i915_private *dev_priv);
> > int cnl_dvfs_pre_change(struct drm_i915_private *dev_priv);
> > void cnl_dvfs_post_change(struct drm_i915_private *dev_priv, int
> > level);
> > +int cnl_dvfs_new_level(int cdclk, int portclk);
> > void bxt_init_cdclk(struct drm_i915_private *dev_priv);
> > void bxt_uninit_cdclk(struct drm_i915_private *dev_priv);
> > void intel_init_cdclk_hooks(struct drm_i915_private *dev_priv);
> --
> Mika Kahola - Intel OTC
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2017-10-05 14:59 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-03 7:06 [PATCH 00/13] DVFS v2 Rodrigo Vivi
2017-10-03 7:06 ` [PATCH 01/13] drm/i915: Let's use more enum intel_dpll_id pll_id Rodrigo Vivi
2017-10-03 9:33 ` Mika Kahola
2017-10-03 7:06 ` [PATCH 02/13] drm/i915/cnl: Extract cnl_calc_pll_link following bxt style Rodrigo Vivi
2017-10-03 10:00 ` Mika Kahola
2017-10-03 7:06 ` [PATCH 03/13] drm/i915/skl: Extract skl_calc_pll_link following bxt, cnl style Rodrigo Vivi
2017-10-03 13:18 ` Mika Kahola
2017-10-03 7:06 ` [PATCH 04/13] drm/i915: Unify and export gen9+ port_clock calculation Rodrigo Vivi
2017-10-04 6:39 ` Mika Kahola
2017-10-04 19:38 ` Rodrigo Vivi
2017-10-04 21:26 ` Rodrigo Vivi
2017-10-05 10:49 ` Mika Kahola
2017-10-03 7:06 ` [PATCH 05/13] drm/i915/cnl: extract cnl_dvfs_{pre, post}_change Rodrigo Vivi
2017-10-04 21:58 ` Ausmus, James
2017-10-04 22:05 ` Manasi Navare
2017-10-03 7:06 ` [PATCH 06/13] drm/i915/cnl: Expose DVFS change functions Rodrigo Vivi
2017-10-04 22:07 ` Manasi Navare
2017-10-03 7:06 ` [PATCH 07/13] drm/i915/cnl: DVFS for PLL enabling Rodrigo Vivi
2017-10-04 22:22 ` Manasi Navare
2017-10-17 15:44 ` Ville Syrjälä
2017-10-17 16:47 ` Rodrigo Vivi
2017-10-17 17:23 ` Ville Syrjälä
2017-10-17 17:45 ` Rodrigo Vivi
2017-10-17 18:02 ` Ville Syrjälä
2017-10-17 20:36 ` Ville Syrjälä
2017-10-17 23:23 ` Rodrigo Vivi
2017-10-18 13:23 ` Ville Syrjälä
2017-10-03 7:06 ` [PATCH 08/13] drm/i915/cnl: DVFS for PLL disabling Rodrigo Vivi
2017-10-04 22:23 ` Manasi Navare
2017-10-03 7:06 ` [PATCH 09/13] drm/i915/cnl: Invert dvfs default level Rodrigo Vivi
2017-10-04 9:46 ` Mika Kahola
2017-10-04 19:36 ` Rodrigo Vivi
2017-10-04 22:40 ` Manasi Navare
2017-10-04 23:03 ` Manasi Navare
2017-10-03 7:06 ` [PATCH 10/13] drm/i915/cnl: Unify dvfs level selection Rodrigo Vivi
2017-10-04 13:20 ` Mika Kahola
2017-10-05 14:59 ` Rodrigo Vivi [this message]
2017-10-18 18:22 ` Paulo Zanoni
2017-10-03 7:06 ` [PATCH 11/13] drm/i915/cnl: Only request voltage frequency switching when needed Rodrigo Vivi
2017-10-05 12:07 ` Mika Kahola
2017-10-05 15:00 ` Rodrigo Vivi
2017-10-03 7:06 ` [PATCH 12/13] drm/i915/cnl: When disabling pll put dvfs back to cdclk requirement Rodrigo Vivi
2017-10-03 7:06 ` [PATCH 13/13] drm/i915: Make DVFS more generic and document them Rodrigo Vivi
2017-10-03 7:42 ` ✓ Fi.CI.BAT: success for DVFS v2 Patchwork
2017-10-03 9:07 ` ✗ Fi.CI.IGT: warning " Patchwork
2017-10-03 19:51 ` ✓ Fi.CI.BAT: success " 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=20171005145947.hhnzxchf3jevj5dr@intel.com \
--to=rodrigo.vivi@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=mika.kahola@intel.com \
--cc=paulo.r.zanoni@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