aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/sound/soc/codecs/lpass-wsa-macro.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2024-01-22ASoC: codecs: lpass-wsa-macro: fix compander volume hackJohan Hovold1-7/+0
The LPASS WSA macro codec driver is updating the digital gain settings behind the back of user space on DAPM events if companding has been enabled. As compander control is exported to user space, this can result in the digital gain setting being incremented (or decremented) every time the sound server is started and the codec suspended depending on what the UCM configuration looks like. Soon enough playback will become distorted (or too quiet). This is specifically a problem on the Lenovo ThinkPad X13s as this bypasses the limit for the digital gain setting that has been set by the machine driver. Fix this by simply dropping the compander gain offset hack. If someone cares about modelling the impact of the compander setting this can possibly be done by exporting it as a volume control later. Note that the volume registers still need to be written after enabling clocks in order for any prior updates to take effect. Fixes: 2c4066e5d428 ("ASoC: codecs: lpass-wsa-macro: add dapm widgets and route") Cc: stable@vger.kernel.org # 5.11 Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Johan Hovold <johan+linaro@kernel.org> Link: https://msgid.link/r/20240119112420.7446-4-johan+linaro@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-10-10ASoC: Merge fixes for consistent cs42l43 schemaMark Brown1-2/+2
We have adjacent changes for the cs42l43 DT schema, merge the fixes branch up so that there's a single thing for people to base future changes on.
2023-10-09ASoC: codecs: wsa-macro: fix uninitialized stack variables with name prefixKrzysztof Kozlowski1-0/+3
Driver compares widget name in wsa_macro_spk_boost_event() widget event callback, however it does not handle component's name prefix. This leads to using uninitialized stack variables as registers and register values. Handle gracefully such case. Fixes: 2c4066e5d428 ("ASoC: codecs: lpass-wsa-macro: add dapm widgets and route") Cc: stable@vger.kernel.org Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20231003155422.801160-1-krzysztof.kozlowski@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-10-09ASoC: codecs: wsa-macro: handle component name prefixKrzysztof Kozlowski1-2/+2
When comparing widget names in wsa_macro_spk_boost_event(), consider also the component's name prefix. Otherwise the WSA codec won't have proper mixer setup resulting in no sound playback through speakers. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20231003155710.821315-3-krzysztof.kozlowski@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-07-23ASoC: codecs: lpass: Log clk_get() failuresBjorn Andersson1-5/+5
The LPASS macro drivers all acquire a number of clocks, but give no indication when clk_get() fails, making it hard to identify and debug system configuration issues. Make these drivers provide useful debug information when this happens. Signed-off-by: Bjorn Andersson <quic_bjorande@quicinc.com> Reviewed-by: Andrew Halaney <ahalaney@redhat.com> Link: https://lore.kernel.org/r/20230721165027.2155528-1-quic_bjorande@quicinc.com Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-30ASoC: Merge fixesMark Brown1-2/+2
So they can be used as a basis for new work.
2023-03-28ASoC: codecs: lpass-wsa-macro: add support for SM8550Krzysztof Kozlowski1-8/+29
Add support for the WSA macro codec on Qualcomm SM8550. SM8550 does not use NPL clock, thus add flags allowing to skip it. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://lore.kernel.org/r/20230313075445.17160-9-krzysztof.kozlowski@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-23ASoC: codecs: lpass: fix the order or clks turn off during suspendSrinivas Kandagatla1-2/+2
The order in which clocks are stopped matters as some of the clock like NPL are derived from MCLK. Without this patch, Dragonboard RB5 DSP would crash with below error: qcom_q6v5_pas 17300000.remoteproc: fatal error received: ABT_dal.c:278:ABTimeout: AHB Bus hang is detected, Number of bus hang detected := 2 , addr0 = 0x3370000 , addr1 = 0x0!!! Turn off fsgen first, followed by npl and then finally mclk, which is exactly the opposite order of enable sequence. Fixes: 1dc3459009c3 ("ASoC: codecs: lpass: register mclk after runtime pm") Reported-by: Amit Pundir <amit.pundir@linaro.org> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Tested-by: Amit Pundir <amit.pundir@linaro.org> Link: https://lore.kernel.org/r/20230323110125.23790-1-srinivas.kandagatla@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-03-20ASoC: codecs: lpass-wsa-macro: Convert to platform remove callback returning voidUwe Kleine-König1-4/+2
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Acked-by: Takashi Iwai <tiwai@suse.de> Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com> Link: https://lore.kernel.org/r/20230315150745.67084-53-u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2023-02-09ASoC: codecs: lpass: remove not so useful verbose logSrinivas Kandagatla1-3/+1
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://lore.kernel.org/r/20230209122806.18923-9-srinivas.kandagatla@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-02-09ASoC: codecs: lpass: do not reset soundwire block on clk enableSrinivas Kandagatla1-7/+11
resetting soundwire block will put the slaves out of sync and result in re-enumeration during fsgen disable/enable path this is totally unnecessary and resulting fifo overflows. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://lore.kernel.org/r/20230209122806.18923-8-srinivas.kandagatla@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2023-02-09ASoC: codecs: lpass: register mclk after runtime pmSrinivas Kandagatla1-5/+4
move mclk out registration after runtime pm is enabled so that the clk framework can resume the codec if it requires to enable the mclk out. Fixes: c96baa2949b2 ("ASoC: codecs: wsa-macro: add runtime pm support") Fixes: 72ad25eabda0 ("ASoC: codecs: va-macro: add runtime pm support") Fixes: 366ff79ed539 ("ASoC: codecs: rx-macro: add runtime pm support") Fixes: 1fb83bc5cf64 ("ASoC: codecs: tx-macro: add runtime pm support") Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://lore.kernel.org/r/20230209122806.18923-6-srinivas.kandagatla@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2022-11-10ASoC: codecs: lpass-wsa-macro: parse clock-output-namesKrzysztof Kozlowski1-2/+4
If we have several instances of WSA macro, each one of them should register clock with unique name, so parse clock-output-names for this. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20221103195341.174972-2-krzysztof.kozlowski@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-23ASoC: codecs: wsa-macro: add support for sm8450 and sc8280xpSrinivas Kandagatla1-0/+2
Add compatible for sm8450 and sc8280xp. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://lore.kernel.org/r/20220906170112.1984-9-srinivas.kandagatla@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2022-09-23ASoC: codecs: wsa-macro: handle swr_reset correctlySrinivas Kandagatla1-13/+4
Reset soundwire block on frame sync generation clock reset. Without this we are hitting read/write timeouts randomly during runtime pm. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://lore.kernel.org/r/20220906170112.1984-2-srinivas.kandagatla@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2022-02-25ASoC: codecs: wsa-macro: add runtime pm supportSrinivas Kandagatla1-0/+61
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://lore.kernel.org/r/20220224111718.6264-12-srinivas.kandagatla@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2022-02-25ASoC: codecs: wsa-macro: setup soundwire clks correctlySrinivas Kandagatla1-1/+9
For SoundWire Frame sync to be generated correctly we need both MCLK and MCLKx2 (npl). Without pm runtime enabled these two clocks will remain on, however after adding pm runtime support its possible that NPl clock could be turned off even when SoundWire controller is active. Fix this by enabling mclk and npl clk when SoundWire clks are enabled. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://lore.kernel.org/r/20220224111718.6264-8-srinivas.kandagatla@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2022-02-25ASoC: codecs: wsa-macro: move to individual clks from bulkSrinivas Kandagatla1-22/+66
Using bulk clocks and referencing them individually using array index is not great for readers. So move them to individual clocks handling and also remove some unnecessary error handling in the code. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://lore.kernel.org/r/20220224111718.6264-7-srinivas.kandagatla@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2022-01-24ASoC: codecs: Check for error pointer after calling devm_regmap_init_mmioJiasheng Jiang1-0/+2
Since the potential failure of the devm_regmap_init_mmio(), it will return error pointer and be assigned to the regmap. Then the error pointer will be dereferenced. For example rx->regmap will be used in rx_macro_mclk_enable(). Therefore, it should be better to check it. Fixes: af3d54b99764 ("ASoC: codecs: lpass-rx-macro: add support for lpass rx macro") Fixes: c39667ddcfc5 ("ASoC: codecs: lpass-tx-macro: add support for lpass tx macro") Fixes: 809bcbcecebf ("ASoC: codecs: lpass-wsa-macro: Add support to WSA Macro") Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn> Link: https://lore.kernel.org/r/20220121171031.2826198-1-jiasheng@iscas.ac.cn Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-26ASoC: qcom: Add compatible names in va,wsa,rx,tx codec drivers for sc7280Srinivasa Rao Mandadapu1-0/+1
Add compatible names for sc7280 based targets in digital codec drivers va,wsa,rx and tx. Signed-off-by: Srinivasa Rao Mandadapu <srivasam@codeaurora.org> Co-developed-by: Venkata Prasad Potturu <potturu@codeaurora.org> Signed-off-by: Venkata Prasad Potturu <potturu@codeaurora.org> Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Tested-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://lore.kernel.org/r/1635234188-7746-2-git-send-email-srivasam@codeaurora.org Signed-off-by: Mark Brown <broonie@kernel.org>
2021-05-10ASoC: codecs: lpass-wsa-macro: handle unexpected inputTom Rix1-0/+4
Static analysis reports this problem lpass-wsa-macro.c:1732:6: warning: Array subscript is undefined if (wsa->ec_hq[ec_tx]) { ^~~~~~~~~~~~~~~~~ The happens because 'ec_tx' is never initialized and there is no default in switch statement that sets ec_tx. Add a default case that returns an error before the array is accessed. Signed-off-by: Tom Rix <trix@redhat.com> Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://lore.kernel.org/r/20210430142117.3272772-1-trix@redhat.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-23ASoC: lpass: use the clock provider APIJerome Brunet1-8/+3
Clock providers should be registered using the clk_hw API. Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> Link: https://lore.kernel.org/r/20210421120512.413057-5-jbrunet@baylibre.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-09ASoC: codecs: lpass-wsa-macro: constify static struct snd_soc_dai_opsYe Bin1-1/+1
The snd_soc_dai_ops structures is only stored in the ops field of a snd_soc_dai_driver structure, so make the snd_soc_dai_ops structure const to allow the compiler to put it in read-only memory. Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Ye Bin <yebin10@huawei.com> Link: https://lore.kernel.org/r/20210408062642.802846-1-yebin10@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-10ASoC: lpass-wsa-macro: add missing testPierre-Louis Bossart1-0/+2
cppcheck warning: sound/soc/codecs/lpass-wsa-macro.c:958:6: style: Variable 'ret' is reassigned a value before the old one has been used. [redundantAssignment] ret = wsa_macro_set_prim_interpolator_rate(dai, (u8) rate_val, sample_rate); ^ sound/soc/codecs/lpass-wsa-macro.c:946:6: note: ret is assigned ret = wsa_macro_set_mix_interpolator_rate(dai, (u8) rate_val, sample_rate); ^ sound/soc/codecs/lpass-wsa-macro.c:958:6: note: ret is overwritten ret = wsa_macro_set_prim_interpolator_rate(dai, (u8) rate_val, sample_rate); ^ set_mix_interpolator_rate can return -EINVAL, add a test and bail on error. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://lore.kernel.org/r/20210218222916.89809-11-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-10ASoC: codecs: lpass-wsa-macro: fix RX MIX input controlsJonathan Marek1-9/+11
Attempting to use the RX MIX path at 48kHz plays at 96kHz, because these controls are incorrectly toggling the first bit of the register, which is part of the FS_RATE field. Fix the problem by using the same method used by the "WSA RX_MIX EC0_MUX" control, which is to use SND_SOC_NOPM as the register and use an enum in the shift field instead. Fixes: 2c4066e5d428 ("ASoC: codecs: lpass-wsa-macro: add dapm widgets and route") Signed-off-by: Jonathan Marek <jonathan@marek.ca> Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://lore.kernel.org/r/20210305005049.24726-1-jonathan@marek.ca Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-27ASoC: codecs: lpass-wsa-macro: make use of snd_soc_component_read_field()Srinivas Kandagatla1-23/+20
Make use of snd_soc_component_read_field() to make the code more readable! Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://lore.kernel.org/r/20210126171749.1863-2-srinivas.kandagatla@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-19ASoC: codecs: lpass-wsa-macro: add dapm widgets and routeSrinivas Kandagatla1-0/+1081
This patch adds dapm widgets and routes on this codec Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20201105113458.12360-4-srinivas.kandagatla@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-19ASoC: codecs: lpass-wsa-macro: Add support to WSA MacroSrinivas Kandagatla1-0/+1383
Qualcomm LPASS (Low Power Audio SubSystem) has internal codec WSA macro block which is used for connecting with WSA Smart speakers over soundwire. This patch adds support to the codec part of the WSA Macro block. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20201105113458.12360-3-srinivas.kandagatla@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>