On 4/30/24 04:10, Lars Petter Mostad wrote:
On Sun, Apr 28, 2024 at 8:15 PM Guenter Roeck <linux@xxxxxxxxxxxx> wrote:
-enum emc1403_chip { emc1402, emc1403, emc1404 };
+enum emc1403_chip { emc1402, emc1403, emc1404, emc1408 };
There is no EMC1408, and if there was it might not be compatible with
EMC1438.
Yes, using the name of a chip that does not (yet) exist is not good. I was going
on the apparent pattern that the name emc140n was used for things common
for all emc14xn chips.
I figured that much, but that should not include virtual chips.
You might consider adding support for emc1428 as well, though; unless
I am missing something the only difference should be the chip ID.
The 8-channel chips (emc1428 and emc1438) suppport signed data
and limit registers. This will need to be handled.
I see that my glance at the EMC14xx datasheets was way too brief. EMC1438 looked
like a straight extension of the currently supported chips to 8 channels.
I totally missed the sign bit.
No problem; I only accidentally noticed it myself.
I guess sign_extend32 can be used to handle two's complement for signed chips.
Yes.
This I guess would mean putting some extra info into thermal_data to let the
show/store functions know whether they are handling a signed chip or not. This
might make the driver unnecessarily messy, as apparently nobody else has been
interested in support for the chips with signed data. If so I withdraw this
patch.
Should this driver be kept unsigned only?
I'd prefer to have support for the 8-channel chips (and with it for signed
temperature data) added. As mentioned in my other reply, I would suggest though
that you convert the driver to use the with_info API. That would move a lot
of code into the hwmon core and make it much easier to add support for additional
chips, for signed/unsigned handling, and for handling 16 bit wide registers.
In this context, could you send me a register dump of emc1438 (and of any
other chips of the chips supported by the emc1403 driver if you have access
to them) ? I'd like to add module tests for those chips.
Thanks,
Guenter