From 9e31e8ce44ef11cabcb1b95830e1fdd8a9655ad3 Mon Sep 17 00:00:00 2001 From: j-schambacher Date: Mon, 11 Mar 2024 15:32:28 +0100 Subject: [PATCH 1290/1295] Overlays:Add specific clk-producer/-consumer overlays for Hifiberry DAC+ As the easy switching of the I2S module bewteen clock producer/consumer on the PI5 is not possible, two specific DT-overlays are introduced. The DAC+PRO boards with onboard clocks use the -PRO overlay, the boards without oscillators the -STD version. The "hifiberry-dacplus,slave" parameter in the -STD overlay disables the automatic clock detection inside the hifiberry-dacplus driver. The former hifiberry-dacplus overlay is kept for compatibility but will be deprecated. Signed-off-by: j-schambacher --- arch/arm/boot/dts/overlays/Makefile | 2 + arch/arm/boot/dts/overlays/README | 42 ++++++++++++ .../hifiberry-dacplus-pro-overlay.dts | 64 ++++++++++++++++++ .../hifiberry-dacplus-std-overlay.dts | 65 +++++++++++++++++++ 4 files changed, 173 insertions(+) create mode 100644 arch/arm/boot/dts/overlays/hifiberry-dacplus-pro-overlay.dts create mode 100644 arch/arm/boot/dts/overlays/hifiberry-dacplus-std-overlay.dts --- a/arch/arm/boot/dts/overlays/Makefile +++ b/arch/arm/boot/dts/overlays/Makefile @@ -90,6 +90,8 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \ hifiberry-dac.dtbo \ hifiberry-dac8x.dtbo \ hifiberry-dacplus.dtbo \ + hifiberry-dacplus-pro.dtbo \ + hifiberry-dacplus-std.dtbo \ hifiberry-dacplusadc.dtbo \ hifiberry-dacplusadcpro.dtbo \ hifiberry-dacplusdsp.dtbo \ --- a/arch/arm/boot/dts/overlays/README +++ b/arch/arm/boot/dts/overlays/README @@ -1801,6 +1801,48 @@ Params: 24db_digital_gain Allow ga are switched off at all times. +Name: hifiberry-dacplus-pro +Info: Configures the HifiBerry DAC+ PRO audio card (onboard clocks) +Load: dtoverlay=hifiberry-dacplus-pro,= +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!) + leds_off If set to 'true' the onboard indicator LEDs + are switched off at all times. + + +Name: hifiberry-dacplus-std +Info: Configures the HifiBerry DAC+ standard audio card (no onboard clocks) +Load: dtoverlay=hifiberry-dacplus-std,= +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!) + leds_off If set to 'true' the onboard indicator LEDs + are switched off at all times. + + Name: hifiberry-dacplusadc Info: Configures the HifiBerry DAC+ADC audio card Load: dtoverlay=hifiberry-dacplusadc,= --- /dev/null +++ b/arch/arm/boot/dts/overlays/hifiberry-dacplus-pro-overlay.dts @@ -0,0 +1,64 @@ +// Definitions for HiFiBerry DAC+ PRO, with onboard clocks +/dts-v1/; +/plugin/; + +/ { + compatible = "brcm,bcm2835"; + + fragment@0 { + target-path = "/"; + __overlay__ { + dacpro_osc: dacpro_osc { + compatible = "hifiberry,dacpro-clk"; + #clock-cells = <0>; + }; + }; + }; + + frag1: fragment@1 { + target = <&i2s_clk_consumer>; + __overlay__ { + status = "okay"; + }; + }; + + fragment@2 { + target = <&i2c1>; + __overlay__ { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + 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"; + }; + hpamp: hpamp@60 { + compatible = "ti,tpa6130a2"; + reg = <0x60>; + status = "disabled"; + }; + }; + }; + + fragment@3 { + target = <&sound>; + hifiberry_dacplus: __overlay__ { + compatible = "hifiberry,hifiberry-dacplus"; + i2s-controller = <&i2s_clk_consumer>; + status = "okay"; + }; + }; + + __overrides__ { + 24db_digital_gain = + <&hifiberry_dacplus>,"hifiberry,24db_digital_gain?"; + leds_off = <&hifiberry_dacplus>,"hifiberry-dacplus,leds_off?"; + }; +}; --- /dev/null +++ b/arch/arm/boot/dts/overlays/hifiberry-dacplus-std-overlay.dts @@ -0,0 +1,65 @@ +// Definitions for HiFiBerry DAC+ Standard w/o onboard clocks +/dts-v1/; +/plugin/; + +/ { + compatible = "brcm,bcm2835"; + + fragment@0 { + target-path = "/"; + __overlay__ { + dacpro_osc: dacpro_osc { + compatible = "hifiberry,dacpro-clk"; + #clock-cells = <0>; + }; + }; + }; + + fragment@1 { + target = <&i2s_clk_producer>; + __overlay__ { + status = "okay"; + }; + }; + + fragment@2 { + target = <&i2c1>; + __overlay__ { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + 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"; + }; + hpamp: hpamp@60 { + compatible = "ti,tpa6130a2"; + reg = <0x60>; + status = "disabled"; + }; + }; + }; + + fragment@3 { + target = <&sound>; + hifiberry_dacplus: __overlay__ { + compatible = "hifiberry,hifiberry-dacplus"; + i2s-controller = <&i2s_clk_producer>; + hifiberry-dacplus,slave; + status = "okay"; + }; + }; + + __overrides__ { + 24db_digital_gain = + <&hifiberry_dacplus>,"hifiberry,24db_digital_gain?"; + leds_off = <&hifiberry_dacplus>,"hifiberry-dacplus,leds_off?"; + }; +};