From 886c341229589e7d46cbdb8194c23faee0e2a6f9 Mon Sep 17 00:00:00 2001
From: WoodenNautilus <86767647+WoodenNautilus@users.noreply.github.com>
Date: Tue, 3 Aug 2021 11:13:06 +0200
Subject: [PATCH] overlays: Add Ablic S35390A to i2c-rtc and -gpio

See: https://github.com/raspberrypi/linux/pull/4492

Signed-off-by: Maxime Torrelli <maxime.torrelli@gmail.com>
---
 arch/arm/boot/dts/overlays/README              |  4 ++++
 arch/arm/boot/dts/overlays/i2c-rtc-common.dtsi | 17 ++++++++++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)

--- a/arch/arm/boot/dts/overlays/README
+++ b/arch/arm/boot/dts/overlays/README
@@ -1424,6 +1424,8 @@ Params: abx80x                  Select o
 
         sd3078                  Select the ZXW Shenzhen whwave SD3078 device
 
+        s35390a                 Select the ABLIC S35390A device
+
         i2c0                    Choose the I2C0 bus on GPIOs 0&1
 
         i2c_csi_dsi             Choose the I2C0 bus on GPIOs 44&45
@@ -1487,6 +1489,8 @@ Params: abx80x                  Select o
 
         sd3078                  Select the ZXW Shenzhen whwave SD3078 device
 
+        s35390a                 Select the ABLIC S35390A device
+
         addr                    Sets the address for the RTC. Note that the
                                 device must be configured to use the specified
                                 address.
--- a/arch/arm/boot/dts/overlays/i2c-rtc-common.dtsi
+++ b/arch/arm/boot/dts/overlays/i2c-rtc-common.dtsi
@@ -243,6 +243,19 @@
 		};
 	};
 
+	fragment@18 {
+		target = <&i2cbus>;
+		__dormant__ {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			s35390a: s35390a@30 {
+				compatible = "ablic,s35390a";
+				reg = <0x30>;
+			};
+		};
+	};
+
 	__overrides__ {
 		abx80x = <0>,"+0";
 		ds1307 = <0>,"+1";
@@ -262,6 +275,7 @@
 		sd3078 = <0>,"+14";
 		pcf85063 = <0>,"+15";
 		pcf85063a = <0>,"+16";
+		s35390a = <0>,"+18";
 
 		addr = <&abx80x>, "reg:0",
 		       <&ds1307>, "reg:0",
@@ -272,7 +286,8 @@
 		       <&pcf8523>, "reg:0",
 		       <&pcf8563>, "reg:0",
 		       <&m41t62>, "reg:0",
-		       <&rv1805>, "reg:0";
+		       <&rv1805>, "reg:0",
+		       <&s35390a>, "reg:0";
 		trickle-diode-type = <&abx80x>,"abracon,tc-diode",
 				     <&rv1805>,"abracon,tc-diode";
 		trickle-resistor-ohms = <&ds1339>,"trickle-resistor-ohms:0",
