* [PATCH] misc: eeprom: at24: Make VCC supply description requirement optional
@ 2026-05-24 8:05 Paul Menzel
2026-05-24 22:07 ` Mark Brown
0 siblings, 1 reply; 4+ messages in thread
From: Paul Menzel @ 2026-05-24 8:05 UTC (permalink / raw)
To: Bartosz Golaszewski, Arnd Bergmann, Greg Kroah-Hartman,
Liam Girdwood, Mark Brown
Cc: Paul Menzel, Madhavan Srinivasan, Michael Ellerman, linuxppc-dev,
linux-i2c, linux-kernel
Some platforms (e.g. IBM Power System S822LC (8335-GCA POWER8)) do not
describe the EEPROM’s VCC supply in firmware-provided device trees.
Using `devm_regulator_get()` on such systems falls back to a dummy
regulator with a kernel warning:
at24 0-0051: supply vcc not found, using dummy regulator
at24 0-0051: 16384 byte 24c128 EEPROM, writable, 1 bytes/write
at24 0-0052: supply vcc not found, using dummy regulator
at24 0-0052: 256 byte 24c02 EEPROM, writable, 1 bytes/write
at24 0-0053: supply vcc not found, using dummy regulator
at24 0-0053: 256 byte 24c02 EEPROM, writable, 1 bytes/write
at24 0-0054: supply vcc not found, using dummy regulator
at24 0-0054: 256 byte 24c02 EEPROM, writable, 1 bytes/write
[…]
at24 12-0050: supply vcc not found, using dummy regulator
at24 12-0050: 16384 byte 24c128 EEPROM, writable, 1 bytes/write
at24 12-0051: supply vcc not found, using dummy regulator
at24 12-0051: 16384 byte 24c128 EEPROM, writable, 1 bytes/write
Switch to `devm_regulator_get_optional()` and treat -ENODEV as “no
supply described”. When `vcc_reg` is NULL, skip all
regulator_enable/disable calls; the hardware is assumed to be always
powered. Linux now logs:
at24 0-0051: 16384 byte 24c128 EEPROM, writable, 1 bytes/write
at24 0-0052: 256 byte 24c02 EEPROM, writable, 1 bytes/write
at24 0-0053: 256 byte 24c02 EEPROM, writable, 1 bytes/write
at24 0-0054: 256 byte 24c02 EEPROM, writable, 1 bytes/write
at24 0-0055: 256 byte 24c02 EEPROM, writable, 1 bytes/write
[…]
at24 12-0050: 16384 byte 24c128 EEPROM, writable, 1 bytes/write
at24 12-0051: 16384 byte 24c128 EEPROM, writable, 1 bytes/write
Assisted-by: Claude Sonnet 4.6
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
---
drivers/misc/eeprom/at24.c | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
index 0200288d3a7a..7e1050f8759a 100644
--- a/drivers/misc/eeprom/at24.c
+++ b/drivers/misc/eeprom/at24.c
@@ -699,9 +699,12 @@ static int at24_probe(struct i2c_client *client)
at24->offset_adj = at24_get_offset_adj(flags, byte_len);
at24->client_regmaps[0] = regmap;
- at24->vcc_reg = devm_regulator_get(dev, "vcc");
- if (IS_ERR(at24->vcc_reg))
- return PTR_ERR(at24->vcc_reg);
+ at24->vcc_reg = devm_regulator_get_optional(dev, "vcc");
+ if (IS_ERR(at24->vcc_reg)) {
+ if (PTR_ERR(at24->vcc_reg) != -ENODEV)
+ return PTR_ERR(at24->vcc_reg);
+ at24->vcc_reg = NULL;
+ }
writable = !(flags & AT24_FLAG_READONLY);
if (writable) {
@@ -754,9 +757,12 @@ static int at24_probe(struct i2c_client *client)
full_power = acpi_dev_state_d0(&client->dev);
if (full_power) {
- err = regulator_enable(at24->vcc_reg);
- if (err)
- return dev_err_probe(dev, err, "Failed to enable vcc regulator\n");
+ if (at24->vcc_reg) {
+ err = regulator_enable(at24->vcc_reg);
+ if (err) {
+ return dev_err_probe(dev, err, "Failed to enable vcc regulator\n");
+ }
+ }
pm_runtime_set_active(dev);
}
@@ -771,7 +777,7 @@ static int at24_probe(struct i2c_client *client)
err = at24_read(at24, 0, &test_byte, 1);
if (err) {
pm_runtime_disable(dev);
- if (!pm_runtime_status_suspended(dev))
+ if (!pm_runtime_status_suspended(dev) && at24->vcc_reg)
regulator_disable(at24->vcc_reg);
return -ENODEV;
}
@@ -808,7 +814,7 @@ static void at24_remove(struct i2c_client *client)
pm_runtime_disable(&client->dev);
if (acpi_dev_state_d0(&client->dev)) {
- if (!pm_runtime_status_suspended(&client->dev))
+ if (!pm_runtime_status_suspended(&client->dev) && at24->vcc_reg)
regulator_disable(at24->vcc_reg);
pm_runtime_set_suspended(&client->dev);
}
@@ -819,6 +825,8 @@ static int __maybe_unused at24_suspend(struct device *dev)
struct i2c_client *client = to_i2c_client(dev);
struct at24_data *at24 = i2c_get_clientdata(client);
+ if (!at24->vcc_reg)
+ return 0;
return regulator_disable(at24->vcc_reg);
}
@@ -827,6 +835,8 @@ static int __maybe_unused at24_resume(struct device *dev)
struct i2c_client *client = to_i2c_client(dev);
struct at24_data *at24 = i2c_get_clientdata(client);
+ if (!at24->vcc_reg)
+ return 0;
return regulator_enable(at24->vcc_reg);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] misc: eeprom: at24: Make VCC supply description requirement optional
2026-05-24 8:05 [PATCH] misc: eeprom: at24: Make VCC supply description requirement optional Paul Menzel
@ 2026-05-24 22:07 ` Mark Brown
2026-05-25 7:07 ` Paul Menzel
0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2026-05-24 22:07 UTC (permalink / raw)
To: Paul Menzel
Cc: Bartosz Golaszewski, Arnd Bergmann, Greg Kroah-Hartman,
Liam Girdwood, Madhavan Srinivasan, Michael Ellerman,
linuxppc-dev, linux-i2c, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 847 bytes --]
On Sun, May 24, 2026 at 10:05:33AM +0200, Paul Menzel wrote:
> Some platforms (e.g. IBM Power System S822LC (8335-GCA POWER8)) do not
> describe the EEPROM’s VCC supply in firmware-provided device trees.
> Using `devm_regulator_get()` on such systems falls back to a dummy
> regulator with a kernel warning:
> Switch to `devm_regulator_get_optional()` and treat -ENODEV as “no
> supply described”. When `vcc_reg` is NULL, skip all
> regulator_enable/disable calls; the hardware is assumed to be always
> powered. Linux now logs:
This is not appropriate unless the device can actually operate without
power, any driver could be used in a system where the firmware does not
describe the regultors and it'd obviously be pointless and error prone
to scatter bodges like this on every single call to a regulator API
function.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] misc: eeprom: at24: Make VCC supply description requirement optional
2026-05-24 22:07 ` Mark Brown
@ 2026-05-25 7:07 ` Paul Menzel
2026-05-25 10:32 ` Mark Brown
0 siblings, 1 reply; 4+ messages in thread
From: Paul Menzel @ 2026-05-25 7:07 UTC (permalink / raw)
To: Mark Brown
Cc: Bartosz Golaszewski, Arnd Bergmann, Greg Kroah-Hartman,
Liam Girdwood, Madhavan Srinivasan, Michael Ellerman,
linuxppc-dev, linux-i2c, linux-kernel
Dear Mark,
Thank you for taking the time to review and respond.
Am 25.05.26 um 00:07 schrieb Mark Brown:
> On Sun, May 24, 2026 at 10:05:33AM +0200, Paul Menzel wrote:
>
>> Some platforms (e.g. IBM Power System S822LC (8335-GCA POWER8)) do not
>> describe the EEPROM’s VCC supply in firmware-provided device trees.
>> Using `devm_regulator_get()` on such systems falls back to a dummy
>> regulator with a kernel warning:
>
>> Switch to `devm_regulator_get_optional()` and treat -ENODEV as “no
>> supply described”. When `vcc_reg` is NULL, skip all
>> regulator_enable/disable calls; the hardware is assumed to be always
>> powered. Linux now logs:
>
> This is not appropriate unless the device can actually operate without
> power, any driver could be used in a system where the firmware does not
> describe the regultors and it'd obviously be pointless and error prone
> to scatter bodges like this on every single call to a regulator API
> function.
How should the warning on the POWER server be addressed then?
Kind regards,
Paul
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] misc: eeprom: at24: Make VCC supply description requirement optional
2026-05-25 7:07 ` Paul Menzel
@ 2026-05-25 10:32 ` Mark Brown
0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2026-05-25 10:32 UTC (permalink / raw)
To: Paul Menzel
Cc: Bartosz Golaszewski, Arnd Bergmann, Greg Kroah-Hartman,
Liam Girdwood, Madhavan Srinivasan, Michael Ellerman,
linuxppc-dev, linux-i2c, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 642 bytes --]
On Mon, May 25, 2026 at 09:07:42AM +0200, Paul Menzel wrote:
> Am 25.05.26 um 00:07 schrieb Mark Brown:
> > This is not appropriate unless the device can actually operate without
> > power, any driver could be used in a system where the firmware does not
> > describe the regultors and it'd obviously be pointless and error prone
> > to scatter bodges like this on every single call to a regulator API
> > function.
> How should the warning on the POWER server be addressed then?
They should fix their DT, or you should arrange some way of identifying
that for some reason their DT is like this and dummy regulators are the
expected case.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-05-25 10:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-24 8:05 [PATCH] misc: eeprom: at24: Make VCC supply description requirement optional Paul Menzel
2026-05-24 22:07 ` Mark Brown
2026-05-25 7:07 ` Paul Menzel
2026-05-25 10:32 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox