summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/wm_adsp.c
AgeCommit message (Collapse)AuthorFilesLines
2023-05-23ASoC: do not include pm_runtime.h if not usedClaudiu Beznea1-1/+0
Do not include pm_runtime.h header in files where APIs exported by pm_runtime.h are not used. Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com> Acked-by: Jarkko Nikula <jarkko.nikula@bitmer.com> # for omap-mcbsp-st.c Link: https://lore.kernel.org/r/20230517094903.2895238-2-claudiu.beznea@microchip.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-05-15ASoC: wm_adsp: Update to use new component control notify heleprCharles Keepax1-19/+1
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com Link: https://lore.kernel.org/r/20230512122838.243002-5-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org
2023-03-21ASoC: wm_adsp: Simplify the logging of requested firmware filesSimon Trimmer1-4/+2
This change makes the logging of firmware files more consistent and simplifies the code - a debug message is logged whether the requested file was found or not and this applies to both wmfw and bin files. Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com> Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://lore.kernel.org/r/20230320112245.115720-8-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-21ASoC: wm_adsp: Add support for loading bin files without wmfwSimon Trimmer1-1/+22
A self-booted DSP may have a file of coefficients to apply to the device even when there is no firmware to download. Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com> Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://lore.kernel.org/r/20230320112245.115720-7-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-21ASoC: wm_adsp: Expose the DSP boot work actions as wm_adsp_power_up()Simon Trimmer1-9/+18
To support self-booting DSPs that are considered always running, the work that is usually invoked as part of a DAPM sequence needs to be triggered by a client of wm_adsp as part of it's startup sequence. These actions load firmware files that might create ALSA controls and apply configuration to the device. Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com> Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://lore.kernel.org/r/20230320112245.115720-6-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-21ASoC: wm_adsp: Support DSPs that don't require firmware downloadSimon Trimmer1-0/+3
When a DSP can self-boot from ROM it is not necessary to download firmware - when the DSP has the wmfw_optional flag set not finding a wmfw firmware file is a successful outcome and not an error condition. Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com> Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://lore.kernel.org/r/167931140130.26.15590061696793062038@mailman-core.alsa-project.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-21ASoC: wm_adsp: Use no_core_startstop to prevent creating preload controlSimon Trimmer1-2/+4
The no_core_startstop flag indicates a self-booting DSP - they are considered to be always running and therefore cannot be pre-loaded. Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com> Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://lore.kernel.org/r/20230320112245.115720-3-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-11-25firmware: cs_dsp: Switch to using namespaced exportsMark Brown1-0/+1
Merge series from Richard Fitzgerald <rf@opensource.cirrus.com>: Use EXPORT_SYMBOL_NS_GPL() instead of EXPORT_SYMBOL_GPL() and patch the three drivers that use cs_dsp to add the MODULE_IMPORT_NS(). To make the namespace more specific the KConfig symbol for cs_dsp is changed from CS_DSP to FW_CS_DSP.
2022-11-25ASoC: wm_adsp: Report when a control write changes the valueMark Brown1-9/+18
Merge series from Richard Fitzgerald <rf@opensource.cirrus.com>: Writing a firmware control should be returning 1 if the control value changed, so these two patches add that. Though this is an ALSA requirement it is also useful for non-ALSA clients of cs_dsp to know if the control value changed, so the main handling is implemented in cs_dsp. TLV controls are specifically an ALSA thing so they are handled specially in wm_adsp. Simon Trimmer (2): firmware: cs_dsp: cs_dsp_coeff_write_ctrl() should report changed ASoC: wm_adsp: Return whether changed when writing controls drivers/firmware/cirrus/cs_dsp.c | 17 ++++++++++++----- sound/soc/codecs/wm_adsp.c | 27 ++++++++++++++++++--------- 2 files changed, 30 insertions(+), 14 deletions(-) -- 2.30.2
2022-11-25firmware: cs_dsp: Make the exports namespacedRichard Fitzgerald1-0/+1
Move all the exports into a namespace. This also adds the MODULE_IMPORT_NS to the 3 drivers that use the exported functions. Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://lore.kernel.org/r/20221124134556.3343784-3-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-11-23ASoC: wm_adsp: Return whether changed when writing controlsSimon Trimmer1-9/+18
Functions that update cs_dsp controls need to handle return codes that indicate whether the control value changed. A return code of 1 indicates a change, 0 indicates no-change and a negative value is an error condition. Acked controls implicitly change value when written so a successful write shall always report that the value changed. Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com> Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://lore.kernel.org/r/20221123165811.3014472-3-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-11-23ASoC: wm_adsp: Allow client to hook into pre_run callbackRichard Fitzgerald1-0/+11
Some HALO-based codecs need some additional custom setup in the pre_run stage of cs_dsp. Implement the callback in wm_adsp to call an optional codec driver callback. Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://lore.kernel.org/r/20221109165331.29332-11-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-05ASoC: wm_adsp: Handle optional legacy supportCristian Ciocaltea1-1/+3
The tracing capabilities for the speaker protection fw enabled via commit c55b3e46cb99 ("ASoC: wm_adsp: Add trace caps to speaker protection FW") are not be available on all platforms, such as the Valve's Steam Deck which is based on the Halo Core DSP. As a consequence, whenever the firmware is loaded, a rather misleading 'Failed to parse legacy: -19' error message is written to the kernel ring buffer: [ 288.977412] steamdeck kernel: cs35l41 spi-VLV1776:01: DSP1: Firmware version: 3 [ 288.978002] steamdeck kernel: cs35l41 spi-VLV1776:01: DSP1: cs35l41-dsp1-spk-prot.wmfw: Fri 02 Apr 2021 21:03:50 W. Europe Daylight Time [ 289.094065] steamdeck kernel: cs35l41 spi-VLV1776:01: DSP1: Firmware: 400a4 vendor: 0x2 v0.33.0, 2 algorithms [ 289.095073] steamdeck kernel: cs35l41 spi-VLV1776:01: DSP1: 0: ID cd v29.53.0 XM@94 YM@e [ 289.095665] steamdeck kernel: cs35l41 spi-VLV1776:01: DSP1: 1: ID f20b v0.0.1 XM@170 YM@0 [ 289.096275] steamdeck kernel: cs35l41 spi-VLV1776:01: DSP1: Protection: C:\Users\ocanavan\Desktop\cirrusTune_july2021.bin [ 291.172383] steamdeck kernel: cs35l41 spi-VLV1776:01: DSP1: Failed to parse legacy: -19 Update wm_adsp_buffer_init() to print a more descriptive info message when wm_adsp_buffer_parse_legacy() returns -ENODEV. Fixes: c55b3e46cb99 ("ASoC: wm_adsp: Add trace caps to speaker protection FW") Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com> Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20220825220530.1205141-1-cristian.ciocaltea@collabora.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-06-30ASoC: wm_adsp: Minor clean and redundant code removalCharles Keepax1-20/+5
The cs_dsp core will return an error if passed a NULL cs_dsp struct so there is no need for the wm_adsp_write|read_ctl functions to manually check that. The cs_dsp core will also check the data is within bounds of the control so the additional bounds check is redundant too. Simplify things a bit by removing said code. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20220630101459.3442327-1-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-06-21ASoC: wm_adsp: Fix event for preloaderCharles Keepax1-1/+1
The preloader controls on ADSP should return a value of 1 if the preloader value was changed, update to correct this. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20220621102041.1713504-1-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-06-07Merge tag 'v5.19-rc1' into asoc-5.19Mark Brown1-5/+5
Linux 5.19-rc1
2022-06-06ASoC: wm_adsp: Fix event generation for wm_adsp_fw_put()Mark Brown1-1/+1
Currently wm_adsp_fw_put() returns 0 rather than 1 when updating the value of the control, meaning that no event is generated to userspace. Fix this by setting the default return value to 1, the code already exits early with a return value of 0 if the value is unchanged. Signed-off-by: Mark Brown <broonie@kernel.org> Reviewed-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://lore.kernel.org/r/20220603115003.3865834-1-broonie@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-21Merge tag 'asoc-fix-v5.18-rc7' of ↵Takashi Iwai1-5/+5
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus ASoC: Fix for v5.17 This is rather late and at this point I'm expecting it to get merged in the merge window rather than as a fix but if we get a -rc8 it's a small, driver specific fix which should be fine to send.
2022-03-21Merge tag 'asoc-v5.18' of ↵Takashi Iwai1-35/+127
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus ASoC: Updates for v5.18 Quite a quiet release for ASoC, lots of work on drivers and platforms but nothing too groundbreaking but not much on the core itself: - Start of moving SoF to support multiple IPC mechanisms. - Use of NHLT ACPI table to reduce the amount of quirking required for Intel systems. - Some building blocks for use in forthcoming Intel AVS driver for legacy Intel DSP firmwares. - Support for AMD PDM, Atmel PDMC, Awinic AW8738, i.MX cards with TLV320AIC31xx, Intel machines with CS35L41 and ESSX8336, Mediatek MT8181 wideband bluetooth, nVidia Tegra234, Qualcomm SC7280, Renesas RZ/V2L, Texas Instruments TAS585M
2022-03-09ASoC: wm_adsp: Compressed stream DSP memory structs should be __packedSimon Trimmer1-5/+5
The compressed stream code has a bunch of structs that are used to represent DSP memory but have not been marked __packed. This isn't safe, they could get padded on a 64-bit build. Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com> Link: https://lore.kernel.org/r/20220309130017.2816-1-simont@opensource.cirrus.com Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-07ASoC: wm_adsp: Expand firmware loading search optionsSimon Trimmer1-12/+87
The parts supported by this driver can have product-specific firmware and tunings files. Typically these have been used on embedded systems where the manufacturer is responsible for installing the correct product-specific firmware files into /lib/firmware. However, the linux-firmware repository places all available firmwares into /lib/firmware and it is up to the driver to select the correct product-specific firmware from that directory. For example a product containing four smart amplifiers may provide firmware specific for that product and each of the amplifiers may have coefficient files containing tunings for their placement in the mechanical design. This change extends firmware (wmfw) and coefficient (bin) filenames to be of the general form: <cirrus/>part-dspN-fwtype<-system_name<-asoc_component_prefix>>.type Where the cirrus subdirectory, system_name and asoc_component_prefix are optional. New files will be placed in the cirrus subdirectory to avoid polluting the main /lib/firmware/ location. The generic name must be searched in /lib/firmware before /lib/firmware/cirrus so that a generic file in the new location does not override existing product-specific files in the legacy location. The search order for firmware files is: - cirrus/part-dspN-fwtype-system_name-asoc_component_prefix.wmfw - cirrus/part-dspN-fwtype-system_name.wmfw - part-dspN-fwtype.wmfw - cirrus/part-dspN-fwtype.wmfw - Qualifications are added to the filename so that rightwards is more specific. - The system_name is provided by the codec driver. - The asoc_component_prefix is used to identify tunings for individual parts because it would already exist to disambiguate the controls and it makes it obvious which firmware file applies to which device. The optional coefficient file must have the same filename construction as the discovered wmfw except: - where the wmfw has only system_name then the bin file can optionally include the asoc_component_prefix. This is to allow a common wmfw for all amps but separate tunings per amp. Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com> Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20220303155016.122125-1-simont@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-02-11ASoC: wm_adsp: Add trace caps to speaker protection FWVlad Karpovich1-2/+7
Enable access to the speaker protection firmware debug stream using compress stream API and lower minimum fragment size to 16 words. Signed-off-by: Vlad Karpovich <Vlad.Karpovich@cirrus.com> Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20220210172053.22782-3-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-02-11ASoC: wm_adsp: Make compressed buffers optionalCharles Keepax1-21/+33
Newer firmwares will support compressed buffers that may or may not exist, for example debugging streams. Update the driver to make a compressed stream optional. A warning will still be generated at DSP boot time and opening the stream will fail if the compressed buffer in question does not exist, however the DSP can still be booted and other features used. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20220210172053.22782-2-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-02-10ASoC: wm_adsp: Correct control read size when parsing compressed bufferCharles Keepax1-1/+2
When parsing the compressed stream the whole buffer descriptor is now read in a single cs_dsp_coeff_read_ctrl; on older firmwares this descriptor is just 4 bytes but on more modern firmwares it is 24 bytes. The current code reads the full 24 bytes regardless, this was working but reading junk for the last 20 bytes. However commit f444da38ac92 ("firmware: cs_dsp: Add offset to cs_dsp read/write") added a size check into cs_dsp_coeff_read_ctrl, causing the older firmwares to now return an error. Update the code to only read the amount of data appropriate for the firmware loaded. Fixes: 04ae08596737 ("ASoC: wm_adsp: Switch to using wm_coeff_read_ctrl for compressed buffers") Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20220210172053.22782-1-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-01-05ASoC: wm_adsp: Add support for "toggle" preloadersCharles Keepax1-3/+11
In the case a device can support retaining the firmware memory across low power states it is useful for the preloader widget to only power up whilst actually loading/unloading the core, as opposed to the normal operation where the widget is powered for the entire time a firmware is preloaded onto the core. Add support for this mode and a flag to enable it. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20220105113026.18955-7-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-01Merge branch 'for-5.16' of ↵Mark Brown1-2/+3
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-5.17 so we can apply new Tegra work
2021-11-18firmware: cs_dsp: Add offset to cs_dsp read/writeCharles Keepax1-7/+7
Provide a mechanism to access only part of a control through the cs_dsp interface. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20211117132300.1290-9-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-18ASoC: wm_adsp: Remove the wmfw_add_ctl helper functionCharles Keepax1-24/+9
The helper function wmfw_add_ctl is only called from one place and that place is a function with only 2 lines of code. Merge the helper function into the work function to simplify the code. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20211117132300.1290-1-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-16ASoC: wm_adsp: wm_adsp_control_add() error: uninitialized symbol 'ret'Simon Trimmer1-2/+3
This patch fixes the static analysis warning as it is correctly indicating a possible code path, it cannot know that for the affected firmware versions subname would always be NULL. Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com> Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20211115120154.56782-1-simont@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-30ASoC: wm_adsp: remove a repeated includingGuo Zhengkui1-1/+0
Remove a repeated "#include <linux/firmware.h>" in line 32. Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com> Acked-by: Simon Trimmer <simont@opensource.cirrus.com> Link: https://lore.kernel.org/r/20210929123217.5240-1-guozhengkui@vivo.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-27firmware: cs_dsp: add driver to support firmware loading on Cirrus Logic DSPsSimon Trimmer1-2877/+33
wm_adsp originally provided firmware loading on some audio DSP and was implemented as an ASoC codec driver. However, the firmware loading now covers a wider range of DSP cores and peripherals containing them, beyond just audio. So it needs to be available to non-audio drivers. All the core firmware loading support has been moved into a new driver cs_dsp, leaving only the ASoC-specific parts in wm_adsp. Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com> Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20210913160057.103842-17-simont@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-27ASoC: wm_adsp: Separate wm_adsp specifics in cs_dsp_client_opsSimon Trimmer1-10/+38
This is preparation for moving the generic DSP support out of ASoC. The event callbacks let the client add custom handling of events. Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com> Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20210913160057.103842-16-simont@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-27ASoC: wm_adsp: Split out struct cs_dsp from struct wm_adspSimon Trimmer1-163/+189
In preparation for moving the generic DSP support out of ASoC split struct wm_adsp into two parts, one will form the structure for the new generic DSP code and embed that one into wm_adsp. Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com> Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20210913160057.103842-15-simont@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-27ASoC: wm_adsp: move firmware loading to clientSimon Trimmer1-51/+112
This is preparation for moving the generic DSP support out of ASoC. Passing the firmware as parameters into the power_up functions simplifies the generic code that will be moved out of wm_adsp. Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com> Link: https://lore.kernel.org/r/20210913160057.103842-14-simont@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-27ASoC: wm_adsp: Pass firmware names as parameters when starting DSP coreSimon Trimmer1-17/+26
As preparation for moving the generic DSP support out of ASoC pass the firmware names used when loading files as parameters as the generic code can't refer directly to the array specific to wm_adsp. The code remaining in wm_adsp.c doesn't need to change, it can continue to use the string arrays directly. Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com> Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20210913160057.103842-13-simont@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-27ASoC: wm_adsp: Move check of dsp->running to better placeSimon Trimmer1-1/+4
In preparation for moving the generic DSP support out of ASoC, move the check of dsp->running to a more appropriate place that will move to the generic code. Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com> Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20210913160057.103842-12-simont@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-27ASoC: wm_adsp: Separate generic cs_dsp_coeff_ctl handlingSimon Trimmer1-127/+156
This is preparation for moving the generic DSP support out of ASoC. The majority of the handling of firmware controls is generic and this change separates the generic and ASoC specific details into separate structures and functions and renames the generic code named wm_* to cs_*. Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com> Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20210913160057.103842-11-simont@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-27ASoC: wm_adsp: Move sys_config_size to wm_adspCharles Keepax1-5/+5
sys_config_size is part of the compressed stream support, move it from what will become generic DSP code so that it remains in ASoC. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com> Link: https://lore.kernel.org/r/20210913160057.103842-10-simont@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-27ASoC: wm_adsp: Split DSP power operations into helper functionsSimon Trimmer1-222/+273
This is preparation for moving the generic DSP support out of ASoC. This change separates the generic handling of power and state transitions from the DAPM API wrapper. Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com> Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20210913160057.103842-9-simont@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-27ASoC: wm_adsp: Separate some ASoC and generic functionsSimon Trimmer1-31/+74
Split some functions into ASoC and generic portions so that existing interfaces can be retained whilst allowing the implementation to be moved out of ASoC. Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com> Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20210913160057.103842-8-simont@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-27ASoC: wm_adsp: Introduce cs_dsp logging macrosSimon Trimmer1-227/+234
In preparation for moving the generic DSP support out of ASoC, add some new logging macros that will be used from the generic code. Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com> Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20210913160057.103842-7-simont@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-27ASoC: wm_adsp: Rename generic DSP supportSimon Trimmer1-413/+413
This rename is preparation for moving the generic DSP support out of ASoC, generic code named wm_* will be renamed to cs_*. Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com> Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20210913160057.103842-6-simont@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-27ASoC: wm_adsp: Cancel ongoing work when removing controlsSimon Trimmer1-25/+9
Removes wm_adsp_ctl_work and integrates the work_struct into wm_coeff_ctl so it may be referenced. Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com> Link: https://lore.kernel.org/r/20210913160057.103842-5-simont@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-27ASoC: wm_adsp: Switch to using wm_coeff_read_ctrl for compressed buffersCharles Keepax1-17/+7
When parsing a compressed buffer from the firmware the driver currently open codes reading the firmware coefficient containing the buffer description. Improve this slightly by using the coefficient read functions already provided by the wm_adsp driver. It is worth noting this change requires the running variable to be set before wm_adsp_buffer_init is called, however this is safe, since its all still under the power lock and nothing in the compressed code gates itself on running. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com> Link: https://lore.kernel.org/r/20210913160057.103842-4-simont@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-27ASoC: wm_adsp: Move check for control existenceCharles Keepax1-8/+13
Checking earlier in the function if a control already exists avoids superfluous string construction and also prepares for future refactoring. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com> Link: https://lore.kernel.org/r/20210913160057.103842-3-simont@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-27ASoC: wm_adsp: Remove use of snd_ctl_elem_type_tSimon Trimmer1-13/+11
In preparation for moving the generic DSP support out of ASoC, remove the use of the ALSA specific types for the control type. The use of an ALSA type was unnecessary, the simplified code is easier to read and avoids Sparse warnings. Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com> Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20210913160057.103842-2-simont@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-08-25Merge branch 'for-5.14' of ↵Mark Brown1-0/+2
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-5.15
2021-08-24ASoC: wm_adsp: Put debugfs_remove_recursive back inCharles Keepax1-0/+2
This patch reverts commit acbf58e53041 ("ASoC: wm_adsp: Let soc_cleanup_component_debugfs remove debugfs"), and adds an alternate solution to the issue. That patch removes the call to debugfs_remove_recursive, which cleans up the DSPs debugfs. The intention was to avoid an unbinding issue on an out of tree driver/platform. The issue with the patch is it means the driver no longer cleans up its own debugfs, instead relying on ASoC to remove recurive on the parent debugfs node. This is conceptually rather unclean, but also it would prevent DSPs being added/removed independently of ASoC and soon we are going to be upstreaming some non-audio parts with these DSPs, which will require this. Finally, it seems the issue on the platform is a result of the wm_adsp2_cleanup_debugfs getting called twice. This is very likely a problem on the platform side and will be resolved there. But in the mean time make the code a little more robust to such issues, and again conceptually a bit nicer, but clearing the debugfs_root variable in the DSP structure when the debugfs is removed. Fixes: acbf58e53041 ("ASoC: wm_adsp: Let soc_cleanup_component_debugfs remove debugfs" Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20210824101552.1119-1-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-08-06Merge some cs42l42 patches into asoc-5.15Mark Brown1-1/+0
2021-07-28ASoC: wm_adsp: Let soc_cleanup_component_debugfs remove debugfsLucas Tanure1-1/+0
soc_cleanup_component_debugfs will debugfs_remove_recursive the component->debugfs_root, so adsp doesn't need to also remove the same entry. By doing that adsp also creates a race with core component, which causes a NULL pointer dereference Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com> Link: https://lore.kernel.org/r/20210728104416.636591-1-tanureal@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>