From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: intel-gfx@lists.freedesktop.org, Paulo Zanoni <paulo.r.zanoni@intel.com>
Subject: Re: [PATCH 1/2] drm/i915/cnl: simplify cnl_procmon_values handling
Date: Tue, 22 Aug 2017 17:44:26 +0300 [thread overview]
Message-ID: <20170822144426.GG4914@intel.com> (raw)
In-Reply-To: <20170822000356.17330-1-rodrigo.vivi@intel.com>
On Mon, Aug 21, 2017 at 05:03:55PM -0700, Rodrigo Vivi wrote:
> From: Paulo Zanoni <paulo.r.zanoni@intel.com>
>
> Make it a little less magical and a little simpler and more hardcoded
> so we don't end up with an array that's composed mostly of empty
> entries.
>
> v2: Add an enum for the voltage+register values (Ville).
>
> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
For the series
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
> drivers/gpu/drm/i915/intel_runtime_pm.c | 58 +++++++++++++++++++++------------
> 1 file changed, 37 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_runtime_pm.c b/drivers/gpu/drm/i915/intel_runtime_pm.c
> index b66d8e136aa3..b7f4fbe7ae0d 100644
> --- a/drivers/gpu/drm/i915/intel_runtime_pm.c
> +++ b/drivers/gpu/drm/i915/intel_runtime_pm.c
> @@ -2707,24 +2707,27 @@ void bxt_display_core_uninit(struct drm_i915_private *dev_priv)
> usleep_range(10, 30); /* 10 us delay per Bspec */
> }
>
> -#define CNL_PROCMON_IDX(val) \
> - (((val) & (PROCESS_INFO_MASK | VOLTAGE_INFO_MASK)) >> VOLTAGE_INFO_SHIFT)
> -#define NUM_CNL_PROCMON \
> - (CNL_PROCMON_IDX(VOLTAGE_INFO_MASK | PROCESS_INFO_MASK) + 1)
> +enum {
> + PROCMON_0_85V_DOT_0,
> + PROCMON_0_95V_DOT_0,
> + PROCMON_0_95V_DOT_1,
> + PROCMON_1_05V_DOT_0,
> + PROCMON_1_05V_DOT_1,
> +};
>
> static const struct cnl_procmon {
> u32 dw1, dw9, dw10;
> -} cnl_procmon_values[NUM_CNL_PROCMON] = {
> - [CNL_PROCMON_IDX(VOLTAGE_INFO_0_85V | PROCESS_INFO_DOT_0)] =
> - { .dw1 = 0x00 << 16, .dw9 = 0x62AB67BB, .dw10 = 0x51914F96, },
> - [CNL_PROCMON_IDX(VOLTAGE_INFO_0_95V | PROCESS_INFO_DOT_0)] =
> - { .dw1 = 0x00 << 16, .dw9 = 0x86E172C7, .dw10 = 0x77CA5EAB, },
> - [CNL_PROCMON_IDX(VOLTAGE_INFO_0_95V | PROCESS_INFO_DOT_1)] =
> - { .dw1 = 0x00 << 16, .dw9 = 0x93F87FE1, .dw10 = 0x8AE871C5, },
> - [CNL_PROCMON_IDX(VOLTAGE_INFO_1_05V | PROCESS_INFO_DOT_0)] =
> - { .dw1 = 0x00 << 16, .dw9 = 0x98FA82DD, .dw10 = 0x89E46DC1, },
> - [CNL_PROCMON_IDX(VOLTAGE_INFO_1_05V | PROCESS_INFO_DOT_1)] =
> - { .dw1 = 0x44 << 16, .dw9 = 0x9A00AB25, .dw10 = 0x8AE38FF1, },
> +} cnl_procmon_values[] = {
> + [PROCMON_0_85V_DOT_0] =
> + { .dw1 = 0x00000000, .dw9 = 0x62AB67BB, .dw10 = 0x51914F96, },
> + [PROCMON_0_95V_DOT_0] =
> + { .dw1 = 0x00000000, .dw9 = 0x86E172C7, .dw10 = 0x77CA5EAB, },
> + [PROCMON_0_95V_DOT_1] =
> + { .dw1 = 0x00000000, .dw9 = 0x93F87FE1, .dw10 = 0x8AE871C5, },
> + [PROCMON_1_05V_DOT_0] =
> + { .dw1 = 0x00000000, .dw9 = 0x98FA82DD, .dw10 = 0x89E46DC1, },
> + [PROCMON_1_05V_DOT_1] =
> + { .dw1 = 0x00440000, .dw9 = 0x9A00AB25, .dw10 = 0x8AE38FF1, },
> };
>
> static void cnl_display_core_init(struct drm_i915_private *dev_priv, bool resume)
> @@ -2747,9 +2750,25 @@ static void cnl_display_core_init(struct drm_i915_private *dev_priv, bool resume
> I915_WRITE(CHICKEN_MISC_2, val);
>
> val = I915_READ(CNL_PORT_COMP_DW3);
> - procmon = &cnl_procmon_values[CNL_PROCMON_IDX(val)];
> -
> - WARN_ON(procmon->dw10 == 0);
> + switch (val & (PROCESS_INFO_MASK | VOLTAGE_INFO_MASK)) {
> + default:
> + MISSING_CASE(val);
> + case VOLTAGE_INFO_0_85V | PROCESS_INFO_DOT_0:
> + procmon = &cnl_procmon_values[PROCMON_0_85V_DOT_0];
> + break;
> + case VOLTAGE_INFO_0_95V | PROCESS_INFO_DOT_0:
> + procmon = &cnl_procmon_values[PROCMON_0_95V_DOT_0];
> + break;
> + case VOLTAGE_INFO_0_95V | PROCESS_INFO_DOT_1:
> + procmon = &cnl_procmon_values[PROCMON_0_95V_DOT_1];
> + break;
> + case VOLTAGE_INFO_1_05V | PROCESS_INFO_DOT_0:
> + procmon = &cnl_procmon_values[PROCMON_1_05V_DOT_0];
> + break;
> + case VOLTAGE_INFO_1_05V | PROCESS_INFO_DOT_1:
> + procmon = &cnl_procmon_values[PROCMON_1_05V_DOT_1];
> + break;
> + }
>
> val = I915_READ(CNL_PORT_COMP_DW1);
> val &= ~((0xff << 16) | 0xff);
> @@ -2784,9 +2803,6 @@ static void cnl_display_core_init(struct drm_i915_private *dev_priv, bool resume
> gen9_dbuf_enable(dev_priv);
> }
>
> -#undef CNL_PROCMON_IDX
> -#undef NUM_CNL_PROCMON
> -
> static void cnl_display_core_uninit(struct drm_i915_private *dev_priv)
> {
> struct i915_power_domains *power_domains = &dev_priv->power_domains;
> --
> 2.13.2
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Ville Syrjälä
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-08-22 14:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-22 0:03 [PATCH 1/2] drm/i915/cnl: simplify cnl_procmon_values handling Rodrigo Vivi
2017-08-22 0:03 ` [PATCH 2/2] drm/i915/cnl: extract cnl_set_procmon_ref_values Rodrigo Vivi
2017-08-22 0:46 ` ✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915/cnl: simplify cnl_procmon_values handling Patchwork
2017-08-22 14:44 ` Ville Syrjälä [this message]
2017-08-22 16:24 ` [PATCH 1/2] " Rodrigo Vivi
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=20170822144426.GG4914@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=paulo.r.zanoni@intel.com \
--cc=rodrigo.vivi@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 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.