All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] ASoC: rt721-sdca: handle HID button read errors
@ 2026-10-30  8:57 Avi Weiss
  2026-10-30  8:57 ` [PATCH 2/4] ASoC: rt711-sdca: " Avi Weiss
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Avi Weiss @ 2026-10-30  8:57 UTC (permalink / raw)
  To: Mark Brown; +Cc: Oder Chiou, Liam Girdwood, linux-sound

rt_sdca_button_detect() returns zero when a regmap read fails,
so RT721 treats the error as a valid no-button result.

Return the original error and skip button reporting when a read
fails. Still report jack changes, and clear button state if the
headset is removed.

Fixes: bbca8e7050e0 ("ASoC: rt-sdw-common: Common functions for Realtek soundwire driver")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
---
 sound/soc/codecs/rt-sdw-common.c |  5 ++++-
 sound/soc/codecs/rt721-sdca.c    | 13 +++++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/rt-sdw-common.c b/sound/soc/codecs/rt-sdw-common.c
index ad61943ce75ff..e4139e6393b1c 100644
--- a/sound/soc/codecs/rt-sdw-common.c
+++ b/sound/soc/codecs/rt-sdw-common.c
@@ -199,7 +199,7 @@ int rt_sdca_button_detect(struct regmap *map, unsigned int entity_id,
 	ret = regmap_read(map, SDW_SDCA_CTL(SDCA_NUM_HID, entity_id,
 			RT_SDCA_CTL_HIDTX_CURRENT_OWNER, 0), &owner);
 	if (ret < 0)
-		return 0;
+		return ret;
 
 	/* if owner is device then there is no button event from device */
 	if (owner == 1)
@@ -229,6 +229,9 @@ int rt_sdca_button_detect(struct regmap *map, unsigned int entity_id,
 			SDW_SDCA_CTL(SDCA_NUM_HID, entity_id,
 				RT_SDCA_CTL_HIDTX_CURRENT_OWNER, 0), 0x01);
 
+	if (ret < 0)
+		return ret;
+
 	return btn_type;
 }
 EXPORT_SYMBOL_GPL(rt_sdca_button_detect);
diff --git a/sound/soc/codecs/rt721-sdca.c b/sound/soc/codecs/rt721-sdca.c
index 9f567caecb70a..95c028efec01c 100644
--- a/sound/soc/codecs/rt721-sdca.c
+++ b/sound/soc/codecs/rt721-sdca.c
@@ -248,6 +248,19 @@ static void rt721_sdca_jack_detect_handler(struct work_struct *work)
 					RT721_SDCA_ENT_HID01, RT721_BUF_ADDR_HID1,
 					RT721_SDCA_HID_ID);
 
+	if (btn_type < 0) {
+		if (rt721->scp_sdca_stat1 & SDW_SCP_SDCA_INT_SDCA_0) {
+			unsigned int mask = SND_JACK_HEADSET;
+
+			if (rt721->jack_type != SND_JACK_HEADSET)
+				mask |= SND_JACK_BTN_0 | SND_JACK_BTN_1 |
+					SND_JACK_BTN_2 | SND_JACK_BTN_3;
+
+			snd_soc_jack_report(rt721->hs_jack, rt721->jack_type, mask);
+		}
+		return;
+	}
+
 	if (rt721->jack_type == 0)
 		btn_type = 0;
 

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

end of thread, other threads:[~2026-10-30 13:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-30  8:57 [PATCH 1/4] ASoC: rt721-sdca: handle HID button read errors Avi Weiss
2026-10-30  8:57 ` [PATCH 2/4] ASoC: rt711-sdca: " Avi Weiss
2026-10-30  8:57 ` [PATCH 3/4] ASoC: rt712-sdca: " Avi Weiss
2026-10-30  8:57 ` [PATCH 4/4] ASoC: rt722-sdca: " Avi Weiss
2026-10-30  9:08 ` [PATCH 1/4] ASoC: rt721-sdca: " sashiko-bot
2026-10-30 13:37 ` 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.