public inbox for linux-leds@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Davis <afd@ti.com>
To: Lee Jones <lee@kernel.org>, Pavel Machek <pavel@kernel.org>,
	David Owens <daowens01@gmail.com>
Cc: <linux-leds@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Andrew Davis <afd@ti.com>
Subject: [PATCH 5/5] leds: lp8860: Do not always program EEPROM on probe
Date: Thu, 5 Mar 2026 14:37:06 -0600	[thread overview]
Message-ID: <20260305203706.841384-5-afd@ti.com> (raw)
In-Reply-To: <20260305203706.841384-1-afd@ti.com>

The EEPROM has limited writes and the contents might have factory set
values that should not be changed. The values currently written by this
driver are just one example of values, but might not be correct for many
use-cases. Do not overwrite the EEPROM with these example values every
probe.

At some point it would be better to populate the content of the EEPROM
based on a configuration provided by the user and check that the values
in EEPROM are not already the same to avoid unneeded write cycles.

That configuration would depend on how the device is used on the board to
which it is attached, for that Device Tree might be the right way. Until a
method can be devised, gate the EEPROM writing behind a module param.

Reported-by: David Owens <daowens01@gmail.com>
Signed-off-by: Andrew Davis <afd@ti.com>
---
 drivers/leds/leds-lp8860.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/leds/leds-lp8860.c b/drivers/leds/leds-lp8860.c
index 6d1c9434e6d17..7a436861c4b71 100644
--- a/drivers/leds/leds-lp8860.c
+++ b/drivers/leds/leds-lp8860.c
@@ -97,6 +97,16 @@ struct lp8860_led {
 	struct regmap *regmap;
 };
 
+static bool program_eeprom;
+module_param(program_eeprom, bool, 0644);
+MODULE_PARM_DESC(program_eeprom, "Program the configuration EEPROM on device startup");
+
+/*
+ * EEPROM bits are intended to be set/programmed before normal operation only
+ * once during silicon production, but can be reprogrammed for evaluation purposes
+ * up to 1000 cycles. To program this EEPROM using this driver, update the below
+ * table and set the module param "program_eeprom" to 1
+ */
 static const struct reg_sequence lp8860_eeprom_disp_regs[] = {
 	{ LP8860_EEPROM_REG_0, 0xed },
 	{ LP8860_EEPROM_REG_1, 0xdf },
@@ -302,9 +312,11 @@ static int lp8860_probe(struct i2c_client *client)
 		return ret;
 	}
 
-	ret = lp8860_program_eeprom(led);
-	if (ret)
-		return ret;
+	if (program_eeprom) {
+		ret = lp8860_program_eeprom(led);
+		if (ret)
+			return ret;
+	}
 
 	init_data.fwnode = of_fwnode_handle(child_node);
 	init_data.devicename = LP8860_NAME;
-- 
2.39.2


  parent reply	other threads:[~2026-03-05 20:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-05 20:37 [PATCH 1/5] leds: lp8860: Use a single regmap table Andrew Davis
2026-03-05 20:37 ` [PATCH 2/5] leds: lp8860: Return directly from lp8860_init Andrew Davis
2026-03-05 20:37 ` [PATCH 3/5] leds: lp8860: Hold lock for all of EEPROM programming Andrew Davis
2026-03-05 20:37 ` [PATCH 4/5] leds: lp8860: Remove unused read of STATUS register Andrew Davis
2026-03-05 20:37 ` Andrew Davis [this message]
2026-03-09 18:49 ` [PATCH 1/5] leds: lp8860: Use a single regmap table Lee Jones

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=20260305203706.841384-5-afd@ti.com \
    --to=afd@ti.com \
    --cc=daowens01@gmail.com \
    --cc=lee@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@kernel.org \
    /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