···11+.. SPDX-License-Identifier: GPL-2.0-only22+33+=====================================================================44+Audio drivers for Cirrus Logic CS35L54/56/57 Boosted Smart Amplifiers55+=====================================================================66+:Copyright: 2025 Cirrus Logic, Inc. and77+ Cirrus Logic International Semiconductor Ltd.88+99+Contact: patches@opensource.cirrus.com1010+1111+Summary1212+=======1313+1414+The high-level summary of this document is:1515+1616+**If you have a laptop that uses CS35L54/56/57 amplifiers but audio is not1717+working, DO NOT ATTEMPT TO USE FIRMWARE AND SETTINGS FROM ANOTHER LAPTOP,1818+EVEN IF THAT LAPTOP SEEMS SIMILAR.**1919+2020+The CS35L54/56/57 amplifiers must be correctly configured for the power2121+supply voltage, speaker impedance, maximum speaker voltage/current, and2222+other external hardware connections.2323+2424+The amplifiers feature advanced boost technology that increases the voltage2525+used to drive the speakers, while proprietary speaker protection algorithms2626+allow these boosted amplifiers to push the limits of the speakers without2727+causing damage. These **must** be configured correctly.2828+2929+Supported Cirrus Logic amplifiers3030+---------------------------------3131+3232+The cs35l56 drivers support:3333+3434+* CS35L543535+* CS35L563636+* CS35L573737+3838+There are two drivers in the kernel3939+4040+*For systems using SoundWire*: sound/soc/codecs/cs35l56.c and associated files4141+4242+*For systems using HDA*: sound/pci/hda/cs35l56_hda.c4343+4444+Firmware4545+========4646+4747+The amplifier is controlled and managed by firmware running on the internal4848+DSP. Firmware files are essential to enable the full capabilities of the4949+amplifier.5050+5151+Firmware is distributed in the linux-firmware repository:5252+https://gitlab.com/kernel-firmware/linux-firmware.git5353+5454+On most SoundWire systems the amplifier has a default minimum capability to5555+produce audio. However this will be5656+5757+* at low volume, to protect the speakers, since the speaker specifications5858+ and power supply voltages are unknown.5959+* a mono mix of left and right channels.6060+6161+On some SoundWire systems that have both CS42L43 and CS35L56/57 the CS35L56/576262+receive their audio from the CS42L43 instead of directly from the host6363+SoundWire interface. These systems can be identified by the CS42L43 showing6464+in dmesg as a SoundWire device, but the CS35L56/57 as SPI. On these systems6565+the firmware is *mandatory* to enable receiving the audio from the CS42L43.6666+6767+On HDA systems the firmware is *mandatory* to enable HDA bridge mode. There6868+will not be any audio from the amplifiers without firmware.6969+7070+Cirrus Logic firmware files7171+---------------------------7272+7373+Each amplifier requires two firmware files. One file has a .wmfw suffix, the7474+other has a .bin suffix.7575+7676+The firmware is customized by the OEM to match the hardware of each laptop,7777+and the firmware is specific to that laptop. Because of this, there are many7878+firmware files in linux-firmware for these amplifiers. Firmware files are7979+**not interchangeable between laptops**.8080+8181+Cirrus Logic submits files for known laptops to the upstream linux-firmware8282+repository. Providing Cirrus Logic is aware of a particular laptop and has8383+permission from the manufacturer to publish the firmware, it will be pushed8484+to linux-firmware. You may need to upgrade to a newer release of8585+linux-firmware to obtain the firmware for your laptop.8686+8787+**Important:** the Makefile for linux-firmware creates symlinks that are listed8888+in the WHENCE file. These symlinks are required for the CS35L56 driver to be8989+able to load the firmware.9090+9191+How do I know which firmware file I should have?9292+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~9393+All firmware file names are qualified with a unique "system ID". On normal9494+x86 PCs with PCI audio this is the Vendor Subsystem ID (SSID) of the host9595+PCI audio interface.9696+9797+The SSID can be viewed using the lspci tool::9898+9999+ lspci -v -nn | grep -A2 -i audio100100+ 0000:00:1f.3 Audio device [0403]: Intel Corporation Meteor Lake-P HD Audio Controller [8086:7e28]101101+ Subsystem: Dell Meteor Lake-P HD Audio Controller [1028:0c63]102102+103103+In this example the SSID is 10280c63.104104+105105+The format of the firmware file names is:106106+107107+ cs35lxx-b0-dsp1-misc-SSID[-spkidX]-ampN108108+109109+Where:110110+111111+ * cs35lxx-b0 is the amplifier model and silicon revision. This information112112+ is logged by the driver during initialization.113113+ * SSID is the 8-digit hexadecimal SSID value.114114+ * ampN is the amplifier number (for example amp1). This is the same as115115+ the prefix on the ALSA control names except that it is always lower-case116116+ in the file name.117117+ * spkidX is an optional part, used for laptops that have firmware118118+ configurations for different makes and models of internal speakers.119119+120120+Sound Open Firmware and ALSA topology files121121+-------------------------------------------122122+123123+All SoundWire systems will require a Sound Open Firmware (SOF) for the124124+host CPU audio DSP, together with an ALSA topology file (.tplg).125125+126126+The SOF firmware will usually be provided by the manufacturer of the host127127+CPU (i.e. Intel or AMD). The .tplg file is normally part of the SOF firmware128128+release.129129+130130+SOF binary builds are available from: https://github.com/thesofproject/sof-bin/releases131131+132132+The main SOF source is here: https://github.com/thesofproject133133+134134+ALSA-ucm configurations135135+-----------------------136136+Typically an appropriate ALSA-ucm configuration file is needed for137137+use-case managers and audio servers such as PipeWire.138138+139139+Configuration files are available from the alsa-ucm-conf repository:140140+https://git.alsa-project.org/?p=alsa-ucm-conf.git141141+142142+Kernel log messages143143+===================144144+145145+SoundWire146146+---------147147+A successful initialization will look like this (this will be repeated for148148+each amplifier)::149149+150150+ [ 7.568374] cs35l56 sdw:0:0:01fa:3556:01:0: supply VDD_P not found, using dummy regulator151151+ [ 7.605208] cs35l56 sdw:0:0:01fa:3556:01:0: supply VDD_IO not found, using dummy regulator152152+ [ 7.605313] cs35l56 sdw:0:0:01fa:3556:01:0: supply VDD_A not found, using dummy regulator153153+ [ 7.939279] cs35l56 sdw:0:0:01fa:3556:01:0: Cirrus Logic CS35L56 Rev B0 OTP3 fw:3.4.4 (patched=0)154154+ [ 7.947844] cs35l56 sdw:0:0:01fa:3556:01:0: Slave 4 state check1: UNATTACHED, status was 1155155+ [ 8.740280] cs35l56 sdw:0:0:01fa:3556:01:0: supply VDD_B not found, using dummy regulator156156+ [ 8.740552] cs35l56 sdw:0:0:01fa:3556:01:0: supply VDD_AMP not found, using dummy regulator157157+ [ 9.242164] cs35l56 sdw:0:0:01fa:3556:01:0: DSP1: cirrus/cs35l56-b0-dsp1-misc-xxxxxxxx.wmfw: format 3 timestamp 0x66b2b872158158+ [ 9.242173] cs35l56 sdw:0:0:01fa:3556:01:0: DSP1: cirrus/cs35l56-b0-dsp1-misc-xxxxxxxx.wmfw: Tue 05 Dec 2023 21:37:21 GMT Standard Time159159+ [ 9.991709] cs35l56 sdw:0:0:01fa:3556:01:0: DSP1: Firmware: 1a00d6 vendor: 0x2 v3.11.23, 41 algorithms160160+ [10.039098] cs35l56 sdw:0:0:01fa:3556:01:0: DSP1: cirrus/cs35l56-b0-dsp1-misc-xxxxxxxx-amp1.bin: v3.11.23161161+ [10.879235] cs35l56 sdw:0:0:01fa:3556:01:0: Slave 4 state check1: UNATTACHED, status was 1162162+ [11.401536] cs35l56 sdw:0:0:01fa:3556:01:0: Calibration applied163163+164164+HDA165165+---166166+A successful initialization will look like this (this will be repeated for167167+each amplifier)::168168+169169+ [ 6.306475] cs35l56-hda i2c-CSC3556:00-cs35l56-hda.0: Cirrus Logic CS35L56 Rev B0 OTP3 fw:3.4.4 (patched=0)170170+ [ 6.613892] cs35l56-hda i2c-CSC3556:00-cs35l56-hda.0: DSP system name: 'xxxxxxxx', amp name: 'AMP1'171171+ [ 8.266660] snd_hda_codec_cs8409 ehdaudio0D0: bound i2c-CSC3556:00-cs35l56-hda.0 (ops cs35l56_hda_comp_ops [snd_hda_scodec_cs35l56])172172+ [ 8.287525] cs35l56-hda i2c-CSC3556:00-cs35l56-hda.0: DSP1: cirrus/cs35l56-b0-dsp1-misc-xxxxxxxx.wmfw: format 3 timestamp 0x66b2b872173173+ [ 8.287528] cs35l56-hda i2c-CSC3556:00-cs35l56-hda.0: DSP1: cirrus/cs35l56-b0-dsp1-misc-xxxxxxxx.wmfw: Tue 05 Dec 2023 21:37:21 GMT Standard Time174174+ [ 9.984335] cs35l56-hda i2c-CSC3556:00-cs35l56-hda.0: DSP1: Firmware: 1a00d6 vendor: 0x2 v3.11.23, 41 algorithms175175+ [10.085797] cs35l56-hda i2c-CSC3556:00-cs35l56-hda.0: DSP1: cirrus/cs35l56-b0-dsp1-misc-xxxxxxxx-amp1.bin: v3.11.23176176+ [10.655237] cs35l56-hda i2c-CSC3556:00-cs35l56-hda.0: Calibration applied177177+178178+Important messages179179+~~~~~~~~~~~~~~~~~~180180+Cirrus Logic CS35L56 Rev B0 OTP3 fw:3.4.4 (patched=0)181181+ Shows that the driver has been able to read device ID registers from the182182+ amplifier.183183+184184+ * The actual amplifier type and silicon revision (CS35L56 B0 in this185185+ example) is shown, as read from the amplifier identification registers.186186+ * (patched=0) is normal, and indicates that the amplifier has been hard187187+ reset and is running default ROM firmware.188188+ * (patched=1) means that something has previously downloaded firmware189189+ to the amplifier and the driver does not have control of the RESET190190+ signal to be able to replace this preloaded firmware. This is normal191191+ for systems where the BIOS downloads firmware to the amplifiers192192+ before OS boot.193193+ This status can also be seen if the cs35l56 kernel module is unloaded194194+ and reloaded on a system where the driver does not have control of195195+ RESET. SoundWire systems typically do not give the driver control of196196+ RESET and only a BIOS (re)boot can reset the amplifiers.197197+198198+DSP1: cirrus/cs35l56-b0-dsp1-misc-xxxxxxxx.wmfw199199+ Shows that a .wmfw firmware file was found and downloaded.200200+201201+DSP1: cirrus/cs35l56-b0-dsp1-misc-xxxxxxxx-amp1.bin202202+ Shows that a .bin firmware file was found and downloaded.203203+204204+Calibration applied205205+ Factory calibration data in EFI was written to the amplifier.206206+207207+Error messages208208+==============209209+This section explains some of the error messages that the driver can log.210210+211211+Algorithm coefficient version %d.%d.%d but expected %d.%d.%d212212+ The version of the .bin file content does not match the loaded firmware.213213+ Caused by mismatched .wmfw and .bin file, or .bin file was found but214214+ .wmfw was not.215215+216216+No %s for algorithm %x217217+ The version of the .bin file content does not match the loaded firmware.218218+ Caused by mismatched .wmfw and .bin file, or .bin file was found but219219+ .wmfw was not.220220+221221+.bin file required but not found222222+ HDA driver did not find a .bin file that matches this hardware.223223+224224+Calibration disabled due to missing firmware controls225225+ Driver was not able to write EFI calibration data to firmware registers.226226+ This typically means that either:227227+228228+ * The driver did not find a suitable wmfw for this hardware, or229229+ * The amplifier has already been patched with firmware by something230230+ previously, and the driver does not have control of a hard RESET line231231+ to be able to reset the amplifier and download the firmware files it232232+ found. This situation is indicated by the device identification233233+ string in the kernel log shows "(patched=1)"234234+235235+Failed to write calibration236236+ Same meaning and cause as "Calibration disabled due to missing firmware237237+ controls"238238+239239+Failed to read calibration data from EFI240240+ Factory calibration data in EFI is missing, empty or corrupt.241241+ This is most likely to be cause by accidentally deleting the file from242242+ the EFI filesystem.243243+244244+No calibration for silicon ID245245+ The factory calibration data in EFI does not match this hardware.246246+ The most likely cause is that an amplifier has been replaced on the247247+ motherboard without going through manufacturer calibration process to248248+ generate calibration data for the new amplifier.249249+250250+Did not find any buses for CSCxxxx251251+ Only on HDA systems. The HDA codec driver found an ACPI entry for252252+ Cirrus Logic companion amps, but could not enumerate the ACPI entries for253253+ the I2C/SPI buses. The most likely cause of this is that:254254+255255+ * The relevant bus driver (I2C or SPI) is not part of the kernel.256256+ * The HDA codec driver was built-in to the kernel but the I2C/SPI257257+ bus driver is a module and so the HDA codec driver cannot call the258258+ bus driver functions.259259+260260+init_completion timed out261261+ The SoundWire bus controller (host end) did not enumerate the amplifier.262262+ In other words, the ACPI says there is an amplifier but for some reason263263+ it was not detected on the bus.264264+265265+No AF01 node266266+ Indicates an error in ACPI. A SoundWire system should have a Device()267267+ node named "AF01" but it was not found.268268+269269+Failed to get spk-id-gpios270270+ ACPI says that the driver should request a GPIO but the driver was not271271+ able to get that GPIO. The most likely cause is that the kernel does not272272+ include the correct GPIO or PINCTRL driver for this system.273273+274274+Failed to read spk-id275275+ ACPI says that the driver should request a GPIO but the driver was not276276+ able to read that GPIO.277277+278278+Unexpected spk-id element count279279+ AF01 contains more speaker ID GPIO entries than the driver supports280280+281281+Overtemp error282282+ Amplifier overheat protection was triggered and the amplifier shut down283283+ to protect itself.284284+285285+Amp short error286286+ Amplifier detected a short-circuit on the speaker output pins and shut287287+ down for protection. This would normally indicate a damaged speaker.288288+289289+Hibernate wake failed290290+ The driver tried to wake the amplifier from its power-saving state but291291+ did not see the expected responses from the amplifier. This can be caused292292+ by using firmware that does not match the hardware.
···8989#define simple_props_to_dai_codec(props, i) ((props)->codec_dai + i)9090#define simple_props_to_codec_conf(props, i) ((props)->codec_conf + i)91919292+/* has the same effect as simple_priv_to_props(). Preferred over9393+ * simple_priv_to_props() when dealing with PCM runtime data as9494+ * the ID stored in rtd->id may not be a valid array index.9595+ */9696+#define runtime_simple_priv_to_props(priv, rtd) \9797+ ((priv)->dai_props + ((rtd)->dai_link - (priv)->dai_link))9898+9299#define for_each_prop_dlc_cpus(props, i, cpu) \93100 for ((i) = 0; \94101 ((i) < (props)->num.cpus) && \
+10-4
sound/core/seq/seq_clientmgr.c
···12751275 if (client->type != client_info->type)12761276 return -EINVAL;1277127712781278- /* check validity of midi_version field */12791279- if (client->user_pversion >= SNDRV_PROTOCOL_VERSION(1, 0, 3) &&12801280- client_info->midi_version > SNDRV_SEQ_CLIENT_UMP_MIDI_2_0)12811281- return -EINVAL;12781278+ if (client->user_pversion >= SNDRV_PROTOCOL_VERSION(1, 0, 3)) {12791279+ /* check validity of midi_version field */12801280+ if (client_info->midi_version > SNDRV_SEQ_CLIENT_UMP_MIDI_2_0)12811281+ return -EINVAL;12821282+12831283+ /* check if UMP is supported in kernel */12841284+ if (!IS_ENABLED(CONFIG_SND_SEQ_UMP) &&12851285+ client_info->midi_version > 0)12861286+ return -EINVAL;12871287+ }1282128812831289 /* fill the info fields */12841290 if (client_info->name[0])
···3939 struct snd_soc_jack *jack;4040 int irq;4141 unsigned int sysclk;4242- unsigned int allowed_rates[ARRAY_SIZE(supported_mclk_lrck_ratios)];4242+ /* ES83xx supports halving the MCLK so it supports twice as many rates4343+ */4444+ unsigned int allowed_rates[ARRAY_SIZE(supported_mclk_lrck_ratios) * 2];4345 struct snd_pcm_hw_constraint_list sysclk_constraints;4446 bool jd_inverted;4547};···388386389387 if (freq % ratio == 0)390388 es8316->allowed_rates[count++] = freq / ratio;389389+390390+ /* We also check if the halved MCLK produces a valid rate391391+ * since the codec supports halving the MCLK.392392+ */393393+ if ((freq / ratio) % 2 == 0)394394+ es8316->allowed_rates[count++] = freq / ratio / 2;391395 }392396393397 if (count) {
···127127128128config SND_SOC_SAMSUNG_ARIES_WM8994129129 tristate "SoC I2S Audio support for WM8994 on Aries"130130- depends on SND_SOC_SAMSUNG && MFD_WM8994 && IIO && EXTCON130130+ depends on SND_SOC_SAMSUNG && I2C && IIO && EXTCON131131 select SND_SOC_BT_SCO132132+ select MFD_WM8994132133 select SND_SOC_WM8994133134 select SND_SAMSUNG_I2S134135 help···141140142141config SND_SOC_SAMSUNG_MIDAS_WM1811143142 tristate "SoC I2S Audio support for Midas boards"144144- depends on SND_SOC_SAMSUNG && IIO143143+ depends on SND_SOC_SAMSUNG && I2C && IIO145144 select SND_SAMSUNG_I2S145145+ select MFD_WM8994146146 select SND_SOC_WM8994147147 help148148 Say Y if you want to add support for SoC audio on the Midas boards.
+2
sound/usb/quirks.c
···22392239 QUIRK_FLAG_CTL_MSG_DELAY_1M),22402240 DEVICE_FLG(0x0c45, 0x6340, /* Sonix HD USB Camera */22412241 QUIRK_FLAG_GET_SAMPLE_RATE),22422242+ DEVICE_FLG(0x0d8c, 0x0014, /* USB Audio Device */22432243+ QUIRK_FLAG_CTL_MSG_DELAY_1M),22422244 DEVICE_FLG(0x0ecb, 0x205c, /* JBL Quantum610 Wireless */22432245 QUIRK_FLAG_FIXED_RATE),22442246 DEVICE_FLG(0x0ecb, 0x2069, /* JBL Quantum810 Wireless */