ALSA: hda: Adding support for CS35L56 on HDA systems
Subsystems (3)
Richard Fitzgerald
maintainerPATCH v3 2/12 ASoC: cs35l56: Make cs35l56_system_reset() code more generic
In reply to Richard FitzgeraldFrom: Simon Trimmer <[email protected]>
The function can be more easily reused in HDA if the tracking of whether a soft reset is being performed and whether the device is connected to a SoundWire bus is moved out of the function.
--- sound/soc/codecs/cs35l56.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
sound/soc/codecs/cs35l56.c +6 -6
@@ -805,10 +805,8 @@ static const struct reg_sequence cs35l56_system_reset_seq[] = { REG_SEQ0(CS35L56_DSP_VIRTUAL1_MBOX_1, CS35L56_MBOX_CMD_SYSTEM_RESET), }; -static void cs35l56_system_reset (struct cs35l56_private *cs35l56) +static void cs35l56_system_reset (struct cs35l56_private *cs35l56,bool is_soundwire) { - cs35l56->soft_resetting = true; -/* * Must enter cache-only first so there can't be any more register * accesses other than the controlled system reset sequence below.
@@ -819,7 +817,7 @@ static void cs35l56_system_reset(struct cs35l56_private *cs35l56) ARRAY_SIZE(cs35l56_system_reset_seq));/* On SoundWire the registers won't be accessible until it re-enumerates. */ -if (cs35l56->sdw_peripheral) +if (is_soundwire)return ;usleep_range (CS35L56_CONTROL_PORT_READY_US ,CS35L56_CONTROL_PORT_READY_US +400 );
@@ -886,7 +884,8 @@ static void cs35l56_patch(struct cs35l56_private *cs35l56)init_completion (&cs35l56->init_completion); -cs35l56_system_reset (cs35l56); + cs35l56->soft_resetting = true; +cs35l56_system_reset (cs35l56, !!cs35l56->sdw_peripheral);if (cs35l56->sdw_peripheral) {/*
@@ -1550,7 +1549,8 @@ int cs35l56_init(struct cs35l56_private *cs35l56)if (!cs35l56->base.reset_gpio) {dev_dbg (cs35l56->base.dev,"No reset gpio: using soft reset\n" ); -cs35l56_system_reset (cs35l56); + cs35l56->soft_resetting = true; +cs35l56_system_reset (cs35l56, !!cs35l56->sdw_peripheral);if (cs35l56->sdw_peripheral) {/* Keep alive while we wait for re-enumeration */ pm_runtime_get_noresume (cs35l56->base.dev);
Signature · 1 line
2.30.2
Richard Fitzgerald
maintainerPATCH v3 12/12 ALSA: hda/cs35l56: Add driver for Cirrus Logic CS35L56 amplifier
In reply to Richard FitzgeraldFrom: Simon Trimmer <[email protected]>
Add a driver for the Cirrus Logic CS35L56 amplifier. This uses the same component binding API as the CS35L41 driver. This is not a standalone HDA device; it provides control of the CS35L56 for systems that use a combination of an HDA codec and CS35L56 amplifiers with audio routed through the HDA codec.
The CS35L56 combines a high-performance mono audio amplifier, Class-H tracking inductive boost converter, Halo Core(TM) DSP and a DC-DC boost converter supporting Class-H tracking.
Control interfaces are I2C or SPI through the standard Linux I2C or SPI bus framework.
Most chip functionality is controlled by on-board ROM firmware that is always running. Firmware patches can be applied by the driver in the form of a .wmfw file (firmware patch) and/or a .bin file (system tuning).
--- sound/pci/hda/Kconfig | 31 + sound/pci/hda/Makefile | 6 + sound/pci/hda/cs35l56_hda.c | 990 ++++++++++++++++++++++++++++++++ sound/pci/hda/cs35l56_hda.h | 48 ++ sound/pci/hda/cs35l56_hda_i2c.c | 69 +++ sound/pci/hda/cs35l56_hda_spi.c | 68 +++ 6 files changed, 1212 insertions(+) create mode 100644 sound/pci/hda/cs35l56_hda.c create mode 100644 sound/pci/hda/cs35l56_hda.h create mode 100644 sound/pci/hda/cs35l56_hda_i2c.c create mode 100644 sound/pci/hda/cs35l56_hda_spi.c
sound/pci/hda/Kconfig +31 -0
@@ -130,6 +130,37 @@ config SND_HDA_SCODEC_CS35L41_SPI comment "Set to Y if you want auto-loading the side codec driver" depends on SND_HDA=y && SND_HDA_SCODEC_CS35L41_SPI=m +config SND_HDA_SCODEC_CS35L56 + tristate + +config SND_HDA_SCODEC_CS35L56_I2C + tristate "Build CS35L56 HD-audio side codec support for I2C Bus" + depends on I2C + depends on ACPI || COMPILE_TEST + depends on SND_SOC + select CS_DSP + select SND_HDA_GENERIC + select SND_SOC_CS35L56_SHARED + select SND_HDA_SCODEC_CS35L56 + select SND_HDA_CS_DSP_CONTROLS + help + Say Y or M here to include CS35L56 amplifier support with + I2C control. + +config SND_HDA_SCODEC_CS35L56_SPI + tristate "Build CS35L56 HD-audio codec support for SPI Bus" + depends on SPI_MASTER + depends on ACPI || COMPILE_TEST + depends on SND_SOC + select CS_DSP + select SND_HDA_GENERIC + select SND_SOC_CS35L56_SHARED + select SND_HDA_SCODEC_CS35L56 + select SND_HDA_CS_DSP_CONTROLS + help + Say Y or M here to include CS35L56 amplifier support with + SPI control. + config SND_HDA_CODEC_REALTEK tristate "Build Realtek HD-audio codec support" select SND_HDA_GENERIC
sound/pci/hda/Makefile +6 -0
@@ -31,6 +31,9 @@ snd-hda-codec-hdmi-objs := patch_hdmi.o hda_eld.o snd-hda-scodec-cs35l41-objs := cs35l41_hda.o snd-hda-scodec-cs35l41-i2c-objs := cs35l41_hda_i2c.o snd-hda-scodec-cs35l41-spi-objs := cs35l41_hda_spi.o +snd-hda-scodec-cs35l56-objs := cs35l56_hda.o +snd-hda-scodec-cs35l56-i2c-objs := cs35l56_hda_i2c.o +snd-hda-scodec-cs35l56-spi-objs := cs35l56_hda_spi.o snd-hda-cs-dsp-ctls-objs := hda_cs_dsp_ctl.o # common driver
@@ -55,6 +58,9 @@ obj-$(CONFIG_SND_HDA_CODEC_HDMI) += snd-hda-codec-hdmi.o obj-$(CONFIG_SND_HDA_SCODEC_CS35L41) += snd-hda-scodec-cs35l41.o obj-$(CONFIG_SND_HDA_SCODEC_CS35L41_I2C) += snd-hda-scodec-cs35l41-i2c.o obj-$(CONFIG_SND_HDA_SCODEC_CS35L41_SPI) += snd-hda-scodec-cs35l41-spi.o +obj-$(CONFIG_SND_HDA_SCODEC_CS35L56) += snd-hda-scodec-cs35l56.o +obj-$(CONFIG_SND_HDA_SCODEC_CS35L56_I2C) += snd-hda-scodec-cs35l56-i2c.o +obj-$(CONFIG_SND_HDA_SCODEC_CS35L56_SPI) += snd-hda-scodec-cs35l56-spi.o obj-$(CONFIG_SND_HDA_CS_DSP_CONTROLS) += snd-hda-cs-dsp-ctls.o # this must be the last entry after codec drivers;
sound/pci/hda/cs35l56_hda.c new file +990 -0
990 lines not on this page · raw message
sound/pci/hda/cs35l56_hda.h new file +48 -0
48 lines not on this page · raw message
sound/pci/hda/cs35l56_hda_i2c.c new file +69 -0
69 lines not on this page · raw message
sound/pci/hda/cs35l56_hda_spi.c new file +68 -0
68 lines not on this page · raw message
Signature · 1 line
2.30.2
Richard Fitzgerald
maintainerv3 cover ALSA: hda: Adding support for CS35L56 on HDA systems
This set of patches adds support for using the CS35L56 boosted smart amplifier on HDA systems. In these systems the CS35L56 audio is routed through a HDA-to-I2S bridge codec.
This doesn't include the changes to the Realtek driver to actually hook up the CS35L56 driver, because we don't yet have the QUIRK IDs to associate it with. But we want to publish the driver now so that it is available for bringing up hardware with the CS35L56.
The first 9 patches are moving code out of the ASoC driver and into the shared library so that it can be shared with the HDA driver.
Patch #10 fixes missing #includes in the HDA headers so that the CS35L56 driver doesn't have to #include headers that it doesn't use.
Finally, #11 and #12 actually add the support for CS35L56 on HDA.
CHANGES SINCE V2
All in patch #12:
- Add __maybe_unused to runtime suspend/resume callbacks to prevent build error if CONFIG_PM is not defined
- Removed __maybe_unused from system suspend/resume functions
- Change i2c .probe_new to .probe
- Removed unnecessary returns in cs35l56_hda_create_controls()
- Change if (ret != 0) to if (ret)
Richard Fitzgerald (4):
ASoC: cs35l56: Move runtime suspend/resume to shared library
ASoC: cs35l56: Move cs_dsp init into shared library
ASoC: cs35l56: Move part of cs35l56_init() to shared library
ALSA: hda: Fix missing header dependencies
Simon Trimmer (8):
ASoC: cs35l56: Move shared data into a common data structure
ASoC: cs35l56: Make cs35l56_system_reset() code more generic
ASoC: cs35l56: Convert utility functions to use common data structure
ASoC: cs35l56: Move utility functions to shared file
ASoC: cs35l56: Make common function for control port wait
ASoC: cs35l56: Make a common function to shutdown the DSP
ALSA: hda: Add mute_hook to hda_component
ALSA: hda/cs35l56: Add driver for Cirrus Logic CS35L56 amplifier
include/sound/cs35l56.h | 29 +- sound/pci/hda/Kconfig | 31 + sound/pci/hda/Makefile | 6 + sound/pci/hda/cs35l56_hda.c | 990 ++++++++++++++++++++++++++++++ sound/pci/hda/cs35l56_hda.h | 48 ++ sound/pci/hda/cs35l56_hda_i2c.c | 69 +++ sound/pci/hda/cs35l56_hda_spi.c | 68 ++ sound/pci/hda/hda_auto_parser.h | 2 + sound/pci/hda/hda_component.h | 1 + sound/pci/hda/hda_generic.h | 3 + sound/soc/codecs/cs35l56-i2c.c | 14 +- sound/soc/codecs/cs35l56-sdw.c | 72 +-- sound/soc/codecs/cs35l56-shared.c | 459 +++++++++++++- sound/soc/codecs/cs35l56-spi.c | 10 +- sound/soc/codecs/cs35l56.c | 648 ++++--------------- sound/soc/codecs/cs35l56.h | 15 +- 16 files changed, 1873 insertions(+), 592 deletions(-) create mode 100644 sound/pci/hda/cs35l56_hda.c create mode 100644 sound/pci/hda/cs35l56_hda.h create mode 100644 sound/pci/hda/cs35l56_hda_i2c.c create mode 100644 sound/pci/hda/cs35l56_hda_spi.c
Signature · 1 line
2.30.2
Richard Fitzgerald
maintainerPATCH v3 8/12 ASoC: cs35l56: Make common function for control port wait
From: Simon Trimmer <[email protected]>
Move the waits for CS35L56_CONTROL_PORT_READY_US into a common function, and also allow a wider range of allowed wait times.
--- include/sound/cs35l56.h | 1 + sound/soc/codecs/cs35l56-shared.c | 16 ++++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-)
include/sound/cs35l56.h +1 -0
@@ -275,6 +275,7 @@ extern const unsigned int cs35l56_tx_input_values[CS35L56_NUM_INPUT_SRC];void cs35l56_reread_firmware_registers (struct cs35l56_base *cs35l56_base);int cs35l56_mbox_send (struct cs35l56_base *cs35l56_base,unsigned int command);int cs35l56_wait_for_firmware_boot (struct cs35l56_base *cs35l56_base); +void cs35l56_wait_control_port_ready (void );void cs35l56_wait_min_reset_pulse (void );void cs35l56_system_reset (struct cs35l56_base *cs35l56_base,bool is_soundwire);int cs35l56_irq_request (struct cs35l56_base *cs35l56_base,int irq);
sound/soc/codecs/cs35l56-shared.c +10 -6
@@ -249,6 +249,13 @@ int cs35l56_wait_for_firmware_boot(struct cs35l56_base *cs35l56_base) }EXPORT_SYMBOL_NS_GPL (cs35l56_wait_for_firmware_boot,SND_SOC_CS35L56_SHARED ); +void cs35l56_wait_control_port_ready (void ) +{ +/* Wait for control port to be ready (datasheet tIRS). */ +usleep_range (CS35L56_CONTROL_PORT_READY_US ,2 *CS35L56_CONTROL_PORT_READY_US ); +} +EXPORT_SYMBOL_NS_GPL (cs35l56_wait_control_port_ready,SND_SOC_CS35L56_SHARED ); +void cs35l56_wait_min_reset_pulse (void ) {/* Satisfy minimum reset pulse width spec */
@@ -275,7 +282,7 @@ void cs35l56_system_reset(struct cs35l56_base *cs35l56_base, bool is_soundwire)if (is_soundwire)return ; -usleep_range (CS35L56_CONTROL_PORT_READY_US ,CS35L56_CONTROL_PORT_READY_US +400 ); +cs35l56_wait_control_port_ready ();regcache_cache_only (cs35l56_base->regmap, false); }EXPORT_SYMBOL_NS_GPL (cs35l56_system_reset,SND_SOC_CS35L56_SHARED );
@@ -486,8 +493,7 @@ int cs35l56_runtime_resume_common(struct cs35l56_base *cs35l56_base, bool is_sou cs35l56_hibernate_wake_seq, ARRAY_SIZE(cs35l56_hibernate_wake_seq)); -usleep_range (CS35L56_CONTROL_PORT_READY_US , -CS35L56_CONTROL_PORT_READY_US +400 ); +cs35l56_wait_control_port_ready (); } out_sync:
@@ -561,9 +567,7 @@ int cs35l56_hw_init(struct cs35l56_base *cs35l56_base)if (!cs35l56_base->reset_gpio)regmap_read (cs35l56_base->regmap,CS35L56_DSP_VIRTUAL1_MBOX_1 , &devid); -/* Wait for control port to be ready (datasheet tIRS). */ -usleep_range (CS35L56_CONTROL_PORT_READY_US , -CS35L56_CONTROL_PORT_READY_US +400 ); +cs35l56_wait_control_port_ready ();/* * The HALO_STATE register is in different locations on Ax and B0
Signature · 1 line
2.30.2
Richard Fitzgerald
maintainerPATCH v3 10/12 ALSA: hda: Fix missing header dependencies
In reply to Richard FitzgeraldAdd #includes of dependencies into hda_auto_parser.h and hda_generic.h
hda_auto_parser.h uses definitions in hda_local.h.
hda_generic.h uses definitions in hda_local.h and hda_auto_parser.h. It also references struct hda_jack_callback, but only as a pointer. This has been forward-declared so hda_jack.h only needs to be included in source that actually uses it.
--- sound/pci/hda/hda_auto_parser.h | 2 ++ sound/pci/hda/hda_generic.h | 3 +++ 2 files changed, 5 insertions(+)
sound/pci/hda/hda_auto_parser.h +2 -0
@@ -8,6 +8,8 @@#ifndef __SOUND_HDA_AUTO_PARSER_H#define __SOUND_HDA_AUTO_PARSER_H +#include "hda_local.h" +/* * Helper for automatic pin configuration */
sound/pci/hda/hda_generic.h +3 -0
@@ -9,6 +9,9 @@#define __SOUND_HDA_GENERIC_H#include <linux/leds.h> +#include "hda_auto_parser.h" + +struct hda_jack_callback ;/* table entry for multi-io paths */ struct hda_multi_io {
Signature · 1 line
2.30.2
Richard Fitzgerald
maintainerPATCH v3 3/12 ASoC: cs35l56: Convert utility functions to use common data structure
In reply to Richard FitzgeraldFrom: Simon Trimmer <[email protected]>
Use the new cs35l56_base struct for utility functions.
--- sound/soc/codecs/cs35l56.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-)
sound/soc/codecs/cs35l56.c +16 -16
@@ -805,14 +805,14 @@ static const struct reg_sequence cs35l56_system_reset_seq[] = { REG_SEQ0(CS35L56_DSP_VIRTUAL1_MBOX_1, CS35L56_MBOX_CMD_SYSTEM_RESET), }; -static void cs35l56_system_reset (struct cs35l56_private *cs35l56,bool is_soundwire) +static void cs35l56_system_reset (struct cs35l56_base *cs35l56_base,bool is_soundwire) {/* * Must enter cache-only first so there can't be any more register * accesses other than the controlled system reset sequence below. */ -regcache_cache_only (cs35l56->base.regmap, true); -regmap_multi_reg_write_bypassed (cs35l56->base.regmap, +regcache_cache_only (cs35l56_base->regmap, true); +regmap_multi_reg_write_bypassed (cs35l56_base->regmap, cs35l56_system_reset_seq,ARRAY_SIZE (cs35l56_system_reset_seq));
@@ -821,7 +821,7 @@ static void cs35l56_system_reset(struct cs35l56_private *cs35l56, bool is_soundwreturn ;usleep_range (CS35L56_CONTROL_PORT_READY_US ,CS35L56_CONTROL_PORT_READY_US +400 ); -regcache_cache_only (cs35l56->base.regmap, false); +regcache_cache_only (cs35l56_base->regmap, false); }static void cs35l56_secure_patch (struct cs35l56_private *cs35l56)
@@ -885,7 +885,7 @@ static void cs35l56_patch(struct cs35l56_private *cs35l56)init_completion (&cs35l56->init_completion); cs35l56->soft_resetting = true; -cs35l56_system_reset (cs35l56, !!cs35l56->sdw_peripheral); +cs35l56_system_reset (&cs35l56->base, !!cs35l56->sdw_peripheral);if (cs35l56->sdw_peripheral) {/*
@@ -1140,20 +1140,20 @@ int cs35l56_runtime_resume_common(struct cs35l56_private *cs35l56) }EXPORT_SYMBOL_NS_GPL (cs35l56_runtime_resume_common,SND_SOC_CS35L56_CORE ); -static int cs35l56_is_fw_reload_needed (struct cs35l56_private *cs35l56) +static int cs35l56_is_fw_reload_needed (struct cs35l56_base *cs35l56_base) {unsigned int val;int ret;/* Nothing to re-patch if we haven't done any patching yet. */ -if (!cs35l56->base.fw_patched) +if (!cs35l56_base->fw_patched)return false;/* * If we have control of RESET we will have asserted it so the firmware * will need re-patching. */ -if (cs35l56->base.reset_gpio) +if (cs35l56_base->reset_gpio)return true;/*
@@ -1161,22 +1161,22 @@ static int cs35l56_is_fw_reload_needed(struct cs35l56_private *cs35l56)* can't be used here to test for memory retention. * Assume that tuning must be re-loaded. */ -if (cs35l56->base.secured) +if (cs35l56_base->secured)return true; - ret =pm_runtime_resume_and_get (cs35l56->base.dev); + ret =pm_runtime_resume_and_get (cs35l56_base->dev);if (ret) { -dev_err (cs35l56->base.dev,"Failed to runtime_get: %d\n" , ret); +dev_err (cs35l56_base->dev,"Failed to runtime_get: %d\n" , ret);return ret; } - ret =regmap_read (cs35l56->base.regmap,CS35L56_PROTECTION_STATUS , &val); + ret =regmap_read (cs35l56_base->regmap,CS35L56_PROTECTION_STATUS , &val);if (ret) -dev_err (cs35l56->base.dev,"Failed to read PROTECTION_STATUS: %d\n" , ret); +dev_err (cs35l56_base->dev,"Failed to read PROTECTION_STATUS: %d\n" , ret);else ret = !!(val &CS35L56_FIRMWARE_MISSING ); -pm_runtime_put_autosuspend (cs35l56->base.dev); +pm_runtime_put_autosuspend (cs35l56_base->dev);return ret; }
@@ -1305,7 +1305,7 @@ int cs35l56_system_resume(struct device *dev)if (!cs35l56->component)return 0 ; - ret =cs35l56_is_fw_reload_needed (cs35l56); + ret =cs35l56_is_fw_reload_needed (&cs35l56->base);dev_dbg (cs35l56->base.dev,"fw_reload_needed: %d\n" , ret);if (ret <1 )return ret;
@@ -1550,7 +1550,7 @@ int cs35l56_init(struct cs35l56_private *cs35l56)if (!cs35l56->base.reset_gpio) {dev_dbg (cs35l56->base.dev,"No reset gpio: using soft reset\n" ); cs35l56->soft_resetting = true; -cs35l56_system_reset (cs35l56, !!cs35l56->sdw_peripheral); +cs35l56_system_reset (&cs35l56->base, !!cs35l56->sdw_peripheral);if (cs35l56->sdw_peripheral) {/* Keep alive while we wait for re-enumeration */ pm_runtime_get_noresume (cs35l56->base.dev);
Signature · 1 line
2.30.2
Richard Fitzgerald
maintainerPATCH v3 11/12 ALSA: hda: Add mute_hook to hda_component
In reply to Richard FitzgeraldFrom: Simon Trimmer <[email protected]>
Add a hook into hda_component to allow the amplifier mute to be controlled by the owning HDA codec driver.
--- sound/pci/hda/hda_component.h | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/hda_component.h +1 -0
@@ -16,4 +16,5 @@ struct hda_component {char name[HDA_MAX_NAME_SIZE ];struct hda_codec *codec;void (*playback_hook)(struct device *dev,int action); +void (*mute_hook)(struct device *dev,bool mute); };
Signature · 1 line
2.30.2
Richard Fitzgerald
maintainerPATCH v3 6/12 ASoC: cs35l56: Move cs_dsp init into shared library
In reply to Richard FitzgeraldMove the code that initialized the struct cs_dsp members into the shared library so that the HDA driver can use it.
--- include/sound/cs35l56.h | 2 +- sound/soc/codecs/cs35l56-shared.c | 18 ++++++++++++++++-- sound/soc/codecs/cs35l56.c | 11 +---------- 3 files changed, 18 insertions(+), 13 deletions(-)
include/sound/cs35l56.h +1 -1
@@ -269,7 +269,6 @@ extern struct regmap_config cs35l56_regmap_i2c;extern struct regmap_config cs35l56_regmap_spi;extern struct regmap_config cs35l56_regmap_sdw; -extern const struct cs_dsp_region cs35l56_dsp1_regions[CS35L56_NUM_DSP_REGIONS ];extern const char *const cs35l56_tx_input_texts[CS35L56_NUM_INPUT_SRC ];extern const unsigned int cs35l56_tx_input_values[CS35L56_NUM_INPUT_SRC ];
@@ -283,6 +282,7 @@ irqreturn_t cs35l56_irq(int irq, void *data);int cs35l56_is_fw_reload_needed (struct cs35l56_base *cs35l56_base);int cs35l56_runtime_suspend_common (struct cs35l56_base *cs35l56_base);int cs35l56_runtime_resume_common (struct cs35l56_base *cs35l56_base,bool is_soundwire); +void cs35l56_init_cs_dsp (struct cs35l56_base *cs35l56_base,struct cs_dsp *cs_dsp);int cs35l56_get_bclk_freq_id (unsigned int freq);void cs35l56_fill_supply_names (struct regulator_bulk_data *data);
sound/soc/codecs/cs35l56-shared.c +16 -2
@@ -526,14 +526,28 @@ int cs35l56_runtime_resume_common(struct cs35l56_base *cs35l56_base, bool is_sou }EXPORT_SYMBOL_NS_GPL (cs35l56_runtime_resume_common,SND_SOC_CS35L56_SHARED ); -const struct cs_dsp_region cs35l56_dsp1_regions[] = { +static const struct cs_dsp_region cs35l56_dsp1_regions[] = { { .type =WMFW_HALO_PM_PACKED , .base =CS35L56_DSP1_PMEM_0 }, { .type =WMFW_HALO_XM_PACKED , .base =CS35L56_DSP1_XMEM_PACKED_0 }, { .type =WMFW_HALO_YM_PACKED , .base =CS35L56_DSP1_YMEM_PACKED_0 }, { .type =WMFW_ADSP2_XM , .base =CS35L56_DSP1_XMEM_UNPACKED24_0 }, { .type =WMFW_ADSP2_YM , .base =CS35L56_DSP1_YMEM_UNPACKED24_0 }, }; -EXPORT_SYMBOL_NS_GPL (cs35l56_dsp1_regions,SND_SOC_CS35L56_SHARED ); + +void cs35l56_init_cs_dsp (struct cs35l56_base *cs35l56_base,struct cs_dsp *cs_dsp) +{ + cs_dsp->num =1 ; + cs_dsp->type =WMFW_HALO ; + cs_dsp->rev =0 ; + cs_dsp->dev = cs35l56_base->dev; + cs_dsp->regmap = cs35l56_base->regmap; + cs_dsp->base =CS35L56_DSP1_CORE_BASE ; + cs_dsp->base_sysinfo =CS35L56_DSP1_SYS_INFO_ID ; + cs_dsp->mem = cs35l56_dsp1_regions; + cs_dsp->num_mems =ARRAY_SIZE (cs35l56_dsp1_regions); + cs_dsp->no_core_startstop = true; +} +EXPORT_SYMBOL_NS_GPL (cs35l56_init_cs_dsp,SND_SOC_CS35L56_SHARED );static const u32 cs35l56_bclk_valid_for_pll_freq_table[] = { [0x0C ] =128000 ,
sound/soc/codecs/cs35l56.c +1 -10
@@ -1019,18 +1019,9 @@ static int cs35l56_dsp_init(struct cs35l56_private *cs35l56)INIT_WORK (&cs35l56->dsp_work, cs35l56_dsp_work); dsp = &cs35l56->dsp; +cs35l56_init_cs_dsp (&cs35l56->base, &dsp->cs_dsp); dsp->part ="cs35l56" ; - dsp->cs_dsp.num =1 ; - dsp->cs_dsp.type =WMFW_HALO ; - dsp->cs_dsp.rev =0 ; dsp->fw =12 ; - dsp->cs_dsp.dev = cs35l56->base.dev; - dsp->cs_dsp.regmap = cs35l56->base.regmap; - dsp->cs_dsp.base =CS35L56_DSP1_CORE_BASE ; - dsp->cs_dsp.base_sysinfo =CS35L56_DSP1_SYS_INFO_ID ; - dsp->cs_dsp.mem = cs35l56_dsp1_regions; - dsp->cs_dsp.num_mems =ARRAY_SIZE (cs35l56_dsp1_regions); - dsp->cs_dsp.no_core_startstop = true; dsp->wmfw_optional = true;dev_dbg (cs35l56->base.dev,"DSP system name: '%s'\n" , dsp->system_name);
Signature · 1 line
2.30.2
Richard Fitzgerald
maintainerPATCH v3 9/12 ASoC: cs35l56: Make a common function to shutdown the DSP
In reply to Richard FitzgeraldFrom: Simon Trimmer <[email protected]>
Move issuing of a CS35L56_MBOX_CMD_SHUTDOWN command and then waiting for the DSP to reach CS35L56_HALO_STATE_SHUTDOWN in the register appropriate for the hardware revision into a common function.
--- include/sound/cs35l56.h | 1 + sound/soc/codecs/cs35l56-shared.c | 26 ++++++++++++++++++++++++++ sound/soc/codecs/cs35l56.c | 17 +---------------- 3 files changed, 28 insertions(+), 16 deletions(-)
include/sound/cs35l56.h +1 -0
@@ -274,6 +274,7 @@ extern const unsigned int cs35l56_tx_input_values[CS35L56_NUM_INPUT_SRC];void cs35l56_reread_firmware_registers (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);void cs35l56_wait_control_port_ready (void );void cs35l56_wait_min_reset_pulse (void );
sound/soc/codecs/cs35l56-shared.c +26 -0
@@ -218,6 +218,32 @@ int cs35l56_mbox_send(struct cs35l56_base *cs35l56_base, unsigned int command) }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, + val, (val ==CS35L56_HALO_STATE_SHUTDOWN ), +CS35L56_HALO_STATE_POLL_US , +CS35L56_HALO_STATE_TIMEOUT_US ); +if (ret <0 ) +dev_err (cs35l56_base->dev,"Failed to poll PM_CUR_STATE to 1 is %d (ret %d)\n" , + val, ret); +return ret; +} +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;
sound/soc/codecs/cs35l56.c +1 -16
@@ -676,8 +676,6 @@ static void cs35l56_secure_patch(struct cs35l56_private *cs35l56)static void cs35l56_patch (struct cs35l56_private *cs35l56) { -unsigned int reg; -unsigned int val;int ret;/*
@@ -694,23 +692,10 @@ static void cs35l56_patch(struct cs35l56_private *cs35l56)flush_work (&cs35l56->sdw_irq_work); } - ret =cs35l56_mbox_send (&cs35l56->base,CS35L56_MBOX_CMD_SHUTDOWN ); + ret =cs35l56_firmware_shutdown (&cs35l56->base);if (ret) goto err; -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, - val, (val ==CS35L56_HALO_STATE_SHUTDOWN ), -CS35L56_HALO_STATE_POLL_US , -CS35L56_HALO_STATE_TIMEOUT_US ); -if (ret <0 ) -dev_err (cs35l56->base.dev,"Failed to poll PM_CUR_STATE to 1 is %d (ret %d)\n" , - val, ret); -/* Use wm_adsp to load and apply the firmware patch and coefficient files */ ret =wm_adsp_power_up (&cs35l56->dsp);if (ret) {
Signature · 1 line
2.30.2
Richard Fitzgerald
maintainerPATCH v3 5/12 ASoC: cs35l56: Move runtime suspend/resume to shared library
In reply to Richard FitzgeraldThe majority of runtime_suspend and runtime_resume handling doesn't have anything specific to the ASoC driver, so can be shared by the HDA driver. Move this code into the shared library.
--- include/sound/cs35l56.h | 2 + sound/soc/codecs/cs35l56-sdw.c | 4 +- sound/soc/codecs/cs35l56-shared.c | 118 +++++++++++++++++++++++++++++ sound/soc/codecs/cs35l56.c | 120 +----------------------------- sound/soc/codecs/cs35l56.h | 2 - 5 files changed, 126 insertions(+), 120 deletions(-)
include/sound/cs35l56.h +2 -0
@@ -281,6 +281,8 @@ void cs35l56_system_reset(struct cs35l56_base *cs35l56_base, bool is_soundwire);int cs35l56_irq_request (struct cs35l56_base *cs35l56_base,int irq);irqreturn_t cs35l56_irq (int irq,void *data);int cs35l56_is_fw_reload_needed (struct cs35l56_base *cs35l56_base); +int cs35l56_runtime_suspend_common (struct cs35l56_base *cs35l56_base); +int cs35l56_runtime_resume_common (struct cs35l56_base *cs35l56_base,bool is_soundwire);int cs35l56_get_bclk_freq_id (unsigned int freq);void cs35l56_fill_supply_names (struct regulator_bulk_data *data);
sound/soc/codecs/cs35l56-sdw.c +2 -2
@@ -424,7 +424,7 @@ static int __maybe_unused cs35l56_sdw_runtime_suspend(struct device *dev)if (!cs35l56->base.init_done)return 0 ; -return cs35l56_runtime_suspend (dev); +return cs35l56_runtime_suspend_common (&cs35l56->base); }static int __maybe_unused cs35l56_sdw_runtime_resume (struct device *dev)
@@ -441,7 +441,7 @@ static int __maybe_unused cs35l56_sdw_runtime_resume(struct device *dev)if (ret <0 )return ret; - ret =cs35l56_runtime_resume_common (cs35l56); + ret =cs35l56_runtime_resume_common (&cs35l56->base, true);if (ret)return ret;
sound/soc/codecs/cs35l56-shared.c +118 -0
124 lines not on this page · raw message
sound/soc/codecs/cs35l56.c +4 -116
143 lines not on this page · raw message
sound/soc/codecs/cs35l56.h +0 -2
@@ -55,8 +55,6 @@ struct cs35l56_private {extern const struct dev_pm_ops cs35l56_pm_ops_i2c_spi; -int cs35l56_runtime_suspend (struct device *dev); -int cs35l56_runtime_resume_common (struct cs35l56_private *cs35l56);int cs35l56_system_suspend (struct device *dev);int cs35l56_system_suspend_late (struct device *dev);int cs35l56_system_suspend_no_irq (struct device *dev);
Signature · 1 line
2.30.2
Richard Fitzgerald
maintainerPATCH v3 4/12 ASoC: cs35l56: Move utility functions to shared file
In reply to Richard FitzgeraldFrom: Simon Trimmer <[email protected]>
Move the cs35l56 utility functions into the shared file so they are available for use in HDA.
--- include/sound/cs35l56.h | 7 + sound/soc/codecs/cs35l56-shared.c | 208 ++++++++++++++++++++++++++++++ sound/soc/codecs/cs35l56.c | 203 ----------------------------- 3 files changed, 215 insertions(+), 203 deletions(-)
include/sound/cs35l56.h +7 -0
@@ -274,6 +274,13 @@ extern const char * const cs35l56_tx_input_texts[CS35L56_NUM_INPUT_SRC];extern const unsigned int cs35l56_tx_input_values[CS35L56_NUM_INPUT_SRC ];void cs35l56_reread_firmware_registers (struct cs35l56_base *cs35l56_base); +int cs35l56_mbox_send (struct cs35l56_base *cs35l56_base,unsigned int command); +int cs35l56_wait_for_firmware_boot (struct cs35l56_base *cs35l56_base); +void cs35l56_wait_min_reset_pulse (void ); +void cs35l56_system_reset (struct cs35l56_base *cs35l56_base,bool is_soundwire); +int cs35l56_irq_request (struct cs35l56_base *cs35l56_base,int irq); +irqreturn_t cs35l56_irq (int irq,void *data); +int cs35l56_is_fw_reload_needed (struct cs35l56_base *cs35l56_base);int cs35l56_get_bclk_freq_id (unsigned int freq);void cs35l56_fill_supply_names (struct regulator_bulk_data *data);
sound/soc/codecs/cs35l56-shared.c +208 -0
214 lines not on this page · raw message
sound/soc/codecs/cs35l56.c +0 -203
227 lines not on this page · raw message
Signature · 1 line
2.30.2
Richard Fitzgerald
maintainerPATCH v3 7/12 ASoC: cs35l56: Move part of cs35l56_init() to shared library
In reply to Richard FitzgeraldPart of the initialization code in cs35l56_init() can be re-used by the HDA driver so move it into a new function in the shared library.
--- include/sound/cs35l56.h | 1 + sound/soc/codecs/cs35l56-shared.c | 79 +++++++++++++++++++++++++++++++ sound/soc/codecs/cs35l56.c | 71 +-------------------------- 3 files changed, 82 insertions(+), 69 deletions(-)
include/sound/cs35l56.h +1 -0
@@ -283,6 +283,7 @@ int cs35l56_is_fw_reload_needed(struct cs35l56_base *cs35l56_base);int cs35l56_runtime_suspend_common (struct cs35l56_base *cs35l56_base);int cs35l56_runtime_resume_common (struct cs35l56_base *cs35l56_base,bool is_soundwire);void cs35l56_init_cs_dsp (struct cs35l56_base *cs35l56_base,struct cs_dsp *cs_dsp); +int cs35l56_hw_init (struct cs35l56_base *cs35l56_base);int cs35l56_get_bclk_freq_id (unsigned int freq);void cs35l56_fill_supply_names (struct regulator_bulk_data *data);
sound/soc/codecs/cs35l56-shared.c +79 -0
85 lines not on this page · raw message
sound/soc/codecs/cs35l56.c +2 -69
90 lines not on this page · raw message
Signature · 1 line
2.30.2
Richard Fitzgerald
maintainerPATCH v3 1/12 ASoC: cs35l56: Move shared data into a common data structure
In reply to Richard FitzgeraldFrom: Simon Trimmer <[email protected]>
The ASoC and HDA drivers have structures that contain some of the same information - instead of maintaining two locations for this data the drivers should share a common data structure as this will enable common utility functions to be created.
The first step is to move the location of these members in the ASoC driver.
---
This is identical to V1 except that the 1-line fix for cs35l56_sdw_interrupt() has been squashed in. So I've included Mark's ack that was conditional on that squash.
--- include/sound/cs35l56.h | 15 +- sound/soc/codecs/cs35l56-i2c.c | 14 +- sound/soc/codecs/cs35l56-sdw.c | 68 ++--- sound/soc/codecs/cs35l56-shared.c | 6 +- sound/soc/codecs/cs35l56-spi.c | 10 +- sound/soc/codecs/cs35l56.c | 404 +++++++++++++++--------------- sound/soc/codecs/cs35l56.h | 13 +- 7 files changed, 270 insertions(+), 260 deletions(-)
include/sound/cs35l56.h +14 -1
@@ -252,6 +252,19 @@#define CS35L56_NUM_BULK_SUPPLIES 3#define CS35L56_NUM_DSP_REGIONS 5 +struct cs35l56_base { +struct device *dev; +struct regmap *regmap; +int irq; +struct mutex irq_lock; +u8 rev; +bool init_done; +bool fw_patched; +bool secured; +bool can_hibernate; +struct gpio_desc *reset_gpio; +}; +extern struct regmap_config cs35l56_regmap_i2c;extern struct regmap_config cs35l56_regmap_spi;extern struct regmap_config cs35l56_regmap_sdw;
@@ -260,7 +273,7 @@ extern const struct cs_dsp_region cs35l56_dsp1_regions[CS35L56_NUM_DSP_REGIONS];extern const char *const cs35l56_tx_input_texts[CS35L56_NUM_INPUT_SRC ];extern const unsigned int cs35l56_tx_input_values[CS35L56_NUM_INPUT_SRC ]; -void cs35l56_reread_firmware_registers (struct device *dev,struct regmap *regmap); +void cs35l56_reread_firmware_registers (struct cs35l56_base *cs35l56_base);int cs35l56_get_bclk_freq_id (unsigned int freq);void cs35l56_fill_supply_names (struct regulator_bulk_data *data);
sound/soc/codecs/cs35l56-i2c.c +7 -7
@@ -26,14 +26,14 @@ static int cs35l56_i2c_probe(struct i2c_client *client)if (!cs35l56)return -ENOMEM ; - cs35l56->dev = dev; - cs35l56->can_hibernate = true; + cs35l56->base.dev = dev; + cs35l56->base.can_hibernate = true;i2c_set_clientdata (client, cs35l56); - cs35l56->regmap =devm_regmap_init_i2c (client, regmap_config); -if (IS_ERR (cs35l56->regmap)) { - ret =PTR_ERR (cs35l56->regmap); -return dev_err_probe (cs35l56->dev, ret,"Failed to allocate register map\n" ); + cs35l56->base.regmap =devm_regmap_init_i2c (client, regmap_config); +if (IS_ERR (cs35l56->base.regmap)) { + ret =PTR_ERR (cs35l56->base.regmap); +return dev_err_probe (cs35l56->base.dev, ret,"Failed to allocate register map\n" ); } ret =cs35l56_common_probe (cs35l56);
@@ -42,7 +42,7 @@ static int cs35l56_i2c_probe(struct i2c_client *client) ret =cs35l56_init (cs35l56);if (ret ==0 ) - ret =cs35l56_irq_request (cs35l56, client->irq); + ret =cs35l56_irq_request (&cs35l56->base, client->irq);if (ret <0 )cs35l56_remove (cs35l56);
sound/soc/codecs/cs35l56-sdw.c +35 -33
221 lines not on this page · raw message
sound/soc/codecs/cs35l56-shared.c +3 -3
@@ -187,14 +187,14 @@ static const u32 cs35l56_firmware_registers[] = { CS35L56_MAIN_POSTURE_NUMBER, }; -void cs35l56_reread_firmware_registers (struct device *dev,struct regmap *regmap) +void cs35l56_reread_firmware_registers (struct cs35l56_base *cs35l56_base) {int i;unsigned int val;for (i =0 ; i <ARRAY_SIZE (cs35l56_firmware_registers); i++) { -regmap_read (regmap, cs35l56_firmware_registers[i], &val); -dev_dbg (dev,"%s: %d: %#x: %#x\n" , __func__, +regmap_read (cs35l56_base->regmap, cs35l56_firmware_registers[i], &val); +dev_dbg (cs35l56_base->dev,"%s: %d: %#x: %#x\n" , __func__, i, cs35l56_firmware_registers[i], val); } }
sound/soc/codecs/cs35l56-spi.c +5 -5
@@ -25,13 +25,13 @@ static int cs35l56_spi_probe(struct spi_device *spi)return -ENOMEM ;spi_set_drvdata (spi, cs35l56); - cs35l56->regmap =devm_regmap_init_spi (spi, regmap_config); -if (IS_ERR (cs35l56->regmap)) { - ret =PTR_ERR (cs35l56->regmap); + cs35l56->base.regmap =devm_regmap_init_spi (spi, regmap_config); +if (IS_ERR (cs35l56->base.regmap)) { + ret =PTR_ERR (cs35l56->base.regmap);return dev_err_probe (&spi->dev, ret,"Failed to allocate register map\n" ); } - cs35l56->dev = &spi->dev; + cs35l56->base.dev = &spi->dev; ret =cs35l56_common_probe (cs35l56);if (ret !=0 )
@@ -39,7 +39,7 @@ static int cs35l56_spi_probe(struct spi_device *spi) ret =cs35l56_init (cs35l56);if (ret ==0 ) - ret =cs35l56_irq_request (cs35l56, spi->irq); + ret =cs35l56_irq_request (&cs35l56->base, spi->irq);if (ret <0 )cs35l56_remove (cs35l56);
sound/soc/codecs/cs35l56.c +204 -200
1,035 lines not on this page · raw message
sound/soc/codecs/cs35l56.h +2 -11
@@ -32,26 +32,17 @@ struct sdw_slave;struct cs35l56_private {struct wm_adsp dsp;/* must be first member */ +struct cs35l56_base base;struct work_struct dsp_work;struct workqueue_struct *dsp_wq; -struct mutex irq_lock;struct snd_soc_component *component; -struct device *dev; -struct regmap *regmap;struct regulator_bulk_data supplies[CS35L56_NUM_BULK_SUPPLIES ]; -int irq;struct sdw_slave *sdw_peripheral; -u8 rev;struct work_struct sdw_irq_work; -bool secured;bool sdw_irq_no_unmask;bool soft_resetting; -bool init_done;bool sdw_attached; -bool fw_patched; -bool can_hibernate;struct completion init_completion; -struct gpio_desc *reset_gpio;u32 rx_mask;u32 tx_mask;
@@ -73,7 +64,7 @@ int cs35l56_system_resume_no_irq(struct device *dev);int cs35l56_system_resume_early (struct device *dev);int cs35l56_system_resume (struct device *dev);irqreturn_t cs35l56_irq (int irq,void *data); -int cs35l56_irq_request (struct cs35l56_private *cs35l56,int irq); +int cs35l56_irq_request (struct cs35l56_base *cs35l56_base,int irq);int cs35l56_common_probe (struct cs35l56_private *cs35l56);int cs35l56_init (struct cs35l56_private *cs35l56);void cs35l56_remove (struct cs35l56_private *cs35l56);
Signature · 1 line
2.30.2
Re: [PATCH v3 12/12] ALSA: hda/cs35l56: Add driver for Cirrus Logic CS35L56 amplifier
In reply to Richard FitzgeraldQuoted 37 lines · Richard Fitzgerald
sound/pci/hda/cs35l56_hda.c new file +37
-0+static int cs35l56_hda_request_firmware_file (struct cs35l56_hda *cs35l56, +const struct firmware **firmware,char **filename, +const char *dir,const char *system_name, +const char *amp_name, +const char *filetype) +{ +char *s, c; +int ret =0 ; + +if (system_name && amp_name) + *filename =kasprintf (GFP_KERNEL ,"%scs35l56%s-%02x-dsp1-misc-%s-%s.%s" , dir, + cs35l56->base.secured ?"s" :"" , cs35l56->base.rev, + system_name, amp_name, filetype); +else if (system_name) + *filename =kasprintf (GFP_KERNEL ,"%scs35l56%s-%02x-dsp1-misc-%s.%s" , dir, + cs35l56->base.secured ?"s" :"" , cs35l56->base.rev, + system_name, filetype); +else + *filename =kasprintf (GFP_KERNEL ,"%scs35l56%s-%02x-dsp1-misc.%s" , dir, + cs35l56->base.secured ?"s" :"" , cs35l56->base.rev, + filetype); + +if (!*filename) +return -ENOMEM ; + +/* +* Make sure that filename is lower-case and any non alpha-numeric +* characters except full stop and forward slash are replaced with +* hyphens. +*/ + s = *filename; +while (*s) { + c = *s; +if (isalnum (c)) + *s =tolower (c); +else if (c !='.' && c !='/' ) + *s ='-' ;
sound/pci/hda/cs35l56_hda.c line 442
Quoted 10 lines
sound/pci/hda/cs35l56_hda.c new file +10
-0+ s++; + } + + ret =firmware_request_nowarn (firmware, *filename, cs35l56->base.dev); +if (ret) { +dev_dbg (cs35l56->base.dev,"Failed to request '%s'\n" , *filename); +kfree (*filename); + *filename =NULL ; + }else { +dev_dbg (cs35l56->base.dev,"Found '%s'\n" , *filename);
I may be wrong but *filename seems leaked to me on this path. I noticed it is could be duplicated on cs_dsp_debugfs_save_wmfwname() but the original copy seems left aside.
Quoted 4 lines
sound/pci/hda/cs35l56_hda.c new file +4
-0+ } + +return ret; +}
Richard Fitzgerald
maintainerRe: [PATCH v3 12/12] ALSA: hda/cs35l56: Add driver for Cirrus Logic CS35L56 amplifier
Quoted 44 lines · On 30/05/2023 08:39, [email protected] wrote:
Quoted 43 lines · Richard Fitzgerald
sound/pci/hda/cs35l56_hda.c new file +43
-0+static int cs35l56_hda_request_firmware_file (struct cs35l56_hda *cs35l56, +const struct firmware **firmware,char **filename, +const char *dir,const char *system_name, +const char *amp_name, +const char *filetype) +{ +char *s, c; +int ret =0 ; + +if (system_name && amp_name) + *filename =kasprintf (GFP_KERNEL ,"%scs35l56%s-%02x-dsp1-misc-%s-%s.%s" , dir, + cs35l56->base.secured ?"s" :"" , cs35l56->base.rev, + system_name, amp_name, filetype); +else if (system_name) + *filename =kasprintf (GFP_KERNEL ,"%scs35l56%s-%02x-dsp1-misc-%s.%s" , dir, + cs35l56->base.secured ?"s" :"" , cs35l56->base.rev, + system_name, filetype); +else + *filename =kasprintf (GFP_KERNEL ,"%scs35l56%s-%02x-dsp1-misc.%s" , dir, + cs35l56->base.secured ?"s" :"" , cs35l56->base.rev, + filetype); + +if (!*filename) +return -ENOMEM ; + +/* +* Make sure that filename is lower-case and any non alpha-numeric +* characters except full stop and forward slash are replaced with +* hyphens. +*/ + s = *filename; +while (*s) { + c = *s; +if (isalnum (c)) + *s =tolower (c); +else if (c !='.' && c !='/' ) + *s ='-' ; + s++; + } + + ret =firmware_request_nowarn (firmware, *filename, cs35l56->base.dev); +if (ret) { +dev_dbg (cs35l56->base.dev,"Failed to request '%s'\n" , *filename);
Quoted 9 lines
sound/pci/hda/cs35l56_hda.c line 442
Quoted 4 lines
sound/pci/hda/cs35l56_hda.c new file +4
-0+kfree (*filename); + *filename =NULL ; + }else { +dev_dbg (cs35l56->base.dev,"Found '%s'\n" , *filename);I may be wrong but *filename seems leaked to me on this path. I noticed it is could be duplicated on
cs_dsp_debugfs_save_wmfwname()but the original copy seems left aside.
It's not a leak. The file has been found so the name of the found file is returned (it's used by other code). But there is a leak of that memory elsewhere.
Quoted 5 lines
Quoted 4 lines
sound/pci/hda/cs35l56_hda.c new file +4
-0+ } + +return ret; +}