intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Paulo Zanoni <paulo.r.zanoni@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 2/5] drm/i915/icl: store the port type for TC ports
Date: Wed, 25 Jul 2018 10:03:51 -0700	[thread overview]
Message-ID: <20180725170351.GM16907@intel.com> (raw)
In-Reply-To: <20180725164118.GI16907@intel.com>

On Wed, Jul 25, 2018 at 09:41:18AM -0700, Rodrigo Vivi wrote:
> On Tue, Jul 24, 2018 at 05:28:10PM -0700, Paulo Zanoni wrote:
> > The type is detected based on the live status bits. Once detected,
> > it's not supposed to be changed, so we have some sanity checks for
> > that.
> > 
> > v2: Rebase.
> > 
> > Cc: Animesh Manna <animesh.manna@intel.com>
> > Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> > Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_display.h |  7 +++++
> >  drivers/gpu/drm/i915/intel_dp.c      | 40 ++++++++++++++++++++++++++--
> >  drivers/gpu/drm/i915/intel_drv.h     |  1 +
> >  3 files changed, 46 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_display.h b/drivers/gpu/drm/i915/intel_display.h
> > index 9292001cdd14..0a79a46d5805 100644
> > --- a/drivers/gpu/drm/i915/intel_display.h
> > +++ b/drivers/gpu/drm/i915/intel_display.h
> > @@ -137,6 +137,13 @@ enum tc_port {
> >  	I915_MAX_TC_PORTS
> >  };
> >  
> > +enum tc_port_type {
> > +	TC_PORT_UNKNOWN = 0,
> > +	TC_PORT_TYPEC,
> > +	TC_PORT_TBT,
> > +	TC_PORT_LEGACY,
> > +};
> > +
> >  enum dpio_channel {
> >  	DPIO_CH0,
> >  	DPIO_CH1
> > diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> > index 998d698788f9..90c5ba6b222b 100644
> > --- a/drivers/gpu/drm/i915/intel_dp.c
> > +++ b/drivers/gpu/drm/i915/intel_dp.c
> > @@ -4594,6 +4594,38 @@ static bool icl_combo_port_connected(struct drm_i915_private *dev_priv,
> >  	return I915_READ(SDEISR) & SDE_DDI_HOTPLUG_ICP(port);
> >  }
> >  
> > +static void icl_update_tc_port_type(struct drm_i915_private *dev_priv,
> > +				    struct intel_digital_port *intel_dig_port,
> > +				    bool is_legacy, bool is_typec, bool is_tbt)
> > +{
> > +	enum port port = intel_dig_port->base.port;
> > +	enum tc_port_type old_type = intel_dig_port->tc_type;
> > +	const char *type_str;
> > +
> > +	WARN_ON(is_legacy + is_typec + is_tbt != 1);
> > +
> > +	if (is_legacy) {
> > +		intel_dig_port->tc_type = TC_PORT_LEGACY;
> > +		type_str = "legacy";
> > +	} else if (is_typec) {
> > +		intel_dig_port->tc_type = TC_PORT_TYPEC;
> > +		type_str = "typec";
> > +	} else if (is_tbt) {
> > +		intel_dig_port->tc_type = TC_PORT_TBT;
> > +		type_str = "tbt";
> > +	} else {
> > +		return;
> > +	}
> 
> nip: switch seems more appropriate for this block.
> 
> Anyway:

ops... ignore this part above... arguments come separated...
coffee didn't kick off yet today :P

> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> 
> > +
> > +	/* Types are not supposed to be changed at runtime. */
> > +	WARN_ON(old_type != TC_PORT_UNKNOWN &&
> > +		old_type != intel_dig_port->tc_type);
> > +
> > +	if (old_type != intel_dig_port->tc_type)
> > +		DRM_DEBUG_KMS("Port %c has TC type %s\n", port_name(port),
> > +			      type_str);
> > +}
> > +
> >  static bool icl_tc_port_connected(struct drm_i915_private *dev_priv,
> >  				  struct intel_digital_port *intel_dig_port)
> >  {
> > @@ -4612,9 +4644,13 @@ static bool icl_tc_port_connected(struct drm_i915_private *dev_priv,
> >  	is_typec = dpsp & TC_LIVE_STATE_TC(tc_port);
> >  	is_tbt = dpsp & TC_LIVE_STATE_TBT(tc_port);
> >  
> > -	WARN_ON(is_legacy + is_typec + is_tbt > 1);
> > +	if (!is_legacy && !is_typec && !is_tbt)
> > +		return false;
> > +
> > +	icl_update_tc_port_type(dev_priv, intel_dig_port, is_legacy, is_typec,
> > +				is_tbt);
> >  
> > -	return is_legacy || is_typec || is_tbt;
> > +	return true;
> >  }
> >  
> >  static bool icl_digital_port_connected(struct intel_encoder *encoder)
> > diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> > index c275f91244a6..5e225d8ba09a 100644
> > --- a/drivers/gpu/drm/i915/intel_drv.h
> > +++ b/drivers/gpu/drm/i915/intel_drv.h
> > @@ -1164,6 +1164,7 @@ struct intel_digital_port {
> >  	bool release_cl2_override;
> >  	uint8_t max_lanes;
> >  	enum intel_display_power_domain ddi_io_power_domain;
> > +	enum tc_port_type tc_type;
> >  
> >  	void (*write_infoframe)(struct drm_encoder *encoder,
> >  				const struct intel_crtc_state *crtc_state,
> > -- 
> > 2.17.1
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2018-07-25 17:04 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-25  0:28 [PATCH 0/5] Remaining ICL display patches, v2 Paulo Zanoni
2018-07-25  0:28 ` [PATCH] drm/i915/icl: implement icl_digital_port_connected() Paulo Zanoni
2018-07-25  1:19   ` Lucas De Marchi
2018-07-25 16:59     ` Paulo Zanoni
2018-07-25 17:27     ` Paulo Zanoni
2018-07-25 17:59       ` Paulo Zanoni
2018-07-25 20:04         ` Lucas De Marchi
2018-07-25 19:59   ` [PATCH v4 1/5] " Paulo Zanoni
2018-07-25  0:28 ` [PATCH 2/5] drm/i915/icl: store the port type for TC ports Paulo Zanoni
2018-07-25 16:41   ` Rodrigo Vivi
2018-07-25 17:03     ` Rodrigo Vivi [this message]
2018-07-25  0:28 ` [PATCH 3/5] drm/i915/icl: Update FIA supported lane count for hpd Paulo Zanoni
2018-07-25 16:52   ` Rodrigo Vivi
2018-07-25 17:12     ` Paulo Zanoni
2018-07-25 17:13     ` Rodrigo Vivi
2018-07-25  0:28 ` [PATCH 4/5] drm/i915/icl: program MG_DP_MODE Paulo Zanoni
2018-07-25  0:28 ` [PATCH 5/5] drm/i915/icl: toggle PHY clock gating around link training Paulo Zanoni
2018-07-25  0:52 ` ✗ Fi.CI.SPARSE: warning for drm/i915/icl: implement icl_digital_port_connected() (rev2) Patchwork
2018-07-25  1:09 ` ✓ Fi.CI.BAT: success " Patchwork
2018-07-25  2:08 ` ✓ Fi.CI.IGT: " Patchwork
2018-07-25 11:07 ` ✓ Fi.CI.BAT: " Patchwork
2018-07-25 12:29 ` ✓ Fi.CI.IGT: " Patchwork
2018-07-25 20:23 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915/icl: implement icl_digital_port_connected() (rev3) Patchwork
2018-07-25 20:26 ` ✗ Fi.CI.SPARSE: " Patchwork
2018-07-25 20:46 ` ✗ Fi.CI.BAT: failure " 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=20180725170351.GM16907@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --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;
as well as URLs for NNTP newsgroup(s).