summaryrefslogtreecommitdiffstats
path: root/drivers/firmware/cirrus
Commit message (Collapse)AuthorAgeFilesLines
* firmware: cirrus: cs_dsp: Only log list of algorithms in debug buildRichard Fitzgerald2023-09-131-17/+17
| | | | | | | | | | | | | | | | Change the logging of each algorithm from info level to debug level. On the original devices supported by this code there were typically only one or two algorithms in a firmware and one or two DSPs so this logging only used a small number of log lines. However, for the latest devices there could be 30-40 algorithms in a firmware and 8 DSPs being loaded in parallel, so using 300+ lines of log for information that isn't particularly important to have logged. Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://lore.kernel.org/r/20230913160523.3701189-1-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
* firmware: cs_dsp: Fix new control name checkVlad Karpovich2023-08-151-1/+2
| | | | | | | | | | | | | | | Before adding a new FW control, its name is checked against existing controls list. But the string length in strncmp used to compare controls names is taken from the list, so if beginnings of the controls are matching, then the new control is not created. For example, if CAL_R control already exists, CAL_R_SELECTED is not created. The fix is to compare string lengths as well. Fixes: 6477960755fb ("ASoC: wm_adsp: Move check for control existence") Signed-off-by: Vlad Karpovich <vkarpovi@opensource.cirrus.com> Link: https://lore.kernel.org/r/20230815172908.3454056-1-vkarpovi@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
* ASoC: Merge fixes due to dependenciesMark Brown2023-06-161-2/+3
|\ | | | | | | So we can apply the tlv320aic3xxx DT conversion.
| * firmware: cs_dsp: Log correct region name in bin error messagesRichard Fitzgerald2023-06-051-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | In cs_dsp_load_coeff() region_name should be set in the XM/YM/ZM cases otherwise any errors will log the region as "Unknown". While doing this also change one error message that logged the region type ID to log the region_name instead. This makes it consistent with other messages in the same function. Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://lore.kernel.org/r/20230605143238.4001982-1-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
* | firmware: cs_dsp: Log that a bin file was loadedRichard Fitzgerald2023-06-011-4/+4
|/ | | | | | | | | | | Change the message at the start of bin file loading from cs_dsp_dbg() to cs_dsp_info() so that there is confirmation in the kernel log that a bin file was loaded, and the name of the file. Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://lore.kernel.org/r/20230531170158.2744700-1-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
* firmware: cs_dsp: Add a debugfs entry containing control detailsSimon Trimmer2023-04-031-0/+31
| | | | | | | | | | | | | | | | | The file named 'controls' in the DSP's debugfs root contains a formatted table describing the controls defined within the loaded DSP firmware, it is of the form name: len region:offset addr fwname algid ctltype flags en dirty Where flags is represented as a character for each flag if set, or '-', enabled is whether the control is enabled or disabled and dirty is whether the control value is set in the cache but not the hardware. Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com> Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://lore.kernel.org/r/20230328131018.6820-1-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
* firmware: cs_dsp: 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 during the powering up sequence. A DSP that required firmware download would fail in a previous configuration step if firmware was not available. 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-4-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
* firmware: cs_dsp: Introduce no_core_startstop for self-booting DSPsSimon Trimmer2023-03-211-1/+13
| | | | | | | | | | | | There are devices containing Halo Core DSPs that self-boot, cs_dsp is used to manage the running firmware but the host does not have direct control over starting and stopping the DSP and so cs_dsp should consider the DSP to be always running. 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-2-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
* firmware: cs_dsp: Switch to using namespaced exportsMark Brown2022-11-253-33/+33
|\ | | | | | | | | | | | | | | | | | | 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-31/+31
| | | | | | | | | | | | | | | | | | | | 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>
| * firmware: cs_dsp: Rename KConfig symbol CS_DSP -> FW_CS_DSPRichard Fitzgerald2022-11-252-2/+2
| | | | | | | | | | | | | | | | | | | | Qualify the KConfig symbol for cs_dsp by adding a FW_ prefix so that it is more explicit what is being referred to. This is preparation for using the symbol to namespace the exports. Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://lore.kernel.org/r/20221124134556.3343784-2-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
* | firmware: cs_dsp: cs_dsp_coeff_write_ctrl() should report changedSimon Trimmer2022-11-231-5/+12
|/ | | | | | | | | | ALSA callers need to know whether there was a change to the value so that they can report a control write change correctly. 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-2-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
* firmware: cs_dsp: Add memory chunk helpersCharles Keepax2022-07-221-0/+104
| | | | | | | | | | | Add helpers that can be layered on top of a buffer read from or to be written to the DSP to faciliate accessing datastructures within the DSP memory. These functions handle adding the padding bytes for the DSP, converting to big endian, and packing arbitrary length data. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20220722094851.92521-2-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
* firmware: cs_dsp: Add pre_stop callbackCharles Keepax2022-07-221-0/+3
| | | | | | | | | | | The code already has a post_stop callback, add a matching pre_stop callback to the client_ops that is called before execution is stopped. This callback provides a convenient place for the client code to communicate with the DSP before it is stopped. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20220722094851.92521-1-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
* firmware: cs_dsp: Fix overrun of unterminated control name stringRichard Fitzgerald2022-04-121-2/+1
| | | | | | | | | | | | | | | | For wmfw format v2 and later the coefficient name strings have a length field and are NOT null-terminated. Use kasprintf() to convert the unterminated string into a null-terminated string in an allocated buffer. The previous code handled this duplication incorrectly using kmemdup() and getting the length from a strlen() of the (unterminated) source string. This resulted in creating a string that continued up to the next byte in the firmware file that just happened to be 0x00. Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Fixes: f6bc909e7673 ("firmware: cs_dsp: add driver to support firmware loading on Cirrus Logic DSPs") Link: https://lore.kernel.org/r/20220412163927.1303470-1-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
* firmware: cs_dsp: Clear core reset for cacheCharles Keepax2022-01-051-4/+10
| | | | | | | | | | | | | If the Halo registers are kept in the register cache the HALO_CORE_RESET bit will be retained as 1 after reset is triggered in cs_dsp_halo_start_core. This will cause subsequent writes to reset the core which is not desired. Apart from this bit the rest of the register bits are cacheable, so for safety sake clear the bit to ensure the cache is consistent. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20220105113026.18955-6-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
* firmware: cs_dsp: Move lockdep asserts to avoid potential null pointerCharles Keepax2021-11-301-4/+4
| | | | | | | | | | | | Move the lockdep asserts until after the ctl pointer has been checked for NULL, to avoid potentially NULL pointer dereferences. Fixes: fb2f364fb5b9 ("firmware: cs_dsp: Add lockdep asserts to interface functions") Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20211130102842.26410-1-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
* firmware: cs_dsp: Allow creation of event controlsCharles Keepax2021-11-171-0/+1
| | | | | | | | | | | Some firmwares contain controls intended to convey firmware state back to the host. Whilst more infrastructure will probably be needed for these in time, as a first step allow creation of the controls, so said firmwares arn't completely rejected. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20211117132300.1290-10-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
* firmware: cs_dsp: Add offset to cs_dsp read/writeCharles Keepax2021-11-171-16/+28
| | | | | | | | | 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>
* firmware: cs_dsp: Clarify some kernel doc commentsCharles Keepax2021-11-171-2/+2
| | | | | | Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20211117132300.1290-8-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
* firmware: cs_dsp: Perform NULL check in cs_dsp_coeff_write/read_ctrlCharles Keepax2021-11-171-0/+6
| | | | | | | | | | | Add a NULL check to the cs_dsp_coeff_write/read_ctrl functions. This is a major convenience for users of the cs_dsp library as it allows the call to cs_dsp_get_ctl to be inlined with the call to read/write the control itself. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20211117132300.1290-7-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
* firmware: cs_dsp: Add support for rev 2 coefficient filesCharles Keepax2021-11-171-0/+1
| | | | | | | | | | | | Add support for the revision 2 coefficient file, this format is identical to revision 1 and was simply added by accident to some firmware. However unfortunately many firmwares have leaked into production using this and as such driver support really needs to be added for it. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20211117132300.1290-6-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
* firmware: cs_dsp: Print messages from bin filesCharles Keepax2021-11-171-0/+11
| | | | | | | | | | The coefficient file contains various info strings, and the equivalent strings are printed from the WMFW file as it is loaded. Add support for printing these from the coefficient file as well. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20211117132300.1290-5-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
* firmware: cs_dsp: Add pre_run callbackCharles Keepax2021-11-171-0/+6
| | | | | | | | | | | | | | | | The code already has a post_run callback, add a matching pre_run callback to the client_ops that is called before execution is started. This callback provides a convenient place for the client code to set DSP controls or hardware that requires configuration before the DSP core actually starts execution. Note that placing this callback before cs_dsp_coeff_sync_controls is important to ensure that any control values are then correctly synced out to the chip. Co-authored-by: Simon Trimmer <simont@opensource.cirrus.com> Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com> Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20211117132300.1290-4-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
* firmware: cs_dsp: Add version checks on coefficient loadingCharles Keepax2021-11-171-13/+36
| | | | | | | | | | | | | | | The firmware coefficient files contain version information that is currently ignored by the cs_dsp code. This information specifies which version of the firmware the coefficient were generated for. Add a check into the code which prints a warning in the case the coefficient and firmware differ in version, in many cases this will be ok but it is not always, so best to let the user know there is a potential issue. Co-authored-by: Simon Trimmer <simont@opensource.cirrus.com> Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com> Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20211117132300.1290-3-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
* firmware: cs_dsp: Add lockdep asserts to interface functionsCharles Keepax2021-11-171-0/+14
| | | | | | | | | | Some of the control functions exposed by the cs_dsp code require the pwr_lock to be held by the caller. Add lockdep_assert_held calls to ensure this is done correctly. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20211117132300.1290-2-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
* firmware: cs_dsp: tidy includes in cs_dsp.c and cs_dsp.hSimon Trimmer2021-11-151-6/+0
| | | | | | | | | | | This patch removes unused included header files and moves others into cs_dsp.h to ensure that types referenced in the header file are properly described to prevent compiler warnings. Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com> Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20211115120215.56824-1-simont@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
* firmware: cs_dsp: add driver to support firmware loading on Cirrus Logic DSPsSimon Trimmer2021-09-273-0/+3117
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>