Linux Sound subsystem development
 help / color / mirror / Atom feed
From: <shumingf@realtek.com>
To: <broonie@kernel.org>, <lgirdwood@gmail.com>
Cc: <linux-sound@vger.kernel.org>, <lars@metafoo.de>,
	<flove@realtek.com>, <oder_chiou@realtek.com>,
	<jack.yu@realtek.com>, <derek.fang@realtek.com>,
	Shuming Fan <shumingf@realtek.com>
Subject: [PATCH] ASoC: rt766: trigger JD when system reboots
Date: Wed, 7 Oct 2026 17:25:24 +0800	[thread overview]
Message-ID: <20261007092524.3711965-1-shumingf@realtek.com> (raw)

From: Shuming Fan <shumingf@realtek.com>

The initial jack detection at boot time may be missed after a warm reboot
if the blind writes are not reloaded.

This patch triggers jack detection from the .set_jack callback to
ensure that the jack status is updated after a system reboot.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
---
 sound/soc/codecs/rt766-sdca.c | 8 +++++++-
 sound/soc/codecs/rt766-sdca.h | 1 +
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/rt766-sdca.c b/sound/soc/codecs/rt766-sdca.c
index 28b4118e05c9..2e891b99dc27 100644
--- a/sound/soc/codecs/rt766-sdca.c
+++ b/sound/soc/codecs/rt766-sdca.c
@@ -176,8 +176,11 @@ static irqreturn_t rt766_sdca_irq_jd_handler(int irq, void *data)
 	if (!rt766->hs_jack)
 		return IRQ_HANDLED;
 
-	if (!rt766->component->card || !rt766->component->card->instantiated)
+	if (!rt766->component->card || !rt766->component->card->instantiated) {
+		/* trigger again if card is not instantiated */
+		regmap_write(rt766->regmap, RT766_GE_DET_IRQ_MNL, 0x01);
 		return IRQ_HANDLED;
+	}
 
 	mutex_lock(&rt766->disable_irq_lock);
 	if (!rt766->disable_irq)
@@ -304,6 +307,9 @@ static int rt766_sdca_set_jack_detect(struct snd_soc_component *component,
 		if (rt766->hid_func_data)
 			rt766_sdca_irq_ctl(rt766, rt766->hid_func_data,
 				rt766->component, rt766->irq_info, false);
+	} else {
+		/* trigger GE interrupt */
+		regmap_write(rt766->regmap, RT766_GE_DET_IRQ_MNL, 0x01);
 	}
 
 	pm_runtime_put_autosuspend(component->dev);
diff --git a/sound/soc/codecs/rt766-sdca.h b/sound/soc/codecs/rt766-sdca.h
index de4064007eb9..61af5e9c077a 100644
--- a/sound/soc/codecs/rt766-sdca.h
+++ b/sound/soc/codecs/rt766-sdca.h
@@ -50,6 +50,7 @@ struct  rt766_sdca_priv {
 #define RT766_DEV_ID1		0xc405
 #define RT766_DEV_ID0		0xc406
 #define RT766_BOND_LATCH_ID	0xc407
+#define RT766_GE_DET_IRQ_MNL	0xd203
 
 #define RT766_HP_POWER_STATE		0x1000004
 #define RT766_HP_FSM_CTL2_1		0x100000d
-- 
2.55.0


             reply	other threads:[~2026-10-07  9:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-07  9:25 shumingf [this message]
2026-10-07 10:47 ` [PATCH] ASoC: rt766: trigger JD when system reboots Mark Brown
2026-10-07 11:03   ` Shuming [范書銘]
2026-10-07 15:26 ` 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=20261007092524.3711965-1-shumingf@realtek.com \
    --to=shumingf@realtek.com \
    --cc=broonie@kernel.org \
    --cc=derek.fang@realtek.com \
    --cc=flove@realtek.com \
    --cc=jack.yu@realtek.com \
    --cc=lars@metafoo.de \
    --cc=lgirdwood@gmail.com \
    --cc=linux-sound@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox