ASoC: cs35l56: Remove obsolete and redundant code
Subsystems (3)
Richard Fitzgerald
maintainercover ASoC: cs35l56: Remove obsolete and redundant code
These commits remove various code that is either no longer needed, or is redundant.
Richard Fitzgerald (3):
ASoC: cs35l56: Revert support for dual-ownership of ASP registers
ASoC: cs35l56: Remove support for A1 silicon
ASoC: cs35l56: Remove redundant clearing of clk_stop_mode1
include/sound/cs35l56.h | 11 +- sound/soc/codecs/cs35l56-sdw.c | 75 ----------- sound/soc/codecs/cs35l56-shared.c | 122 ++++-------------- sound/soc/codecs/cs35l56.c | 205 ++---------------------------- sound/soc/codecs/cs35l56.h | 2 - 5 files changed, 45 insertions(+), 370 deletions(-)
Signature · 1 line
2.39.2
Richard Fitzgerald
maintainerPATCH 1/3 ASoC: cs35l56: Revert support for dual-ownership of ASP registers
This patch reverts a series of commits that allowed for the ASP registers to be owned by either the driver or the firmware. Nothing currently depends on the functionality that is being reverted, so it is safe to remove.
The commits being reverted are (last 3 are bugfixes to the first 2):
commit 72a77d7631c6
("ASoC: cs35l56: Fix to ensure ASP1 registers match cache") commit 07f7d6e7a124
("ASoC: cs35l56: Fix for initializing ASP1 mixer registers") commit 4703b014f28b
("ASoC: cs35l56: fix reversed if statement in cs35l56_dspwait_asp1tx_put()") commit c14f09f010cc
("ASoC: cs35l56: Fix deadlock in ASP1 mixer register initialization") commit dfd2ffb37399
("ASoC: cs35l56: Prevent overwriting firmware ASP config")
These reverts have been squashed into a single commit because there would be no reason to revert only some of them (which would just reintroduce bugs).
The changes introduced by the commits were well-intentioned but somewhat misguided. ACPI does not provide any information about how audio hardware is linked together, so that information has to be hardcoded into drivers. On Windows the firmware is customized to statically setup appropriate configuration of the audio links, and the intent of the commits was to re-use this information if the Linux host drivers aren't taking control of the ASP. This would avoid having to hardcode the ASP config into the machine driver on some systems.
However, this added complexity and race conditions into the driver. It also complicates implementation of new code.
The only case where the ASP is used but the host is not taking ownership is when CS35L56 is used in SoundWire mode with the ASP as a reference audio interconnect. But even in that case it's not necessarily required even if the firmware initialized it. Typically it is used to avoid the host SDCA drivers having to be capable of aggregating capture paths from multiple SoundWire peripherals. But the SOF SoundWire support is capable of doing that aggregation.
Reverting all these commits significantly simplifies the driver. Let's just use the normal Linux mechanisms of the machine driver and ALSA controls to set things up instead of trying to use the firmware to do use-case setup.
--- include/sound/cs35l56.h | 9 +- sound/soc/codecs/cs35l56-shared.c | 101 ++++----------- sound/soc/codecs/cs35l56.c | 205 ++---------------------------- sound/soc/codecs/cs35l56.h | 1 - 4 files changed, 43 insertions(+), 273 deletions(-)
include/sound/cs35l56.h +6 -3
@@ -267,13 +267,18 @@ struct cs35l56_base {bool fw_patched;bool secured;bool can_hibernate; -bool fw_owns_asp1;bool cal_data_valid;s8 cal_index;struct cirrus_amp_cal_data cal_data;struct gpio_desc *reset_gpio; }; +/* Temporary to avoid a build break with the HDA driver */ +static inline int cs35l56_force_sync_asp1_registers_from_cache (struct cs35l56_base *cs35l56_base) +{ +return 0 ; +} +extern struct regmap_config cs35l56_regmap_i2c;extern struct regmap_config cs35l56_regmap_spi;extern struct regmap_config cs35l56_regmap_sdw;
@@ -284,8 +289,6 @@ extern const char * const cs35l56_tx_input_texts[CS35L56_NUM_INPUT_SRC];extern const unsigned int cs35l56_tx_input_values[CS35L56_NUM_INPUT_SRC ];int cs35l56_set_patch (struct cs35l56_base *cs35l56_base); -int cs35l56_init_asp1_regs_for_driver_control (struct cs35l56_base *cs35l56_base); -int cs35l56_force_sync_asp1_registers_from_cache (struct cs35l56_base *cs35l56_base);int cs35l56_mbox_send (struct cs35l56_base *cs35l56_base,unsigned int command);int cs35l56_firmware_shutdown (struct cs35l56_base *cs35l56_base);int cs35l56_wait_for_firmware_boot (struct cs35l56_base *cs35l56_base);
sound/soc/codecs/cs35l56-shared.c +24 -77
119 lines not on this page · raw message
sound/soc/codecs/cs35l56.c +13 -192
296 lines not on this page · raw message
sound/soc/codecs/cs35l56.h +0 -1
@@ -51,7 +51,6 @@ struct cs35l56_private {u8 asp_slot_count;bool tdm_mode;bool sysclk_set; -bool asp1_mixer_widgets_initialized;u8 old_sdw_clock_scale; };
Signature · 1 line
2.39.2
Richard Fitzgerald
maintainerPATCH 2/3 ASoC: cs35l56: Remove support for A1 silicon
In reply to Richard FitzgeraldNo product was ever released with A1 silicon so there is no need for the driver to include support for it.
--- include/sound/cs35l56.h | 2 - sound/soc/codecs/cs35l56-sdw.c | 74 ------------------------------- sound/soc/codecs/cs35l56-shared.c | 21 +-------- sound/soc/codecs/cs35l56.h | 1 - 4 files changed, 2 insertions(+), 96 deletions(-)
include/sound/cs35l56.h +0 -2
@@ -80,9 +80,7 @@#define CS35L56_DSP1_AHBM_WINDOW_DEBUG_1 0x25E2044#define CS35L56_DSP1_XMEM_UNPACKED24_0 0x2800000#define CS35L56_DSP1_FW_VER 0x2800010 -#define CS35L56_DSP1_HALO_STATE_A1 0x2801E58#define CS35L56_DSP1_HALO_STATE 0x28021E0 -#define CS35L56_DSP1_PM_CUR_STATE_A1 0x2804000#define CS35L56_DSP1_PM_CUR_STATE 0x2804308#define CS35L56_DSP1_XMEM_UNPACKED24_8191 0x2807FFC#define CS35L56_DSP1_CORE_BASE 0x2B80000
sound/soc/codecs/cs35l56-sdw.c +0 -74
86 lines not on this page · raw message
sound/soc/codecs/cs35l56-shared.c +2 -19
@@ -245,19 +245,13 @@ EXPORT_SYMBOL_NS_GPL(cs35l56_mbox_send, SND_SOC_CS35L56_SHARED);int cs35l56_firmware_shutdown (struct cs35l56_base *cs35l56_base) {int ret; -unsigned int reg;unsigned int val; ret =cs35l56_mbox_send (cs35l56_base,CS35L56_MBOX_CMD_SHUTDOWN );if (ret)return ret; -if (cs35l56_base->rev <CS35L56_REVID_B0 ) - reg =CS35L56_DSP1_PM_CUR_STATE_A1 ; -else - reg =CS35L56_DSP1_PM_CUR_STATE ; - - ret =regmap_read_poll_timeout (cs35l56_base->regmap, reg, + ret =regmap_read_poll_timeout (cs35l56_base->regmap,CS35L56_DSP1_PM_CUR_STATE , val, (val ==CS35L56_HALO_STATE_SHUTDOWN ),CS35L56_HALO_STATE_POLL_US ,CS35L56_HALO_STATE_TIMEOUT_US );
@@ -270,15 +264,9 @@ EXPORT_SYMBOL_NS_GPL(cs35l56_firmware_shutdown, SND_SOC_CS35L56_SHARED);int cs35l56_wait_for_firmware_boot (struct cs35l56_base *cs35l56_base) { -unsigned int reg;unsigned int val =0 ;int read_ret, poll_ret; -if (cs35l56_base->rev <CS35L56_REVID_B0 ) - reg =CS35L56_DSP1_HALO_STATE_A1 ; -else - reg =CS35L56_DSP1_HALO_STATE ; -/* * The regmap must remain in cache-only until the chip has * booted, so use a bypassed read of the status register.
@@ -288,7 +276,7 @@ int cs35l56_wait_for_firmware_boot(struct cs35l56_base *cs35l56_base)CS35L56_HALO_STATE_POLL_US ,CS35L56_HALO_STATE_TIMEOUT_US , false, - cs35l56_base->regmap, reg, &val); + cs35l56_base->regmap, CS35L56_DSP1_HALO_STATE, &val);if (poll_ret) { dev_err(cs35l56_base->dev, "Firmware boot timed out(%d): HALO_STATE=%#x\n",
@@ -726,11 +714,6 @@ int cs35l56_hw_init(struct cs35l56_base *cs35l56_base)else cs35l56_wait_control_port_ready (); -/* -* The HALO_STATE register is in different locations on Ax and B0 -* devices so the REVID needs to be determined before waiting for the -* firmware to boot. -*/ ret =regmap_read_bypassed (cs35l56_base->regmap,CS35L56_REVID , &revid);if (ret <0 ) {dev_err (cs35l56_base->dev,"Get Revision ID failed\n" );
sound/soc/codecs/cs35l56.h +0 -1
@@ -51,7 +51,6 @@ 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.39.2
Richard Fitzgerald
maintainerPATCH 3/3 ASoC: cs35l56: Remove redundant clearing of clk_stop_mode1
In reply to Richard Fitzgeraldstruct sdw_slave_prop is zero-initialized by the SoundWire core so there is no need to clear clk_stop_mode1 to false. Removing this also avoids having an unnecessary build dependency on a struct member.
--- sound/soc/codecs/cs35l56-sdw.c | 1 - 1 file changed, 1 deletion(-)
sound/soc/codecs/cs35l56-sdw.c +0 -1
@@ -271,7 +271,6 @@ static int cs35l56_sdw_read_prop(struct sdw_slave *peripheral) prop->source_ports =BIT (CS35L56_SDW1_CAPTURE_PORT ); prop->sink_ports =BIT (CS35L56_SDW1_PLAYBACK_PORT ); prop->paging_support = true; - prop->clk_stop_mode1 = false; prop->quirks =SDW_SLAVE_QUIRKS_INVALID_INITIAL_PARITY ; prop->scp_int1_mask =SDW_SCP_INT1_BUS_CLASH |SDW_SCP_INT1_PARITY |SDW_SCP_INT1_IMPL_DEF ;
Signature · 1 line
2.39.2
Mark Brown
maintainerQuoted 9 lines · Richard Fitzgerald
These commits remove various code that is either no longer needed, or is redundant.
Richard Fitzgerald (3):
ASoC: cs35l56: Revert support for dual-ownership of ASP registers
ASoC: cs35l56: Remove support for A1 silicon
ASoC: cs35l56: Remove redundant clearing ofclk_stop_mode1[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/3] ASoC: cs35l56: Revert support for dual-ownership of ASP registers
commit: 5d7e328e20b3d2bd3e1e8bea7a868ab8892aeed1
[2/3] ASoC: cs35l56: Remove support for A1 silicon
commit: e2996141d6db0d8b353e1c221a37c8e1be109d4a
[3/3] ASoC: cs35l56: Remove redundant clearing of clk_stop_mode1
commit: e5524e3316ac54ca04dde3bfef4565bacf72c594All 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