From: Avi Weiss <thnkslprpt@gmail.com>
To: Mark Brown <broonie@kernel.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
Zhang Yi <zhangyi@everest-semi.com>,
linux-sound@vger.kernel.org
Subject: [PATCH] ASoC: es9356: propagate HID button read errors
Date: Fri, 30 Oct 2026 08:54:42 +0200 [thread overview]
Message-ID: <20261030065441.2020789-2-thnkslprpt@gmail.com> (raw)
es9356_sdca_button_detect() returns zero when a regmap read
fails, so the interrupt handler cannot distinguish the
error from a valid no-button result.
Return the original error and keep the button result signed
so the existing negative-result check also handles decoding
errors. Leave the ownership handoff unchanged.
Fixes: 5d9cb740cd38 ("ASoC: es9356-sdca: Add ES9356 SDCA driver")
Signed-off-by: Avi Weiss <thnkslprpt@gmail.com>
---
sound/soc/codecs/es9356.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/sound/soc/codecs/es9356.c b/sound/soc/codecs/es9356.c
index 9c70ccd5b310..277d0ae56661 100644
--- a/sound/soc/codecs/es9356.c
+++ b/sound/soc/codecs/es9356.c
@@ -293,13 +293,15 @@ static int es9356_sdca_button(unsigned int *buffer)
static int es9356_sdca_button_detect(struct es9356_sdw_priv *es9356)
{
- unsigned int btn_type = 0, offset, idx, val, owner;
+ unsigned int offset, idx, val, owner;
unsigned int button[3];
- int ret;
+ int btn_type = 0, ret;
ret = regmap_read(es9356->regmap,
SDW_SDCA_CTL(FUNC_NUM_HID, ES9356_SDCA_ENT_HID01, ES9356_SDCA_CTL_HIDTX_CURRENT_OWNER, 0), &owner);
- if (ret < 0 || owner == 0x01)
+ if (ret < 0)
+ return ret;
+ if (owner == 0x01)
return 0;
ret = regmap_read(es9356->regmap, ES9356_BUF_ADDR_HID, &offset);
@@ -320,6 +322,9 @@ static int es9356_sdca_button_detect(struct es9356_sdw_priv *es9356)
regmap_write(es9356->regmap,
SDW_SDCA_CTL(FUNC_NUM_HID, ES9356_SDCA_ENT_HID01, ES9356_SDCA_CTL_HIDTX_CURRENT_OWNER, 0), 0x01);
+ if (ret < 0)
+ return ret;
+
return btn_type;
}
reply other threads:[~2026-10-30 6:54 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261030065441.2020789-2-thnkslprpt@gmail.com \
--to=thnkslprpt@gmail.com \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-sound@vger.kernel.org \
--cc=zhangyi@everest-semi.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