Skip to contentSkip to conversation

dp/mst: add SDP stream support

PATCH In review [email protected] 4 participants 15 messages Dec 2, 2015 – Dec 21, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v4 1/2 dp/mst: add SDP stream support

From: Libin Yang <[email protected]>

This adds code to initialise the SDP streams
for a sink in the simplest ordering.

I've no idea how you'd want to control the
ordering at this level, so don't bother
until someone comes up with a use case.

---
 drivers/gpu/drm/drm_dp_mst_topology.c | 38 ++++++++++++++++++++++++++++++++---
 include/drm/drm_dp_mst_helper.h       |  7 +++++--
 2 files changed, 40 insertions(+), 5 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +35 -3
index 809959d..f50eb7b 100644
@@ -666,7 +666,9 @@ static int build_enum_path_resources(struct drm_dp_sideband_msg_tx *msg, int por
 }
 
 static int build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int port_num,
-				  u8 vcpi, uint16_t pbn)
+				  u8 vcpi, uint16_t pbn,
+				  u8 number_sdp_streams,
+				  u8 *sdp_stream_sink)
 {
 	struct drm_dp_sideband_msg_req_body req;
 	memset(&req, 0, sizeof(req));
@@ -674,6 +676,9 @@ static int build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int port_n
 	req.u.allocate_payload.port_number = port_num;
 	req.u.allocate_payload.vcpi = vcpi;
 	req.u.allocate_payload.pbn = pbn;
+	req.u.allocate_payload.number_sdp_streams = number_sdp_streams;
+	memcpy(req.u.allocate_payload.sdp_stream_sink, sdp_stream_sink,
+		   number_sdp_streams);
 	drm_dp_encode_sideband_req(&req, msg);
 	msg->path_msg = true;
 	return 0;
@@ -1562,6 +1567,8 @@ static int drm_dp_payload_send_msg(struct drm_dp_mst_topology_mgr *mgr,
 	struct drm_dp_sideband_msg_tx *txmsg;
 	struct drm_dp_mst_branch *mstb;
 	int len, ret;
+	u8 sinks[DRM_DP_MAX_SDP_STREAMS];
+	int i;
 
 	mstb = drm_dp_get_validated_mstb_ref(mgr, port->parent);
 	if (!mstb)
@@ -1573,10 +1580,13 @@ static int drm_dp_payload_send_msg(struct drm_dp_mst_topology_mgr *mgr,
 		goto fail_put;
 	}
 
+	for (i = 0; i < port->num_sdp_streams; i++)
+		sinks[i] = i;
+
 	txmsg->dst = mstb;
 	len = build_allocate_payload(txmsg, port->port_num,
 				     id,
-				     pbn);
+				     pbn, port->num_sdp_streams, sinks);
 
 	drm_dp_queue_down_tx(mgr, txmsg);
 
@@ -2259,6 +2269,27 @@ out:
 EXPORT_SYMBOL(drm_dp_mst_detect_port);
 
 /**
+ * drm_dp_mst_port_has_audio() - Check whether port has audio capability or not
+ * @mgr: manager for this port
+ * @port: unverified pointer to a port.
+ *
+ * This returns whether the port supports audio or not.
+ */
+bool drm_dp_mst_port_has_audio(struct drm_dp_mst_topology_mgr *mgr,
+					struct drm_dp_mst_port *port)
+{
+	bool ret = false;
+
+	port = drm_dp_get_validated_port_ref(mgr, port);
+	if (!port)
+		return ret;
+	ret = port->has_audio;
+	drm_dp_put_port(port);
+	return ret;
+}
+EXPORT_SYMBOL(drm_dp_mst_port_has_audio);
+
+/**
  * drm_dp_mst_get_edid() - get EDID for an MST port
  * @connector: toplevel connector to get EDID for
  * @mgr: manager for this port
@@ -2283,6 +2314,7 @@ struct edid *drm_dp_mst_get_edid(struct drm_connector *connector, struct drm_dp_
 		edid = drm_get_edid(connector, &port->aux.ddc);
 		drm_mode_connector_set_tile_property(connector);
 	}
+	port->has_audio = drm_detect_monitor_audio(edid);
 	drm_dp_put_port(port);
 	return edid;
 }
@@ -2566,7 +2598,7 @@ static void drm_dp_mst_dump_mstb(struct seq_file *m,
 
 	seq_printf(m, "%smst: %p, %d\n", prefix, mstb, mstb->num_ports);
 	list_for_each_entry(port, &mstb->ports, next) {
-		seq_printf(m, "%sport: %d: ddps: %d ldps: %d, %p, conn: %p\n", prefix, port->port_num, port->ddps, port->ldps, port, port->connector);
+		seq_printf(m, "%sport: %d: ddps: %d ldps: %d, sdp: %d/%d, %p, conn: %p\n", prefix, port->port_num, port->ddps, port->ldps, port->num_sdp_streams, port->num_sdp_stream_sinks, port, port->connector);
 		if (port->mstb)
 			drm_dp_mst_dump_mstb(m, port->mstb);
 	}
include/drm/drm_dp_mst_helper.h +5 -2
index 5340099..74b5888 100644
@@ -94,6 +94,7 @@ struct drm_dp_mst_port {
 	struct drm_dp_mst_topology_mgr *mgr;
 
 	struct edid *cached_edid; /* for DP logical ports - make tiling work */
+	bool has_audio;
 };
 
 /**
@@ -215,13 +216,13 @@ struct drm_dp_sideband_msg_rx {
 	struct drm_dp_sideband_msg_hdr initial_hdr;
 };
 
-
+#define DRM_DP_MAX_SDP_STREAMS 16
 struct drm_dp_allocate_payload {
 	u8 port_number;
 	u8 number_sdp_streams;
 	u8 vcpi;
 	u16 pbn;
-	u8 sdp_stream_sink[8];
+	u8 sdp_stream_sink[DRM_DP_MAX_SDP_STREAMS];
 };
 
 struct drm_dp_allocate_payload_ack_reply {
@@ -484,6 +485,8 @@ int drm_dp_mst_hpd_irq(struct drm_dp_mst_topology_mgr *mgr, u8 *esi, bool *handl
 
 enum drm_connector_status drm_dp_mst_detect_port(struct drm_connector *connector, struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port);
 
+bool drm_dp_mst_port_has_audio(struct drm_dp_mst_topology_mgr *mgr,
+					struct drm_dp_mst_port *port);
 struct edid *drm_dp_mst_get_edid(struct drm_connector *connector, struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port);
 
 
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH v4 2/2 drm/i915: start adding dp mst audio

From: Libin Yang <[email protected]>

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.

---
 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(-)
drivers/gpu/drm/i915/i915_debugfs.c +16 -0
index bfd57fb..8387638 100644
@@ -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");
drivers/gpu/drm/i915/intel_audio.c +6 -3
index 9aa83e7..5ad2e66 100644
@@ -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;
drivers/gpu/drm/i915/intel_ddi.c +15 -5
index 76ce7c2..bc7fffb 100644
@@ -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;
 	}
 
-	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))
-			pipe_config->has_audio = true;
-	}
+	pipe_config->has_audio =
+		intel_ddi_is_audio_enabled(dev_priv, intel_crtc);
 
 	if (encoder->type == INTEL_OUTPUT_EDP && dev_priv->vbt.edp_bpp &&
 	    pipe_config->pipe_bpp > dev_priv->vbt.edp_bpp) {
drivers/gpu/drm/i915/intel_dp_mst.c +22 -0
index 8c4e7df..8b608c2 100644
@@ -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);
+	}
 }
 
 static void intel_mst_post_disable_dp(struct intel_encoder *encoder)
@@ -208,6 +219,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;
 
@@ -220,6 +232,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,
@@ -245,6 +264,9 @@ static void intel_dp_mst_enc_get_config(struct intel_encoder *encoder,
 
 	pipe_config->has_dp_encoder = true;
 
+	pipe_config->has_audio =
+		intel_ddi_is_audio_enabled(dev_priv, crtc);
+
 	temp = I915_READ(TRANS_DDI_FUNC_CTL(cpu_transcoder));
 	if (temp & TRANS_DDI_PHSYNC)
 		flags |= DRM_MODE_FLAG_PHSYNC;
drivers/gpu/drm/i915/intel_drv.h +2 -0
index 1ffd8d5..0d2c59f 100644
@@ -1011,6 +1011,8 @@ void intel_ddi_set_pipe_settings(struct drm_crtc *crtc);
 void intel_ddi_prepare_link_retrain(struct intel_dp *intel_dp);
 bool intel_ddi_connector_get_hw_state(struct intel_connector *intel_connector);
 void intel_ddi_fdi_disable(struct drm_crtc *crtc);
+bool intel_ddi_is_audio_enabled(struct drm_i915_private *dev_priv,
+				 struct intel_crtc *intel_crtc);
 void intel_ddi_get_config(struct intel_encoder *encoder,
 			  struct intel_crtc_state *pipe_config);
 struct intel_encoder *
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#2 lore raw

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

Hi all,

Any comments on the patches?

Best Regards,
Libin

Quoted 201 lines · On 12/02/2015 02:09 PM, [email protected] wrote:

From: Libin Yang <[email protected]>

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.

---
  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(-)
drivers/gpu/drm/i915/i915_debugfs.c +16 -0
index bfd57fb..8387638 100644
@@ -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");
drivers/gpu/drm/i915/intel_audio.c +6 -3
index 9aa83e7..5ad2e66 100644
@@ -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;
drivers/gpu/drm/i915/intel_ddi.c +15 -5
index 76ce7c2..bc7fffb 100644
@@ -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;
  	}
 
-	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))
-			pipe_config->has_audio = true;
-	}
+	pipe_config->has_audio =
+		intel_ddi_is_audio_enabled(dev_priv, intel_crtc);
 
  	if (encoder->type == INTEL_OUTPUT_EDP && dev_priv->vbt.edp_bpp &&
  	    pipe_config->pipe_bpp > dev_priv->vbt.edp_bpp) {
drivers/gpu/drm/i915/intel_dp_mst.c +22 -0
index 8c4e7df..8b608c2 100644
@@ -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);
+	}
  }
 
  static void intel_mst_post_disable_dp(struct intel_encoder *encoder)
@@ -208,6 +219,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;
 
@@ -220,6 +232,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,
@@ -245,6 +264,9 @@ static void intel_dp_mst_enc_get_config(struct intel_encoder *encoder,
 
  	pipe_config->has_dp_encoder = true;
 
+	pipe_config->has_audio =
+		intel_ddi_is_audio_enabled(dev_priv, crtc);
+
  	temp = I915_READ(TRANS_DDI_FUNC_CTL(cpu_transcoder));
  	if (temp & TRANS_DDI_PHSYNC)
  		flags |= DRM_MODE_FLAG_PHSYNC;
drivers/gpu/drm/i915/intel_drv.h +0 -0
index 1ffd8d5..0d2c59f 100644

drivers/gpu/drm/i915/intel_drv.h void intel_ddi_set_pipe_settings(struct drm_crtc *crtc); · line 1018

Quoted 8 lines
drivers/gpu/drm/i915/intel_drv.h +2 -0
@@ -1011,6 +1011,8 @@ void intel_ddi_set_pipe_settings(struct drm_crtc *crtc);
  void intel_ddi_prepare_link_retrain(struct intel_dp *intel_dp);
  bool intel_ddi_connector_get_hw_state(struct intel_connector *intel_connector);
  void intel_ddi_fdi_disable(struct drm_crtc *crtc);
+bool intel_ddi_is_audio_enabled(struct drm_i915_private *dev_priv,
+				 struct intel_crtc *intel_crtc);
  void intel_ddi_get_config(struct intel_encoder *encoder,
  			  struct intel_crtc_state *pipe_config);
  struct intel_encoder *

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw

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

Quoted 3 lines · Libin Yang

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

Quoted 218 lines

Best Regards,
Libin

Quoted 201 lines · On 12/02/2015 02:09 PM, [email protected] wrote:

From: Libin Yang <[email protected]>

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.

---
 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(-)
drivers/gpu/drm/i915/i915_debugfs.c +16 -0
index bfd57fb..8387638 100644
@@ -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");
drivers/gpu/drm/i915/intel_audio.c +6 -3
index 9aa83e7..5ad2e66 100644
@@ -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;
drivers/gpu/drm/i915/intel_ddi.c +15 -5
index 76ce7c2..bc7fffb 100644
@@ -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;
 	}
 
-	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))
-			pipe_config->has_audio = true;
-	}
+	pipe_config->has_audio =
+		intel_ddi_is_audio_enabled(dev_priv, intel_crtc);
 
 	if (encoder->type == INTEL_OUTPUT_EDP && dev_priv->vbt.edp_bpp &&
 	    pipe_config->pipe_bpp > dev_priv->vbt.edp_bpp) {
drivers/gpu/drm/i915/intel_dp_mst.c +22 -0
index 8c4e7df..8b608c2 100644
@@ -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);
+	}
 }
 
 static void intel_mst_post_disable_dp(struct intel_encoder *encoder)
@@ -208,6 +219,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;
 
@@ -220,6 +232,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,
@@ -245,6 +264,9 @@ static void intel_dp_mst_enc_get_config(struct intel_encoder *encoder,
 
 	pipe_config->has_dp_encoder = true;
 
+	pipe_config->has_audio =
+		intel_ddi_is_audio_enabled(dev_priv, crtc);
+
 	temp = I915_READ(TRANS_DDI_FUNC_CTL(cpu_transcoder));
 	if (temp & TRANS_DDI_PHSYNC)
 		flags |= DRM_MODE_FLAG_PHSYNC;
drivers/gpu/drm/i915/intel_drv.h +0 -0
index 1ffd8d5..0d2c59f 100644

drivers/gpu/drm/i915/intel_drv.h void intel_ddi_set_pipe_settings(struct drm_crtc *crtc); · line 1018

Quoted 8 lines
drivers/gpu/drm/i915/intel_drv.h +2 -0
@@ -1011,6 +1011,8 @@ void intel_ddi_set_pipe_settings(struct drm_crtc *crtc);
 void intel_ddi_prepare_link_retrain(struct intel_dp *intel_dp);
 bool intel_ddi_connector_get_hw_state(struct intel_connector *intel_connector);
 void intel_ddi_fdi_disable(struct drm_crtc *crtc);
+bool intel_ddi_is_audio_enabled(struct drm_i915_private *dev_priv,
+				 struct intel_crtc *intel_crtc);
 void intel_ddi_get_config(struct intel_encoder *encoder,
 			  struct intel_crtc_state *pipe_config);
 struct intel_encoder *

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
author
#4 lore raw

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

Add Takashi and ALSA mail list.

Quoted 5 lines · Daniel Vetter
Quoted 3 lines · Libin Yang

Hi all,

Any comments on the patches?

Quoted 7 lines

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

Quoted 222 lines

Thanks, Daniel

Quoted 218 lines

Best Regards,
Libin

Quoted 201 lines · On 12/02/2015 02:09 PM, [email protected] wrote:

From: Libin Yang <[email protected]>

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.

---
  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(-)
drivers/gpu/drm/i915/i915_debugfs.c +16 -0
index bfd57fb..8387638 100644
@@ -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");
drivers/gpu/drm/i915/intel_audio.c +6 -3
index 9aa83e7..5ad2e66 100644
@@ -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;
drivers/gpu/drm/i915/intel_ddi.c +15 -5
index 76ce7c2..bc7fffb 100644
@@ -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;
  	}
 
-	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))
-			pipe_config->has_audio = true;
-	}
+	pipe_config->has_audio =
+		intel_ddi_is_audio_enabled(dev_priv, intel_crtc);
 
  	if (encoder->type == INTEL_OUTPUT_EDP && dev_priv->vbt.edp_bpp &&
  	    pipe_config->pipe_bpp > dev_priv->vbt.edp_bpp) {
drivers/gpu/drm/i915/intel_dp_mst.c +22 -0
index 8c4e7df..8b608c2 100644
@@ -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);
+	}
  }
 
  static void intel_mst_post_disable_dp(struct intel_encoder *encoder)
@@ -208,6 +219,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;
 
@@ -220,6 +232,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,
@@ -245,6 +264,9 @@ static void intel_dp_mst_enc_get_config(struct intel_encoder *encoder,
 
  	pipe_config->has_dp_encoder = true;
 
+	pipe_config->has_audio =
+		intel_ddi_is_audio_enabled(dev_priv, crtc);
+
  	temp = I915_READ(TRANS_DDI_FUNC_CTL(cpu_transcoder));
  	if (temp & TRANS_DDI_PHSYNC)
  		flags |= DRM_MODE_FLAG_PHSYNC;
drivers/gpu/drm/i915/intel_drv.h +0 -0
index 1ffd8d5..0d2c59f 100644

drivers/gpu/drm/i915/intel_drv.h void intel_ddi_set_pipe_settings(struct drm_crtc *crtc); · line 1018

Quoted 8 lines
drivers/gpu/drm/i915/intel_drv.h +2 -0
@@ -1011,6 +1011,8 @@ void intel_ddi_set_pipe_settings(struct drm_crtc *crtc);
  void intel_ddi_prepare_link_retrain(struct intel_dp *intel_dp);
  bool intel_ddi_connector_get_hw_state(struct intel_connector *intel_connector);
  void intel_ddi_fdi_disable(struct drm_crtc *crtc);
+bool intel_ddi_is_audio_enabled(struct drm_i915_private *dev_priv,
+				 struct intel_crtc *intel_crtc);
  void intel_ddi_get_config(struct intel_encoder *encoder,
  			  struct intel_crtc_state *pipe_config);
  struct intel_encoder *

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw

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

Quoted 13 lines · Libin Yang
Quoted 13 lines
Quoted 13 lines

drivers/gpu/drm/i915/intel_audio.c static void hsw_audio_codec_disable(struct intel_encoder *encoder) · line 267

Quoted 13 lines
drivers/gpu/drm/i915/intel_audio.c +2 -1
index 9aa83e7..5ad2e66 100644
@@ -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()?

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

drivers/gpu/drm/i915/intel_audio.c static void ilk_audio_codec_enable(struct drm_connector *connector, · line 480

Quoted 10 lines
drivers/gpu/drm/i915/intel_audio.c +2 -1
  	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()?

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

drivers/gpu/drm/i915/intel_audio.c void intel_audio_codec_enable(struct intel_encoder *intel_encoder) · line 518

Quoted 9 lines
drivers/gpu/drm/i915/intel_audio.c +2 -1
  	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
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#6 lore raw

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

Quoted 37 lines · Takashi Iwai
Quoted 13 lines · Libin Yang
Quoted 13 lines
Quoted 13 lines

drivers/gpu/drm/i915/intel_audio.c static void hsw_audio_codec_disable(struct intel_encoder *encoder) · line 267

Quoted 13 lines
drivers/gpu/drm/i915/intel_audio.c +2 -1
index 9aa83e7..5ad2e66 100644
@@ -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()?

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

drivers/gpu/drm/i915/intel_audio.c static void ilk_audio_codec_enable(struct drm_connector *connector, · line 480

Quoted 10 lines
drivers/gpu/drm/i915/intel_audio.c +2 -1
  	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()?

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/i915/intel_audio.c +0 -0
  	else
  		tmp |= audio_config_hdmi_pixel_clock(adjusted_mode);
@@ -512,7 +514,8 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder)
 
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

drivers/gpu/drm/i915/intel_audio.c void intel_audio_codec_enable(struct intel_encoder *intel_encoder) · line 518

Quoted 5 lines
drivers/gpu/drm/i915/intel_audio.c +2 -1
  	/* 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
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

author
#7 lore raw

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

Sorry, I missed the emails.

Quoted 23 lines · Takashi Iwai
Quoted 21 lines · Takashi Iwai
Quoted 13 lines · Libin Yang
Quoted 13 lines
Quoted 13 lines

drivers/gpu/drm/i915/intel_audio.c static void hsw_audio_codec_disable(struct intel_encoder *encoder) · line 267

Quoted 13 lines
drivers/gpu/drm/i915/intel_audio.c +2 -1
index 9aa83e7..5ad2e66 100644
@@ -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()?

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
drivers/gpu/drm/i915/intel_audio.c +0 -0
   	I915_WRITE(HSW_AUD_CFG(pipe), tmp);
 
Quoted 10 lines
Quoted 10 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/gpu/drm/i915/intel_audio.c static void ilk_audio_codec_enable(struct drm_connector *connector, · line 480

Quoted 8 lines
drivers/gpu/drm/i915/intel_audio.c +2 -1
@@ -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()?

Based on the discussion, I think you and Jani are right. It should be in hsw_audio_codec_enable() and not in ild_audio_codec_disable().

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/i915/intel_audio.c +0 -0
   	else
   		tmp |= audio_config_hdmi_pixel_clock(adjusted_mode);
@@ -512,7 +514,8 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder)
 
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

drivers/gpu/drm/i915/intel_audio.c void intel_audio_codec_enable(struct intel_encoder *intel_encoder) · line 518

Quoted 5 lines
drivers/gpu/drm/i915/intel_audio.c +2 -1
   	/* 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.

OK, I will use a macro.

Quoted 8 lines

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)

Quoted 7 lines
{
	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);
}

Yes, I will fix it in the new version patch.

Best Regards,
Libin

Quoted 8 lines

Takashi
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

maintainer
#8 lore raw

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

In reply to Takashi Iwai
Quoted 36 lines · Takashi Iwai
Quoted 13 lines · Libin Yang
Quoted 13 lines
Quoted 13 lines

drivers/gpu/drm/i915/intel_audio.c static void hsw_audio_codec_disable(struct intel_encoder *encoder) · line 267

Quoted 13 lines
drivers/gpu/drm/i915/intel_audio.c +2 -1
index 9aa83e7..5ad2e66 100644
@@ -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()?

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

drivers/gpu/drm/i915/intel_audio.c static void ilk_audio_codec_enable(struct drm_connector *connector, · line 480

Quoted 10 lines
drivers/gpu/drm/i915/intel_audio.c +2 -1
  	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()?

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/i915/intel_audio.c +0 -0
  	else
  		tmp |= audio_config_hdmi_pixel_clock(adjusted_mode);
@@ -512,7 +514,8 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder)
 
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

drivers/gpu/drm/i915/intel_audio.c void intel_audio_codec_enable(struct intel_encoder *intel_encoder) · line 518

Quoted 5 lines
drivers/gpu/drm/i915/intel_audio.c +2 -1
  	/* 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.

Quoted 5 lines

thanks,

Takashi

Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#9 lore raw

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

Quoted 47 lines · Jani Nikula
Quoted 36 lines · Takashi Iwai
Quoted 13 lines · Libin Yang
Quoted 13 lines
Quoted 13 lines

drivers/gpu/drm/i915/intel_audio.c static void hsw_audio_codec_disable(struct intel_encoder *encoder) · line 267

Quoted 13 lines
drivers/gpu/drm/i915/intel_audio.c +2 -1
index 9aa83e7..5ad2e66 100644
@@ -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()?

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

drivers/gpu/drm/i915/intel_audio.c static void ilk_audio_codec_enable(struct drm_connector *connector, · line 480

Quoted 10 lines
drivers/gpu/drm/i915/intel_audio.c +2 -1
  	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()?

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/i915/intel_audio.c +0 -0
  	else
  		tmp |= audio_config_hdmi_pixel_clock(adjusted_mode);
@@ -512,7 +514,8 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder)
 
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

drivers/gpu/drm/i915/intel_audio.c void intel_audio_codec_enable(struct intel_encoder *intel_encoder) · line 518

Quoted 5 lines
drivers/gpu/drm/i915/intel_audio.c +2 -1
  	/* 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.

Quoted 2 lines

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
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

maintainer
#10 lore raw

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

Quoted 49 lines · Takashi Iwai
Quoted 47 lines · Jani Nikula
Quoted 44 lines · Takashi Iwai
Quoted 13 lines · Libin Yang
Quoted 13 lines
Quoted 13 lines

drivers/gpu/drm/i915/intel_audio.c static void hsw_audio_codec_disable(struct intel_encoder *encoder) · line 267

Quoted 13 lines
drivers/gpu/drm/i915/intel_audio.c +2 -1
index 9aa83e7..5ad2e66 100644
@@ -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()?

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

drivers/gpu/drm/i915/intel_audio.c static void ilk_audio_codec_enable(struct drm_connector *connector, · line 480

Quoted 10 lines
drivers/gpu/drm/i915/intel_audio.c +2 -1
  	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()?

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

drivers/gpu/drm/i915/intel_audio.c void intel_audio_codec_enable(struct intel_encoder *intel_encoder) · line 518

Quoted 9 lines
drivers/gpu/drm/i915/intel_audio.c +2 -1
  	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.

Quoted 5 lines
Quoted 2 lines

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.

Quoted 5 lines

thanks,

Takashi

Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#11 lore raw

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

Quoted 54 lines · Jani Nikula
Quoted 52 lines · Takashi Iwai
Quoted 49 lines · Jani Nikula
Quoted 36 lines · Takashi Iwai
Quoted 13 lines · Libin Yang
Quoted 13 lines
Quoted 13 lines

drivers/gpu/drm/i915/intel_audio.c static void hsw_audio_codec_disable(struct intel_encoder *encoder) · line 267

Quoted 13 lines
drivers/gpu/drm/i915/intel_audio.c +2 -1
index 9aa83e7..5ad2e66 100644
@@ -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()?

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

drivers/gpu/drm/i915/intel_audio.c static void ilk_audio_codec_enable(struct drm_connector *connector, · line 480

Quoted 10 lines
drivers/gpu/drm/i915/intel_audio.c +2 -1
  	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()?

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/i915/intel_audio.c +0 -0
  	else
  		tmp |= audio_config_hdmi_pixel_clock(adjusted_mode);
@@ -512,7 +514,8 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder)
 
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

drivers/gpu/drm/i915/intel_audio.c void intel_audio_codec_enable(struct intel_encoder *intel_encoder) · line 518

Quoted 5 lines
drivers/gpu/drm/i915/intel_audio.c +2 -1
  	/* 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.

Quoted 6 lines
Quoted 2 lines

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
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#12 lore raw

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

In reply to Libin Yang
Quoted 15 lines · Libin Yang

Add Takashi and ALSA mail list.

Quoted 11 lines · Daniel Vetter
Quoted 3 lines · Libin Yang

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.

Quoted 3 lines
Quoted 1 line

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

---

drivers/gpu/drm/i915/intel_dp_mst.c +7 -0
index 8b608c2cd070..87dad62fd10b 100644
@@ -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
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#13 lore raw

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

Quoted 18 lines · Takashi Iwai
Quoted 15 lines · Libin Yang

Add Takashi and ALSA mail list.

Quoted 11 lines · Daniel Vetter
Quoted 3 lines · Libin Yang

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.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

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
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

author
#14 lore raw
In reply to [email protected]

Add Takashi and ALSA mailing list

Best Regards,
Libin

Quoted 141 lines · On 12/02/2015 02:09 PM, [email protected] wrote:

From: Libin Yang <[email protected]>

This adds code to initialise the SDP streams
for a sink in the simplest ordering.

I've no idea how you'd want to control the
ordering at this level, so don't bother
until someone comes up with a use case.

---
  drivers/gpu/drm/drm_dp_mst_topology.c | 38 ++++++++++++++++++++++++++++++++---
  include/drm/drm_dp_mst_helper.h       |  7 +++++--
  2 files changed, 40 insertions(+), 5 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +35 -3
index 809959d..f50eb7b 100644
@@ -666,7 +666,9 @@ static int build_enum_path_resources(struct drm_dp_sideband_msg_tx *msg, int por
  }
 
  static int build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int port_num,
-				  u8 vcpi, uint16_t pbn)
+				  u8 vcpi, uint16_t pbn,
+				  u8 number_sdp_streams,
+				  u8 *sdp_stream_sink)
  {
  	struct drm_dp_sideband_msg_req_body req;
  	memset(&req, 0, sizeof(req));
@@ -674,6 +676,9 @@ static int build_allocate_payload(struct drm_dp_sideband_msg_tx *msg, int port_n
  	req.u.allocate_payload.port_number = port_num;
  	req.u.allocate_payload.vcpi = vcpi;
  	req.u.allocate_payload.pbn = pbn;
+	req.u.allocate_payload.number_sdp_streams = number_sdp_streams;
+	memcpy(req.u.allocate_payload.sdp_stream_sink, sdp_stream_sink,
+		   number_sdp_streams);
  	drm_dp_encode_sideband_req(&req, msg);
  	msg->path_msg = true;
  	return 0;
@@ -1562,6 +1567,8 @@ static int drm_dp_payload_send_msg(struct drm_dp_mst_topology_mgr *mgr,
  	struct drm_dp_sideband_msg_tx *txmsg;
  	struct drm_dp_mst_branch *mstb;
  	int len, ret;
+	u8 sinks[DRM_DP_MAX_SDP_STREAMS];
+	int i;
 
  	mstb = drm_dp_get_validated_mstb_ref(mgr, port->parent);
  	if (!mstb)
@@ -1573,10 +1580,13 @@ static int drm_dp_payload_send_msg(struct drm_dp_mst_topology_mgr *mgr,
  		goto fail_put;
  	}
 
+	for (i = 0; i < port->num_sdp_streams; i++)
+		sinks[i] = i;
+
  	txmsg->dst = mstb;
  	len = build_allocate_payload(txmsg, port->port_num,
  				     id,
-				     pbn);
+				     pbn, port->num_sdp_streams, sinks);
 
  	drm_dp_queue_down_tx(mgr, txmsg);
 
@@ -2259,6 +2269,27 @@ out:
  EXPORT_SYMBOL(drm_dp_mst_detect_port);
 
  /**
+ * drm_dp_mst_port_has_audio() - Check whether port has audio capability or not
+ * @mgr: manager for this port
+ * @port: unverified pointer to a port.
+ *
+ * This returns whether the port supports audio or not.
+ */
+bool drm_dp_mst_port_has_audio(struct drm_dp_mst_topology_mgr *mgr,
+					struct drm_dp_mst_port *port)
+{
+	bool ret = false;
+
+	port = drm_dp_get_validated_port_ref(mgr, port);
+	if (!port)
+		return ret;
+	ret = port->has_audio;
+	drm_dp_put_port(port);
+	return ret;
+}
+EXPORT_SYMBOL(drm_dp_mst_port_has_audio);
+
+/**
   * drm_dp_mst_get_edid() - get EDID for an MST port
   * @connector: toplevel connector to get EDID for
   * @mgr: manager for this port
@@ -2283,6 +2314,7 @@ struct edid *drm_dp_mst_get_edid(struct drm_connector *connector, struct drm_dp_
  		edid = drm_get_edid(connector, &port->aux.ddc);
  		drm_mode_connector_set_tile_property(connector);
  	}
+	port->has_audio = drm_detect_monitor_audio(edid);
  	drm_dp_put_port(port);
  	return edid;
  }
@@ -2566,7 +2598,7 @@ static void drm_dp_mst_dump_mstb(struct seq_file *m,
 
  	seq_printf(m, "%smst: %p, %d\n", prefix, mstb, mstb->num_ports);
  	list_for_each_entry(port, &mstb->ports, next) {
-		seq_printf(m, "%sport: %d: ddps: %d ldps: %d, %p, conn: %p\n", prefix, port->port_num, port->ddps, port->ldps, port, port->connector);
+		seq_printf(m, "%sport: %d: ddps: %d ldps: %d, sdp: %d/%d, %p, conn: %p\n", prefix, port->port_num, port->ddps, port->ldps, port->num_sdp_streams, port->num_sdp_stream_sinks, port, port->connector);
  		if (port->mstb)
  			drm_dp_mst_dump_mstb(m, port->mstb);
  	}
include/drm/drm_dp_mst_helper.h +3 -2
index 5340099..74b5888 100644
@@ -94,6 +94,7 @@ struct drm_dp_mst_port {
  	struct drm_dp_mst_topology_mgr *mgr;
 
  	struct edid *cached_edid; /* for DP logical ports - make tiling work */
+	bool has_audio;
  };
 
  /**
@@ -215,13 +216,13 @@ struct drm_dp_sideband_msg_rx {
  	struct drm_dp_sideband_msg_hdr initial_hdr;
  };
 
-
+#define DRM_DP_MAX_SDP_STREAMS 16
  struct drm_dp_allocate_payload {
  	u8 port_number;
  	u8 number_sdp_streams;
  	u8 vcpi;
  	u16 pbn;
-	u8 sdp_stream_sink[8];
+	u8 sdp_stream_sink[DRM_DP_MAX_SDP_STREAMS];
  };
 
  struct drm_dp_allocate_payload_ack_reply {

include/drm/drm_dp_mst_helper.h int drm_dp_mst_hpd_irq(struct drm_dp_mst_topology_mgr *mgr, u8 *esi, bool *handl · line 492

Quoted 8 lines
include/drm/drm_dp_mst_helper.h +2 -0
@@ -484,6 +485,8 @@ int drm_dp_mst_hpd_irq(struct drm_dp_mst_topology_mgr *mgr, u8 *esi, bool *handl
 
  enum drm_connector_status drm_dp_mst_detect_port(struct drm_connector *connector, struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port);
 
+bool drm_dp_mst_port_has_audio(struct drm_dp_mst_topology_mgr *mgr,
+					struct drm_dp_mst_port *port);
  struct edid *drm_dp_mst_get_edid(struct drm_connector *connector, struct drm_dp_mst_topology_mgr *mgr, struct drm_dp_mst_port *port);
 
 

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx