f07e572f64
bcm2708: boot tested on RPi B+ v1.2 bcm2709: boot tested on RPi 3B v1.2 and RPi 4B v1.1 4G bcm2710: boot tested on RPi 3B v1.2 bcm2711: boot tested on RPi 4B v1.1 4G Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
90 lines
3.7 KiB
Diff
90 lines
3.7 KiB
Diff
From 4a773d6535c3386044490156264ebd2a3b1bc38b Mon Sep 17 00:00:00 2001
|
|
From: j-schambacher <joerg@i2audio.com>
|
|
Date: Mon, 27 Jan 2020 17:45:51 +0100
|
|
Subject: [PATCH] adds LED OFF feature to HiFiBerry DAC+ADC PRO sound
|
|
card
|
|
|
|
This adds a DT overlay parameter 'leds_off' which allows
|
|
to switch off the onboard activity LEDs at all times
|
|
which has been requested by some users.
|
|
|
|
Signed-off-by: Joerg Schambacher <joerg@i2audio.com>
|
|
---
|
|
arch/arm/boot/dts/overlays/README | 2 ++
|
|
.../overlays/hifiberry-dacplusadcpro-overlay.dts | 1 +
|
|
sound/soc/bcm/hifiberry_dacplusadcpro.c | 15 +++++++++++++--
|
|
3 files changed, 16 insertions(+), 2 deletions(-)
|
|
|
|
--- a/arch/arm/boot/dts/overlays/README
|
|
+++ b/arch/arm/boot/dts/overlays/README
|
|
@@ -948,6 +948,8 @@ Params: 24db_digital_gain Allow ga
|
|
that does not result in clipping/distortion!)
|
|
slave Force DAC+ADC Pro into slave mode, using Pi as
|
|
master for bit clock and frame clock.
|
|
+ leds_off If set to 'true' the onboard indicator LEDs
|
|
+ are switched off at all times.
|
|
|
|
|
|
Name: hifiberry-dacplusdsp
|
|
--- a/arch/arm/boot/dts/overlays/hifiberry-dacplusadcpro-overlay.dts
|
|
+++ b/arch/arm/boot/dts/overlays/hifiberry-dacplusadcpro-overlay.dts
|
|
@@ -60,5 +60,6 @@
|
|
24db_digital_gain =
|
|
<&hifiberry_dacplusadcpro>,"hifiberry-dacplusadcpro,24db_digital_gain?";
|
|
slave = <&hifiberry_dacplusadcpro>,"hifiberry-dacplusadcpro,slave?";
|
|
+ leds_off = <&hifiberry_dacplusadcpro>,"hifiberry-dacplusadcpro,leds_off?";
|
|
};
|
|
};
|
|
--- a/sound/soc/bcm/hifiberry_dacplusadcpro.c
|
|
+++ b/sound/soc/bcm/hifiberry_dacplusadcpro.c
|
|
@@ -54,6 +54,7 @@ struct pcm512x_priv {
|
|
static bool slave;
|
|
static bool snd_rpi_hifiberry_is_dacpro;
|
|
static bool digital_gain_0db_limit = true;
|
|
+static bool leds_off;
|
|
|
|
static const unsigned int pcm186x_adc_input_channel_sel_value[] = {
|
|
0x00, 0x01, 0x02, 0x03, 0x10
|
|
@@ -321,7 +322,10 @@ static int snd_rpi_hifiberry_dacplusadcp
|
|
|
|
snd_soc_component_update_bits(dac, PCM512x_GPIO_EN, 0x08, 0x08);
|
|
snd_soc_component_update_bits(dac, PCM512x_GPIO_OUTPUT_4, 0x0f, 0x02);
|
|
- snd_soc_component_update_bits(dac, PCM512x_GPIO_CONTROL_1, 0x08, 0x08);
|
|
+ if (leds_off)
|
|
+ snd_soc_component_update_bits(dac, PCM512x_GPIO_CONTROL_1, 0x08, 0x00);
|
|
+ else
|
|
+ snd_soc_component_update_bits(dac, PCM512x_GPIO_CONTROL_1, 0x08, 0x08);
|
|
|
|
ret = pcm1863_add_controls(adc);
|
|
if (ret < 0)
|
|
@@ -331,7 +335,10 @@ static int snd_rpi_hifiberry_dacplusadcp
|
|
/* set GPIO2 to output, GPIO3 input */
|
|
snd_soc_component_write(adc, PCM186X_GPIO3_2_CTRL, 0x00);
|
|
snd_soc_component_write(adc, PCM186X_GPIO3_2_DIR_CTRL, 0x04);
|
|
- snd_soc_component_update_bits(adc, PCM186X_GPIO_IN_OUT, 0x40, 0x40);
|
|
+ if (leds_off)
|
|
+ snd_soc_component_update_bits(adc, PCM186X_GPIO_IN_OUT, 0x40, 0x00);
|
|
+ else
|
|
+ snd_soc_component_update_bits(adc, PCM186X_GPIO_IN_OUT, 0x40, 0x40);
|
|
|
|
if (digital_gain_0db_limit) {
|
|
int ret;
|
|
@@ -417,6 +424,8 @@ static int snd_rpi_hifiberry_dacplusadcp
|
|
struct snd_soc_component *dac = rtd->codec_dais[0]->component;
|
|
struct snd_soc_component *adc = rtd->codec_dais[1]->component;
|
|
|
|
+ if (leds_off)
|
|
+ return 0;
|
|
/* switch on respective LED */
|
|
if (!substream->stream)
|
|
snd_soc_component_update_bits(dac, PCM512x_GPIO_CONTROL_1, 0x08, 0x08);
|
|
@@ -500,6 +509,8 @@ static int snd_rpi_hifiberry_dacplusadcp
|
|
pdev->dev.of_node, "hifiberry-dacplusadcpro,24db_digital_gain");
|
|
slave = of_property_read_bool(pdev->dev.of_node,
|
|
"hifiberry-dacplusadcpro,slave");
|
|
+ leds_off = of_property_read_bool(pdev->dev.of_node,
|
|
+ "hifiberry-dacplusadcpro,leds_off");
|
|
ret = snd_soc_register_card(&snd_rpi_hifiberry_dacplusadcpro);
|
|
if (ret && ret != -EPROBE_DEFER)
|
|
dev_err(&pdev->dev,
|