* [PATCH v2 0/5] Qualcomm LPG support for PM8150b/l
@ 2020-10-30 1:07 Dmitry Baryshkov
2020-10-30 1:07 ` [PATCH v2 1/5] dt-bindings: leds: leds-qcom-lpg: add pm8150[bl] compatible strings Dmitry Baryshkov
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Dmitry Baryshkov @ 2020-10-30 1:07 UTC (permalink / raw)
To: Bjorn Andersson, Pavel Machek, Dan Murphy
Cc: linux-leds, Rob Herring, devicetree, linux-arm-msm
This patchset brings support for LPG blocks on Qualcomm's PM8150[BL]
PMIC chips, see [1]. PM8150L support was tested on RB5 platform.
This patchset can be folded into the aforementioned series, if Bjorn
would like to, or it can go as a separate instance.
Changes since v1:
- Changed lpg data fields to use 'triled_has_foo_ctl' rather than
'triled_no_foo_ctl'
[1] https://lore.kernel.org/linux-arm-msm/20201021201224.3430546-1-bjorn.andersson@linaro.org/
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 1/5] dt-bindings: leds: leds-qcom-lpg: add pm8150[bl] compatible strings
2020-10-30 1:07 [PATCH v2 0/5] Qualcomm LPG support for PM8150b/l Dmitry Baryshkov
@ 2020-10-30 1:07 ` Dmitry Baryshkov
2020-10-30 1:07 ` [PATCH v2 2/5] leds: qcom-lpg: add support for pm8150[bl] leds Dmitry Baryshkov
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Dmitry Baryshkov @ 2020-10-30 1:07 UTC (permalink / raw)
To: Bjorn Andersson, Pavel Machek, Dan Murphy
Cc: linux-leds, Rob Herring, devicetree, linux-arm-msm, Rob Herring
Add two more compatible strings for Light Pulse Generator blocks as
found on PM8150B and PM8150A/L chips.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Acked-by: Rob Herring <robh@kernel.org>
---
Documentation/devicetree/bindings/leds/leds-qcom-lpg.yaml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Documentation/devicetree/bindings/leds/leds-qcom-lpg.yaml b/Documentation/devicetree/bindings/leds/leds-qcom-lpg.yaml
index 5ccf0f3d8f1b..0474f1d998ff 100644
--- a/Documentation/devicetree/bindings/leds/leds-qcom-lpg.yaml
+++ b/Documentation/devicetree/bindings/leds/leds-qcom-lpg.yaml
@@ -17,6 +17,8 @@ description: >
properties:
compatible:
enum:
+ - qcom,pm8150b-lpg
+ - qcom,pm8150l-lpg
- qcom,pm8916-pwm
- qcom,pm8941-lpg
- qcom,pm8994-lpg
--
2.28.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 2/5] leds: qcom-lpg: add support for pm8150[bl] leds
2020-10-30 1:07 [PATCH v2 0/5] Qualcomm LPG support for PM8150b/l Dmitry Baryshkov
2020-10-30 1:07 ` [PATCH v2 1/5] dt-bindings: leds: leds-qcom-lpg: add pm8150[bl] compatible strings Dmitry Baryshkov
@ 2020-10-30 1:07 ` Dmitry Baryshkov
2020-11-25 12:22 ` Pavel Machek
2020-10-30 1:07 ` [PATCH v2 3/5] arm64: dts: pm8150b: add Light Pulse Generator device node Dmitry Baryshkov
` (2 subsequent siblings)
4 siblings, 1 reply; 7+ messages in thread
From: Dmitry Baryshkov @ 2020-10-30 1:07 UTC (permalink / raw)
To: Bjorn Andersson, Pavel Machek, Dan Murphy
Cc: linux-leds, Rob Herring, devicetree, linux-arm-msm
Add support for the LPG/PWM block found on newer PMICs: PM8150B and
PM8150A/L.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
drivers/leds/leds-qcom-lpg.c | 68 ++++++++++++++++++++++++++++++++----
1 file changed, 61 insertions(+), 7 deletions(-)
diff --git a/drivers/leds/leds-qcom-lpg.c b/drivers/leds/leds-qcom-lpg.c
index 86131a65d2c5..4770fc46f312 100644
--- a/drivers/leds/leds-qcom-lpg.c
+++ b/drivers/leds/leds-qcom-lpg.c
@@ -48,6 +48,8 @@ struct lpg_data;
* @lut_bitmap: allocation bitmap for LUT entries
* @triled_base: base address of the TRILED block (optional)
* @triled_src: power-source for the TRILED
+ * @triled_has_atc_ctl: true if there is TRI_LED_ATC_CTL register
+ * @triled_has_src_sel: true if there is TRI_LED_SRC_SEL register
* @channels: list of PWM channels
* @num_channels: number of @channels
*/
@@ -65,6 +67,8 @@ struct lpg {
u32 triled_base;
u32 triled_src;
+ bool triled_has_atc_ctl;
+ bool triled_has_src_sel;
struct lpg_channel *channels;
unsigned int num_channels;
@@ -165,6 +169,8 @@ struct lpg_channel_data {
* @lut_base: base address of LUT block
* @lut_size: number of entries in LUT
* @triled_base: base address of TRILED
+ * @triled_has_atc_ctl: true if there is TRI_LED_ATC_CTL register
+ * @triled_has_src_sel: true if there is TRI_LED_SRC_SEL register
* @pwm_9bit_mask: bitmask for switching from 6bit to 9bit pwm
* @num_channels: number of channels in LPG
* @channels: list of channel initialization data
@@ -173,6 +179,8 @@ struct lpg_data {
unsigned int lut_base;
unsigned int lut_size;
unsigned int triled_base;
+ bool triled_has_atc_ctl;
+ bool triled_has_src_sel;
unsigned int pwm_9bit_mask;
int num_channels;
struct lpg_channel_data *channels;
@@ -986,18 +994,24 @@ static int lpg_init_triled(struct lpg *lpg)
return 0;
lpg->triled_base = lpg->data->triled_base;
-
- ret = of_property_read_u32(np, "qcom,power-source", &lpg->triled_src);
- if (ret || lpg->triled_src == 2 || lpg->triled_src > 3) {
- dev_err(lpg->dev, "invalid power source\n");
- return -EINVAL;
+ lpg->triled_has_atc_ctl = lpg->data->triled_has_atc_ctl;
+ lpg->triled_has_src_sel = lpg->data->triled_has_src_sel;
+
+ if (lpg->triled_has_src_sel) {
+ ret = of_property_read_u32(np, "qcom,power-source", &lpg->triled_src);
+ if (ret || lpg->triled_src == 2 || lpg->triled_src > 3) {
+ dev_err(lpg->dev, "invalid power source\n");
+ return -EINVAL;
+ }
}
/* Disable automatic trickle charge LED */
- regmap_write(lpg->map, lpg->triled_base + TRI_LED_ATC_CTL, 0);
+ if (lpg->triled_has_atc_ctl)
+ regmap_write(lpg->map, lpg->triled_base + TRI_LED_ATC_CTL, 0);
/* Configure power source */
- regmap_write(lpg->map, lpg->triled_base + TRI_LED_SRC_SEL, lpg->triled_src);
+ if (lpg->triled_has_src_sel)
+ regmap_write(lpg->map, lpg->triled_base + TRI_LED_SRC_SEL, lpg->triled_src);
/* Default all outputs to off */
regmap_write(lpg->map, lpg->triled_base + TRI_LED_EN_CTL, 0);
@@ -1099,6 +1113,8 @@ static const struct lpg_data pm8941_lpg_data = {
.lut_size = 64,
.triled_base = 0xd000,
+ .triled_has_atc_ctl = true,
+ .triled_has_src_sel = true,
.pwm_9bit_mask = 3 << 4,
@@ -1137,6 +1153,8 @@ static const struct lpg_data pmi8994_lpg_data = {
.lut_size = 24,
.triled_base = 0xd000,
+ .triled_has_atc_ctl = true,
+ .triled_has_src_sel = true,
.pwm_9bit_mask = BIT(4),
@@ -1166,12 +1184,48 @@ static const struct lpg_data pmi8998_lpg_data = {
},
};
+static const struct lpg_data pm8150b_lpg_data = {
+ .lut_base = 0xb000,
+ .lut_size = 49,
+
+ .triled_base = 0xd000,
+
+ .pwm_9bit_mask = BIT(4),
+
+ .num_channels = 2,
+ .channels = (struct lpg_channel_data[]) {
+ { .base = 0xb100, .triled_mask = BIT(7) },
+ { .base = 0xb200, .triled_mask = BIT(6) },
+ },
+};
+
+static const struct lpg_data pm8150l_lpg_data = {
+ .lut_base = 0xb000,
+ .lut_size = 49,
+
+ .triled_base = 0xd000,
+
+ .pwm_9bit_mask = BIT(4),
+
+ .num_channels = 5,
+ .channels = (struct lpg_channel_data[]) {
+ { .base = 0xb100, .triled_mask = BIT(7) },
+ { .base = 0xb200, .triled_mask = BIT(6) },
+ { .base = 0xb300, .triled_mask = BIT(5) },
+ { .base = 0xbc00 },
+ { .base = 0xbd00 },
+
+ },
+};
+
static const struct of_device_id lpg_of_table[] = {
{ .compatible = "qcom,pm8916-pwm", .data = &pm8916_pwm_data },
{ .compatible = "qcom,pm8941-lpg", .data = &pm8941_lpg_data },
{ .compatible = "qcom,pm8994-lpg", .data = &pm8994_lpg_data },
{ .compatible = "qcom,pmi8994-lpg", .data = &pmi8994_lpg_data },
{ .compatible = "qcom,pmi8998-lpg", .data = &pmi8998_lpg_data },
+ { .compatible = "qcom,pm8150b-lpg", .data = &pm8150b_lpg_data },
+ { .compatible = "qcom,pm8150l-lpg", .data = &pm8150l_lpg_data },
{}
};
MODULE_DEVICE_TABLE(of, lpg_of_table);
--
2.28.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 3/5] arm64: dts: pm8150b: add Light Pulse Generator device node
2020-10-30 1:07 [PATCH v2 0/5] Qualcomm LPG support for PM8150b/l Dmitry Baryshkov
2020-10-30 1:07 ` [PATCH v2 1/5] dt-bindings: leds: leds-qcom-lpg: add pm8150[bl] compatible strings Dmitry Baryshkov
2020-10-30 1:07 ` [PATCH v2 2/5] leds: qcom-lpg: add support for pm8150[bl] leds Dmitry Baryshkov
@ 2020-10-30 1:07 ` Dmitry Baryshkov
2020-10-30 1:07 ` [PATCH v2 4/5] arm64: dts: pm8150l: " Dmitry Baryshkov
2020-10-30 1:07 ` [PATCH v2 5/5] arm64: dts: qrb5165-rb5: declare tri-led user leds Dmitry Baryshkov
4 siblings, 0 replies; 7+ messages in thread
From: Dmitry Baryshkov @ 2020-10-30 1:07 UTC (permalink / raw)
To: Bjorn Andersson, Pavel Machek, Dan Murphy
Cc: linux-leds, Rob Herring, devicetree, linux-arm-msm
Add device node defining LPG/PWM block on PM8150B PMIC chip.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
arch/arm64/boot/dts/qcom/pm8150b.dtsi | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/arch/arm64/boot/dts/qcom/pm8150b.dtsi b/arch/arm64/boot/dts/qcom/pm8150b.dtsi
index d6e075f92b1e..30e7a5f19e5f 100644
--- a/arch/arm64/boot/dts/qcom/pm8150b.dtsi
+++ b/arch/arm64/boot/dts/qcom/pm8150b.dtsi
@@ -133,5 +133,14 @@ pmic@3 {
reg = <0x3 SPMI_USID>;
#address-cells = <1>;
#size-cells = <0>;
+
+ pm8150b_lpg: lpg {
+ compatible = "qcom,pm8150b-lpg";
+
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ status = "disabled";
+ };
};
};
--
2.28.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 4/5] arm64: dts: pm8150l: add Light Pulse Generator device node
2020-10-30 1:07 [PATCH v2 0/5] Qualcomm LPG support for PM8150b/l Dmitry Baryshkov
` (2 preceding siblings ...)
2020-10-30 1:07 ` [PATCH v2 3/5] arm64: dts: pm8150b: add Light Pulse Generator device node Dmitry Baryshkov
@ 2020-10-30 1:07 ` Dmitry Baryshkov
2020-10-30 1:07 ` [PATCH v2 5/5] arm64: dts: qrb5165-rb5: declare tri-led user leds Dmitry Baryshkov
4 siblings, 0 replies; 7+ messages in thread
From: Dmitry Baryshkov @ 2020-10-30 1:07 UTC (permalink / raw)
To: Bjorn Andersson, Pavel Machek, Dan Murphy
Cc: linux-leds, Rob Herring, devicetree, linux-arm-msm
Add device node defining LPG/PWM block on PM8150L PMIC chip.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
arch/arm64/boot/dts/qcom/pm8150l.dtsi | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/arch/arm64/boot/dts/qcom/pm8150l.dtsi b/arch/arm64/boot/dts/qcom/pm8150l.dtsi
index 9f214ceec2b7..e8926d6c32cb 100644
--- a/arch/arm64/boot/dts/qcom/pm8150l.dtsi
+++ b/arch/arm64/boot/dts/qcom/pm8150l.dtsi
@@ -114,5 +114,15 @@ pmic@5 {
reg = <0x5 SPMI_USID>;
#address-cells = <1>;
#size-cells = <0>;
+
+ pm8150l_lpg: lpg {
+ compatible = "qcom,pm8150l-lpg";
+
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ status = "disabled";
+ };
+
};
};
--
2.28.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 5/5] arm64: dts: qrb5165-rb5: declare tri-led user leds
2020-10-30 1:07 [PATCH v2 0/5] Qualcomm LPG support for PM8150b/l Dmitry Baryshkov
` (3 preceding siblings ...)
2020-10-30 1:07 ` [PATCH v2 4/5] arm64: dts: pm8150l: " Dmitry Baryshkov
@ 2020-10-30 1:07 ` Dmitry Baryshkov
4 siblings, 0 replies; 7+ messages in thread
From: Dmitry Baryshkov @ 2020-10-30 1:07 UTC (permalink / raw)
To: Bjorn Andersson, Pavel Machek, Dan Murphy
Cc: linux-leds, Rob Herring, devicetree, linux-arm-msm
Qualcomm RB5 platform uses Light Pulse Generator tri-led block to drive
three green leds. Add device nodes defining those leds.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
arch/arm64/boot/dts/qcom/qrb5165-rb5.dts | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts b/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts
index df2d01f915c9..bf3d3f44016e 100644
--- a/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts
+++ b/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts
@@ -1017,6 +1017,29 @@ &pm8150_rtc {
status = "okay";
};
+&pm8150l_lpg {
+ status = "okay";
+
+ led@1 {
+ reg = <1>;
+ label = "green:user0";
+
+ linux,default-trigger = "heartbeat";
+ default-state = "on";
+ };
+
+ led@2 {
+ reg = <2>;
+ label = "green:user1";
+ default-state = "on";
+ };
+
+ led@3 {
+ reg = <3>;
+ label = "green:user2";
+ };
+};
+
&qupv3_id_0 {
status = "okay";
};
--
2.28.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/5] leds: qcom-lpg: add support for pm8150[bl] leds
2020-10-30 1:07 ` [PATCH v2 2/5] leds: qcom-lpg: add support for pm8150[bl] leds Dmitry Baryshkov
@ 2020-11-25 12:22 ` Pavel Machek
0 siblings, 0 replies; 7+ messages in thread
From: Pavel Machek @ 2020-11-25 12:22 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: Bjorn Andersson, Dan Murphy, linux-leds, Rob Herring, devicetree,
linux-arm-msm
[-- Attachment #1: Type: text/plain, Size: 408 bytes --]
On Fri 2020-10-30 04:07:10, Dmitry Baryshkov wrote:
> Add support for the LPG/PWM block found on newer PMICs: PM8150B and
> PM8150A/L.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
1,2: Acked-by: Pavel Machek <pavel@ucw.cz>
...but they don't apply to current leds-next tree, so I'm not taking
them.
Best regards,
Pavel--
http://www.livejournal.com/~pavelmachek
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-11-25 12:23 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-30 1:07 [PATCH v2 0/5] Qualcomm LPG support for PM8150b/l Dmitry Baryshkov
2020-10-30 1:07 ` [PATCH v2 1/5] dt-bindings: leds: leds-qcom-lpg: add pm8150[bl] compatible strings Dmitry Baryshkov
2020-10-30 1:07 ` [PATCH v2 2/5] leds: qcom-lpg: add support for pm8150[bl] leds Dmitry Baryshkov
2020-11-25 12:22 ` Pavel Machek
2020-10-30 1:07 ` [PATCH v2 3/5] arm64: dts: pm8150b: add Light Pulse Generator device node Dmitry Baryshkov
2020-10-30 1:07 ` [PATCH v2 4/5] arm64: dts: pm8150l: " Dmitry Baryshkov
2020-10-30 1:07 ` [PATCH v2 5/5] arm64: dts: qrb5165-rb5: declare tri-led user leds Dmitry Baryshkov
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.