Skip to content

Commit 9147c0b

Browse files
committed
ASoC: allo-piano-dac-plus: Fix volume limiting
Controls which only exist when snd_soc_register_card returns can't be modified before then. Move the setting of volume limits to just before the end of the probe function. Link: #6527 Signed-off-by: Phil Elwell <[email protected]>
1 parent cd47d5c commit 9147c0b

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

sound/soc/bcm/allo-piano-dac-plus.c

+14-12
Original file line numberDiff line numberDiff line change
@@ -734,18 +734,6 @@ static int snd_allo_piano_dac_init(struct snd_soc_pcm_runtime *rtd)
734734
if (digital_gain_0db_limit) {
735735
int ret;
736736

737-
ret = snd_soc_limit_volume(card, "Master Playback Volume",
738-
207);
739-
if (ret < 0)
740-
dev_warn(card->dev, "Failed to set master volume limit: %d\n",
741-
ret);
742-
743-
ret = snd_soc_limit_volume(card, "Subwoofer Playback Volume",
744-
207);
745-
if (ret < 0)
746-
dev_warn(card->dev, "Failed to set subwoofer volume limit: %d\n",
747-
ret);
748-
749737
//Set volume limit on both dacs
750738
for (i = 0; i < ARRAY_SIZE(codec_ctl_pfx); i++) {
751739
char cname[256];
@@ -1000,6 +988,20 @@ static int snd_allo_piano_dac_probe(struct platform_device *pdev)
1000988
if (ret < 0)
1001989
return dev_err_probe(&pdev->dev, ret, "snd_soc_register_card() failed\n");
1002990

991+
if (digital_gain_0db_limit) {
992+
ret = snd_soc_limit_volume(card, "Master Playback Volume",
993+
207);
994+
if (ret < 0)
995+
dev_warn(card->dev, "Failed to set master volume limit: %d\n",
996+
ret);
997+
998+
ret = snd_soc_limit_volume(card, "Subwoofer Playback Volume",
999+
207);
1000+
if (ret < 0)
1001+
dev_warn(card->dev, "Failed to set subwoofer volume limit: %d\n",
1002+
ret);
1003+
}
1004+
10031005
if ((mute_gpio[0]) && (mute_gpio[1]))
10041006
snd_allo_piano_gpio_mute(&snd_allo_piano_dac);
10051007

0 commit comments

Comments
 (0)