[PATCH 3/3] ARM: dts: qcom: msm8960: expressatt: Add camera flash

Rudraksha Gupta via B4 Relay posted 3 patches 1 month ago
There is a newer version of this series
[PATCH 3/3] ARM: dts: qcom: msm8960: expressatt: Add camera flash
Posted by Rudraksha Gupta via B4 Relay 1 month ago
From: Rudraksha Gupta <guptarud@gmail.com>

Add camera flash support for the Samsung Galaxy Express (expressatt).

The flash IC uses a one-wire pulse-count protocol on GPIO 3, gated by
PMIC MPP 4 which must be driven high to unlock the flash circuit.

Downstream references:
Link: https://github.com/LineageOS/android_kernel_samsung_d2/blob/stable/cm-12.0-YNG4N/drivers/leds/Makefile#L51
Link: https://github.com/LineageOS/android_kernel_samsung_d2/blob/stable/cm-12.0-YNG4N/arch/arm/mach-msm/board-apexq-camera.c#L591

Signed-off-by: Rudraksha Gupta <guptarud@gmail.com>
---
 .../dts/qcom/qcom-msm8960-samsung-expressatt.dts   | 31 ++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/arch/arm/boot/dts/qcom/qcom-msm8960-samsung-expressatt.dts b/arch/arm/boot/dts/qcom/qcom-msm8960-samsung-expressatt.dts
index c4b98af6955d..96460775a4ec 100644
--- a/arch/arm/boot/dts/qcom/qcom-msm8960-samsung-expressatt.dts
+++ b/arch/arm/boot/dts/qcom/qcom-msm8960-samsung-expressatt.dts
@@ -1,5 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <dt-bindings/input/input.h>
+#include <dt-bindings/leds/common.h>
 #include <dt-bindings/reset/qcom,gcc-msm8960.h>
 
 #include "qcom-msm8960.dtsi"
@@ -61,6 +62,20 @@ touchkey_enable: touchkey-enable {
 		regulator-boot-on;
 	};
 
+	camera_flash: led-controller {
+		compatible = "richtek,rt8515";
+		enf-gpios = <&tlmm 3 GPIO_ACTIVE_HIGH>;
+		unlock-gpios = <&pm8921_mpps 4 GPIO_ACTIVE_HIGH>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&cam_flash_en>;
+
+		led {
+			function = LED_FUNCTION_FLASH;
+			color = <LED_COLOR_ID_WHITE>;
+			flash-max-timeout-us = <250000>;
+		};
+	};
+
 	i2c-gpio-touchkey {
 		compatible = "i2c-gpio";
 		#address-cells = <1>;
@@ -247,6 +262,13 @@ touchkey_irq_pin: touchkey-irq-state {
 		drive-strength = <2>;
 		bias-disable;
 	};
+
+	cam_flash_en: cam-flash-en-state {
+		pins = "gpio3";
+		function = "gpio";
+		drive-strength = <16>;
+		bias-pull-down;
+	};
 };
 
 &pm8921 {
@@ -572,3 +594,12 @@ magnetometer@2e {
 		/* TODO: Figure out Mount Matrix */
 	};
 };
+
+&pm8921_mpps {
+	flash_led_unlock: flash-led-unlock-state {
+		pins = "mpp4";
+		function = "digital";
+		output-low;
+		power-source = <PM8921_GPIO_S4>;
+	};
+};

-- 
2.53.0
Re: [PATCH 3/3] ARM: dts: qcom: msm8960: expressatt: Add camera flash
Posted by Linus Walleij 1 month ago
Hi Rudraksha,

thanks for your patch!

On Sat, Mar 7, 2026 at 1:58 AM Rudraksha Gupta via B4 Relay
<devnull+guptarud.gmail.com@kernel.org> wrote:

> From: Rudraksha Gupta <guptarud@gmail.com>
>
> Add camera flash support for the Samsung Galaxy Express (expressatt).
>
> The flash IC uses a one-wire pulse-count protocol on GPIO 3, gated by
> PMIC MPP 4 which must be driven high to unlock the flash circuit.
>
> Downstream references:
> Link: https://github.com/LineageOS/android_kernel_samsung_d2/blob/stable/cm-12.0-YNG4N/drivers/leds/Makefile#L51
> Link: https://github.com/LineageOS/android_kernel_samsung_d2/blob/stable/cm-12.0-YNG4N/arch/arm/mach-msm/board-apexq-camera.c#L591
>
> Signed-off-by: Rudraksha Gupta <guptarud@gmail.com>

(...)

> +       camera_flash: led-controller {
> +               compatible = "richtek,rt8515";
> +               enf-gpios = <&tlmm 3 GPIO_ACTIVE_HIGH>;

I think you should ideally define richtek,rfs-ohms, if it's impossible
to find this information then use the default,
richtek,rfs-ohms = <16000>;

> +               unlock-gpios = <&pm8921_mpps 4 GPIO_ACTIVE_HIGH>;

As mentioned I don't think this is right. The chip has no "unlock"
signal. I think this is a simple regulator (such as a switch).

I would do:

vin-supply = <&flash_gpio_reg>;

Then something like (better if you reserarch it a bit):

flash_gpio_reg: regulator-gpio-ldo-3v3 {
    compatible = "regulator-fixed";
    /* Supplied in turn by VBAT? I guess so. It is between 2.8 and 5V */
    regulator-name = "FLASH_3V3"; // Or whatever the rail is best called?
    regulator-min-microvolt = <3300000>; // If you have better guesses, use them
    regulator-max-microvolt = <3300000>; // If you know VBAT then use
that voltage
    gpio = <&pm8921_mpps 4 GPIO_ACTIVE_HIGH>;
    startup-delay-us = <5000>; // FIXME
    enable-active-high;
    pinctrl-names = "default";
    pinctrl-0 = <&flash_led_unlock>;
};

Notice:

+&pm8921_mpps {
+       flash_led_unlock: flash-led-unlock-state {
+               pins = "mpp4";
+               function = "digital";
+               output-low;
+               power-source = <PM8921_GPIO_S4>;
+       };

This seems completely unused in the current patch, but my addition
above uses it.

Yours,
Linus Walleij
Re: [PATCH 3/3] ARM: dts: qcom: msm8960: expressatt: Add camera flash
Posted by David Heidelberg 1 month ago
On 07/03/2026 01:58, Rudraksha Gupta via B4 Relay wrote:
> From: Rudraksha Gupta <guptarud@gmail.com>
> 
> Add camera flash support for the Samsung Galaxy Express (expressatt).
> 
> The flash IC uses a one-wire pulse-count protocol on GPIO 3, gated by
> PMIC MPP 4 which must be driven high to unlock the flash circuit.
> 
> Downstream references:
> Link: https://github.com/LineageOS/android_kernel_samsung_d2/blob/stable/cm-12.0-YNG4N/drivers/leds/Makefile#L51
> Link: https://github.com/LineageOS/android_kernel_samsung_d2/blob/stable/cm-12.0-YNG4N/arch/arm/mach-msm/board-apexq-camera.c#L591
> 
> Signed-off-by: Rudraksha Gupta <guptarud@gmail.com>
> ---
>   .../dts/qcom/qcom-msm8960-samsung-expressatt.dts   | 31 ++++++++++++++++++++++
>   1 file changed, 31 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/qcom/qcom-msm8960-samsung-expressatt.dts b/arch/arm/boot/dts/qcom/qcom-msm8960-samsung-expressatt.dts
> index c4b98af6955d..96460775a4ec 100644
> --- a/arch/arm/boot/dts/qcom/qcom-msm8960-samsung-expressatt.dts
> +++ b/arch/arm/boot/dts/qcom/qcom-msm8960-samsung-expressatt.dts
> @@ -1,5 +1,6 @@
>   // SPDX-License-Identifier: GPL-2.0
>   #include <dt-bindings/input/input.h>
> +#include <dt-bindings/leds/common.h>
>   #include <dt-bindings/reset/qcom,gcc-msm8960.h>
>   
>   #include "qcom-msm8960.dtsi"
> @@ -61,6 +62,20 @@ touchkey_enable: touchkey-enable {
>   		regulator-boot-on;
>   	};
>   
> +	camera_flash: led-controller {
> +		compatible = "richtek,rt8515";
> +		enf-gpios = <&tlmm 3 GPIO_ACTIVE_HIGH>;
> +		unlock-gpios = <&pm8921_mpps 4 GPIO_ACTIVE_HIGH>;
> +		pinctrl-names = "default";
> +		pinctrl-0 = <&cam_flash_en>;
> +

LGTM, just please order pinctrl-n before pinctrl-names :)

Reviewed-by: David Heidelberg <david@ixit.cz>

Nitpick: if you can, add phone-devel@vger.kernel.org for next time,
it's easier to distinguish the phone patches in huge linux-arm-msm pile :)

David

-- 
David Heidelberg
Re: [PATCH 3/3] ARM: dts: qcom: msm8960: expressatt: Add camera flash
Posted by Rudraksha Gupta 3 weeks ago
On 3/7/26 00:23, David Heidelberg wrote:
> On 07/03/2026 01:58, Rudraksha Gupta via B4 Relay wrote:
>> From: Rudraksha Gupta <guptarud@gmail.com>
>>
>> Add camera flash support for the Samsung Galaxy Express (expressatt).
>>
>> The flash IC uses a one-wire pulse-count protocol on GPIO 3, gated by
>> PMIC MPP 4 which must be driven high to unlock the flash circuit.
>>
>> Downstream references:
>> Link: 
>> https://github.com/LineageOS/android_kernel_samsung_d2/blob/stable/cm-12.0-YNG4N/drivers/leds/Makefile#L51
>> Link: 
>> https://github.com/LineageOS/android_kernel_samsung_d2/blob/stable/cm-12.0-YNG4N/arch/arm/mach-msm/board-apexq-camera.c#L591
>>
>> Signed-off-by: Rudraksha Gupta <guptarud@gmail.com>
>> ---
>>   .../dts/qcom/qcom-msm8960-samsung-expressatt.dts   | 31 
>> ++++++++++++++++++++++
>>   1 file changed, 31 insertions(+)
>>
>> diff --git 
>> a/arch/arm/boot/dts/qcom/qcom-msm8960-samsung-expressatt.dts 
>> b/arch/arm/boot/dts/qcom/qcom-msm8960-samsung-expressatt.dts
>> index c4b98af6955d..96460775a4ec 100644
>> --- a/arch/arm/boot/dts/qcom/qcom-msm8960-samsung-expressatt.dts
>> +++ b/arch/arm/boot/dts/qcom/qcom-msm8960-samsung-expressatt.dts
>> @@ -1,5 +1,6 @@
>>   // SPDX-License-Identifier: GPL-2.0
>>   #include <dt-bindings/input/input.h>
>> +#include <dt-bindings/leds/common.h>
>>   #include <dt-bindings/reset/qcom,gcc-msm8960.h>
>>     #include "qcom-msm8960.dtsi"
>> @@ -61,6 +62,20 @@ touchkey_enable: touchkey-enable {
>>           regulator-boot-on;
>>       };
>>   +    camera_flash: led-controller {
>> +        compatible = "richtek,rt8515";
>> +        enf-gpios = <&tlmm 3 GPIO_ACTIVE_HIGH>;
>> +        unlock-gpios = <&pm8921_mpps 4 GPIO_ACTIVE_HIGH>;
>> +        pinctrl-names = "default";
>> +        pinctrl-0 = <&cam_flash_en>;
>> +
>
> LGTM, just please order pinctrl-n before pinctrl-names :)
>
> Reviewed-by: David Heidelberg <david@ixit.cz>
>
> Nitpick: if you can, add phone-devel@vger.kernel.org for next time,
> it's easier to distinguish the phone patches in huge linux-arm-msm 
> pile :)

Hello David,

Thanks for your comments! I have addressed them in v2 :)

Rudraksha


>
> David
>