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 3/3] ASoC: codecs: hdac_hdmi: Update codec read API callers
Date: Thu, 3 Dec 2026 17:05:02 +0000 [thread overview]
Message-ID: <20261203170741.3873-4-sreekuttan2156239@gmail.com> (raw)
In-Reply-To: <20261203170741.3873-1-sreekuttan2156239@gmail.com>
Update callers of snd_hdac_codec_read() in hdac_hdmi.c to use
the new status and output parameter interface.
Check the return status before using codec responses and handle
command failures appropriately in port selection, power
management and vendor-specific verb operations.
This ensures that codec read errors are handled separately
from response values.
Signed-off-by: Sreeraj S Kurup <sreekuttan2156239@gmail.com>
---
sound/soc/codecs/hdac_hdmi.c | 72 +++++++++++++++++++++++-------------
1 file changed, 47 insertions(+), 25 deletions(-)
diff --git a/sound/soc/codecs/hdac_hdmi.c b/sound/soc/codecs/hdac_hdmi.c
index f7922ffaad97..8dad9f1644f8 100644
--- a/sound/soc/codecs/hdac_hdmi.c
+++ b/sound/soc/codecs/hdac_hdmi.c
@@ -241,8 +241,15 @@ static int hdac_hdmi_get_port_len(struct hdac_device *hdev, hda_nid_t nid)
static int hdac_hdmi_port_select_get(struct hdac_device *hdev,
struct hdac_hdmi_port *port)
{
- return snd_hdac_codec_read(hdev, port->pin->nid,
- 0, AC_VERB_GET_DEVICE_SEL, 0);
+ unsigned int res;
+ int err;
+
+ err = snd_hdac_codec_read(hdev, port->pin->nid,
+ 0, AC_VERB_GET_DEVICE_SEL, 0, &res);
+ if (err < 0)
+ return err;
+
+ return res;
}
/*
@@ -253,6 +260,7 @@ static int hdac_hdmi_port_select_set(struct hdac_device *hdev,
struct hdac_hdmi_port *port)
{
int num_ports;
+ int selected;
if (!port->pin->mst_capable)
return 0;
@@ -271,7 +279,11 @@ static int hdac_hdmi_port_select_set(struct hdac_device *hdev,
snd_hdac_codec_write(hdev, port->pin->nid, 0,
AC_VERB_SET_DEVICE_SEL, port->id);
- if (port->id != hdac_hdmi_port_select_get(hdev, port))
+ selected = hdac_hdmi_port_select_get(hdev, port);
+ if (selected < 0)
+ return selected;
+
+ if (port->id != selected)
return -EIO;
dev_dbg(&hdev->dev, "Selected the port=%d\n", port->id);
@@ -740,15 +752,18 @@ static struct hdac_hdmi_pcm *hdac_hdmi_get_pcm(struct hdac_device *hdev,
static void hdac_hdmi_set_power_state(struct hdac_device *hdev,
hda_nid_t nid, unsigned int pwr_state)
{
- int count;
- unsigned int state;
+ int count, err;
+ unsigned int state, res;
if (snd_hdac_get_wcaps(hdev, nid) & AC_WCAP_POWER) {
if (!snd_hdac_check_power_state(hdev, nid, pwr_state)) {
for (count = 0; count < 10; count++) {
- snd_hdac_codec_read(hdev, nid, 0,
+ err = snd_hdac_codec_read(hdev, nid, 0,
AC_VERB_SET_POWER_STATE,
- pwr_state);
+ pwr_state, &res);
+ if (err < 0)
+ break;
+
state = snd_hdac_sync_power_state(hdev,
nid, pwr_state);
if (!(state & AC_PWRST_ERROR))
@@ -1401,38 +1416,40 @@ static int hdac_hdmi_add_pin(struct hdac_device *hdev, hda_nid_t nid)
static void hdac_hdmi_skl_enable_all_pins(struct hdac_device *hdev)
{
- unsigned int vendor_param;
+ unsigned int vendor_param, res;
struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
unsigned int vendor_nid = hdmi->drv_data->vendor_nid;
+ int err;
- vendor_param = snd_hdac_codec_read(hdev, vendor_nid, 0,
- INTEL_GET_VENDOR_VERB, 0);
- if (vendor_param == -1 || vendor_param & INTEL_EN_ALL_PIN_CVTS)
+ err = snd_hdac_codec_read(hdev, vendor_nid, 0,
+ INTEL_GET_VENDOR_VERB, 0, &vendor_param);
+ if (err < 0 || (vendor_param & INTEL_EN_ALL_PIN_CVTS))
return;
vendor_param |= INTEL_EN_ALL_PIN_CVTS;
- vendor_param = snd_hdac_codec_read(hdev, vendor_nid, 0,
- INTEL_SET_VENDOR_VERB, vendor_param);
- if (vendor_param == -1)
+ err = snd_hdac_codec_read(hdev, vendor_nid, 0,
+ INTEL_SET_VENDOR_VERB, vendor_param, &res);
+ if (err < 0)
return;
}
static void hdac_hdmi_skl_enable_dp12(struct hdac_device *hdev)
{
- unsigned int vendor_param;
+ unsigned int vendor_param, res;
struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
unsigned int vendor_nid = hdmi->drv_data->vendor_nid;
+ int err;
- vendor_param = snd_hdac_codec_read(hdev, vendor_nid, 0,
- INTEL_GET_VENDOR_VERB, 0);
- if (vendor_param == -1 || vendor_param & INTEL_EN_DP12)
+ err = snd_hdac_codec_read(hdev, vendor_nid, 0,
+ INTEL_GET_VENDOR_VERB, 0, &vendor_param);
+ if (err < 0 || (vendor_param & INTEL_EN_DP12))
return;
/* enable DP1.2 mode */
vendor_param |= INTEL_EN_DP12;
- vendor_param = snd_hdac_codec_read(hdev, vendor_nid, 0,
- INTEL_SET_VENDOR_VERB, vendor_param);
- if (vendor_param == -1)
+ err = snd_hdac_codec_read(hdev, vendor_nid, 0,
+ INTEL_SET_VENDOR_VERB, vendor_param, &res);
+ if (err < 0)
return;
}
@@ -1942,6 +1959,8 @@ static int hdac_hdmi_runtime_suspend(struct device *dev)
struct hdac_device *hdev = dev_to_hdac_dev(dev);
struct hdac_bus *bus = hdev->bus;
struct hdac_ext_link *hlink;
+ int ret;
+ unsigned int res;
dev_dbg(dev, "Enter: %s\n", __func__);
@@ -1956,8 +1975,10 @@ static int hdac_hdmi_runtime_suspend(struct device *dev)
* is received. So setting power state is ensured without using loop
* to read the state.
*/
- snd_hdac_codec_read(hdev, hdev->afg, 0, AC_VERB_SET_POWER_STATE,
- AC_PWRST_D3);
+ ret = snd_hdac_codec_read(hdev, hdev->afg, 0, AC_VERB_SET_POWER_STATE,
+ AC_PWRST_D3, &res);
+ if (ret < 0)
+ return ret;
hlink = snd_hdac_ext_bus_get_hlink_by_name(bus, dev_name(dev));
if (!hlink) {
@@ -1978,6 +1999,7 @@ static int hdac_hdmi_runtime_resume(struct device *dev)
struct hdac_device *hdev = dev_to_hdac_dev(dev);
struct hdac_bus *bus = hdev->bus;
struct hdac_ext_link *hlink;
+ unsigned int res;
dev_dbg(dev, "Enter: %s\n", __func__);
@@ -2000,8 +2022,8 @@ static int hdac_hdmi_runtime_resume(struct device *dev)
hdac_hdmi_skl_enable_dp12(hdev);
/* Power up afg */
- snd_hdac_codec_read(hdev, hdev->afg, 0, AC_VERB_SET_POWER_STATE,
- AC_PWRST_D0);
+ snd_hdac_codec_read(hdev, hdev->afg, 0, AC_VERB_SET_POWER_STATE,
+ AC_PWRST_D0, &res);
return 0;
}
--
2.55.0
next prev parent reply other threads:[~2026-12-03 17:09 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 ` [PATCH 2/3] ALSA: hda: hdmi_chmap: Update HDMI channel map codec read callers Sreeraj S Kurup
2026-12-03 17:05 ` Sreeraj S Kurup [this message]
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-4-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®