Skip to contentSkip to conversation

arm64: dts: qcom: msm8916-alcatel-idol347: add GPIO torch LED

PATCH Applied Vincent Knecht 3 participants 5 messages Oct 29, 2022 – Nov 8, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 arm64: dts: qcom: msm8916-alcatel-idol347: add GPIO torch LED

Add support for torch LED on GPIO 32.

---
 .../boot/dts/qcom/msm8916-alcatel-idol347.dts | 22 +++++++++++++++++++
 1 file changed, 22 insertions(+)
arch/arm64/boot/dts/qcom/msm8916-alcatel-idol347.dts +22 -0
index 3dc9619fde6e..3a0a593899ae 100644
@@ -5,6 +5,7 @@
 #include "msm8916-pm8916.dtsi"
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/input.h>
+#include <dt-bindings/leds/common.h>
 
 / {
 	model = "Alcatel OneTouch Idol 3 (4.7)";
@@ -34,6 +35,19 @@ button-volume-up {
 		};
 	};
 
+	gpio-leds {
+		compatible = "gpio-leds";
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&gpio_leds_default>;
+
+		led-0 {
+			gpios = <&msmgpio 32 GPIO_ACTIVE_HIGH>;
+			linux,default-trigger = "torch";
+			function = LED_FUNCTION_TORCH;
+		};
+	};
+
 	usb_id: usb-id {
 		compatible = "linux,extcon-usb-gpio";
 		id-gpio = <&msmgpio 69 GPIO_ACTIVE_HIGH>;
@@ -276,6 +290,14 @@ gpio_keys_default: gpio-keys-default {
 		bias-pull-up;
 	};
 
+	gpio_leds_default: gpio-leds-default {
+		pins = "gpio32";
+		function = "gpio";
+
+		drive-strength = <2>;
+		bias-disable;
+	};
+
 	gyro_int_default: gyro-int-default {
 		pins = "gpio97", "gpio98";
 		function = "gpio";
Signature · 1 line
2.37.3
#1 lore raw

PATCH 2/2 arm64: dts: qcom: msm8916-alcatel-idol347: add LED indicator

Add si-en,sn3190 LED controller to enable white LED indicator.

This requires adding the additional "enable" gpio that the OEM choose to use, despite it not being mentioned in si-en,sn3190 datasheet nor supported by the driver.

---
 .../boot/dts/qcom/msm8916-alcatel-idol347.dts | 44 +++++++++++++++++++
 1 file changed, 44 insertions(+)
arch/arm64/boot/dts/qcom/msm8916-alcatel-idol347.dts +44 -0
index 3a0a593899ae..952ae092e6ae 100644
@@ -130,6 +130,27 @@ gyroscope@68 {
 	};
 };
 
+&blsp_i2c6 {
+	status = "okay";
+
+	led-controller@68 {
+		compatible = "si-en,sn3190";
+		reg = <0x68>;
+		shutdown-gpios = <&msmgpio 89 GPIO_ACTIVE_HIGH>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&led_enable_default &led_shutdown_default>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		led@1 {
+			reg = <1>;
+			led-max-microamp = <5000>;
+			function = LED_FUNCTION_INDICATOR;
+			color = <LED_COLOR_ID_WHITE>;
+		};
+	};
+};
+
 &pm8916_resin {
 	status = "okay";
 	linux,code = <KEY_VOLUMEDOWN>;
@@ -306,6 +327,29 @@ gyro_int_default: gyro-int-default {
 		bias-disable;
 	};
 
+	/*
+	 * The OEM wired an additional GPIO to be asserted so that
+	 * the si-en,sn3190 LED IC works. Since this GPIO is not
+	 * part of the IC datasheet nor supported by the driver,
+	 * force it asserted here.
+	 */
+	led_enable_default: led-enable-default {
+		pins = "gpio102";
+		function = "gpio";
+
+		drive-strength = <2>;
+		bias-disable;
+		output-high;
+	};
+
+	led_shutdown_default: led-shutdown-default {
+		pins = "gpio89";
+		function = "gpio";
+
+		drive-strength = <2>;
+		bias-disable;
+	};
+
 	mag_reset_default: mag-reset-default {
 		pins = "gpio8";
 		function = "gpio";
Signature · 1 line
2.37.3
#2 lore raw

Re: [PATCH v1 2/2] arm64: dts: qcom: msm8916-alcatel-idol347: add LED indicator

Quoted 44 lines · Vincent Knecht

Add si-en,sn3190 LED controller to enable white LED indicator.

This requires adding the additional "enable" gpio that the OEM choose to use, despite it not being mentioned in si-en,sn3190 datasheet nor supported by the driver.

---
 .../boot/dts/qcom/msm8916-alcatel-idol347.dts | 44 +++++++++++++++++++
 1 file changed, 44 insertions(+)
arch/arm64/boot/dts/qcom/msm8916-alcatel-idol347.dts +21 -0
index 3a0a593899ae..952ae092e6ae 100644
@@ -130,6 +130,27 @@ gyroscope@68 {
 	};
 };
 
+&blsp_i2c6 {
+	status = "okay";
+
+	led-controller@68 {
+		compatible = "si-en,sn3190";
+		reg = <0x68>;
+		shutdown-gpios = <&msmgpio 89 GPIO_ACTIVE_HIGH>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&led_enable_default &led_shutdown_default>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		led@1 {
+			reg = <1>;
+			led-max-microamp = <5000>;
+			function = LED_FUNCTION_INDICATOR;
+			color = <LED_COLOR_ID_WHITE>;
+		};
+	};
+};
+
 &pm8916_resin {
 	status = "okay";
 	linux,code = <KEY_VOLUMEDOWN>;

arch/arm64/boot/dts/qcom/msm8916-alcatel-idol347.dts gyro_int_default: gyro-int-default { · line 336

Quoted 10 lines
arch/arm64/boot/dts/qcom/msm8916-alcatel-idol347.dts +7 -0
@@ -306,6 +327,29 @@ gyro_int_default: gyro-int-default {
 		bias-disable;
 	};
 
+	/*
+	 * The OEM wired an additional GPIO to be asserted so that
+	 * the si-en,sn3190 LED IC works. Since this GPIO is not
+	 * part of the IC datasheet nor supported by the driver,
+	 * force it asserted here.
+	 */
+	led_enable_default: led-enable-default {

Add suffix to node name: "-state"

Same in other places. Bindings require it now.

Best regards,
Krzysztof

#3 lore raw
In reply to Vincent Knecht
Quoted 40 lines · Vincent Knecht

Add support for torch LED on GPIO 32.

---
 .../boot/dts/qcom/msm8916-alcatel-idol347.dts | 22 +++++++++++++++++++
 1 file changed, 22 insertions(+)
arch/arm64/boot/dts/qcom/msm8916-alcatel-idol347.dts +14 -0
index 3dc9619fde6e..3a0a593899ae 100644
@@ -5,6 +5,7 @@
 #include "msm8916-pm8916.dtsi"
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/input.h>
+#include <dt-bindings/leds/common.h>
 
 / {
 	model = "Alcatel OneTouch Idol 3 (4.7)";
@@ -34,6 +35,19 @@ button-volume-up {
 		};
 	};
 
+	gpio-leds {
+		compatible = "gpio-leds";
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&gpio_leds_default>;
+
+		led-0 {
+			gpios = <&msmgpio 32 GPIO_ACTIVE_HIGH>;
+			linux,default-trigger = "torch";
+			function = LED_FUNCTION_TORCH;
+		};
+	};
+
 	usb_id: usb-id {
 		compatible = "linux,extcon-usb-gpio";
 		id-gpio = <&msmgpio 69 GPIO_ACTIVE_HIGH>;

arch/arm64/boot/dts/qcom/msm8916-alcatel-idol347.dts gpio_keys_default: gpio-keys-default { · line 293

Quoted 4 lines
arch/arm64/boot/dts/qcom/msm8916-alcatel-idol347.dts +1 -0
@@ -276,6 +290,14 @@ gpio_keys_default: gpio-keys-default {
 		bias-pull-up;
 	};
 
+	gpio_leds_default: gpio-leds-default {

Node name: gpio-leds-default-state

Best regards,
Krzysztof

maintainer Applied
#4 lore raw

Re: (subset) [PATCH v1 1/2] arm64: dts: qcom: msm8916-alcatel-idol347: add GPIO torch LED

In reply to Vincent Knecht
Quoted 3 lines · Vincent Knecht

Add support for torch LED on GPIO 32.

Applied, thanks!

[1/2] arm64: dts: qcom: msm8916-alcatel-idol347: add GPIO torch LED

      commit: 64323952aa5a14471a1225f2c1121aa5447c6ded
[2/2] arm64: dts: qcom: msm8916-alcatel-idol347: add LED indicator
      commit: 1c8cc183d07059d23d28c29a8e345464c4055127

Best regards,

Signature · 1 line
Bjorn Andersson <[email protected]>