Linux Sound subsystem development
 help / color / mirror / Atom feed
* [PATCH] ASoC: rt766: trigger JD when system reboots
@ 2026-10-07  9:25 shumingf
  2026-10-07 10:47 ` Mark Brown
  2026-10-07 15:26 ` Mark Brown
  0 siblings, 2 replies; 4+ messages in thread
From: shumingf @ 2026-10-07  9:25 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: linux-sound, lars, flove, oder_chiou, jack.yu, derek.fang,
	Shuming Fan

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-10-08  7:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-07  9:25 [PATCH] ASoC: rt766: trigger JD when system reboots shumingf
2026-10-07 10:47 ` Mark Brown
2026-10-07 11:03   ` Shuming [范書銘]
2026-10-07 15:26 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox