]> git.karo-electronics.de Git - linux-beck.git/commitdiff
drm/i915: Call audio pin/ELD notify function
authorDavid Henningsson <david.henningsson@canonical.com>
Wed, 19 Aug 2015 08:48:56 +0000 (10:48 +0200)
committerTakashi Iwai <tiwai@suse.de>
Wed, 2 Sep 2015 09:31:44 +0000 (11:31 +0200)
When the audio codec is enabled or disabled, notify the audio driver.
This will enable the audio driver to get the notification at all times
(even when audio is in different powersave states).

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Acked-by: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/intel_audio.c

index fd1de451c8c6bae13f42eaae5e9cfe572039ea18..1fc327d3421e3d47a2ee40731b0964ed78729059 100644 (file)
@@ -1809,6 +1809,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;
index 3da9b8409f205723da7a3613fd1badf77e4b64cc..969835db8ff700a3aa5c4187348c7833d825a8b9 100644 (file)
@@ -399,6 +399,9 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder)
        struct drm_connector *connector;
        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;
 
        connector = drm_select_eld(encoder, mode);
        if (!connector)
@@ -419,6 +422,9 @@ 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);
+
+       if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify)
+               acomp->audio_ops->pin_eld_notify(acomp->audio_ops->audio_ptr, (int) port, 0);
 }
 
 /**
@@ -428,13 +434,20 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder)
  * The disable sequences must be performed before disabling the transcoder or
  * port.
  */
-void intel_audio_codec_disable(struct intel_encoder *encoder)
+void intel_audio_codec_disable(struct intel_encoder *intel_encoder)
 {
-       struct drm_device *dev = encoder->base.dev;
+       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 (dev_priv->display.audio_codec_disable)
-               dev_priv->display.audio_codec_disable(encoder);
+               dev_priv->display.audio_codec_disable(intel_encoder);
+
+       if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify)
+               acomp->audio_ops->pin_eld_notify(acomp->audio_ops->audio_ptr, (int) port, 0);
 }
 
 /**
@@ -525,12 +538,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 +554,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 = {