Skip to content

Commit b4b24c6

Browse files
hifiberrypopcornmix
authored andcommitted
Added driver for the HiFiBerry DAC+ ADC (#2694)
Signed-off-by: Daniel Matuschek <[email protected]>
1 parent 9a32e51 commit b4b24c6

File tree

8 files changed

+512
-0
lines changed

8 files changed

+512
-0
lines changed

arch/arm/boot/dts/overlays/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
4141
hifiberry-amp.dtbo \
4242
hifiberry-dac.dtbo \
4343
hifiberry-dacplus.dtbo \
44+
hifiberry-dacplusadc.dtbo \
4445
hifiberry-digi.dtbo \
4546
hifiberry-digi-pro.dtbo \
4647
hy28a.dtbo \

arch/arm/boot/dts/overlays/README

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,27 @@ Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec
672672
master for bit clock and frame clock.
673673

674674

675+
Name: hifiberry-dacplusadc
676+
Info: Configures the HifiBerry DAC+ADC audio card
677+
Load: dtoverlay=hifiberry-dacplusadc,<param>=<val>
678+
Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec
679+
Digital volume control. Enable with
680+
"dtoverlay=hifiberry-dacplus,24db_digital_gain"
681+
(The default behaviour is that the Digital
682+
volume control is limited to a maximum of
683+
0dB. ie. it can attenuate but not provide
684+
gain. For most users, this will be desired
685+
as it will prevent clipping. By appending
686+
the 24dB_digital_gain parameter, the Digital
687+
volume control will allow up to 24dB of
688+
gain. If this parameter is enabled, it is the
689+
responsibility of the user to ensure that
690+
the Digital volume control is set to a value
691+
that does not result in clipping/distortion!)
692+
slave Force DAC+ Pro into slave mode, using Pi as
693+
master for bit clock and frame clock.
694+
695+
675696
Name: hifiberry-digi
676697
Info: Configures the HifiBerry Digi and Digi+ audio card
677698
Load: dtoverlay=hifiberry-digi
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
// Definitions for HiFiBerry DAC+ADC
2+
/dts-v1/;
3+
/plugin/;
4+
5+
/ {
6+
compatible = "brcm,bcm2708";
7+
8+
fragment@0 {
9+
target-path = "/clocks";
10+
__overlay__ {
11+
dacpro_osc: dacpro_osc {
12+
compatible = "hifiberry,dacpro-clk";
13+
#clock-cells = <0>;
14+
};
15+
};
16+
};
17+
18+
fragment@1 {
19+
target = <&i2s>;
20+
__overlay__ {
21+
status = "okay";
22+
};
23+
};
24+
25+
fragment@2 {
26+
target = <&i2c1>;
27+
__overlay__ {
28+
#address-cells = <1>;
29+
#size-cells = <0>;
30+
status = "okay";
31+
32+
pcm_codec: pcm5122@4d {
33+
#sound-dai-cells = <0>;
34+
compatible = "ti,pcm5122";
35+
reg = <0x4d>;
36+
clocks = <&dacpro_osc>;
37+
AVDD-supply = <&vdd_3v3_reg>;
38+
DVDD-supply = <&vdd_3v3_reg>;
39+
CPVDD-supply = <&vdd_3v3_reg>;
40+
status = "okay";
41+
};
42+
};
43+
};
44+
45+
fragment@3 {
46+
target-path = "/";
47+
__overlay__ {
48+
dmic {
49+
#sound-dai-cells = <0>;
50+
compatible = "dmic-codec";
51+
num-channels = <2>;
52+
status = "okay";
53+
};
54+
};
55+
};
56+
57+
fragment@4 {
58+
target = <&sound>;
59+
hifiberry_dacplusadc: __overlay__ {
60+
compatible = "hifiberry,hifiberry-dacplusadc";
61+
i2s-controller = <&i2s>;
62+
status = "okay";
63+
};
64+
};
65+
66+
__overrides__ {
67+
24db_digital_gain =
68+
<&hifiberry_dacplusadc>,"hifiberry,24db_digital_gain?";
69+
slave = <&hifiberry_dacplusadc>,"hifiberry-dacplusadc,slave?";
70+
};
71+
};

arch/arm/configs/bcm2709_defconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -894,6 +894,7 @@ CONFIG_SND_SOC=m
894894
CONFIG_SND_BCM2835_SOC_I2S=m
895895
CONFIG_SND_BCM2708_SOC_GOOGLEVOICEHAT_SOUNDCARD=m
896896
CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC=m
897+
CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUSADC=m
897898
CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS=m
898899
CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI=m
899900
CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP=m

arch/arm/configs/bcmrpi_defconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,7 @@ CONFIG_SND_SOC=m
888888
CONFIG_SND_BCM2835_SOC_I2S=m
889889
CONFIG_SND_BCM2708_SOC_GOOGLEVOICEHAT_SOUNDCARD=m
890890
CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC=m
891+
CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUSADC=m
891892
CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS=m
892893
CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI=m
893894
CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP=m

sound/soc/bcm/Kconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ config SND_BCM2708_SOC_HIFIBERRY_DACPLUS
4040
help
4141
Say Y or M if you want to add support for HifiBerry DAC+.
4242

43+
config SND_BCM2708_SOC_HIFIBERRY_DACPLUSADC
44+
tristate "Support for HifiBerry DAC+ADC"
45+
depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S
46+
select SND_SOC_PCM512x_I2C
47+
select SND_SOC_DMIC
48+
help
49+
Say Y or M if you want to add support for HifiBerry DAC+ADC.
50+
4351
config SND_BCM2708_SOC_HIFIBERRY_DIGI
4452
tristate "Support for HifiBerry Digi"
4553
depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S

sound/soc/bcm/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ snd-soc-googlevoicehat-codec-objs := googlevoicehat-codec.o
1313

1414
# BCM2708 Machine Support
1515
snd-soc-hifiberry-dacplus-objs := hifiberry_dacplus.o
16+
snd-soc-hifiberry-dacplusadc-objs := hifiberry_dacplusadc.o
1617
snd-soc-justboom-dac-objs := justboom-dac.o
1718
snd-soc-rpi-cirrus-objs := rpi-cirrus.o
1819
snd-soc-rpi-proto-objs := rpi-proto.o
@@ -33,6 +34,7 @@ snd-soc-rpi-wm8804-soundcard-objs := rpi-wm8804-soundcard.o
3334

3435
obj-$(CONFIG_SND_BCM2708_SOC_GOOGLEVOICEHAT_SOUNDCARD) += snd-soc-googlevoicehat-codec.o
3536
obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o
37+
obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUSADC) += snd-soc-hifiberry-dacplusadc.o
3638
obj-$(CONFIG_SND_BCM2708_SOC_JUSTBOOM_DAC) += snd-soc-justboom-dac.o
3739
obj-$(CONFIG_SND_BCM2708_SOC_RPI_CIRRUS) += snd-soc-rpi-cirrus.o
3840
obj-$(CONFIG_SND_BCM2708_SOC_RPI_PROTO) += snd-soc-rpi-proto.o

0 commit comments

Comments
 (0)