All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eduardo Valentin <eduardo.valentin@ti.com>
To: Eduardo Valentin <eduardo.valentin@ti.com>
Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/7] thermal: ti-soc-thermal: freeze FSM while computing trend
Date: Fri, 7 Jun 2013 15:10:51 -0400	[thread overview]
Message-ID: <51B2303B.8090200@ti.com> (raw)
In-Reply-To: <1369840066-20357-4-git-send-email-eduardo.valentin@ti.com>

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

On 29-05-2013 11:07, Eduardo Valentin wrote:
> In order to read the history buffer, it is required to
> freeze BG FSM. This patch adds the missing piece of code
> to freeze the FSM and also a contention area to avoid
> other parts of the code to access the DTEMPs.
> 
> Cc: Zhang Rui <rui.zhang@intel.com>
> Cc: linux-pm@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
> ---
>  drivers/thermal/ti-soc-thermal/ti-bandgap.c | 13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/thermal/ti-soc-thermal/ti-bandgap.c b/drivers/thermal/ti-soc-thermal/ti-bandgap.c
> index f20c1cf..be9dba5 100644
> --- a/drivers/thermal/ti-soc-thermal/ti-bandgap.c
> +++ b/drivers/thermal/ti-soc-thermal/ti-bandgap.c
> @@ -992,9 +992,12 @@ int ti_bandgap_get_trend(struct ti_bandgap *bgp, int id, int *trend)
>  		goto exit;
>  	}
>  
> +	spin_lock(&bgp->lock);
> +
>  	tsr = bgp->conf->sensors[id].registers;
>  
>  	/* Freeze and read the last 2 valid readings */
> +	RMW_BITS(bgp, id, bgap_mask_ctrl, mask_freeze_mask, 1);
>  	reg1 = tsr->ctrl_dtemp_1;
>  	reg2 = tsr->ctrl_dtemp_2;
>  
> @@ -1008,22 +1011,26 @@ int ti_bandgap_get_trend(struct ti_bandgap *bgp, int id, int *trend)
>  	/* Convert from adc values to mCelsius temperature */
>  	ret = ti_bandgap_adc_to_mcelsius(bgp, temp1, &t1);
>  	if (ret)
> -		goto exit;
> +		goto unfreeze;
>  
>  	ret = ti_bandgap_adc_to_mcelsius(bgp, temp2, &t2);
>  	if (ret)
> -		goto exit;
> +		goto unfreeze;
>  
>  	/* Fetch the update interval */
>  	ret = ti_bandgap_read_update_interval(bgp, id, &interval);
>  	if (ret || !interval)
> -		goto exit;
> +		goto unfreeze;
>  
>  	*trend = (t1 - t2) / interval;
>  
>  	dev_dbg(bgp->dev, "The temperatures are t1 = %d and t2 = %d and trend =%d\n",
>  		t1, t2, *trend);
>  
> +unfreeze:
> +	RMW_BITS(bgp, id, bgap_mask_ctrl, mask_freeze_mask, 0);
> +unlock:

This label is unused. I will repost this patch only without this label.

> +	spin_unlock(&bgp->lock);
>  exit:
>  	return ret;
>  }
> 


-- 
You have got to be excited about what you are doing. (L. Lamport)

Eduardo Valentin


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 295 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Eduardo Valentin <eduardo.valentin@ti.com>
To: Eduardo Valentin <eduardo.valentin@ti.com>
Cc: <rui.zhang@intel.com>, <linux-pm@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 3/7] thermal: ti-soc-thermal: freeze FSM while computing trend
Date: Fri, 7 Jun 2013 15:10:51 -0400	[thread overview]
Message-ID: <51B2303B.8090200@ti.com> (raw)
In-Reply-To: <1369840066-20357-4-git-send-email-eduardo.valentin@ti.com>

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

On 29-05-2013 11:07, Eduardo Valentin wrote:
> In order to read the history buffer, it is required to
> freeze BG FSM. This patch adds the missing piece of code
> to freeze the FSM and also a contention area to avoid
> other parts of the code to access the DTEMPs.
> 
> Cc: Zhang Rui <rui.zhang@intel.com>
> Cc: linux-pm@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
> ---
>  drivers/thermal/ti-soc-thermal/ti-bandgap.c | 13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/thermal/ti-soc-thermal/ti-bandgap.c b/drivers/thermal/ti-soc-thermal/ti-bandgap.c
> index f20c1cf..be9dba5 100644
> --- a/drivers/thermal/ti-soc-thermal/ti-bandgap.c
> +++ b/drivers/thermal/ti-soc-thermal/ti-bandgap.c
> @@ -992,9 +992,12 @@ int ti_bandgap_get_trend(struct ti_bandgap *bgp, int id, int *trend)
>  		goto exit;
>  	}
>  
> +	spin_lock(&bgp->lock);
> +
>  	tsr = bgp->conf->sensors[id].registers;
>  
>  	/* Freeze and read the last 2 valid readings */
> +	RMW_BITS(bgp, id, bgap_mask_ctrl, mask_freeze_mask, 1);
>  	reg1 = tsr->ctrl_dtemp_1;
>  	reg2 = tsr->ctrl_dtemp_2;
>  
> @@ -1008,22 +1011,26 @@ int ti_bandgap_get_trend(struct ti_bandgap *bgp, int id, int *trend)
>  	/* Convert from adc values to mCelsius temperature */
>  	ret = ti_bandgap_adc_to_mcelsius(bgp, temp1, &t1);
>  	if (ret)
> -		goto exit;
> +		goto unfreeze;
>  
>  	ret = ti_bandgap_adc_to_mcelsius(bgp, temp2, &t2);
>  	if (ret)
> -		goto exit;
> +		goto unfreeze;
>  
>  	/* Fetch the update interval */
>  	ret = ti_bandgap_read_update_interval(bgp, id, &interval);
>  	if (ret || !interval)
> -		goto exit;
> +		goto unfreeze;
>  
>  	*trend = (t1 - t2) / interval;
>  
>  	dev_dbg(bgp->dev, "The temperatures are t1 = %d and t2 = %d and trend =%d\n",
>  		t1, t2, *trend);
>  
> +unfreeze:
> +	RMW_BITS(bgp, id, bgap_mask_ctrl, mask_freeze_mask, 0);
> +unlock:

This label is unused. I will repost this patch only without this label.

> +	spin_unlock(&bgp->lock);
>  exit:
>  	return ret;
>  }
> 


-- 
You have got to be excited about what you are doing. (L. Lamport)

Eduardo Valentin


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 295 bytes --]

  reply	other threads:[~2013-06-07 19:11 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-29 15:07 [PATCH 0/7] thermal: ti-soc-thermal: fixes and DRA752 support Eduardo Valentin
2013-05-29 15:07 ` Eduardo Valentin
2013-05-29 15:07 ` [PATCH 1/7] thermal: ti-soc-thermal: update DT reference for OMAP5430 Eduardo Valentin
2013-05-29 15:07   ` Eduardo Valentin
2013-05-29 15:07 ` [PATCH 2/7] thermal: ti-soc-thermal: remove external heat while extrapolating hotspot Eduardo Valentin
2013-05-29 15:07   ` Eduardo Valentin
2013-05-29 15:07 ` [PATCH 3/7] thermal: ti-soc-thermal: freeze FSM while computing trend Eduardo Valentin
2013-05-29 15:07   ` Eduardo Valentin
2013-06-07 19:10   ` Eduardo Valentin [this message]
2013-06-07 19:10     ` Eduardo Valentin
2013-06-07 19:13     ` [PATCHv2 " Eduardo Valentin
2013-06-07 19:13       ` Eduardo Valentin
2013-05-29 15:07 ` [PATCH 4/7] thermal: ti-soc-thermal: remove usage of IS_ERR_OR_NULL Eduardo Valentin
2013-05-29 15:07   ` Eduardo Valentin
2013-05-29 15:07 ` [PATCH 5/7] thermal: ti-soc-thermal: add thermal data for DRA752 chips Eduardo Valentin
2013-05-29 15:07   ` Eduardo Valentin
2013-06-03 20:31   ` Eduardo Valentin
2013-06-03 20:31     ` Eduardo Valentin
2013-06-03 20:33     ` [PATCHv2 " Eduardo Valentin
2013-06-03 20:33       ` Eduardo Valentin
2013-05-29 15:07 ` [PATCH 6/7] thermal: ti-soc-thermal: add dra752 chip to device table Eduardo Valentin
2013-05-29 15:07   ` Eduardo Valentin
2013-05-29 15:07 ` [PATCH 7/7] thermal: ti-soc-thermal: add DT example for DRA752 chip Eduardo Valentin
2013-05-29 15:07   ` Eduardo Valentin
2013-05-30  8:56   ` keerthy
2013-05-30  8:56     ` keerthy
2013-05-30 13:52     ` Eduardo Valentin
2013-05-30 13:52       ` Eduardo Valentin
2013-06-13  2:20 ` [PATCH 0/7] thermal: ti-soc-thermal: fixes and DRA752 support Zhang Rui

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=51B2303B.8090200@ti.com \
    --to=eduardo.valentin@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.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 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.