Add support for Cirrus Logic CS530x DAC and CODEC variants.
Subsystems (4)
v4 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
Simon Trimmer (4):
ASoC: cs530x: Correct log message with expected variable
ASoC: cs530x: Add CODEC and DAC support
ASoC: cs530x: Check the DEVID matches the devtype
ASoC: cs530x: Rename i2c related structures
Vitaly Rodionov (7):
ASoC: cs530x: Update the copyright headers
ASoC: cs530x: Sort #include directives and tidy up whitespaces
ASoC: cs530x: Remove unused struct members and constants
ASoC: cs530x: Correct constant naming
ASoC: dt-bindings: sound: cirrus: cs530x: Add cs530x variants
ASoC: cs530x: Correct MCLK reference frequency values
ASoC: cs530x: Add SPI bus support for cs530x parts
.../bindings/sound/cirrus,cs530x.yaml | 4 + 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 | 120 ++-- 7 files changed, 634 insertions(+), 134 deletions(-) create mode 100644 sound/soc/codecs/cs530x-spi.c
Signature · 1 line
2.43.0
PATCH v4 1/11 ASoC: cs530x: Correct log message with expected variable
From: Simon Trimmer <[email protected]>
The function used one parameter for the switch statement, but logged a different parameter when it defaulted.
--- sound/soc/codecs/cs530x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/cs530x.c +1 -1
@@ -793,7 +793,7 @@ static int cs530x_set_sysclk(struct snd_soc_component *component, int clk_id,case CS530X_SYSCLK_SRC_PLL :break ;default : -dev_err (component->dev,"Invalid clock id %d\n" , clk_id); +dev_err (component->dev,"Invalid sysclk source: %d\n" , source);return -EINVAL ; }
Signature · 1 line
2.43.0
PATCH v4 2/11 ASoC: cs530x: Update the copyright headers
In reply to Vitaly Rodionov--- 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
@@ -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
@@ -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
@@ -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
PATCH v4 3/11 ASoC: cs530x: Sort #include directives and tidy 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
@@ -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
PATCH v4 4/11 ASoC: cs530x: Remove unused struct members and constants
In reply to Vitaly Rodionov--- sound/soc/codecs/cs530x.c | 6 ------ sound/soc/codecs/cs530x.h | 29 +---------------------------- 2 files changed, 1 insertion(+), 34 deletions(-)
sound/soc/codecs/cs530x.c +0 -6
@@ -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 -28
@@ -52,10 +52,6 @@/* Register Fields */ -/* REVID */ -#define CS530X_MTLREVID GENMASK(3, 0) -#define CS530X_AREVID GENMASK(7, 4) -/* SW_RESET */ #define CS530X_SW_RST_SHIFT 8#define CS530X_SW_RST_VAL (0x5A << CS530X_SW_RST_SHIFT)
@@ -79,9 +75,6 @@#define CS530X_FS_384K_356P8K 4#define CS530X_FS_768K_705P6K 5 -/* CHIP_ENABLE */ -#define CS530X_GLOBAL_EN BIT(0) -/* ASP_CFG */ #define CS530X_ASP_BCLK_FREQ_MASK GENMASK(1, 0)#define CS530X_ASP_PRIMARY BIT(5)
@@ -95,11 +88,10 @@#define CS530X_ASP_FMT_MASK GENMASK(2, 0)#define CS530X_ASP_TDM_SLOT_MASK GENMASK(5, 3)#define CS530X_ASP_TDM_SLOT_SHIFT 3 -#define CS530X_ASP_CH_REVERSE BIT(9)#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)
@@ -163,22 +155,6 @@/* IN_VOL_CTL5 */ #define CS530X_IN_VU BIT(0) -/* PAD_FN */ -#define CS530X_DOUT2_FN BIT(0) -#define CS530X_DOUT3_FN BIT(1) -#define CS530X_DOUT4_FN BIT(2) -#define CS530X_SPI_CS_FN BIT(3) -#define CS530X_CONFIG2_FN BIT(6) -#define CS530X_CONFIG3_FN BIT(7) -#define CS530X_CONFIG4_FN BIT(8) -#define CS530X_CONFIG5_FN BIT(9) - -/* PAD_LVL */ -#define CS530X_CONFIG2_LVL BIT(6) -#define CS530X_CONFIG3_LVL BIT(7) -#define CS530X_CONFIG4_LVL BIT(8) -#define CS530X_CONFIG5_LVL BIT(9) -/* System Clock Source */ #define CS530X_SYSCLK_SRC_MCLK 0#define CS530X_SYSCLK_SRC_PLL 1
@@ -207,11 +183,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
Mark Brown
maintainerRe: [PATCH v4 04/11] ASoC: cs530x: Remove unused struct members and constants
sound/soc/codecs/cs530x.h line 58
Quoted 6 lines · Vitaly Rodionov
/* Register Fields */
sound/soc/codecs/cs530x.h +0
-4-/* REVID */ -#define CS530X_MTLREVID GENMASK(3, 0) -#define CS530X_AREVID GENMASK(7, 4) -
It seems a bit unhelpful to remove register definitions merely because they are removed, so long as they're correct they might come in handly for something in the future. I'm not sure if the datasheet for these parts is public...
PATCH v4 5/11 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
@@ -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
@@ -69,11 +69,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/* ASP_CFG */ #define CS530X_ASP_BCLK_FREQ_MASK GENMASK(1, 0)
Signature · 1 line
2.43.0
PATCH v4 6/11 ASoC: dt-bindings: sound: cirrus: cs530x: Add cs530x variants
In reply to Vitaly RodionovThis 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
@@ -22,6 +22,10 @@ properties: - cirrus,cs5302 - cirrus,cs5304 - cirrus,cs5308 + - cirrus,cs4282 + - cirrus,cs4302 + - cirrus,cs4304 + - cirrus,cs4308 reg: maxItems: 1
Signature · 1 line
2.43.0
Mark Brown
maintainerRe: [PATCH v4 06/11] ASoC: dt-bindings: sound: cirrus: cs530x: Add cs530x variants
Documentation/devicetree/bindings/sound/cirrus,cs530x.yaml properties: · line 28
Quoted 10 lines · Vitaly Rodionov
Documentation/devicetree/bindings/sound/cirrus,cs530x.yaml +4
-0@@ -22,6 +22,10 @@ properties: - cirrus,cs5302 - cirrus,cs5304 - cirrus,cs5308 + - cirrus,cs4282 + - cirrus,cs4302 + - cirrus,cs4304 + - cirrus,cs4308
I've not gone back and cheked but I suspect Krzysztof's complaint on prior versions that he wasn't happy you weren't addressing was that these enumerations should be sorted.
Re: [PATCH v4 06/11] ASoC: dt-bindings: sound: cirrus: cs530x: Add cs530x variants
Quoted 16 lines · Mark Brown
Documentation/devicetree/bindings/sound/cirrus,cs530x.yaml properties: · line 28
Quoted 10 lines · Vitaly Rodionov
Documentation/devicetree/bindings/sound/cirrus,cs530x.yaml +4
-0@@ -22,6 +22,10 @@ properties: - cirrus,cs5302 - cirrus,cs5304 - cirrus,cs5308 + - cirrus,cs4282 + - cirrus,cs4302 + - cirrus,cs4304 + - cirrus,cs4308I've not gone back and cheked but I suspect Krzysztof's complaint on prior versions that he wasn't happy you weren't addressing was that these enumerations should be sorted.
Sorry, it looks like my email clent decided to send HTML somehow. Yes, I missed the point about sorted listi again. Will address in the next version.
Thank you
Re: [PATCH v4 06/11] ASoC: dt-bindings: sound: cirrus: cs530x: Add cs530x variants
In reply to Vitaly RodionovQuoted 17 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
Signed-off-by Vitaly Rodionov <[email protected]>--- Documentation/devicetree/bindings/sound/cirrus,cs530x.yaml | 4 ++++ 1 file changed, 4 insertions(+)Documentation/devicetree/bindings/sound/cirrus,cs530x.yaml +0
-0
Documentation/devicetree/bindings/sound/cirrus,cs530x.yaml properties: · line 28
Quoted 7 lines
Documentation/devicetree/bindings/sound/cirrus,cs530x.yaml +4
-0@@ -22,6 +22,10 @@ properties: - cirrus,cs5302 - cirrus,cs5304 - cirrus,cs5308 + - cirrus,cs4282 + - cirrus,cs4302 + - cirrus,cs4304 + - cirrus,cs4308
I asked about fixing this at v1. You ignored it. Then I reminded this at v3. You sent v4 still ignoring my comment.
I don't know what to do more.
NAK
Best regards,
Krzysztof
Re: [PATCH v4 06/11] ASoC: dt-bindings: sound: cirrus: cs530x: Add cs530x variants
Quoted 29 lines · Krzysztof Kozlowski
Quoted 17 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
Signed-off-by Vitaly Rodionov <[email protected]>--- Documentation/devicetree/bindings/sound/cirrus,cs530x.yaml | 4 ++++ 1 file changed, 4 insertions(+)Documentation/devicetree/bindings/sound/cirrus,cs530x.yaml +0
-0Documentation/devicetree/bindings/sound/cirrus,cs530x.yaml properties: · line 28
Quoted 7 lines
Documentation/devicetree/bindings/sound/cirrus,cs530x.yaml +4
-0@@ -22,6 +22,10 @@ properties: - cirrus,cs5302 - cirrus,cs5304 - cirrus,cs5308 + - cirrus,cs4282 + - cirrus,cs4302 + - cirrus,cs4304 + - cirrus,cs4308I asked about fixing this at v1. You ignored it. Then I reminded this at v3. You sent v4 still ignoring my comment.
Quoted 6 lines
I don't know what to do more.
NAK
Best regards,
Krzysztof
I’m sorry, Krzysztof — I didn’t ignore your comments. I carefully read the suggested documentation regarding docs and DTS submissions. My mistake was that I simply missed the point about sorting the string list, and I’ve already acknowledged that in my earlier reply. Apologies for the confusion — it wasn’t intentional or out of disregard on my part.
PATCH v4 7/11 ASoC: cs530x: Add CODEC and DAC support
In reply to Vitaly RodionovFrom: 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 | 413 +++++++++++++++++++++++++++++++--- sound/soc/codecs/cs530x.h | 60 +++-- 3 files changed, 441 insertions(+), 48 deletions(-)
sound/soc/codecs/cs530x-i2c.c +16 -0
@@ -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 +383 -30
565 lines not on this page · raw message
sound/soc/codecs/cs530x.h +42 -18
101 lines not on this page · raw message
Signature · 1 line
2.43.0
Mark Brown
maintainerRe: [PATCH v4 07/11] ASoC: cs530x: Add CODEC and DAC support
Quoted 8 lines · Vitaly Rodionov
sound/soc/codecs/cs530x.c +2
-0@@ -45,6 +45,18 @@ static const struct reg_default cs530x_reg_defaults[] = { { CS530X_IN_VOL_CTRL3_1, 0x8000 }, { CS530X_IN_VOL_CTRL4_0, 0x8000 }, { CS530X_IN_VOL_CTRL4_1, 0x8000 }, + { CS530X_OUT_ENABLES, 0 }, + { CS530X_OUT_RAMP_SUM, 0x0022 },
sound/soc/codecs/cs530x.c static const struct reg_default cs530x_reg_defaults[] = { · line 59
Quoted 10 lines
sound/soc/codecs/cs530x.c +10
-0+ { CS530X_OUT_FILTER, 0 }, + { CS530X_OUT_INV, 0 }, + { CS530X_OUT_VOL_CTRL1_0, 0x8000 }, + { CS530X_OUT_VOL_CTRL1_1, 0x8000 }, + { CS530X_OUT_VOL_CTRL2_0, 0x8000 }, + { CS530X_OUT_VOL_CTRL2_1, 0x8000 }, + { CS530X_OUT_VOL_CTRL3_0, 0x8000 }, + { CS530X_OUT_VOL_CTRL3_1, 0x8000 }, + { CS530X_OUT_VOL_CTRL4_0, 0x8000 }, + { CS530X_OUT_VOL_CTRL4_1, 0x8000 },
Do these new registers apply to all parts or just some (I'm guessing these might be different packaging/binnings of the same die in which case this should be fine if a little messy, but just checking).
sound/soc/codecs/cs530x.c static int cs530x_put_volsw_vu(struct snd_kcontrol *kcontrol, · line 145
Quoted 3 lines
sound/soc/codecs/cs530x.c +1
-1/* Write IN_VU bit for the volume change to take effect */ -regmap_write (regmap,CS530X_IN_VOL_CTRL5 ,CS530X_IN_VU ); +regmap_write (regmap,CS530X_IN_VOL_CTRL5 ,CS530X_INOUT_VU );
The comment is now out of sync. I can't help but feel that this change might be easier to read if the rename of everything to INOUT were a separate patch.
sound/soc/codecs/cs530x.c static int cs530x_adc_event(struct snd_soc_dapm_widget *w, · line 376
Quoted 6 lines
sound/soc/codecs/cs530x.c +6
-0+ cs530x->dac_pairs_count--; +if (!cs530x->dac_pairs_count) { +usleep_range (1000 ,1100 ); +return regmap_write (regmap,CS530X_OUT_VOL_CTRL5 , +CS530X_INOUT_VU ); + }
Should dac_pairs_count be a supply widget?
PATCH v4 8/11 ASoC: cs530x: Check the DEVID matches the devtype
In reply to Vitaly RodionovFrom: 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
@@ -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
@@ -185,13 +185,13 @@#define CS530X_NUM_SUPPLIES 2enum 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
PATCH v4 9/11 ASoC: cs530x: Correct MCLK reference frequency values
In reply to Vitaly RodionovThe 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
@@ -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
@@ -174,6 +174,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
Mark Brown
maintainerRe: [PATCH v4 09/11] ASoC: cs530x: Correct MCLK reference frequency values
Quoted 7 lines · 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 +0
-2switch (source) {case CS530X_SYSCLK_SRC_MCLK : -if (freq !=24560000 && freq !=22572000 ) { - dev_err(component->dev, "Invalid MCLK source rate %d\n",
sound/soc/codecs/cs530x.c static int cs530x_set_sysclk(struct snd_soc_component *component, int clk_id, · line 1111
Quoted 10 lines
sound/soc/codecs/cs530x.c +6
-1- 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 ;
This will break any existing user that sets MCLK won't it? Hopefully they were managing to function, even if the clocks were out of spec.
Re: [PATCH v4 09/11] ASoC: cs530x: Correct MCLK reference frequency values
Quoted 13 lines · Mark Brown
Quoted 12 lines · 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 +4
-3switch (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 ;
Quoted 8 lines
sound/soc/codecs/cs530x.c static int cs530x_set_sysclk(struct snd_soc_component *component, int clk_id, · line 1111
Quoted 5 lines
sound/soc/codecs/cs530x.c +2
-0+default : +dev_err (component->dev,"Invalid MCLK source rate %d\n" , freq);return -EINVAL ; }break ;This will break any existing user that sets MCLK won't it? Hopefully they were managing to function, even if the clocks were out of spec.
Hopefully, there are no existing users yet. This was used only on our development board, and we’d like to fix it proactively before any users encounter issues.
PATCH v4 10/11 ASoC: cs530x: Rename i2c related structures
In reply to Vitaly RodionovFrom: 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
@@ -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
@@ -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
@@ -220,7 +220,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
PATCH v4 11/11 ASoC: cs530x: Add SPI bus support for cs530x parts
In reply to Vitaly RodionovCirrus 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
@@ -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
@@ -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
@@ -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
@@ -221,6 +221,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
Mark Brown
maintainerRe: [PATCH v4 11/11] ASoC: cs530x: Add SPI bus support for cs530x parts
Quoted 2 lines · Vitaly Rodionov
Cirrus Logic cs530x device family has 2 control buses I2C and SPI. This patch adds SPI support.
Don't we need a bindings update to reflect the SPI support? Your bindings patch only added new device IDs.
Mark Brown
maintainerRe: (subset) [PATCH v4 00/11] Add support for Cirrus Logic CS530x DAC and CODEC variants.
In reply to Vitaly RodionovQuoted 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/11] ASoC: cs530x: Correct log message with expected variable
commit: 248adfe32bfd75afbcb8f6d4b68f7e0a9fb2c438
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