summaryrefslogtreecommitdiff
path: root/sound/soc/codecs
AgeCommit message (Collapse)Author
2025-05-06ASoC: cs35l56: Add Mute, Volume and Posture registers to firmware register listStefan Binding
Registers to set Mute, Volume and Posture are inside firmware, which means they should be added to the list of registers set inside firmware, in case they vary across Device or Revision. These three registers are also used for controls, so additional handling is required to be able to obtain and set the register inside ALSA controls. Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com> Reviewed-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://patch.msgid.link/20250407151842.143393-4-sbinding@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-06ASoC: cs35l56: Add struct to index firmware registersStefan Binding
Firmware based registers may be different addresses across different device ids and revision ids. Create a structure to store and access these addresses. Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com> Reviewed-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://patch.msgid.link/20250407151842.143393-3-sbinding@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-06ASoC: cs35l56: Add Index based on ACPI HID or SDW ID to select regmap configStefan Binding
This is to prepare for further products using slightly different regmap configs. Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com> Reviewed-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://patch.msgid.link/20250407151842.143393-2-sbinding@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-05ALSA: hda/tas2781: select CONFIG_CRC8 for SND_HDA_SCODEC_TAS2781_I2CArnd Bergmann
The crc8 function is used by the common fmwlib module, so this has to be selected directly to avoid a link failure: ERROR: modpost: "crc8" [sound/soc/codecs/snd-soc-tas2781-fmwlib.ko] undefined! Fixes: 9fa6a693ad8d ("ALSA: hda/tas2781: Remove tas2781_spi_fwlib.c and leverage SND_SOC_TAS2781_FMWLIB") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Link: https://patch.msgid.link/20250505052303.1812002-1-arnd@kernel.org Signed-off-by: Takashi Iwai <tiwai@suse.de>
2025-05-02ASoC: codecs: tas2764: Fix Wvoid-pointer-to-enum-cast warningKrzysztof Kozlowski
'devid' is an enum, thus cast of pointer on 64-bit compile test with clang and W=1 causes: tas2764.c:879:19: error: cast to smaller integer type 'enum tas2764_devid' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast] One of the discussions in 2023 on LKML suggested warning is not suitable for kernel. Nothing changed in this regard for more than a year, so assume the warning will stay and we want to have warnings-free builds. Link: https://lore.kernel.org/all/20230814160457.GA2836@dev-arch.thelio-3990X/ Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://patch.msgid.link/20250427105105.18164-4-krzysztof.kozlowski@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-02ASoC: codecs: wsa88xx/wcd938x: Drop kerneldoc marker from inner commentKrzysztof Kozlowski
Drop the kerneldoc marker from a comment within a function: wsa883x.c:1402: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202504261851.TJGZIvtl-lkp@intel.com/ Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://patch.msgid.link/20250427105105.18164-3-krzysztof.kozlowski@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-01ASoC: codec: twl4030: Convert to GPIO descriptorsMark Brown
Merge series from "Peng Fan (OSS)" <peng.fan@oss.nxp.com>: This is separated from [1]. With an update that sorting the headers in a separate patch. No other changes, so I still keep Linus' R-b for Patch 2. [1] https://lore.kernel.org/all/20250408-asoc-gpio-v1-3-c0db9d3fd6e9@nxp.com/
2025-05-01ASoC: codec: sma1307: Remove including of_gpio.hPeng Fan
of_gpio.h is deprecated. And there is no user in this driver using API in of_gpio.h, so remove it. Signed-off-by: Peng Fan <peng.fan@nxp.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Link: https://patch.msgid.link/20250427055020.176099-1-peng.fan@oss.nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-01ASoC: codec: twl4030: Convert to GPIO descriptorsPeng Fan
of_gpio.h is deprecated, update the driver to use GPIO descriptors. - Use of_property_present to check "ti,hs_extmute_gpio" to set hs_extmute - if returned value is true. - Use devm_gpiod_get_optional to get GPIO descriptor, set consumer name. - Use gpiod_set_value to configure output value. While at here - drop remove hook after switching to use devm_gpiod_get_optional - Add return value for twl4030_init_chip to propagate value to parent in case defer probe happens Checking the only user logicpd-som-lv.dtsi that uses polarity GPIO_ACTIVE_HIGH, so all should work as expected. Cc: Tony Lindgren <tony@atomide.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Peng Fan <peng.fan@nxp.com> Link: https://patch.msgid.link/20250428-twl4030-v2-2-868d0d572f12@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
2025-05-01ASoC: codec: twl4030: Sort headers alphabeticallyPeng Fan
Sort headers alphabetically to easily insert new ones and drop unused ones. Signed-off-by: Peng Fan <peng.fan@nxp.com> Link: https://patch.msgid.link/20250428-twl4030-v2-1-868d0d572f12@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
2025-04-30ALSA: hda/tas2781: Remove tas2781_spi_fwlib.c and leverage ↵Shenghao Ding
SND_SOC_TAS2781_FMWLIB Most codes in tas2781_spi_fwlib.c are same as tas2781-fmwlib.c, mainly for firmware parsing, only differece is the register reading, bit update and book switching in i2c and spi. The main purpose of this patch is for code cleaup and arrange the shared part for i2c and spi. Signed-off-by: Shenghao Ding <shenghao-ding@ti.com> Acked-by: Mark Brown <broonie@kernel.org> Link: https://patch.msgid.link/20250429111055.567-1-shenghao-ding@ti.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
2025-04-30ASoC: wm_adsp: Don't use no_free_ptr() when passing to PTR_ERR()Richard Fitzgerald
It's no longer necessary to no_free_ptr() an auto-freed pointer before passing it to PTR_ERR(). This was fixed by commit cd7eb8f83fcf ("mm/slab: make __free(kfree) accept error pointers"). Removing the no_free_ptr() avoids the spurious warning "inconsistent IS_ERR and PTR_ERR". Fixes: b5d057a86e20 ("ASoC: wm_adsp: Use vmemdup_user() instead of open-coding") Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202504270751.nR3Ngfrq-lkp@intel.com/ Link: https://patch.msgid.link/20250428090803.97909-1-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2025-04-30ASoC: codecs: Use min() to simplify aw_dev_dsp_update_container()Thorsten Blum
Use min() to simplify aw_dev_dsp_update_container() and improve its readability. No functional changes intended. Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Link: https://patch.msgid.link/20250429071032.65391-2-thorsten.blum@linux.dev Signed-off-by: Mark Brown <broonie@kernel.org>
2025-04-25ASoC: codec: tpa6130a2: Convert to GPIO descriptorsMark Brown
Merge series from "Peng Fan (OSS)" <peng.fan@oss.nxp.com>: Per Mark's comments in [1], each driver in one patchset and not merge the changes to one driver in one patch, so worked out three patches. - Sort the included headers. - Drop sound/tpa6130a2-plat.h because no user is creating the device using platform data - Covert to GPIO descriptors Checking the DTS polarity, all users are using GPIOD_ACTIVE_HIGH. so all should work as expected with this patch. I not have hardware to test, just my best effort to do this. [1] https://lore.kernel.org/all/66db9962-d773-4c7a-bf59-4698eca9eedc@sirena.org.uk/
2025-04-25ASoC: codecs: wcd938x: fix mux error handlingMark Brown
Merge series from Johan Hovold <johan+linaro@kernel.org>: A recent change added support for looking up an optional mux control before falling back to gpio control for us-euro plug selection. The mux framework does however not yet support optional muxes and an error message is now incorrectly logged on machines like the Lenovo ThinkPad X13s which do not have one: wcd938x_codec audio-codec: /audio-codec: failed to get mux-control (0) Suppress the bogus error and add the missing mux error handling by making sure that the 'mux-controls' DT property is present before looking up the mux control. Included is also a related cleanup.
2025-04-24ASoC: Merge up fixesMark Brown
They have build/application dependencies for some new changes coming in.
2025-04-24ASoC: codecs: wcd938x: drop unnecessary mux flag assignmentJohan Hovold
The codec driver data is allocated using kzalloc() so there's no need to clear the mux setup flag when mux selection fails during probe. Signed-off-by: Johan Hovold <johan+linaro@kernel.org> Link: https://patch.msgid.link/20250415074145.7202-3-johan+linaro@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2025-04-24ASoC: codecs: wcd938x: fix mux error handlingJohan Hovold
A recent change added support for looking up an optional mux control before falling back to gpio control for us-euro plug selection. The mux framework does however not yet support optional muxes and an error message is now incorrectly logged on machines like the Lenovo ThinkPad X13s which do not have one: wcd938x_codec audio-codec: /audio-codec: failed to get mux-control (0) Suppress the bogus error and add the missing mux error handling by making sure that the 'mux-controls' DT property is present before looking up the mux control. Fixes: eec611d26f84 ("ASoC: codecs: wcd938x: add mux control support for hp audio mux") Link: https://lore.kernel.org/lkml/Z-z_ZAyVBK5ui50k@hovoldconsulting.com/ Signed-off-by: Johan Hovold <johan+linaro@kernel.org> Link: https://patch.msgid.link/20250415074145.7202-2-johan+linaro@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2025-04-24ASoC: codec: tpa6130a2: Convert to GPIO descriptorsPeng Fan
of_gpio.h is deprecated, update the driver to use GPIO descriptors. - Use devm_gpiod_get_optional to get GPIO descriptor with default polarity GPIOD_OUT_LOW, set consumer name. - Use gpiod_set_value to configure output value. Checking the DTS polarity, all users are using GPIOD_ACTIVE_HIGH. so all should work as expected with this patch. Cc: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Peng Fan <peng.fan@nxp.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Link: https://patch.msgid.link/20250414-asoc-tpa6130a2-v1-3-5f4052e656a0@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
2025-04-24ASoC: codec: tpa6130a2: Remove tpa6130a2_platform_dataPeng Fan
There is no in-tree user to create the device using platform data 'struct tpa6130a2_platform_data', so drop the dead code. Signed-off-by: Peng Fan <peng.fan@nxp.com> Link: https://patch.msgid.link/20250414-asoc-tpa6130a2-v1-2-5f4052e656a0@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
2025-04-24ASoC: codec: tpa6130a2: Sort headers alphabeticallyPeng Fan
Sort headers alphabetically to easily insert new ones and drop duplications. Signed-off-by: Peng Fan <peng.fan@nxp.com> Link: https://patch.msgid.link/20250414-asoc-tpa6130a2-v1-1-5f4052e656a0@nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
2025-04-23ASoC: cs42l43: Disable headphone clamps during type detectionCharles Keepax
The headphone clamps cause fairly loud pops during type detect because they sink current from the detection process itself. Disable the clamps whilst the type detect runs, to improve the detection pop performance. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://patch.msgid.link/20250423090944.1504538-1-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2025-04-22ASoC: adau7118: Allow dsp_a modeMichael Sikora
TDM mode on the adau7118 is dsp_a compatible. Set SPT_SAI_MODE on the SPT_CTRL1 register to 1 for TDM mode when the DAI is operating in dsp_a mode. Signed-off-by: Michael Sikora <michael.sikora@axis.com> Link: https://patch.msgid.link/20250411-adau7118-dsp-a-v1-1-be3fb487a6ac@axis.com Signed-off-by: Mark Brown <broonie@kernel.org>
2025-04-21ASoC: wm8998: Add Kconfig promptAndré Apitzsch
Add tristate prompt to allow codec selection. Signed-off-by: André Apitzsch <git@apitzsch.eu> Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://patch.msgid.link/20250418-wm8998-v1-1-21c4bead9cd8@apitzsch.eu Signed-off-by: Mark Brown <broonie@kernel.org>
2025-04-21ASoC: codecs: Remove unused rt566[58]_sel_asrc_clk_srcDr. David Alan Gilbert
rt5665_sel_asrc_clk_src() was added in 2016 by commit 33ada14a26c8 ("ASoC: add rt5665 codec driver") rt5668_sel_asrc_clk_src() was added in 2018 by commit d59fb2856223 ("ASoC: rt5668: add rt5668B codec driver") Neither have been used. Remove them. Signed-off-by: "Dr. David Alan Gilbert" <linux@treblig.org> Link: https://patch.msgid.link/20250420232733.182802-1-linux@treblig.org Signed-off-by: Mark Brown <broonie@kernel.org>
2025-04-21ASoC: cs48l32: Use modern PM_OPSNathan Chancellor
When building for a platform that does not support CONFIG_PM, such as s390, cs48l32_runtime_{suspend,resume}() are unused because SET_RUNTIME_PM_OPS does not reference its argument when CONFIG_PM is not set: sound/soc/codecs/cs48l32.c:3822:12: error: 'cs48l32_runtime_suspend' defined but not used [-Werror=unused-function] 3822 | static int cs48l32_runtime_suspend(struct device *dev) | ^~~~~~~~~~~~~~~~~~~~~~~ sound/soc/codecs/cs48l32.c:3779:12: error: 'cs48l32_runtime_resume' defined but not used [-Werror=unused-function] 3779 | static int cs48l32_runtime_resume(struct device *dev) | ^~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors Use RUNTIME_PM_OPS and pm_ptr() to ensure these functions are seen as used by the compiler but be dropped in the final object file when CONFIG_PM is not set, matching the current behavior while clearing up the warnings. Fixes: e2bcbf99d045 ("ASoC: cs48l32: Add driver for Cirrus Logic CS48L32 audio DSP") Signed-off-by: Nathan Chancellor <nathan@kernel.org> Reviewed-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://patch.msgid.link/20250418-cs48l32-modern-pm_ops-v1-1-640559407619@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2025-04-16ASoC: rt722: fix pop noise at the beginning of DMIC recordingShuming Fan
This patch added the PDE status check which makes sure the PDE transition is done. It will decrease the pop noise at the beginning of DMIC recording. Signed-off-by: Shuming Fan <shumingf@realtek.com> Link: https://patch.msgid.link/20250416092547.737879-1-shumingf@realtek.com Signed-off-by: Mark Brown <broonie@kernel.org>
2025-04-16ASoC: cs48l32: Fix spelling mistake "exceeeds" -> "exceeds"Colin Ian King
There is a spelling mistake in a cs48l32_fll_err message. Fix it. Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Reviewed-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://patch.msgid.link/20250416081204.36851-1-colin.i.king@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2025-04-16ASoC: ak4458: Remove useless return variableChen Ni
Remove unnecessary return variable and compress the return logic. Signed-off-by: Chen Ni <nichen@iscas.ac.cn> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://patch.msgid.link/20250416041023.546311-1-nichen@iscas.ac.cn Signed-off-by: Mark Brown <broonie@kernel.org>
2025-04-16ASoC: rt722: fix pop noise at the beginning of headphone playbackShuming Fan
This patch added the function_status check to avoid the calibration again. The codec driver reinitializes when the 'FUNCTION_NEEDS_INITIALIZATION' flag raises. Signed-off-by: Shuming Fan <shumingf@realtek.com> Link: https://patch.msgid.link/20250416092528.737845-1-shumingf@realtek.com Signed-off-by: Mark Brown <broonie@kernel.org>
2025-04-16ASoC: cs-amp-lib-test: Use faux bus instead of creating a dummy platform deviceRichard Fitzgerald
Change the code to use faux bus for the dummy codec driver device instead of creating a platform device. Also use KUnit automatic resource cleanup to destroy the device instead of doing it "manually" in a test case exit() function. Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://patch.msgid.link/20250416121604.780220-1-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2025-04-15ASoC: Add codec driver for Cirrus Logic CS48L32 DSPMark Brown
Merge series from Richard Fitzgerald <rf@opensource.cirrus.com>: formance low-power audio DSP with analog and PDM digital inputs and support for low-power always-on voice-trigger functionality. This series adds the devicetree bindings and the ASoC codec driver.
2025-04-15ASoC: cs-amp-lib-test: Use flex_array_size()Richard Fitzgerald
Use flex_array_size() when calculating the number of bytes argument to get_random_bytes(). This replaces a calculation based on passing sizeof() the expected type of the destination. Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://patch.msgid.link/20250415131837.568750-1-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2025-04-15ASoC: cs48l32: Add driver for Cirrus Logic CS48L32 audio DSPRichard Fitzgerald
Add a codec driver for the Cirrus Logic CS48L32 audio DSP. The CS48L32 is a low-power audio DSP with microphone inputs for "Always on Voice" (i.e. voice trigger) and voice command processing. It has a programmable Halo Core DSP and a variety of power-efficient fixed-function audio processors, with configurable digital mixing and routing. There are two I2S/TDM audio serial ports. Four analogue inputs are available through IN1. These feed into a 2-channel ADC through an analogue mux. There is an ALSA control for each IN1 ADC channel to select which analogue input to use. A dedicated digital mic (DMIC) PDM input is available on IN2. Two PDM outputs can feed DMIC inputs on another codec or a host DMIC/PDM input. An on-board regulator provides a power supply or bias voltage to attached microphones. Three switchable MICBIAS outputs are fed from this allowing only the microphone in use to be powered-up. There are DAPM widgets for these outputs: MICBIAS1A, MICBIAS1B and MICBIAS1C. The machine driver must create a DAPM route from the required MICBIAS1x widget to the INn input widgets to make the MICBIAS switch on when the audio input is powered-up. For example if the microphone feeding CS48L32 pin IN1LN_1 is powered from MICBIAS1A, the machine driver must create the path: (sink) IN1LN_1 <----- (source) MICBIAS1A Co-developed-by: Stuart Henderson <stuarth@opensource.cirrus.com> Signed-off-by: Stuart Henderson <stuarth@opensource.cirrus.com> Co-developed-by: Qi Zhou <qi.zhou@cirrus.com> Signed-off-by: Qi Zhou <qi.zhou@cirrus.com> Co-developed-by: Piotr Stankiewicz <piotrs@opensource.cirrus.com> Signed-off-by: Piotr Stankiewicz <piotrs@opensource.cirrus.com> Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://patch.msgid.link/20250415115016.505777-3-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2025-04-14ASoC: cs-amp-lib: Replace offsetof() with struct_size()Thorsten Blum
Use struct_size() to calculate the number of bytes to allocate and used by 'cirrus_amp_efi_data'. Compared to offsetof(), struct_size() provides additional compile-time checks (e.g., __must_be_array()). Reviewed-by: Richard Fitzgerald <rf@opensource.cirrus.com> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Link: https://patch.msgid.link/20250414114528.355204-2-thorsten.blum@linux.dev Signed-off-by: Mark Brown <broonie@kernel.org>
2025-04-14Add support for Loongson-1 AC97Mark Brown
Merge series from Keguang Zhang <keguang.zhang@gmail.com>: Add the driver and dt-binding document for Loongson-1 AC97. Add the dt-binding document for Realtek ALC203 Codec. Add DT support for the AC97 generic codec driver.
2025-04-14ASoC: convert GPIO chips to using new value settersMark Brown
Merge series from Bartosz Golaszewski <brgl@bgdev.pl>: struct gpio_chip now has callbacks for setting line values that return an integer, allowing to indicate failures. We're in the process of converting all GPIO drivers to using the new API. This series converts all ASoC GPIO controllers.
2025-04-14ASoC: Add Richtek rt9123 and rt9123p supportMark Brown
Merge series from cy_huang@richtek.com: This patch series adds Richtek rt9123 and rt9123p support. It's a 3.2W mono Class-D audio amplifier.
2025-04-14ASoC: tas27{64,70}: improve support for Apple codecMark Brown
Merge series from James Calligeros <jcalligeros99@gmail.com>: This series introduces a number of changes to the drivers for the Texas Instruments TAS2764 and TAS2770 amplifiers in order to introduce (and improve in the case of TAS2770) support for the variants of these amps found in Apple Silicon Macs. Apple's variant of TAS2764 is known as SN012776, and as always with Apple is a subtly incompatible variant with a number of quirks. It is not publicly available. The TAS2770 variant is known as TAS5770L, and does not require incompatible handling. Much as with the Cirrus codec patches, I do not expect that we will get any official acknowledgement that these parts exist from TI, however I would be delighted to be proven wrong. This series has been living in the downstream Asahi kernel tree[1] for over two years, and has been tested by many thousands of users by this point[2]. v4 drops the TDM idle TX slot behaviour patches. I experimented with the API discussed in v3, however this did not work on any of the machines I tested it with. More tweaking is probably needed. [1] https://github.com/AsahiLinux/linux/tree/asahi-wip [2] https://stats.asahilinux.org/
2025-04-14Fix up building KUnit tests for Cirrus Logic modulesMark Brown
Merge series from Richard Fitzgerald <rf@opensource.cirrus.com>: This series fixes the KConfig for cs_dsp and cs-amp-lib tests so that CONFIG_KUNIT_ALL_TESTS doesn't cause them to add modules to the build.
2025-04-13ASoC: codecs: Add support for Richtek rt9123pChiYuan Huang
Add codec driver for Richtek rt9123p. Signed-off-by: ChiYuan Huang <cy_huang@richtek.com> Link: https://patch.msgid.link/d10c08abb3e92598ce7ff3663db7dd70ec2d3c65.1744245663.git.cy_huang@richtek.com Signed-off-by: Mark Brown <broonie@kernel.org>
2025-04-13ASoC: codecs: Add support for Richtek rt9123ChiYuan Huang
Add codec driver for Richtek rt9123. Signed-off-by: ChiYuan Huang <cy_huang@richtek.com> Link: https://patch.msgid.link/f467200d7c116f5f34a3c31fafeebd9a410ab8bd.1744245663.git.cy_huang@richtek.com Signed-off-by: Mark Brown <broonie@kernel.org>
2025-04-13ASoC: tas2764: expose die temp to hwmonJames Calligeros
TAS2764 contains an ADC that reports the chip's die temperature. The temperature in degrees Celsius is yielded by subtracting 93 from the raw value reported by the ADC. Expose the codec die temperature to the hwmon interface. The chip will initialise the temperature register to 2.6 *C to avoid triggering over temp protection. As the ADC is powered down during software shutdown, this value will persist until the chip is fully powered up (e.g. when the PCM it's attached to is opened). When the chip is powered back down, the last value sampled will persist in the register. Co-developed-by: Martin Povišer <povik+lin@cutebit.org> Signed-off-by: Martin Povišer <povik+lin@cutebit.org> Signed-off-by: James Calligeros <jcalligeros99@gmail.com> Link: https://patch.msgid.link/20250406-apple-codec-changes-v5-8-50a00ec850a3@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2025-04-13ASoC: tas2770: expose die temp to hwmonJames Calligeros
TAS2770 includes an ADC which reports the chip's die temperature. As per the datasheet, the temperature in degrees Celsius is derived by taking the raw value stored in the ADC's registers, dividing by 16, then subtracting 93. Create and register a hwmon device to expose the chip's die temperature to the hwmon interface. The ADC is shut down during software shutdown mode, and its registers are initialised to 0 on reset. This means that the die temperature will read -93 *C until the chip has been fully powered up at least once (e.g. the PCM its attached to is opened). Once the chip is put into software shutdown again, the ADC will also shut down. The last value sampled before this happens will persist in the ADC's registers. Co-developed-by: Martin Povišer <povik+lin@cutebit.org> Signed-off-by: Martin Povišer <povik+lin@cutebit.org> Signed-off-by: James Calligeros <jcalligeros99@gmail.com> Link: https://patch.msgid.link/20250406-apple-codec-changes-v5-7-50a00ec850a3@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2025-04-13ASoC: tas2764: Apply Apple quirksMartin Povišer
Apple's SN012776 driver has some peculiar aspects to its behavior that are suspected to work around issues in the codec part. Add a module parameter for enabling individual quirks that should be imitated after the Apple driver. Setting some of these by default seems to be required. For example, setting 0xf fixes an issue with transient overcurrent errors which can crash the chip until the next system reboot. To be safe, let's enable all of them by default. Reviewed-by: Neal Gompa <neal@gompa.dev> Co-developed-by: Hector Martin <marcan@marcan.st> Signed-off-by: Hector Martin <marcan@marcan.st> Signed-off-by: Martin Povišer <povik+lin@cutebit.org> Co-developed-by: James Calligeros <jcalligeros99@gmail.com> Signed-off-by: James Calligeros <jcalligeros99@gmail.com> Link: https://patch.msgid.link/20250406-apple-codec-changes-v5-6-50a00ec850a3@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2025-04-13ASoC: tas2764: Raise regmap range maximumMartin Povišer
TAS2764 has a number of undocumented registers between page 0xf0 and 0xff. These are used to apply in-silicon quirks and workarounds at runtime. Raise the regmap max register to 0xffff to cover any quirks registers. Reviewed-by: Neal Gompa <neal@gompa.dev> Signed-off-by: Martin Povišer <povik+lin@cutebit.org> Signed-off-by: James Calligeros <jcalligeros99@gmail.com> Link: https://patch.msgid.link/20250406-apple-codec-changes-v5-5-50a00ec850a3@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2025-04-13ASoC: tas2764: Enable main IRQsHector Martin
IRQ handling was added in commit dae191fb957f ("ASoC: tas2764: Add IRQ handling") however that same commit masks all interrupts coming from the chip. Unmask the "main" interrupts so that we can see and deal with a number of errors including clock, voltage, and current. Fixes: dae191fb957f ("ASoC: tas2764: Add IRQ handling") Reviewed-by: Neal Gompa <neal@gompa.dev> Signed-off-by: Hector Martin <marcan@marcan.st> Signed-off-by: James Calligeros <jcalligeros99@gmail.com> Link: https://patch.msgid.link/20250406-apple-codec-changes-v5-4-50a00ec850a3@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2025-04-13ASoC: tas2764: Reinit cache on part resetMartin Povišer
When the part is reset in component_probe, do not forget to reinit the regcache, otherwise the cache can get out of sync with the part's actual state. This fix is similar to commit 0a0342ede303 ("ASoC: tas2770: Reinit regcache on reset") which concerned the tas2770 driver. Fixes: 827ed8a0fa50 ("ASoC: tas2764: Add the driver for the TAS2764") Reviewed-by: Neal Gompa <neal@gompa.dev> Signed-off-by: Martin Povišer <povik+lin@cutebit.org> Signed-off-by: James Calligeros <jcalligeros99@gmail.com> Link: https://patch.msgid.link/20250406-apple-codec-changes-v5-3-50a00ec850a3@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2025-04-13ASoC: tas2770: Support setting the PDM TX slotHector Martin
We don't actually support configuring the PDM input right now. Rather, this is useful as a hack. On Apple Silicon machines, amps are split between two I2S buses which are logically ANDed internally at the SoC. Odd and even slot groups are driven by amps on either bus respectively. Since the signals are ANDed, unused slot groups must be driven as zero to avoid corrupting the data from the other side. On most recent machines (TAS2764-based), this is accomplished using the "SDOUT zero mask" feature of that chip. Unfortunately, TAS2770 does not support this. It does support zeroing out *all* unused slots, which works well for machines with a single amp per I2S bus. That is all, except one. The 13" M1 MacBook Pro is the only machine using TAS2770 and two amps per I2S bus: L Bus: SPK0I SPK0V Hi-Z Hi-Z SPK2I SPK2V Hi-Z Hi-Z R Bus: Hi-Z Hi-Z SPK1I SPK2V Hi-Z Hi-Z SPK3I SPK3V To ensure uncorrupted data, we need to force all the Hi-Z periods to zero. We cannot use the "force all zero" feature, as that would cause a bus conflict between both amps. We can use the pull-down feature, but that leaves a few bits of garbage on the trailing edge of the speaker data, since the pull-down is weak. This is where the PDM transmit feature comes in. With PDM grounded and disabled (the default state), the PDM slot is transmitted as all zeroes. We can use that to force a zero 16-bit slot after the voltage data for each speaker, cleaning it up. Then the pull-down ensures the line stays low for the subsequent slot: L Bus: SPK0I SPK0V PDM0 PulDn SPK2I SPK2V PDM0 PulDn R Bus: PDM0 PulDn SPK1I SPK2V PDM0 PulDn SPK3I SPK3V Yes, this is a horrible hack, but it beats adding dummy slots that would be visible to the userspace capture side. There may be some other way to fix the logical AND behavior on the MCA side... that would make this unnecessary. ("How does Apple deal with this"? - they don't, macOS does not use IVSENSE on TAS2770 machines even though it's physically wired up, but we want to do so on Linux.) Reviewed-by: Neal Gompa <neal@gompa.dev> Signed-off-by: Hector Martin <marcan@marcan.st> Signed-off-by: James Calligeros <jcalligeros99@gmail.com> Link: https://patch.msgid.link/20250406-apple-codec-changes-v5-2-50a00ec850a3@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2025-04-13ASoC: tas2770: Power cycle amp on ISENSE/VSENSE changeHector Martin
The ISENSE/VSENSE blocks are only powered up when the amplifier transitions from shutdown to active. This means that if those controls are flipped on while the amplifier is already playing back audio, they will have no effect. Fix this by forcing a power cycle around transitions in those controls. Reviewed-by: Neal Gompa <neal@gompa.dev> Signed-off-by: Hector Martin <marcan@marcan.st> Signed-off-by: James Calligeros <jcalligeros99@gmail.com> Link: https://patch.msgid.link/20250406-apple-codec-changes-v5-1-50a00ec850a3@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>