* [PATCH 1/2] ASoC: rt298: fix jack type detect error
@ 2016-10-24 10:32 Bard Liao
2016-10-24 10:32 ` [PATCH 2/2] ASoC: rt298: disable IRQ when jack is NULL Bard Liao
0 siblings, 1 reply; 3+ messages in thread
From: Bard Liao @ 2016-10-24 10:32 UTC (permalink / raw)
To: broonie, lgirdwood
Cc: oder_chiou, jack.yu, alsa-devel, lars, vinod.koul, Bard Liao,
shumingf, senthilnathanx.veppur, flove
rt298_jack_detect may be called before card is instantiated. And
snd_soc_dapm_force_enable_pin will not work in that case. So, update
bit manually by regmap_update_bits.
Signed-off-by: Bard Liao <bardliao@realtek.com>
---
sound/soc/codecs/rt298.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/sound/soc/codecs/rt298.c b/sound/soc/codecs/rt298.c
index f80cfe4..dceffe9 100644
--- a/sound/soc/codecs/rt298.c
+++ b/sound/soc/codecs/rt298.c
@@ -249,6 +249,11 @@ static int rt298_jack_detect(struct rt298_priv *rt298, bool *hp, bool *mic)
snd_soc_dapm_force_enable_pin(dapm, "LDO1");
snd_soc_dapm_sync(dapm);
+ regmap_update_bits(rt298->regmap,
+ RT298_POWER_CTRL1, 0x1001, 0);
+ regmap_update_bits(rt298->regmap,
+ RT298_POWER_CTRL2, 0x4, 0x4);
+
regmap_write(rt298->regmap, RT298_SET_MIC1, 0x24);
msleep(50);
--
1.8.1.1.439.g50a6b54
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] ASoC: rt298: disable IRQ when jack is NULL
2016-10-24 10:32 [PATCH 1/2] ASoC: rt298: fix jack type detect error Bard Liao
@ 2016-10-24 10:32 ` Bard Liao
2016-11-29 11:44 ` Applied "ASoC: rt298: disable IRQ when jack is NULL" to the asoc tree Mark Brown
0 siblings, 1 reply; 3+ messages in thread
From: Bard Liao @ 2016-10-24 10:32 UTC (permalink / raw)
To: broonie, lgirdwood
Cc: oder_chiou, jack.yu, alsa-devel, lars, vinod.koul, Bard Liao,
shumingf, senthilnathanx.veppur, flove
Disable IRQ when jack is NULL in rt298_mic_detect. So machine driver
can use it in suspend/resume.
Signed-off-by: Bard Liao <bardliao@realtek.com>
---
sound/soc/codecs/rt298.c | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/rt298.c b/sound/soc/codecs/rt298.c
index dceffe9..f7ec8c7 100644
--- a/sound/soc/codecs/rt298.c
+++ b/sound/soc/codecs/rt298.c
@@ -326,11 +326,31 @@ static void rt298_jack_detect_work(struct work_struct *work)
int rt298_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack)
{
struct rt298_priv *rt298 = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_dapm_context *dapm;
+ bool hp = false;
+ bool mic = false;
+ int status = 0;
+
+ /* If jack in NULL, disable HS jack */
+ if (!jack) {
+ regmap_update_bits(rt298->regmap, RT298_IRQ_CTRL, 0x2, 0x0);
+ dapm = snd_soc_codec_get_dapm(codec);
+ snd_soc_dapm_disable_pin(dapm, "LDO1");
+ snd_soc_dapm_sync(dapm);
+ return 0;
+ }
rt298->jack = jack;
+ regmap_update_bits(rt298->regmap, RT298_IRQ_CTRL, 0x2, 0x2);
- /* Send an initial empty report */
- snd_soc_jack_report(rt298->jack, 0,
+ rt298_jack_detect(rt298, &hp, &mic);
+ if (hp == true)
+ status |= SND_JACK_HEADPHONE;
+
+ if (mic == true)
+ status |= SND_JACK_MICROPHONE;
+
+ snd_soc_jack_report(rt298->jack, status,
SND_JACK_MICROPHONE | SND_JACK_HEADPHONE);
return 0;
--
1.8.1.1.439.g50a6b54
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Applied "ASoC: rt298: disable IRQ when jack is NULL" to the asoc tree
2016-10-24 10:32 ` [PATCH 2/2] ASoC: rt298: disable IRQ when jack is NULL Bard Liao
@ 2016-11-29 11:44 ` Mark Brown
0 siblings, 0 replies; 3+ messages in thread
From: Mark Brown @ 2016-11-29 11:44 UTC (permalink / raw)
To: Bard Liao
Cc: oder_chiou, jack.yu, alsa-devel, lars, vinod.koul, lgirdwood,
broonie, shumingf, senthilnathanx.veppur, flove
The patch
ASoC: rt298: disable IRQ when jack is NULL
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
>From e3d62cb8c70ff5ff946051484b1cdb38523d8b95 Mon Sep 17 00:00:00 2001
From: Bard Liao <bardliao@realtek.com>
Date: Mon, 28 Nov 2016 13:24:06 +0800
Subject: [PATCH] ASoC: rt298: disable IRQ when jack is NULL
Disable IRQ when jack is NULL in rt298_mic_detect. So machine driver
can use it in suspend/resume.
Signed-off-by: Bard Liao <bardliao@realtek.com>
Reviewed-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
sound/soc/codecs/rt298.c | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/rt298.c b/sound/soc/codecs/rt298.c
index 55558643166f..6c4ac5b04665 100644
--- a/sound/soc/codecs/rt298.c
+++ b/sound/soc/codecs/rt298.c
@@ -321,11 +321,31 @@ static void rt298_jack_detect_work(struct work_struct *work)
int rt298_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack)
{
struct rt298_priv *rt298 = snd_soc_codec_get_drvdata(codec);
+ struct snd_soc_dapm_context *dapm;
+ bool hp = false;
+ bool mic = false;
+ int status = 0;
+
+ /* If jack in NULL, disable HS jack */
+ if (!jack) {
+ regmap_update_bits(rt298->regmap, RT298_IRQ_CTRL, 0x2, 0x0);
+ dapm = snd_soc_codec_get_dapm(codec);
+ snd_soc_dapm_disable_pin(dapm, "LDO1");
+ snd_soc_dapm_sync(dapm);
+ return 0;
+ }
rt298->jack = jack;
+ regmap_update_bits(rt298->regmap, RT298_IRQ_CTRL, 0x2, 0x2);
- /* Send an initial empty report */
- snd_soc_jack_report(rt298->jack, 0,
+ rt298_jack_detect(rt298, &hp, &mic);
+ if (hp == true)
+ status |= SND_JACK_HEADPHONE;
+
+ if (mic == true)
+ status |= SND_JACK_MICROPHONE;
+
+ snd_soc_jack_report(rt298->jack, status,
SND_JACK_MICROPHONE | SND_JACK_HEADPHONE);
return 0;
--
2.10.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-11-29 11:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-24 10:32 [PATCH 1/2] ASoC: rt298: fix jack type detect error Bard Liao
2016-10-24 10:32 ` [PATCH 2/2] ASoC: rt298: disable IRQ when jack is NULL Bard Liao
2016-11-29 11:44 ` Applied "ASoC: rt298: disable IRQ when jack is NULL" to the asoc tree Mark Brown
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.