From 289455bc1d0de545fd247db402d8f9aa13cf4992 Mon Sep 17 00:00:00 2001
From: handsomeyingyan <handsomeyingyan@github.com>
Date: Tue, 20 Jul 2021 11:59:54 +0800
Subject: [PATCH] add support for sinv3s

---
 arch/arm/boot/dts/Makefile                    |   3 +-
 .../arm/boot/dts/sun8i-v3s-sinlinx-sinv3s.dts | 223 ++++++++++++++++++
 2 files changed, 225 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/sun8i-v3s-sinlinx-sinv3s.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 4c5414c13..27f270922 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -1132,7 +1132,8 @@ dtb-$(CONFIG_MACH_SUN8I) += \
 	sun8i-t3-cqa3t-bv3.dtb \
 	sun8i-v3s-licheepi-zero.dtb \
 	sun8i-v3s-licheepi-zero-dock.dtb \
-	sun8i-v40-bananapi-m2-berry.dtb
+	sun8i-v3s-sinlinx-sinv3s.dtb \
+	sun8i-v40-bananapi-m2-berry.dtb 
 dtb-$(CONFIG_MACH_SUN9I) += \
 	sun9i-a80-optimus.dtb \
 	sun9i-a80-cubieboard4.dtb
diff --git a/arch/arm/boot/dts/sun8i-v3s-sinlinx-sinv3s.dts b/arch/arm/boot/dts/sun8i-v3s-sinlinx-sinv3s.dts
new file mode 100644
index 000000000..3ef5d2fc1
--- /dev/null
+++ b/arch/arm/boot/dts/sun8i-v3s-sinlinx-sinv3s.dts
@@ -0,0 +1,223 @@
+/*
+ * Copyright (C) 2021 HandsomeYingyan <HandsomeYingyan@gmail.com>
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This file is distributed in the hope that it will be useful,
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use,
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include "sun8i-v3s.dtsi"
+#include "sunxi-common-regulators.dtsi"
+#include <dt-bindings/input/input.h>
+
+/ {
+    model = "SinLinx sinv3s";
+    compatible = "sinlinx,sinv3s", "allwinner,sun8i-v3s";
+
+    aliases {
+        serial0 = &uart0;
+        ethernet0 = &emac;
+        display0 = &panel;
+    };
+
+    chosen {
+        stdout-path = "serial0:115200n8";
+    };
+
+    backlight: backlight {
+        compatible = "pwm-backlight";
+        pwms = <&pwm 0 50000 PWM_POLARITY_INVERTED>;
+        brightness-levels = <0 10 20 30 40 50 60 70 80 90 100>;
+        default-brightness-level = <50>;
+        enable-gpios = <&pio 1 4 GPIO_ACTIVE_HIGH>; /* PB4 PWM0 */
+    };
+
+    panel: panel {
+        compatible = "simple-panel","netron-dy,e231732";
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        label = "lcd";
+        pinctrl-names = "default";
+        
+        backlight = <&backlight>;
+
+        port@0 {
+            panel_input: endpoint {
+                remote-endpoint = <&tcon0_out_lcd>;
+            };
+        };
+    };
+   
+};
+
+&mmc0 {
+    broken-cd;
+    bus-width = <4>;
+    vmmc-supply = <&reg_vcc3v3>;
+    status = "okay";
+};
+
+&mmc1 {
+    bus-width = <4>;
+    vmmc-supply = <&reg_vcc3v3>;
+    broken-cd;
+    status = "okay";
+    
+    esp8089: sdio_wifi@1 {
+	compatible = "esp,esp8089";
+	reg = <1>;
+	esp,crystal-26M-en = <2>;
+    };
+};
+
+
+&uart0 {
+    pinctrl-0 = <&uart0_pb_pins>;
+    pinctrl-names = "default";
+    status = "okay";
+};
+
+&usb_otg {
+    dr_mode = "otg";
+    status = "okay";
+};
+
+&usbphy {
+    usb0_id_det-gpios = <&pio 1 3 GPIO_ACTIVE_LOW>; /* PB3 */
+    status = "okay";
+};
+
+&emac {
+    phy-handle = <&int_mii_phy>;
+    phy-mode = "mii";
+    allwinner,leds-active-low;
+    status = "okay";
+};
+
+&pwm {
+    status = "okay";
+};
+
+&de {
+    status = "okay";
+};
+
+&i2c0 {
+	clock-frequency = <400000>;
+	status = "okay";
+	touchscreen@38 {
+		compatible = "edt,edt-ft5x06","edt,edt-ft5306";
+		reg = <0x38>;
+		interrupt-parent = <&pio>;
+		interrupts = <1 4 IRQ_TYPE_EDGE_FALLING>; /* PB04 */
+		wake-gpios = <&pio 1 5 GPIO_ACTIVE_LOW>; /* PB05 */
+		touchscreen-size-x = <1024>;
+		touchscreen-size-y = <600>;
+	};
+};
+
+&tcon0 {
+    pinctrl-names = "default";
+    pinctrl-0 = <&lcd_rgb666_pins>;
+    status = "okay";
+};
+
+&tcon0_out {
+    tcon0_out_lcd: endpoint@0 {
+        reg = <0>;
+        remote-endpoint = <&panel_input>;
+    };
+};
+
+&lradc {
+	vref-supply = <&reg_vcc3v0>;
+	status = "okay";
+
+	button-200 {
+		label = "Volume Up";
+		linux,code = <KEY_VOLUMEUP>;
+		channel = <0>;
+		voltage = <158730>;
+	};
+
+	button-400 {
+		label = "Volume Down";
+		linux,code = <KEY_VOLUMEDOWN>;
+		channel = <0>;
+		voltage = <349206>;
+	};
+
+	button-600 {
+		label = "Select";
+		linux,code = <KEY_SELECT>;
+		channel = <0>;
+		voltage = <539682>;
+	};
+
+	button-800 {
+		label = "Start";
+		linux,code = <KEY_OK>;
+		channel = <0>;
+		voltage = <761904>;
+	};
+	
+	button-1000 {
+		label = "Return";
+		linux,code = <KEY_ESC>;
+		channel = <0>;
+		voltage = <888888>;
+	};
+};
+
+&codec {
+	allwinner,audio-routing =
+		"Headphone", "HP",
+		"Headphone", "HPCOM",
+		"MIC1", "Mic",
+		"Mic",  "HBIAS";
+	status = "okay";
+};
+
+&cedarx {
+    status = "okay";
+};
+
+&ion {
+    status = "okay";
+};
-- 
2.32.0

