All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] dt-bindings: leds: qcom-lpg: Add compatible for PM660L LPG block
@ 2022-05-04 20:57 Marijn Suijten
  2022-05-04 20:57 ` [PATCH 2/4] leds: qcom-lpg: Add PM660L configuration and compatible Marijn Suijten
                   ` (5 more replies)
  0 siblings, 6 replies; 12+ messages in thread
From: Marijn Suijten @ 2022-05-04 20:57 UTC (permalink / raw)
  To: phone-devel, Pavel Machek, Bjorn Andersson
  Cc: ~postmarketos/upstreaming, AngeloGioacchino Del Regno,
	Konrad Dybcio, Martin Botka, Marijn Suijten, linux-arm-msm,
	linux-leds, Rob Herring, Krzysztof Kozlowski, devicetree,
	linux-kernel

Document the availability of an LPG configuration for the PM660L PMIC in
the Qualcomm Light Pulse Generator driver.

Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
---
 Documentation/devicetree/bindings/leds/leds-qcom-lpg.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/leds/leds-qcom-lpg.yaml b/Documentation/devicetree/bindings/leds/leds-qcom-lpg.yaml
index 336bd8e10efd..64272a92c5b7 100644
--- a/Documentation/devicetree/bindings/leds/leds-qcom-lpg.yaml
+++ b/Documentation/devicetree/bindings/leds/leds-qcom-lpg.yaml
@@ -17,6 +17,7 @@ description: >
 properties:
   compatible:
     enum:
+      - qcom,pm660l-lpg
       - qcom,pm8150b-lpg
       - qcom,pm8150l-lpg
       - qcom,pm8916-pwm
--
2.36.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/4] leds: qcom-lpg: Add PM660L configuration and compatible
  2022-05-04 20:57 [PATCH 1/4] dt-bindings: leds: qcom-lpg: Add compatible for PM660L LPG block Marijn Suijten
@ 2022-05-04 20:57 ` Marijn Suijten
  2022-05-04 20:57 ` [PATCH 3/4] arm64: dts: qcom: pm660l: Add LPG node Marijn Suijten
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Marijn Suijten @ 2022-05-04 20:57 UTC (permalink / raw)
  To: phone-devel, Pavel Machek, Bjorn Andersson
  Cc: ~postmarketos/upstreaming, AngeloGioacchino Del Regno,
	Konrad Dybcio, Martin Botka, Marijn Suijten, linux-arm-msm,
	linux-leds, Rob Herring, Krzysztof Kozlowski, devicetree,
	linux-kernel

Inherit PM660L PMIC LPG/triled block configuration from downstream
drivers and DT sources, consisting of a triled block with automatic
trickle charge control and source selection, three colored led channels
belonging to the synchronized triled block and one loose PWM channel.

Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
---
 drivers/leds/rgb/leds-qcom-lpg.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/leds/rgb/leds-qcom-lpg.c b/drivers/leds/rgb/leds-qcom-lpg.c
index 17576f77c423..e75db1813baa 100644
--- a/drivers/leds/rgb/leds-qcom-lpg.c
+++ b/drivers/leds/rgb/leds-qcom-lpg.c
@@ -1271,6 +1271,23 @@ static int lpg_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static const struct lpg_data pm660l_lpg_data = {
+	.lut_base = 0xb000,
+	.lut_size = 0x100,
+
+	.triled_base = 0xd000,
+	.triled_has_atc_ctl = true,
+	.triled_has_src_sel = true,
+
+	.num_channels = 4,
+	.channels = (struct lpg_channel_data[]) {
+		{ .base = 0xb100, .triled_mask = BIT(5) },
+		{ .base = 0xb200, .triled_mask = BIT(6) },
+		{ .base = 0xb300, .triled_mask = BIT(7) },
+		{ .base = 0xb400 },
+	},
+};
+
 static const struct lpg_data pm8916_pwm_data = {
 	.num_channels = 1,
 	.channels = (const struct lpg_channel_data[]) {
@@ -1379,6 +1396,7 @@ static const struct lpg_data pm8150l_lpg_data = {
 };
 
 static const struct of_device_id lpg_of_table[] = {
+	{ .compatible = "qcom,pm660l-lpg", .data = &pm660l_lpg_data },
 	{ .compatible = "qcom,pm8150b-lpg", .data = &pm8150b_lpg_data },
 	{ .compatible = "qcom,pm8150l-lpg", .data = &pm8150l_lpg_data },
 	{ .compatible = "qcom,pm8916-pwm", .data = &pm8916_pwm_data },
-- 
2.36.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 3/4] arm64: dts: qcom: pm660l: Add LPG node
  2022-05-04 20:57 [PATCH 1/4] dt-bindings: leds: qcom-lpg: Add compatible for PM660L LPG block Marijn Suijten
  2022-05-04 20:57 ` [PATCH 2/4] leds: qcom-lpg: Add PM660L configuration and compatible Marijn Suijten
@ 2022-05-04 20:57 ` Marijn Suijten
  2022-05-04 20:57 ` [PATCH 4/4] arm64: dts: qcom: sdm630-nile: Add RGB status LED on the PM660L LPG Marijn Suijten
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Marijn Suijten @ 2022-05-04 20:57 UTC (permalink / raw)
  To: phone-devel, Pavel Machek, Bjorn Andersson
  Cc: ~postmarketos/upstreaming, AngeloGioacchino Del Regno,
	Konrad Dybcio, Martin Botka, Marijn Suijten, linux-arm-msm,
	linux-leds, Rob Herring, Krzysztof Kozlowski, devicetree,
	linux-kernel, Andy Gross

The Light Pulse Generator describes a hardware block responsible for
displaying colors and patterns on an RGB LED (usually used for [battery]
status and notifications), and drive PWM signals for general-purpose
(ie. backlight) LEDs.  The availability and usage of the individual
channels differ per board and is hence left for individual platform DTs
to configure.

Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
---
 arch/arm64/boot/dts/qcom/pm660l.dtsi | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/pm660l.dtsi b/arch/arm64/boot/dts/qcom/pm660l.dtsi
index cfef42353611..636b8d398d96 100644
--- a/arch/arm64/boot/dts/qcom/pm660l.dtsi
+++ b/arch/arm64/boot/dts/qcom/pm660l.dtsi
@@ -65,6 +65,15 @@ pmic@3 {
 		#address-cells = <1>;
 		#size-cells = <0>;
 
+		pm660l_lpg: lpg@b100 {
+			compatible = "qcom,pm660l-lpg";
+
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			status = "disabled";
+		};
+
 		pm660l_wled: leds@d800 {
 			compatible = "qcom,pm660l-wled";
 			reg = <0xd800 0xd900>;
-- 
2.36.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 4/4] arm64: dts: qcom: sdm630-nile: Add RGB status LED on the PM660L LPG
  2022-05-04 20:57 [PATCH 1/4] dt-bindings: leds: qcom-lpg: Add compatible for PM660L LPG block Marijn Suijten
  2022-05-04 20:57 ` [PATCH 2/4] leds: qcom-lpg: Add PM660L configuration and compatible Marijn Suijten
  2022-05-04 20:57 ` [PATCH 3/4] arm64: dts: qcom: pm660l: Add LPG node Marijn Suijten
@ 2022-05-04 20:57 ` Marijn Suijten
  2022-05-05  8:35 ` [PATCH 1/4] dt-bindings: leds: qcom-lpg: Add compatible for PM660L LPG block Krzysztof Kozlowski
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 12+ messages in thread
From: Marijn Suijten @ 2022-05-04 20:57 UTC (permalink / raw)
  To: phone-devel, Pavel Machek, Bjorn Andersson
  Cc: ~postmarketos/upstreaming, AngeloGioacchino Del Regno,
	Konrad Dybcio, Martin Botka, Marijn Suijten, linux-arm-msm,
	linux-leds, Rob Herring, Krzysztof Kozlowski, devicetree,
	linux-kernel, Andy Gross

The entire Sony Nile and Ganges lineup utilize the first three channels
(the triled channels) of the LPG block for an RGB (battery) status and
notification indicator.

Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
---
 .../dts/qcom/sdm630-sony-xperia-nile.dtsi     | 33 +++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sdm630-sony-xperia-nile.dtsi b/arch/arm64/boot/dts/qcom/sdm630-sony-xperia-nile.dtsi
index 42af1fade461..f42304671520 100644
--- a/arch/arm64/boot/dts/qcom/sdm630-sony-xperia-nile.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm630-sony-xperia-nile.dtsi
@@ -10,6 +10,7 @@
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/input/input.h>
 #include <dt-bindings/input/gpio-keys.h>
+#include <dt-bindings/leds/common.h>
 
 / {
 	/* required for bootloader to select correct board */
@@ -214,6 +215,38 @@ &blsp2_uart1 {
 	/* HCI Bluetooth */
 };
 
+&pm660l_lpg {
+	status = "okay";
+
+	#address-cells = <1>;
+	#size-cells = <0>;
+
+	qcom,power-source = <1>;
+
+	multi-led {
+		color = <LED_COLOR_ID_RGB>;
+		function = LED_FUNCTION_STATUS;
+
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		led@1 {
+			reg = <1>;
+			color = <LED_COLOR_ID_BLUE>;
+		};
+
+		led@2 {
+			reg = <2>;
+			color = <LED_COLOR_ID_GREEN>;
+		};
+
+		led@3 {
+			reg = <3>;
+			color = <LED_COLOR_ID_RED>;
+		};
+	};
+};
+
 &pon_pwrkey {
 	status = "okay";
 };
-- 
2.36.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/4] dt-bindings: leds: qcom-lpg: Add compatible for PM660L LPG block
  2022-05-04 20:57 [PATCH 1/4] dt-bindings: leds: qcom-lpg: Add compatible for PM660L LPG block Marijn Suijten
                   ` (2 preceding siblings ...)
  2022-05-04 20:57 ` [PATCH 4/4] arm64: dts: qcom: sdm630-nile: Add RGB status LED on the PM660L LPG Marijn Suijten
@ 2022-05-05  8:35 ` Krzysztof Kozlowski
  2022-05-05  9:14   ` Marijn Suijten
  2022-05-05 19:58 ` Rob Herring
  2022-05-07 21:19 ` Pavel Machek
  5 siblings, 1 reply; 12+ messages in thread
From: Krzysztof Kozlowski @ 2022-05-05  8:35 UTC (permalink / raw)
  To: Marijn Suijten, phone-devel, Pavel Machek, Bjorn Andersson
  Cc: ~postmarketos/upstreaming, AngeloGioacchino Del Regno,
	Konrad Dybcio, Martin Botka, linux-arm-msm, linux-leds,
	Rob Herring, Krzysztof Kozlowski, devicetree, linux-kernel

On 04/05/2022 22:57, Marijn Suijten wrote:
> Document the availability of an LPG configuration for the PM660L PMIC in
> the Qualcomm Light Pulse Generator driver.
> 
> Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
> ---
>  Documentation/devicetree/bindings/leds/leds-qcom-lpg.yaml | 1 +

Hmm, there is no such file in next-20220503...


Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/4] dt-bindings: leds: qcom-lpg: Add compatible for PM660L LPG block
  2022-05-05  8:35 ` [PATCH 1/4] dt-bindings: leds: qcom-lpg: Add compatible for PM660L LPG block Krzysztof Kozlowski
@ 2022-05-05  9:14   ` Marijn Suijten
  0 siblings, 0 replies; 12+ messages in thread
From: Marijn Suijten @ 2022-05-05  9:14 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: phone-devel, Pavel Machek, Bjorn Andersson,
	~postmarketos/upstreaming, AngeloGioacchino Del Regno,
	Konrad Dybcio, Martin Botka, linux-arm-msm, linux-leds,
	Rob Herring, Krzysztof Kozlowski, devicetree, linux-kernel

On 2022-05-05 10:35:20, Krzysztof Kozlowski wrote:
> On 04/05/2022 22:57, Marijn Suijten wrote:
> > Document the availability of an LPG configuration for the PM660L PMIC in
> > the Qualcomm Light Pulse Generator driver.
> > 
> > Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
> > ---
> >  Documentation/devicetree/bindings/leds/leds-qcom-lpg.yaml | 1 +
> 
> Hmm, there is no such file in next-20220503...

Bjorn's patches got pulled into Pavel's linux-leds tree just yesterday:

    https://git.kernel.org/pub/scm/linux/kernel/git/pavel/linux-leds.git/log/?h=for-next

Specifically, this file got added in:

    https://git.kernel.org/pub/scm/linux/kernel/git/pavel/linux-leds.git/commit/?h=for-next&id=a8e53db46f19f67be6a26488aafb7d10c78e33bd

They don't seem to be in next-20220504 yet either, but should probably
show up in next-20220505.  This shouldn't prevent the patch from being
picked up for linux-leds though, now that everone is scrambling to send
additional LPG configs in hopes of landing for 5.19 all at once.

- Marijn

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/4] dt-bindings: leds: qcom-lpg: Add compatible for PM660L LPG block
  2022-05-04 20:57 [PATCH 1/4] dt-bindings: leds: qcom-lpg: Add compatible for PM660L LPG block Marijn Suijten
                   ` (3 preceding siblings ...)
  2022-05-05  8:35 ` [PATCH 1/4] dt-bindings: leds: qcom-lpg: Add compatible for PM660L LPG block Krzysztof Kozlowski
@ 2022-05-05 19:58 ` Rob Herring
  2022-05-07 21:19 ` Pavel Machek
  5 siblings, 0 replies; 12+ messages in thread
From: Rob Herring @ 2022-05-05 19:58 UTC (permalink / raw)
  To: Marijn Suijten
  Cc: Martin Botka, ~postmarketos/upstreaming, devicetree, phone-devel,
	Krzysztof Kozlowski, Pavel Machek, Bjorn Andersson, linux-leds,
	linux-arm-msm, Rob Herring, AngeloGioacchino Del Regno,
	linux-kernel, Konrad Dybcio

On Wed, 04 May 2022 22:57:01 +0200, Marijn Suijten wrote:
> Document the availability of an LPG configuration for the PM660L PMIC in
> the Qualcomm Light Pulse Generator driver.
> 
> Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
> ---
>  Documentation/devicetree/bindings/leds/leds-qcom-lpg.yaml | 1 +
>  1 file changed, 1 insertion(+)
> 

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/4] dt-bindings: leds: qcom-lpg: Add compatible for PM660L LPG block
  2022-05-04 20:57 [PATCH 1/4] dt-bindings: leds: qcom-lpg: Add compatible for PM660L LPG block Marijn Suijten
                   ` (4 preceding siblings ...)
  2022-05-05 19:58 ` Rob Herring
@ 2022-05-07 21:19 ` Pavel Machek
  2022-05-07 22:20   ` Marijn Suijten
  5 siblings, 1 reply; 12+ messages in thread
From: Pavel Machek @ 2022-05-07 21:19 UTC (permalink / raw)
  To: Marijn Suijten
  Cc: phone-devel, Bjorn Andersson, ~postmarketos/upstreaming,
	AngeloGioacchino Del Regno, Konrad Dybcio, Martin Botka,
	linux-arm-msm, linux-leds, Rob Herring, Krzysztof Kozlowski,
	devicetree, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 349 bytes --]

Hi!

> Document the availability of an LPG configuration for the PM660L PMIC in
> the Qualcomm Light Pulse Generator driver.

Thank you, but I could not apply it. Can you collect reviews and
resend? I'll only be able to apply first two.

Best regards,
							Pavel

-- 
People of Russia, stop Putin before his war on Ukraine escalates.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/4] dt-bindings: leds: qcom-lpg: Add compatible for PM660L LPG block
  2022-05-07 21:19 ` Pavel Machek
@ 2022-05-07 22:20   ` Marijn Suijten
  0 siblings, 0 replies; 12+ messages in thread
From: Marijn Suijten @ 2022-05-07 22:20 UTC (permalink / raw)
  To: Pavel Machek
  Cc: phone-devel, Bjorn Andersson, ~postmarketos/upstreaming,
	AngeloGioacchino Del Regno, Konrad Dybcio, Martin Botka,
	linux-arm-msm, linux-leds, Rob Herring, Krzysztof Kozlowski,
	devicetree, linux-kernel

Hi Pavel!

On 2022-05-07 23:19:07, Pavel Machek wrote:
> Hi!
> 
> > Document the availability of an LPG configuration for the PM660L PMIC in
> > the Qualcomm Light Pulse Generator driver.
> 
> Thank you, but I could not apply it.

Thank you for notifying me.  It seems the diff-context changed a little
when the pm8350c-pwm patches were applied, the series is now rebased on
linux-leds and re-sent as [1] (I may have forgotten to pass -v2 to git
format-patch, apologies for that).

[1]: https://lore.kernel.org/linux-leds/20220507221123.2201668-4-marijn.suijten@somainline.org/T/#u

> Can you collect reviews

Unless I missed something there only seems to be one Acked-by from Rob,
on the dt-bindings patch - I hope that's enough and otherwise Bjorn may
want to chime in on the LPG code part.

> I'll only be able to apply first two.

No worries about that, I expect Bjorn to pick up the latter two through
the arm-msm tree.  Is it okay if I send all patches as a unified series
going forward, or should it rather be split per sub-tree/maintainer?

Last but not least, a friendly reminder to look at patch [2] (resent as
[3]) to complement Bjorn's LPG patches.

[2]: https://lore.kernel.org/linux-leds/20210418213427.220638-1-marijn.suijten@somainline.org/
[3]: https://lore.kernel.org/linux-leds/20210915080252.69147-1-marijn.suijten@somainline.org/

- Marijn

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/4] leds: qcom-lpg: Add PM660L configuration and compatible
  2022-05-11  3:54   ` Bjorn Andersson
@ 2022-05-11  8:39     ` Marijn Suijten
  0 siblings, 0 replies; 12+ messages in thread
From: Marijn Suijten @ 2022-05-11  8:39 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: phone-devel, Pavel Machek, ~postmarketos/upstreaming,
	AngeloGioacchino Del Regno, Konrad Dybcio, Martin Botka,
	linux-arm-msm, linux-leds, Rob Herring, Rob Herring,
	Krzysztof Kozlowski, devicetree, linux-kernel, Matthias Kaehlcke,
	Stephen Boyd, Satya Priya

On 2022-05-10 22:54:07, Bjorn Andersson wrote:
> On Sat 07 May 17:11 CDT 2022, Marijn Suijten wrote:
> 
> > Inherit PM660L PMIC LPG/triled block configuration from downstream
> > drivers and DT sources, consisting of a triled block with automatic
> > trickle charge control and source selection, three colored led channels
> > belonging to the synchronized triled block and one loose PWM channel.
> > 
> > Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
> > ---
> >  drivers/leds/rgb/leds-qcom-lpg.c | 18 ++++++++++++++++++
> >  1 file changed, 18 insertions(+)
> > 
> > diff --git a/drivers/leds/rgb/leds-qcom-lpg.c b/drivers/leds/rgb/leds-qcom-lpg.c
> > index cfa3362b2457..30c12ac8eed4 100644
> > --- a/drivers/leds/rgb/leds-qcom-lpg.c
> > +++ b/drivers/leds/rgb/leds-qcom-lpg.c
> > @@ -1271,6 +1271,23 @@ static int lpg_remove(struct platform_device *pdev)
> >  	return 0;
> >  }
> >  
> > +static const struct lpg_data pm660l_lpg_data = {
> > +	.lut_base = 0xb000,
> > +	.lut_size = 0x100,
> 
> The documentation tells me that you have 49 entries of LUT on the
> PM660L.

Downstream DT sources report the full 0x100 range starting at 0xb000 is
used, before the first channel starts at 0xb100:

    https://git.codelinaro.org/clo/la/kernel/msm-4.14/-/blob/LA.UM.8.2.1.r1-06200-sdm660.0/arch/arm64/boot/dts/qcom/pm660l.dtsi#L84-85

However, every LUT entry appears to be two bytes in size so this should
at least be halved.

The driver does seem to add another 0x42 on top of this base address:

    https://git.codelinaro.org/clo/la/kernel/msm-4.14/-/blob/LA.UM.8.2.1.r1-06200-sdm660.0/drivers/pwm/pwm-qti-lpg.c#L104

(Your LPG driver adds 0x40 - I've seen both used in our downstream
driver) yet that leaves (0x100-0x42) / 2 = 95 spots.

This is still significantly higher than 49.  Is part of this register
range used for something else, inaccesible for LUT-value readings or is
the counter hardware in the LPG limiting this?

The driver codes in a max length of 47:

    https://git.codelinaro.org/clo/la/kernel/msm-4.14/-/blob/LA.UM.8.2.1.r1-06200-sdm660.0/drivers/pwm/pwm-qti-lpg.c#L108

If you're confident about this I'll bump it down to 49 or try validating
what happens if higher registers are used.

> > +
> > +	.triled_base = 0xd000,
> > +	.triled_has_atc_ctl = true,
> > +	.triled_has_src_sel = true,
> > +
> > +	.num_channels = 4,
> > +	.channels = (struct lpg_channel_data[]) {
> 
> This can be const

Thanks for spotting!

- Marijn

> 
> Regards,
> Bjorn
> 
> > +		{ .base = 0xb100, .triled_mask = BIT(5) },
> > +		{ .base = 0xb200, .triled_mask = BIT(6) },
> > +		{ .base = 0xb300, .triled_mask = BIT(7) },
> > +		{ .base = 0xb400 },
> > +	},
> > +};
> > +
> >  static const struct lpg_data pm8916_pwm_data = {
> >  	.num_channels = 1,
> >  	.channels = (const struct lpg_channel_data[]) {
> > @@ -1391,6 +1408,7 @@ static const struct lpg_data pm8350c_pwm_data = {
> >  };
> >  
> >  static const struct of_device_id lpg_of_table[] = {
> > +	{ .compatible = "qcom,pm660l-lpg", .data = &pm660l_lpg_data },
> >  	{ .compatible = "qcom,pm8150b-lpg", .data = &pm8150b_lpg_data },
> >  	{ .compatible = "qcom,pm8150l-lpg", .data = &pm8150l_lpg_data },
> >  	{ .compatible = "qcom,pm8350c-pwm", .data = &pm8350c_pwm_data },
> > -- 
> > 2.36.0
> > 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/4] leds: qcom-lpg: Add PM660L configuration and compatible
  2022-05-07 22:11 ` [PATCH 2/4] leds: qcom-lpg: Add PM660L configuration and compatible Marijn Suijten
@ 2022-05-11  3:54   ` Bjorn Andersson
  2022-05-11  8:39     ` Marijn Suijten
  0 siblings, 1 reply; 12+ messages in thread
From: Bjorn Andersson @ 2022-05-11  3:54 UTC (permalink / raw)
  To: Marijn Suijten
  Cc: phone-devel, Pavel Machek, ~postmarketos/upstreaming,
	AngeloGioacchino Del Regno, Konrad Dybcio, Martin Botka,
	linux-arm-msm, linux-leds, Rob Herring, Rob Herring,
	Krzysztof Kozlowski, devicetree, linux-kernel, Matthias Kaehlcke,
	Stephen Boyd, Satya Priya

On Sat 07 May 17:11 CDT 2022, Marijn Suijten wrote:

> Inherit PM660L PMIC LPG/triled block configuration from downstream
> drivers and DT sources, consisting of a triled block with automatic
> trickle charge control and source selection, three colored led channels
> belonging to the synchronized triled block and one loose PWM channel.
> 
> Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
> ---
>  drivers/leds/rgb/leds-qcom-lpg.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/drivers/leds/rgb/leds-qcom-lpg.c b/drivers/leds/rgb/leds-qcom-lpg.c
> index cfa3362b2457..30c12ac8eed4 100644
> --- a/drivers/leds/rgb/leds-qcom-lpg.c
> +++ b/drivers/leds/rgb/leds-qcom-lpg.c
> @@ -1271,6 +1271,23 @@ static int lpg_remove(struct platform_device *pdev)
>  	return 0;
>  }
>  
> +static const struct lpg_data pm660l_lpg_data = {
> +	.lut_base = 0xb000,
> +	.lut_size = 0x100,

The documentation tells me that you have 49 entries of LUT on the
PM660L.

> +
> +	.triled_base = 0xd000,
> +	.triled_has_atc_ctl = true,
> +	.triled_has_src_sel = true,
> +
> +	.num_channels = 4,
> +	.channels = (struct lpg_channel_data[]) {

This can be const

Regards,
Bjorn

> +		{ .base = 0xb100, .triled_mask = BIT(5) },
> +		{ .base = 0xb200, .triled_mask = BIT(6) },
> +		{ .base = 0xb300, .triled_mask = BIT(7) },
> +		{ .base = 0xb400 },
> +	},
> +};
> +
>  static const struct lpg_data pm8916_pwm_data = {
>  	.num_channels = 1,
>  	.channels = (const struct lpg_channel_data[]) {
> @@ -1391,6 +1408,7 @@ static const struct lpg_data pm8350c_pwm_data = {
>  };
>  
>  static const struct of_device_id lpg_of_table[] = {
> +	{ .compatible = "qcom,pm660l-lpg", .data = &pm660l_lpg_data },
>  	{ .compatible = "qcom,pm8150b-lpg", .data = &pm8150b_lpg_data },
>  	{ .compatible = "qcom,pm8150l-lpg", .data = &pm8150l_lpg_data },
>  	{ .compatible = "qcom,pm8350c-pwm", .data = &pm8350c_pwm_data },
> -- 
> 2.36.0
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 2/4] leds: qcom-lpg: Add PM660L configuration and compatible
  2022-05-07 22:11 Marijn Suijten
@ 2022-05-07 22:11 ` Marijn Suijten
  2022-05-11  3:54   ` Bjorn Andersson
  0 siblings, 1 reply; 12+ messages in thread
From: Marijn Suijten @ 2022-05-07 22:11 UTC (permalink / raw)
  To: phone-devel, Pavel Machek, Bjorn Andersson
  Cc: ~postmarketos/upstreaming, AngeloGioacchino Del Regno,
	Konrad Dybcio, Martin Botka, Marijn Suijten, linux-arm-msm,
	linux-leds, Rob Herring, Rob Herring, Krzysztof Kozlowski,
	devicetree, linux-kernel, Matthias Kaehlcke, Stephen Boyd,
	Satya Priya

Inherit PM660L PMIC LPG/triled block configuration from downstream
drivers and DT sources, consisting of a triled block with automatic
trickle charge control and source selection, three colored led channels
belonging to the synchronized triled block and one loose PWM channel.

Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
---
 drivers/leds/rgb/leds-qcom-lpg.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/leds/rgb/leds-qcom-lpg.c b/drivers/leds/rgb/leds-qcom-lpg.c
index cfa3362b2457..30c12ac8eed4 100644
--- a/drivers/leds/rgb/leds-qcom-lpg.c
+++ b/drivers/leds/rgb/leds-qcom-lpg.c
@@ -1271,6 +1271,23 @@ static int lpg_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static const struct lpg_data pm660l_lpg_data = {
+	.lut_base = 0xb000,
+	.lut_size = 0x100,
+
+	.triled_base = 0xd000,
+	.triled_has_atc_ctl = true,
+	.triled_has_src_sel = true,
+
+	.num_channels = 4,
+	.channels = (struct lpg_channel_data[]) {
+		{ .base = 0xb100, .triled_mask = BIT(5) },
+		{ .base = 0xb200, .triled_mask = BIT(6) },
+		{ .base = 0xb300, .triled_mask = BIT(7) },
+		{ .base = 0xb400 },
+	},
+};
+
 static const struct lpg_data pm8916_pwm_data = {
 	.num_channels = 1,
 	.channels = (const struct lpg_channel_data[]) {
@@ -1391,6 +1408,7 @@ static const struct lpg_data pm8350c_pwm_data = {
 };
 
 static const struct of_device_id lpg_of_table[] = {
+	{ .compatible = "qcom,pm660l-lpg", .data = &pm660l_lpg_data },
 	{ .compatible = "qcom,pm8150b-lpg", .data = &pm8150b_lpg_data },
 	{ .compatible = "qcom,pm8150l-lpg", .data = &pm8150l_lpg_data },
 	{ .compatible = "qcom,pm8350c-pwm", .data = &pm8350c_pwm_data },
-- 
2.36.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2022-05-11  8:39 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-04 20:57 [PATCH 1/4] dt-bindings: leds: qcom-lpg: Add compatible for PM660L LPG block Marijn Suijten
2022-05-04 20:57 ` [PATCH 2/4] leds: qcom-lpg: Add PM660L configuration and compatible Marijn Suijten
2022-05-04 20:57 ` [PATCH 3/4] arm64: dts: qcom: pm660l: Add LPG node Marijn Suijten
2022-05-04 20:57 ` [PATCH 4/4] arm64: dts: qcom: sdm630-nile: Add RGB status LED on the PM660L LPG Marijn Suijten
2022-05-05  8:35 ` [PATCH 1/4] dt-bindings: leds: qcom-lpg: Add compatible for PM660L LPG block Krzysztof Kozlowski
2022-05-05  9:14   ` Marijn Suijten
2022-05-05 19:58 ` Rob Herring
2022-05-07 21:19 ` Pavel Machek
2022-05-07 22:20   ` Marijn Suijten
2022-05-07 22:11 Marijn Suijten
2022-05-07 22:11 ` [PATCH 2/4] leds: qcom-lpg: Add PM660L configuration and compatible Marijn Suijten
2022-05-11  3:54   ` Bjorn Andersson
2022-05-11  8:39     ` Marijn Suijten

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.