aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorSimon Trimmer <simont@opensource.cirrus.com>2025-10-23 10:03:16 +0100
committerMark Brown <broonie@kernel.org>2025-10-27 11:10:29 +0000
commitc37c3e5e390dcd52cbe6178ac53f5a6131ef6f8c (patch)
treec5f8dc1f1b6f0f762155f57eb0204ae796d83015 /sound
parent3941abb26ff327e53e1e8b873cab3ed3d5103eab (diff)
ASoC: cs530x: Check the DEVID matches the devtype
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@opensource.cirrus.com> Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com> Link: https://patch.msgid.link/20251023090327.58275-9-vitalyr@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/cs530x.c6
-rw-r--r--sound/soc/codecs/cs530x.h14
2 files changed, 13 insertions, 7 deletions
diff --git a/sound/soc/codecs/cs530x.c b/sound/soc/codecs/cs530x.c
index abe3fe365425..6552bef0577b 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 52fb148df36a..d11711715ba8 100644
--- a/sound/soc/codecs/cs530x.h
+++ b/sound/soc/codecs/cs530x.h
@@ -211,13 +211,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 */