All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Jani Nikula <jani.nikula@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915: De-magic the PSR AUX message
Date: Wed, 10 Sep 2014 17:02:46 +0300	[thread overview]
Message-ID: <20140910140245.GU4193@intel.com> (raw)
In-Reply-To: <871trjegii.fsf@intel.com>

On Wed, Sep 10, 2014 at 04:45:09PM +0300, Jani Nikula wrote:
> On Wed, 10 Sep 2014, ville.syrjala@linux.intel.com wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >
> > Use pack_aux() to construct the PSR exit DPMS D0 AUX message,
> > and use the defines from dp_dp_helper.h to populate the message
> > contents.
> >
> > Cc: Rodrigo Vivi <rodrigo.vivi@gmail.com>
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/i915_reg.h |  2 --
> >  drivers/gpu/drm/i915/intel_dp.c | 16 +++++++++++-----
> >  2 files changed, 11 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> > index e4d7607..fb60493 100644
> > --- a/drivers/gpu/drm/i915/i915_reg.h
> > +++ b/drivers/gpu/drm/i915/i915_reg.h
> > @@ -2453,9 +2453,7 @@ enum punit_power_well {
> >  
> >  #define EDP_PSR_AUX_CTL(dev)			(EDP_PSR_BASE(dev) + 0x10)
> >  #define EDP_PSR_AUX_DATA1(dev)			(EDP_PSR_BASE(dev) + 0x14)
> > -#define   EDP_PSR_DPCD_COMMAND		0x80060000
> >  #define EDP_PSR_AUX_DATA2(dev)			(EDP_PSR_BASE(dev) + 0x18)
> > -#define   EDP_PSR_DPCD_NORMAL_OPERATION	(1<<24)
> >  #define EDP_PSR_AUX_DATA3(dev)			(EDP_PSR_BASE(dev) + 0x1c)
> >  #define EDP_PSR_AUX_DATA4(dev)			(EDP_PSR_BASE(dev) + 0x20)
> >  #define EDP_PSR_AUX_DATA5(dev)			(EDP_PSR_BASE(dev) + 0x24)
> > diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> > index 81d7681..05bab25 100644
> > --- a/drivers/gpu/drm/i915/intel_dp.c
> > +++ b/drivers/gpu/drm/i915/intel_dp.c
> > @@ -225,7 +225,7 @@ intel_dp_mode_valid(struct drm_connector *connector,
> >  }
> >  
> >  static uint32_t
> > -pack_aux(uint8_t *src, int src_bytes)
> > +pack_aux(const uint8_t *src, int src_bytes)
> >  {
> >  	int	i;
> >  	uint32_t v = 0;
> > @@ -1741,8 +1741,14 @@ static void intel_edp_psr_enable_sink(struct intel_dp *intel_dp)
> >  	struct drm_i915_private *dev_priv = dev->dev_private;
> >  	uint32_t aux_clock_divider;
> >  	int precharge = 0x3;
> > -	int msg_size = 5;       /* Header(4) + Message(1) */
> >  	bool only_standby = false;
> > +	static const uint8_t aux_msg[] = {
> > +		[0] = DP_AUX_NATIVE_WRITE << 4,
> > +		[1] = DP_SET_POWER >> 8,
> > +		[2] = DP_SET_POWER & 0xff,
> > +		[3] = 1 - 1,
> > +		[4] = DP_SET_POWER_D0,
> > +	};
> >  
> >  	aux_clock_divider = intel_dp->get_aux_clock_divider(intel_dp, 0);
> >  
> > @@ -1758,11 +1764,11 @@ static void intel_edp_psr_enable_sink(struct intel_dp *intel_dp)
> >  				   DP_PSR_ENABLE | DP_PSR_MAIN_LINK_ACTIVE);
> >  
> >  	/* Setup AUX registers */
> > -	I915_WRITE(EDP_PSR_AUX_DATA1(dev), EDP_PSR_DPCD_COMMAND);
> > -	I915_WRITE(EDP_PSR_AUX_DATA2(dev), EDP_PSR_DPCD_NORMAL_OPERATION);
> > +	I915_WRITE(EDP_PSR_AUX_DATA1(dev), pack_aux(&aux_msg[0], 4));
> > +	I915_WRITE(EDP_PSR_AUX_DATA2(dev), pack_aux(&aux_msg[4], 1));
> >  	I915_WRITE(EDP_PSR_AUX_CTL(dev),
> >  		   DP_AUX_CH_CTL_TIME_OUT_400us |
> > -		   (msg_size << DP_AUX_CH_CTL_MESSAGE_SIZE_SHIFT) |
> > +		   (5 << DP_AUX_CH_CTL_MESSAGE_SIZE_SHIFT) |
> 
> s/5/ARRAY_SIZE(aux_msg)/ ?

Or just sizeof(). Either is fine by me.

> 
> >  		   (precharge << DP_AUX_CH_CTL_PRECHARGE_2US_SHIFT) |
> >  		   (aux_clock_divider << DP_AUX_CH_CTL_BIT_CLOCK_2X_SHIFT));
> >  }
> > -- 
> > 1.8.5.5
> >
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
> -- 
> Jani Nikula, Intel Open Source Technology Center

-- 
Ville Syrjälä
Intel OTC

  reply	other threads:[~2014-09-10 14:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-10 13:17 [PATCH] drm/i915: De-magic the PSR AUX message ville.syrjala
2014-09-10 13:45 ` Jani Nikula
2014-09-10 14:02   ` Ville Syrjälä [this message]
2014-10-01 13:56 ` [PATCH v2] " ville.syrjala
2014-10-02  7:42   ` Daniel Vetter

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