All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ander Conselvan De Oliveira <conselvan2@gmail.com>
To: Libin Yang <libin.yang@linux.intel.com>,
	intel-gfx@lists.freedesktop.org, jani.nikula@linux.intel.com,
	daniel.vetter@intel.com, ville.syrjala@linux.intel.com
Cc: Dave Airlie <airlied@redhat.com>
Subject: Re: [V2 PATCH 2/2] drm/i915: start adding dp mst audio
Date: Mon, 23 Nov 2015 10:55:42 +0200	[thread overview]
Message-ID: <1448268942.2699.5.camel@gmail.com> (raw)
In-Reply-To: <5652788D.2010704@linux.intel.com>

On Mon, 2015-11-23 at 10:23 +0800, Libin Yang wrote:
> On 11/19/2015 07:07 PM, Ander Conselvan De Oliveira wrote:
> > (Cc'ing Paulo for the audio power domain question)
> > 
> > On Wed, 2015-11-11 at 13:33 +0800, libin.yang@linux.intel.com wrote:
> > > From: Libin Yang <libin.yang@linux.intel.com>
> > > 
> > > This patch adds support for DP MST audio in i915.
> > > 
> > > Enable audio codec when DP MST is enabled if has_audio flag is set.
> > > Disable audio codec when DP MST is disabled if has_audio flag is set.
> > > 
> > > Signed-off-by: Libin Yang <libin.yang@linux.intel.com>
> > > Signed-off-by: Dave Airlie <airlied@redhat.com>
> > > ---
> > >   drivers/gpu/drm/i915/i915_debugfs.c | 14 ++++++++++++++
> > >   drivers/gpu/drm/i915/intel_audio.c  |  9 ++++++---
> > >   drivers/gpu/drm/i915/intel_dp_mst.c | 25 +++++++++++++++++++++++++
> > >   3 files changed, 45 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/drivers/gpu/drm/i915/i915_debugfs.c
> > > b/drivers/gpu/drm/i915/i915_debugfs.c
> > > index 5659d4c..38c7a5d 100644
> > > --- a/drivers/gpu/drm/i915/i915_debugfs.c
> > > +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> > > @@ -2873,6 +2873,18 @@ static void intel_dp_info(struct seq_file *m,
> > >   		intel_panel_info(m, &intel_connector->panel);
> > >   }
> > > 
> > > +static void intel_dp_mst_info(struct seq_file *m,
> > > +			  struct intel_connector *intel_connector)
> > > +{
> > > +	struct intel_encoder *intel_encoder = intel_connector->encoder;
> > > +	struct intel_dp_mst_encoder *intel_mst =
> > > +		enc_to_mst(&intel_encoder->base);
> > > +	struct intel_digital_port *intel_dig_port = intel_mst->primary;
> > > +	struct intel_dp *intel_dp = &intel_dig_port->dp;
> > > +
> > > +	seq_printf(m, "\taudio support: %s\n",
> > > drm_dp_mst_port_has_audio(&intel_dp->mst_mgr, intel_connector->port) ?
> > > "yes" :
> > > "no");
> > 
> > Too much going on in just one line. You can replace the ternary operator
> > with
> > yesno(). You could also add a has_audio bool:
> > 
> > bool has_audio = drm_dp_mst_port_has_audio(...);
> > seq_printf(..., yesno(has_audio));
> 
> Get it. Thanks.
> 
> > 
> > 
> > > +}
> > > +
> > >   static void intel_hdmi_info(struct seq_file *m,
> > >   			    struct intel_connector *intel_connector)
> > >   {
> > > @@ -2916,6 +2928,8 @@ static void intel_connector_info(struct seq_file *m,
> > >   			intel_hdmi_info(m, intel_connector);
> > >   		else if (intel_encoder->type == INTEL_OUTPUT_LVDS)
> > >   			intel_lvds_info(m, intel_connector);
> > > +		else if (intel_encoder->type == INTEL_OUTPUT_DP_MST)
> > > +			intel_dp_mst_info(m, intel_connector);
> > >   	}
> > > 
> > >   	seq_printf(m, "\tmodes:\n");
> > > diff --git a/drivers/gpu/drm/i915/intel_audio.c
> > > b/drivers/gpu/drm/i915/intel_audio.c
> > > index 63d4706..07b2aa6 100644
> > > --- a/drivers/gpu/drm/i915/intel_audio.c
> > > +++ b/drivers/gpu/drm/i915/intel_audio.c
> > > @@ -262,7 +262,8 @@ static void hsw_audio_codec_disable(struct
> > > intel_encoder
> > > *encoder)
> > >   	tmp |= AUD_CONFIG_N_PROG_ENABLE;
> > >   	tmp &= ~AUD_CONFIG_UPPER_N_MASK;
> > >   	tmp &= ~AUD_CONFIG_LOWER_N_MASK;
> > > -	if (intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DISPLAYPORT))
> > > +	if (intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DISPLAYPORT) ||
> > > +		intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DP_MST))
> > 
> > The second line should be aligned with '('.
> 
> OK, I see.
> 
> > 
> > >   		tmp |= AUD_CONFIG_N_VALUE_INDEX;
> > >   	I915_WRITE(HSW_AUD_CFG(pipe), tmp);
> > > 
> > > @@ -478,7 +479,8 @@ static void ilk_audio_codec_enable(struct
> > > drm_connector
> > > *connector,
> > >   	tmp &= ~AUD_CONFIG_N_VALUE_INDEX;
> > >   	tmp &= ~AUD_CONFIG_N_PROG_ENABLE;
> > >   	tmp &= ~AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK;
> > > -	if (intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DISPLAYPORT))
> > > +	if (intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DISPLAYPORT) ||
> > > +		intel_pipe_has_type(intel_crtc, INTEL_OUTPUT_DP_MST))
> > 
> > Same here.
> > 
> > >   		tmp |= AUD_CONFIG_N_VALUE_INDEX;
> > >   	else
> > >   		tmp |= audio_config_hdmi_pixel_clock(adjusted_mode);
> > > @@ -516,7 +518,8 @@ void intel_audio_codec_enable(struct intel_encoder
> > > *intel_encoder)
> > > 
> > >   	/* ELD Conn_Type */
> > >   	connector->eld[5] &= ~(3 << 2);
> > > -	if (intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT))
> > > +	if (intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT) ||
> > > +		intel_pipe_has_type(crtc, INTEL_OUTPUT_DP_MST))
> > >   		connector->eld[5] |= (1 << 2);
> > 
> > And here.
> > 
> > > 
> > >   	connector->eld[6] = drm_av_sync_delay(connector, adjusted_mode)
> > > / 2;
> > > diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c
> > > b/drivers/gpu/drm/i915/intel_dp_mst.c
> > > index 0639275..4ded0fb 100644
> > > --- a/drivers/gpu/drm/i915/intel_dp_mst.c
> > > +++ b/drivers/gpu/drm/i915/intel_dp_mst.c
> > > @@ -78,6 +78,8 @@ static bool intel_dp_mst_compute_config(struct
> > > intel_encoder
> > > *encoder,
> > >   		return false;
> > >   	}
> > > 
> > > +	if (drm_dp_mst_port_has_audio(&intel_dp->mst_mgr, found->port))
> > > +		pipe_config->has_audio = true;
> > >   	mst_pbn = drm_dp_calc_pbn_mode(adjusted_mode->crtc_clock, bpp);
> > > 
> > >   	pipe_config->pbn = mst_pbn;
> > > @@ -102,6 +104,11 @@ static void intel_mst_disable_dp(struct intel_encoder
> > > *encoder)
> > >   	struct intel_dp_mst_encoder *intel_mst = enc_to_mst(&encoder
> > > ->base);
> > >   	struct intel_digital_port *intel_dig_port = intel_mst->primary;
> > >   	struct intel_dp *intel_dp = &intel_dig_port->dp;
> > > +	struct drm_device *dev = encoder->base.dev;
> > > +	struct drm_i915_private *dev_priv = dev->dev_private;
> > > +	struct drm_crtc *crtc = encoder->base.crtc;
> > > +	struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> > > +
> > >   	int ret;
> > > 
> > >   	DRM_DEBUG_KMS("%d\n", intel_dp->active_mst_links);
> > > @@ -112,6 +119,10 @@ static void intel_mst_disable_dp(struct intel_encoder
> > > *encoder)
> > >   	if (ret) {
> > >   		DRM_ERROR("failed to update payload %d\n", ret);
> > >   	}
> > > +	if (intel_crtc->config->has_audio) {
> > > +		intel_audio_codec_disable(encoder);
> > > +		intel_display_power_put(dev_priv, POWER_DOMAIN_AUDIO);
> > > +	}
> > 
> > It seems the power domain is only need for DDI platforms. Perhaps it would
> > make
> > sense to move that into hsw_audio_codec_{en,dis}able. Paulo?
> > 
> > >   }
> > > 
> > >   static void intel_mst_post_disable_dp(struct intel_encoder *encoder)
> > > @@ -214,6 +225,7 @@ static void intel_mst_enable_dp(struct intel_encoder
> > > *encoder)
> > >   	struct intel_dp *intel_dp = &intel_dig_port->dp;
> > >   	struct drm_device *dev = intel_dig_port->base.base.dev;
> > >   	struct drm_i915_private *dev_priv = dev->dev_private;
> > > +	struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
> > >   	enum port port = intel_dig_port->port;
> > >   	int ret;
> > > 
> > > @@ -226,6 +238,13 @@ static void intel_mst_enable_dp(struct intel_encoder
> > > *encoder)
> > >   	ret = drm_dp_check_act_status(&intel_dp->mst_mgr);
> > > 
> > >   	ret = drm_dp_update_payload_part2(&intel_dp->mst_mgr);
> > > +
> > > +	if (crtc->config->has_audio) {
> > > +		DRM_DEBUG_DRIVER("Enabling DP audio on pipe %c\n",
> > > +				 pipe_name(crtc->pipe));
> > > +		intel_display_power_get(dev_priv, POWER_DOMAIN_AUDIO);
> > > +		intel_audio_codec_enable(encoder);
> > > +	}
> > >   }
> > > 
> > >   static bool intel_dp_mst_enc_get_hw_state(struct intel_encoder *encoder,
> > > @@ -251,6 +270,12 @@ static void intel_dp_mst_enc_get_config(struct
> > > intel_encoder *encoder,
> > > 
> > >   	pipe_config->has_dp_encoder = true;
> > > 
> > > +	if (intel_display_power_is_enabled(dev_priv, POWER_DOMAIN_AUDIO))
> > > {
> > > +		temp = I915_READ(HSW_AUD_PIN_ELD_CP_VLD);
> > > +		if (temp & AUDIO_OUTPUT_ENABLE(crtc->pipe))
> > > +			pipe_config->has_audio = true;
> > > +	}
> > > +
> > 
> > This code is DDI specific. That shouldn't be a problem since we only support
> > DP
> > MST on DDI platforms, but we shouldn't duplicate that logic here. So I think
> > this should be added to a function that can be called both from here and
> > intel_ddi.c.
> 
> OK, I will try to add a helper function. Which file do you suggest 
> adding the function it?

Add it to intel_ddi.c, where the original occurrence of that code is.

Ander
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2015-11-23  8:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-11  5:33 [V2 PATCH 1/2] dp/mst: add SDP stream support libin.yang
2015-11-11  5:33 ` [V2 PATCH 2/2] drm/i915: start adding dp mst audio libin.yang
2015-11-19 11:07   ` Ander Conselvan De Oliveira
2015-11-23  2:23     ` Libin Yang
2015-11-23  8:55       ` Ander Conselvan De Oliveira [this message]
2015-11-23 14:04     ` Zanoni, Paulo R
2015-11-23 15:01       ` Ander Conselvan De Oliveira
2015-11-24  7:10         ` Libin Yang
2015-11-12 14:40 ` [V2 PATCH 1/2] dp/mst: add SDP stream support Yang, Libin

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=1448268942.2699.5.camel@gmail.com \
    --to=conselvan2@gmail.com \
    --cc=airlied@redhat.com \
    --cc=daniel.vetter@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=libin.yang@linux.intel.com \
    --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 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.