@@ -1808,6 +1808,7 @@ struct drm_i915_private {
struct drm_property *force_audio_property;
/* hda/i915 audio component */
+ struct i915_audio_component *audio_component;
bool audio_component_registered;
uint32_t hw_context_size;
@@ -384,6 +384,39 @@ static void ilk_audio_codec_enable(struct drm_connector *connector,
I915_WRITE(aud_config, tmp);
}
+static void audio_hotplug_notify(struct intel_encoder *intel_encoder,
+ struct drm_connector *connector)
+{
+ struct i915_audio_hotplug_info audio_info;
+ struct drm_encoder *encoder = &intel_encoder->base;
+ struct drm_device *dev = encoder->dev;
+ struct drm_i915_private *dev_priv = dev->dev_private;
+ 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_dig_port->port;
+
+ if (!acomp || !acomp->audio_ops || !acomp->audio_ops->hotplug_notify)
+ return;
+
+ memset((void *) &audio_info, 0, sizeof(audio_info));
+
+ if (connector) {
+ audio_info.connector_type = connector->connector_type;
+ audio_info.connector_type_id = connector->connector_type_id;
+ audio_info.plugged_in = true;
+ audio_info.eld = connector->eld;
+ audio_info.eld_size = drm_eld_size(audio_info.eld);
+ } else {
+ audio_info.connector_type = -1;
+ audio_info.connector_type_id = -1;
+ }
+
+ audio_info.port = (int) port;
+ /* DP Mst is unsupported for now */
+
+ acomp->audio_ops->hotplug_notify(acomp->hdac_bus, &audio_info);
+}
+
/**
* intel_audio_codec_enable - Enable the audio codec for HD audio
* @intel_encoder: encoder on which to enable audio
@@ -419,6 +452,8 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder)
if (dev_priv->display.audio_codec_enable)
dev_priv->display.audio_codec_enable(connector, intel_encoder, mode);
+
+ audio_hotplug_notify(intel_encoder, connector);
}
/**
@@ -435,6 +470,8 @@ void intel_audio_codec_disable(struct intel_encoder *encoder)
if (dev_priv->display.audio_codec_disable)
dev_priv->display.audio_codec_disable(encoder);
+
+ audio_hotplug_notify(encoder, NULL);
}
/**
@@ -525,12 +562,14 @@ static int i915_audio_component_bind(struct device *i915_dev,
struct device *hda_dev, void *data)
{
struct i915_audio_component *acomp = data;
+ struct drm_i915_private *dev_priv = dev_to_i915(i915_dev);
if (WARN_ON(acomp->ops || acomp->dev))
return -EEXIST;
acomp->ops = &i915_audio_component_ops;
acomp->dev = i915_dev;
+ dev_priv->audio_component = acomp;
return 0;
}
@@ -539,9 +578,11 @@ static void i915_audio_component_unbind(struct device *i915_dev,
struct device *hda_dev, void *data)
{
struct i915_audio_component *acomp = data;
+ struct drm_i915_private *dev_priv = dev_to_i915(i915_dev);
acomp->ops = NULL;
acomp->dev = NULL;
+ dev_priv->audio_component = NULL;
}
static const struct component_ops i915_audio_component_bind_ops = {
On HDMI hotplug events, notify the audio driver. This will enable the audio driver to get the information at all times (even when audio is in different powersave states), and also without reading it from the hardware. Signed-off-by: David Henningsson <david.henningsson@canonical.com> --- drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/intel_audio.c | 41 ++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+)