* [PATCH v5 1/3] thermal: mediatek: Add cpu dynamic power cooling model.
2015-12-16 3:59 [PATCH v5 0/3] thermal: mediatek: Add cpu dynamic power cooling model Dawei Chien
@ 2015-12-16 3:59 ` Dawei Chien
2015-12-16 3:59 ` [PATCH v5 2/3] arm64: dts: mt8173: Add thermal zone node Dawei Chien
` (2 subsequent siblings)
3 siblings, 0 replies; 9+ messages in thread
From: Dawei Chien @ 2015-12-16 3:59 UTC (permalink / raw)
To: Viresh Kumar
Cc: Rafael J. Wysocki, Rob Herring, Pawel Moll, Mark Rutland,
Ian Campbell, Kumar Gala, Matthias Brugger, Daniel Kurtz,
Sascha Hauer, Daniel Lezcano, Dawei Chien, devicetree,
linux-arm-kernel, linux-kernel, linux-pm, linux-mediatek,
srv_heupstream, Sascha Hauer, Punit Agrawal
MT8173 cpufreq driver select of_cpufreq_power_cooling_register registering
cooling devices with dynamic power coefficient.
Signed-off-by: Dawei Chien <dawei.chien@mediatek.com>
---
This patch is base on patchset:
https://lkml.org/lkml/2015/11/17/251
---
drivers/cpufreq/mt8173-cpufreq.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/cpufreq/mt8173-cpufreq.c b/drivers/cpufreq/mt8173-cpufreq.c
index 83001dc..d00bab5 100644
--- a/drivers/cpufreq/mt8173-cpufreq.c
+++ b/drivers/cpufreq/mt8173-cpufreq.c
@@ -263,17 +263,24 @@ static int mtk_cpufreq_set_target(struct cpufreq_policy *policy,
return 0;
}
+#define DYNAMIC_POWER "dynamic-power-coefficient"
+
static void mtk_cpufreq_ready(struct cpufreq_policy *policy)
{
struct mtk_cpu_dvfs_info *info = policy->driver_data;
struct device_node *np = of_node_get(info->cpu_dev->of_node);
+ u32 capacitance = 0;
if (WARN_ON(!np))
return;
if (of_find_property(np, "#cooling-cells", NULL)) {
- info->cdev = of_cpufreq_cooling_register(np,
- policy->related_cpus);
+ of_property_read_u32(np, DYNAMIC_POWER, &capacitance);
+
+ info->cdev = of_cpufreq_power_cooling_register(np,
+ policy->related_cpus,
+ capacitance,
+ NULL);
if (IS_ERR(info->cdev)) {
dev_err(info->cpu_dev,
--
1.7.9.5
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH v5 2/3] arm64: dts: mt8173: Add thermal zone node.
2015-12-16 3:59 [PATCH v5 0/3] thermal: mediatek: Add cpu dynamic power cooling model Dawei Chien
2015-12-16 3:59 ` [PATCH v5 1/3] " Dawei Chien
@ 2015-12-16 3:59 ` Dawei Chien
2015-12-16 8:34 ` Daniel Kurtz
2015-12-16 3:59 ` [PATCH v5 3/3] arm64: dts: mt8173: Add dynamic power node Dawei Chien
2015-12-16 4:14 ` [PATCH v5 0/3] thermal: mediatek: Add cpu dynamic power cooling model Viresh Kumar
3 siblings, 1 reply; 9+ messages in thread
From: Dawei Chien @ 2015-12-16 3:59 UTC (permalink / raw)
To: Viresh Kumar
Cc: Rafael J. Wysocki, Rob Herring, Pawel Moll, Mark Rutland,
Ian Campbell, Kumar Gala, Matthias Brugger, Daniel Kurtz,
Sascha Hauer, Daniel Lezcano, Dawei Chien, devicetree,
linux-arm-kernel, linux-kernel, linux-pm, linux-mediatek,
srv_heupstream, Sascha Hauer, Punit Agrawal
This adds thermal zone node to Mediatek MT8173 dtsi file.
Signed-off-by: Dawei Chien <dawei.chien@mediatek.com>
---
This patch is base on patchset:
https://lkml.org/lkml/2015/11/30/239
---
arch/arm64/boot/dts/mediatek/mt8173.dtsi | 43 ++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
index fda805d..4114cee 100644
--- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
@@ -188,6 +188,49 @@
clock-output-names = "cpum_ck";
};
+ thermal-zones {
+ cpu_thermal: cpu_thermal {
+ polling-delay-passive = <1000>; /* milliseconds */
+ polling-delay = <1000>; /* milliseconds */
+
+ thermal-sensors = <&thermal 0>;
+ sustainable-power = <1500>; /* milliwatts */
+
+ trips {
+ threshold: trip-point@0 {
+ temperature = <68000>;
+ hysteresis = <2000>;
+ type = "passive";
+ };
+
+ target: trip-point@1 {
+ temperature = <85000>;
+ hysteresis = <2000>;
+ type = "passive";
+ };
+
+ cpu_crit: cpu_crit@0 {
+ temperature = <115000>;
+ hysteresis = <2000>;
+ type = "critical";
+ };
+ };
+
+ cooling-maps {
+ map@0 {
+ trip = <&target>;
+ cooling-device = <&cpu0 0 0>;
+ contribution = <1024>;
+ };
+ map@1 {
+ trip = <&target>;
+ cooling-device = <&cpu2 0 0>;
+ contribution = <2048>;
+ };
+ };
+ };
+ };
+
timer {
compatible = "arm,armv8-timer";
interrupt-parent = <&gic>;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH v5 2/3] arm64: dts: mt8173: Add thermal zone node.
2015-12-16 3:59 ` [PATCH v5 2/3] arm64: dts: mt8173: Add thermal zone node Dawei Chien
@ 2015-12-16 8:34 ` Daniel Kurtz
2015-12-16 10:09 ` dawei chien
0 siblings, 1 reply; 9+ messages in thread
From: Daniel Kurtz @ 2015-12-16 8:34 UTC (permalink / raw)
To: Dawei Chien
Cc: Viresh Kumar, Rafael J. Wysocki, Rob Herring, Pawel Moll,
Mark Rutland, Ian Campbell, Kumar Gala, Matthias Brugger,
Sascha Hauer, Daniel Lezcano, open list:OPEN FIRMWARE AND...,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-pm, linux-mediatek,
srv_heupstream, Sascha Hauer, Punit Agrawal
On Wed, Dec 16, 2015 at 11:59 AM, Dawei Chien <dawei.chien@mediatek.com> wrote:
>
> This adds thermal zone node to Mediatek MT8173 dtsi file.
>
> Signed-off-by: Dawei Chien <dawei.chien@mediatek.com>
> ---
> This patch is base on patchset:
> https://lkml.org/lkml/2015/11/30/239
> ---
> arch/arm64/boot/dts/mediatek/mt8173.dtsi | 43 ++++++++++++++++++++++++++++++
> 1 file changed, 43 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
> index fda805d..4114cee 100644
> --- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi
> +++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
> @@ -188,6 +188,49 @@
> clock-output-names = "cpum_ck";
> };
>
> + thermal-zones {
> + cpu_thermal: cpu_thermal {
> + polling-delay-passive = <1000>; /* milliseconds */
> + polling-delay = <1000>; /* milliseconds */
> +
> + thermal-sensors = <&thermal 0>;
This should be <&thermal> with the MTK temp sensor node in
https://lkml.org/lkml/2015/11/30/239 patch series.
-Dan
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH v5 2/3] arm64: dts: mt8173: Add thermal zone node.
2015-12-16 8:34 ` Daniel Kurtz
@ 2015-12-16 10:09 ` dawei chien
2015-12-16 11:22 ` Daniel Kurtz
0 siblings, 1 reply; 9+ messages in thread
From: dawei chien @ 2015-12-16 10:09 UTC (permalink / raw)
To: Daniel Kurtz
Cc: Viresh Kumar, Rafael J. Wysocki, Rob Herring, Pawel Moll,
Mark Rutland, Ian Campbell, Kumar Gala, Matthias Brugger,
Sascha Hauer, Daniel Lezcano, open list:OPEN FIRMWARE AND...,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-pm, linux-mediatek,
srv_heupstream, Sascha Hauer, Punit Agrawal
On Wed, 2015-12-16 at 16:34 +0800, Daniel Kurtz wrote:
> On Wed, Dec 16, 2015 at 11:59 AM, Dawei Chien <dawei.chien@mediatek.com> wrote:
> >
> > This adds thermal zone node to Mediatek MT8173 dtsi file.
> >
> > Signed-off-by: Dawei Chien <dawei.chien@mediatek.com>
> > ---
> > This patch is base on patchset:
> > https://lkml.org/lkml/2015/11/30/239
> > ---
> > arch/arm64/boot/dts/mediatek/mt8173.dtsi | 43 ++++++++++++++++++++++++++++++
> > 1 file changed, 43 insertions(+)
> >
> > diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
> > index fda805d..4114cee 100644
> > --- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi
> > +++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
> > @@ -188,6 +188,49 @@
> > clock-output-names = "cpum_ck";
> > };
> >
> > + thermal-zones {
> > + cpu_thermal: cpu_thermal {
> > + polling-delay-passive = <1000>; /* milliseconds */
> > + polling-delay = <1000>; /* milliseconds */
> > +
> > + thermal-sensors = <&thermal 0>;
>
> This should be <&thermal> with the MTK temp sensor node in
> https://lkml.org/lkml/2015/11/30/239 patch series.
>
> -Dan
Hi Dan,
Sascha's thermal driver V12 only register sensor id as 0, so we need to
register sensor id as 0 to device tree as well.
Either <&thermal 0> or <&thermal>, sensor id should be 0 for two cases.
I try this two case, function all work fine for two cases. May I have
any misunderstand? Please kindly give your comment.
I will re-send this patch again once you tell me the reason, thank you.
BR,
Dawei
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH v5 2/3] arm64: dts: mt8173: Add thermal zone node.
2015-12-16 10:09 ` dawei chien
@ 2015-12-16 11:22 ` Daniel Kurtz
2015-12-16 12:12 ` dawei chien
0 siblings, 1 reply; 9+ messages in thread
From: Daniel Kurtz @ 2015-12-16 11:22 UTC (permalink / raw)
To: dawei chien
Cc: Viresh Kumar, Rafael J. Wysocki, Rob Herring, Pawel Moll,
Mark Rutland, Ian Campbell, Kumar Gala, Matthias Brugger,
Sascha Hauer, Daniel Lezcano, open list:OPEN FIRMWARE AND...,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-pm, linux-mediatek,
srv_heupstream, Sascha Hauer, Punit Agrawal
On Wed, Dec 16, 2015 at 6:09 PM, dawei chien <dawei.chien@mediatek.com> wrote:
> On Wed, 2015-12-16 at 16:34 +0800, Daniel Kurtz wrote:
>> On Wed, Dec 16, 2015 at 11:59 AM, Dawei Chien <dawei.chien@mediatek.com> wrote:
>> >
>> > This adds thermal zone node to Mediatek MT8173 dtsi file.
>> >
>> > Signed-off-by: Dawei Chien <dawei.chien@mediatek.com>
>> > ---
>> > This patch is base on patchset:
>> > https://lkml.org/lkml/2015/11/30/239
>> > ---
>> > arch/arm64/boot/dts/mediatek/mt8173.dtsi | 43 ++++++++++++++++++++++++++++++
>> > 1 file changed, 43 insertions(+)
>> >
>> > diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
>> > index fda805d..4114cee 100644
>> > --- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi
>> > +++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
>> > @@ -188,6 +188,49 @@
>> > clock-output-names = "cpum_ck";
>> > };
>> >
>> > + thermal-zones {
>> > + cpu_thermal: cpu_thermal {
>> > + polling-delay-passive = <1000>; /* milliseconds */
>> > + polling-delay = <1000>; /* milliseconds */
>> > +
>> > + thermal-sensors = <&thermal 0>;
>>
>> This should be <&thermal> with the MTK temp sensor node in
>> https://lkml.org/lkml/2015/11/30/239 patch series.
>>
>> -Dan
>
> Hi Dan,
> Sascha's thermal driver V12 only register sensor id as 0, so we need to
> register sensor id as 0 to device tree as well.
>
> Either <&thermal 0> or <&thermal>, sensor id should be 0 for two cases.
> I try this two case, function all work fine for two cases. May I have
> any misunderstand? Please kindly give your comment.
> I will re-send this patch again once you tell me the reason, thank you.
In the new patchset, Sascha changed it to:
#thermal-sensor-cells = <0>;
Which means the <&thermal> phandle no longer has any arguments.
Thanks!
-Dan
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH v5 2/3] arm64: dts: mt8173: Add thermal zone node.
2015-12-16 11:22 ` Daniel Kurtz
@ 2015-12-16 12:12 ` dawei chien
0 siblings, 0 replies; 9+ messages in thread
From: dawei chien @ 2015-12-16 12:12 UTC (permalink / raw)
To: Daniel Kurtz
Cc: Viresh Kumar, Rafael J. Wysocki, Rob Herring, Pawel Moll,
Mark Rutland, Ian Campbell, Kumar Gala, Matthias Brugger,
Sascha Hauer, Daniel Lezcano, open list:OPEN FIRMWARE AND...,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-pm, linux-mediatek,
srv_heupstream, Sascha Hauer, Punit Agrawal
On Wed, 2015-12-16 at 19:22 +0800, Daniel Kurtz wrote:
> On Wed, Dec 16, 2015 at 6:09 PM, dawei chien <dawei.chien@mediatek.com> wrote:
> > On Wed, 2015-12-16 at 16:34 +0800, Daniel Kurtz wrote:
> >> On Wed, Dec 16, 2015 at 11:59 AM, Dawei Chien <dawei.chien@mediatek.com> wrote:
> >> >
> >> > This adds thermal zone node to Mediatek MT8173 dtsi file.
> >> >
> >> > Signed-off-by: Dawei Chien <dawei.chien@mediatek.com>
> >> > ---
> >> > This patch is base on patchset:
> >> > https://lkml.org/lkml/2015/11/30/239
> >> > ---
> >> > arch/arm64/boot/dts/mediatek/mt8173.dtsi | 43 ++++++++++++++++++++++++++++++
> >> > 1 file changed, 43 insertions(+)
> >> >
> >> > diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
> >> > index fda805d..4114cee 100644
> >> > --- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi
> >> > +++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
> >> > @@ -188,6 +188,49 @@
> >> > clock-output-names = "cpum_ck";
> >> > };
> >> >
> >> > + thermal-zones {
> >> > + cpu_thermal: cpu_thermal {
> >> > + polling-delay-passive = <1000>; /* milliseconds */
> >> > + polling-delay = <1000>; /* milliseconds */
> >> > +
> >> > + thermal-sensors = <&thermal 0>;
> >>
> >> This should be <&thermal> with the MTK temp sensor node in
> >> https://lkml.org/lkml/2015/11/30/239 patch series.
> >>
> >> -Dan
> >
> > Hi Dan,
> > Sascha's thermal driver V12 only register sensor id as 0, so we need to
> > register sensor id as 0 to device tree as well.
> >
> > Either <&thermal 0> or <&thermal>, sensor id should be 0 for two cases.
> > I try this two case, function all work fine for two cases. May I have
> > any misunderstand? Please kindly give your comment.
> > I will re-send this patch again once you tell me the reason, thank you.
>
> In the new patchset, Sascha changed it to:
> #thermal-sensor-cells = <0>;
>
> Which means the <&thermal> phandle no longer has any arguments.
>
> Thanks!
> -Dan
Hi Dan,
Thank you for your comment. Yes, I don't need to add sensor id since new
driver add thermal-sensor-cell as 0.
(Even I checked function OK to this patch with new patchset)
I will re-send this patch soon, thank you.
BR,
Dawei
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v5 3/3] arm64: dts: mt8173: Add dynamic power node.
2015-12-16 3:59 [PATCH v5 0/3] thermal: mediatek: Add cpu dynamic power cooling model Dawei Chien
2015-12-16 3:59 ` [PATCH v5 1/3] " Dawei Chien
2015-12-16 3:59 ` [PATCH v5 2/3] arm64: dts: mt8173: Add thermal zone node Dawei Chien
@ 2015-12-16 3:59 ` Dawei Chien
2015-12-16 4:14 ` [PATCH v5 0/3] thermal: mediatek: Add cpu dynamic power cooling model Viresh Kumar
3 siblings, 0 replies; 9+ messages in thread
From: Dawei Chien @ 2015-12-16 3:59 UTC (permalink / raw)
To: Viresh Kumar
Cc: Rafael J. Wysocki, Rob Herring, Pawel Moll, Mark Rutland,
Ian Campbell, Kumar Gala, Matthias Brugger, Daniel Kurtz,
Sascha Hauer, Daniel Lezcano, Dawei Chien, devicetree,
linux-arm-kernel, linux-kernel, linux-pm, linux-mediatek,
srv_heupstream, Sascha Hauer, Punit Agrawal
This device node is for calculating dynamic power in mW.
Since mt8173 has two clusters, there are two dynamic power
coefficient as well.
Signed-off-by: Dawei Chien <dawei.chien@mediatek.com>
---
This patch is base on patchset:
https://lkml.org/lkml/2015/11/17/251
---
arch/arm64/boot/dts/mediatek/mt8173.dtsi | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
index 4114cee..33fabe4 100644
--- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
@@ -71,6 +71,7 @@
#cooling-cells = <2>;
#cooling-min-level = <0>;
#cooling-max-level = <7>;
+ dynamic-power-coefficient = <263>;
};
cpu1: cpu@1 {
@@ -95,6 +96,7 @@
#cooling-cells = <2>;
#cooling-min-level = <0>;
#cooling-max-level = <7>;
+ dynamic-power-coefficient = <263>;
};
cpu2: cpu@100 {
@@ -119,6 +121,7 @@
#cooling-cells = <2>;
#cooling-min-level = <0>;
#cooling-max-level = <7>;
+ dynamic-power-coefficient = <530>;
};
cpu3: cpu@101 {
@@ -143,6 +146,7 @@
#cooling-cells = <2>;
#cooling-min-level = <0>;
#cooling-max-level = <7>;
+ dynamic-power-coefficient = <530>;
};
idle-states {
--
1.7.9.5
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH v5 0/3] thermal: mediatek: Add cpu dynamic power cooling model.
2015-12-16 3:59 [PATCH v5 0/3] thermal: mediatek: Add cpu dynamic power cooling model Dawei Chien
` (2 preceding siblings ...)
2015-12-16 3:59 ` [PATCH v5 3/3] arm64: dts: mt8173: Add dynamic power node Dawei Chien
@ 2015-12-16 4:14 ` Viresh Kumar
3 siblings, 0 replies; 9+ messages in thread
From: Viresh Kumar @ 2015-12-16 4:14 UTC (permalink / raw)
To: Dawei Chien
Cc: Rafael J. Wysocki, Rob Herring, Pawel Moll, Mark Rutland,
Ian Campbell, Kumar Gala, Matthias Brugger, Daniel Kurtz,
Sascha Hauer, Daniel Lezcano, devicetree, linux-arm-kernel,
linux-kernel, linux-pm, linux-mediatek, srv_heupstream,
Sascha Hauer, Punit Agrawal
On 16-12-15, 11:59, Dawei Chien wrote:
> Use Intelligent Power Allocation (IPA) technical to add dynamic power model
> for binding CPU thermal zone. The power allocator governor allocates power
> budget to control CPU temperature.
>
> Power Allocator governor is able to keep SOC temperature within a defined
> temperature range to avoid SOC overheat and keep it's performance.
> mt8173-cpufreq.c need to register its' own power model with power allocator
> thermal governor, so that power allocator governor can allocates suitable
> power budget to control CPU temperature.
>
> Binding document is refer to this patchset
> https://lkml.org/lkml/2015/11/30/239
>
> Change since V4:
> 1. Remove unnecessary error-checking for mt8173-cpufreq.c
> 2. Initializing variable capacitance with 0
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
--
viresh
^ permalink raw reply [flat|nested] 9+ messages in thread