Skip to content

Commit c5daaf3

Browse files
Stefan BindingSasha Levin
authored andcommitted
ASoC: intel/sdw_utils: Add volume limit to cs42l43 speakers
[ Upstream commit 02b44a2 ] The volume control for cs42l43 speakers has a maximum gain of +31.5 dB. However, for many use cases, this can cause distorted audio, depending various factors, such as other signal-processing elements in the chain, for example if the audio passes through a gain control before reaching the codec or the signal path has been tuned for a particular maximum gain in the codec. In the case of systems which use the soc_sdw_cs42l43 driver, audio will likely be distorted in all cases above 0 dB, therefore add a volume limit of 128, which is 0 dB maximum volume inside this driver. Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com> Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://patch.msgid.link/20250430103134.24579-2-sbinding@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent f4c5145 commit c5daaf3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

sound/soc/sdw_utils/soc_sdw_cs42l43.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
#include <sound/soc-dapm.h>
2121
#include <sound/soc_sdw_utils.h>
2222

23+
#define CS42L43_SPK_VOLUME_0DB 128 /* 0dB Max */
24+
2325
static const struct snd_soc_dapm_route cs42l43_hs_map[] = {
2426
{ "Headphone", NULL, "cs42l43 AMP3_OUT" },
2527
{ "Headphone", NULL, "cs42l43 AMP4_OUT" },
@@ -117,6 +119,14 @@ int asoc_sdw_cs42l43_spk_rtd_init(struct snd_soc_pcm_runtime *rtd, struct snd_so
117119
return -ENOMEM;
118120
}
119121

122+
ret = snd_soc_limit_volume(card, "cs42l43 Speaker Digital Volume",
123+
CS42L43_SPK_VOLUME_0DB);
124+
if (ret)
125+
dev_err(card->dev, "cs42l43 speaker volume limit failed: %d\n", ret);
126+
else
127+
dev_info(card->dev, "Setting CS42L43 Speaker volume limit to %d\n",
128+
CS42L43_SPK_VOLUME_0DB);
129+
120130
ret = snd_soc_dapm_add_routes(&card->dapm, cs42l43_spk_map,
121131
ARRAY_SIZE(cs42l43_spk_map));
122132
if (ret)

0 commit comments

Comments
 (0)