summaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm_adsp.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* ASoC: wm_adsp: Add wm_adsp_start() and wm_adsp_stop()Richard Fitzgerald2024-02-231-9/+18
| | | | | | | | | | | | Separate the functionality of wm_adsp_event() into two exported functions wm_adsp_start() and wm_adsp_stop(). This allows the codec driver to start and stop the DSP outside of a DAPM widget. Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://lore.kernel.org/r/20240223153910.2063698-2-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: wm_adsp: Don't overwrite fwf_name with the defaultRichard Fitzgerald2024-02-011-17/+12
| | | | | | | | | | | | | | | | | | | | | | There's no need to overwrite fwf_name with a kstrdup() of the cs_dsp part name. It is trivial to select either fwf_name or cs_dsp.part as the string to use when building the filename in wm_adsp_request_firmware_file(). This leaves fwf_name entirely owned by the codec driver. It also avoids problems with freeing the pointer. With the original code fwf_name was either a pointer owned by the codec driver, or a kstrdup() created by wm_adsp. This meant wm_adsp must free it if it set it, but not if the codec driver set it. The code was handling this by using devm_kstrdup(). But there is no absolute requirement that wm_adsp_common_init() must be called from probe(), so this was a pseudo-memory leak - each new call to wm_adsp_common_init() would allocate another block of memory but these would only be freed if the owning codec driver was removed. Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://msgid.link/r/20240129162737.497-3-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: wm_adsp: Fix firmware file search orderRichard Fitzgerald2024-02-011-25/+19
| | | | | | | | | | | | | | | | Check for the cases of system-specific bin file without a wmfw before falling back to looking for a generic wmfw. All system-specific options should be tried before falling back to loading a generic wmfw/bin. With the original code, the presence of a fallback generic wmfw on the filesystem would prevent using a system-specific tuning with a ROM firmware. Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Fixes: 0e7d82cbea8b ("ASoC: wm_adsp: Add support for loading bin files without wmfw") Link: https://msgid.link/r/20240129162737.497-2-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: wm_adsp: fix memleak in wm_adsp_buffer_populateDinghao Liu2023-12-041-2/+6
| | | | | | | | | | | | | When wm_adsp_buffer_read() fails, we should free buf->regions. Otherwise, the callers of wm_adsp_buffer_populate() will directly free buf on failure, which makes buf->regions a leaked memory. Fixes: a792af69b08f ("ASoC: wm_adsp: Refactor compress stream initialisation") Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn> Reviewed-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://lore.kernel.org/r/20231204074158.12026-1-dinghao.liu@zju.edu.cn Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: Merge up fixesMark Brown2023-09-261-2/+11
|\ | | | | | | For the benefit of CI.
| * ASoC: wm_adsp: Fix missing locking in wm_adsp_[read|write]_ctl()Richard Fitzgerald2023-09-131-2/+11
| | | | | | | | | | | | | | | | | | wm_adsp_read_ctl() and wm_adsp_write_ctl() must hold the cs_dsp pwr_lock mutex when calling cs_dsp_coeff_read_ctrl() and cs_dsp_coeff_write_ctrl(). Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://lore.kernel.org/r/20230913160250.3700346-1-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
* | ASoC: codec: wm: convert not to use asoc_xxx()Kuninori Morimoto2023-09-251-5/+5
|/ | | | | | | | | ASoC is now unified asoc_xxx() into snd_soc_xxx(). This patch convert asoc_xxx() to snd_soc_xxx(). Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87zg1sp8vd.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: wm_adsp: Support powering-up DSP without trying to load firmwareRichard Fitzgerald2023-08-151-7/+9
| | | | | | | | | | | | | Add a flag to wm_adsp_power_up() that indicates whether it should attempt to find and load firmware files. This is to support DSPs that have built-in firmware that may already have been patched (for example, by the BIOS). In that case the patch must not be overwritten because that could corrupt the running firmware. Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://lore.kernel.org/r/20230815124826.5447-2-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: wm_adsp: Expose the DSP power down actions as wm_adsp_power_down()Simon Trimmer2023-08-081-1/+7
| | | | | | | | | | | To support self-booting DSPs that operate outside of a conventional DAPM event life cycle expose a companion function to wm_adsp_power_up() so that the correct state of the DSP firmware and controls can be recorded. Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com> Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://lore.kernel.org/r/20230808164702.21272-5-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: do not include pm_runtime.h if not usedClaudiu Beznea2023-05-231-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>
* ASoC: wm_adsp: Update to use new component control notify heleprCharles Keepax2023-05-151-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
* ASoC: wm_adsp: Simplify the logging of requested firmware filesSimon Trimmer2023-03-211-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>
* ASoC: wm_adsp: Add support for loading bin files without wmfwSimon Trimmer2023-03-211-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>
* ASoC: wm_adsp: Expose the DSP boot work actions as wm_adsp_power_up()Simon Trimmer2023-03-211-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>
* ASoC: wm_adsp: Support DSPs that don't require firmware downloadSimon Trimmer2023-03-211-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>
* ASoC: wm_adsp: Use no_core_startstop to prevent creating preload controlSimon Trimmer2023-03-211-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>
* firmware: cs_dsp: Switch to using namespaced exportsMark Brown2022-11-251-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.
| * firmware: cs_dsp: Make the exports namespacedRichard Fitzgerald2022-11-251-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>
* | ASoC: wm_adsp: Report when a control write changes the valueMark Brown2022-11-251-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
| * ASoC: wm_adsp: Return whether changed when writing controlsSimon Trimmer2022-11-231-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>
* | ASoC: wm_adsp: Allow client to hook into pre_run callbackRichard Fitzgerald2022-11-231-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>
* ASoC: wm_adsp: Handle optional legacy supportCristian Ciocaltea2022-09-051-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>
* ASoC: wm_adsp: Minor clean and redundant code removalCharles Keepax2022-06-301-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>
* ASoC: wm_adsp: Fix event for preloaderCharles Keepax2022-06-211-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>
* Merge tag 'v5.19-rc1' into asoc-5.19Mark Brown2022-06-071-5/+5
|\ | | | | | | Linux 5.19-rc1
| * Merge tag 'asoc-fix-v5.18-rc7' of ↵Takashi Iwai2022-05-211-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.
| | * ASoC: wm_adsp: Compressed stream DSP memory structs should be __packedSimon Trimmer2022-03-091-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>
* | | ASoC: wm_adsp: Fix event generation for wm_adsp_fw_put()Mark Brown2022-06-061-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>
* | Merge tag 'asoc-v5.18' of ↵Takashi Iwai2022-03-211-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
| * ASoC: wm_adsp: Expand firmware loading search optionsSimon Trimmer2022-03-071-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>
| * ASoC: wm_adsp: Add trace caps to speaker protection FWVlad Karpovich2022-02-111-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>
| * ASoC: wm_adsp: Make compressed buffers optionalCharles Keepax2022-02-111-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>
* | ASoC: wm_adsp: Correct control read size when parsing compressed bufferCharles Keepax2022-02-101-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>
* ASoC: wm_adsp: Add support for "toggle" preloadersCharles Keepax2022-01-051-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>
* Merge branch 'for-5.16' of ↵Mark Brown2021-12-011-2/+3
|\ | | | | | | https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-5.17 so we can apply new Tegra work
| * ASoC: wm_adsp: wm_adsp_control_add() error: uninitialized symbol 'ret'Simon Trimmer2021-11-151-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>
* | firmware: cs_dsp: Add offset to cs_dsp read/writeCharles Keepax2021-11-171-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>
* | ASoC: wm_adsp: Remove the wmfw_add_ctl helper functionCharles Keepax2021-11-171-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>
* ASoC: wm_adsp: remove a repeated includingGuo Zhengkui2021-09-301-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>
* firmware: cs_dsp: add driver to support firmware loading on Cirrus Logic DSPsSimon Trimmer2021-09-271-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>
* ASoC: wm_adsp: Separate wm_adsp specifics in cs_dsp_client_opsSimon Trimmer2021-09-271-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>
* ASoC: wm_adsp: Split out struct cs_dsp from struct wm_adspSimon Trimmer2021-09-271-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>
* ASoC: wm_adsp: move firmware loading to clientSimon Trimmer2021-09-271-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>
* ASoC: wm_adsp: Pass firmware names as parameters when starting DSP coreSimon Trimmer2021-09-271-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>
* ASoC: wm_adsp: Move check of dsp->running to better placeSimon Trimmer2021-09-271-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>
* ASoC: wm_adsp: Separate generic cs_dsp_coeff_ctl handlingSimon Trimmer2021-09-271-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>
* ASoC: wm_adsp: Move sys_config_size to wm_adspCharles Keepax2021-09-271-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>
* ASoC: wm_adsp: Split DSP power operations into helper functionsSimon Trimmer2021-09-271-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>
* ASoC: wm_adsp: Separate some ASoC and generic functionsSimon Trimmer2021-09-271-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>
* ASoC: wm_adsp: Introduce cs_dsp logging macrosSimon Trimmer2021-09-271-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>