Re: [PATCH 2/4] hwmon: adc: rp1: Add Raspberry Pi's RP1 ADC driver

Stefan Wahren
2025-09-25T05:26:16Z

Hi Guenter,

Am 25.09.25 um 04:42 schrieb Guenter Roeck:
> On Thu, Sep 25, 2025 at 03:04:14AM +0300, Stanimir Varbanov wrote:
>> A five-input successive-approximation analogue-to-digital converter
>> with 12-bit (effective number of 9.5 bits) resolution at 500kSPS.
>> The ADC has four external inputs and one internal temperature sensor.
>>
>> Signed-off-by: Phil Elwell <phil@raspberrypi.com>
>> Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
>> Signed-off-by: Stanimir Varbanov <svarbanov@suse.de>
> I just realized that there is already a hwmon driver for
> Rasperri Pi - drivers/hwmon/raspberrypi-hwmon.c.
>
> Please add this code to that driver.
could you please explain the reason for this?

Yes, both drivers are for Raspberry Pi boards, but they don't share any
code base. The raspberrypi-hwmon uses a mailbox interfaces to get the
sensor data and works for the board generation 1 - 4. This driver works
completely differently ( MMIO ), doesn't depend on the mailbox interface
and applies only for board generation 5. Actually I don't see a benefit
of merging them.

Best regards
>
>> ---
>> drivers/hwmon/Kconfig | 10 ++
>> drivers/hwmon/Makefile | 1 +
>> drivers/hwmon/rp1-adc.c | 301 ++++++++++++++++++++++++++++++++++++++++
> Also, this needs documentation.
>
> Thanks,
> Guenter