mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Huibin Shi <henrys@silicom-usa.com>
Cc: Henry Shi <henryshi2018@gmail.com>,
	"hbshi69@hotmail.com" <hbshi69@hotmail.com>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"bp@alien8.de" <bp@alien8.de>,
	"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
	"x86@kernel.org" <x86@kernel.org>,
	"hpa@zytor.com" <hpa@zytor.com>,
	"hdegoede@redhat.com" <hdegoede@redhat.com>,
	"markgross@kernel.org" <markgross@kernel.org>,
	"jdelvare@suse.com" <jdelvare@suse.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"platform-driver-x86@vger.kernel.org" 
	<platform-driver-x86@vger.kernel.org>,
	"linux-hwmon@vger.kernel.org" <linux-hwmon@vger.kernel.org>,
	"hb_shi2003@yahoo.com" <hb_shi2003@yahoo.com>,
	Wen Wang <wenw@silicom-usa.com>,
	Guenter Roeck <linux@roeck-us.net>
Subject: Re: [PATCH] Add Silicom Platform Driver
Date: Mon, 21 Aug 2023 13:39:55 +0300 (EEST)	[thread overview]
Message-ID: <1ecd7ad-3878-c826-45a5-7123e55d8527@linux.intel.com> (raw)
In-Reply-To: <7f537cef-d5cd-4816-a07b-9df27954ef93@roeck-us.net>

On Sat, 19 Aug 2023, Guenter Roeck wrote:

> On Sat, Aug 19, 2023 at 02:20:32PM +0000, Huibin Shi wrote:
> > Hi Guenter,
> > 
> > Thanks for your comments. Probably, I should not resubmit patch too rushed. I will add version number to subject and change log in cover letter for next resubmission.
> > 
> > See my comments below. Please let me know whether you accept my explanation.
> > 
> > Henry
> > -----Original Message-----
> [ ... ]
> 
> > > +
> > > +static u32 temp_get(void)
> > > +{
> > > +     u32 reg;
> > > +
> > > +     mutex_lock(&mec_io_mutex);
> > > +     /* Select memory region */
> > > +     outb(IO_REG_BANK, EC_ADDR_MSB);
> > > +     outb(0xc, EC_ADDR_LSB);
> > > +     /* Get current data from the address */
> > > +     reg = inl(MEC_DATA(DEFAULT_CHAN_LO));
> > > +     mutex_unlock(&mec_io_mutex);
> > > +
> > > +     return (reg >> 16) / 10;
> > 
> > The hwmon ABI expects temperatures to be reported in milli-degrees C.
> > The above sets the maximum temperature to 65,535 / 10 = 6,553 milli-degrees or 6.553 degrees C. It is very unlikely that this is correct.
> > 
> > Again, I commented on this before.
> > 
> > Henry: this is due to an internal implementation of MIcor-controller firmware, instead of putting real temperature to the register, it put (real temperature * 10 ) to the register. So, in order to report correct temperature to user space application, the read value is divided by 10, then report to user space. 
> > 
> > Please let me know if you accept this. If not, I can change the code, but let user space application to do adjustment. 
> 
> No, I do not accept this. I do not believe that the maximum temperature
> reported by the microcontroller is 6.553 degrees C. I suspect it reports
> 10th of degrees C. In that case, the number reported should be multiplied
> by 100 to make it milli-degrees C as expected by the ABI.

...And for that multiplication, please use the constant defined in 
include/linux/units.h instead of a literal.


And please do version the patches properly, it's getting messy to track 
which version is which (if something is new or not). If you use git 
format-patch, it has an argument that can be used to add the version, no 
need to add it by hand.


-- 
 i.


  reply	other threads:[~2023-08-21 10:40 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-18 15:43 Henry Shi
2023-08-19 12:41 ` Guenter Roeck
2023-08-19 14:20   ` Huibin Shi
2023-08-19 14:36     ` Guenter Roeck
2023-08-21 10:39       ` Ilpo Järvinen [this message]
2023-08-21 16:00         ` Huibin Shi
2023-08-21 15:48       ` Huibin Shi
2023-08-21 16:09         ` Guenter Roeck
2023-08-21 16:23           ` Huibin Shi
  -- strict thread matches above, loose matches on Subject: below --
2023-08-15 13:37 Henry Shi
2023-08-17  8:06 ` Ilpo Järvinen
2023-08-18 14:31   ` Huibin Shi
2023-07-18 16:01 Henry Shi
2023-07-18 16:40 ` Guenter Roeck
2023-07-25 20:29   ` Huibin Shi
2023-07-19 12:13 ` Ilpo Järvinen
2023-07-28 19:10   ` Huibin Shi
2023-08-03 12:06     ` Ilpo Järvinen
2023-08-10 17:48       ` Huibin Shi
2023-08-10 18:00         ` Guenter Roeck
2023-08-14 13:07           ` Huibin Shi
2023-08-10 18:01         ` Guenter Roeck
2023-08-14 13:09           ` Huibin Shi
2023-07-25 21:02 ` Christophe JAILLET
2023-07-28 12:59   ` Huibin Shi
2023-07-28 14:28     ` Guenter Roeck
2023-08-08 19:19       ` Huibin Shi
2023-08-08 19:35         ` Guenter Roeck
2023-08-08 20:39           ` Huibin Shi
2023-07-28 16:47     ` Christophe JAILLET
2023-07-28 17:52       ` Guenter Roeck
2023-08-08 19:23         ` Huibin Shi

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=1ecd7ad-3878-c826-45a5-7123e55d8527@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hb_shi2003@yahoo.com \
    --cc=hbshi69@hotmail.com \
    --cc=hdegoede@redhat.com \
    --cc=henrys@silicom-usa.com \
    --cc=henryshi2018@gmail.com \
    --cc=hpa@zytor.com \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=markgross@kernel.org \
    --cc=mingo@redhat.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=wenw@silicom-usa.com \
    --cc=x86@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

all inboxes | Powered by JetHome®