linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eduardo Valentin <edubezval@gmail.com>
To: Pavel Machek <pavel@ucw.cz>
Cc: nm@ti.com, rui.zhang@intel.com, linux-kernel@vger.kernel.org,
	linux-pm@vger.kernel.org, pali.rohar@gmail.com, sre@debian.org,
	sre@ring0.de,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	linux-omap@vger.kernel.org, tony@atomide.com, khilman@kernel.org,
	aaro.koskinen@iki.fi, ivo.g.dimitrov.75@gmail.com
Subject: Re: [PATCH] thermal: add omap3 support
Date: Mon, 5 Jan 2015 17:41:57 -0400	[thread overview]
Message-ID: <20150105214155.GE31536@developer> (raw)
In-Reply-To: <20150103220219.GA26747@amd>

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

On Sat, Jan 03, 2015 at 11:02:19PM +0100, Pavel Machek wrote:
> Hi!
> 
> > Thanks for sending your code.
> 
> You are welcome.
> 
> > > Add support for omap3430 sensor. Tested on Nokia N900.
> > 
> > To my understanding, and as already mentioned by Nishanth Menon
> > (currently TIer), TI has intentionally avoided adding this support.
> 
> Well, Nokia had similar code in their kernel.
> 
> > There is a hardware accuracy limitation in this sensor, and therefore it
> > is not advisable to use it, specially in Dynamic Thermal Management,
> > such as the thermal framework.
> 
> We are talking cellphone here. Yes, sensor may be inacurate (but it
> seems to work pretty well; perhaps TI can point us to some docs that
> explains the details?), but it provides useful information (mostly

sure! you should demand TI the proper data pointers.

> room temperature). I don't think we'll ever run anywhere close to
> thermal limits where inacuracy would matter. (Battery can't really
> take > 60C. AFAICT CPU limit is 120C. Battery is close to the CPU.)

Well, when the sensor's accuracy is +-15C and there is variance across
the sample distribution, well, that means you are gonna see products
behaving way different from each other, even if you are attempting to
find a threshold to shutdown a device. 

BTW, I am not a TIer anymore, and I don't have the exact data to provide
you.

> 
> > > Signed-off-by: Pavel Machek <pavel@ucw.cz>
> > > 
> > > diff --git a/drivers/thermal/ti-soc-thermal/Kconfig b/drivers/thermal/ti-soc-thermal/Kconfig
> > > index bd4c7be..a49495f 100644
> > > --- a/drivers/thermal/ti-soc-thermal/Kconfig
> > > +++ b/drivers/thermal/ti-soc-thermal/Kconfig
> > > @@ -21,6 +21,15 @@ config TI_THERMAL
> > >  	  This includes trip points definitions, extrapolation rules and
> > >  	  CPU cooling device bindings.
> > >  
> > > +config OMAP3_THERMAL
> > > +	bool "Texas Instruments OMAP3 thermal support"
> > > +	depends on TI_SOC_THERMAL
> > > +	depends on ARCH_OMAP3
> > > +	help
> > > +	  If you say yes here you get thermal support for the Texas Instruments
> > > +	  OMAP3 SoC family. The current chip supported are:
> > > +	   - OMAP3430
> > 
> > But if you insist :-), I believe the user deserves at least a fair
> > message saying this is on his / her own risk.
> 
> Something like this?
> 
>           If you say yes here you get thermal support for the Texas Instruments
> 	  OMAP3 SoC family. The current chip supported are:
> 	              - OMAP3430
> 
>           OMAP3 chips normally don't need thermal management, and sensors in
> 	  this generation are not very accurate, nor they are very close to
>           the important hotspots.

I would be stronger and rephrase with s/very//g. 


> 
>           Say 'N' here.
> 	  
> 
> > > +static struct temp_sensor_registers
> > > +omap34xx_mpu_temp_sensor_registers = {
> > > +	.temp_sensor_ctrl = 0,
> > > +	.bgap_tempsoff_mask = 0, /* Unused, we don't have POWER_SWITCH */
> > > +	.bgap_soc_mask = BIT(8),
> > > +	.bgap_eocz_mask = BIT(7),
> > > +	.bgap_dtemp_mask = 0x7f,
> > > +
> > > +	.bgap_mode_ctrl = 0,
> > > +	.mode_ctrl_mask = BIT(9),
> > > +
> > > +	.bgap_efuse = 0,
> > 
> > The 0'ed filed may be removed here.
> 
> Ok; I'll keep temp_sensors_ctrl / bgap_mode_ctrl, because it is actually used.
> 
> 
> > > diff --git a/drivers/thermal/ti-soc-thermal/ti-bandgap.c b/drivers/thermal/ti-soc-thermal/ti-bandgap.c
> > > index 634b6ce..3b4e72f 100644
> > > --- a/drivers/thermal/ti-soc-thermal/ti-bandgap.c
> > > +++ b/drivers/thermal/ti-soc-thermal/ti-bandgap.c
> > > @@ -1509,6 +1531,12 @@ static SIMPLE_DEV_PM_OPS(ti_bandgap_dev_pm_ops, ti_bandgap_suspend,
> > >  #endif
> > >  
> > >  static const struct of_device_id of_ti_bandgap_match[] = {
> > > +#ifdef CONFIG_OMAP3_THERMAL
> > > +	{
> > > +		.compatible = "ti,omap34xx-bandgap",
> > 
> > This needs to be updated in the binding documentation.
> > Documentation/devicetree/bindings/thermal/ti_soc_thermal.txt
> 
> Ok.
> 
> > > +		.data = (void *)&omap34xx_data,
> > 
> > 
> > Having a run time message intentionally advising users of the risk of
> > using this sensor is also required.
> 
> Ok, what about?
> 
>     if (TI_BANDGAP_HAS(bgp, UNRELIABLE))
>               dev_warn(&pdev->dev,
>                          "OMAP3 thermal sensor is unreliable and normally unneccessary\n");
> 

works for me.

> Will not fit in 80 columns, but keeping message on one line is more important.
> 									Pavel
> -- 
> (english) http://www.livejournal.com/~pavelmachek
> (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

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

  reply	other threads:[~2015-01-05 21:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-03 11:11 [PATCH] thermal: add omap3 support Pavel Machek
2015-01-03 12:34 ` Eduardo Valentin
2015-01-03 22:02   ` Pavel Machek
2015-01-05 21:41     ` Eduardo Valentin [this message]
2015-01-18 20:28 ` [PATCHv2] " Pavel Machek
2015-03-13  5:03   ` Eduardo Valentin
2015-03-13 19:40     ` Pavel Machek
2015-03-13 12:09   ` Pavel Machek
2015-03-13 16:53     ` Eduardo Valentin
2015-03-14 18:02       ` Pavel Machek
2015-03-23 11:25         ` Pavel Machek
2015-03-23 14:31   ` Eduardo Valentin
2015-03-23 15:58     ` Pavel Machek
2015-03-23 17:55       ` 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=20150105214155.GE31536@developer \
    --to=edubezval@gmail.com \
    --cc=aaro.koskinen@iki.fi \
    --cc=ivo.g.dimitrov.75@gmail.com \
    --cc=khilman@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=nm@ti.com \
    --cc=pali.rohar@gmail.com \
    --cc=pavel@ucw.cz \
    --cc=rui.zhang@intel.com \
    --cc=sre@debian.org \
    --cc=sre@ring0.de \
    --cc=tony@atomide.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).