* [PATCH 0/5] Qualcomm LPG support for PM8150b/l
@ 2020-10-21 22:50 Dmitry Baryshkov
2020-10-21 22:50 ` [PATCH 1/5] dt-bindings: leds: leds-qcom-lpg: add pm8150[bl] compatible strings Dmitry Baryshkov
` (4 more replies)
0 siblings, 5 replies; 8+ messages in thread
From: Dmitry Baryshkov @ 2020-10-21 22:50 UTC (permalink / raw)
To: Bjorn Andersson, Pavel Machek, Dan Murphy
Cc: Rob Herring, linux-leds, 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.
[1] https://lore.kernel.org/linux-arm-msm/20201021201224.3430546-1-bjorn.andersson@linaro.org/
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/5] dt-bindings: leds: leds-qcom-lpg: add pm8150[bl] compatible strings
2020-10-21 22:50 [PATCH 0/5] Qualcomm LPG support for PM8150b/l Dmitry Baryshkov
@ 2020-10-21 22:50 ` Dmitry Baryshkov
2020-10-23 16:28 ` Rob Herring
2020-10-21 22:50 ` [PATCH 2/5] leds: qcom-lpg: add support for pm8150[bl] leds Dmitry Baryshkov
` (3 subsequent siblings)
4 siblings, 1 reply; 8+ messages in thread
From: Dmitry Baryshkov @ 2020-10-21 22:50 UTC (permalink / raw)
To: Bjorn Andersson, Pavel Machek, Dan Murphy
Cc: Rob Herring, linux-leds, devicetree, linux-arm-msm
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>
---
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] 8+ messages in thread
* [PATCH 2/5] leds: qcom-lpg: add support for pm8150[bl] leds
2020-10-21 22:50 [PATCH 0/5] Qualcomm LPG support for PM8150b/l Dmitry Baryshkov
2020-10-21 22:50 ` [PATCH 1/5] dt-bindings: leds: leds-qcom-lpg: add pm8150[bl] compatible strings Dmitry Baryshkov
@ 2020-10-21 22:50 ` Dmitry Baryshkov
2020-10-29 18:16 ` Pavel Machek
2020-10-21 22:50 ` [PATCH 3/5] arm64: dts: pm8150b: add Light Pulse Generator device node Dmitry Baryshkov
` (2 subsequent siblings)
4 siblings, 1 reply; 8+ messages in thread
From: Dmitry Baryshkov @ 2020-10-21 22:50 UTC (permalink / raw)
To: Bjorn Andersson, Pavel Machek, Dan Murphy
Cc: Rob Herring, linux-leds, 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..4d24e0c973d6 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_no_atc_ctl: true if there is no TRI_LED_ATC_CTL register
+ * @triled_no_src_sel: true if there is no 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_no_atc_ctl;
+ bool triled_no_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_no_atc_ctl: true if there is no TRI_LED_ATC_CTL register
+ * @triled_no_src_sel: true if there is no 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_no_atc_ctl;
+ bool triled_no_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_no_atc_ctl = lpg->data->triled_no_atc_ctl;
+ lpg->triled_no_src_sel = lpg->data->triled_no_src_sel;
+
+ if (!lpg->triled_no_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_no_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_no_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);
@@ -1166,12 +1180,52 @@ 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,
+ .triled_no_atc_ctl = true,
+ .triled_no_src_sel = true,
+
+ .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,
+ .triled_no_atc_ctl = true,
+ .triled_no_src_sel = true,
+
+ .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] 8+ messages in thread
* [PATCH 3/5] arm64: dts: pm8150b: add Light Pulse Generator device node
2020-10-21 22:50 [PATCH 0/5] Qualcomm LPG support for PM8150b/l Dmitry Baryshkov
2020-10-21 22:50 ` [PATCH 1/5] dt-bindings: leds: leds-qcom-lpg: add pm8150[bl] compatible strings Dmitry Baryshkov
2020-10-21 22:50 ` [PATCH 2/5] leds: qcom-lpg: add support for pm8150[bl] leds Dmitry Baryshkov
@ 2020-10-21 22:50 ` Dmitry Baryshkov
2020-10-21 22:50 ` [PATCH 4/5] arm64: dts: pm8150l: " Dmitry Baryshkov
2020-10-21 22:51 ` [PATCH 5/5] arm64: dts: qrb5165-rb5: declare tri-led user leds Dmitry Baryshkov
4 siblings, 0 replies; 8+ messages in thread
From: Dmitry Baryshkov @ 2020-10-21 22:50 UTC (permalink / raw)
To: Bjorn Andersson, Pavel Machek, Dan Murphy
Cc: Rob Herring, linux-leds, 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] 8+ messages in thread
* [PATCH 4/5] arm64: dts: pm8150l: add Light Pulse Generator device node
2020-10-21 22:50 [PATCH 0/5] Qualcomm LPG support for PM8150b/l Dmitry Baryshkov
` (2 preceding siblings ...)
2020-10-21 22:50 ` [PATCH 3/5] arm64: dts: pm8150b: add Light Pulse Generator device node Dmitry Baryshkov
@ 2020-10-21 22:50 ` Dmitry Baryshkov
2020-10-21 22:51 ` [PATCH 5/5] arm64: dts: qrb5165-rb5: declare tri-led user leds Dmitry Baryshkov
4 siblings, 0 replies; 8+ messages in thread
From: Dmitry Baryshkov @ 2020-10-21 22:50 UTC (permalink / raw)
To: Bjorn Andersson, Pavel Machek, Dan Murphy
Cc: Rob Herring, linux-leds, 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] 8+ messages in thread
* [PATCH 5/5] arm64: dts: qrb5165-rb5: declare tri-led user leds
2020-10-21 22:50 [PATCH 0/5] Qualcomm LPG support for PM8150b/l Dmitry Baryshkov
` (3 preceding siblings ...)
2020-10-21 22:50 ` [PATCH 4/5] arm64: dts: pm8150l: " Dmitry Baryshkov
@ 2020-10-21 22:51 ` Dmitry Baryshkov
4 siblings, 0 replies; 8+ messages in thread
From: Dmitry Baryshkov @ 2020-10-21 22:51 UTC (permalink / raw)
To: Bjorn Andersson, Pavel Machek, Dan Murphy
Cc: Rob Herring, linux-leds, 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 01708d84fdf6..04eff24f9d71 100644
--- a/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts
+++ b/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts
@@ -1014,6 +1014,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] 8+ messages in thread
* Re: [PATCH 1/5] dt-bindings: leds: leds-qcom-lpg: add pm8150[bl] compatible strings
2020-10-21 22:50 ` [PATCH 1/5] dt-bindings: leds: leds-qcom-lpg: add pm8150[bl] compatible strings Dmitry Baryshkov
@ 2020-10-23 16:28 ` Rob Herring
0 siblings, 0 replies; 8+ messages in thread
From: Rob Herring @ 2020-10-23 16:28 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: linux-arm-msm, Pavel Machek, Bjorn Andersson, Dan Murphy,
devicetree, Rob Herring, linux-leds
On Thu, 22 Oct 2020 01:50:56 +0300, Dmitry Baryshkov wrote:
> 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>
> ---
> Documentation/devicetree/bindings/leds/leds-qcom-lpg.yaml | 2 ++
> 1 file changed, 2 insertions(+)
>
Acked-by: Rob Herring <robh@kernel.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/5] leds: qcom-lpg: add support for pm8150[bl] leds
2020-10-21 22:50 ` [PATCH 2/5] leds: qcom-lpg: add support for pm8150[bl] leds Dmitry Baryshkov
@ 2020-10-29 18:16 ` Pavel Machek
0 siblings, 0 replies; 8+ messages in thread
From: Pavel Machek @ 2020-10-29 18:16 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: Bjorn Andersson, Dan Murphy, Rob Herring, linux-leds, devicetree,
linux-arm-msm
[-- Attachment #1: Type: text/plain, Size: 989 bytes --]
Hi!
> 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..4d24e0c973d6 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_no_atc_ctl: true if there is no TRI_LED_ATC_CTL register
> + * @triled_no_src_sel: true if there is no TRI_LED_SRC_SEL register
Please make logic the other way around. ... triled_has_atc_ctl.
Best regards,
Pavel
--
http://www.livejournal.com/~pavelmachek
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2020-10-29 18:16 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-21 22:50 [PATCH 0/5] Qualcomm LPG support for PM8150b/l Dmitry Baryshkov
2020-10-21 22:50 ` [PATCH 1/5] dt-bindings: leds: leds-qcom-lpg: add pm8150[bl] compatible strings Dmitry Baryshkov
2020-10-23 16:28 ` Rob Herring
2020-10-21 22:50 ` [PATCH 2/5] leds: qcom-lpg: add support for pm8150[bl] leds Dmitry Baryshkov
2020-10-29 18:16 ` Pavel Machek
2020-10-21 22:50 ` [PATCH 3/5] arm64: dts: pm8150b: add Light Pulse Generator device node Dmitry Baryshkov
2020-10-21 22:50 ` [PATCH 4/5] arm64: dts: pm8150l: " Dmitry Baryshkov
2020-10-21 22:51 ` [PATCH 5/5] arm64: dts: qrb5165-rb5: declare tri-led user leds Dmitry Baryshkov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).