linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eduardo Valentin <edubezval@gmail.com>
To: Rui Zhang <rui.zhang@intel.com>,
	hongtao.jia@freescale.com, kong.kongxinwei@hisilicon.com,
	nrajan@codeaurora.org
Cc: Linux PM <linux-pm@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Linux ACPI <linux-acpi@vger.kernel.org>
Subject: Re: [PATCH 1/2] thermal: support slope and offset coefficients
Date: Mon, 11 May 2015 20:25:10 -0700	[thread overview]
Message-ID: <20150512032509.GI4810@localhost.localdomain> (raw)
In-Reply-To: <1431399857-13943-2-git-send-email-edubezval@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3920 bytes --]

Copying Narendran.

On Mon, May 11, 2015 at 08:04:16PM -0700, Eduardo Valentin wrote:
> It is common to have a linear extrapolation from
> the current sensor readings and the actual temperature
> value. This is specially the case when the sensor
> is in use to extrapolate hotspots.
> 
> This patch adds slope and offset constants for
> single sensor linear extrapolation equation. Because
> the same sensor can be use in different locations,
> from board to board, these constants are added
> as part of thermal_zone_params.
> 
> The constants are available through sysfs.
> 
> It is up to the device driver to determine
> the usage of these values.


> 
> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
> ---
>  Documentation/thermal/sysfs-api.txt | 16 ++++++++++++++++
>  drivers/thermal/thermal_core.c      |  4 ++++
>  include/linux/thermal.h             | 11 +++++++++++
>  3 files changed, 31 insertions(+)
> 
> diff --git a/Documentation/thermal/sysfs-api.txt b/Documentation/thermal/sysfs-api.txt
> index 7d44d7f..c1f6864 100644
> --- a/Documentation/thermal/sysfs-api.txt
> +++ b/Documentation/thermal/sysfs-api.txt
> @@ -190,6 +190,8 @@ Thermal zone device sys I/F, created once it's registered:
>      |---k_i:                    PID's integral term in the power allocator gov
>      |---k_d:                    PID's derivative term in the power allocator
>      |---integral_cutoff:        Offset above which errors are accumulated
> +    |---slope:                  Slope constant applied as linear extrapolation
> +    |---offset:                 Offset constant applied as linear extrapolation
>  
>  Thermal cooling device sys I/F, created once it's registered:
>  /sys/class/thermal/cooling_device[0-*]:
> @@ -359,6 +361,20 @@ integral_cutoff
>  	Documentation/thermal/power_allocator.txt
>  	RW, Optional
>  
> +slope
> +	The slope constant used in a linear extrapolation model
> +	to determine a hotspot temperature based off the sensor's
> +	raw readings. It is up to the device driver to determine
> +	the usage of these values.
> +	RW, Optional
> +
> +offset
> +	The offset constant used in a linear extrapolation model
> +	to determine a hotspot temperature based off the sensor's
> +	raw readings. It is up to the device driver to determine
> +	the usage of these values.
> +	RW, Optional
> +
>  *****************************
>  * Cooling device attributes *
>  *****************************
> diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
> index 962de18..04659bf 100644
> --- a/drivers/thermal/thermal_core.c
> +++ b/drivers/thermal/thermal_core.c
> @@ -944,6 +944,8 @@ create_s32_tzp_attr(k_pu);
>  create_s32_tzp_attr(k_i);
>  create_s32_tzp_attr(k_d);
>  create_s32_tzp_attr(integral_cutoff);
> +create_s32_tzp_attr(slope);
> +create_s32_tzp_attr(offset);
>  #undef create_s32_tzp_attr
>  
>  static struct device_attribute *dev_tzp_attrs[] = {
> @@ -953,6 +955,8 @@ static struct device_attribute *dev_tzp_attrs[] = {
>  	&dev_attr_k_i,
>  	&dev_attr_k_d,
>  	&dev_attr_integral_cutoff,
> +	&dev_attr_slope,
> +	&dev_attr_offset,
>  };
>  
>  static int create_tzp_attrs(struct device *dev)
> diff --git a/include/linux/thermal.h b/include/linux/thermal.h
> index 6bbe11c..037e9df 100644
> --- a/include/linux/thermal.h
> +++ b/include/linux/thermal.h
> @@ -302,6 +302,17 @@ struct thermal_zone_params {
>  
>  	/* threshold below which the error is no longer accumulated */
>  	s32 integral_cutoff;
> +
> +	/*
> +	 * @slope:	slope of a linear temperature adjustment curve.
> +	 * 		Used by thermal zone drivers.
> +	 */
> +	int slope;
> +	/*
> +	 * @offset:	offset of a linear temperature adjustment curve.
> +	 * 		Used by thermal zone drivers (default 0).
> +	 */
> +	int offset;
>  };
>  
>  struct thermal_genl_event {
> -- 
> 2.3.4
> 

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

  reply	other threads:[~2015-05-12  3:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-12  3:04 [PATCH 0/2] thermal: add support to slope and offset Eduardo Valentin
2015-05-12  3:04 ` [PATCH 1/2] thermal: support slope and offset coefficients Eduardo Valentin
2015-05-12  3:25   ` Eduardo Valentin [this message]
2015-05-12  3:04 ` [PATCH 2/2] thermal: of-thermal: add support for reading coefficients property Eduardo Valentin
2015-05-12  3:27   ` [PATCH 2/2] thermal: of-thermal: add support for reading coefficients property 33 O May 11 Antoine Tenart ( 15K) [PATCH v4 1/3] iio: adc: add support for Berlin Eduardo Valentin
2015-05-12  3:24 ` [PATCH 0/2] thermal: add support to slope and offset Eduardo Valentin

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=20150512032509.GI4810@localhost.localdomain \
    --to=edubezval@gmail.com \
    --cc=hongtao.jia@freescale.com \
    --cc=kong.kongxinwei@hisilicon.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=nrajan@codeaurora.org \
    --cc=rui.zhang@intel.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 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 NNTP newsgroup(s).