mirror of https://lore.kernel.org/linux-amlogic/
 help / color / mirror / Atom feed
From: linux@roeck-us.net (Guenter Roeck)
To: linus-amlogic@lists.infradead.org
Subject: [PATCH] hwmon: (scpi) Add slope and offset to SCP sensor readings
Date: Wed, 1 Mar 2017 12:04:44 -0800	[thread overview]
Message-ID: <20170301200444.GB20160@roeck-us.net> (raw)
In-Reply-To: <CAOQ7t2Y1=fL9a4A_gPtvrrWR_uOOP_gGT-61Q+1B39t2gRJBmw@mail.gmail.com>

On Wed, Mar 01, 2017 at 07:45:50PM +0100, Carlo Caione wrote:
> On Wed, Mar 1, 2017 at 6:56 PM, Guenter Roeck <linux@roeck-us.net> wrote:
> > On Wed, Mar 01, 2017 at 04:57:00PM +0000, Punit Agrawal wrote:
> 
> >> Another way to fix this would be to add optional properties to the scpi
> >> sensors binding and use them instead. This could then be used to fixup
> >> values reported to both thermal and hwmon.
> >>
> >
> > Yes, this would be much more appropriate.
> 
> What about something like:
> 
> sensor-coefficients = <x1 y1 z1>,
>                                   <x2 y2 z2>,
>                                   ...;

As mentioned before, I don't think 'slope' and 'offset' are well enough
defined, so I would rather not use that approach.

I don't know if there are DT examples on how to specify a translation
from an arbitrary value to well-defined units; we could use that
if it exists. Otherwise, we might just go with a combination of
sensor class and the unit scale used for that sensor class.
A simple approach might be something like
    scpi,sensor-scale =	// pick preferred property name 
	<0 1000>,
	<1 1000>,
	<2 1000>,
	<3 1000000>,
	<4 1000000>;
or even simpler
	scpi,sensor-scale = <1000, 1000, 1000, 1000000, 1000000>;
since the class index is really redundant.

This would describe the units for the Juno ARM development platform.

In your case, that would be something like
	scpi,sensor-scale = <1, 1000, 1000, 1000000, 1000000>;
assuming that the other units are as expected (which may not be the case). 

Guenter

  reply	other threads:[~2017-03-01 20:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-01 13:20 Carlo Caione
2017-03-01 15:01 ` Guenter Roeck
2017-03-01 16:16   ` Carlo Caione
2017-03-01 16:57     ` Punit Agrawal
2017-03-01 17:09       ` Carlo Caione
2017-03-01 17:56       ` Guenter Roeck
2017-03-01 18:45         ` Carlo Caione
2017-03-01 20:04           ` Guenter Roeck [this message]
2017-03-01 17:46     ` Guenter Roeck

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=20170301200444.GB20160@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=linus-amlogic@lists.infradead.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®