Skip to content

Commit 0c04855

Browse files
Stefan Bindingjfvogel
authored andcommitted
ASoC: intel/sdw_utils: Add volume limit to cs42l43 speakers
[ Upstream commit 02b44a2b2bdcee03cbb92484d31e9ca1b91b2a38 ] 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 <[email protected]> Reviewed-by: Charles Keepax <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]> Signed-off-by: Sasha Levin <[email protected]> (cherry picked from commit 5926bc887da2f044c92ec270bdc73ac9681d99fa) Signed-off-by: Jack Vogel <[email protected]>
1 parent 20d49b7 commit 0c04855

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)