public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: ville.syrjala@linux.intel.com, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 11/11] drm/i915: Clean up	.get_aux_clock_divider() functions
Date: Tue, 01 Dec 2015 14:56:12 +0200	[thread overview]
Message-ID: <87h9k249ar.fsf@intel.com> (raw)
In-Reply-To: <1448893432-6978-12-git-send-email-ville.syrjala@linux.intel.com>

On Mon, 30 Nov 2015, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Now that the mess with AUX clock divder rounding is sorted out and
> we have both cdclk and rawclk cached in dev_priv, we can clean up
> the .get_aux_clock_divider() functions a bit.
>
> The main thing here is just calling ilk_get_aux_clock_divider()
> from hsw_get_aux_clock_divider() except for the LPT:H special
> case.
>
> We could got further and call g4x_get_aux_clock_divider() from
> ilk_get_aux_clock_divider() for the PCH ports, but I'm sure Jani
> would object, so leave that be.

Thanks. :)

Reviewed-by: Jani Nikula <jani.nikula@intel.com>


> While at it repeat the comment where the AUX clock comes from
> in ilk_get_aux_clock_divider().
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_dp.c | 28 +++++++++++++++-------------
>  1 file changed, 15 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 39a1689bac7d..df9fc396d18d 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -677,22 +677,29 @@ static uint32_t g4x_get_aux_clock_divider(struct intel_dp *intel_dp, int index)
>  	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
>  	struct drm_i915_private *dev_priv = to_i915(intel_dig_port->base.base.dev);
>  
> +	if (index)
> +		return 0;
> +
>  	/*
>  	 * The clock divider is based off the hrawclk, and would like to run at
> -	 * 2MHz.  So, take the hrawclk value and divide by 2 and use that
> +	 * 2MHz.  So, take the hrawclk value and divide by 2000 and use that
>  	 */
> -	return index ? 0 : DIV_ROUND_CLOSEST(dev_priv->rawclk_freq, 2000);
> +	return DIV_ROUND_CLOSEST(dev_priv->rawclk_freq, 2000);
>  }
>  
>  static uint32_t ilk_get_aux_clock_divider(struct intel_dp *intel_dp, int index)
>  {
>  	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
> -	struct drm_device *dev = intel_dig_port->base.base.dev;
> -	struct drm_i915_private *dev_priv = dev->dev_private;
> +	struct drm_i915_private *dev_priv = to_i915(intel_dig_port->base.base.dev);
>  
>  	if (index)
>  		return 0;
>  
> +	/*
> +	 * The clock divider is based off the cdclk or PCH rawclk, and would
> +	 * like to run at 2MHz.  So, take the cdclk or PCH rawclk value and
> +	 * divide by 2000 and use that
> +	 */
>  	if (intel_dig_port->port == PORT_A)
>  		return DIV_ROUND_CLOSEST(dev_priv->cdclk_freq, 2000);
>  	else
> @@ -702,23 +709,18 @@ static uint32_t ilk_get_aux_clock_divider(struct intel_dp *intel_dp, int index)
>  static uint32_t hsw_get_aux_clock_divider(struct intel_dp *intel_dp, int index)
>  {
>  	struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
> -	struct drm_device *dev = intel_dig_port->base.base.dev;
> -	struct drm_i915_private *dev_priv = dev->dev_private;
> +	struct drm_i915_private *dev_priv = to_i915(intel_dig_port->base.base.dev);
>  
> -	if (intel_dig_port->port == PORT_A) {
> -		if (index)
> -			return 0;
> -		return DIV_ROUND_CLOSEST(dev_priv->cdclk_freq, 2000);
> -	} else if (HAS_PCH_LPT_H(dev_priv)) {
> +	if (intel_dig_port->port != PORT_A && HAS_PCH_LPT_H(dev_priv)) {
>  		/* Workaround for non-ULT HSW */
>  		switch (index) {
>  		case 0: return 63;
>  		case 1: return 72;
>  		default: return 0;
>  		}
> -	} else  {
> -		return index ? 0 : DIV_ROUND_CLOSEST(dev_priv->rawclk_freq, 2000);
>  	}
> +
> +	return ilk_get_aux_clock_divider(intel_dp, index);
>  }
>  
>  static uint32_t skl_get_aux_clock_divider(struct intel_dp *intel_dp, int index)

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

      reply	other threads:[~2015-12-01 12:52 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-30 14:23 [PATCH 00/11] drm/i915: rawclk/cdclk stuff ville.syrjala
2015-11-30 14:23 ` [PATCH 01/11] drm/i915: Fix VBT backlight Hz to PWM conversion for PNV ville.syrjala
2015-12-01 12:19   ` Jani Nikula
2015-11-30 14:23 ` [PATCH 02/11] drm/i915: Fix vbt PWM max setup for CTG ville.syrjala
2015-12-01 12:21   ` Jani Nikula
2015-12-01 12:28     ` Ville Syrjälä
2015-12-01 12:30     ` Jani Nikula
2015-12-04  9:37       ` Daniel Vetter
2015-11-30 14:23 ` [PATCH 03/11] drm/i915: Add HAS_PCH_LPT_H() ville.syrjala
2015-12-01 12:23   ` Jani Nikula
2015-11-30 14:23 ` [PATCH 04/11] drm/i915: Kill duplicated PNV .get_display_clock_speed() assignment ville.syrjala
2015-12-01  8:48   ` Daniel Vetter
2015-12-01 12:23   ` Jani Nikula
2015-11-30 14:23 ` [PATCH 05/11] drm/i915: Round the AUX clock divider to closest on all platforms ville.syrjala
2015-12-01 12:34   ` Jani Nikula
2015-11-30 14:23 ` [PATCH 06/11] drm/i915: Use cached cdclk_freq for PWM calculations ville.syrjala
2015-12-01 12:37   ` Jani Nikula
2015-12-02  9:29     ` Ville Syrjälä
2015-11-30 14:23 ` [PATCH 07/11] drm/i915: Store rawclk_freq in dev_priv ville.syrjala
2015-12-01 12:47   ` Jani Nikula
2015-12-01 13:25     ` Ville Syrjälä
2015-12-01 15:43       ` Jani Nikula
2016-01-12 17:47         ` Ville Syrjälä
2015-11-30 14:23 ` [PATCH 08/11] drm/i915: Rename s/i9xx/g4x/ in DP code ville.syrjala
2015-12-01 12:39   ` Jani Nikula
2015-11-30 14:23 ` [PATCH 09/11] drm/i915: Use g4x_get_aux_clock_divider() for VLV/CHV ville.syrjala
2015-12-01 12:49   ` Jani Nikula
2015-11-30 14:23 ` [PATCH 10/11] drm/i915: Read out hrawclk from CCK on vlv/chv ville.syrjala
2015-11-30 14:23 ` [PATCH 11/11] drm/i915: Clean up .get_aux_clock_divider() functions ville.syrjala
2015-12-01 12:56   ` Jani Nikula [this message]

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=87h9k249ar.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ville.syrjala@linux.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