[PATCH v3 04/11] arm64: dts: qcom: sdm845-lg-common: Add leds

Paul Sajna posted 11 patches 4 months, 2 weeks ago
There is a newer version of this series
[PATCH v3 04/11] arm64: dts: qcom: sdm845-lg-common: Add leds
Posted by Paul Sajna 4 months, 2 weeks ago
From: Amir Dahan <system64fumo@protonmail.com>

Add the multicolor status led in the phone's notch

Signed-off-by: Amir Dahan <system64fumo@protonmail.com>
Signed-off-by: Paul Sajna <sajattack@postmarketos.org>
---
 arch/arm64/boot/dts/qcom/sdm845-lg-common.dtsi | 28 ++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sdm845-lg-common.dtsi b/arch/arm64/boot/dts/qcom/sdm845-lg-common.dtsi
index 4c631df56f262ba9e730f6720abd94d374b14692..2a612922ecf7ce3f8a0734cb1a31a8a81efdb4f2 100644
--- a/arch/arm64/boot/dts/qcom/sdm845-lg-common.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm845-lg-common.dtsi
@@ -6,6 +6,7 @@
  */
 
 #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/leds/common.h>
 #include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
 #include <dt-bindings/regulator/qcom,rpmh-regulator.h>
 
@@ -504,6 +505,33 @@ &pm8998_resin {
 	status = "okay";
 };
 
+&pmi8998_lpg {
+	status = "okay";
+
+	multi-led {
+		color = <LED_COLOR_ID_RGB>;
+		function = LED_FUNCTION_STATUS;
+
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		led@3 {
+			reg = <3>;
+			color = <LED_COLOR_ID_BLUE>;
+		};
+
+		led@4 {
+			reg = <4>;
+			color = <LED_COLOR_ID_GREEN>;
+		};
+
+		led@5 {
+			reg = <5>;
+			color = <LED_COLOR_ID_RED>;
+		};
+	};
+};
+
 &sdhc_2 {
 	cd-gpios = <&tlmm 126 GPIO_ACTIVE_LOW>;
 

-- 
2.51.0
Re: [PATCH v3 04/11] arm64: dts: qcom: sdm845-lg-common: Add leds
Posted by Konrad Dybcio 4 months, 1 week ago
On 9/29/25 7:05 AM, Paul Sajna wrote:
> From: Amir Dahan <system64fumo@protonmail.com>
> 
> Add the multicolor status led in the phone's notch
> 
> Signed-off-by: Amir Dahan <system64fumo@protonmail.com>
> Signed-off-by: Paul Sajna <sajattack@postmarketos.org>
> ---
>  arch/arm64/boot/dts/qcom/sdm845-lg-common.dtsi | 28 ++++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/qcom/sdm845-lg-common.dtsi b/arch/arm64/boot/dts/qcom/sdm845-lg-common.dtsi
> index 4c631df56f262ba9e730f6720abd94d374b14692..2a612922ecf7ce3f8a0734cb1a31a8a81efdb4f2 100644
> --- a/arch/arm64/boot/dts/qcom/sdm845-lg-common.dtsi
> +++ b/arch/arm64/boot/dts/qcom/sdm845-lg-common.dtsi
> @@ -6,6 +6,7 @@
>   */
>  
>  #include <dt-bindings/gpio/gpio.h>
> +#include <dt-bindings/leds/common.h>
>  #include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
>  #include <dt-bindings/regulator/qcom,rpmh-regulator.h>
>  
> @@ -504,6 +505,33 @@ &pm8998_resin {
>  	status = "okay";
>  };
>  
> +&pmi8998_lpg {
> +	status = "okay";

Could you read back register 0xd000+0x45 (LED_SRC_SEL) on downstream
and make sure the value matches upstream?

A msm8998 kernel fork I have laying around on my computer always seems
to write '1' in there (which it claims corresponds to VPH_PWR as input)

Konrad
Re: [PATCH v3 04/11] arm64: dts: qcom: sdm845-lg-common: Add leds
Posted by Paul Sajna 4 months, 1 week ago
October 1, 2025 at 9:01 AM, "Konrad Dybcio" <konrad.dybcio@oss.qualcomm.com mailto:konrad.dybcio@oss.qualcomm.com?to=%22Konrad%20Dybcio%22%20%3Ckonrad.dybcio%40oss.qualcomm.com%3E > wrote:


> 
> On 9/29/25 7:05 AM, Paul Sajna wrote:
> 
> > 
> > From: Amir Dahan <system64fumo@protonmail.com>
> >  
> >  Add the multicolor status led in the phone's notch
> >  
> >  Signed-off-by: Amir Dahan <system64fumo@protonmail.com>
> >  Signed-off-by: Paul Sajna <sajattack@postmarketos.org>
> >  ---
> >  arch/arm64/boot/dts/qcom/sdm845-lg-common.dtsi | 28 ++++++++++++++++++++++++++
> >  1 file changed, 28 insertions(+)
> >  
> >  diff --git a/arch/arm64/boot/dts/qcom/sdm845-lg-common.dtsi b/arch/arm64/boot/dts/qcom/sdm845-lg-common.dtsi
> >  index 4c631df56f262ba9e730f6720abd94d374b14692..2a612922ecf7ce3f8a0734cb1a31a8a81efdb4f2 100644
> >  --- a/arch/arm64/boot/dts/qcom/sdm845-lg-common.dtsi
> >  +++ b/arch/arm64/boot/dts/qcom/sdm845-lg-common.dtsi
> >  @@ -6,6 +6,7 @@
> >  */
> >  
> >  #include <dt-bindings/gpio/gpio.h>
> >  +#include <dt-bindings/leds/common.h>
> >  #include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
> >  #include <dt-bindings/regulator/qcom,rpmh-regulator.h>
> >  
> >  @@ -504,6 +505,33 @@ &pm8998_resin {
> >  status = "okay";
> >  };
> >  
> >  +&pmi8998_lpg {
> >  + status = "okay";
> > 
> Could you read back register 0xd000+0x45 (LED_SRC_SEL) on downstream
> and make sure the value matches upstream?
> 
> A msm8998 kernel fork I have laying around on my computer always seems
> to write '1' in there (which it claims corresponds to VPH_PWR as input)
> 
> Konrad
>

I need more explanation on how to do this please.
Re: [PATCH v3 04/11] arm64: dts: qcom: sdm845-lg-common: Add leds
Posted by Konrad Dybcio 4 months, 1 week ago
On 10/2/25 7:13 AM, Paul Sajna wrote:
> October 1, 2025 at 9:01 AM, "Konrad Dybcio" <konrad.dybcio@oss.qualcomm.com mailto:konrad.dybcio@oss.qualcomm.com?to=%22Konrad%20Dybcio%22%20%3Ckonrad.dybcio%40oss.qualcomm.com%3E > wrote:
> 
> 
>>
>> On 9/29/25 7:05 AM, Paul Sajna wrote:
>>
>>>
>>> From: Amir Dahan <system64fumo@protonmail.com>
>>>  
>>>  Add the multicolor status led in the phone's notch
>>>  
>>>  Signed-off-by: Amir Dahan <system64fumo@protonmail.com>
>>>  Signed-off-by: Paul Sajna <sajattack@postmarketos.org>
>>>  ---
>>>  arch/arm64/boot/dts/qcom/sdm845-lg-common.dtsi | 28 ++++++++++++++++++++++++++
>>>  1 file changed, 28 insertions(+)
>>>  
>>>  diff --git a/arch/arm64/boot/dts/qcom/sdm845-lg-common.dtsi b/arch/arm64/boot/dts/qcom/sdm845-lg-common.dtsi
>>>  index 4c631df56f262ba9e730f6720abd94d374b14692..2a612922ecf7ce3f8a0734cb1a31a8a81efdb4f2 100644
>>>  --- a/arch/arm64/boot/dts/qcom/sdm845-lg-common.dtsi
>>>  +++ b/arch/arm64/boot/dts/qcom/sdm845-lg-common.dtsi
>>>  @@ -6,6 +6,7 @@
>>>  */
>>>  
>>>  #include <dt-bindings/gpio/gpio.h>
>>>  +#include <dt-bindings/leds/common.h>
>>>  #include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
>>>  #include <dt-bindings/regulator/qcom,rpmh-regulator.h>
>>>  
>>>  @@ -504,6 +505,33 @@ &pm8998_resin {
>>>  status = "okay";
>>>  };
>>>  
>>>  +&pmi8998_lpg {
>>>  + status = "okay";
>>>
>> Could you read back register 0xd000+0x45 (LED_SRC_SEL) on downstream
>> and make sure the value matches upstream?
>>
>> A msm8998 kernel fork I have laying around on my computer always seems
>> to write '1' in there (which it claims corresponds to VPH_PWR as input)
>>
>> Konrad
>>
> 
> I need more explanation on how to do this please.

diff --git a/drivers/leds/leds-qpnp.c b/drivers/leds/leds-qpnp.c
index 8de71a8e621a..f6914abef562 100644
--- a/drivers/leds/leds-qpnp.c
+++ b/drivers/leds/leds-qpnp.c
@@ -1788,6 +1788,10 @@ static int qpnp_rgb_set(struct qpnp_led_data *led)
                }
        }
 
+       u32 val;
+       regmap_read(led->regmap, RGB_LED_SRC_SEL(led->base), &val);
+       pr_err("RGB_LED_SRC_SEL = 0x%x\n", val);
+
        led->rgb_cfg->pwm_cfg->blinking = false;
        qpnp_dump_regs(led, rgb_pwm_debug_regs, ARRAY_SIZE(rgb_pwm_debug_regs));

Konrad