openwrt-cghmn-mt300n/target/linux/bcm27xx/patches-6.6/950-1502-ASoC-allo-piano-dac-plus-Fix-volume-limiting.patch
Álvaro Fernández Rojas 251f76c1c6 bcm27xx: pull 6.6 patches from RPi repo
Adds latest 6.6 patches from the Raspberry Pi repository.

These patches were generated from:
https://github.com/raspberrypi/linux/commits/rpi-6.6.y/
With the following command:
git format-patch -N v6.6.83..HEAD
(HEAD -> 08d4e8f52256bd422d8a1f876411603f627d0a82)

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2025-03-16 08:04:48 +01:00

59 lines
1.9 KiB
Diff

From 4111f4ede92b1f5bf869f87c66fc39151999c42f 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);