From: Eduardo Valentin <edubezval@gmail.com>
To: Pavel Machek <pavel@ucw.cz>
Cc: 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: Sat, 3 Jan 2015 08:34:30 -0400 [thread overview]
Message-ID: <20150103123426.GA26069@developer> (raw)
In-Reply-To: <20150103111146.GB7065@amd>
[-- Attachment #1: Type: text/plain, Size: 7563 bytes --]
Hello Pavel,
Thanks for sending your code.
On Sat, Jan 03, 2015 at 12:11:46PM +0100, Pavel Machek wrote:
> 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.
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.
>
> 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.
> +
> config OMAP4_THERMAL
> bool "Texas Instruments OMAP4 thermal support"
> depends on TI_SOC_THERMAL
> diff --git a/drivers/thermal/ti-soc-thermal/Makefile b/drivers/thermal/ti-soc-thermal/Makefile
> index 1226b24..2b5b220 100644
> --- a/drivers/thermal/ti-soc-thermal/Makefile
> +++ b/drivers/thermal/ti-soc-thermal/Makefile
> @@ -2,5 +2,6 @@ obj-$(CONFIG_TI_SOC_THERMAL) += ti-soc-thermal.o
> ti-soc-thermal-y := ti-bandgap.o
> ti-soc-thermal-$(CONFIG_TI_THERMAL) += ti-thermal-common.o
> ti-soc-thermal-$(CONFIG_DRA752_THERMAL) += dra752-thermal-data.o
> +ti-soc-thermal-$(CONFIG_OMAP3_THERMAL) += omap3-thermal-data.o
> ti-soc-thermal-$(CONFIG_OMAP4_THERMAL) += omap4-thermal-data.o
> ti-soc-thermal-$(CONFIG_OMAP5_THERMAL) += omap5-thermal-data.o
> diff --git a/drivers/thermal/ti-soc-thermal/omap3-thermal-data.c b/drivers/thermal/ti-soc-thermal/omap3-thermal-data.c
> new file mode 100644
> index 0000000..7c18766
> --- /dev/null
> +++ b/drivers/thermal/ti-soc-thermal/omap3-thermal-data.c
> @@ -0,0 +1,95 @@
> +/*
> + * OMAP3 thermal driver.
> + *
> + * Copyright (C) 2011-2012 Texas Instruments Inc.
> + * Copyright (C) 2014 Pavel Machek <pavel@ucw.cz>
> + *
> + * This software is licensed under the terms of the GNU General Public
> + * License version 2, as published by the Free Software Foundation, and
> + * may be copied, distributed, and modified under those terms.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + */
> +
> +#include "ti-thermal.h"
> +#include "ti-bandgap.h"
> +
> +/*
> + * OMAP34XX has one instance of thermal sensor for MPU
> + * need to describe the individual bit fields
> + */
> +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.
> +};
> +
> +/* Thresholds and limits for OMAP34XX MPU temperature sensor */
> +static struct temp_sensor_data omap34xx_mpu_temp_sensor_data = {
> + .min_freq = 32768,
> + .max_freq = 32768,
> + .max_temp = -99000,
> + .min_temp = 99000,
> + .hyst_val = 5000,
> +};
> +
> +/*
> + * Temperature values in milli degree celsius
> + */
> +static const int
> +omap34xx_adc_to_temp[128] = {
> + -40000, -40000, -40000, -40000, -40000, -39000, -38000, -36000,
> + -34000, -32000, -31000, -29000, -28000, -26000, -25000, -24000,
> + -22000, -21000, -19000, -18000, -17000, -15000, -14000, -12000,
> + -11000, -9000, -8000, -7000, -5000, -4000, -2000, -1000, 0000,
> + 1000, 3000, 4000, 5000, 7000, 8000, 10000, 11000, 13000, 14000,
> + 15000, 17000, 18000, 20000, 21000, 22000, 24000, 25000, 27000,
> + 28000, 30000, 31000, 32000, 34000, 35000, 37000, 38000, 39000,
> + 41000, 42000, 44000, 45000, 47000, 48000, 49000, 51000, 52000,
> + 53000, 55000, 56000, 58000, 59000, 60000, 62000, 63000, 65000,
> + 66000, 67000, 69000, 70000, 72000, 73000, 74000, 76000, 77000,
> + 79000, 80000, 81000, 83000, 84000, 85000, 87000, 88000, 89000,
> + 91000, 92000, 94000, 95000, 96000, 98000, 99000, 100000,
> + 102000, 103000, 105000, 106000, 107000, 109000, 110000, 111000,
> + 113000, 114000, 116000, 117000, 118000, 120000, 121000, 122000,
> + 124000, 124000, 125000, 125000, 125000, 125000, 125000
> +};
> +
> +/* OMAP34XX data */
> +const struct ti_bandgap_data omap34xx_data = {
> + .features = TI_BANDGAP_FEATURE_CLK_CTRL /* | TI_BANDGAP_FEATURE_MODE_CONFIG */,
> + .fclock_name = "ts_fck",
> + .div_ck_name = "ts_fck",
> + .conv_table = omap34xx_adc_to_temp,
> + .adc_start_val = 0,
> + .adc_end_val = 127,
> + .expose_sensor = ti_thermal_expose_sensor,
> + .remove_sensor = ti_thermal_remove_sensor,
> +
> + .sensors = {
> + {
> + .registers = &omap34xx_mpu_temp_sensor_registers,
> + .ts_data = &omap34xx_mpu_temp_sensor_data,
> + .domain = "cpu",
> + .slope = 0,
> + .constant = 20000,
> + .slope_pcb = 0,
> + .constant_pcb = 20000,
> + .register_cooling = NULL,
> + .unregister_cooling = NULL,
> + },
> + },
> + .sensor_count = 1,
> +};
> 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
> + .data = (void *)&omap34xx_data,
Having a run time message intentionally advising users of the risk of
using this sensor is also required.
> + },
> +#endif
> #ifdef CONFIG_OMAP4_THERMAL
> {
> .compatible = "ti,omap4430-bandgap",
> diff --git a/drivers/thermal/ti-soc-thermal/ti-bandgap.h b/drivers/thermal/ti-soc-thermal/ti-bandgap.h
> index b3adf72..3f05386 100644
> --- a/drivers/thermal/ti-soc-thermal/ti-bandgap.h
> +++ b/drivers/thermal/ti-soc-thermal/ti-bandgap.h
> @@ -384,6 +384,8 @@ int ti_bandgap_set_sensor_data(struct ti_bandgap *bgp, int id, void *data);
> void *ti_bandgap_get_sensor_data(struct ti_bandgap *bgp, int id);
> int ti_bandgap_get_trend(struct ti_bandgap *bgp, int id, int *trend);
>
> +extern const struct ti_bandgap_data omap34xx_data;
> +
> #ifdef CONFIG_OMAP4_THERMAL
> extern const struct ti_bandgap_data omap4430_data;
> extern const struct ti_bandgap_data omap4460_data;
>
> --
> (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 --]
WARNING: multiple messages have this Message-ID (diff)
From: edubezval@gmail.com (Eduardo Valentin)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] thermal: add omap3 support
Date: Sat, 3 Jan 2015 08:34:30 -0400 [thread overview]
Message-ID: <20150103123426.GA26069@developer> (raw)
In-Reply-To: <20150103111146.GB7065@amd>
Hello Pavel,
Thanks for sending your code.
On Sat, Jan 03, 2015 at 12:11:46PM +0100, Pavel Machek wrote:
> 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.
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.
>
> 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.
> +
> config OMAP4_THERMAL
> bool "Texas Instruments OMAP4 thermal support"
> depends on TI_SOC_THERMAL
> diff --git a/drivers/thermal/ti-soc-thermal/Makefile b/drivers/thermal/ti-soc-thermal/Makefile
> index 1226b24..2b5b220 100644
> --- a/drivers/thermal/ti-soc-thermal/Makefile
> +++ b/drivers/thermal/ti-soc-thermal/Makefile
> @@ -2,5 +2,6 @@ obj-$(CONFIG_TI_SOC_THERMAL) += ti-soc-thermal.o
> ti-soc-thermal-y := ti-bandgap.o
> ti-soc-thermal-$(CONFIG_TI_THERMAL) += ti-thermal-common.o
> ti-soc-thermal-$(CONFIG_DRA752_THERMAL) += dra752-thermal-data.o
> +ti-soc-thermal-$(CONFIG_OMAP3_THERMAL) += omap3-thermal-data.o
> ti-soc-thermal-$(CONFIG_OMAP4_THERMAL) += omap4-thermal-data.o
> ti-soc-thermal-$(CONFIG_OMAP5_THERMAL) += omap5-thermal-data.o
> diff --git a/drivers/thermal/ti-soc-thermal/omap3-thermal-data.c b/drivers/thermal/ti-soc-thermal/omap3-thermal-data.c
> new file mode 100644
> index 0000000..7c18766
> --- /dev/null
> +++ b/drivers/thermal/ti-soc-thermal/omap3-thermal-data.c
> @@ -0,0 +1,95 @@
> +/*
> + * OMAP3 thermal driver.
> + *
> + * Copyright (C) 2011-2012 Texas Instruments Inc.
> + * Copyright (C) 2014 Pavel Machek <pavel@ucw.cz>
> + *
> + * This software is licensed under the terms of the GNU General Public
> + * License version 2, as published by the Free Software Foundation, and
> + * may be copied, distributed, and modified under those terms.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + */
> +
> +#include "ti-thermal.h"
> +#include "ti-bandgap.h"
> +
> +/*
> + * OMAP34XX has one instance of thermal sensor for MPU
> + * need to describe the individual bit fields
> + */
> +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.
> +};
> +
> +/* Thresholds and limits for OMAP34XX MPU temperature sensor */
> +static struct temp_sensor_data omap34xx_mpu_temp_sensor_data = {
> + .min_freq = 32768,
> + .max_freq = 32768,
> + .max_temp = -99000,
> + .min_temp = 99000,
> + .hyst_val = 5000,
> +};
> +
> +/*
> + * Temperature values in milli degree celsius
> + */
> +static const int
> +omap34xx_adc_to_temp[128] = {
> + -40000, -40000, -40000, -40000, -40000, -39000, -38000, -36000,
> + -34000, -32000, -31000, -29000, -28000, -26000, -25000, -24000,
> + -22000, -21000, -19000, -18000, -17000, -15000, -14000, -12000,
> + -11000, -9000, -8000, -7000, -5000, -4000, -2000, -1000, 0000,
> + 1000, 3000, 4000, 5000, 7000, 8000, 10000, 11000, 13000, 14000,
> + 15000, 17000, 18000, 20000, 21000, 22000, 24000, 25000, 27000,
> + 28000, 30000, 31000, 32000, 34000, 35000, 37000, 38000, 39000,
> + 41000, 42000, 44000, 45000, 47000, 48000, 49000, 51000, 52000,
> + 53000, 55000, 56000, 58000, 59000, 60000, 62000, 63000, 65000,
> + 66000, 67000, 69000, 70000, 72000, 73000, 74000, 76000, 77000,
> + 79000, 80000, 81000, 83000, 84000, 85000, 87000, 88000, 89000,
> + 91000, 92000, 94000, 95000, 96000, 98000, 99000, 100000,
> + 102000, 103000, 105000, 106000, 107000, 109000, 110000, 111000,
> + 113000, 114000, 116000, 117000, 118000, 120000, 121000, 122000,
> + 124000, 124000, 125000, 125000, 125000, 125000, 125000
> +};
> +
> +/* OMAP34XX data */
> +const struct ti_bandgap_data omap34xx_data = {
> + .features = TI_BANDGAP_FEATURE_CLK_CTRL /* | TI_BANDGAP_FEATURE_MODE_CONFIG */,
> + .fclock_name = "ts_fck",
> + .div_ck_name = "ts_fck",
> + .conv_table = omap34xx_adc_to_temp,
> + .adc_start_val = 0,
> + .adc_end_val = 127,
> + .expose_sensor = ti_thermal_expose_sensor,
> + .remove_sensor = ti_thermal_remove_sensor,
> +
> + .sensors = {
> + {
> + .registers = &omap34xx_mpu_temp_sensor_registers,
> + .ts_data = &omap34xx_mpu_temp_sensor_data,
> + .domain = "cpu",
> + .slope = 0,
> + .constant = 20000,
> + .slope_pcb = 0,
> + .constant_pcb = 20000,
> + .register_cooling = NULL,
> + .unregister_cooling = NULL,
> + },
> + },
> + .sensor_count = 1,
> +};
> 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
> + .data = (void *)&omap34xx_data,
Having a run time message intentionally advising users of the risk of
using this sensor is also required.
> + },
> +#endif
> #ifdef CONFIG_OMAP4_THERMAL
> {
> .compatible = "ti,omap4430-bandgap",
> diff --git a/drivers/thermal/ti-soc-thermal/ti-bandgap.h b/drivers/thermal/ti-soc-thermal/ti-bandgap.h
> index b3adf72..3f05386 100644
> --- a/drivers/thermal/ti-soc-thermal/ti-bandgap.h
> +++ b/drivers/thermal/ti-soc-thermal/ti-bandgap.h
> @@ -384,6 +384,8 @@ int ti_bandgap_set_sensor_data(struct ti_bandgap *bgp, int id, void *data);
> void *ti_bandgap_get_sensor_data(struct ti_bandgap *bgp, int id);
> int ti_bandgap_get_trend(struct ti_bandgap *bgp, int id, int *trend);
>
> +extern const struct ti_bandgap_data omap34xx_data;
> +
> #ifdef CONFIG_OMAP4_THERMAL
> extern const struct ti_bandgap_data omap4430_data;
> extern const struct ti_bandgap_data omap4460_data;
>
> --
> (english) http://www.livejournal.com/~pavelmachek
> (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20150103/e40fab4a/attachment-0001.sig>
next prev parent reply other threads:[~2015-01-03 12:34 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-03 11:11 [PATCH] thermal: add omap3 support Pavel Machek
2015-01-03 11:11 ` Pavel Machek
2015-01-03 12:34 ` Eduardo Valentin [this message]
2015-01-03 12:34 ` Eduardo Valentin
2015-01-03 22:02 ` Pavel Machek
2015-01-03 22:02 ` Pavel Machek
2015-01-05 21:41 ` Eduardo Valentin
2015-01-05 21:41 ` Eduardo Valentin
2015-01-18 20:28 ` [PATCHv2] " Pavel Machek
2015-01-18 20:28 ` Pavel Machek
2015-01-18 20:28 ` Pavel Machek
2015-03-13 5:03 ` Eduardo Valentin
2015-03-13 5:03 ` Eduardo Valentin
2015-03-13 19:40 ` Pavel Machek
2015-03-13 19:40 ` Pavel Machek
2015-03-13 12:09 ` Pavel Machek
2015-03-13 12:09 ` Pavel Machek
2015-03-13 16:53 ` Eduardo Valentin
2015-03-13 16:53 ` Eduardo Valentin
2015-03-14 18:02 ` Pavel Machek
2015-03-14 18:02 ` Pavel Machek
2015-03-23 11:25 ` Pavel Machek
2015-03-23 11:25 ` Pavel Machek
2015-03-23 14:31 ` Eduardo Valentin
2015-03-23 14:31 ` Eduardo Valentin
2015-03-23 15:58 ` Pavel Machek
2015-03-23 15:58 ` Pavel Machek
2015-03-23 17:55 ` Eduardo Valentin
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=20150103123426.GA26069@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=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 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.