All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: Guenter Roeck <linux@roeck-us.net>,
	Sudeep Holla <sudeep.holla@arm.com>,
	linux-hwmon@vger.kernel.org,
	"moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" 
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: SCMI sensor reads unit scaling
Date: Mon, 22 Apr 2019 11:31:18 -0700	[thread overview]
Message-ID: <2e6a6141-762f-7618-60b9-84fa1190813d@gmail.com> (raw)
In-Reply-To: <7d23066b-fd45-1784-3c2a-7e44eeae63bf@roeck-us.net>

On 4/20/19 10:31 AM, Guenter Roeck wrote:
> On 4/20/19 9:43 AM, Florian Fainelli wrote:
>> Hi Sudeep, Guenter,
>>
>> The current SCMI hwmon support does not seem to make use of the sensor
>> scale/unit as defined in the sensor replies (or the update scale for
>> that matter).
>>
>> I came up with the patch below which gets the job done, but I am worried
>> about possibly breaking people's SCMI deployments and sensors reading
>> because they may have intentionally or not already decided to return a
>> value which is scaled the way Linux's hwmon expect it, and may, or may
>> not have populated a valid unit number in the sensor reply.
>>
>> Ideally we should probably do two conversions:
>>
>> - from within scmi_sensor_reading_get(), scale the value as indicated by
>> the reply
>> - from within scmi_hwmon_read(), take that scaled value and apply the
>> necessary conversion expected by Linux's HWMON conventions (e.g.:
>> reporting voltage as mV values)
>>
>> What do you think?
>>
> 
> Reported values have to follow HWMON conventions. If not, this is a bug
> and needs to get fixed. The argument about not changing the userspace ABI
> does not apply to bugs.

Upon re-reading the SCMI specification, what is not clear to me is
whether you have the liberty to:

- target the Linux HWMON sensor units as specified by
Documentation/hwmon/sysfs-interface by e.g.: putting a millidegree
Celsius value in the SCMI reply and an power of 10 multiplier value of 0
(which would be treated as not doing any scaling)

- must provide the raw value as provided by the sensor as well as
indicate the scale, e.g.: millidegree celsius and specifying a scale of -3

Sudeep can you clarify how you would approach making use (or not) of the
power of 10 multiplier as defined by the SCMI specification?

Thanks!
-- 
Florian

WARNING: multiple messages have this Message-ID (diff)
From: Florian Fainelli <f.fainelli@gmail.com>
To: Guenter Roeck <linux@roeck-us.net>,
	Sudeep Holla <sudeep.holla@arm.com>,
	linux-hwmon@vger.kernel.org,
	"moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: SCMI sensor reads unit scaling
Date: Mon, 22 Apr 2019 11:31:18 -0700	[thread overview]
Message-ID: <2e6a6141-762f-7618-60b9-84fa1190813d@gmail.com> (raw)
In-Reply-To: <7d23066b-fd45-1784-3c2a-7e44eeae63bf@roeck-us.net>

On 4/20/19 10:31 AM, Guenter Roeck wrote:
> On 4/20/19 9:43 AM, Florian Fainelli wrote:
>> Hi Sudeep, Guenter,
>>
>> The current SCMI hwmon support does not seem to make use of the sensor
>> scale/unit as defined in the sensor replies (or the update scale for
>> that matter).
>>
>> I came up with the patch below which gets the job done, but I am worried
>> about possibly breaking people's SCMI deployments and sensors reading
>> because they may have intentionally or not already decided to return a
>> value which is scaled the way Linux's hwmon expect it, and may, or may
>> not have populated a valid unit number in the sensor reply.
>>
>> Ideally we should probably do two conversions:
>>
>> - from within scmi_sensor_reading_get(), scale the value as indicated by
>> the reply
>> - from within scmi_hwmon_read(), take that scaled value and apply the
>> necessary conversion expected by Linux's HWMON conventions (e.g.:
>> reporting voltage as mV values)
>>
>> What do you think?
>>
> 
> Reported values have to follow HWMON conventions. If not, this is a bug
> and needs to get fixed. The argument about not changing the userspace ABI
> does not apply to bugs.

Upon re-reading the SCMI specification, what is not clear to me is
whether you have the liberty to:

- target the Linux HWMON sensor units as specified by
Documentation/hwmon/sysfs-interface by e.g.: putting a millidegree
Celsius value in the SCMI reply and an power of 10 multiplier value of 0
(which would be treated as not doing any scaling)

- must provide the raw value as provided by the sensor as well as
indicate the scale, e.g.: millidegree celsius and specifying a scale of -3

Sudeep can you clarify how you would approach making use (or not) of the
power of 10 multiplier as defined by the SCMI specification?

Thanks!
-- 
Florian

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-04-22 18:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-20 16:43 SCMI sensor reads unit scaling Florian Fainelli
2019-04-20 16:43 ` Florian Fainelli
2019-04-20 17:31 ` Guenter Roeck
2019-04-20 17:31   ` Guenter Roeck
2019-04-22 18:31   ` Florian Fainelli [this message]
2019-04-22 18:31     ` Florian Fainelli
2019-04-22 19:29     ` Guenter Roeck
2019-04-22 19:29       ` Guenter Roeck
2019-04-23 13:06 ` Sudeep Holla
2019-04-23 13:06   ` Sudeep Holla

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=2e6a6141-762f-7618-60b9-84fa1190813d@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=sudeep.holla@arm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.