Skip to content

Commit ff14af8

Browse files
j-schambacherpelwell
j-schambacher
authored andcommitted
adds LED OFF feature to HiFiBerry DAC+/DAC+PRO sound cards
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 <[email protected]>
1 parent dd2d713 commit ff14af8

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

arch/arm/boot/dts/overlays/README

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -906,6 +906,8 @@ Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec
906906
that does not result in clipping/distortion!)
907907
slave Force DAC+ Pro into slave mode, using Pi as
908908
master for bit clock and frame clock.
909+
leds_off If set to 'true' the onboard indicator LEDs
910+
are switched off at all times.
909911

910912

911913
Name: hifiberry-dacplusadc

arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,6 @@
5555
24db_digital_gain =
5656
<&hifiberry_dacplus>,"hifiberry,24db_digital_gain?";
5757
slave = <&hifiberry_dacplus>,"hifiberry-dacplus,slave?";
58+
leds_off = <&hifiberry_dacplus>,"hifiberry-dacplus,leds_off?";
5859
};
5960
};

sound/soc/bcm/hifiberry_dacplus.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ struct pcm512x_priv {
5050
static bool slave;
5151
static bool snd_rpi_hifiberry_is_dacpro;
5252
static bool digital_gain_0db_limit = true;
53+
static bool leds_off;
5354

5455
static void snd_rpi_hifiberry_dacplus_select_clk(struct snd_soc_component *component,
5556
int clk_id)
@@ -171,7 +172,10 @@ static int snd_rpi_hifiberry_dacplus_init(struct snd_soc_pcm_runtime *rtd)
171172

172173
snd_soc_component_update_bits(component, PCM512x_GPIO_EN, 0x08, 0x08);
173174
snd_soc_component_update_bits(component, PCM512x_GPIO_OUTPUT_4, 0x0f, 0x02);
174-
snd_soc_component_update_bits(component, PCM512x_GPIO_CONTROL_1, 0x08, 0x08);
175+
if (leds_off)
176+
snd_soc_component_update_bits(component, PCM512x_GPIO_CONTROL_1, 0x08, 0x00);
177+
else
178+
snd_soc_component_update_bits(component, PCM512x_GPIO_CONTROL_1, 0x08, 0x08);
175179

176180
if (digital_gain_0db_limit)
177181
{
@@ -251,6 +255,8 @@ static int snd_rpi_hifiberry_dacplus_startup(
251255
struct snd_soc_pcm_runtime *rtd = substream->private_data;
252256
struct snd_soc_component *component = rtd->codec_dai->component;
253257

258+
if (leds_off)
259+
return 0;
254260
snd_soc_component_update_bits(component, PCM512x_GPIO_CONTROL_1, 0x08, 0x08);
255261
return 0;
256262
}
@@ -319,6 +325,8 @@ static int snd_rpi_hifiberry_dacplus_probe(struct platform_device *pdev)
319325
pdev->dev.of_node, "hifiberry,24db_digital_gain");
320326
slave = of_property_read_bool(pdev->dev.of_node,
321327
"hifiberry-dacplus,slave");
328+
leds_off = of_property_read_bool(pdev->dev.of_node,
329+
"hifiberry-dacplus,leds_off");
322330
}
323331

324332
ret = devm_snd_soc_register_card(&pdev->dev,

0 commit comments

Comments
 (0)