From: Stefan Wahren <wahrenst@gmx.net>
To: Guenter Roeck <linux@roeck-us.net>,
Sander Speetjens <sander.speetjens@gmail.com>,
Florian Fainelli <florian.fainelli@broadcom.com>,
Broadcom internal kernel review list
<bcm-kernel-feedback-list@broadcom.com>,
Ray Jui <rjui@broadcom.com>,
Scott Branden <sbranden@broadcom.com>,
Jonathan Corbet <corbet@lwn.net>,
Shuah Khan <skhan@linuxfoundation.org>,
Randy Dunlap <rdunlap@infradead.org>
Cc: linux-kernel@vger.kernel.org,
linux-rpi-kernel@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-hwmon@vger.kernel.org, linux-doc@vger.kernel.org,
Peter Robinson <pbrobinson@gmail.com>
Subject: Re: [PATCH v5 3/3] hwmon: add Raspberry Pi PMIC driver
Date: Tue, 1 Dec 2026 19:24:33 +0100 [thread overview]
Message-ID: <8f144baf-8eed-4c8f-a197-3820738f1662@gmx.net> (raw)
In-Reply-To: <a3fb77f9-e4f2-4703-b886-20a7cc01fe08@roeck-us.net>
Hi Guenter,
Am 01.12.26 um 18:21 schrieb Guenter Roeck:
> On 12/1/26 05:02, Stefan Wahren wrote:
>> Hi Sander,
>>
>> Am 26.11.26 um 14:03 schrieb Sander Speetjens:
>>> Add a hwmon driver for the PMIC found on the Raspberry Pi 5.
>>> The PMIC exposes voltages, currents and temperatures exclusively
>>> through the VideoCore firmware mailbox interface (property
>>> 0x0003009f).
>>>
...
>>> +static int rpi_pmic_probe(struct platform_device *pdev)
>>> +{
>>> + struct device *dev = &pdev->dev;
>>> + struct rpi_pmic_data *data;
>>> + struct rpi_firmware *fw;
>>> + struct device *hwmon_dev;
>>> + int ret;
>>> +
>>> + fw = devm_rpi_firmware_get(dev, dev->parent->of_node);
>>> + if (!fw)
>>> + return -EPROBE_DEFER;
>>> +
>>> + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
>>> + if (!data)
>>> + return -ENOMEM;
>>> +
>>> + data->fw = fw;
>>> +
>>> + ret = rpi_pmic_update(data);
>>> + if (ret)
>>> + return -ENODEV;
>> I think it would be helpful to log this case.
>
> Only if you can guarantee that the probe function is never called
> on systems not supporting the functionality. Logging noise due to
> unsupported devices/systems/chips is not acceptable.
Yes, the PMIC hwmon driver is only registered in case it's only a
Raspberry Pi 5 and the specific firmware property is supported (see
patch 2).
>
> The function returns an error if the rpi_firmware_property() call
> fails, which does suggest that the driver may probe even if the
> functionality is not supported. That in turn suggests that an error
> message here would not be acceptable.
Unfortunately there is another error case possible, which I was
concerned. In case rpi_firmware_property succeed, but the returned data
doesn't match (e.g. newer firmware version or something else).
So dev_warn_once(dev, "PMIC ADC length mismatch: got %u, expected %u\n"
within rpi_pmic_update() is enough / okay?
Best regards
>
> Guenter
>
>>> +
>>> + hwmon_dev =
>>> + devm_hwmon_device_register_with_info(dev,
>>> + "rpi_pmic", data, &rpi_pmic_chip_info,
>>> NULL);
>>> +
>>> + return PTR_ERR_OR_ZERO(hwmon_dev);
>>> +}
>>> +
>>> +static const struct platform_device_id rpi_pmic_id[] = {
>>> + { "raspberrypi-pmic-hwmon", },
>>> + { }
>>> +};
>>> +MODULE_DEVICE_TABLE(platform, rpi_pmic_id);
>>> +
>>> +static struct platform_driver rpi_pmic_driver = {
>>> + .probe = rpi_pmic_probe,
>>> + .driver = {
>>> + .name = "raspberrypi-pmic-hwmon",
>>> + },
>>> + .id_table = rpi_pmic_id,
>>> +};
>>> +module_platform_driver(rpi_pmic_driver);
>>> +
>>> +MODULE_AUTHOR("Sander Speetjens <sander.speetjens@gmail.com>");
>>> +MODULE_DESCRIPTION("Raspberry Pi 5 PMIC hwmon driver");
>>> +MODULE_LICENSE("GPL");
>>>
>>
>
prev parent reply other threads:[~2026-12-01 18:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 13:03 [PATCH v5 0/3] hwmon: add Raspberry Pi 5 " Sander Speetjens
2026-11-26 13:03 ` [PATCH v5 1/3] soc: bcm2835: raspberrypi-firmware: Add PMIC ADC property tag Sander Speetjens
2026-11-26 13:03 ` [PATCH v5 2/3] firmware: raspberrypi: Register PMIC hwmon driver on Pi 5 Sander Speetjens
2026-12-01 12:40 ` Stefan Wahren
2026-11-26 13:03 ` [PATCH v5 3/3] hwmon: add Raspberry Pi PMIC driver Sander Speetjens
2026-12-01 13:02 ` Stefan Wahren
2026-12-01 17:21 ` Guenter Roeck
2026-12-01 18:24 ` Stefan Wahren [this message]
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=8f144baf-8eed-4c8f-a197-3820738f1662@gmx.net \
--to=wahrenst@gmx.net \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=corbet@lwn.net \
--cc=florian.fainelli@broadcom.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rpi-kernel@lists.infradead.org \
--cc=linux@roeck-us.net \
--cc=pbrobinson@gmail.com \
--cc=rdunlap@infradead.org \
--cc=rjui@broadcom.com \
--cc=sander.speetjens@gmail.com \
--cc=sbranden@broadcom.com \
--cc=skhan@linuxfoundation.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
all inboxes | Powered by JetHome®