lkml.org 
[lkml]   [2022]   [Sep]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] ALSA: hda/hdmi: run eld notify in delay work
Date
During resolution change, display driver would disable HDMI audio then
enable it in a short time. There is possibility that eld notify for
HDMI audio enable is called when previous runtime suspend is still
running. In this case, the elf nofity just returns and not updating the
status of corresponding HDMI pin/port. Here we move the eld nofity to
a delay work so we don't lose it.

Signed-off-by: Brent Lu <brent.lu@intel.com>
---
sound/pci/hda/patch_hdmi.c | 38 +++++++++++++++++++++++++++++++++-----
1 file changed, 33 insertions(+), 5 deletions(-)

diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 6c209cd26c0c..a4c305ee8ff9 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -2907,13 +2907,21 @@ static int intel_port2pin(struct hda_codec *codec, int port)
return spec->port_map[port];
}

-static void intel_pin_eld_notify(void *audio_ptr, int port, int pipe)
+struct pin_eld_notify {
+ void *audio_ptr;
+ int port;
+ int pipe;
+ struct delayed_work notify_work;
+};
+
+static void pin_eld_notify_work(struct work_struct *work)
{
- struct hda_codec *codec = audio_ptr;
+ struct pin_eld_notify *notify = container_of(work, struct pin_eld_notify, notify_work.work);
+ struct hda_codec *codec = notify->audio_ptr;
int pin_nid;
- int dev_id = pipe;
+ int dev_id = notify->pipe;

- pin_nid = intel_port2pin(codec, port);
+ pin_nid = intel_port2pin(codec, notify->port);
if (!pin_nid)
return;
/* skip notification during system suspend (but not in runtime PM);
@@ -2922,13 +2930,33 @@ static void intel_pin_eld_notify(void *audio_ptr, int port, int pipe)
if (codec->core.dev.power.power_state.event == PM_EVENT_SUSPEND)
return;
/* ditto during suspend/resume process itself */
- if (snd_hdac_is_in_pm(&codec->core))
+ if (snd_hdac_is_in_pm(&codec->core)) {
+ schedule_delayed_work(&notify->notify_work, msecs_to_jiffies(10));
return;
+ }

snd_hdac_i915_set_bclk(&codec->bus->core);
check_presence_and_report(codec, pin_nid, dev_id);
}

+static void intel_pin_eld_notify(void *audio_ptr, int port, int pipe)
+{
+ struct hda_codec *codec = audio_ptr;
+ struct device *dev = hda_codec_dev(codec);
+ struct pin_eld_notify *notify;
+
+ notify = devm_kzalloc(dev, sizeof(struct pin_eld_notify), GFP_KERNEL);
+ if (!notify)
+ return;
+
+ notify->audio_ptr = audio_ptr;
+ notify->port = port;
+ notify->pipe = pipe;
+ INIT_DELAYED_WORK(&notify->notify_work, pin_eld_notify_work);
+
+ schedule_delayed_work(&notify->notify_work, 0);
+}
+
static const struct drm_audio_component_audio_ops intel_audio_ops = {
.pin2port = intel_pin2port,
.pin_eld_notify = intel_pin_eld_notify,
--
2.25.1
\
 
 \ /
  Last update: 2022-09-27 16:01    [W:0.067 / U:0.820 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site