From 7c5d182e1cc50ac84a345da09b685dc049e3c748 Mon Sep 17 00:00:00 2001
From: Sergey Larin <cerg2010cerg2010@mail.ru>
Date: Mon, 28 Jan 2019 11:38:19 +0300
Subject: [PATCH] ARM: dts: tegra20-glide: Device Tree changes

- added wm8994 tegra binding
- vmmc regulator
- STMPE GPIO for card and jack detection (doesn't work)
- remove pwm backlight node

Signed-off-by: Sergey Larin <cerg2010cerg2010@mail.ru>
---
 arch/arm/boot/dts/tegra20-glide.dts | 53 +++++++++++++++++------------
 1 file changed, 32 insertions(+), 21 deletions(-)

diff --git a/arch/arm/boot/dts/tegra20-glide.dts b/arch/arm/boot/dts/tegra20-glide.dts
index 32f59e7889be..f9dfb7ec3a3e 100644
--- a/arch/arm/boot/dts/tegra20-glide.dts
+++ b/arch/arm/boot/dts/tegra20-glide.dts
@@ -732,11 +732,10 @@
 					regulator-always-on;
 				};
 
-				ldo16 {
+				vmmc_reg: ldo16 {
 					regulator-name = "nvvdd_ldo16,vtf_3v3,vmmc";
 					regulator-min-microvolt = <3300000>;
 					regulator-max-microvolt = <3300000>;
-					regulator-always-on;
 				};
 
 				ldo17 {
@@ -846,12 +845,15 @@
 		#address-cells = <1>;
 		#size-cells = <0>;
 
-		wm8994@1a {
+		wm8994: wm8994@1a {
 			compatible = "wlf,wm8994";
 			reg = <0x1a>;
 
 			gpio-controller;
 			#gpio-cells = <2>;
+
+			wlf,ldo1ena =  <&gpio TEGRA_GPIO(X, 5) GPIO_ACTIVE_HIGH>;
+
 		};
 	};
 
@@ -1029,14 +1031,14 @@
 					MATRIX_KEY(0, 0, KEY_R)
 					MATRIX_KEY(0, 1, KEY_G)
 					MATRIX_KEY(0, 2, KEY_V)
-					MATRIX_KEY(0, 3, KEY_LEFTMETA)
+					MATRIX_KEY(0, 3, KEY_LEFTCTRL /* KEY_LEFTMETA */)
 					MATRIX_KEY(0, 4, KEY_MENU)
 					MATRIX_KEY(0, 5, KEY_HOME)
 
 					MATRIX_KEY(1, 0, KEY_T)
 					MATRIX_KEY(1, 1, KEY_H)
 					MATRIX_KEY(1, 2, KEY_B)
-					MATRIX_KEY(1, 3, KEY_RIGHTMETA)
+					MATRIX_KEY(1, 3, KEY_TAB /* KEY_RIGHTMETA */)
 					MATRIX_KEY(1, 4, KEY_Q)
 					MATRIX_KEY(1, 5, KEY_FN)
 
@@ -1074,13 +1076,19 @@
 					MATRIX_KEY(6, 3, KEY_DOWN)
 					MATRIX_KEY(6, 4, KEY_D)
 
-					MATRIX_KEY(7, 0, KEY_DELETE)
+					MATRIX_KEY(7, 0, KEY_BACKSPACE /* KEY_DELETE */)
 					MATRIX_KEY(7, 1, KEY_BACK)
 					MATRIX_KEY(7, 2, KEY_SEARCH)
-					MATRIX_KEY(7, 3, KEY_WWW)
+					MATRIX_KEY(7, 3, KEY_SLASH /* KEY_WWW */)
 					MATRIX_KEY(7, 4, KEY_F)
 					MATRIX_KEY(7, 5, KEY_FN) >;
 			};
+
+			stmpegpio: stmpe_gpio {
+				compatible = "st,stmpe-gpio";
+				gpio-controller;
+				#gpio-cells = <2>;
+			};
 		};
 	};
 
@@ -1151,7 +1159,10 @@
 	sdhci@c8000400 {
 		status = "okay";
 		bus-width = <4>;
-		cd-gpios = <&gpio TEGRA_GPIO(V, 6) GPIO_ACTIVE_LOW>;
+		// cd-gpios = <&stmpegpio 16 GPIO_ACTIVE_HIGH>;
+		cd-gpios = <&gpio TEGRA_GPIO(V, 6) GPIO_ACTIVE_HIGH>;
+		vmmc-supply = <&vmmc_reg>;
+		broken-cd;
 		keep-power-in-suspend;
 	};
 
@@ -1163,19 +1174,6 @@
 		keep-power-in-suspend;
 	};
 
-	// This is supposed to be vibra, but it operates on a controller, which is not supported
-	/* backlight: backlight {
-		compatible = "pwm-backlight";
-
-		enable-gpios = <&gpio TEGRA_GPIO(U, 4) GPIO_ACTIVE_HIGH>;
-		pwms = <&pwm 0 5000000>;
-
-		brightness-levels = <0 16 32 48 64 80 96 112 128 144 160 176 192 208 224 240 255>;
-		default-brightness-level = <10>;
-
-		backlight-boot-off;
-	}; */
-
 	clocks {
 		compatible = "simple-bus";
 		#address-cells = <1>;
@@ -1288,4 +1286,17 @@
 			enable-active-high;
 		};
 	};
+
+	sound {
+		compatible = "nvidia,tegra-audio-wm8994";
+		nvidia,model = "wm8994-aif1";
+
+		nvidia,i2s-controller = <&tegra_i2s1>;
+		nvidia,audio-codec = <&wm8994>;
+
+		clocks = <&tegra_car TEGRA20_CLK_PLL_A>,
+			 <&tegra_car TEGRA20_CLK_PLL_A_OUT0>,
+			 <&tegra_car TEGRA20_CLK_CDEV1>;
+		clock-names = "pll_a", "pll_a_out0", "mclk";
+	};
 };
-- 
2.22.0

