Add support for CS35L63 Smart Amplifier
Subsystems (3)
PATCH RESEND 1/5 ASoC: cs35l56: Add Index based on ACPI HID or SDW ID to select regmap config
In reply to Stefan BindingThis is to prepare for further products using slightly different regmap configs.
--- sound/soc/codecs/cs35l56-i2c.c | 16 +++++++++++++--- sound/soc/codecs/cs35l56-sdw.c | 16 +++++++++++++--- 2 files changed, 26 insertions(+), 6 deletions(-)
sound/soc/codecs/cs35l56-i2c.c +13 -3
@@ -17,9 +17,10 @@static int cs35l56_i2c_probe (struct i2c_client *client) { +unsigned int id = (u32 )(uintptr_t )i2c_get_match_data (client);struct cs35l56_private *cs35l56;struct device *dev = &client->dev; -const struct regmap_config *regmap_config = &cs35l56_regmap_i2c; +const struct regmap_config *regmap_config;int ret; cs35l56 =devm_kzalloc (dev,sizeof (struct cs35l56_private ),GFP_KERNEL );
@@ -30,6 +31,15 @@ static int cs35l56_i2c_probe(struct i2c_client *client) cs35l56->base.can_hibernate = true;i2c_set_clientdata (client, cs35l56); + +switch (id) { +case 0x3556 : + regmap_config = &cs35l56_regmap_i2c; +break ; +default : +return -ENODEV ; + } + cs35l56->base.regmap =devm_regmap_init_i2c (client, regmap_config);if (IS_ERR (cs35l56->base.regmap)) { ret =PTR_ERR (cs35l56->base.regmap);
@@ -57,14 +67,14 @@ static void cs35l56_i2c_remove(struct i2c_client *client) }static const struct i2c_device_id cs35l56_id_i2c[] = { - {"cs35l56" }, + {"cs35l56" ,0x3556 }, {} };MODULE_DEVICE_TABLE (i2c, cs35l56_id_i2c);#ifdef CONFIG_ACPI static const struct acpi_device_id cs35l56_asoc_acpi_match[] = { - {"CSC355C" ,0 }, + {"CSC355C" ,0x3556 }, {}, };MODULE_DEVICE_TABLE (acpi, cs35l56_asoc_acpi_match);
sound/soc/codecs/cs35l56-sdw.c +13 -3
@@ -509,6 +509,7 @@ static int cs35l56_sdw_probe(struct sdw_slave *peripheral, const struct sdw_devi {struct device *dev = &peripheral->dev;struct cs35l56_private *cs35l56; +const struct regmap_config *regmap_config;int ret; cs35l56 =devm_kzalloc (dev,sizeof (*cs35l56),GFP_KERNEL );
@@ -521,8 +522,17 @@ static int cs35l56_sdw_probe(struct sdw_slave *peripheral, const struct sdw_devidev_set_drvdata (dev, cs35l56); +switch ((unsigned int )id->driver_data) { +case 0x3556 : +case 0x3557 : + regmap_config = &cs35l56_regmap_sdw; +break ; +default : +return -ENODEV ; + } + cs35l56->base.regmap =devm_regmap_init (dev, &cs35l56_regmap_bus_sdw, - peripheral, &cs35l56_regmap_sdw); + peripheral, regmap_config);if (IS_ERR (cs35l56->base.regmap)) { ret =PTR_ERR (cs35l56->base.regmap);return dev_err_probe (dev, ret,"Failed to allocate register map\n" );
@@ -562,8 +572,8 @@ static const struct dev_pm_ops cs35l56_sdw_pm = { };static const struct sdw_device_id cs35l56_sdw_id[] = { -SDW_SLAVE_ENTRY (0x01FA ,0x3556 ,0 ), -SDW_SLAVE_ENTRY (0x01FA ,0x3557 ,0 ), +SDW_SLAVE_ENTRY (0x01FA ,0x3556 ,0x3556 ), +SDW_SLAVE_ENTRY (0x01FA ,0x3557 ,0x3557 ), {}, };MODULE_DEVICE_TABLE (sdw, cs35l56_sdw_id);
Signature · 1 line
2.43.0
PATCH RESEND 3/5 ASoC: cs35l56: Add Mute, Volume and Posture registers to firmware register list
In reply to Stefan BindingRegisters to set Mute, Volume and Posture are inside firmware, which means they should be added to the list of registers set inside firmware, in case they vary across Device or Revision.
These three registers are also used for controls, so additional handling is required to be able to obtain and set the register inside ALSA controls.
--- include/sound/cs35l56.h | 3 +++ sound/pci/hda/cs35l56_hda.c | 17 +++++++---------- sound/soc/codecs/cs35l56-shared.c | 25 ++++++++++++++++++++++++- sound/soc/codecs/cs35l56.c | 19 +++++++++++++++++-- 4 files changed, 51 insertions(+), 13 deletions(-)
include/sound/cs35l56.h +3 -0
@@ -273,6 +273,9 @@ struct cs35l56_fw_reg {unsigned int pm_cur_stat;unsigned int prot_sts;unsigned int transducer_actual_ps; +unsigned int user_mute; +unsigned int user_volume; +unsigned int posture_number; };struct cs35l56_base {
sound/pci/hda/cs35l56_hda.c +7 -10
@@ -237,7 +237,8 @@ static int cs35l56_hda_posture_get(struct snd_kcontrol *kcontrol,cs35l56_hda_wait_dsp_ready (cs35l56); - ret =regmap_read (cs35l56->base.regmap,CS35L56_MAIN_POSTURE_NUMBER , &pos); + ret =regmap_read (cs35l56->base.regmap, + cs35l56->base.fw_reg->posture_number, &pos);if (ret)return ret;
@@ -260,10 +261,8 @@ static int cs35l56_hda_posture_put(struct snd_kcontrol *kcontrol,cs35l56_hda_wait_dsp_ready (cs35l56); - ret =regmap_update_bits_check (cs35l56->base.regmap, -CS35L56_MAIN_POSTURE_NUMBER , -CS35L56_MAIN_POSTURE_MASK , - pos, &changed); + ret =regmap_update_bits_check (cs35l56->base.regmap, cs35l56->base.fw_reg->posture_number, +CS35L56_MAIN_POSTURE_MASK , pos, &changed);if (ret)return ret;
@@ -305,7 +304,7 @@ static int cs35l56_hda_vol_get(struct snd_kcontrol *kcontrol,cs35l56_hda_wait_dsp_ready (cs35l56); - ret =regmap_read (cs35l56->base.regmap,CS35L56_MAIN_RENDER_USER_VOLUME , &raw_vol); + ret =regmap_read (cs35l56->base.regmap, cs35l56->base.fw_reg->user_volume, &raw_vol);if (ret)return ret;
@@ -339,10 +338,8 @@ static int cs35l56_hda_vol_put(struct snd_kcontrol *kcontrol,cs35l56_hda_wait_dsp_ready (cs35l56); - ret =regmap_update_bits_check (cs35l56->base.regmap, -CS35L56_MAIN_RENDER_USER_VOLUME , -CS35L56_MAIN_RENDER_USER_VOLUME_MASK , - raw_vol, &changed); + ret =regmap_update_bits_check (cs35l56->base.regmap, cs35l56->base.fw_reg->user_volume, +CS35L56_MAIN_RENDER_USER_VOLUME_MASK , raw_vol, &changed);if (ret)return ret;
sound/soc/codecs/cs35l56-shared.c +24 -1
@@ -38,7 +38,9 @@ static const struct reg_sequence cs35l56_patch[] = { { CS35L56_SWIRE_DP3_CH3_INPUT, 0x00000029 }, { CS35L56_SWIRE_DP3_CH4_INPUT, 0x00000028 }, { CS35L56_IRQ1_MASK_18, 0x1f7df0ff }, +}; +static const struct reg_sequence cs35l56_patch_fw[] = {/* These are not reset by a soft-reset, so patch to defaults. */ {CS35L56_MAIN_RENDER_USER_MUTE ,0x00000000 }, { CS35L56_MAIN_RENDER_USER_VOLUME, 0x00000000 },
@@ -47,8 +49,26 @@ static const struct reg_sequence cs35l56_patch[] = {int cs35l56_set_patch (struct cs35l56_base *cs35l56_base) { -return regmap_register_patch (cs35l56_base->regmap, cs35l56_patch, +int ret; + + ret =regmap_register_patch (cs35l56_base->regmap, cs35l56_patch,ARRAY_SIZE (cs35l56_patch)); +if (ret) +return ret; + + +switch (cs35l56_base->type) { +case 0x54 : +case 0x56 : +case 0x57 : + ret =regmap_register_patch (cs35l56_base->regmap, cs35l56_patch_fw, +ARRAY_SIZE (cs35l56_patch_fw)); +break ; +default : +break ; + } + +return ret; }EXPORT_SYMBOL_NS_GPL (cs35l56_set_patch,"SND_SOC_CS35L56_SHARED" );
@@ -1066,6 +1086,9 @@ const struct cs35l56_fw_reg cs35l56_fw_reg = { .pm_cur_stat = CS35L56_DSP1_PM_CUR_STATE, .prot_sts = CS35L56_PROTECTION_STATUS, .transducer_actual_ps = CS35L56_TRANSDUCER_ACTUAL_PS, + .user_mute = CS35L56_MAIN_RENDER_USER_MUTE, + .user_volume = CS35L56_MAIN_RENDER_USER_VOLUME, + .posture_number = CS35L56_MAIN_POSTURE_NUMBER, };EXPORT_SYMBOL_NS_GPL (cs35l56_fw_reg,"SND_SOC_CS35L56_SHARED" );
sound/soc/codecs/cs35l56.c +17 -2
@@ -838,6 +838,7 @@ static int cs35l56_component_probe(struct snd_soc_component *component)struct cs35l56_private *cs35l56 =snd_soc_component_get_drvdata (component);struct dentry *debugfs_root = component->debugfs_root;unsigned short vendor, device; +int ret;BUILD_BUG_ON (ARRAY_SIZE (cs35l56_tx_input_texts) !=ARRAY_SIZE (cs35l56_tx_input_values));
@@ -877,6 +878,22 @@ static int cs35l56_component_probe(struct snd_soc_component *component)debugfs_create_bool ("can_hibernate" ,0444 , debugfs_root, &cs35l56->base.can_hibernate);debugfs_create_bool ("fw_patched" ,0444 , debugfs_root, &cs35l56->base.fw_patched); + +switch (cs35l56->base.type) { +case 0x54 : +case 0x56 : +case 0x57 : + ret =snd_soc_add_component_controls (component, cs35l56_controls, +ARRAY_SIZE (cs35l56_controls)); +break ; +default : + ret = -ENODEV ; +break ; + } + +if (ret) +return dev_err_probe (cs35l56->base.dev, ret,"unable to add controls\n" ); +queue_work (cs35l56->dsp_wq, &cs35l56->dsp_work);return 0 ;
@@ -932,8 +949,6 @@ static const struct snd_soc_component_driver soc_component_dev_cs35l56 = { .num_dapm_widgets = ARRAY_SIZE(cs35l56_dapm_widgets), .dapm_routes = cs35l56_audio_map, .num_dapm_routes = ARRAY_SIZE(cs35l56_audio_map), - .controls = cs35l56_controls, - .num_controls = ARRAY_SIZE(cs35l56_controls), .set_bias_level = cs35l56_set_bias_level,
Signature · 1 line
2.43.0
PATCH RESEND 2/5 ASoC: cs35l56: Add struct to index firmware registers
In reply to Stefan BindingFirmware based registers may be different addresses across different device ids and revision ids. Create a structure to store and access these addresses.
--- include/sound/cs35l56.h | 11 ++++++++ sound/pci/hda/cs35l56_hda.c | 5 ++-- sound/pci/hda/cs35l56_hda_i2c.c | 3 +++ sound/pci/hda/cs35l56_hda_spi.c | 3 +++ sound/soc/codecs/cs35l56-i2c.c | 1 + sound/soc/codecs/cs35l56-sdw.c | 1 + sound/soc/codecs/cs35l56-shared.c | 42 ++++++++++++++++++++++++------- sound/soc/codecs/cs35l56-spi.c | 3 +++ sound/soc/codecs/cs35l56.c | 5 ++-- 9 files changed, 61 insertions(+), 13 deletions(-)
include/sound/cs35l56.h +11 -0
@@ -267,6 +267,14 @@ struct cs35l56_spi_payload { } __packed;static_assert (sizeof (struct cs35l56_spi_payload ) ==10 ); +struct cs35l56_fw_reg { +unsigned int fw_ver; +unsigned int halo_state; +unsigned int pm_cur_stat; +unsigned int prot_sts; +unsigned int transducer_actual_ps; +}; +struct cs35l56_base {struct device *dev;struct regmap *regmap;
@@ -283,6 +291,7 @@ struct cs35l56_base {struct cirrus_amp_cal_data cal_data;struct gpio_desc *reset_gpio;struct cs35l56_spi_payload *spi_payload_buf; +const struct cs35l56_fw_reg *fw_reg; };static inline bool cs35l56_is_otp_register (unsigned int reg)
@@ -311,6 +320,8 @@ extern const struct regmap_config cs35l56_regmap_i2c;extern const struct regmap_config cs35l56_regmap_spi;extern const struct regmap_config cs35l56_regmap_sdw; +extern const struct cs35l56_fw_reg cs35l56_fw_reg; +extern const struct cirrus_amp_cal_controls cs35l56_calibration_controls;extern const char *const cs35l56_tx_input_texts[CS35L56_NUM_INPUT_SRC ];
sound/pci/hda/cs35l56_hda.c +3 -2
@@ -68,7 +68,7 @@ static void cs35l56_hda_play(struct cs35l56_hda *cs35l56)if (ret ==0 ) {/* Wait for firmware to enter PS0 power state */ ret =regmap_read_poll_timeout (cs35l56->base.regmap, -CS35L56_TRANSDUCER_ACTUAL_PS , + cs35l56->base.fw_reg->transducer_actual_ps, val, (val ==CS35L56_PS0 ),CS35L56_PS0_POLL_US ,CS35L56_PS0_TIMEOUT_US );
@@ -665,7 +665,8 @@ static void cs35l56_hda_fw_load(struct cs35l56_hda *cs35l56)regcache_sync (cs35l56->base.regmap); -regmap_clear_bits (cs35l56->base.regmap,CS35L56_PROTECTION_STATUS , +regmap_clear_bits (cs35l56->base.regmap, + cs35l56->base.fw_reg->prot_sts,CS35L56_FIRMWARE_MISSING ); cs35l56->base.fw_patched = true;
sound/pci/hda/cs35l56_hda_i2c.c +3 -0
@@ -26,6 +26,9 @@ static int cs35l56_hda_i2c_probe(struct i2c_client *clt)#ifdef CS35L56_WAKE_HOLD_TIME_US cs35l56->base.can_hibernate = true;#endif + + cs35l56->base.fw_reg = &cs35l56_fw_reg; + cs35l56->base.regmap =devm_regmap_init_i2c (clt, &cs35l56_regmap_i2c);if (IS_ERR (cs35l56->base.regmap)) { ret =PTR_ERR (cs35l56->base.regmap);
sound/pci/hda/cs35l56_hda_spi.c +3 -0
@@ -29,6 +29,9 @@ static int cs35l56_hda_spi_probe(struct spi_device *spi)#ifdef CS35L56_WAKE_HOLD_TIME_US cs35l56->base.can_hibernate = true;#endif + + cs35l56->base.fw_reg = &cs35l56_fw_reg; + cs35l56->base.regmap =devm_regmap_init_spi (spi, &cs35l56_regmap_spi);if (IS_ERR (cs35l56->base.regmap)) { ret =PTR_ERR (cs35l56->base.regmap);
sound/soc/codecs/cs35l56-i2c.c +1 -0
@@ -35,6 +35,7 @@ static int cs35l56_i2c_probe(struct i2c_client *client)switch (id) {case 0x3556 : regmap_config = &cs35l56_regmap_i2c; + cs35l56->base.fw_reg = &cs35l56_fw_reg;break ;default :return -ENODEV ;
sound/soc/codecs/cs35l56-sdw.c +1 -0
@@ -526,6 +526,7 @@ static int cs35l56_sdw_probe(struct sdw_slave *peripheral, const struct sdw_devicase 0x3556 :case 0x3557 : regmap_config = &cs35l56_regmap_sdw; + cs35l56->base.fw_reg = &cs35l56_fw_reg;break ;default :return -ENODEV ;
sound/soc/codecs/cs35l56-shared.c +33 -9
90 lines not on this page · raw message
sound/soc/codecs/cs35l56-spi.c +3 -0
@@ -25,6 +25,9 @@ static int cs35l56_spi_probe(struct spi_device *spi)return -ENOMEM ;spi_set_drvdata (spi, cs35l56); + + cs35l56->base.fw_reg = &cs35l56_fw_reg; + cs35l56->base.regmap =devm_regmap_init_spi (spi, regmap_config);if (IS_ERR (cs35l56->base.regmap)) { ret =PTR_ERR (cs35l56->base.regmap);
sound/soc/codecs/cs35l56.c +3 -2
@@ -174,7 +174,7 @@ static int cs35l56_play_event(struct snd_soc_dapm_widget *w,case SND_SOC_DAPM_POST_PMU :/* Wait for firmware to enter PS0 power state */ ret =regmap_read_poll_timeout (cs35l56->base.regmap, -CS35L56_TRANSDUCER_ACTUAL_PS , + cs35l56->base.fw_reg->transducer_actual_ps, val, (val ==CS35L56_PS0 ),CS35L56_PS0_POLL_US ,CS35L56_PS0_TIMEOUT_US );
@@ -760,7 +760,8 @@ static void cs35l56_patch(struct cs35l56_private *cs35l56, bool firmware_missing goto err_unlock; } -regmap_clear_bits (cs35l56->base.regmap,CS35L56_PROTECTION_STATUS , +regmap_clear_bits (cs35l56->base.regmap, + cs35l56->base.fw_reg->prot_sts,CS35L56_FIRMWARE_MISSING ); cs35l56->base.fw_patched = true;
Signature · 1 line
2.43.0
PATCH RESEND 4/5 ASoC: cs35l56: Add initial support for CS35L63 for I2C and SoundWire
In reply to Stefan BindingCS35L63 uses a similar control interface to CS35L56 so support for it can be added into the CS35L56 driver.
New regmap configs have been added to support CS35L63. CS35L63 only has SoundWire and I2C control interfaces.
--- include/sound/cs35l56.h | 12 +++ sound/soc/codecs/cs35l56-i2c.c | 6 ++ sound/soc/codecs/cs35l56-sdw.c | 74 ++++++++++++++++++ sound/soc/codecs/cs35l56-shared.c | 123 +++++++++++++++++++++++++++++- sound/soc/codecs/cs35l56.c | 23 ++++++ sound/soc/codecs/cs35l56.h | 1 + 6 files changed, 237 insertions(+), 2 deletions(-)
include/sound/cs35l56.h +12 -0
@@ -104,6 +104,15 @@#define CS35L56_DSP1_PMEM_0 0x3800000#define CS35L56_DSP1_PMEM_5114 0x3804FE8 +#define CS35L63_DSP1_FW_VER CS35L56_DSP1_FW_VER +#define CS35L63_DSP1_HALO_STATE 0x280396C +#define CS35L63_DSP1_PM_CUR_STATE 0x28042C8 +#define CS35L63_PROTECTION_STATUS 0x340009C +#define CS35L63_TRANSDUCER_ACTUAL_PS 0x34000F4 +#define CS35L63_MAIN_RENDER_USER_MUTE 0x3400020 +#define CS35L63_MAIN_RENDER_USER_VOLUME 0x3400028 +#define CS35L63_MAIN_POSTURE_NUMBER 0x3400068 +/* DEVID */ #define CS35L56_DEVID_MASK 0x00FFFFFF
@@ -322,8 +331,11 @@ static inline bool cs35l56_is_spi(struct cs35l56_base *cs35l56)extern const struct regmap_config cs35l56_regmap_i2c;extern const struct regmap_config cs35l56_regmap_spi;extern const struct regmap_config cs35l56_regmap_sdw; +extern const struct regmap_config cs35l63_regmap_i2c; +extern const struct regmap_config cs35l63_regmap_sdw;extern const struct cs35l56_fw_reg cs35l56_fw_reg; +extern const struct cs35l56_fw_reg cs35l63_fw_reg;extern const struct cirrus_amp_cal_controls cs35l56_calibration_controls;
sound/soc/codecs/cs35l56-i2c.c +6 -0
@@ -37,6 +37,10 @@ static int cs35l56_i2c_probe(struct i2c_client *client) regmap_config = &cs35l56_regmap_i2c; cs35l56->base.fw_reg = &cs35l56_fw_reg;break ; +case 0x3563 : + regmap_config = &cs35l63_regmap_i2c; + cs35l56->base.fw_reg = &cs35l63_fw_reg; +break ;default :return -ENODEV ; }
@@ -69,6 +73,7 @@ static void cs35l56_i2c_remove(struct i2c_client *client)static const struct i2c_device_id cs35l56_id_i2c[] = { {"cs35l56" ,0x3556 }, + {"cs35l63" ,0x3563 }, {} };MODULE_DEVICE_TABLE (i2c, cs35l56_id_i2c);
@@ -76,6 +81,7 @@ MODULE_DEVICE_TABLE(i2c, cs35l56_id_i2c);#ifdef CONFIG_ACPI static const struct acpi_device_id cs35l56_asoc_acpi_match[] = { {"CSC355C" ,0x3556 }, + {"CSC356C" ,0x3563 }, {}, };MODULE_DEVICE_TABLE (acpi, cs35l56_asoc_acpi_match);
sound/soc/codecs/cs35l56-sdw.c +74 -0
98 lines not on this page · raw message
sound/soc/codecs/cs35l56-shared.c +121 -2
188 lines not on this page · raw message
sound/soc/codecs/cs35l56.c +23 -0
@@ -84,6 +84,25 @@ static const struct snd_kcontrol_new cs35l56_controls[] = { cs35l56_dspwait_get_volsw, cs35l56_dspwait_put_volsw), }; +static const struct snd_kcontrol_new cs35l63_controls[] = { +SOC_SINGLE_EXT ("Speaker Switch" , +CS35L63_MAIN_RENDER_USER_MUTE ,0 ,1 ,1 , + cs35l56_dspwait_get_volsw, cs35l56_dspwait_put_volsw), +SOC_SINGLE_S_EXT_TLV ("Speaker Volume" , +CS35L63_MAIN_RENDER_USER_VOLUME , +CS35L56_MAIN_RENDER_USER_VOLUME_SHIFT , +CS35L56_MAIN_RENDER_USER_VOLUME_MIN , +CS35L56_MAIN_RENDER_USER_VOLUME_MAX , +CS35L56_MAIN_RENDER_USER_VOLUME_SIGNBIT , +0 , + cs35l56_dspwait_get_volsw, + cs35l56_dspwait_put_volsw, + vol_tlv), +SOC_SINGLE_EXT ("Posture Number" ,CS35L63_MAIN_POSTURE_NUMBER , +0 ,255 ,0 , + cs35l56_dspwait_get_volsw, cs35l56_dspwait_put_volsw), +}; + static SOC_VALUE_ENUM_SINGLE_DECL(cs35l56_asp1tx1_enum, CS35L56_ASP1TX1_INPUT, 0, CS35L56_ASP_TXn_SRC_MASK,
@@ -886,6 +905,10 @@ static int cs35l56_component_probe(struct snd_soc_component *component) ret =snd_soc_add_component_controls (component, cs35l56_controls,ARRAY_SIZE (cs35l56_controls));break ; +case 0x63 : + ret =snd_soc_add_component_controls (component, cs35l63_controls, +ARRAY_SIZE (cs35l63_controls)); +break ;default : ret = -ENODEV ;break ;
sound/soc/codecs/cs35l56.h +1 -0
@@ -51,6 +51,7 @@ struct cs35l56_private {u8 asp_slot_count;bool tdm_mode;bool sysclk_set; +u8 old_sdw_clock_scale; };extern const struct dev_pm_ops cs35l56_pm_ops_i2c_spi;
Signature · 1 line
2.43.0
cover Add support for CS35L63 Smart Amplifier
CS35L63 is a Mono Class-D PC Smart Amplifier, with Speaker Protection and Audio Enhancement Algorithms.
CS35L63 uses a similar control interface to CS35L56 so support for it can be added into the CS35L56 driver.
CS35L63 only has SoundWire and I2C control interfaces.
Stefan Binding (5):
ASoC: cs35l56: Add Index based on ACPI HID or SDW ID to select regmap
config
ASoC: cs35l56: Add struct to index firmware registers
ASoC: cs35l56: Add Mute, Volume and Posture registers to firmware
register list
ASoC: cs35l56: Add initial support for CS35L63 for I2C and SoundWire
ASoC: cs35l56: Read Silicon ID from DIE_STS registers for CS35L63
include/sound/cs35l56.h | 28 ++++ sound/pci/hda/cs35l56_hda.c | 22 ++- sound/pci/hda/cs35l56_hda_i2c.c | 3 + sound/pci/hda/cs35l56_hda_spi.c | 3 + sound/soc/codecs/cs35l56-i2c.c | 23 ++- sound/soc/codecs/cs35l56-sdw.c | 91 +++++++++++- sound/soc/codecs/cs35l56-shared.c | 229 ++++++++++++++++++++++++++++-- sound/soc/codecs/cs35l56-spi.c | 3 + sound/soc/codecs/cs35l56.c | 47 +++++- sound/soc/codecs/cs35l56.h | 1 + 10 files changed, 413 insertions(+), 37 deletions(-)
Signature · 1 line
2.43.0
PATCH RESEND 5/5 ASoC: cs35l56: Read Silicon ID from DIE_STS registers for CS35L63
On CS35L63 the DIE_STS registers are populated by the Firmware from OTP, so the driver can read these registers directly, rather than obtaining them from OTP.
--- include/sound/cs35l56.h | 2 ++ sound/soc/codecs/cs35l56-shared.c | 39 ++++++++++++++++++++++++++++--- 2 files changed, 38 insertions(+), 3 deletions(-)
include/sound/cs35l56.h +2 -0
@@ -71,6 +71,8 @@#define CS35L56_DSP_VIRTUAL1_MBOX_6 0x0011034#define CS35L56_DSP_VIRTUAL1_MBOX_7 0x0011038#define CS35L56_DSP_VIRTUAL1_MBOX_8 0x001103C +#define CS35L56_DIE_STS1 0x0017040 +#define CS35L56_DIE_STS2 0x0017044#define CS35L56_DSP_RESTRICT_STS1 0x00190F0#define CS35L56_DSP1_XMEM_PACKED_0 0x2000000#define CS35L56_DSP1_XMEM_PACKED_6143 0x2005FFC
sound/soc/codecs/cs35l56-shared.c +36 -3
@@ -214,6 +214,8 @@ static bool cs35l56_readable_reg(struct device *dev, unsigned int reg)case CS35L56_DSP_VIRTUAL1_MBOX_6 :case CS35L56_DSP_VIRTUAL1_MBOX_7 :case CS35L56_DSP_VIRTUAL1_MBOX_8 : +case CS35L56_DIE_STS1 : +case CS35L56_DIE_STS2 :case CS35L56_DSP_RESTRICT_STS1 : case CS35L56_DSP1_SYS_INFO_ID ... CS35L56_DSP1_SYS_INFO_END:case CS35L56_DSP1_AHBM_WINDOW_DEBUG_0 :
@@ -802,13 +804,29 @@ static int cs35l56_read_silicon_uid(struct cs35l56_base *cs35l56_base, u64 *uid) unique_id |= (u32 )pte.x | ((u32 )pte.y <<8 ) | ((u32 )pte.wafer_id <<16 ) | ((u32 )pte.dvs <<24 ); -dev_dbg (cs35l56_base->dev,"UniqueID = %#llx\n" , unique_id); - *uid = unique_id;return 0 ; } +static int cs35l63_read_silicon_uid (struct cs35l56_base *cs35l56_base,u64 *uid) +{ +u32 tmp[2 ]; +int ret; + + ret =regmap_bulk_read (cs35l56_base->regmap,CS35L56_DIE_STS1 , tmp,ARRAY_SIZE (tmp)); +if (ret) { +dev_err (cs35l56_base->dev,"Cannot obtain CS35L56_DIE_STS: %d\n" , ret); +return ret; + } + + *uid = tmp[1 ]; + *uid <<=32 ; + *uid |= tmp[0 ]; + +return 0 ; +} +/* Firmware calibration controls */ const struct cirrus_amp_cal_controls cs35l56_calibration_controls = { .alg_id =0x9f210 ,
@@ -829,10 +847,25 @@ int cs35l56_get_calibration(struct cs35l56_base *cs35l56_base)if (cs35l56_base->secured)return 0 ; - ret =cs35l56_read_silicon_uid (cs35l56_base, &silicon_uid); +switch (cs35l56_base->type) { +case 0x54 : +case 0x56 : +case 0x57 : + ret =cs35l56_read_silicon_uid (cs35l56_base, &silicon_uid); +break ; +case 0x63 : + ret =cs35l63_read_silicon_uid (cs35l56_base, &silicon_uid); +break ; +default : + ret = -ENODEV ; +break ; + } +if (ret <0 )return ret; +dev_dbg (cs35l56_base->dev,"UniqueID = %#llx\n" , silicon_uid); + ret =cs_amp_get_efi_calibration_data (cs35l56_base->dev, silicon_uid, cs35l56_base->cal_index, &cs35l56_base->cal_data);
Signature · 1 line
2.43.0
Mark Brown
maintainerQuoted 6 lines · Stefan Binding
CS35L63 is a Mono Class-D PC Smart Amplifier, with Speaker Protection and Audio Enhancement Algorithms.
CS35L63 uses a similar control interface to CS35L56 so support for it can be added into the CS35L56 driver.
CS35L63 only has SoundWire and I2C control interfaces.
Please don't resend things when people have added tags, at a bare minimum you should collect the tags.