Re: [Intel-gfx] [PATCH V4 2/2] drm/i915: start adding dp mst audio

2015-12-14 Thread Takashi Iwai
On Mon, 14 Dec 2015 11:34:53 +0100,
Jani Nikula wrote:
> 
> On Mon, 14 Dec 2015, Takashi Iwai  wrote:
> > On Mon, 14 Dec 2015 10:33:44 +0100,
> > Jani Nikula wrote:
> >> 
> >> On Fri, 11 Dec 2015, Takashi Iwai  wrote:
> >> > On Fri, 11 Dec 2015 07:07:53 +0100,
> >> > Libin Yang wrote:
> >> >> 
> >> >> >>> diff --git a/drivers/gpu/drm/i915/intel_audio.c 
> >> >> >>> b/drivers/gpu/drm/i915/intel_audio.c
> >> >> >>> index 9aa83e7..5ad2e66 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))
> >> >> >>> tmp |= AUD_CONFIG_N_VALUE_INDEX;
> >> >
> >> > The same check is missing in hsw_audio_codec_enable()?
> >> >
> >> >> >>> I915_WRITE(HSW_AUD_CFG(pipe), tmp);
> >> >> >>>
> >> >> >>> @@ -474,7 +475,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))
> >> >> >>> tmp |= AUD_CONFIG_N_VALUE_INDEX;
> >> >
> >> > ... and missing for ilk_audio_codec_disable()?
> >> >
> >> >
> >> >> >>> else
> >> >> >>> tmp |= audio_config_hdmi_pixel_clock(adjusted_mode);
> >> >> >>> @@ -512,7 +514,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))
> >> >
> >> > IMO, it's better to have a macro to cover this two-line check instead
> >> > of open-coding at each place.  We'll have 5 places in the end.
> >> 
> >> I don't think that's necessary. Only the hsw_* functions need it, the
> >> other platforms (using the other functions) don't support DP MST.
> >
> > Then the patch changes the functions.  And still three places have
> > this check.
> 
> Probably the mistake in the patch was to add the check to
> ilk_audio_codec_enable when it should have been added to
> hsw_audio_codec_enable.

Yeah, I wanted to write "the patch changes the wrong functions", too.


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


Re: [Intel-gfx] [PATCH V4 2/2] drm/i915: start adding dp mst audio

2015-12-14 Thread Jani Nikula
On Mon, 14 Dec 2015, Takashi Iwai  wrote:
> On Mon, 14 Dec 2015 10:33:44 +0100,
> Jani Nikula wrote:
>> 
>> On Fri, 11 Dec 2015, Takashi Iwai  wrote:
>> > On Fri, 11 Dec 2015 07:07:53 +0100,
>> > Libin Yang wrote:
>> >> 
>> >> >>> diff --git a/drivers/gpu/drm/i915/intel_audio.c 
>> >> >>> b/drivers/gpu/drm/i915/intel_audio.c
>> >> >>> index 9aa83e7..5ad2e66 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))
>> >> >>>   tmp |= AUD_CONFIG_N_VALUE_INDEX;
>> >
>> > The same check is missing in hsw_audio_codec_enable()?
>> >
>> >> >>>   I915_WRITE(HSW_AUD_CFG(pipe), tmp);
>> >> >>>
>> >> >>> @@ -474,7 +475,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))
>> >> >>>   tmp |= AUD_CONFIG_N_VALUE_INDEX;
>> >
>> > ... and missing for ilk_audio_codec_disable()?
>> >
>> >
>> >> >>>   else
>> >> >>>   tmp |= audio_config_hdmi_pixel_clock(adjusted_mode);
>> >> >>> @@ -512,7 +514,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))
>> >
>> > IMO, it's better to have a macro to cover this two-line check instead
>> > of open-coding at each place.  We'll have 5 places in the end.
>> 
>> I don't think that's necessary. Only the hsw_* functions need it, the
>> other platforms (using the other functions) don't support DP MST.
>
> Then the patch changes the functions.  And still three places have
> this check.

Probably the mistake in the patch was to add the check to
ilk_audio_codec_enable when it should have been added to
hsw_audio_codec_enable.

BR,
Jani.



>
>
> thanks,
>
> Takashi

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


Re: [Intel-gfx] [PATCH V4 2/2] drm/i915: start adding dp mst audio

2015-12-14 Thread Takashi Iwai
On Mon, 14 Dec 2015 10:33:44 +0100,
Jani Nikula wrote:
> 
> On Fri, 11 Dec 2015, Takashi Iwai  wrote:
> > On Fri, 11 Dec 2015 07:07:53 +0100,
> > Libin Yang wrote:
> >> 
> >> >>> diff --git a/drivers/gpu/drm/i915/intel_audio.c 
> >> >>> b/drivers/gpu/drm/i915/intel_audio.c
> >> >>> index 9aa83e7..5ad2e66 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))
> >> >>>tmp |= AUD_CONFIG_N_VALUE_INDEX;
> >
> > The same check is missing in hsw_audio_codec_enable()?
> >
> >> >>>I915_WRITE(HSW_AUD_CFG(pipe), tmp);
> >> >>>
> >> >>> @@ -474,7 +475,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))
> >> >>>tmp |= AUD_CONFIG_N_VALUE_INDEX;
> >
> > ... and missing for ilk_audio_codec_disable()?
> >
> >
> >> >>>else
> >> >>>tmp |= audio_config_hdmi_pixel_clock(adjusted_mode);
> >> >>> @@ -512,7 +514,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))
> >
> > IMO, it's better to have a macro to cover this two-line check instead
> > of open-coding at each place.  We'll have 5 places in the end.
> 
> I don't think that's necessary. Only the hsw_* functions need it, the
> other platforms (using the other functions) don't support DP MST.

Then the patch changes the functions.  And still three places have
this check.


thanks,

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


Re: [Intel-gfx] [PATCH V4 2/2] drm/i915: start adding dp mst audio

2015-12-14 Thread Jani Nikula
On Fri, 11 Dec 2015, Takashi Iwai  wrote:
> On Fri, 11 Dec 2015 07:07:53 +0100,
> Libin Yang wrote:
>> 
>> >>> diff --git a/drivers/gpu/drm/i915/intel_audio.c 
>> >>> b/drivers/gpu/drm/i915/intel_audio.c
>> >>> index 9aa83e7..5ad2e66 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))
>> >>>  tmp |= AUD_CONFIG_N_VALUE_INDEX;
>
> The same check is missing in hsw_audio_codec_enable()?
>
>> >>>  I915_WRITE(HSW_AUD_CFG(pipe), tmp);
>> >>>
>> >>> @@ -474,7 +475,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))
>> >>>  tmp |= AUD_CONFIG_N_VALUE_INDEX;
>
> ... and missing for ilk_audio_codec_disable()?
>
>
>> >>>  else
>> >>>  tmp |= audio_config_hdmi_pixel_clock(adjusted_mode);
>> >>> @@ -512,7 +514,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))
>
> IMO, it's better to have a macro to cover this two-line check instead
> of open-coding at each place.  We'll have 5 places in the end.

I don't think that's necessary. Only the hsw_* functions need it, the
other platforms (using the other functions) don't support DP MST.

BR,
Jani.


>
>
> thanks,
>
> Takashi

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


Re: [Intel-gfx] [PATCH V4 2/2] drm/i915: start adding dp mst audio

2015-12-13 Thread Takashi Iwai
On Fri, 11 Dec 2015 15:05:08 +0100,
Takashi Iwai wrote:
> 
> On Fri, 11 Dec 2015 07:07:53 +0100,
> Libin Yang wrote:
> > 
> > Add Takashi and ALSA mail list.
> > 
> > On 12/10/2015 05:02 PM, Daniel Vetter wrote:
> > > On Tue, Dec 08, 2015 at 04:01:20PM +0800, Libin Yang wrote:
> > >> Hi all,
> > >>
> > >> Any comments on the patches?
> > >
> > > Sorry, simply fell through the cracks since Ander is on vacation. Takashi
> > > is working on some cleanup patches to have a port->encoder mapping for the
> > > audio side of i915. His patch cleans up all the existing audio code in
> > > i915, but please work together with him to align mst code with the new
> > > style.
> > >
> > > Both patches queued for next.
> > 
> > Yes, I have seen Takashi's patches. I will check the patches.
> 
> The patch like below should work; it sets/clears the reverse mapping
> dynamically for the MST encoder.

This might be too shortsighted and broken -- if multiple devices are
hook on the same port...

Now I wonder which graphics part actually corresponds to the HD-audio
widget.  So far, we supposed that each pin widget 0x05-0x07
corresponds to the digital port B-D in the fixed manner.  If so, how
is the case where two devices on the same port?  In the codec level,
we get an unsolicited event on the same pin but check with the
different device index.  What would be a unique index instead that can
be passed via the component ops?

Then, another question is which audio converter widget is used and how
is set up, if multiple devices were on the same pin.

Libin, do you have any git branch where MST really works?  I should
test it at first to confirm that it actually works on my test system.


thanks,

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


Re: [Intel-gfx] [PATCH V4 2/2] drm/i915: start adding dp mst audio

2015-12-11 Thread Takashi Iwai
On Fri, 11 Dec 2015 07:07:53 +0100,
Libin Yang wrote:
> 
> Add Takashi and ALSA mail list.
> 
> On 12/10/2015 05:02 PM, Daniel Vetter wrote:
> > On Tue, Dec 08, 2015 at 04:01:20PM +0800, Libin Yang wrote:
> >> Hi all,
> >>
> >> Any comments on the patches?
> >
> > Sorry, simply fell through the cracks since Ander is on vacation. Takashi
> > is working on some cleanup patches to have a port->encoder mapping for the
> > audio side of i915. His patch cleans up all the existing audio code in
> > i915, but please work together with him to align mst code with the new
> > style.
> >
> > Both patches queued for next.
> 
> Yes, I have seen Takashi's patches. I will check the patches.

The patch like below should work; it sets/clears the reverse mapping
dynamically for the MST encoder.

At least, now I could get a proper ELD from a docking station.  But
the audio itself doesn't seem working yet, missing something...

FWIW, the fixed patches are found in my test/hdmi-jack branch.
It contains my previous get_eld patchset, HD-audio side changes,
Libin's this patchset, plus Libin's HD-audio MST patchset and some
fixes.


Takashi

---
diff --git a/drivers/gpu/drm/i915/intel_dp_mst.c 
b/drivers/gpu/drm/i915/intel_dp_mst.c
index 8b608c2cd070..87dad62fd10b 100644
--- a/drivers/gpu/drm/i915/intel_dp_mst.c
+++ b/drivers/gpu/drm/i915/intel_dp_mst.c
@@ -108,6 +108,7 @@ static void intel_mst_disable_dp(struct intel_encoder 
*encoder)
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);
+   enum port port = intel_dig_port->port;
 
int ret;
 
@@ -122,6 +123,9 @@ static void intel_mst_disable_dp(struct intel_encoder 
*encoder)
if (intel_crtc->config->has_audio) {
intel_audio_codec_disable(encoder);
intel_display_power_put(dev_priv, POWER_DOMAIN_AUDIO);
+   mutex_lock(&dev_priv->av_mutex);
+   dev_priv->dig_port_map[port] = NULL;
+   mutex_unlock(&dev_priv->av_mutex);
}
 }
 
@@ -236,6 +240,9 @@ static void intel_mst_enable_dp(struct intel_encoder 
*encoder)
if (crtc->config->has_audio) {
DRM_DEBUG_DRIVER("Enabling DP audio on pipe %c\n",
 pipe_name(crtc->pipe));
+   mutex_lock(&dev_priv->av_mutex);
+   dev_priv->dig_port_map[port] = encoder;
+   mutex_unlock(&dev_priv->av_mutex);
intel_display_power_get(dev_priv, POWER_DOMAIN_AUDIO);
intel_audio_codec_enable(encoder);
}
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH V4 2/2] drm/i915: start adding dp mst audio

2015-12-11 Thread Takashi Iwai
On Fri, 11 Dec 2015 11:43:51 +0100,
Takashi Iwai wrote:
> 
> On Fri, 11 Dec 2015 07:07:53 +0100,
> Libin Yang wrote:
> > 
> > >>> diff --git a/drivers/gpu/drm/i915/intel_audio.c 
> > >>> b/drivers/gpu/drm/i915/intel_audio.c
> > >>> index 9aa83e7..5ad2e66 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))
> > >>> tmp |= AUD_CONFIG_N_VALUE_INDEX;
> 
> The same check is missing in hsw_audio_codec_enable()?
> 
> > >>> I915_WRITE(HSW_AUD_CFG(pipe), tmp);
> > >>>
> > >>> @@ -474,7 +475,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))
> > >>> tmp |= AUD_CONFIG_N_VALUE_INDEX;
> 
> ... and missing for ilk_audio_codec_disable()?
> 
> 
> > >>> else
> > >>> tmp |= audio_config_hdmi_pixel_clock(adjusted_mode);
> > >>> @@ -512,7 +514,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))
> 
> IMO, it's better to have a macro to cover this two-line check instead
> of open-coding at each place.  We'll have 5 places in the end.

Also, this patch still has an issue about the encoder type, namely, it
passes intel_encoder from MST, where you can't apply
enc_to_dig_port().  We need another help to get the digital port
depending on the encoder type, e.g.

static struct intel_digital_port *
intel_encoder_to_dig_port(struct intel_encoder *intel_encoder)
{
struct drm_encoder *encoder = &intel_encoder->base;

if (intel_encoder->type == INTEL_OUTPUT_DP_MST)
return enc_to_mst(encoder)->primary;
return enc_to_dig_port(encoder);
}


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


Re: [Intel-gfx] [PATCH V4 2/2] drm/i915: start adding dp mst audio

2015-12-11 Thread Takashi Iwai
On Fri, 11 Dec 2015 07:07:53 +0100,
Libin Yang wrote:
> 
> >>> diff --git a/drivers/gpu/drm/i915/intel_audio.c 
> >>> b/drivers/gpu/drm/i915/intel_audio.c
> >>> index 9aa83e7..5ad2e66 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))
> >>>   tmp |= AUD_CONFIG_N_VALUE_INDEX;

The same check is missing in hsw_audio_codec_enable()?

> >>>   I915_WRITE(HSW_AUD_CFG(pipe), tmp);
> >>>
> >>> @@ -474,7 +475,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))
> >>>   tmp |= AUD_CONFIG_N_VALUE_INDEX;

... and missing for ilk_audio_codec_disable()?


> >>>   else
> >>>   tmp |= audio_config_hdmi_pixel_clock(adjusted_mode);
> >>> @@ -512,7 +514,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))

IMO, it's better to have a macro to cover this two-line check instead
of open-coding at each place.  We'll have 5 places in the end.


thanks,

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


Re: [Intel-gfx] [PATCH V4 2/2] drm/i915: start adding dp mst audio

2015-12-10 Thread Libin Yang

Add Takashi and ALSA mail list.

On 12/10/2015 05:02 PM, Daniel Vetter wrote:

On Tue, Dec 08, 2015 at 04:01:20PM +0800, Libin Yang wrote:

Hi all,

Any comments on the patches?


Sorry, simply fell through the cracks since Ander is on vacation. Takashi
is working on some cleanup patches to have a port->encoder mapping for the
audio side of i915. His patch cleans up all the existing audio code in
i915, but please work together with him to align mst code with the new
style.

Both patches queued for next.


Yes, I have seen Takashi's patches. I will check the patches.

Best Regards,
Libin



Thanks, Daniel



Best Regards,
Libin

On 12/02/2015 02:09 PM, libin.y...@linux.intel.com wrote:

From: Libin Yang 

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.

Another separated patches to support DP MST audio will be implemented
in audio driver.

Reviewed-by: Ander Conselvan de Oliveira 
Signed-off-by: Libin Yang 
Signed-off-by: Dave Airlie 
---
  drivers/gpu/drm/i915/i915_debugfs.c | 16 
  drivers/gpu/drm/i915/intel_audio.c  |  9 ++---
  drivers/gpu/drm/i915/intel_ddi.c| 20 +++-
  drivers/gpu/drm/i915/intel_dp_mst.c | 22 ++
  drivers/gpu/drm/i915/intel_drv.h|  2 ++
  5 files changed, 61 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c 
b/drivers/gpu/drm/i915/i915_debugfs.c
index bfd57fb..8387638 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -2850,6 +2850,20 @@ 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;
+   bool has_audio = drm_dp_mst_port_has_audio(&intel_dp->mst_mgr,
+   intel_connector->port);
+
+   seq_printf(m, "\taudio support: %s\n", yesno(has_audio));
+}
+
  static void intel_hdmi_info(struct seq_file *m,
struct intel_connector *intel_connector)
  {
@@ -2893,6 +2907,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 9aa83e7..5ad2e66 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))
tmp |= AUD_CONFIG_N_VALUE_INDEX;
I915_WRITE(HSW_AUD_CFG(pipe), tmp);

@@ -474,7 +475,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))
tmp |= AUD_CONFIG_N_VALUE_INDEX;
else
tmp |= audio_config_hdmi_pixel_clock(adjusted_mode);
@@ -512,7 +514,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);

connector->eld[6] = drm_av_sync_delay(connector, adjusted_mode) / 2;
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 76ce7c2..bc7fffb 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -3108,6 +3108,19 @@ void intel_ddi_fdi_disable(struct drm_crtc *crtc)
I915_WRI

Re: [Intel-gfx] [PATCH V4 2/2] drm/i915: start adding dp mst audio

2015-12-10 Thread Daniel Vetter
On Tue, Dec 08, 2015 at 04:01:20PM +0800, Libin Yang wrote:
> Hi all,
> 
> Any comments on the patches?

Sorry, simply fell through the cracks since Ander is on vacation. Takashi
is working on some cleanup patches to have a port->encoder mapping for the
audio side of i915. His patch cleans up all the existing audio code in
i915, but please work together with him to align mst code with the new
style.

Both patches queued for next.

Thanks, Daniel

> 
> Best Regards,
> Libin
> 
> On 12/02/2015 02:09 PM, libin.y...@linux.intel.com wrote:
> >From: Libin Yang 
> >
> >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.
> >
> >Another separated patches to support DP MST audio will be implemented
> >in audio driver.
> >
> >Reviewed-by: Ander Conselvan de Oliveira 
> >Signed-off-by: Libin Yang 
> >Signed-off-by: Dave Airlie 
> >---
> >  drivers/gpu/drm/i915/i915_debugfs.c | 16 
> >  drivers/gpu/drm/i915/intel_audio.c  |  9 ++---
> >  drivers/gpu/drm/i915/intel_ddi.c| 20 +++-
> >  drivers/gpu/drm/i915/intel_dp_mst.c | 22 ++
> >  drivers/gpu/drm/i915/intel_drv.h|  2 ++
> >  5 files changed, 61 insertions(+), 8 deletions(-)
> >
> >diff --git a/drivers/gpu/drm/i915/i915_debugfs.c 
> >b/drivers/gpu/drm/i915/i915_debugfs.c
> >index bfd57fb..8387638 100644
> >--- a/drivers/gpu/drm/i915/i915_debugfs.c
> >+++ b/drivers/gpu/drm/i915/i915_debugfs.c
> >@@ -2850,6 +2850,20 @@ 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;
> >+bool has_audio = drm_dp_mst_port_has_audio(&intel_dp->mst_mgr,
> >+intel_connector->port);
> >+
> >+seq_printf(m, "\taudio support: %s\n", yesno(has_audio));
> >+}
> >+
> >  static void intel_hdmi_info(struct seq_file *m,
> > struct intel_connector *intel_connector)
> >  {
> >@@ -2893,6 +2907,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 9aa83e7..5ad2e66 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))
> > tmp |= AUD_CONFIG_N_VALUE_INDEX;
> > I915_WRITE(HSW_AUD_CFG(pipe), tmp);
> >
> >@@ -474,7 +475,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))
> > tmp |= AUD_CONFIG_N_VALUE_INDEX;
> > else
> > tmp |= audio_config_hdmi_pixel_clock(adjusted_mode);
> >@@ -512,7 +514,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);
> >
> > connector->eld[6] = drm_av_sync_delay(connector, adjusted_mode) / 2;
> >diff --git a/drivers/gpu/drm/i915/intel_ddi.c 
> >b/drivers/gpu/drm/i915/intel_ddi.c
> >index 76ce7c2..bc7fffb 100644
> >--- a/drivers/gpu/drm/i915/intel_ddi.c
> >+++ b/drivers/gpu/drm/i915/intel_ddi.c
> >@@ -3108,6 +3108,19 @@ void intel_ddi_fdi_disable(struct drm_crtc *cr

Re: [Intel-gfx] [PATCH V4 2/2] drm/i915: start adding dp mst audio

2015-12-08 Thread Libin Yang

Hi all,

Any comments on the patches?

Best Regards,
Libin

On 12/02/2015 02:09 PM, libin.y...@linux.intel.com wrote:

From: Libin Yang 

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.

Another separated patches to support DP MST audio will be implemented
in audio driver.

Reviewed-by: Ander Conselvan de Oliveira 
Signed-off-by: Libin Yang 
Signed-off-by: Dave Airlie 
---
  drivers/gpu/drm/i915/i915_debugfs.c | 16 
  drivers/gpu/drm/i915/intel_audio.c  |  9 ++---
  drivers/gpu/drm/i915/intel_ddi.c| 20 +++-
  drivers/gpu/drm/i915/intel_dp_mst.c | 22 ++
  drivers/gpu/drm/i915/intel_drv.h|  2 ++
  5 files changed, 61 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c 
b/drivers/gpu/drm/i915/i915_debugfs.c
index bfd57fb..8387638 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -2850,6 +2850,20 @@ 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;
+   bool has_audio = drm_dp_mst_port_has_audio(&intel_dp->mst_mgr,
+   intel_connector->port);
+
+   seq_printf(m, "\taudio support: %s\n", yesno(has_audio));
+}
+
  static void intel_hdmi_info(struct seq_file *m,
struct intel_connector *intel_connector)
  {
@@ -2893,6 +2907,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 9aa83e7..5ad2e66 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))
tmp |= AUD_CONFIG_N_VALUE_INDEX;
I915_WRITE(HSW_AUD_CFG(pipe), tmp);

@@ -474,7 +475,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))
tmp |= AUD_CONFIG_N_VALUE_INDEX;
else
tmp |= audio_config_hdmi_pixel_clock(adjusted_mode);
@@ -512,7 +514,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);

connector->eld[6] = drm_av_sync_delay(connector, adjusted_mode) / 2;
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 76ce7c2..bc7fffb 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -3108,6 +3108,19 @@ void intel_ddi_fdi_disable(struct drm_crtc *crtc)
I915_WRITE(FDI_RX_CTL(PIPE_A), val);
  }

+bool intel_ddi_is_audio_enabled(struct drm_i915_private *dev_priv,
+struct intel_crtc *intel_crtc)
+{
+   u32 temp;
+
+   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(intel_crtc->pipe))
+   return true;
+   }
+   return false;
+}
+
  void intel_ddi_get_config(struct intel_encoder *encoder,
  struct intel_crtc_state *pip

[Intel-gfx] [PATCH V4 2/2] drm/i915: start adding dp mst audio

2015-12-01 Thread libin . yang
From: Libin Yang 

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.

Another separated patches to support DP MST audio will be implemented
in audio driver.

Reviewed-by: Ander Conselvan de Oliveira 
Signed-off-by: Libin Yang 
Signed-off-by: Dave Airlie 
---
 drivers/gpu/drm/i915/i915_debugfs.c | 16 
 drivers/gpu/drm/i915/intel_audio.c  |  9 ++---
 drivers/gpu/drm/i915/intel_ddi.c| 20 +++-
 drivers/gpu/drm/i915/intel_dp_mst.c | 22 ++
 drivers/gpu/drm/i915/intel_drv.h|  2 ++
 5 files changed, 61 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c 
b/drivers/gpu/drm/i915/i915_debugfs.c
index bfd57fb..8387638 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -2850,6 +2850,20 @@ 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;
+   bool has_audio = drm_dp_mst_port_has_audio(&intel_dp->mst_mgr,
+   intel_connector->port);
+
+   seq_printf(m, "\taudio support: %s\n", yesno(has_audio));
+}
+
 static void intel_hdmi_info(struct seq_file *m,
struct intel_connector *intel_connector)
 {
@@ -2893,6 +2907,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 9aa83e7..5ad2e66 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))
tmp |= AUD_CONFIG_N_VALUE_INDEX;
I915_WRITE(HSW_AUD_CFG(pipe), tmp);
 
@@ -474,7 +475,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))
tmp |= AUD_CONFIG_N_VALUE_INDEX;
else
tmp |= audio_config_hdmi_pixel_clock(adjusted_mode);
@@ -512,7 +514,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);
 
connector->eld[6] = drm_av_sync_delay(connector, adjusted_mode) / 2;
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 76ce7c2..bc7fffb 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -3108,6 +3108,19 @@ void intel_ddi_fdi_disable(struct drm_crtc *crtc)
I915_WRITE(FDI_RX_CTL(PIPE_A), val);
 }
 
+bool intel_ddi_is_audio_enabled(struct drm_i915_private *dev_priv,
+struct intel_crtc *intel_crtc)
+{
+   u32 temp;
+
+   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(intel_crtc->pipe))
+   return true;
+   }
+   return false;
+}
+
 void intel_ddi_get_config(struct intel_encoder *encoder,
  struct intel_crtc_state *pipe_config)
 {
@@ -3168,11 +3181,8 @@ void intel_ddi_get_config(struct intel_encoder *encoder,
break;
}