Message ID | 1472023380-29923-4-git-send-email-dhinakaran.pandiyan@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Confirmed on IRC, Lyude is fine with carrying over R-B from previous version. On Wed, 2016-08-24 at 00:22 -0700, Dhinakaran Pandiyan wrote: > With DP MST, a digital_port can carry more than one audio stream. Hence, > more than one audio_connector needs to be attached to intel_digital_port in > such cases. However, each stream is associated with an unique encoder. So, > instead of creating an array of audio_connectors per port, move > audio_connector from struct intel_digital_port to struct intel_encoder. > This also simplifies access to the right audio_connector from codec > functions in intel_audio.c that receive intel_encoder. > > v2: Removed locals that are not needed anymore. > > Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> > --- > drivers/gpu/drm/i915/intel_audio.c | 12 ++++-------- > drivers/gpu/drm/i915/intel_drv.h | 4 ++-- > 2 files changed, 6 insertions(+), 10 deletions(-) > > diff --git a/drivers/gpu/drm/i915/intel_audio.c b/drivers/gpu/drm/i915/intel_audio.c > index 5a41439..b86bfad 100644 > --- a/drivers/gpu/drm/i915/intel_audio.c > +++ b/drivers/gpu/drm/i915/intel_audio.c > @@ -490,7 +490,6 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder) > struct drm_connector *connector; > struct drm_i915_private *dev_priv = to_i915(encoder->dev); > struct i915_audio_component *acomp = dev_priv->audio_component; > - struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder); > enum port port = intel_encoder->attached_port; > > connector = drm_select_eld(encoder); > @@ -515,7 +514,7 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder) > adjusted_mode); > > mutex_lock(&dev_priv->av_mutex); > - intel_dig_port->audio_connector = connector; > + intel_encoder->audio_connector = connector; > /* referred in audio callbacks */ > dev_priv->dig_port_map[port] = intel_encoder; > mutex_unlock(&dev_priv->av_mutex); > @@ -536,14 +535,13 @@ void intel_audio_codec_disable(struct intel_encoder *intel_encoder) > struct drm_encoder *encoder = &intel_encoder->base; > struct drm_i915_private *dev_priv = to_i915(encoder->dev); > struct i915_audio_component *acomp = dev_priv->audio_component; > - struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder); > enum port port = intel_encoder->attached_port; > > if (dev_priv->display.audio_codec_disable) > dev_priv->display.audio_codec_disable(intel_encoder); > > mutex_lock(&dev_priv->av_mutex); > - intel_dig_port->audio_connector = NULL; > + intel_encoder->audio_connector = NULL; > dev_priv->dig_port_map[port] = NULL; > mutex_unlock(&dev_priv->av_mutex); > > @@ -704,7 +702,6 @@ static int i915_audio_component_get_eld(struct device *dev, int port, > { > struct drm_i915_private *dev_priv = dev_to_i915(dev); > struct intel_encoder *intel_encoder; > - struct intel_digital_port *intel_dig_port; > const u8 *eld; > int ret = -EINVAL; > > @@ -713,10 +710,9 @@ static int i915_audio_component_get_eld(struct device *dev, int port, > /* intel_encoder might be NULL for DP MST */ > if (intel_encoder) { > ret = 0; > - intel_dig_port = enc_to_dig_port(&intel_encoder->base); > - *enabled = intel_dig_port->audio_connector != NULL; > + *enabled = intel_encoder->audio_connector != NULL; > if (*enabled) { > - eld = intel_dig_port->audio_connector->eld; > + eld = intel_encoder->audio_connector->eld; > ret = drm_eld_size(eld); > memcpy(buf, eld, min(max_bytes, ret)); > } > diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h > index 68bf134..30186bf 100644 > --- a/drivers/gpu/drm/i915/intel_drv.h > +++ b/drivers/gpu/drm/i915/intel_drv.h > @@ -232,6 +232,8 @@ struct intel_encoder { > void (*suspend)(struct intel_encoder *); > int crtc_mask; > enum hpd_pin hpd_pin; > + /* for communication with audio component; protected by av_mutex */ > + const struct drm_connector *audio_connector; > }; > > struct intel_panel { > @@ -948,8 +950,6 @@ struct intel_digital_port { > enum irqreturn (*hpd_pulse)(struct intel_digital_port *, bool); > bool release_cl2_override; > uint8_t max_lanes; > - /* for communication with audio component; protected by av_mutex */ > - const struct drm_connector *audio_connector; > }; > > struct intel_dp_mst_encoder {
diff --git a/drivers/gpu/drm/i915/intel_audio.c b/drivers/gpu/drm/i915/intel_audio.c index 5a41439..b86bfad 100644 --- a/drivers/gpu/drm/i915/intel_audio.c +++ b/drivers/gpu/drm/i915/intel_audio.c @@ -490,7 +490,6 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder) struct drm_connector *connector; struct drm_i915_private *dev_priv = to_i915(encoder->dev); struct i915_audio_component *acomp = dev_priv->audio_component; - struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder); enum port port = intel_encoder->attached_port; connector = drm_select_eld(encoder); @@ -515,7 +514,7 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder) adjusted_mode); mutex_lock(&dev_priv->av_mutex); - intel_dig_port->audio_connector = connector; + intel_encoder->audio_connector = connector; /* referred in audio callbacks */ dev_priv->dig_port_map[port] = intel_encoder; mutex_unlock(&dev_priv->av_mutex); @@ -536,14 +535,13 @@ void intel_audio_codec_disable(struct intel_encoder *intel_encoder) struct drm_encoder *encoder = &intel_encoder->base; struct drm_i915_private *dev_priv = to_i915(encoder->dev); struct i915_audio_component *acomp = dev_priv->audio_component; - struct intel_digital_port *intel_dig_port = enc_to_dig_port(encoder); enum port port = intel_encoder->attached_port; if (dev_priv->display.audio_codec_disable) dev_priv->display.audio_codec_disable(intel_encoder); mutex_lock(&dev_priv->av_mutex); - intel_dig_port->audio_connector = NULL; + intel_encoder->audio_connector = NULL; dev_priv->dig_port_map[port] = NULL; mutex_unlock(&dev_priv->av_mutex); @@ -704,7 +702,6 @@ static int i915_audio_component_get_eld(struct device *dev, int port, { struct drm_i915_private *dev_priv = dev_to_i915(dev); struct intel_encoder *intel_encoder; - struct intel_digital_port *intel_dig_port; const u8 *eld; int ret = -EINVAL; @@ -713,10 +710,9 @@ static int i915_audio_component_get_eld(struct device *dev, int port, /* intel_encoder might be NULL for DP MST */ if (intel_encoder) { ret = 0; - intel_dig_port = enc_to_dig_port(&intel_encoder->base); - *enabled = intel_dig_port->audio_connector != NULL; + *enabled = intel_encoder->audio_connector != NULL; if (*enabled) { - eld = intel_dig_port->audio_connector->eld; + eld = intel_encoder->audio_connector->eld; ret = drm_eld_size(eld); memcpy(buf, eld, min(max_bytes, ret)); } diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 68bf134..30186bf 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -232,6 +232,8 @@ struct intel_encoder { void (*suspend)(struct intel_encoder *); int crtc_mask; enum hpd_pin hpd_pin; + /* for communication with audio component; protected by av_mutex */ + const struct drm_connector *audio_connector; }; struct intel_panel { @@ -948,8 +950,6 @@ struct intel_digital_port { enum irqreturn (*hpd_pulse)(struct intel_digital_port *, bool); bool release_cl2_override; uint8_t max_lanes; - /* for communication with audio component; protected by av_mutex */ - const struct drm_connector *audio_connector; }; struct intel_dp_mst_encoder {
With DP MST, a digital_port can carry more than one audio stream. Hence, more than one audio_connector needs to be attached to intel_digital_port in such cases. However, each stream is associated with an unique encoder. So, instead of creating an array of audio_connectors per port, move audio_connector from struct intel_digital_port to struct intel_encoder. This also simplifies access to the right audio_connector from codec functions in intel_audio.c that receive intel_encoder. v2: Removed locals that are not needed anymore. Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> --- drivers/gpu/drm/i915/intel_audio.c | 12 ++++-------- drivers/gpu/drm/i915/intel_drv.h | 4 ++-- 2 files changed, 6 insertions(+), 10 deletions(-)