linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Fenglin Wu via B4 Relay <devnull+fenglin.wu.oss.qualcomm.com@kernel.org>
To: kernel@oss.qualcomm.com, Lee Jones <lee@kernel.org>,
	 Pavel Machek <pavel@kernel.org>,
	Fenglin Wu <quic_fenglinw@quicinc.com>
Cc: Subbaraman Narayanamurthy
	<subbaraman.narayanamurthy@oss.qualcomm.com>,
	 linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Fenglin Wu <fenglin.wu@oss.qualcomm.com>
Subject: [PATCH 2/2] leds: flash: leds-qcom-flash: add a separate register map for PMI8998
Date: Fri, 25 Jul 2025 18:04:04 +0800	[thread overview]
Message-ID: <20250725-fix-torch-clamp-issue-v1-2-4cf3ebaa4c67@oss.qualcomm.com> (raw)
In-Reply-To: <20250725-fix-torch-clamp-issue-v1-0-4cf3ebaa4c67@oss.qualcomm.com>

From: Fenglin Wu <fenglin.wu@oss.qualcomm.com>

The 3-channel flash module in PMI8998 has several registers different
than the others, such as: torch_clamp. Add different register fields
for it.

Signed-off-by: Fenglin Wu <fenglin.wu@oss.qualcomm.com>
---
 drivers/leds/flash/leds-qcom-flash.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/drivers/leds/flash/leds-qcom-flash.c b/drivers/leds/flash/leds-qcom-flash.c
index 9c2e41cfddcf2d50d5a633cb157084371a631d74..2554ef7bcae6bc8f66edbffc7c885a9386b263ad 100644
--- a/drivers/leds/flash/leds-qcom-flash.c
+++ b/drivers/leds/flash/leds-qcom-flash.c
@@ -118,6 +118,22 @@ enum {
 	REG_MAX_COUNT,
 };
 
+static const struct reg_field mvflash_3ch_pmi8998_regs[REG_MAX_COUNT] = {
+	REG_FIELD(0x08, 0, 7),			/* status1	*/
+	REG_FIELD(0x09, 0, 7),			/* status2	*/
+	REG_FIELD(0x0a, 0, 7),			/* status3	*/
+	REG_FIELD_ID(0x40, 0, 7, 3, 1),		/* chan_timer	*/
+	REG_FIELD_ID(0x43, 0, 6, 3, 1),		/* itarget	*/
+	REG_FIELD(0x46, 7, 7),			/* module_en	*/
+	REG_FIELD(0x47, 0, 5),			/* iresolution	*/
+	REG_FIELD_ID(0x49, 0, 2, 3, 1),		/* chan_strobe	*/
+	REG_FIELD(0x4c, 0, 2),			/* chan_en	*/
+	REG_FIELD(0xea, 0, 6),			/* torch_clamp	*/
+	REG_FIELD(0x56, 0, 2),			/* therm_thrsh1 */
+	REG_FIELD(0x57, 0, 2),			/* therm_thrsh2 */
+	REG_FIELD(0x58, 0, 2),			/* therm_thrsh3 */
+};
+
 static const struct reg_field mvflash_3ch_regs[REG_MAX_COUNT] = {
 	REG_FIELD(0x08, 0, 7),			/* status1	*/
 	REG_FIELD(0x09, 0, 7),                  /* status2	*/
@@ -862,13 +878,20 @@ static int qcom_flash_led_probe(struct platform_device *pdev)
 		return rc;
 	}
 
-	if (val == FLASH_SUBTYPE_3CH_PM8150_VAL || val == FLASH_SUBTYPE_3CH_PMI8998_VAL) {
+	if (val == FLASH_SUBTYPE_3CH_PM8150_VAL) {
 		flash_data->hw_type = QCOM_MVFLASH_3CH;
 		flash_data->max_channels = 3;
 		regs = devm_kmemdup(dev, mvflash_3ch_regs, sizeof(mvflash_3ch_regs),
 				    GFP_KERNEL);
 		if (!regs)
 			return -ENOMEM;
+	} else if (val == FLASH_SUBTYPE_3CH_PMI8998_VAL) {
+		flash_data->hw_type = QCOM_MVFLASH_3CH;
+		flash_data->max_channels = 3;
+		regs = devm_kmemdup(dev, mvflash_3ch_pmi8998_regs,
+				    sizeof(mvflash_3ch_pmi8998_regs), GFP_KERNEL);
+		if (!regs)
+			return -ENOMEM;
 	} else if (val == FLASH_SUBTYPE_4CH_VAL) {
 		flash_data->hw_type = QCOM_MVFLASH_4CH;
 		flash_data->max_channels = 4;

-- 
2.34.1



  parent reply	other threads:[~2025-07-25 10:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-25 10:04 [PATCH 0/2] leds: flash: leds-qcom-flash: update torch current clamp setting Fenglin Wu via B4 Relay
2025-07-25 10:04 ` [PATCH 1/2] " Fenglin Wu via B4 Relay
2025-07-25 12:37   ` Konrad Dybcio
2025-07-25 12:45     ` Konrad Dybcio
2025-07-28  2:27     ` Fenglin Wu
2025-07-28  9:18       ` Konrad Dybcio
2025-07-25 10:04 ` Fenglin Wu via B4 Relay [this message]
2025-07-25 12:42   ` [PATCH 2/2] leds: flash: leds-qcom-flash: add a separate register map for PMI8998 Konrad Dybcio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250725-fix-torch-clamp-issue-v1-2-4cf3ebaa4c67@oss.qualcomm.com \
    --to=devnull+fenglin.wu.oss.qualcomm.com@kernel.org \
    --cc=fenglin.wu@oss.qualcomm.com \
    --cc=kernel@oss.qualcomm.com \
    --cc=lee@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@kernel.org \
    --cc=quic_fenglinw@quicinc.com \
    --cc=subbaraman.narayanamurthy@oss.qualcomm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).