Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

leds: lp8860: Do not always program EEPROM on probe

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>
Link: https://patch.msgid.link/20260305203706.841384-5-afd@ti.com
Signed-off-by: Lee Jones <lee@kernel.org>

authored by

Andrew Davis and committed by
Lee Jones
15c9c907 ca4b5ff8

+15 -3
+15 -3
drivers/leds/leds-lp8860.c
··· 97 97 struct regmap *regmap; 98 98 }; 99 99 100 + static bool program_eeprom; 101 + module_param(program_eeprom, bool, 0644); 102 + MODULE_PARM_DESC(program_eeprom, "Program the configuration EEPROM on device startup"); 103 + 104 + /* 105 + * EEPROM bits are intended to be set/programmed before normal operation only 106 + * once during silicon production, but can be reprogrammed for evaluation purposes 107 + * up to 1000 cycles. To program this EEPROM using this driver, update the below 108 + * table and set the module param "program_eeprom" to 1 109 + */ 100 110 static const struct reg_sequence lp8860_eeprom_disp_regs[] = { 101 111 { LP8860_EEPROM_REG_0, 0xed }, 102 112 { LP8860_EEPROM_REG_1, 0xdf }, ··· 312 302 return ret; 313 303 } 314 304 315 - ret = lp8860_program_eeprom(led); 316 - if (ret) 317 - return ret; 305 + if (program_eeprom) { 306 + ret = lp8860_program_eeprom(led); 307 + if (ret) 308 + return ret; 309 + } 318 310 319 311 init_data.fwnode = of_fwnode_handle(child_node); 320 312 init_data.devicename = LP8860_NAME;