summaryrefslogtreecommitdiff
path: root/target/linux/brcm2708/patches-4.4/0141-Limit-PCM512x-Digital-gain-to-0dB-by-default-with-Hi.patch
diff options
context:
space:
mode:
authorÁlvaro Fernández Rojas <noltari@gmail.com>2016-04-07 21:25:10 +0200
committerÁlvaro Fernández Rojas <noltari@gmail.com>2016-04-07 21:25:10 +0200
commita8d4d71c41ff0158c2026cac5981e39702167da9 (patch)
tree0c54ec3eb59f5bab6aa7318d14c92ff875412202 /target/linux/brcm2708/patches-4.4/0141-Limit-PCM512x-Digital-gain-to-0dB-by-default-with-Hi.patch
parent59e0e88c22007fd77ee9c6c8e02a689889a5f597 (diff)
downloadmtk-20170518-a8d4d71c41ff0158c2026cac5981e39702167da9.zip
mtk-20170518-a8d4d71c41ff0158c2026cac5981e39702167da9.tar.gz
mtk-20170518-a8d4d71c41ff0158c2026cac5981e39702167da9.tar.bz2
brcm2708: update to latest version
As usual these patches were extracted from the raspberry pi repo: https://github.com/raspberrypi/linux/commits/rpi-4.4.y Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Diffstat (limited to 'target/linux/brcm2708/patches-4.4/0141-Limit-PCM512x-Digital-gain-to-0dB-by-default-with-Hi.patch')
-rw-r--r--target/linux/brcm2708/patches-4.4/0141-Limit-PCM512x-Digital-gain-to-0dB-by-default-with-Hi.patch98
1 files changed, 98 insertions, 0 deletions
diff --git a/target/linux/brcm2708/patches-4.4/0141-Limit-PCM512x-Digital-gain-to-0dB-by-default-with-Hi.patch b/target/linux/brcm2708/patches-4.4/0141-Limit-PCM512x-Digital-gain-to-0dB-by-default-with-Hi.patch
new file mode 100644
index 0000000..cc28de8
--- /dev/null
+++ b/target/linux/brcm2708/patches-4.4/0141-Limit-PCM512x-Digital-gain-to-0dB-by-default-with-Hi.patch
@@ -0,0 +1,98 @@
+From 6fda328fc5613d449641ad6701fe8180e70ec338 Mon Sep 17 00:00:00 2001
+From: Digital Dreamtime <clive.messer@digitaldreamtime.co.uk>
+Date: Thu, 4 Feb 2016 20:04:00 +0000
+Subject: [PATCH 141/232] Limit PCM512x "Digital" gain to 0dB by default with
+ HiFiBerry DAC+
+
+24db_digital_gain DT param can be used to specify that PCM512x
+codec "Digital" volume control should not be limited to 0dB gain,
+and if specified will allow the full 24dB gain.
+---
+ arch/arm/boot/dts/overlays/README | 17 +++++++++++++++--
+ .../arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts | 6 +++++-
+ sound/soc/bcm/hifiberry_dacplus.c | 14 ++++++++++++++
+ 3 files changed, 34 insertions(+), 3 deletions(-)
+
+--- a/arch/arm/boot/dts/overlays/README
++++ b/arch/arm/boot/dts/overlays/README
+@@ -273,8 +273,21 @@ Params: <None>
+
+ Name: hifiberry-dacplus
+ Info: Configures the HifiBerry DAC+ audio card
+-Load: dtoverlay=hifiberry-dacplus
+-Params: <None>
++Load: dtoverlay=hifiberry-dacplus,<param>=<val>
++Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec
++ Digital volume control. Enable with
++ "dtoverlay=hifiberry-dacplus,24db_digital_gain"
++ (The default behaviour is that the Digital
++ volume control is limited to a maximum of
++ 0dB. ie. it can attenuate but not provide
++ gain. For most users, this will be desired
++ as it will prevent clipping. By appending
++ the 24dB_digital_gain parameter, the Digital
++ volume control will allow up to 24dB of
++ gain. If this parameter is enabled, it is the
++ responsibility of the user to ensure that
++ the Digital volume control is set to a value
++ that does not result in clipping/distortion!)
+
+
+ Name: hifiberry-digi
+--- a/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts
++++ b/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts
+@@ -17,7 +17,7 @@
+
+ fragment@1 {
+ target = <&sound>;
+- __overlay__ {
++ frag1: __overlay__ {
+ compatible = "hifiberry,hifiberry-dacplus";
+ i2s-controller = <&i2s>;
+ status = "okay";
+@@ -47,4 +47,8 @@
+ };
+ };
+ };
++
++ __overrides__ {
++ 24db_digital_gain = <&frag1>,"hifiberry,24db_digital_gain?";
++ };
+ };
+--- a/sound/soc/bcm/hifiberry_dacplus.c
++++ b/sound/soc/bcm/hifiberry_dacplus.c
+@@ -48,6 +48,7 @@ struct pcm512x_priv {
+ #define CLK_48EN_RATE 24576000UL
+
+ static bool snd_rpi_hifiberry_is_dacpro;
++static bool digital_gain_0db_limit = true;
+
+ static void snd_rpi_hifiberry_dacplus_select_clk(struct snd_soc_codec *codec,
+ int clk_id)
+@@ -167,6 +168,16 @@ static int snd_rpi_hifiberry_dacplus_ini
+ snd_soc_update_bits(codec, PCM512x_GPIO_OUTPUT_4, 0x0f, 0x02);
+ snd_soc_update_bits(codec, PCM512x_GPIO_CONTROL_1, 0x08, 0x08);
+
++ if (digital_gain_0db_limit)
++ {
++ int ret;
++ struct snd_soc_card *card = rtd->card;
++
++ ret = snd_soc_limit_volume(card, "Digital Playback Volume", 207);
++ if (ret < 0)
++ dev_warn(card->dev, "Failed to set volume limit: %d\n", ret);
++ }
++
+ return 0;
+ }
+
+@@ -299,6 +310,9 @@ static int snd_rpi_hifiberry_dacplus_pro
+ dai->platform_name = NULL;
+ dai->platform_of_node = i2s_node;
+ }
++
++ digital_gain_0db_limit = !of_property_read_bool(
++ pdev->dev.of_node, "hifiberry,24db_digital_gain");
+ }
+
+ ret = snd_soc_register_card(&snd_rpi_hifiberry_dacplus);