Linux-Hwmon Archive mirror
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Lars Petter Mostad <larspm@gmail.com>
Cc: jdelvare@suse.com, linux-hwmon@vger.kernel.org,
	Lars Petter Mostad <lars.petter.mostad@appear.net>
Subject: Re: [PATCH] hwmon: (emc1403) Add support for EMC1438.
Date: Tue, 30 Apr 2024 08:51:53 -0700	[thread overview]
Message-ID: <1c2cc415-8dd5-4aa9-afbf-45e20d5295a3@roeck-us.net> (raw)
In-Reply-To: <CAC-Dm27uxQR1k0bbpCDNQLiWum8d4B-3xgFqRgSOHYnUhuovxw@mail.gmail.com>

On 4/30/24 04:10, Lars Petter Mostad wrote:
> On Sun, Apr 28, 2024 at 8:15 PM Guenter Roeck <linux@roeck-us.net> 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


      reply	other threads:[~2024-04-30 15:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-26 14:09 [PATCH] hwmon: (emc1403) Add support for EMC1438 Lars Petter Mostad
2024-04-28 18:15 ` Guenter Roeck
2024-04-30 11:10   ` Lars Petter Mostad
2024-04-30 15:51     ` Guenter Roeck [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=1c2cc415-8dd5-4aa9-afbf-45e20d5295a3@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=jdelvare@suse.com \
    --cc=lars.petter.mostad@appear.net \
    --cc=larspm@gmail.com \
    --cc=linux-hwmon@vger.kernel.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).