From: Takashi Iwai <tiwai@suse.de>
To: Mark Brown <broonie@kernel.org>
Cc: Oder Chiou <oder_chiou@realtek.com>,
Bard Liao <bardliao@realtek.com>,
alsa-devel@alsa-project.org, Hans de Goede <hdegoede@redhat.com>
Subject: [PATCH 1/4] ASoC: rt5645: read jd1_1 status for jd detection
Date: Wed, 28 Jun 2017 14:49:36 +0200 [thread overview]
Message-ID: <20170628124939.11696-2-tiwai@suse.de> (raw)
In-Reply-To: <20170628124939.11696-1-tiwai@suse.de>
From: Bard Liao <bardliao@realtek.com>
Read the jd status after invert control. The benefit is we don't need
to invert the reading jd status when jd invert is needed.
Signed-off-by: Bard Liao <bardliao@realtek.com>
Tested-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
sound/soc/codecs/rt5645.c | 31 ++++++++-----------------------
1 file changed, 8 insertions(+), 23 deletions(-)
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c
index 87844a45886a..8e419ea418e9 100644
--- a/sound/soc/codecs/rt5645.c
+++ b/sound/soc/codecs/rt5645.c
@@ -3238,24 +3238,16 @@ static void rt5645_jack_detect_work(struct work_struct *work)
snd_soc_jack_report(rt5645->mic_jack,
report, SND_JACK_MICROPHONE);
return;
- case 1: /* 2 port */
- val = snd_soc_read(rt5645->codec, RT5645_A_JD_CTRL1) & 0x0070;
- break;
- default: /* 1 port */
- val = snd_soc_read(rt5645->codec, RT5645_A_JD_CTRL1) & 0x0020;
+ default: /* read rt5645 jd1_1 status */
+ val = snd_soc_read(rt5645->codec, RT5645_INT_IRQ_ST) & 0x1000;
break;
}
- switch (val) {
- /* jack in */
- case 0x30: /* 2 port */
- case 0x0: /* 1 port or 2 port */
- if (rt5645->jack_type == 0) {
- report = rt5645_jack_detect(rt5645->codec, 1);
- /* for push button and jack out */
- break;
- }
+ if (!val && (rt5645->jack_type == 0)) { /* jack in */
+ report = rt5645_jack_detect(rt5645->codec, 1);
+ } else if (!val && rt5645->jack_type != 0) {
+ /* for push button and jack out */
btn_type = 0;
if (snd_soc_read(rt5645->codec, RT5645_INT_IRQ_ST) & 0x4) {
/* button pressed */
@@ -3302,19 +3294,12 @@ static void rt5645_jack_detect_work(struct work_struct *work)
mod_timer(&rt5645->btn_check_timer,
msecs_to_jiffies(100));
}
-
- break;
- /* jack out */
- case 0x70: /* 2 port */
- case 0x10: /* 2 port */
- case 0x20: /* 1 port */
+ } else {
+ /* jack out */
report = 0;
snd_soc_update_bits(rt5645->codec,
RT5645_INT_IRQ_ST, 0x1, 0x0);
rt5645_jack_detect(rt5645->codec, 0);
- break;
- default:
- break;
}
snd_soc_jack_report(rt5645->hp_jack, report, SND_JACK_HEADPHONE);
--
2.13.2
next prev parent reply other threads:[~2017-06-28 12:49 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-28 12:49 [PATCH 0/4] ASoC: rt5645: GPD Win jack support Takashi Iwai
2017-06-28 12:49 ` Takashi Iwai [this message]
2017-06-28 19:24 ` Applied "ASoC: rt5645: read jd1_1 status for jd detection" to the asoc tree Mark Brown
2017-06-28 12:49 ` [PATCH 2/4] ASoC: rt5645: rename jd_invert flag in platform data Takashi Iwai
2017-06-28 19:24 ` Applied "ASoC: rt5645: rename jd_invert flag in platform data" to the asoc tree Mark Brown
2017-06-28 12:49 ` [PATCH 3/4] ASoC: rt5645: add inv_jd1_1 flag Takashi Iwai
2017-06-28 19:24 ` Applied "ASoC: rt5645: add inv_jd1_1 flag" to the asoc tree Mark Brown
2017-06-28 12:49 ` [PATCH 4/4] ASoC: rt5645: Add jack detection workaround for GPD Win Takashi Iwai
2017-06-28 19:23 ` Applied "ASoC: rt5645: Add jack detection workaround for GPD Win" to the asoc tree Mark Brown
2017-06-28 21:07 ` [PATCH 4/4] ASoC: rt5645: Add jack detection workaround for GPD Win Pierre-Louis Bossart
2017-06-29 6:45 ` James Cameron
2017-06-29 7:06 ` Takashi Iwai
2017-06-29 8:10 ` Bard Liao
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=20170628124939.11696-2-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=bardliao@realtek.com \
--cc=broonie@kernel.org \
--cc=hdegoede@redhat.com \
--cc=oder_chiou@realtek.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.