difos/target/linux/bcm27xx/patches-6.12/950-0744-ASoC-allo-piano-dac-plus-Fix-volume-limiting.patch
Álvaro Fernández Rojas 8f9e91ad03 bcm27xx: add 6.12 patches from RPi repo
These patches were generated from:
https://github.com/raspberrypi/linux/commits/rpi-6.12.y
With the following command:
git format-patch -N v6.12.27..HEAD
(HEAD -> 8d3206ee456a5ecdf9ddbfd8e5e231e4f0cd716e)

Exceptions:
- (def)configs patches
- github workflows patches
- applied & reverted patches
- readme patches
- wireless patches

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2025-05-21 11:32:18 +02:00

58 lines
1.9 KiB
Diff

From 37b57103df07f8bd6bf7b164174bc3004d0c8c1c Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Wed, 8 Jan 2025 15:46:30 +0000
Subject: [PATCH] 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: https://github.com/raspberrypi/linux/issues/6527
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
sound/soc/bcm/allo-piano-dac-plus.c | 26 ++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)
--- a/sound/soc/bcm/allo-piano-dac-plus.c
+++ b/sound/soc/bcm/allo-piano-dac-plus.c
@@ -734,18 +734,6 @@ static int snd_allo_piano_dac_init(struc
if (digital_gain_0db_limit) {
int ret;
- ret = snd_soc_limit_volume(card, "Master Playback Volume",
- 207);
- if (ret < 0)
- dev_warn(card->dev, "Failed to set master volume limit: %d\n",
- ret);
-
- ret = snd_soc_limit_volume(card, "Subwoofer Playback Volume",
- 207);
- if (ret < 0)
- dev_warn(card->dev, "Failed to set subwoofer volume limit: %d\n",
- ret);
-
//Set volume limit on both dacs
for (i = 0; i < ARRAY_SIZE(codec_ctl_pfx); i++) {
char cname[256];
@@ -1000,6 +988,20 @@ static int snd_allo_piano_dac_probe(stru
if (ret < 0)
return dev_err_probe(&pdev->dev, ret, "snd_soc_register_card() failed\n");
+ if (digital_gain_0db_limit) {
+ ret = snd_soc_limit_volume(card, "Master Playback Volume",
+ 207);
+ if (ret < 0)
+ dev_warn(card->dev, "Failed to set master volume limit: %d\n",
+ ret);
+
+ ret = snd_soc_limit_volume(card, "Subwoofer Playback Volume",
+ 207);
+ if (ret < 0)
+ dev_warn(card->dev, "Failed to set subwoofer volume limit: %d\n",
+ ret);
+ }
+
if ((mute_gpio[0]) && (mute_gpio[1]))
snd_allo_piano_gpio_mute(&snd_allo_piano_dac);