summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/wsa883x.c
AgeCommit message (Collapse)AuthorFilesLines
2024-01-22ASoC: codecs: wsa883x: fix PA volume controlJohan Hovold1-1/+5
The PA gain can be set in steps of 1.5 dB from -3 dB to 18 dB, that is, in 15 levels. Fix the dB values for the PA volume control as experiments using wsa8835 show that the first 16 levels all map to the same lowest gain while the last three map to the highest gain. These values specifically need to be correct for the sound server to provide proper volume control. Note that level 0 (-3 dB) does not mute the PA so the mute flag should also not be set. Fixes: cdb09e623143 ("ASoC: codecs: wsa883x: add control, dapm widgets and map") Cc: stable@vger.kernel.org # 6.0 Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Johan Hovold <johan+linaro@kernel.org> Link: https://msgid.link/r/20240119112420.7446-2-johan+linaro@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-10-27ASoC: codecs: wsa883x: make use of new mute_unmute_on_trigger flagSrinivas Kandagatla1-6/+1
In the current setup the PA is left unmuted even when the Soundwire ports are not started streaming. This can lead to click and pop sounds during start. There is a same issue in the reverse order where in the PA is left unmute even after the data stream is stopped, the time between data stream stopping and port closing is long enough to accumulate DC on the line resulting in Click/Pop noise during end of stream. making use of new mute_unmute_on_trigger flag is helping a lot with this Click/Pop issues reported on this Codec Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Tested-by: Johan Hovold <johan+linaro@kernel.org> Link: https://lore.kernel.org/r/20231027105747.32450-3-srinivas.kandagatla@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-07-17ASoC: wsa883x: Update to use maple tree register cacheMark Brown1-1/+1
The maple tree register cache is based on a much more modern data structure than the rbtree cache and makes optimisation choices which are probably more appropriate for modern systems than those made by the rbtree cache. In v6.5 it has also acquired the ability to generate multi-register writes in sync operations, bringing performance up to parity with the rbtree cache there. Update the wsa883x driver to use the more modern data structure. Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20230712-asoc-qcom-maple-v1-4-15f8089664b9@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-06-16ASoC: Merge fixes due to dependenciesMark Brown1-1/+0
So we can apply the tlv320aic3xxx DT conversion.
2023-06-07ASoC: codecs: wsa883x: use existing define instead of raw valueKrzysztof Kozlowski1-1/+2
Use existing define for WSA883X_GLOBAL_PA_ENABLE instead of hard-coded value, just like in other places in this driver. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20230607171326.179527-1-krzysztof.kozlowski@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-05-24ASoC: codecs: wsa883x: do not set can_multi_write flagSrinivas Kandagatla1-1/+0
regmap-sdw does not support multi register writes, so there is no point in setting this flag. This also leads to incorrect programming of WSA codecs with regmap_multi_reg_write() call. This invalid configuration should have been rejected by regmap-sdw. Fixes: 43b8c7dc85a1 ("ASoC: codecs: add wsa883x amplifier support") Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://lore.kernel.org/r/20230523154605.4284-1-srinivas.kandagatla@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-02-16Merge tag 'asoc-v6.3' of ↵Takashi Iwai1-13/+9
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-next ASoC: Updates for v6.3 There's been quite a lot of activity this release, but not really one big feature - lots of new devices, plus a lot of cleanup and modernisation work spread throughout the subsystem: - More factoring out of common operations into helper functions by Morimoto-san. - DT schema conversons and stylistic nits. - Continued work on building out the new SOF IPC4 scheme. - Support for Awinc AT88395, Infineon PEB2466, Iron Device SMA1303, Mediatek MT8188, Realtek RT712, Renesas IDT821034, Samsung/Tesla FSD SoC I2S, and TI TAS5720A-Q1.
2023-01-25ASoC: codecs: wsa88xx: remove unneeded includesKrzysztof Kozlowski1-4/+0
Remove unneeded includes from wsa881x and wsa883x drivers. The drivers do not reference anything from the headers. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20230124163953.345949-3-krzysztof.kozlowski@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-01-25ASoC: codecs: constify static sdw_port_config structKrzysztof Kozlowski1-1/+1
The struct sdw_port_config is not modified, so make it a const for code safety. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20230124163953.345949-2-krzysztof.kozlowski@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-01-25ASoC: codecs: constify static sdw_slave_ops structKrzysztof Kozlowski1-1/+1
The struct sdw_slave_ops is not modified and sdw_driver takes pointer to const, so make it a const for code safety. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20230124163953.345949-1-krzysztof.kozlowski@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-01-25ASoC: codecs: wsa883x: correct playback min/max ratesKrzysztof Kozlowski1-2/+2
Correct reversed values used in min/max rates, leading to incorrect playback constraints. Cc: <stable@vger.kernel.org> Fixes: 43b8c7dc85a1 ("ASoC: codecs: add wsa883x amplifier support") Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20230124123049.285395-1-krzysztof.kozlowski@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-01-16ASoC: codecs: wsa883x: Simplify &pdev->dev in probeKrzysztof Kozlowski1-7/+7
The probe already stores pointer to &pdev->dev, so use it to make the code a bit easier to read. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20230102114152.297305-1-krzysztof.kozlowski@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2022-11-16ASoC: codecs: wsa883x: Simplify with dev_err_probeKrzysztof Kozlowski1-12/+9
Code can be a bit simpler with dev_err_probe(). Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20221109163759.1158837-2-krzysztof.kozlowski@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2022-11-16ASoC: codecs: wsa883x: Shutdown on error pathKrzysztof Kozlowski1-0/+1
If probe fails, toggle shutdown via GPIO to save power and reverse probe actions. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20221109163759.1158837-1-krzysztof.kozlowski@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2022-11-11ASoC: codecs: wsa883x: use correct header fileRandy Dunlap1-1/+1
Fix build errors when GPIOLIB is not set/enabled: ../sound/soc/codecs/wsa883x.c: In function 'wsa883x_probe': ../sound/soc/codecs/wsa883x.c:1394:25: error: implicit declaration of function 'devm_gpiod_get_optional'; did you mean 'devm_regulator_get_optional'? [-Werror=implicit-function-declaration] wsa883x->sd_n = devm_gpiod_get_optional(&pdev->dev, "powerdown", ../sound/soc/codecs/wsa883x.c:1395:49: error: 'GPIOD_FLAGS_BIT_NONEXCLUSIVE' undeclared (first use in this function) GPIOD_FLAGS_BIT_NONEXCLUSIVE); ../sound/soc/codecs/wsa883x.c:1414:9: error: implicit declaration of function 'gpiod_direction_output'; did you mean 'gpio_direction_output'? [-Werror=implicit-function-declaration] gpiod_direction_output(wsa883x->sd_n, 1); Fixes: 43b8c7dc85a1 ("ASoC: codecs: add wsa883x amplifier support") Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Reported-by: kernel test robot <lkp@intel.com> Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Cc: Banajit Goswami <bgoswami@quicinc.com> Cc: Mark Brown <broonie@kernel.org> Cc: Liam Girdwood <lgirdwood@gmail.com> Cc: alsa-devel@alsa-project.org Cc: Jaroslav Kysela <perex@perex.cz> Cc: Takashi Iwai <tiwai@suse.com> Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://lore.kernel.org/r/20221108001829.5100-1-rdunlap@infradead.org Signed-off-by: Mark Brown <broonie@kernel.org>
2022-11-11ASoC: codecs: wsa883x: Use proper shutdown GPIO polarityKrzysztof Kozlowski1-2/+2
The shutdown GPIO is active low (SD_N), but this depends on actual board layout. Linux drivers should only care about logical state, where high (1) means shutdown and low (0) means do not shutdown. Invert the GPIO to match logical value. Fixes: 43b8c7dc85a1 ("ASoC: codecs: add wsa883x amplifier support") Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://lore.kernel.org/r/20221110133512.478831-2-krzysztof.kozlowski@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-23ASoC: codecs: wsa883x: add clock stop supportSrinivas Kandagatla1-27/+1
WSA883x does support clock stop, so remove code that reset the Codec during runtime pm suspend and add flag to mark clock stop support. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://lore.kernel.org/r/20220906170112.1984-7-srinivas.kandagatla@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2022-07-05ASoC: codecs: wsa883x: fix warning using-module-alias-sdw.cocciGaosheng Cui1-0/+2
This patch adds missing MODULE_DEVICE_TABLE definition which generates correct modalias for automatic loading of this driver when it is built as an external module. Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com> Link: https://lore.kernel.org/r/20220705005315.663920-1-cuigaosheng1@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-07-01ASoC: codecs: wsa883x: add missing break statementSrinivas Kandagatla1-0/+1
Add missing break in one of the switch statement. Reported-by: kernel test robot <lkp@intel.com> Fixes: cdb09e623143 ("ASoC: codecs: wsa883x: add control, dapm widgets and map") Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://lore.kernel.org/r/20220701125515.32332-1-srinivas.kandagatla@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2022-06-30ASoC: codecs: wsa883x: handle timeouts in resume pathSrinivas Kandagatla1-2/+9
Currently we do not check if SoundWire slave initialization timeout expired before continuing to access its registers. Its possible that the registers are not accessible if timeout is expired. Handle this by returning timeout in resume path. Reported-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Fixes: 43b8c7dc85a1 ("ASoC: codecs: add wsa883x amplifier support") Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://lore.kernel.org/r/20220630130023.9308-2-srinivas.kandagatla@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2022-06-30ASoC: codecs: wsa883x: add control, dapm widgets and mapSrinivas Kandagatla1-0/+200
Add controls, dapm widgets along with route. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://lore.kernel.org/r/20220630123633.8047-1-srinivas.kandagatla@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2022-06-29ASoC: codecs: add wsa883x amplifier supportSrinivas Kandagatla1-0/+1301
This patch adds support to WSA8830/WSA8812/WSA8835 Class-D Smart Speaker Amplifier. This Amplifier is primarily interfaced with SoundWire. This patch is tested on SM8450 MTP Board. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://lore.kernel.org/r/20220629090644.67982-3-srinivas.kandagatla@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>