linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] leds: flash: leds-qcom-flash: add PMI8998 support
@ 2023-05-07 17:29 Dylan Van Assche
  2023-05-07 17:29 ` [PATCH 1/2] " Dylan Van Assche
  2023-05-07 17:29 ` [PATCH 2/2] leds: flash: leds-qcom-flash: disable LED when changing brightness Dylan Van Assche
  0 siblings, 2 replies; 5+ messages in thread
From: Dylan Van Assche @ 2023-05-07 17:29 UTC (permalink / raw)
  To: pavel, quic_fenglinw, lee
  Cc: trix, linux-leds, linux-kernel, ~postmarketos/upstreaming,
	phone-devel, Dylan Van Assche

This patchserie adds support for the Qualcomm PMI8998 PMIC to the 
pending leds-qcom-flash LED driver (v8) [1]. The following changes 
are necessary to support the Qualcomm PMI8998 PMIC:

- Add subtype 0x3 for the Qualcomm PMI8998 PMIC.
- Disable LED when changing the brightness to make brightness changes
propagate when the LED was already enabled.

@Fenglin Wu: Feel free to pull these patches in with your v9 if you like them.
We discussed support for this PMIC in the past around v3, but never could make
it work until now.

[1] https://lore.kernel.org/all/20230303095023.538917-1-quic_fenglinw@quicinc.com/

Kind regards,
Dylan Van Assche

Dylan Van Assche (2):
  leds: flash: leds-qcom-flash: add PMI8998 support
  leds: flash: leds-qcom-flash: disable LED when changing brightness

 drivers/leds/flash/leds-qcom-flash.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

-- 
2.40.1


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

* [PATCH 1/2] leds: flash: leds-qcom-flash: add PMI8998 support
  2023-05-07 17:29 [PATCH 0/2] leds: flash: leds-qcom-flash: add PMI8998 support Dylan Van Assche
@ 2023-05-07 17:29 ` Dylan Van Assche
  2023-05-15 16:18   ` Lee Jones
  2023-05-07 17:29 ` [PATCH 2/2] leds: flash: leds-qcom-flash: disable LED when changing brightness Dylan Van Assche
  1 sibling, 1 reply; 5+ messages in thread
From: Dylan Van Assche @ 2023-05-07 17:29 UTC (permalink / raw)
  To: pavel, quic_fenglinw, lee
  Cc: trix, linux-leds, linux-kernel, ~postmarketos/upstreaming,
	phone-devel, Dylan Van Assche

Add subtype for the Qualcomm PMI8998 PMIC to support it besides the
PM8150 PMIC which has the same registers. Adjust the driver to recognize
both PMIC subtypes as a 3 channel LED driver.

Signed-off-by: Dylan Van Assche <me@dylanvanassche.be>
---
 drivers/leds/flash/leds-qcom-flash.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/leds/flash/leds-qcom-flash.c b/drivers/leds/flash/leds-qcom-flash.c
index 90a24fa25a49..16045b5d89b1 100644
--- a/drivers/leds/flash/leds-qcom-flash.c
+++ b/drivers/leds/flash/leds-qcom-flash.c
@@ -18,7 +18,8 @@
 #define FLASH_TYPE_VAL			0x18
 
 #define FLASH_SUBTYPE_REG		0x05
-#define FLASH_SUBTYPE_3CH_VAL		0x04
+#define FLASH_SUBTYPE_3CH_PM8150_VAL	0x04
+#define FLASH_SUBTYPE_3CH_PMI8998_VAL	0x03
 #define FLASH_SUBTYPE_4CH_VAL		0x07
 
 #define FLASH_STS_3CH_OTST1		BIT(0)
@@ -682,7 +683,7 @@ static int qcom_flash_led_probe(struct platform_device *pdev)
 		return rc;
 	}
 
-	if (val == FLASH_SUBTYPE_3CH_VAL) {
+	if (val == FLASH_SUBTYPE_3CH_PM8150_VAL || val == FLASH_SUBTYPE_3CH_PMI8998_VAL) {
 		flash_data->hw_type = QCOM_MVFLASH_3CH;
 		flash_data->max_channels = 3;
 		regs = mvflash_3ch_regs;
-- 
2.40.1


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

* [PATCH 2/2] leds: flash: leds-qcom-flash: disable LED when changing brightness
  2023-05-07 17:29 [PATCH 0/2] leds: flash: leds-qcom-flash: add PMI8998 support Dylan Van Assche
  2023-05-07 17:29 ` [PATCH 1/2] " Dylan Van Assche
@ 2023-05-07 17:29 ` Dylan Van Assche
  2023-05-15 16:19   ` Lee Jones
  1 sibling, 1 reply; 5+ messages in thread
From: Dylan Van Assche @ 2023-05-07 17:29 UTC (permalink / raw)
  To: pavel, quic_fenglinw, lee
  Cc: trix, linux-leds, linux-kernel, ~postmarketos/upstreaming,
	phone-devel, Dylan Van Assche

The Qualcomm PMI8998 PMIC requires the LED to be disabled when configuring
the brightness. Always disable the LED when setting the brightness and
re-enable it afterwards.

Signed-off-by: Dylan Van Assche <me@dylanvanassche.be>
---
 drivers/leds/flash/leds-qcom-flash.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/leds/flash/leds-qcom-flash.c b/drivers/leds/flash/leds-qcom-flash.c
index 16045b5d89b1..c8d41a3caf38 100644
--- a/drivers/leds/flash/leds-qcom-flash.c
+++ b/drivers/leds/flash/leds-qcom-flash.c
@@ -417,6 +417,14 @@ static int qcom_flash_led_brightness_set(struct led_classdev *led_cdev,
 	bool enable = !!brightness;
 	int rc;
 
+	rc = set_flash_strobe(led, SW_STROBE, false);
+	if (rc)
+		return rc;
+
+	rc = set_flash_module_en(led, false);
+	if (rc)
+		return rc;
+
 	rc = set_flash_current(led, current_ma, TORCH_MODE);
 	if (rc)
 		return rc;
-- 
2.40.1


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

* Re: [PATCH 1/2] leds: flash: leds-qcom-flash: add PMI8998 support
  2023-05-07 17:29 ` [PATCH 1/2] " Dylan Van Assche
@ 2023-05-15 16:18   ` Lee Jones
  0 siblings, 0 replies; 5+ messages in thread
From: Lee Jones @ 2023-05-15 16:18 UTC (permalink / raw)
  To: Dylan Van Assche
  Cc: pavel, quic_fenglinw, trix, linux-leds, linux-kernel,
	~postmarketos/upstreaming, phone-devel

On Sun, 07 May 2023, Dylan Van Assche wrote:

> Add subtype for the Qualcomm PMI8998 PMIC to support it besides the
> PM8150 PMIC which has the same registers. Adjust the driver to recognize
> both PMIC subtypes as a 3 channel LED driver.
> 
> Signed-off-by: Dylan Van Assche <me@dylanvanassche.be>
> ---
>  drivers/leds/flash/leds-qcom-flash.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

Applied, thanks

-- 
Lee Jones [李琼斯]

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

* Re: [PATCH 2/2] leds: flash: leds-qcom-flash: disable LED when changing brightness
  2023-05-07 17:29 ` [PATCH 2/2] leds: flash: leds-qcom-flash: disable LED when changing brightness Dylan Van Assche
@ 2023-05-15 16:19   ` Lee Jones
  0 siblings, 0 replies; 5+ messages in thread
From: Lee Jones @ 2023-05-15 16:19 UTC (permalink / raw)
  To: Dylan Van Assche
  Cc: pavel, quic_fenglinw, trix, linux-leds, linux-kernel,
	~postmarketos/upstreaming, phone-devel

On Sun, 07 May 2023, Dylan Van Assche wrote:

> The Qualcomm PMI8998 PMIC requires the LED to be disabled when configuring
> the brightness. Always disable the LED when setting the brightness and
> re-enable it afterwards.
> 
> Signed-off-by: Dylan Van Assche <me@dylanvanassche.be>
> ---
>  drivers/leds/flash/leds-qcom-flash.c | 8 ++++++++
>  1 file changed, 8 insertions(+)

Applied, thanks

-- 
Lee Jones [李琼斯]

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

end of thread, other threads:[~2023-05-15 16:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-07 17:29 [PATCH 0/2] leds: flash: leds-qcom-flash: add PMI8998 support Dylan Van Assche
2023-05-07 17:29 ` [PATCH 1/2] " Dylan Van Assche
2023-05-15 16:18   ` Lee Jones
2023-05-07 17:29 ` [PATCH 2/2] leds: flash: leds-qcom-flash: disable LED when changing brightness Dylan Van Assche
2023-05-15 16:19   ` Lee Jones

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).