From: David Henningsson <david.henningsson@canonical.com>
To: Jani Nikula <jani.nikula@linux.intel.com>,
alsa-devel@alsa-project.org, intel-gfx@lists.freedesktop.org,
vinod.koul@intel.com, daniel.vetter@intel.com, tiwai@suse.de,
libin.yang@intel.com
Subject: Re: [PATCH 2/4] drm/i915: Call audio pin/ELD notify function
Date: Fri, 28 Aug 2015 15:15:30 +0200 [thread overview]
Message-ID: <55E05EF2.2040708@canonical.com> (raw)
In-Reply-To: <87si735zos.fsf@intel.com>
On 2015-08-28 15:07, Jani Nikula wrote:
> On Wed, 19 Aug 2015, David Henningsson <david.henningsson@canonical.com> wrote:
>> 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>
>> ---
>> drivers/gpu/drm/i915/i915_drv.h | 1 +
>> drivers/gpu/drm/i915/intel_audio.c | 23 ++++++++++++++++++++---
>> 2 files changed, 21 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
>> index fd1de45..1fc327d 100644
>> --- a/drivers/gpu/drm/i915/i915_drv.h
>> +++ b/drivers/gpu/drm/i915/i915_drv.h
>> @@ -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;
>> diff --git a/drivers/gpu/drm/i915/intel_audio.c b/drivers/gpu/drm/i915/intel_audio.c
>> index 3da9b84..969835d 100644
>> --- a/drivers/gpu/drm/i915/intel_audio.c
>> +++ b/drivers/gpu/drm/i915/intel_audio.c
>> @@ -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);
>
> AFAICT this has a race with i915_audio_component_unbind, i.e. modeset
> while hda is being unloaded might crash.
>
> What do others think, is drm_modeset_lock_all in combonent bind/unbind
> overkill?
Thanks for the review(s). I'm happy to add a
drm_modeset_lock_all/drm_modeset_unlock_all - I'm not that familiar with
the graphics side, really, so, is there another option...?
>
> With that resolved one way or another (I'm not dismissing "we don't need
> to care") this is
>
> Reviewed-by: Jani Nikula <jani.nikula@intel.com>
>
>
>> }
>>
>> /**
>> @@ -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 = {
>> --
>> 1.9.1
>>
>
--
David Henningsson, Canonical Ltd.
https://launchpad.net/~diwic
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2015-08-28 13:15 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-19 8:48 [PATCH v4 0/4] i915 to call hda driver on HDMI plug/unplug David Henningsson
2015-08-19 8:48 ` [PATCH 1/4] drm/i915: Add audio pin sense / ELD callback David Henningsson
2015-08-26 8:33 ` Daniel Vetter
2015-08-26 18:39 ` [alsa-devel] " David Henningsson
2015-08-27 14:24 ` Jani Nikula
2015-08-28 12:55 ` Jani Nikula
2015-08-19 8:48 ` [PATCH 2/4] drm/i915: Call audio pin/ELD notify function David Henningsson
2015-08-28 13:07 ` Jani Nikula
2015-08-28 13:15 ` David Henningsson [this message]
2015-08-19 8:48 ` [PATCH 3/4] ALSA: hda - allow codecs to access the i915 pin/ELD callback David Henningsson
2015-08-19 8:48 ` [PATCH 4/4] ALSA: hda - Wake the codec up on pin/ELD notify events David Henningsson
2015-08-20 9:28 ` Takashi Iwai
2015-08-20 9:41 ` David Henningsson
2015-08-20 9:46 ` Takashi Iwai
2015-08-28 13:10 ` Jani Nikula
2015-09-02 8:00 ` Daniel Vetter
2015-09-02 8:03 ` Takashi Iwai
2015-09-02 8:32 ` Daniel Vetter
2015-09-02 9:39 ` Takashi Iwai
-- strict thread matches above, loose matches on Subject: below --
2015-08-28 17:02 [PATCH 0/4 v5] i915 to call hda driver on HDMI plug/unplug David Henningsson
2015-08-28 17:02 ` [PATCH 2/4] drm/i915: Call audio pin/ELD notify function David Henningsson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55E05EF2.2040708@canonical.com \
--to=david.henningsson@canonical.com \
--cc=alsa-devel@alsa-project.org \
--cc=daniel.vetter@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=libin.yang@intel.com \
--cc=tiwai@suse.de \
--cc=vinod.koul@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox