Skip to contentSkip to conversation

Add PM8350C PMIC PWM support for backlight

PATCH In review Satya Priya 3 participants 6 messages Oct 19, 2021 – Oct 22, 2021

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

v2 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=560587&state=%2A&archive=both

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 v2 1/3 dt-bindings: leds: Add pm8350c pmic support

From: satya priya <[email protected]>

Add pm8350c pmic pwm support.

---
Changes in V2:
- No changes.

 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 336bd8e..409a4c7 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
#2 lore raw

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

In reply to Satya Priya

From: satya priya <[email protected]>

Add pm8350c compatible and lpg_data to the driver.

---
Changes in V2:
- Added const for lpg_channel_data[] struct.

 drivers/leds/rgb/leds-qcom-lpg.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/leds/rgb/leds-qcom-lpg.c +10 -0
index 45ef4ec..99235af 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 = (const 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
#3 lore raw

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

Quoted 18 lines · Satya Priya

From: satya priya <[email protected]>

Add pm8350c compatible and lpg_data to the driver.

---
Changes in V2:
- Added const for lpg_channel_data[] struct.

 drivers/leds/rgb/leds-qcom-lpg.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/leds/rgb/leds-qcom-lpg.c +0 -0
index 45ef4ec..99235af 100644

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

Quoted 7 lines
drivers/leds/rgb/leds-qcom-lpg.c +4 -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,

No, this should be 4. The fact that you only care about the first channel in your product should be reflected in the dts, not in the driver.

Thanks,
Bjorn

Quoted 16 lines
drivers/leds/rgb/leds-qcom-lpg.c +6 -0
+	.channels = (const 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
#4 lore raw

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

In reply to Satya Priya

From: satya priya <[email protected]>

Add pwm support for PM8350C pmic.

---
Changes in V2:
- Dropped suffix '4' from pwm phandle and removed "status=ok".

 arch/arm64/boot/dts/qcom/pm8350c.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm64/boot/dts/qcom/pm8350c.dtsi +6 -0
index e1b75ae..08fc0a8 100644
@@ -29,6 +29,12 @@
 			interrupt-controller;
 			#interrupt-cells = <2>;
 		};
+
+		pm8350c_pwm: pwm {
+			compatible = "qcom,pm8350c-pwm";
+			#pwm-cells = <2>;
+			status = "disabled";
+		};
 	};
 };
 
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

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

Quoting Satya Priya (2021-10-19 03:48:51)

Quoted 17 lines

From: satya priya <[email protected]>

Add pwm support for PM8350C pmic.

---
Changes in V2:
- Dropped suffix '4' from pwm phandle and removed "status=ok".

 arch/arm64/boot/dts/qcom/pm8350c.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm64/boot/dts/qcom/pm8350c.dtsi +0 -0
index e1b75ae..08fc0a8 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_pwm: pwm {
+                       compatible = "qcom,pm8350c-pwm";

It should have a reg property. Every node should have a single cell for the reg property because the parent has #address-cells = <1>

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