1 From 5eccee0e620b799558d89ebee29280116ad37e4f Mon Sep 17 00:00:00 2001
2 From: j-schambacher <joerg@i2audio.com>
3 Date: Mon, 27 Jan 2020 20:58:24 +0100
4 Subject: [PATCH] adds LED OFF feature to HiFiBerry DAC+/DAC+PRO sound
7 This adds a DT overlay parameter 'leds_off' which allows
8 to switch off the onboard activity LEDs at all times
9 which has been requested by some users.
11 Signed-off-by: Joerg Schambacher <joerg@i2audio.com>
13 arch/arm/boot/dts/overlays/README | 2 ++
14 .../boot/dts/overlays/hifiberry-dacplus-overlay.dts | 1 +
15 sound/soc/bcm/hifiberry_dacplus.c | 10 +++++++++-
16 3 files changed, 12 insertions(+), 1 deletion(-)
18 --- a/arch/arm/boot/dts/overlays/README
19 +++ b/arch/arm/boot/dts/overlays/README
20 @@ -906,6 +906,8 @@ Params: 24db_digital_gain Allow ga
21 that does not result in clipping/distortion!)
22 slave Force DAC+ Pro into slave mode, using Pi as
23 master for bit clock and frame clock.
24 + leds_off If set to 'true' the onboard indicator LEDs
25 + are switched off at all times.
28 Name: hifiberry-dacplusadc
29 --- a/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts
30 +++ b/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts
33 <&hifiberry_dacplus>,"hifiberry,24db_digital_gain?";
34 slave = <&hifiberry_dacplus>,"hifiberry-dacplus,slave?";
35 + leds_off = <&hifiberry_dacplus>,"hifiberry-dacplus,leds_off?";
38 --- a/sound/soc/bcm/hifiberry_dacplus.c
39 +++ b/sound/soc/bcm/hifiberry_dacplus.c
40 @@ -50,6 +50,7 @@ struct pcm512x_priv {
42 static bool snd_rpi_hifiberry_is_dacpro;
43 static bool digital_gain_0db_limit = true;
44 +static bool leds_off;
46 static void snd_rpi_hifiberry_dacplus_select_clk(struct snd_soc_component *component,
48 @@ -171,7 +172,10 @@ static int snd_rpi_hifiberry_dacplus_ini
50 snd_soc_component_update_bits(component, PCM512x_GPIO_EN, 0x08, 0x08);
51 snd_soc_component_update_bits(component, PCM512x_GPIO_OUTPUT_4, 0x0f, 0x02);
52 - snd_soc_component_update_bits(component, PCM512x_GPIO_CONTROL_1, 0x08, 0x08);
54 + snd_soc_component_update_bits(component, PCM512x_GPIO_CONTROL_1, 0x08, 0x00);
56 + snd_soc_component_update_bits(component, PCM512x_GPIO_CONTROL_1, 0x08, 0x08);
58 if (digital_gain_0db_limit)
60 @@ -251,6 +255,8 @@ static int snd_rpi_hifiberry_dacplus_sta
61 struct snd_soc_pcm_runtime *rtd = substream->private_data;
62 struct snd_soc_component *component = rtd->codec_dai->component;
66 snd_soc_component_update_bits(component, PCM512x_GPIO_CONTROL_1, 0x08, 0x08);
69 @@ -319,6 +325,8 @@ static int snd_rpi_hifiberry_dacplus_pro
70 pdev->dev.of_node, "hifiberry,24db_digital_gain");
71 slave = of_property_read_bool(pdev->dev.of_node,
72 "hifiberry-dacplus,slave");
73 + leds_off = of_property_read_bool(pdev->dev.of_node,
74 + "hifiberry-dacplus,leds_off");
77 ret = devm_snd_soc_register_card(&pdev->dev,