From f134380c19eb38bc276d6d86fa575821c3493c60 Mon Sep 17 00:00:00 2001
From: Matthias Reichl <hias@horus.com>
Date: Sun, 22 Jan 2017 12:49:36 +0100
Subject: [PATCH] BCM270x DT: Consolidate audio card overlays

Reference 3.3V / 5V system rails instead of instantiating local
regulators.

Add missing power supply properties for codecs where these are
required according to the DT bindings docs.

Signed-off-by: Matthias Reichl <hias@horus.com>
---
 .../arm/boot/dts/overlays/adau1977-adc-overlay.dts | 19 ++--------
 .../dts/overlays/akkordion-iqdacplus-overlay.dts   |  3 ++
 .../dts/overlays/hifiberry-dacplus-overlay.dts     |  3 ++
 .../boot/dts/overlays/hifiberry-digi-overlay.dts   |  2 +
 .../dts/overlays/hifiberry-digi-pro-overlay.dts    |  2 +
 arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts |  3 ++
 .../boot/dts/overlays/iqaudio-dacplus-overlay.dts  |  3 ++
 .../overlays/iqaudio-digi-wm8804-audio-overlay.dts |  4 +-
 .../arm/boot/dts/overlays/justboom-dac-overlay.dts |  3 ++
 .../boot/dts/overlays/justboom-digi-overlay.dts    |  2 +
 arch/arm/boot/dts/overlays/raspidac3-overlay.dts   |  4 ++
 .../overlays/rra-digidac1-wm8741-audio-overlay.dts | 44 +++-------------------
 12 files changed, 36 insertions(+), 56 deletions(-)

--- a/arch/arm/boot/dts/overlays/adau1977-adc-overlay.dts
+++ b/arch/arm/boot/dts/overlays/adau1977-adc-overlay.dts
@@ -6,19 +6,6 @@
 	compatible = "brcm,bcm2708";
     
 	fragment@0 {
-		target = <&soc>;
-		
-		__overlay__ {
-			codec_supply: fixedregulator@0 {
-				compatible = "regulator-fixed";
-				regulator-name = "AVDD";
-				regulator-min-microvolt = <3300000>;
-				regulator-max-microvolt = <3300000>;
-			};
-		};
-	};
-	
-	fragment@1 {
         	target = <&i2c>;
         	
 		__overlay__ {
@@ -30,19 +17,19 @@
                         	compatible = "adi,adau1977";
                         	reg = <0x11>;
                         	reset-gpios = <&gpio 5 0>;
-                        	AVDD-supply = <&codec_supply>;
+				AVDD-supply = <&vdd_3v3_reg>;
                 	};
         	};
 	};
 
-	fragment@2 {
+	fragment@1 {
 		target = <&i2s>;
 		__overlay__ {
 			status = "okay";
 		};
 	};
 
-	fragment@3 {
+	fragment@2 {
 		target = <&sound>;
 		__overlay__ {
 			compatible = "adi,adau1977-adc";
--- a/arch/arm/boot/dts/overlays/akkordion-iqdacplus-overlay.dts
+++ b/arch/arm/boot/dts/overlays/akkordion-iqdacplus-overlay.dts
@@ -23,6 +23,9 @@
 				#sound-dai-cells = <0>;
 				compatible = "ti,pcm5122";
 				reg = <0x4c>;
+				AVDD-supply = <&vdd_3v3_reg>;
+				DVDD-supply = <&vdd_3v3_reg>;
+				CPVDD-supply = <&vdd_3v3_reg>;
 				status = "okay";
 			};
 		};
--- a/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts
+++ b/arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts
@@ -34,6 +34,9 @@
 				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";
 			};
 		};
--- a/arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts
+++ b/arch/arm/boot/dts/overlays/hifiberry-digi-overlay.dts
@@ -23,6 +23,8 @@
 				#sound-dai-cells = <0>;
 				compatible = "wlf,wm8804";
 				reg = <0x3b>;
+				PVDD-supply = <&vdd_3v3_reg>;
+				DVDD-supply = <&vdd_3v3_reg>;
 				status = "okay";
 			};
 		};
--- a/arch/arm/boot/dts/overlays/hifiberry-digi-pro-overlay.dts
+++ b/arch/arm/boot/dts/overlays/hifiberry-digi-pro-overlay.dts
@@ -23,6 +23,8 @@
 				#sound-dai-cells = <0>;
 				compatible = "wlf,wm8804";
 				reg = <0x3b>;
+				PVDD-supply = <&vdd_3v3_reg>;
+				DVDD-supply = <&vdd_3v3_reg>;
 				status = "okay";
 			};
 		};
--- a/arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts
+++ b/arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts
@@ -23,6 +23,9 @@
 				#sound-dai-cells = <0>;
 				compatible = "ti,pcm5122";
 				reg = <0x4c>;
+				AVDD-supply = <&vdd_3v3_reg>;
+				DVDD-supply = <&vdd_3v3_reg>;
+				CPVDD-supply = <&vdd_3v3_reg>;
 				status = "okay";
 			};
 		};
--- a/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts
+++ b/arch/arm/boot/dts/overlays/iqaudio-dacplus-overlay.dts
@@ -23,6 +23,9 @@
 				#sound-dai-cells = <0>;
 				compatible = "ti,pcm5122";
 				reg = <0x4c>;
+				AVDD-supply = <&vdd_3v3_reg>;
+				DVDD-supply = <&vdd_3v3_reg>;
+				CPVDD-supply = <&vdd_3v3_reg>;
 				status = "okay";
 			};
 		};
--- a/arch/arm/boot/dts/overlays/iqaudio-digi-wm8804-audio-overlay.dts
+++ b/arch/arm/boot/dts/overlays/iqaudio-digi-wm8804-audio-overlay.dts
@@ -24,8 +24,8 @@
 				compatible = "wlf,wm8804";
 				reg = <0x3b>;
 				status = "okay";
-				// DVDD-supply = <&reg_3v3>;
-				// PVDD-supply = <&reg_3v3>;
+				DVDD-supply = <&vdd_3v3_reg>;
+				PVDD-supply = <&vdd_3v3_reg>;
 			};
 		};
 	};
--- a/arch/arm/boot/dts/overlays/justboom-dac-overlay.dts
+++ b/arch/arm/boot/dts/overlays/justboom-dac-overlay.dts
@@ -23,6 +23,9 @@
 				#sound-dai-cells = <0>;
 				compatible = "ti,pcm5122";
 				reg = <0x4d>;
+				AVDD-supply = <&vdd_3v3_reg>;
+				DVDD-supply = <&vdd_3v3_reg>;
+				CPVDD-supply = <&vdd_3v3_reg>;
 				status = "okay";
 			};
 		};
--- a/arch/arm/boot/dts/overlays/justboom-digi-overlay.dts
+++ b/arch/arm/boot/dts/overlays/justboom-digi-overlay.dts
@@ -23,6 +23,8 @@
 				#sound-dai-cells = <0>;
 				compatible = "wlf,wm8804";
 				reg = <0x3b>;
+				PVDD-supply = <&vdd_3v3_reg>;
+				DVDD-supply = <&vdd_3v3_reg>;
 				status = "okay";
 			};
 		};
--- a/arch/arm/boot/dts/overlays/raspidac3-overlay.dts
+++ b/arch/arm/boot/dts/overlays/raspidac3-overlay.dts
@@ -23,12 +23,16 @@
 				#sound-dai-cells = <0>;
 				compatible = "ti,pcm5122";
 				reg = <0x4c>;
+				AVDD-supply = <&vdd_3v3_reg>;
+				DVDD-supply = <&vdd_3v3_reg>;
+				CPVDD-supply = <&vdd_3v3_reg>;
 				status = "okay";
 			};
 
 			tpa6130a2: tpa6130a2@60 {
 				compatible = "ti,tpa6130a2";
 				reg = <0x60>;
+				Vdd-supply = <&vdd_3v3_reg>;
 				status = "okay";
 			};
 		};
--- a/arch/arm/boot/dts/overlays/rra-digidac1-wm8741-audio-overlay.dts
+++ b/arch/arm/boot/dts/overlays/rra-digidac1-wm8741-audio-overlay.dts
@@ -6,45 +6,13 @@
 	compatible = "brcm,bcm2708";
 
 	fragment@0 {
-		target-path = "/";
-		__overlay__ {
-			aliases {
-				ldo0 = &ldo0;
-				ldo1 = &ldo1;
-			};
-		};
-	};
-
-	fragment@1 {
-		target-path = "/soc";
-		__overlay__ {
-
-			ldo1: ldo1 {
-				compatible = "regulator-fixed";
-				regulator-name = "DC_5V";
-				regulator-min-microvolt = <5000000>;
-				regulator-max-microvolt = <5000000>;
-				regulator-always-on;
-			};
-
-			ldo0: ldo0 {
-				compatible = "regulator-fixed";
-				regulator-name = "DC_3V3";
-				regulator-min-microvolt = <3300000>;
-				regulator-max-microvolt = <3300000>;
-				regulator-always-on;
-			};
-		};
-	};
-
-	fragment@2 {
 		target = <&i2s>;
 		__overlay__ {
 			status = "okay";
 		};
 	};
 
-	fragment@3 {
+	fragment@1 {
 		target = <&i2c1>;
 		__overlay__ {
 			#address-cells = <1>;
@@ -56,21 +24,21 @@
 				compatible = "wlf,wm8804";
 				reg = <0x3b>;
 				status = "okay";
-				PVDD-supply = <&ldo0>;
-				DVDD-supply = <&ldo0>;
+				PVDD-supply = <&vdd_3v3_reg>;
+				DVDD-supply = <&vdd_3v3_reg>;
 			};
 
 			wm8742: wm8741@1a {
 				compatible = "wlf,wm8741";
 				reg = <0x1a>;
 				status = "okay";
-				AVDD-supply = <&ldo1>;
-				DVDD-supply = <&ldo0>;
+				AVDD-supply = <&vdd_5v0_reg>;
+				DVDD-supply = <&vdd_3v3_reg>;
 			};
 		};
 	};
 
-	fragment@4 {
+	fragment@2 {
 		target = <&sound>;
 		__overlay__ {
 			compatible = "rra,digidac1-soundcard";
