All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Lin <CTLIN0@nuvoton.com>
To: <broonie@kernel.org>
Cc: alsa-devel@alsa-project.org, ctlin0.linux@gmail.com,
	WTLI@nuvoton.com, SJLIN0@nuvoton.com, KCHSU0@nuvoton.com,
	lgirdwood@gmail.com, YHCHuang@nuvoton.com,
	David Lin <CTLIN0@nuvoton.com>
Subject: [PATCH 1/2] ASoC: nau8825: Adjust internal clock during jack detection
Date: Tue, 22 Nov 2022 15:38:55 +0800	[thread overview]
Message-ID: <20221122073855.43024-1-CTLIN0@nuvoton.com> (raw)

This patch is to rasie up internal clock during jack detection.
The fast clock will accelerate charge and discharge effect.
So this mechanism will make jack detection more robust.

Signed-off-by: David Lin <CTLIN0@nuvoton.com>
---
 sound/soc/codecs/nau8825.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sound/soc/codecs/nau8825.c b/sound/soc/codecs/nau8825.c
index 3eac7c92df88..ba7f5ec28609 100644
--- a/sound/soc/codecs/nau8825.c
+++ b/sound/soc/codecs/nau8825.c
@@ -1686,6 +1686,9 @@ static void nau8825_setup_auto_irq(struct nau8825 *nau8825)
 
 	/* Enable internal VCO needed for interruptions */
 	nau8825_configure_sysclk(nau8825, NAU8825_CLK_INTERNAL, 0);
+	/* Raise up the internal clock for jack detection */
+	regmap_update_bits(regmap, NAU8825_REG_CLK_DIVIDER,
+			   NAU8825_CLK_MCLK_SRC_MASK, 0);
 
 	/* Enable ADC needed for interruptions */
 	regmap_update_bits(regmap, NAU8825_REG_ENA_CTRL,
@@ -1800,6 +1803,10 @@ static int nau8825_jack_insert(struct nau8825 *nau8825)
 		break;
 	}
 
+	/* Update to the default divider of internal clock for power saving */
+	regmap_update_bits(regmap, NAU8825_REG_CLK_DIVIDER,
+			   NAU8825_CLK_MCLK_SRC_MASK, 0xf);
+
 	/* Leaving HPOL/R grounded after jack insert by default. They will be
 	 * ungrounded as part of the widget power up sequence at the beginning
 	 * of playback to reduce pop.
-- 
2.25.1


             reply	other threads:[~2022-11-22  7:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-22  7:38 David Lin [this message]
2022-11-22  7:38 ` [PATCH 2/2] ASoC: nau8825: Add a manually mechanism for detection failure David Lin
2022-11-22 14:49 ` [PATCH 1/2] ASoC: nau8825: Adjust internal clock during jack detection Mark Brown

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=20221122073855.43024-1-CTLIN0@nuvoton.com \
    --to=ctlin0@nuvoton.com \
    --cc=KCHSU0@nuvoton.com \
    --cc=SJLIN0@nuvoton.com \
    --cc=WTLI@nuvoton.com \
    --cc=YHCHuang@nuvoton.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=ctlin0.linux@gmail.com \
    --cc=lgirdwood@gmail.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.