summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/wcd939x.c
AgeCommit message (Collapse)Author
2025-06-23ASoC: codecs: wcd939x: Add defines for major/minor version decodingKrzysztof Kozlowski
Replace hard-coded register values with defines for checking major and minor versions of device. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://patch.msgid.link/20250616-asoc-wcd93xx-enum-v1-4-a20a1b538509@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2025-06-23ASoC: codecs: wcd939x: Use simple defines for chipid register valueKrzysztof Kozlowski
The value used to identify chip variant is not an enumeration, but raw value used to compare registers with. The 'enum' is not used in the code at all, so simplify and make it a raw hex value define, so intention will be explicit. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://patch.msgid.link/20250616-asoc-wcd93xx-enum-v1-3-a20a1b538509@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2025-06-09ASoC: codecs: More const and unused member cleanupsMark Brown
Merge series from Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>: Make static data const for code safety and drop some unused fields in structs.
2025-06-08ASoC: codecs: wcd939x: Add VDD_PX supplyKrzysztof Kozlowski
Device has also VDD_PX supply, which should be acquired by the driver. Regulator framework will provide a dummy supply, thus the change is compatible with older DTS. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://patch.msgid.link/20250526-b4-asoc-wcd9395-vdd-px-v1-6-64d3cb60313b@linaro.org Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2025-06-08ASoC: codecs: wcd939x: Simplify return from devm_gpiod_get() errorKrzysztof Kozlowski
No need to store devm_gpiod_get() error code in temporary variable. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://patch.msgid.link/20250526-b4-asoc-wcd9395-vdd-px-v1-4-64d3cb60313b@linaro.org Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2025-06-08ASoC: codecs: wcd939x: Simplify with devm_regulator_bulk_get_enable()Krzysztof Kozlowski
Drop separate regulator get and enable in probe() path with devm_regulator_bulk_get_enable(), which simplifies cleanup paths and device remove(). Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://patch.msgid.link/20250526-b4-asoc-wcd9395-vdd-px-v1-3-64d3cb60313b@linaro.org Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2025-06-08ASoC: codecs: wcd939x: Drop unused 'struct wcd939x_priv' fieldsKrzysztof Kozlowski
'wcd_regmap_irq_chip' and 'jack' in 'struct wcd939x_priv' are not used at all. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com> Link: https://patch.msgid.link/20250528-asoc-const-unused-v1-8-19a5d07b9d5c@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2025-04-08ASoC: wcd938x: enable t14s audio headsetMark Brown
Merge series from srinivas.kandagatla@linaro.org: On Lenovo ThinkPad T14s, the headset is connected via a HiFi Switch to support CTIA and OMTP headsets. This switch is used to minimise pop and click during headset type switching. This patchset adds required bindings and changes to codec and dts to tnable the regulator required to power this switch along with wiring up gpio that control the headset switching. Without this patchset, there will be lots of noise on headset and mic will not we functional.
2025-04-06ASoC: codecs: wcd-mbhc: cleanup swap_gnd_mic apiSrinivas Kandagatla
Remove confusing and unused argument in swap_gnd_mic api, the second argument active is not really used, and always set to true in the mbhc drivers. The callback itself is used to toggle the gnd_mic lines when a cross connection is detected by mbhc circuits, so there is no need of this argument. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Link: https://patch.msgid.link/20250327100633.11530-4-srinivas.kandagatla@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2025-04-06ASoC: codec: wcd939x: Convert to GPIO descriptorsPeng Fan
of_gpio.h is deprecated, update the driver to use GPIO descriptors. - Use dev_gpiod_get to get GPIO descriptor. - Use gpiod_set_value to configure output value. With legacy of_gpio API, the driver set gpio value 0 to assert reset, and 1 to deassert reset. And the reset-gpios use GPIO_ACTIVE_LOW flag in DTS, so set GPIOD_OUT_LOW when get GPIO descriptors, and set value 1 means output low, set value 0 means output high with gpiod API. The in-tree DTS files have the right polarity set up already so we can expect this to "just work". Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Peng Fan <peng.fan@nxp.com> Link: https://patch.msgid.link/20250324-wcd-gpiod-v2-1-773f67ce3b56@nxp.com Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2025-03-19irqdomain: sound: Switch to irq_domain_create_linear()Jiri Slaby (SUSE)
irq_domain_add_linear() is going away as being obsolete now. Switch to the preferred irq_domain_create_linear(). That differs in the first parameter: It takes more generic struct fwnode_handle instead of struct device_node. Therefore, of_fwnode_handle() is added around the parameter. Note some of the users can likely use dev->fwnode directly instead of indirect of_fwnode_handle(dev->of_node). But dev->fwnode is not guaranteed to be set for all, so this has to be investigated on case to case basis (by people who can actually test with the HW). Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org> Cc: Liam Girdwood <lgirdwood@gmail.com> Cc: Mark Brown <broonie@kernel.org> Cc: Jaroslav Kysela <perex@perex.cz> Cc: Takashi Iwai <tiwai@suse.com> Cc: Prasad Kumpatla <quic_pkumpatl@quicinc.com> Cc: linux-sound@vger.kernel.org Link: https://patch.msgid.link/20250319092951.37667-36-jirislaby@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2024-09-09ASoC: Switch back to struct platform_driver::remove()Uwe Kleine-König
After commit 0edb555a65d1 ("platform: Make platform_driver::remove() return void") .remove() is (again) the right callback to implement for platform drivers. Convert all drivers below sound/soc to use .remove(), with the eventual goal to drop struct platform_driver::remove_new(). As .remove() and .remove_new() have the same prototypes, conversion is done by just changing the structure member name in the driver initializer. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com> Link: https://patch.msgid.link/20240909151230.909818-2-u.kleine-koenig@baylibre.com Signed-off-by: Mark Brown <broonie@kernel.org>
2024-07-04ASoC: codecs: wcd939x: Fix typec mux and switch leak during device removalKrzysztof Kozlowski
Driver does not unregister typec structures (typec_mux_dev and typec_switch_desc) during removal leading to leaks. Fix this by moving typec registering parts to separate function and using devm interface to release them. This also makes code a bit simpler: - Smaller probe() function with less error paths and no #ifdefs, - No need to store typec_mux_dev and typec_switch_desc in driver state container structure. Cc: stable@vger.kernel.org Fixes: 10f514bd172a ("ASoC: codecs: Add WCD939x Codec driver") Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Link: https://patch.msgid.link/20240701122616.414158-1-krzysztof.kozlowski@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2024-06-18ASoC: codecs: wcd939x: Constify wcd939x_sdw_ch_infoKrzysztof Kozlowski
Driver does not modify static wcd939x_sdw_ch_info array, so it can be made const for code safety. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Link: https://msgid.link/r/20240612-asoc-wcd9xxx-wide-cleanups-v1-21-0d15885b2a06@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2024-06-18ASoC: codecs: wcd939x: Constify static dataKrzysztof Kozlowski
Driver does not modify few static data (MBHC reg fields, IRQ chip), so make them const for code safety. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Link: https://msgid.link/r/20240612-asoc-wcd9xxx-wide-cleanups-v1-20-0d15885b2a06@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2024-06-03ASoC: codecs: wcd939x: Unify define used for MIC bias VOUT registersKrzysztof Kozlowski
All four microphone bias registers have similar layout: VOUT control mask is exactly the same. Use one define, just like older driver wcd938x is doing, to make the code a bit simpler. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://msgid.link/r/20240523125049.43713-1-krzysztof.kozlowski@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2024-05-27ASoC: codecs: wcd939x: Minor white-space and define cleanupKrzysztof Kozlowski
Correct white-space issues and drop unused WCD939X_MBHC_IS_SECOND_RAMP_REQUIRED() define. No functional impact. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://msgid.link/r/20240523104228.36263-4-krzysztof.kozlowski@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2024-05-27ASoC: codecs: wcd939x: Unify define used for MIC bias registersKrzysztof Kozlowski
All four microphone bias registers have similar layout: enable mask is exactly the same. Use one define, just like older driver wcd938x is doing, to make the code a bit simpler. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://msgid.link/r/20240523104228.36263-3-krzysztof.kozlowski@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2024-01-24ASoC: codecs: Remove unneeded semicolonYang Li
In the wcd939x codec driver, there are two instances where semicolons are used after closing braces of a switch-case statement. These semicolons are not required and do not adhere to the coding style guidelines. This patch removes the unnecessary semicolons at the end of the switch-case statements which cleans up the code and ensures consistency with the rest of the kernel coding style. Signed-off-by: Yang Li <yang.lee@linux.alibaba.com> Link: https://msgid.link/r/20240124004425.54020-1-yang.lee@linux.alibaba.com Signed-off-by: Mark Brown <broonie@kernel.org>
2024-01-22ASoC: codecs: Add WCD939x Codec driverNeil Armstrong
Add the main WCD9390/WCD9395 Audio Codec driver to support: - 4 ADC inputs for up to 5 Analog Microphones - 4 DMIC inputs for up to 8 Digital Microphones - 4 Microphone BIAS - Stereo Headphone output - Mono EAR output - MBHC engine for Headset Detection It makes usage of the generic MBHC and CLSH generic code and the USB Type-C mux and switch helpers to gather USB-C Events in order to properly setup Headset Detection mechanism when connected behind the separate USB-C Mux subsystem. WCD9390/WCD9395 supports a PCM path for Playback instead of the actually implemented PDM playback, it will be implemented later. Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> Link: https://msgid.link/r/20231219-topic-sm8650-upstream-wcd939x-codec-v4-5-1c3bbff2d7ab@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>