From 287d9f4f38c2710b5a8cd384ffe1f05ca10761b0 Mon Sep 17 00:00:00 2001
From: Jack Knightly <J__A__K@hotmail.com>
Date: Fri, 14 Oct 2022 20:59:44 +0200
Subject: [PATCH 08/11] samsung-t0lte: add leds

Adds flash/torch LED for samsung-t0lte

AND notification LED to t0lte and other midas devices (samsung-m0,
samsung-m3).
---
 arch/arm/boot/dts/exynos4412-midas.dtsi | 37 ++++++++++++++++++++++++-
 arch/arm/boot/dts/exynos4412-n710x.dts  | 15 ++++++++++
 2 files changed, 51 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/exynos4412-midas.dtsi b/arch/arm/boot/dts/exynos4412-midas.dtsi
index 1f9cd7474b16..3d6faa222f1d 100644
--- a/arch/arm/boot/dts/exynos4412-midas.dtsi
+++ b/arch/arm/boot/dts/exynos4412-midas.dtsi
@@ -18,6 +18,7 @@
 #include <dt-bindings/interrupt-controller/irq.h>
 #include <dt-bindings/clock/maxim,max77686.h>
 #include "exynos-pinctrl.h"
+#include <dt-bindings/leds/common.h>
 
 / {
 	compatible = "samsung,midas", "samsung,exynos4412", "samsung,exynos4";
@@ -25,6 +26,7 @@ / {
 	aliases {
 		i2c11 = &i2c_max77693;
 		i2c12 = &i2c_max77693_fuel;
+		i2c13 = &i2c_an30259a;
 	};
 
 	chosen {
@@ -171,7 +173,7 @@ i2c_max77693: i2c-gpio-1 {
 		#address-cells = <1>;
 		#size-cells = <0>;
 
-		pmic@66 {
+		max77693_pmic: pmic@66 {
 			compatible = "maxim,max77693";
 			interrupt-parent = <&gpx1>;
 			interrupts = <5 IRQ_TYPE_LEVEL_LOW>;
@@ -251,6 +253,39 @@ touchkey@20 {
 		};
 	};
 
+	i2c_an30259a: i2c-gpio-5 {
+		compatible = "i2c-gpio";
+		gpios = <&gpf2 7 GPIO_ACTIVE_HIGH>, <&gpf2 6 GPIO_ACTIVE_HIGH>;
+		i2c-gpio,delay-us = <2>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		led-controller@30 {
+			compatible = "panasonic,an30259a";
+			reg = <0x30>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			led@1 {
+				reg = <1>;
+				function = LED_FUNCTION_STATUS;
+				color = <LED_COLOR_ID_RED>;
+			};
+
+			led@2 {
+				reg = <2>;
+				function = LED_FUNCTION_STATUS;
+				color = <LED_COLOR_ID_GREEN>;
+			};
+
+			led@3 {
+				reg = <3>;
+				function = LED_FUNCTION_STATUS;
+				color = <LED_COLOR_ID_BLUE>;
+			};
+		};
+	};
+
 	i2c-mhl {
 		compatible = "i2c-gpio";
 		sda-gpios = <&gpf0 4 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
diff --git a/arch/arm/boot/dts/exynos4412-n710x.dts b/arch/arm/boot/dts/exynos4412-n710x.dts
index da0e475b1063..739aa0080e3f 100644
--- a/arch/arm/boot/dts/exynos4412-n710x.dts
+++ b/arch/arm/boot/dts/exynos4412-n710x.dts
@@ -138,6 +138,21 @@ &ldo25_reg {
 	regulator-max-microvolt = <3000000>;
 };
 
+&max77693_pmic {
+	led {
+		compatible = "maxim,max77693-led";
+		maxim,boost-mode = <LEDS_BOOST_ADAPTIVE>;
+		maxim,boost-mvout = <5000>;
+		camera-flash {
+			label = "white:flash";
+			led-sources = <0>, <1>;
+			led-max-microamp = <140625>;
+			flash-max-microamp = <500000>;
+			flash-max-timeout-us = <500000>;
+		};
+	};
+};
+
 &s5c73m3 {
 	standby-gpios = <&gpm0 6 GPIO_ACTIVE_LOW>;   /* ISP_STANDBY */
 	vdda-supply = <&cam_vdda_reg>;
-- 
2.38.1

