Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Charles Keepax <ckeepax@opensource.cirrus.com>
To: broonie@kernel.org, lee@kernel.org
Cc: lgirdwood@gmail.com, linux-sound@vger.kernel.org,
	linux-kernel@vger.kernel.org, patches@opensource.cirrus.com
Subject: [PATCH 4/6] ASoC: cs42l43: Shutdown jack detection on suspend
Date: Wed,  3 Sep 2025 10:45:47 +0100	[thread overview]
Message-ID: <20250903094549.271068-5-ckeepax@opensource.cirrus.com> (raw)
In-Reply-To: <20250903094549.271068-1-ckeepax@opensource.cirrus.com>

Fully power down the jack detection on system suspend since the device
will not be powered up during.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---
 sound/soc/codecs/cs42l43-jack.c | 8 +++++---
 sound/soc/codecs/cs42l43.c      | 2 ++
 sound/soc/codecs/cs42l43.h      | 1 +
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/sound/soc/codecs/cs42l43-jack.c b/sound/soc/codecs/cs42l43-jack.c
index 2a0a4986a9ce8..867e23d4fb8d8 100644
--- a/sound/soc/codecs/cs42l43-jack.c
+++ b/sound/soc/codecs/cs42l43-jack.c
@@ -684,7 +684,7 @@ static int cs42l43_run_type_detect(struct cs42l43_codec *priv)
 	}
 }
 
-static void cs42l43_clear_jack(struct cs42l43_codec *priv)
+void cs42l43_clear_jack(struct cs42l43_codec *priv)
 {
 	struct cs42l43 *cs42l43 = priv->core;
 
@@ -703,8 +703,6 @@ static void cs42l43_clear_jack(struct cs42l43_codec *priv)
 	regmap_update_bits(cs42l43->regmap, CS42L43_HS2,
 			   CS42L43_HSDET_MODE_MASK | CS42L43_HSDET_MANUAL_MODE_MASK,
 			   0x2 << CS42L43_HSDET_MODE_SHIFT);
-
-	snd_soc_jack_report(priv->jack_hp, 0, 0xFFFF);
 }
 
 void cs42l43_tip_sense_work(struct work_struct *work)
@@ -753,6 +751,8 @@ void cs42l43_tip_sense_work(struct work_struct *work)
 
 		cs42l43_clear_jack(priv);
 
+		snd_soc_jack_report(priv->jack_hp, 0, 0xFFFF);
+
 		if (cs42l43->sdw && priv->jack_present) {
 			pm_runtime_put(priv->dev);
 			priv->jack_present = false;
@@ -903,6 +903,8 @@ int cs42l43_jack_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *u
 
 	cs42l43_clear_jack(priv);
 
+	snd_soc_jack_report(priv->jack_hp, 0, 0xFFFF);
+
 	if (!override) {
 		queue_delayed_work(system_long_wq, &priv->tip_sense_work, 0);
 	} else {
diff --git a/sound/soc/codecs/cs42l43.c b/sound/soc/codecs/cs42l43.c
index 405926149a137..b61df09f20cf4 100644
--- a/sound/soc/codecs/cs42l43.c
+++ b/sound/soc/codecs/cs42l43.c
@@ -2422,6 +2422,8 @@ static int cs42l43_codec_suspend(struct device *dev)
 	cancel_delayed_work_sync(&priv->tip_sense_work);
 	cancel_delayed_work_sync(&priv->hp_ilimit_clear_work);
 
+	cs42l43_clear_jack(priv);
+
 	return pm_runtime_force_suspend(dev);
 }
 
diff --git a/sound/soc/codecs/cs42l43.h b/sound/soc/codecs/cs42l43.h
index 0951ad3525efe..b2fa2cd1d99f8 100644
--- a/sound/soc/codecs/cs42l43.h
+++ b/sound/soc/codecs/cs42l43.h
@@ -132,6 +132,7 @@ static inline int cs42l43_sdw_add_peripheral(struct snd_pcm_substream *substream
 int cs42l43_set_jack(struct snd_soc_component *component,
 		     struct snd_soc_jack *jack, void *d);
 void cs42l43_bias_sense_timeout(struct work_struct *work);
+void cs42l43_clear_jack(struct cs42l43_codec *priv);
 void cs42l43_tip_sense_work(struct work_struct *work);
 irqreturn_t cs42l43_bias_detect_clamp(int irq, void *data);
 irqreturn_t cs42l43_button_press(int irq, void *data);
-- 
2.47.2


  parent reply	other threads:[~2025-09-03  9:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-03  9:45 [PATCH 0/6] Improve cs42l43 suspend/IRQ interactions Charles Keepax
2025-09-03  9:45 ` [PATCH 1/6] ASoC: cs42l43: Rename system suspend callback and fix debug print Charles Keepax
2025-09-03  9:45 ` [PATCH 2/6] ASoC: cs42l43: Store IRQ domain in codec private data Charles Keepax
2025-09-03  9:45 ` [PATCH 3/6] ASoC: cs42l43: Disable IRQs in system suspend Charles Keepax
2025-09-03  9:45 ` Charles Keepax [this message]
2025-09-03  9:45 ` [PATCH 5/6] mfd: cs42l43: Move IRQ enable/disable to encompass force suspend Charles Keepax
2025-09-03  9:45 ` [PATCH 6/6] mfd: cs42l43: Remove IRQ masking in suspend Charles Keepax
2025-09-04 18:09 ` (subset) [PATCH 0/6] Improve cs42l43 suspend/IRQ interactions Mark Brown
2025-09-11 15:02 ` Lee Jones

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=20250903094549.271068-5-ckeepax@opensource.cirrus.com \
    --to=ckeepax@opensource.cirrus.com \
    --cc=broonie@kernel.org \
    --cc=lee@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=patches@opensource.cirrus.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox