From: Ian Minett <ian_minett@creativelabs.com>
To: patch@alsa-project.org
Cc: alsa-devel@alsa-project.org, Ian Minett <ian_minett@creativelabs.com>
Subject: [PATCH 4/4] ALSA: CA0132: Update hp unsol event handler
Date: Fri, 8 Feb 2013 18:31:45 -0800 [thread overview]
Message-ID: <1360377105-2480-5-git-send-email-ian_minett@creativelabs.com> (raw)
In-Reply-To: <1360377105-2480-1-git-send-email-ian_minett@creativelabs.com>
From: Ian Minett <ian_minett@creativelabs.com>
Manage the delayed work queue in hp unsol event handler.
Signed-off-by: Ian Minett <ian_minett@creativelabs.com>
diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c
index c797f65..61d74db 100644
--- a/sound/pci/hda/patch_ca0132.c
+++ b/sound/pci/hda/patch_ca0132.c
@@ -749,6 +749,9 @@ struct ca0132_spec {
long voicefx_val;
long cur_mic_boost;
+ struct hda_codec *codec;
+ struct delayed_work unsol_hp_work;
+
#ifdef ENABLE_TUNING_CONTROLS
long cur_ctl_vals[TUNING_CTLS_COUNT];
#endif
@@ -3338,6 +3341,14 @@ exit:
return err < 0 ? err : 0;
}
+static void ca0132_unsol_hp_delayed(struct work_struct *work)
+{
+ struct ca0132_spec *spec = container_of(
+ to_delayed_work(work), struct ca0132_spec, unsol_hp_work);
+ ca0132_select_out(spec->codec);
+ snd_hda_jack_report_sync(spec->codec);
+}
+
static void ca0132_set_dmic(struct hda_codec *codec, int enable);
static int ca0132_mic_boost_set(struct hda_codec *codec, long val);
static int ca0132_effects_set(struct hda_codec *codec, hda_nid_t nid, long val);
@@ -4540,8 +4551,9 @@ static void ca0132_process_dsp_response(struct hda_codec *codec)
static void ca0132_unsol_event(struct hda_codec *codec, unsigned int res)
{
- snd_printdd(KERN_INFO "ca0132_unsol_event: 0x%x\n", res);
+ struct ca0132_spec *spec = codec->spec;
+ snd_printdd(KERN_INFO "ca0132_unsol_event: 0x%x\n", res);
if (((res >> AC_UNSOL_RES_TAG_SHIFT) & 0x3f) == UNSOL_TAG_DSP) {
ca0132_process_dsp_response(codec);
@@ -4553,8 +4565,10 @@ static void ca0132_unsol_event(struct hda_codec *codec, unsigned int res)
switch (res) {
case UNSOL_TAG_HP:
- ca0132_select_out(codec);
- snd_hda_jack_report_sync(codec);
+ cancel_delayed_work_sync(&spec->unsol_hp_work);
+ queue_delayed_work(codec->bus->workq,
+ &spec->unsol_hp_work,
+ msecs_to_jiffies(500));
break;
case UNSOL_TAG_AMIC1:
ca0132_select_mic(codec);
@@ -4729,6 +4743,7 @@ static void ca0132_free(struct hda_codec *codec)
{
struct ca0132_spec *spec = codec->spec;
+ cancel_delayed_work_sync(&spec->unsol_hp_work);
snd_hda_power_up(codec);
snd_hda_sequence_write(codec, spec->base_exit_verbs);
ca0132_exit_chip(codec);
@@ -4794,6 +4809,7 @@ static int patch_ca0132(struct hda_codec *codec)
if (!spec)
return -ENOMEM;
codec->spec = spec;
+ spec->codec = codec;
spec->num_mixers = 1;
spec->mixers[0] = ca0132_mixer;
@@ -4804,6 +4820,8 @@ static int patch_ca0132(struct hda_codec *codec)
spec->init_verbs[1] = ca0132_init_verbs1;
spec->num_init_verbs = 2;
+ INIT_DELAYED_WORK(&spec->unsol_hp_work, ca0132_unsol_hp_delayed);
+
ca0132_init_chip(codec);
ca0132_config(codec);
--
1.7.4.1
next prev parent reply other threads:[~2013-02-09 2:31 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-09 2:31 [PATCH 0/4] ALSA: Updates for the CA0132 codec Ian Minett
2013-02-09 2:31 ` [PATCH 1/4] ALSA: CA0132: Add SpeakerEQ feature firmware loading Ian Minett
2013-02-10 10:47 ` Takashi Iwai
2013-02-09 2:31 ` [PATCH 2/4] ALSA: CA0132: Improve the DSP transfer timeout calculations Ian Minett
2013-02-10 10:51 ` Takashi Iwai
2013-02-09 2:31 ` [PATCH 3/4] ALSA: CA0132: Add latency monitoring Ian Minett
2013-02-10 10:51 ` Takashi Iwai
2013-03-25 17:47 ` Dylan Reid
2013-04-02 9:30 ` Takashi Iwai
2013-04-02 20:24 ` Dylan Reid
2013-04-03 5:19 ` Takashi Iwai
2013-02-09 2:31 ` Ian Minett [this message]
2013-02-10 10:52 ` [PATCH 4/4] ALSA: CA0132: Update hp unsol event handler Takashi Iwai
2013-02-10 10:57 ` [PATCH 0/4] ALSA: Updates for the CA0132 codec Takashi Iwai
2013-03-15 0:34 ` Dylan Reid
2013-03-15 8:25 ` Takashi Iwai
2013-03-15 18:39 ` Dylan Reid
2013-03-15 20:23 ` Takashi Iwai
2013-03-20 17:21 ` Dylan Reid
2013-03-20 17:39 ` Takashi Iwai
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=1360377105-2480-5-git-send-email-ian_minett@creativelabs.com \
--to=ian_minett@creativelabs.com \
--cc=alsa-devel@alsa-project.org \
--cc=patch@alsa-project.org \
/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;
as well as URLs for NNTP newsgroup(s).