Skip to contentSkip to conversation

Add support for Cirrus Logic CS530x DAC and CODEC variants.

PATCH In review Vitaly Rodionov 4 participants 18 messages Oct 23, 2025 – Oct 28, 2025

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v6 cover Add support for Cirrus Logic CS530x DAC and CODEC variants.

This patch series introduces DAC, CODEC, and SPI control bus support for Cirrus Logic CS530x variants, along with general code cleanup and resolution of checkpatch.pl warnings.

Changes since v1,v2,v3:

- Signed off all patches
- Splitted "tidy up" pach in 3 separate simple patches
- Fixed commit subject to much preferred subject prefix for binding patches.
- Moved dt-bindings related patch down the chain
- Added all relevant maintainers to CC list

Changes since v4:
- Sorted dt-binding properties list
- Re-worked removal of unused defenitions and structures
- Move renaming of CS530X_IN_VU to CS530X_INOUT_VU into separate patch
- Added dt-bindings SPI propery patch

Changes since v5:
- Corrected the DT-binding patch to include SPI support and revised the commit message.

Simon Trimmer (3):
ASoC: cs530x: Add CODEC and DAC support
ASoC: cs530x: Check the DEVID matches the devtype
ASoC: cs530x: Rename i2c related structures

Vitaly Rodionov (9):
ASoC: cs530x: Update the copyright headers
ASoC: cs530x: Sort #include directives and tydy up whitespaces
ASoC: cs530x: Remove unused struct members and constants
ASoC: cs530x: Correct constant naming
ASoC: dt-bindings: sound: cirrus: cs530x: Add cs530x
ASoC: cs530x: Rename bitfield to reflect common use for ADC and DAC
ASoC: cs530x: Correct MCLK reference frequency values
ASoC: dt-bindings: sound: cirrus: cs530x: Add SPI bus support
ASoC: cs530x: Add SPI bus support for cs530x parts

 .../bindings/sound/cirrus,cs530x.yaml         |   8 +
 sound/soc/codecs/Kconfig                      |  10 +
 sound/soc/codecs/Makefile                     |   2 +
 sound/soc/codecs/cs530x-i2c.c                 |  24 +-
 sound/soc/codecs/cs530x-spi.c                 |  92 ++++
 sound/soc/codecs/cs530x.c                     | 516 +++++++++++++++---
 sound/soc/codecs/cs530x.h                     |  90 ++-
 7 files changed, 636 insertions(+), 106 deletions(-)
 create mode 100644 sound/soc/codecs/cs530x-spi.c
Signature · 1 line
2.43.0
#1 lore raw

PATCH v6 1/12 ASoC: cs530x: Update the copyright headers

---
 sound/soc/codecs/cs530x-i2c.c | 4 ++--
 sound/soc/codecs/cs530x.c     | 4 ++--
 sound/soc/codecs/cs530x.h     | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)
sound/soc/codecs/cs530x-i2c.c +2 -2
index 22b1a4d6b61c..be80dcad3647 100644
@@ -2,8 +2,8 @@
 //
 // CS530x CODEC driver
 //
-// Copyright (C) 2024 Cirrus Logic, Inc. and
-//                    Cirrus Logic International Semiconductor Ltd.
+// Copyright (C) 2024-2025 Cirrus Logic, Inc. and
+//                         Cirrus Logic International Semiconductor Ltd.
 
 #include <linux/device.h>
 #include <linux/module.h>
sound/soc/codecs/cs530x.c +2 -2
index 0dbc5fb92290..88084e7d6447 100644
@@ -2,8 +2,8 @@
 //
 // CS530x CODEC driver
 //
-// Copyright (C) 2024 Cirrus Logic, Inc. and
-//                    Cirrus Logic International Semiconductor Ltd.
+// Copyright (C) 2024-2025 Cirrus Logic, Inc. and
+//                         Cirrus Logic International Semiconductor Ltd.
 
 #include <sound/core.h>
 #include <linux/delay.h>
sound/soc/codecs/cs530x.h +1 -1
index f473e33eb835..b325847036e9 100644
@@ -2,7 +2,7 @@
 /*
  * CS530x CODEC driver internal data
  *
- * Copyright (C) 2023-2024 Cirrus Logic, Inc. and
+ * Copyright (C) 2023-2025 Cirrus Logic, Inc. and
  *                         Cirrus Logic International Semiconductor Ltd.
  */
 
Signature · 1 line
2.43.0
#2 lore raw

PATCH v6 2/12 ASoC: cs530x: Sort #include directives and tydy up whitespaces

In reply to Vitaly Rodionov
---
 sound/soc/codecs/cs530x-i2c.c |  2 +-
 sound/soc/codecs/cs530x.c     | 49 ++++++++++++++++-------------------
 2 files changed, 23 insertions(+), 28 deletions(-)
sound/soc/codecs/cs530x-i2c.c +1 -1
index be80dcad3647..d6b7883ba7b9 100644
@@ -48,7 +48,7 @@ static int cs530x_i2c_probe(struct i2c_client *client)
 	cs530x->regmap = devm_regmap_init_i2c(client, &cs530x_regmap);
 	if (IS_ERR(cs530x->regmap))
 		return dev_err_probe(&client->dev, PTR_ERR(cs530x->regmap),
-			      "Failed to allocate register map\n");
+				     "Failed to allocate register map\n");
 
 	cs530x->devtype = (uintptr_t)i2c_get_match_data(client);
 	cs530x->dev = &client->dev;
sound/soc/codecs/cs530x.c +22 -27

162 lines not on this page · raw message

Signature · 1 line
2.43.0
#3 lore raw

PATCH v6 3/12 ASoC: cs530x: Remove unused struct members and constants

In reply to Vitaly Rodionov
---
 sound/soc/codecs/cs530x.c | 6 ------
 sound/soc/codecs/cs530x.h | 5 +----
 2 files changed, 1 insertion(+), 10 deletions(-)
sound/soc/codecs/cs530x.c +0 -6
index 3a59eeba5e55..3de748fa5255 100644
@@ -21,9 +21,6 @@
 
 #include "cs530x.h"
 
-#define CS530X_MAX_ADC_CH	8
-#define CS530X_MIN_ADC_CH	2
-
 static const char *cs530x_supply_names[CS530X_NUM_SUPPLIES] = {
 	"vdd-a",
 	"vdd-io",
@@ -517,7 +514,6 @@ static int cs530x_hw_params(struct snd_pcm_substream *substream,
 		return -EINVAL;
 	}
 
-	cs530x->fs = fs;
 	regmap_update_bits(regmap, CS530X_CLK_CFG_1,
 			   CS530X_SAMPLE_RATE_MASK, fs_val);
 
@@ -781,8 +777,6 @@ static int cs530x_set_sysclk(struct snd_soc_component *component, int clk_id,
 				freq);
 			return -EINVAL;
 		}
-
-		cs530x->mclk_rate = freq;
 		break;
 	case CS530X_SYSCLK_SRC_PLL:
 		break;
sound/soc/codecs/cs530x.h +1 -4
index b325847036e9..5b47c1ae2a09 100644
@@ -99,7 +99,7 @@
 #define CS530X_TDM_EN_MASK		BIT(2)
 #define CS530X_ASP_FMT_I2S		0
 #define CS530X_ASP_FMT_LJ		1
-#define CS530X_ASP_FMT_DSP_A		0x6
+#define CS530X_ASP_FMT_DSP_A		6
 
 /* TDM Slots */
 #define CS530X_0_1_TDM_SLOT_MASK	GENMASK(1, 0)
@@ -207,11 +207,8 @@ struct cs530x_priv {
 
 	struct regulator_bulk_data supplies[CS530X_NUM_SUPPLIES];
 
-	unsigned int mclk_rate;
-
 	int tdm_width;
 	int tdm_slots;
-	int fs;
 	int adc_pairs_count;
 
 	struct gpio_desc *reset_gpio;
Signature · 1 line
2.43.0
#4 lore raw

PATCH v6 4/12 ASoC: cs530x: Correct constant naming

In reply to Vitaly Rodionov
---
 sound/soc/codecs/cs530x.c | 10 +++++-----
 sound/soc/codecs/cs530x.h | 10 +++++-----
 2 files changed, 10 insertions(+), 10 deletions(-)
sound/soc/codecs/cs530x.c +5 -5
index 3de748fa5255..42b9e087f28d 100644
@@ -491,23 +491,23 @@ static int cs530x_hw_params(struct snd_pcm_substream *substream,
 		break;
 	case 44100:
 	case 48000:
-		fs_val = CS530X_FS_48K_44P1K;
+		fs_val = CS530X_FS_44P1K_48K;
 		break;
 	case 88200:
 	case 96000:
-		fs_val = CS530X_FS_96K_88P2K;
+		fs_val = CS530X_FS_88P2K_96K;
 		break;
 	case 176400:
 	case 192000:
-		fs_val = CS530X_FS_192K_176P4K;
+		fs_val = CS530X_FS_176P4K_192K;
 		break;
 	case 356800:
 	case 384000:
-		fs_val = CS530X_FS_384K_356P8K;
+		fs_val = CS530X_FS_356P8K_384K;
 		break;
 	case 705600:
 	case 768000:
-		fs_val = CS530X_FS_768K_705P6K;
+		fs_val = CS530X_FS_705P6K_768K;
 		break;
 	default:
 		dev_err(component->dev, "Invalid sample rate %d\n", fs);
sound/soc/codecs/cs530x.h +5 -5
index 5b47c1ae2a09..f7640161c77f 100644
@@ -73,11 +73,11 @@
 /* CLK_CFG_1 */
 #define CS530X_SAMPLE_RATE_MASK		GENMASK(2, 0)
 #define CS530X_FS_32K			0
-#define CS530X_FS_48K_44P1K		1
-#define CS530X_FS_96K_88P2K		2
-#define CS530X_FS_192K_176P4K		3
-#define CS530X_FS_384K_356P8K		4
-#define CS530X_FS_768K_705P6K		5
+#define CS530X_FS_44P1K_48K		1
+#define CS530X_FS_88P2K_96K		2
+#define CS530X_FS_176P4K_192K		3
+#define CS530X_FS_356P8K_384K		4
+#define CS530X_FS_705P6K_768K		5
 
 /* CHIP_ENABLE */
 #define CS530X_GLOBAL_EN		BIT(0)
Signature · 1 line
2.43.0
#5 lore raw

PATCH v6 5/12 ASoC: dt-bindings: sound: cirrus: cs530x: Add cs530x

In reply to Vitaly Rodionov

This patch adds additional cs530x family variants.

cirrus,cs4282 - high-performance, 32-bit resolution, stereo CODEC cirrus,cs4302 - high performance stereo DAC, 2 channels cirrus,cs4304 - high performance stereo DAC, 4 channels cirrus,cs4308 - high performance stereo DAC, 8 channels

---
 Documentation/devicetree/bindings/sound/cirrus,cs530x.yaml | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/sound/cirrus,cs530x.yaml +4 -0
index 9582eb8eb418..04ed197f91eb 100644
@@ -19,6 +19,10 @@ allOf:
 properties:
   compatible:
     enum:
+      - cirrus,cs4282
+      - cirrus,cs4302
+      - cirrus,cs4304
+      - cirrus,cs4308
       - cirrus,cs5302
       - cirrus,cs5304
       - cirrus,cs5308
Signature · 1 line
2.43.0
maintainer Reviewed-by on v6 5/12
#6 lore raw

Re: [PATCH v6 05/12] ASoC: dt-bindings: sound: cirrus: cs530x: Add cs530x

Quoted 7 lines · Vitaly Rodionov

This patch adds additional cs530x family variants.

cirrus,cs4282 - high-performance, 32-bit resolution, stereo CODEC cirrus,cs4302 - high performance stereo DAC, 2 channels cirrus,cs4304 - high performance stereo DAC, 4 channels cirrus,cs4308 - high performance stereo DAC, 8 channels

Quoted 5 lines
---
 Documentation/devicetree/bindings/sound/cirrus,cs530x.yaml | 4 ++++
 1 file changed, 4 insertions(+)
#7 lore raw

Re: [PATCH v6 05/12] ASoC: dt-bindings: sound: cirrus: cs530x: Add cs530x

In reply to Vitaly Rodionov
Quoted 7 lines · Vitaly Rodionov

This patch adds additional cs530x family variants.

cirrus,cs4282 - high-performance, 32-bit resolution, stereo CODEC cirrus,cs4302 - high performance stereo DAC, 2 channels cirrus,cs4304 - high performance stereo DAC, 4 channels cirrus,cs4308 - high performance stereo DAC, 8 channels

<form letter>
This is a friendly reminder during the review process.

It looks like you received a tag and forgot to add it.

If you do not know the process, here is a short explanation:
Please add Acked-by/Reviewed-by/Tested-by tags when posting new versions of patchset, under or above your Signed-off-by tag, unless patch changed significantly (e.g. new properties added to the DT bindings). Tag is "received", when provided in a message replied to you on the mailing list. Tools like b4 can help here. However, there's no need to repost patches *only* to add the tags. The upstream maintainer will do that for tags received on the version they apply.

Please read:
https://elixir.bootlin.com/linux/v6.12-rc3/source/Documentation/process/submitting-patches.rst#L577

If a tag was not added on purpose, please state why and what changed. </form letter>

Best regards,
Krzysztof

#8 lore raw

Re: [PATCH v6 05/12] ASoC: dt-bindings: sound: cirrus: cs530x: Add cs530x

Quoted 23 lines · Krzysztof Kozlowski
Quoted 7 lines · Vitaly Rodionov

This patch adds additional cs530x family variants.

cirrus,cs4282 - high-performance, 32-bit resolution, stereo CODEC cirrus,cs4302 - high performance stereo DAC, 2 channels cirrus,cs4304 - high performance stereo DAC, 4 channels cirrus,cs4308 - high performance stereo DAC, 8 channels

<form letter>
This is a friendly reminder during the review process.

It looks like you received a tag and forgot to add it.

If you do not know the process, here is a short explanation:
Please add Acked-by/Reviewed-by/Tested-by tags when posting new versions of patchset, under or above your Signed-off-by tag, unless patch changed significantly (e.g. new properties added to the DT bindings). Tag is "received", when provided in a message replied to you on the mailing list. Tools like b4 can help here. However, there's no need to repost patches *only* to add the tags. The upstream maintainer will do that for tags received on the version they apply.

Quoted 8 lines

Please read:
https://elixir.bootlin.com/linux/v6.12-rc3/source/Documentation/process/submitting-patches.rst#L577

If a tag was not added on purpose, please state why and what changed. </form letter>

Best regards,
Krzysztof

Hi Krzysztof,
Thank you for reminder. Acknowledged.
Best regards,
Vitaly

#9 lore raw

PATCH v6 6/12 ASoC: cs530x: Add CODEC and DAC support

In reply to Vitaly Rodionov

From: Simon Trimmer <[email protected]>

- Added DAC register address constants
- Add the new registers to the regmap config
- Renamed constants that are shared between the DACs and ADCs
- Add the device IDs and device names of the CODEC and DACs along with their different capabilities
- Add DAPM widgets, ALSA controls and event handling for the DAC functionality
- Add Playback DAI support

---
 sound/soc/codecs/cs530x-i2c.c |  16 ++
 sound/soc/codecs/cs530x.c     | 411 +++++++++++++++++++++++++++++++---
 sound/soc/codecs/cs530x.h     |  58 +++--
 3 files changed, 440 insertions(+), 45 deletions(-)
sound/soc/codecs/cs530x-i2c.c +16 -0
index d6b7883ba7b9..ab410826f777 100644
@@ -14,6 +14,18 @@
 
 static const struct of_device_id cs530x_of_match[] = {
 	{
+		.compatible = "cirrus,cs4282",
+		.data = (void *)CS4282,
+	}, {
+		.compatible = "cirrus,cs4302",
+		.data = (void *)CS4302,
+	}, {
+		.compatible = "cirrus,cs4304",
+		.data = (void *)CS4304,
+	}, {
+		.compatible = "cirrus,cs4308",
+		.data = (void *)CS4308,
+	}, {
 		.compatible = "cirrus,cs5302",
 		.data = (void *)CS5302,
 	}, {
@@ -28,6 +40,10 @@ static const struct of_device_id cs530x_of_match[] = {
 MODULE_DEVICE_TABLE(of, cs530x_of_match);
 
 static const struct i2c_device_id cs530x_i2c_id[] = {
+	{ "cs4282", CS4282 },
+	{ "cs4302", CS4302 },
+	{ "cs4304", CS4304 },
+	{ "cs4308", CS4308 },
 	{ "cs5302", CS5302 },
 	{ "cs5304", CS5304 },
 	{ "cs5308", CS5308 },
sound/soc/codecs/cs530x.c +382 -29

557 lines not on this page · raw message

sound/soc/codecs/cs530x.h +42 -16

104 lines not on this page · raw message

Signature · 1 line
2.43.0
#10 lore raw

PATCH v6 7/12 ASoC: cs530x: Rename bitfield to reflect common use for ADC and DAC

In reply to Vitaly Rodionov
---
 sound/soc/codecs/cs530x.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/cs530x.c +2 -2
index 4b0bf1c3b985..193d7af5cfd5 100644
@@ -141,8 +141,8 @@ static int cs530x_put_volsw_vu(struct snd_kcontrol *kcontrol,
 	if (ret)
 		goto volsw_err;
 
-	/* Write IN_VU bit for the volume change to take effect */
-	regmap_write(regmap, CS530X_IN_VOL_CTRL5, CS530X_IN_VU);
+	/* Write INOUT_VU bit for the volume change to take effect */
+	regmap_write(regmap, CS530X_IN_VOL_CTRL5, CS530X_INOUT_VU);
 
 volsw_err:
 	snd_soc_dapm_mutex_unlock(dapm);
Signature · 1 line
2.43.0
#11 lore raw

PATCH v6 8/12 ASoC: cs530x: Check the DEVID matches the devtype

In reply to Vitaly Rodionov

From: Simon Trimmer <[email protected]>

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.

---
 sound/soc/codecs/cs530x.c |  6 ++++++
 sound/soc/codecs/cs530x.h | 14 +++++++-------
 2 files changed, 13 insertions(+), 7 deletions(-)
sound/soc/codecs/cs530x.c +6 -0
index 193d7af5cfd5..7dd9e5d19336 100644
@@ -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);
 
sound/soc/codecs/cs530x.h +7 -7
index 52fb148df36a..d11711715ba8 100644
@@ -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 */
Signature · 1 line
2.43.0
#12 lore raw

PATCH v6 9/12 ASoC: cs530x: Correct MCLK reference frequency values

In reply to Vitaly Rodionov

The MCLK frequency must be 49.152 MHz (for 48 kHz-related sample rates) or 45.1584 MHz (for 44.1 kHz-related sample rates).

---
 sound/soc/codecs/cs530x.c | 9 ++++++---
 sound/soc/codecs/cs530x.h | 6 ++++++
 2 files changed, 12 insertions(+), 3 deletions(-)
sound/soc/codecs/cs530x.c +6 -3
index 7dd9e5d19336..19fac4a90368 100644
@@ -1100,9 +1100,12 @@ static int cs530x_set_sysclk(struct snd_soc_component *component, int clk_id,
 
 	switch (source) {
 	case CS530X_SYSCLK_SRC_MCLK:
-		if (freq != 24560000 && freq != 22572000) {
-			dev_err(component->dev, "Invalid MCLK source rate %d\n",
-				freq);
+		switch (freq) {
+		case CS530X_SYSCLK_REF_45_1MHZ:
+		case CS530X_SYSCLK_REF_49_1MHZ:
+			break;
+		default:
+			dev_err(component->dev, "Invalid MCLK source rate %d\n", freq);
 			return -EINVAL;
 		}
 		break;
sound/soc/codecs/cs530x.h +6 -0
index d11711715ba8..2c773c4b6b92 100644
@@ -200,6 +200,12 @@
 /* IN_VOL_CTL5 and OUT_VOL_CTL5 */
 #define CS530X_INOUT_VU			BIT(0)
 
+/* MCLK Reference Source Frequency */
+/* 41KHz related */
+#define CS530X_SYSCLK_REF_45_1MHZ	45158400
+/* 48KHz related */
+#define CS530X_SYSCLK_REF_49_1MHZ	49152000
+
 /* System Clock Source */
 #define CS530X_SYSCLK_SRC_MCLK		0
 #define CS530X_SYSCLK_SRC_PLL		1
Signature · 1 line
2.43.0
#13 lore raw

PATCH v6 10/12 ASoC: cs530x: Rename i2c related structures

In reply to Vitaly Rodionov

From: Simon Trimmer <[email protected]>

In preparation for SPI support these structures should be renamed to reflect that they are for i2c.

---
 sound/soc/codecs/cs530x-i2c.c | 2 +-
 sound/soc/codecs/cs530x.c     | 4 ++--
 sound/soc/codecs/cs530x.h     | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
sound/soc/codecs/cs530x-i2c.c +1 -1
index ab410826f777..52b02ceaa7e3 100644
@@ -61,7 +61,7 @@ static int cs530x_i2c_probe(struct i2c_client *client)
 
 	i2c_set_clientdata(client, cs530x);
 
-	cs530x->regmap = devm_regmap_init_i2c(client, &cs530x_regmap);
+	cs530x->regmap = devm_regmap_init_i2c(client, &cs530x_regmap_i2c);
 	if (IS_ERR(cs530x->regmap))
 		return dev_err_probe(&client->dev, PTR_ERR(cs530x->regmap),
 				     "Failed to allocate register map\n");
sound/soc/codecs/cs530x.c +2 -2
index 19fac4a90368..9fcae9b85a45 100644
@@ -1128,7 +1128,7 @@ static const struct snd_soc_component_driver soc_component_dev_cs530x = {
 	.endianness		= 1,
 };
 
-const struct regmap_config cs530x_regmap = {
+const struct regmap_config cs530x_regmap_i2c = {
 	.reg_bits = 16,
 	.val_bits = 16,
 
@@ -1140,7 +1140,7 @@ const struct regmap_config cs530x_regmap = {
 	.reg_defaults = cs530x_reg_defaults,
 	.num_reg_defaults = ARRAY_SIZE(cs530x_reg_defaults),
 };
-EXPORT_SYMBOL_NS_GPL(cs530x_regmap, "SND_SOC_CS530X");
+EXPORT_SYMBOL_NS_GPL(cs530x_regmap_i2c, "SND_SOC_CS530X");
 
 static int cs530x_check_device_id(struct cs530x_priv *cs530x)
 {
sound/soc/codecs/cs530x.h +1 -1
index 2c773c4b6b92..2a7b7d01ecfb 100644
@@ -246,7 +246,7 @@ struct cs530x_priv {
 	struct gpio_desc *reset_gpio;
 };
 
-extern const struct regmap_config cs530x_regmap;
+extern const struct regmap_config cs530x_regmap_i2c;
 int cs530x_probe(struct cs530x_priv *cs530x);
 
 #endif
Signature · 1 line
2.43.0
#14 lore raw

PATCH v6 11/12 ASoC: dt-bindings: sound: cirrus: cs530x: Add SPI bus support

In reply to Vitaly Rodionov

The CS530x device family supports multiple control interfaces. At present, only the I2C interface is implemented. Adding support for the SPI control interface, operating at up to 24 MHz.

---
 Documentation/devicetree/bindings/sound/cirrus,cs530x.yaml | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/sound/cirrus,cs530x.yaml +4 -0
index 04ed197f91eb..7600fff0e3b7 100644
@@ -15,6 +15,7 @@ description:
 
 allOf:
   - $ref: dai-common.yaml#
+  - $ref: /schemas/spi/spi-peripheral-props.yaml#
 
 properties:
   compatible:
@@ -30,6 +31,9 @@ properties:
   reg:
     maxItems: 1
 
+  spi-max-frequency:
+    maximum: 24000000
+
   '#sound-dai-cells':
     const: 1
 
Signature · 1 line
2.43.0
#15 lore raw

Re: [PATCH v6 11/12] ASoC: dt-bindings: sound: cirrus: cs530x: Add SPI bus support

Quoted 3 lines · Vitaly Rodionov

The CS530x device family supports multiple control interfaces. At present, only the I2C interface is implemented. Adding support for the SPI control interface, operating at up to 24 MHz.

subject - too many sound prefixes. It is ASoC and dt-bindings. ASoC defines sound.

Please use subject prefixes matching the subsystem. You can get them for example with 'git log --oneline -- DIRECTORY_OR_FILE' on the directory your patch is touching. For bindings, the preferred subjects are explained here:
https://www.kernel.org/doc/html/latest/devicetree/bindings/submitting-patches.html#i-for-patch-submitters

Quoted 3 lines

---

<form letter>
This is an automated instruction, just in case, because many review tags are being ignored. If you know the process, just skip it entirely (please do not feel offended by me posting it here - no bad intentions intended, no patronizing, I just want to avoid wasted efforts). If you do not know the process, here is a short explanation:

Please add Acked-by/Reviewed-by/Tested-by tags when posting new versions of patchset, under or above your Signed-off-by tag, unless patch changed significantly (e.g. new properties added to the DT bindings). Tag is "received", when provided in a message replied to you on the mailing list. Tools like b4 can help here ('b4 trailers -u ...'). However, there's no need to repost patches *only* to add the tags. The upstream maintainer will do that for tags received on the version they apply.

https://elixir.bootlin.com/linux/v6.15/source/Documentation/process/submitting-patches.rst#L591
</form letter>

Best regards,
Krzysztof

#16 lore raw

PATCH v6 12/12 ASoC: cs530x: Add SPI bus support for cs530x parts

In reply to Vitaly Rodionov

Cirrus Logic cs530x device family has 2 control buses I2C and SPI. This patch adds SPI support.

---
 sound/soc/codecs/Kconfig      | 10 ++++
 sound/soc/codecs/Makefile     |  2 +
 sound/soc/codecs/cs530x-spi.c | 92 +++++++++++++++++++++++++++++++++++
 sound/soc/codecs/cs530x.c     | 21 ++++++++
 sound/soc/codecs/cs530x.h     |  1 +
 5 files changed, 126 insertions(+)
 create mode 100644 sound/soc/codecs/cs530x-spi.c
sound/soc/codecs/Kconfig +10 -0
index 160c07699a8b..ef49f71e8b34 100644
@@ -106,6 +106,7 @@ config SND_SOC_ALL_CODECS
 	imply SND_SOC_CS48L32
 	imply SND_SOC_CS53L30
 	imply SND_SOC_CS530X_I2C
+	imply SND_SOC_CS530X_SPI
 	imply SND_SOC_CX20442
 	imply SND_SOC_CX2072X
 	imply SND_SOC_DA7210
@@ -1082,6 +1083,15 @@ config SND_SOC_CS530X_I2C
 	  Enable support for Cirrus Logic CS530X ADCs
 	  with I2C control.
 
+config SND_SOC_CS530X_SPI
+	tristate "Cirrus Logic CS530x ADCs (SPI)"
+	depends on SPI_MASTER
+	select REGMAP_SPI
+	select SND_SOC_CS530X
+	help
+	  Enable support for Cirrus Logic CS530X ADCs
+	  with SPI control.
+
 config SND_SOC_CX20442
 	tristate
 	depends on TTY
sound/soc/codecs/Makefile +2 -0
index bd95a7c911d5..39138d96a720 100644
@@ -115,6 +115,7 @@ snd-soc-cs48l32-y := cs48l32.o cs48l32-tables.o
 snd-soc-cs53l30-y := cs53l30.o
 snd-soc-cs530x-y := cs530x.o
 snd-soc-cs530x-i2c-y := cs530x-i2c.o
+snd-soc-cs530x-spi-y := cs530x-spi.o
 snd-soc-cx20442-y := cx20442.o
 snd-soc-cx2072x-y := cx2072x.o
 snd-soc-da7210-y := da7210.o
@@ -546,6 +547,7 @@ obj-$(CONFIG_SND_SOC_CS48L32)	+= snd-soc-cs48l32.o
 obj-$(CONFIG_SND_SOC_CS53L30)	+= snd-soc-cs53l30.o
 obj-$(CONFIG_SND_SOC_CS530X)	+= snd-soc-cs530x.o
 obj-$(CONFIG_SND_SOC_CS530X_I2C)	+= snd-soc-cs530x-i2c.o
+obj-$(CONFIG_SND_SOC_CS530X_SPI)	+= snd-soc-cs530x-spi.o
 obj-$(CONFIG_SND_SOC_CX20442)	+= snd-soc-cx20442.o
 obj-$(CONFIG_SND_SOC_CX2072X)	+= snd-soc-cx2072x.o
 obj-$(CONFIG_SND_SOC_DA7210)	+= snd-soc-da7210.o
sound/soc/codecs/cs530x-spi.c new file +92 -0

92 lines not on this page · raw message

sound/soc/codecs/cs530x.c +21 -0
index 9fcae9b85a45..f8f409d0b035 100644
@@ -12,6 +12,7 @@
 #include <linux/pm.h>
 #include <linux/property.h>
 #include <linux/slab.h>
+#include <linux/spi/spi.h>
 #include <sound/core.h>
 #include <sound/initval.h>
 #include <sound/pcm.h>
@@ -1142,6 +1143,26 @@ const struct regmap_config cs530x_regmap_i2c = {
 };
 EXPORT_SYMBOL_NS_GPL(cs530x_regmap_i2c, "SND_SOC_CS530X");
 
+const struct regmap_config cs530x_regmap_spi = {
+	.reg_bits = 16,
+	.pad_bits = 16,
+	.val_bits = 16,
+
+	.reg_stride = 2,
+
+	.reg_format_endian = REGMAP_ENDIAN_BIG,
+	.val_format_endian = REGMAP_ENDIAN_BIG,
+
+	.max_register = CS530X_MAX_REGISTER,
+	.writeable_reg = cs530x_writeable_register,
+	.readable_reg = cs530x_readable_register,
+
+	.cache_type = REGCACHE_MAPLE,
+	.reg_defaults = cs530x_reg_defaults,
+	.num_reg_defaults = ARRAY_SIZE(cs530x_reg_defaults),
+};
+EXPORT_SYMBOL_NS_GPL(cs530x_regmap_spi, "SND_SOC_CS530X");
+
 static int cs530x_check_device_id(struct cs530x_priv *cs530x)
 {
 	struct device *dev = cs530x->dev;
sound/soc/codecs/cs530x.h +1 -0
index 2a7b7d01ecfb..1e2f6a7a589c 100644
@@ -247,6 +247,7 @@ struct cs530x_priv {
 };
 
 extern const struct regmap_config cs530x_regmap_i2c;
+extern const struct regmap_config cs530x_regmap_spi;
 int cs530x_probe(struct cs530x_priv *cs530x);
 
 #endif
Signature · 1 line
2.43.0
maintainer
#17 lore raw
In reply to Vitaly Rodionov
Quoted 6 lines · Vitaly Rodionov

This patch series introduces DAC, CODEC, and SPI control bus support for Cirrus Logic CS530x variants, along with general code cleanup and resolution of checkpatch.pl warnings.

Changes since v1,v2,v3:

Quoted 7 lines

- Signed off all patches
- Splitted "tidy up" pach in 3 separate simple patches
- Fixed commit subject to much preferred subject prefix for binding patches.
- Moved dt-bindings related patch down the chain
- Added all relevant maintainers to CC list

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[01/12] ASoC: cs530x: Update the copyright headers

        commit: ca4d49f8a21c37be7e5aed80100ca6b13ac3cf9d
[02/12] ASoC: cs530x: Sort #include directives and tydy up whitespaces
        commit: 1e0722a77b4e263854a812c9c106ddef8fd56720
[03/12] ASoC: cs530x: Remove unused struct members and constants
        commit: f97ebfda8da28a77a0218a448829451ba7e30d5d
[04/12] ASoC: cs530x: Correct constant naming
        commit: ddbcd2f396116581ad035fb76a99fc2ed865a85f
[05/12] ASoC: dt-bindings: sound: cirrus: cs530x: Add cs530x
        commit: 9957614d2b79578b6f9a2512bfbb2bc7bbdc43ce
[06/12] ASoC: cs530x: Add CODEC and DAC support
        commit: c63b2315b9cc6b705205c73dcf4591cfeb9a25ae
[07/12] ASoC: cs530x: Rename bitfield to reflect common use for ADC and DAC
        commit: 3941abb26ff327e53e1e8b873cab3ed3d5103eab
[08/12] ASoC: cs530x: Check the DEVID matches the devtype
        commit: c37c3e5e390dcd52cbe6178ac53f5a6131ef6f8c
[09/12] ASoC: cs530x: Correct MCLK reference frequency values
        commit: e7ab858390f24a23ba0827066382ba0e6a8e4379
[10/12] ASoC: cs530x: Rename i2c related structures
        commit: 38ff69586bbb3a823dd501972e17075374b685a1
[11/12] ASoC: dt-bindings: sound: cirrus: cs530x: Add SPI bus support
        commit: bb65cb96f64e9b4ea2bbd41e4591f3da91414fdb
[12/12] ASoC: cs530x: Add SPI bus support for cs530x parts
        commit: e7434adf0c53a84d548226304cdb41c8818da1cb

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark