Skip to contentSkip to conversation

Add PM8350C PMIC PWM support for backlight

PATCH Superseded satya priya 5 participants 20 messages Sep 6, 2021 – Sep 9, 2021

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Add PM8350C PMIC PWM support for backlight

This series depends on [1], which adds driver for Qualcomm LPG.

[1] https://patchwork.kernel.org/project/linux-arm-msm/list/?series=505483&archive=both&state=*

satya priya (3):
dt-bindings: leds: Add pm8350c pmic support
leds: Add pm8350c support to Qualcomm LPG driver
arm64: dts: qcom: pm8350c: Add pwm support

 Documentation/devicetree/bindings/leds/leds-qcom-lpg.yaml |  1 +
 arch/arm64/boot/dts/qcom/pm8350c.dtsi                     |  6 ++++++
 drivers/leds/rgb/leds-qcom-lpg.c                          | 10 ++++++++++
 3 files changed, 17 insertions(+)
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member 
of Code Aurora Forum, hosted by The Linux Foundation
#1 lore raw

PATCH 1/3 dt-bindings: leds: Add pm8350c pmic support

Add pm8350c pmic pwm support.

---
 Documentation/devicetree/bindings/leds/leds-qcom-lpg.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/leds/leds-qcom-lpg.yaml +1 -0
index 10aee61..56d7a39 100644
@@ -19,6 +19,7 @@ properties:
     enum:
       - qcom,pm8150b-lpg
       - qcom,pm8150l-lpg
+      - qcom,pm8350c-pwm
       - qcom,pm8916-pwm
       - qcom,pm8941-lpg
       - qcom,pm8994-lpg
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member 
of Code Aurora Forum, hosted by The Linux Foundation
#5 lore raw

PATCH 2/3 leds: Add pm8350c support to Qualcomm LPG driver

In reply to satya priya

Add pm8350c compatible and lpg_data to the driver.

---
 drivers/leds/rgb/leds-qcom-lpg.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/leds/rgb/leds-qcom-lpg.c +10 -0
index 327e81a..6ee80d6 100644
@@ -1275,9 +1275,19 @@ static const struct lpg_data pm8150l_lpg_data = {
 	},
 };
 
+static const struct lpg_data pm8350c_pwm_data = {
+	.pwm_9bit_mask = BIT(2),
+
+	.num_channels = 1,
+	.channels = (struct lpg_channel_data[]) {
+		{ .base = 0xeb00 },
+	},
+};
+
 static const struct of_device_id lpg_of_table[] = {
 	{ .compatible = "qcom,pm8150b-lpg", .data = &pm8150b_lpg_data },
 	{ .compatible = "qcom,pm8150l-lpg", .data = &pm8150l_lpg_data },
+	{ .compatible = "qcom,pm8350c-pwm", .data = &pm8350c_pwm_data },
 	{ .compatible = "qcom,pm8916-pwm", .data = &pm8916_pwm_data },
 	{ .compatible = "qcom,pm8941-lpg", .data = &pm8941_lpg_data },
 	{ .compatible = "qcom,pm8994-lpg", .data = &pm8994_lpg_data },
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member 
of Code Aurora Forum, hosted by The Linux Foundation
#6 lore raw

Re: [PATCH 2/3] leds: Add pm8350c support to Qualcomm LPG driver

Quoted 6 lines · satya priya

Add pm8350c compatible and lpg_data to the driver.

---
 drivers/leds/rgb/leds-qcom-lpg.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

That driver does not exist in upstream or -next. Looks like this is a patch from some downstream tree, which you should not use as base for sending patches upstream.

It seems you need to send patches for the entire driver + bindings.

#7 lore raw

Re: [PATCH 2/3] leds: Add pm8350c support to Qualcomm LPG driver

Quoted 8 lines · Matthias Kaehlcke
Quoted 6 lines · satya priya

Add pm8350c compatible and lpg_data to the driver.

---
 drivers/leds/rgb/leds-qcom-lpg.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
Quoted 5 lines

That driver does not exist in upstream or -next. Looks like this is a patch from some downstream tree, which you should not use as base for sending patches upstream.

It seems you need to send patches for the entire driver + bindings.

Sorry, my bad, I should have read the cover letter, which mentions the
dependency on https://patchwork.kernel.org/project/linux-arm-msm/list/?series=505483&archive=both&state=*

#9 lore raw

Re: [PATCH 2/3] leds: Add pm8350c support to Qualcomm LPG driver

In reply to satya priya

Quoting satya priya (2021-09-06 03:41:06)

Quoted 12 lines

Add pm8350c compatible and lpg_data to the driver.

---
 drivers/leds/rgb/leds-qcom-lpg.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/leds/rgb/leds-qcom-lpg.c +0 -0
index 327e81a..6ee80d6 100644

drivers/leds/rgb/leds-qcom-lpg.c static const struct lpg_data pm8150l_lpg_data = { · line 1282

Quoted 8 lines
drivers/leds/rgb/leds-qcom-lpg.c +5 -0
@@ -1275,9 +1275,19 @@ static const struct lpg_data pm8150l_lpg_data = {
        },
 };
 
+static const struct lpg_data pm8350c_pwm_data = {
+       .pwm_9bit_mask = BIT(2),
+
+       .num_channels = 1,
+       .channels = (struct lpg_channel_data[]) {

Can this be const struct lpg_channel_data? I think that will move it to rodata which is only a good thing.

Quoted 11 lines
drivers/leds/rgb/leds-qcom-lpg.c +5 -0
+               { .base = 0xeb00 },
+       },
+};
+
 static const struct of_device_id lpg_of_table[] = {
        { .compatible = "qcom,pm8150b-lpg", .data = &pm8150b_lpg_data },
        { .compatible = "qcom,pm8150l-lpg", .data = &pm8150l_lpg_data },
+       { .compatible = "qcom,pm8350c-pwm", .data = &pm8350c_pwm_data },
        { .compatible = "qcom,pm8916-pwm", .data = &pm8916_pwm_data },
        { .compatible = "qcom,pm8941-lpg", .data = &pm8941_lpg_data },
        { .compatible = "qcom,pm8994-lpg", .data = &pm8994_lpg_data },
#10 lore raw

Re: [PATCH 2/3] leds: Add pm8350c support to Qualcomm LPG driver

Quoted 17 lines · Stephen Boyd

Quoting satya priya (2021-09-06 03:41:06)

Quoted 16 lines

Add pm8350c compatible and lpg_data to the driver.

---
 drivers/leds/rgb/leds-qcom-lpg.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/leds/rgb/leds-qcom-lpg.c +0 -0
index 327e81a..6ee80d6 100644
@@ -1275,9 +1275,19 @@ static const struct lpg_data pm8150l_lpg_data = 
 {
        },
 };
 
Quoted 9 lines

drivers/leds/rgb/leds-qcom-lpg.c static const struct lpg_data pm8150l_lpg_data = { · line 1282

Quoted 5 lines
drivers/leds/rgb/leds-qcom-lpg.c +5 -0
+static const struct lpg_data pm8350c_pwm_data = {
+       .pwm_9bit_mask = BIT(2),
+
+       .num_channels = 1,
+       .channels = (struct lpg_channel_data[]) {

Can this be const struct lpg_channel_data? I think that will move it to rodata which is only a good thing.

I agree.
@Bjorn, can we make it const struct?

Quoted 14 lines
Quoted 14 lines
drivers/leds/rgb/leds-qcom-lpg.c +5 -0
+               { .base = 0xeb00 },
+       },
+};
+
 static const struct of_device_id lpg_of_table[] = {
        { .compatible = "qcom,pm8150b-lpg", .data = &pm8150b_lpg_data 
 },
        { .compatible = "qcom,pm8150l-lpg", .data = &pm8150l_lpg_data 
 },
+       { .compatible = "qcom,pm8350c-pwm", .data = &pm8350c_pwm_data 

},

        { .compatible = "qcom,pm8916-pwm", .data = &pm8916_pwm_data },
        { .compatible = "qcom,pm8941-lpg", .data = &pm8941_lpg_data },
        { .compatible = "qcom,pm8994-lpg", .data = &pm8994_lpg_data },
#11 lore raw

Re: [PATCH 2/3] leds: Add pm8350c support to Qualcomm LPG driver

Quoted 29 lines · On Wed 08 Sep 02:17 PDT 2021, [email protected] wrote:
Quoted 18 lines · Stephen Boyd

Quoting satya priya (2021-09-06 03:41:06)

Quoted 17 lines

Add pm8350c compatible and lpg_data to the driver.

---
 drivers/leds/rgb/leds-qcom-lpg.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/leds/rgb/leds-qcom-lpg.c +0 -0
index 327e81a..6ee80d6 100644
@@ -1275,9 +1275,19 @@ static const struct lpg_data pm8150l_lpg_data
 = {
        },
 };
 
Quoted 9 lines

drivers/leds/rgb/leds-qcom-lpg.c static const struct lpg_data pm8150l_lpg_data = { · line 1282

Quoted 5 lines
drivers/leds/rgb/leds-qcom-lpg.c +5 -0
+static const struct lpg_data pm8350c_pwm_data = {
+       .pwm_9bit_mask = BIT(2),
+
+       .num_channels = 1,
+       .channels = (struct lpg_channel_data[]) {

Can this be const struct lpg_channel_data? I think that will move it to rodata which is only a good thing.

Quoted 3 lines

I agree.
@Bjorn, can we make it const struct?

I like it and have updated the driver patches accordingly.

Seems like I still have a couple of more comments from Uwe left to resolve on v9 of the driver, I'll fix those up and post the driver again.

Thanks,
Bjorn

Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
drivers/leds/rgb/leds-qcom-lpg.c +5 -0
+               { .base = 0xeb00 },
+       },
+};
+
 static const struct of_device_id lpg_of_table[] = {
        { .compatible = "qcom,pm8150b-lpg", .data =
 &pm8150b_lpg_data },
        { .compatible = "qcom,pm8150l-lpg", .data =
 &pm8150l_lpg_data },
+       { .compatible = "qcom,pm8350c-pwm", .data =

&pm8350c_pwm_data },

        { .compatible = "qcom,pm8916-pwm", .data = &pm8916_pwm_data },
        { .compatible = "qcom,pm8941-lpg", .data = &pm8941_lpg_data },
        { .compatible = "qcom,pm8994-lpg", .data = &pm8994_lpg_data },
#12 lore raw

PATCH 3/3 arm64: dts: qcom: pm8350c: Add pwm support

In reply to satya priya

Add pwm support for PM8350C pmic.

---
 arch/arm64/boot/dts/qcom/pm8350c.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm64/boot/dts/qcom/pm8350c.dtsi +6 -0
index e1b75ae..ecdae55 100644
@@ -29,6 +29,12 @@
 			interrupt-controller;
 			#interrupt-cells = <2>;
 		};
+
+		pm8350c_pwm4: pwm {
+			compatible = "qcom,pm8350c-pwm";
+			#pwm-cells = <2>;
+			status = "okay";
+		};
 	};
 };
 
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member 
of Code Aurora Forum, hosted by The Linux Foundation
#13 lore raw

Re: [PATCH 3/3] arm64: dts: qcom: pm8350c: Add pwm support

Quoted 12 lines · satya priya

Add pwm support for PM8350C pmic.

---
 arch/arm64/boot/dts/qcom/pm8350c.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm64/boot/dts/qcom/pm8350c.dtsi +0 -0
index e1b75ae..ecdae55 100644

arch/arm64/boot/dts/qcom/pm8350c.dtsi line 33

Quoted 5 lines
arch/arm64/boot/dts/qcom/pm8350c.dtsi +2 -0
@@ -29,6 +29,12 @@
 			interrupt-controller;
 			#interrupt-cells = <2>;
 		};
+
+		pm8350c_pwm4: pwm {

What does the '4' represent, an internal channel number? It should probably be omitted if the PM8350 only has a single output PWM port.

arch/arm64/boot/dts/qcom/pm8350c.dtsi line 36

Quoted 3 lines
arch/arm64/boot/dts/qcom/pm8350c.dtsi +3 -0
+			compatible = "qcom,pm8350c-pwm";
+			#pwm-cells = <2>;
+			status = "okay";

I don't think it should be enabled by default, there may be boards with the PM8350C that don't use the PWM.

#14 lore raw

Re: [PATCH 3/3] arm64: dts: qcom: pm8350c: Add pwm support

Quoted 8 lines · Matthias Kaehlcke
Quoted 7 lines · satya priya

Add pwm support for PM8350C pmic.

---
 arch/arm64/boot/dts/qcom/pm8350c.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)
Quoted 15 lines

arch/arm64/boot/dts/qcom/pm8350c.dtsi line 33

Quoted 10 lines
arch/arm64/boot/dts/qcom/pm8350c.dtsi +2 -0
index e1b75ae..ecdae55 100644
@@ -29,6 +29,12 @@
 			interrupt-controller;
 			#interrupt-cells = <2>;
 		};
+
+		pm8350c_pwm4: pwm {

What does the '4' represent, an internal channel number? It should probably be omitted if the PM8350 only has a single output PWM port.

pm8350c has four PWMs, but I think we can drop the '4' here.

Quoted 6 lines

arch/arm64/boot/dts/qcom/pm8350c.dtsi line 36

Quoted 3 lines
arch/arm64/boot/dts/qcom/pm8350c.dtsi +3 -0
+			compatible = "qcom,pm8350c-pwm";
+			#pwm-cells = <2>;
+			status = "okay";

I don't think it should be enabled by default, there may be boards with the PM8350C that don't use the PWM.

Okay.

#15 lore raw

Re: [PATCH 3/3] arm64: dts: qcom: pm8350c: Add pwm support

Quoted 26 lines · On Wed, Sep 08, 2021 at 02:37:39PM +0530, [email protected] wrote:
Quoted 8 lines · Matthias Kaehlcke
Quoted 7 lines · satya priya

Add pwm support for PM8350C pmic.

---
 arch/arm64/boot/dts/qcom/pm8350c.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)
Quoted 16 lines

arch/arm64/boot/dts/qcom/pm8350c.dtsi line 33

Quoted 11 lines
arch/arm64/boot/dts/qcom/pm8350c.dtsi +2 -0
index e1b75ae..ecdae55 100644
@@ -29,6 +29,12 @@
 			interrupt-controller;
 			#interrupt-cells = <2>;
 		};
+
+		pm8350c_pwm4: pwm {

What does the '4' represent, an internal channel number? It should probably be omitted if the PM8350 only has a single output PWM port.

Quoted 1 line

pm8350c has four PWMs, but I think we can drop the '4' here.

Why is only one PWM exposed if the PMIC has for of them? Why number 4 and not one of the others?

#16 lore raw

Re: [PATCH 3/3] arm64: dts: qcom: pm8350c: Add pwm support

Quoted 27 lines · Matthias Kaehlcke
Quoted 26 lines · On Wed, Sep 08, 2021 at 02:37:39PM +0530, [email protected] wrote:
Quoted 24 lines · Matthias Kaehlcke
Quoted 13 lines · satya priya

Add pwm support for PM8350C pmic.

---
 arch/arm64/boot/dts/qcom/pm8350c.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm64/boot/dts/qcom/pm8350c.dtsi +0 -0
index e1b75ae..ecdae55 100644

arch/arm64/boot/dts/qcom/pm8350c.dtsi line 33

Quoted 5 lines
arch/arm64/boot/dts/qcom/pm8350c.dtsi +2 -0
@@ -29,6 +29,12 @@
 			interrupt-controller;
 			#interrupt-cells = <2>;
 		};
+
+		pm8350c_pwm4: pwm {

What does the '4' represent, an internal channel number? It should probably be omitted if the PM8350 only has a single output PWM port.

Quoted 4 lines
Quoted 1 line

pm8350c has four PWMs, but I think we can drop the '4' here.

Why is only one PWM exposed if the PMIC has for of them? Why number 4 and not one of the others?

The node should represent all 4 channels, which ones the board uses is captured in how they are bound to other clients - or defines as LEDs by additional child nodes.

Regards,
Bjorn

#17 lore raw

Re: [PATCH 3/3] arm64: dts: qcom: pm8350c: Add pwm support

Quoted 29 lines · Bjorn Andersson
Quoted 27 lines · Matthias Kaehlcke
Quoted 26 lines · On Wed, Sep 08, 2021 at 02:37:39PM +0530, [email protected] wrote:
Quoted 24 lines · Matthias Kaehlcke
Quoted 13 lines · satya priya

Add pwm support for PM8350C pmic.

---
 arch/arm64/boot/dts/qcom/pm8350c.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm64/boot/dts/qcom/pm8350c.dtsi +0 -0
index e1b75ae..ecdae55 100644

arch/arm64/boot/dts/qcom/pm8350c.dtsi line 33

Quoted 5 lines
arch/arm64/boot/dts/qcom/pm8350c.dtsi +2 -0
@@ -29,6 +29,12 @@
 			interrupt-controller;
 			#interrupt-cells = <2>;
 		};
+
+		pm8350c_pwm4: pwm {

What does the '4' represent, an internal channel number? It should probably be omitted if the PM8350 only has a single output PWM port.

Quoted 5 lines
Quoted 4 lines
Quoted 1 line

pm8350c has four PWMs, but I think we can drop the '4' here.

Why is only one PWM exposed if the PMIC has for of them? Why number 4 and not one of the others?

pwm4 is used for backlight support on kodiak crd board, so I mentioned 4, thinking 4 nodes should be present for 4 pwms. but I see that we need to represent all the four channels as one node. will drop the '4' in next version.

Thanks,
Satya Priya

Quoted 6 lines

The node should represent all 4 channels, which ones the board uses is captured in how they are bound to other clients - or defines as LEDs by additional child nodes.

Regards,
Bjorn

#18 lore raw

Re: [PATCH 3/3] arm64: dts: qcom: pm8350c: Add pwm support

In reply to satya priya

Quoting satya priya (2021-09-06 03:41:07)

Quoted 12 lines

Add pwm support for PM8350C pmic.

---
 arch/arm64/boot/dts/qcom/pm8350c.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm64/boot/dts/qcom/pm8350c.dtsi +0 -0
index e1b75ae..ecdae55 100644

arch/arm64/boot/dts/qcom/pm8350c.dtsi line 34

Quoted 6 lines
arch/arm64/boot/dts/qcom/pm8350c.dtsi +3 -0
@@ -29,6 +29,12 @@
                        interrupt-controller;
                        #interrupt-cells = <2>;
                };
+
+               pm8350c_pwm4: pwm {
+                       compatible = "qcom,pm8350c-pwm";

Shouldn't there be a reg property?

Quoted 10 lines
arch/arm64/boot/dts/qcom/pm8350c.dtsi +3 -1
+                       #pwm-cells = <2>;
+                       status = "okay";
+               };
        };
 };
 
--

QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation

#19 lore raw

Re: [PATCH 3/3] arm64: dts: qcom: pm8350c: Add pwm support

Quoted 8 lines · Stephen Boyd

Quoting satya priya (2021-09-06 03:41:07)

Quoted 7 lines

Add pwm support for PM8350C pmic.

---
 arch/arm64/boot/dts/qcom/pm8350c.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)
Quoted 14 lines

arch/arm64/boot/dts/qcom/pm8350c.dtsi line 34

Quoted 11 lines
arch/arm64/boot/dts/qcom/pm8350c.dtsi +3 -0
index e1b75ae..ecdae55 100644
@@ -29,6 +29,12 @@
                        interrupt-controller;
                        #interrupt-cells = <2>;
                };
+
+               pm8350c_pwm4: pwm {
+                       compatible = "qcom,pm8350c-pwm";

Shouldn't there be a reg property?

The bindings do not specify reg property. I think it is because we are adding the base address in struct "pm8350c_pwm_data".

Quoted 10 lines
Quoted 10 lines
arch/arm64/boot/dts/qcom/pm8350c.dtsi +3 -1
+                       #pwm-cells = <2>;
+                       status = "okay";
+               };
        };
 };
 
--

QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation