[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251015092619.52952-5-vitalyr@opensource.cirrus.com>
Date: Wed, 15 Oct 2025 10:26:07 +0100
From: Vitaly Rodionov <vitalyr@...nsource.cirrus.com>
To: Mark Brown <broonie@...nel.org>
Cc: Liam Girdwood <lgirdwood@...il.com>, Takashi Iwai <tiwai@...e.com>,
Jaroslav Kysela <perex@...ex.cz>, linux-sound@...r.kernel.org,
linux-kernel@...r.kernel.org, patches@...nsource.cirrus.com,
Simon Trimmer <simont@...nsource.cirrus.com>
Subject: [PATCH 4/8] ASoC: cs530x: Check the DEVID matches the devtype
From: Simon Trimmer <simont@...nsource.cirrus.com>
If the read device ID is not the expected devtype derived from the
compatible device match then fail the probe as other configuration
details may be incorrect.
Signed-off-by: Simon Trimmer <simont@...nsource.cirrus.com>
---
sound/soc/codecs/cs530x.c | 6 ++++++
sound/soc/codecs/cs530x.h | 14 +++++++-------
2 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/sound/soc/codecs/cs530x.c b/sound/soc/codecs/cs530x.c
index 25dbf401b15d..cdd050c0fa2b 100644
--- a/sound/soc/codecs/cs530x.c
+++ b/sound/soc/codecs/cs530x.c
@@ -1181,6 +1181,12 @@ static int cs530x_check_device_id(struct cs530x_priv *cs530x)
dev_id);
}
+ if (cs530x->devtype != dev_id) {
+ dev_err(dev, "Read device ID 0x%x is not the expected devtype 0x%x\n",
+ dev_id, cs530x->devtype);
+ return -EINVAL;
+ }
+
dev_dbg(dev, "Device ID 0x%x Rev ID 0x%x (%d in %d out)\n", dev_id, rev,
cs530x->num_adcs, cs530x->num_dacs);
diff --git a/sound/soc/codecs/cs530x.h b/sound/soc/codecs/cs530x.h
index c10a6766cc7a..758d9b1eb39d 100644
--- a/sound/soc/codecs/cs530x.h
+++ b/sound/soc/codecs/cs530x.h
@@ -185,13 +185,13 @@
#define CS530X_NUM_SUPPLIES 2
enum cs530x_type {
- CS4282,
- CS4302,
- CS4304,
- CS4308,
- CS5302,
- CS5304,
- CS5308,
+ CS4282 = CS530X_2CH_CODEC_DEV_ID,
+ CS4302 = CS530X_2CH_DAC_DEV_ID,
+ CS4304 = CS530X_4CH_DAC_DEV_ID,
+ CS4308 = CS530X_8CH_DAC_DEV_ID,
+ CS5302 = CS530X_2CH_ADC_DEV_ID,
+ CS5304 = CS530X_4CH_ADC_DEV_ID,
+ CS5308 = CS530X_8CH_ADC_DEV_ID,
};
/* codec private data */
--
2.43.0
Powered by blists - more mailing lists