intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Ville Syrjala <ville.syrjala@linux.intel.com>,
	intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v2 9/9] drm/i915: Split intel_enable_ddi() into	DP and HDMI variants
Date: Fri, 13 Oct 2017 17:20:47 +0300	[thread overview]
Message-ID: <87376nku2o.fsf@intel.com> (raw)
In-Reply-To: <87h8v5o3f4.fsf@intel.com>

On Wed, 11 Oct 2017, Jani Nikula <jani.nikula@linux.intel.com> wrote:
> On Tue, 10 Oct 2017, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
>> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>>
>> Untangle intel_enable_ddi() by splitting it into DP and HDMI specific
>> variants.
>>
>> v2: Keep using intel_ddi_get_encoder_port() for now
>>
>> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
>> ---
>>  drivers/gpu/drm/i915/intel_ddi.c | 86 +++++++++++++++++++++++-----------------
>>  1 file changed, 49 insertions(+), 37 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
>> index 49cf8d9d2bc1..18bf06c7e43f 100644
>> --- a/drivers/gpu/drm/i915/intel_ddi.c
>> +++ b/drivers/gpu/drm/i915/intel_ddi.c
>> @@ -2369,45 +2369,57 @@ void intel_ddi_fdi_post_disable(struct intel_encoder *encoder,
>>  	I915_WRITE(FDI_RX_CTL(PIPE_A), val);
>>  }
>>  
>> -static void intel_enable_ddi(struct intel_encoder *intel_encoder,
>> -			     const struct intel_crtc_state *pipe_config,
>> +static void intel_enable_ddi_dp(struct intel_encoder *encoder,
>> +				const struct intel_crtc_state *crtc_state,
>> +				const struct drm_connector_state *conn_state)
>> +{
>> +	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>> +	struct intel_dp *intel_dp = enc_to_intel_dp(&encoder->base);
>> +	enum port port = intel_ddi_get_encoder_port(encoder);
>> +
>> +	if (port == PORT_A && INTEL_GEN(dev_priv) < 9)
>> +		intel_dp_stop_link_train(intel_dp);

I note that this was only run on type == INTEL_OUTPUT_EDP previously. I
suppose the condition does effectively imply edp, so this is probably
fine. It's just that sometimes I wonder about the amount of background
knowledge like this that we impose on the reader.

>> +
>> +	intel_edp_backlight_on(crtc_state, conn_state);
>> +	intel_psr_enable(intel_dp, crtc_state);
>
> This is broken without edp check.

And fine now with 4d90f2d507ab ("drm/i915: Start tracking PSR state in
crtc state") merged.

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


>
> BR, Jani.
>
>
>> +	intel_edp_drrs_enable(intel_dp, crtc_state);
>> +
>> +	if (crtc_state->has_audio)
>> +		intel_audio_codec_enable(encoder, crtc_state, conn_state);
>> +}
>> +
>> +static void intel_enable_ddi_hdmi(struct intel_encoder *encoder,
>> +				  const struct intel_crtc_state *crtc_state,
>> +				  const struct drm_connector_state *conn_state)
>> +{
>> +	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>> +	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
>> +	enum port port = intel_ddi_get_encoder_port(encoder);
>> +
>> +	intel_hdmi_handle_sink_scrambling(encoder,
>> +					  conn_state->connector,
>> +					  crtc_state->hdmi_high_tmds_clock_ratio,
>> +					  crtc_state->hdmi_scrambling);
>> +
>> +	/* In HDMI/DVI mode, the port width, and swing/emphasis values
>> +	 * are ignored so nothing special needs to be done besides
>> +	 * enabling the port.
>> +	 */
>> +	I915_WRITE(DDI_BUF_CTL(port),
>> +		   dig_port->saved_port_bits | DDI_BUF_CTL_ENABLE);
>> +
>> +	if (crtc_state->has_audio)
>> +		intel_audio_codec_enable(encoder, crtc_state, conn_state);
>> +}
>> +
>> +static void intel_enable_ddi(struct intel_encoder *encoder,
>> +			     const struct intel_crtc_state *crtc_state,
>>  			     const struct drm_connector_state *conn_state)
>>  {
>> -	struct drm_encoder *encoder = &intel_encoder->base;
>> -	struct drm_i915_private *dev_priv = to_i915(encoder->dev);
>> -	enum port port = intel_ddi_get_encoder_port(intel_encoder);
>> -	int type = intel_encoder->type;
>> -
>> -	if (type == INTEL_OUTPUT_HDMI) {
>> -		struct intel_digital_port *intel_dig_port =
>> -			enc_to_dig_port(encoder);
>> -		bool clock_ratio = pipe_config->hdmi_high_tmds_clock_ratio;
>> -		bool scrambling = pipe_config->hdmi_scrambling;
>> -
>> -		intel_hdmi_handle_sink_scrambling(intel_encoder,
>> -						  conn_state->connector,
>> -						  clock_ratio, scrambling);
>> -
>> -		/* In HDMI/DVI mode, the port width, and swing/emphasis values
>> -		 * are ignored so nothing special needs to be done besides
>> -		 * enabling the port.
>> -		 */
>> -		I915_WRITE(DDI_BUF_CTL(port),
>> -			   intel_dig_port->saved_port_bits |
>> -			   DDI_BUF_CTL_ENABLE);
>> -	} else if (type == INTEL_OUTPUT_EDP) {
>> -		struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
>> -
>> -		if (port == PORT_A && INTEL_GEN(dev_priv) < 9)
>> -			intel_dp_stop_link_train(intel_dp);
>> -
>> -		intel_edp_backlight_on(pipe_config, conn_state);
>> -		intel_psr_enable(intel_dp, pipe_config);
>> -		intel_edp_drrs_enable(intel_dp, pipe_config);
>> -	}
>> -
>> -	if (pipe_config->has_audio)
>> -		intel_audio_codec_enable(intel_encoder, pipe_config, conn_state);
>> +	if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI))
>> +		intel_enable_ddi_hdmi(encoder, crtc_state, conn_state);
>> +	else
>> +		intel_enable_ddi_dp(encoder, crtc_state, conn_state);
>>  }
>>  
>>  static void intel_disable_ddi_dp(struct intel_encoder *encoder,

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

  reply	other threads:[~2017-10-13 14:21 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-10 12:11 [PATCH v2 0/9] drm/i915: Cleaner DDI DP vs. HDMI split Ville Syrjala
2017-10-10 12:11 ` [PATCH v2 1/9] drm/i915: Dump 'output_types' in crtc state dump Ville Syrjala
2017-10-11 19:50   ` Jani Nikula
2017-10-10 12:12 ` [PATCH v2 2/9] drm/i915: Extract intel_ddi_clk_disable() Ville Syrjala
2017-10-11 19:52   ` Jani Nikula
2017-10-10 12:12 ` [PATCH v2 3/9] drm/i915: Extract intel_disable_ddi_buf() Ville Syrjala
2017-10-11 19:53   ` Jani Nikula
2017-10-10 12:12 ` [PATCH 4/9] drm/i915: Inline the required bits of intel_ddi_post_disable() into intel_ddi_fdi_post_disable() Ville Syrjala
2017-10-10 12:12 ` [PATCH v2 5/9] drm/i915: Split intel_ddi_post_disable() into DP vs. HDMI variants Ville Syrjala
2017-10-10 12:12 ` [PATCH 6/9] drm/i915: Remove useless eDP check from intel_ddi_pre_enable_dp() Ville Syrjala
2017-10-10 12:12 ` [PATCH 7/9] drm/i915: Split intel_disable_ddi() into DP vs. HDMI variants Ville Syrjala
2017-10-11 20:03   ` Jani Nikula
2017-10-12  9:49     ` Ville Syrjälä
2017-10-13 14:13       ` Jani Nikula
2017-10-10 12:12 ` [PATCH v2 8/9] drm/i915: Plumb crtc_state etc. directly to intel_ddi_pre_enable_{dp, hdmi}() Ville Syrjala
2017-10-13 14:25   ` Jani Nikula
2017-10-10 12:12 ` [PATCH v2 9/9] drm/i915: Split intel_enable_ddi() into DP and HDMI variants Ville Syrjala
2017-10-11 20:06   ` Jani Nikula
2017-10-13 14:20     ` Jani Nikula [this message]
2017-10-13 18:10       ` Ville Syrjälä
2017-10-10 13:07 ` ✗ Fi.CI.BAT: warning for drm/i915: Cleaner DDI DP vs. HDMI split Patchwork
2017-10-10 13:21   ` Ville Syrjälä
2017-10-13 17:03 ` ✓ Fi.CI.BAT: success " Patchwork
2017-10-13 18:16   ` Ville Syrjälä
2017-10-13 18:49     ` Jani Nikula
2017-10-14  0:10 ` ✗ Fi.CI.IGT: 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=87376nku2o.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;
as well as URLs for NNTP newsgroup(s).