Skip to content

Commit

Permalink
Added driver for the HiFiBerry DAC+ ADC (#2694)
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Matuschek <[email protected]>
  • Loading branch information
hifiberry authored and popcornmix committed Oct 15, 2018
1 parent 9a32e51 commit b4b24c6
Show file tree
Hide file tree
Showing 8 changed files with 512 additions and 0 deletions.
1 change: 1 addition & 0 deletions arch/arm/boot/dts/overlays/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
hifiberry-amp.dtbo \
hifiberry-dac.dtbo \
hifiberry-dacplus.dtbo \
hifiberry-dacplusadc.dtbo \
hifiberry-digi.dtbo \
hifiberry-digi-pro.dtbo \
hy28a.dtbo \
Expand Down
21 changes: 21 additions & 0 deletions arch/arm/boot/dts/overlays/README
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,27 @@ Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec
master for bit clock and frame clock.


Name: hifiberry-dacplusadc
Info: Configures the HifiBerry DAC+ADC audio card
Load: dtoverlay=hifiberry-dacplusadc,<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!)
slave Force DAC+ Pro into slave mode, using Pi as
master for bit clock and frame clock.


Name: hifiberry-digi
Info: Configures the HifiBerry Digi and Digi+ audio card
Load: dtoverlay=hifiberry-digi
Expand Down
71 changes: 71 additions & 0 deletions arch/arm/boot/dts/overlays/hifiberry-dacplusadc-overlay.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// Definitions for HiFiBerry DAC+ADC
/dts-v1/;
/plugin/;

/ {
compatible = "brcm,bcm2708";

fragment@0 {
target-path = "/clocks";
__overlay__ {
dacpro_osc: dacpro_osc {
compatible = "hifiberry,dacpro-clk";
#clock-cells = <0>;
};
};
};

fragment@1 {
target = <&i2s>;
__overlay__ {
status = "okay";
};
};

fragment@2 {
target = <&i2c1>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";

pcm_codec: pcm5122@4d {
#sound-dai-cells = <0>;
compatible = "ti,pcm5122";
reg = <0x4d>;
clocks = <&dacpro_osc>;
AVDD-supply = <&vdd_3v3_reg>;
DVDD-supply = <&vdd_3v3_reg>;
CPVDD-supply = <&vdd_3v3_reg>;
status = "okay";
};
};
};

fragment@3 {
target-path = "/";
__overlay__ {
dmic {
#sound-dai-cells = <0>;
compatible = "dmic-codec";
num-channels = <2>;
status = "okay";
};
};
};

fragment@4 {
target = <&sound>;
hifiberry_dacplusadc: __overlay__ {
compatible = "hifiberry,hifiberry-dacplusadc";
i2s-controller = <&i2s>;
status = "okay";
};
};

__overrides__ {
24db_digital_gain =
<&hifiberry_dacplusadc>,"hifiberry,24db_digital_gain?";
slave = <&hifiberry_dacplusadc>,"hifiberry-dacplusadc,slave?";
};
};
1 change: 1 addition & 0 deletions arch/arm/configs/bcm2709_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -894,6 +894,7 @@ CONFIG_SND_SOC=m
CONFIG_SND_BCM2835_SOC_I2S=m
CONFIG_SND_BCM2708_SOC_GOOGLEVOICEHAT_SOUNDCARD=m
CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC=m
CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUSADC=m
CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS=m
CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI=m
CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP=m
Expand Down
1 change: 1 addition & 0 deletions arch/arm/configs/bcmrpi_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,7 @@ CONFIG_SND_SOC=m
CONFIG_SND_BCM2835_SOC_I2S=m
CONFIG_SND_BCM2708_SOC_GOOGLEVOICEHAT_SOUNDCARD=m
CONFIG_SND_BCM2708_SOC_HIFIBERRY_DAC=m
CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUSADC=m
CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS=m
CONFIG_SND_BCM2708_SOC_HIFIBERRY_DIGI=m
CONFIG_SND_BCM2708_SOC_HIFIBERRY_AMP=m
Expand Down
8 changes: 8 additions & 0 deletions sound/soc/bcm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ config SND_BCM2708_SOC_HIFIBERRY_DACPLUS
help
Say Y or M if you want to add support for HifiBerry DAC+.

config SND_BCM2708_SOC_HIFIBERRY_DACPLUSADC
tristate "Support for HifiBerry DAC+ADC"
depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S
select SND_SOC_PCM512x_I2C
select SND_SOC_DMIC
help
Say Y or M if you want to add support for HifiBerry DAC+ADC.

config SND_BCM2708_SOC_HIFIBERRY_DIGI
tristate "Support for HifiBerry Digi"
depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S
Expand Down
2 changes: 2 additions & 0 deletions sound/soc/bcm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ snd-soc-googlevoicehat-codec-objs := googlevoicehat-codec.o

# BCM2708 Machine Support
snd-soc-hifiberry-dacplus-objs := hifiberry_dacplus.o
snd-soc-hifiberry-dacplusadc-objs := hifiberry_dacplusadc.o
snd-soc-justboom-dac-objs := justboom-dac.o
snd-soc-rpi-cirrus-objs := rpi-cirrus.o
snd-soc-rpi-proto-objs := rpi-proto.o
Expand All @@ -33,6 +34,7 @@ snd-soc-rpi-wm8804-soundcard-objs := rpi-wm8804-soundcard.o

obj-$(CONFIG_SND_BCM2708_SOC_GOOGLEVOICEHAT_SOUNDCARD) += snd-soc-googlevoicehat-codec.o
obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUS) += snd-soc-hifiberry-dacplus.o
obj-$(CONFIG_SND_BCM2708_SOC_HIFIBERRY_DACPLUSADC) += snd-soc-hifiberry-dacplusadc.o
obj-$(CONFIG_SND_BCM2708_SOC_JUSTBOOM_DAC) += snd-soc-justboom-dac.o
obj-$(CONFIG_SND_BCM2708_SOC_RPI_CIRRUS) += snd-soc-rpi-cirrus.o
obj-$(CONFIG_SND_BCM2708_SOC_RPI_PROTO) += snd-soc-rpi-proto.o
Expand Down
Loading

0 comments on commit b4b24c6

Please sign in to comment.