From: Sreeraj S Kurup <sreekuttan2156239@gmail.com>
To: perex@perex.cz, tiwai@suse.de, lgirdwood@gmail.com, broonie@kernel.org
Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
Sreeraj S Kurup <sreekuttan2156239@gmail.com>
Subject: [PATCH 2/3] ALSA: hda: hdmi_chmap: Update HDMI channel map codec read callers
Date: Thu, 3 Dec 2026 17:05:01 +0000 [thread overview]
Message-ID: <20261203170741.3873-3-sreekuttan2156239@gmail.com> (raw)
In-Reply-To: <20261203170741.3873-1-sreekuttan2156239@gmail.com>
Update callers of snd_hdac_codec_read() in hdmi_chmap.c to use
the new status and output parameter interface.
Check the return status before using the codec response, and
propagate read errors from the channel mapping helper functions.
Also avoid updating the converter channel count when reading the
current channel count fails.
Signed-off-by: Sreeraj S Kurup <sreekuttan2156239@gmail.com>
---
sound/hda/core/hdmi_chmap.c | 30 +++++++++++++++++++++++++-----
1 file changed, 25 insertions(+), 5 deletions(-)
diff --git a/sound/hda/core/hdmi_chmap.c b/sound/hda/core/hdmi_chmap.c
index c897fc443467..e9e599154ef1 100644
--- a/sound/hda/core/hdmi_chmap.c
+++ b/sound/hda/core/hdmi_chmap.c
@@ -190,21 +190,41 @@ static int hdmi_pin_set_slot_channel(struct hdac_device *codec,
static int hdmi_pin_get_slot_channel(struct hdac_device *codec,
hda_nid_t pin_nid, int asp_slot)
{
- return (snd_hdac_codec_read(codec, pin_nid, 0,
+ unsigned int res;
+ int err;
+
+ err = snd_hdac_codec_read(codec, pin_nid, 0,
AC_VERB_GET_HDMI_CHAN_SLOT,
- asp_slot) & 0xf0) >> 4;
+ asp_slot, &res);
+ if (err < 0)
+ return err;
+
+ return (res & 0xf0) >> 4;
}
static int hdmi_get_channel_count(struct hdac_device *codec, hda_nid_t cvt_nid)
{
- return 1 + snd_hdac_codec_read(codec, cvt_nid, 0,
- AC_VERB_GET_CVT_CHAN_COUNT, 0);
+ unsigned int res;
+ int err;
+
+ err = snd_hdac_codec_read(codec, cvt_nid, 0,
+ AC_VERB_GET_CVT_CHAN_COUNT, 0, &res);
+ if (err < 0)
+ return err;
+
+ return 1 + res;
}
static void hdmi_set_channel_count(struct hdac_device *codec,
hda_nid_t cvt_nid, int chs)
{
- if (chs != hdmi_get_channel_count(codec, cvt_nid))
+ int current;
+
+ current = hdmi_get_channel_count(codec, cvt_nid);
+ if (current < 0)
+ return;
+
+ if (chs != current)
snd_hdac_codec_write(codec, cvt_nid, 0,
AC_VERB_SET_CVT_CHAN_COUNT, chs - 1);
}
--
2.55.0
next prev parent reply other threads:[~2026-12-03 17:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 17:04 [PATCH 0/3] ALSA: hda: Separate codec read status from response Sreeraj S Kurup
2026-12-03 17:05 ` [PATCH 1/3] ALSA: hda: core: Fix command creation error handling Sreeraj S Kurup
2026-12-03 17:05 ` Sreeraj S Kurup [this message]
2026-12-03 17:05 ` [PATCH 3/3] ASoC: codecs: hdac_hdmi: Update codec read API callers Sreeraj S Kurup
2026-12-03 17:33 ` [PATCH 0/3] ALSA: hda: Separate codec read status from response Takashi Iwai
2026-12-03 18:10 ` Sreeraj S Kurup
2026-12-03 18:31 ` Sreeraj S Kurup
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=20261203170741.3873-3-sreekuttan2156239@gmail.com \
--to=sreekuttan2156239@gmail.com \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.de \
/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
all inboxes | Powered by JetHome®