Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1218781 > unrolled thread
| Started by | Dawei Chien <dawei.chien@mediatek.com> |
|---|---|
| First post | 2015-09-04 11:10 +0200 |
| Last post | 2015-09-08 17:50 +0200 |
| Articles | 9 — 4 participants |
Back to article view | Back to linux.kernel
thermal: mediatek: Add cpu power cooling model Dawei Chien <dawei.chien@mediatek.com> - 2015-09-04 11:10 +0200
[PATCH 1/2] thermal: mediatek: Add cpu power cooling model Dawei Chien <dawei.chien@mediatek.com> - 2015-09-04 11:10 +0200
[PATCH 2/2] arm64: dts: mt8173: Add thermal zone node for mt8173. Dawei Chien <dawei.chien@mediatek.com> - 2015-09-04 11:10 +0200
Re: [PATCH 2/2] arm64: dts: mt8173: Add thermal zone node for mt8173. Daniel Kurtz <djkurtz@chromium.org> - 2015-09-07 06:10 +0200
Re: [PATCH 2/2] arm64: dts: mt8173: Add thermal zone node for mt8173. Daniel Kurtz <djkurtz@chromium.org> - 2015-09-07 06:10 +0200
Re: [PATCH 2/2] arm64: dts: mt8173: Add thermal zone node for mt8173. dawei chien <dawei.chien@mediatek.com> - 2015-09-08 18:00 +0200
Re: thermal: mediatek: Add cpu power cooling model dawei chien <dawei.chien@mediatek.com> - 2015-09-04 12:10 +0200
Re: thermal: mediatek: Add cpu power cooling model Viresh Kumar <viresh.kumar@linaro.org> - 2015-09-07 08:10 +0200
Re: thermal: mediatek: Add cpu power cooling model dawei chien <dawei.chien@mediatek.com> - 2015-09-08 17:50 +0200
| From | Dawei Chien <dawei.chien@mediatek.com> |
|---|---|
| Date | 2015-09-04 11:10 +0200 |
| Subject | thermal: mediatek: Add cpu power cooling model |
| Message-ID | <q4Vaq-60u-19@gated-at.bofh.it> |
Use Intelligent Power Allocation (IPA) technical to add static/dynamic power model for binding CPU thermal zone. The power allocator governor allocates power budget to control CPU temperature. Dawei.Chien (2): thermal: mediatek: Add cpu power cooling model. arm64: dts: mt8173: Add thermal zone node for mt8173. arch/arm64/boot/dts/mediatek/mt8173.dtsi | 44 ++++++++++++++ drivers/cpufreq/mt8173-cpufreq.c | 97 ++++++++++++++++++++++++++---- 2 files changed, 130 insertions(+), 11 deletions(-) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Dawei Chien <dawei.chien@mediatek.com> |
|---|---|
| Date | 2015-09-04 11:10 +0200 |
| Subject | [PATCH 1/2] thermal: mediatek: Add cpu power cooling model |
| Message-ID | <q4Vaq-60u-27@gated-at.bofh.it> |
| In reply to | #1218781 |
Use Intelligent Power Allocation (IPA) technical to add
static/dynamic power model for binding CPU thermal zone.
The power allocator governor allocates power budget to control
CPU temperature.
Signed-off-by: Dawei Chien <dawei.chien@mediatek.com>
---
This patch is base on
https://patchwork.kernel.org/patch/7034601/
---
drivers/cpufreq/mt8173-cpufreq.c | 97 +++++++++++++++++++++++++++++++++-----
1 file changed, 86 insertions(+), 11 deletions(-)
diff --git a/drivers/cpufreq/mt8173-cpufreq.c b/drivers/cpufreq/mt8173-cpufreq.c
index 49caed2..9233ec5 100644
--- a/drivers/cpufreq/mt8173-cpufreq.c
+++ b/drivers/cpufreq/mt8173-cpufreq.c
@@ -28,7 +28,8 @@
#define MAX_VOLT_SHIFT (200000)
#define MAX_VOLT_LIMIT (1150000)
#define VOLT_TOL (10000)
-
+#define CAPACITANCE_CA53 (263)
+#define CAPACITANCE_CA57 (530)
/*
* The struct mtk_cpu_dvfs_info holds necessary information for doing CPU DVFS
* on each CPU power/clock domain of Mediatek SoCs. Each CPU cluster in
@@ -51,6 +52,72 @@ struct mtk_cpu_dvfs_info {
bool need_voltage_tracking;
};
+struct mtk_cpu_static_power {
+ unsigned long voltage;
+ unsigned int power;
+};
+
+/* measured by WA program. */
+static const struct mtk_cpu_static_power mtk_ca53_static_power[] = {
+ {859000, 43},
+ {908000, 52},
+ {983000, 86},
+ {1009000, 123},
+ {1028000, 138},
+ {1083000, 172},
+ {1109000, 180},
+ {1125000, 192},
+};
+
+/* measured by WA program. */
+static const struct mtk_cpu_static_power mtk_ca57_static_power[] = {
+ {828000, 72},
+ {867000, 90},
+ {927000, 156},
+ {968000, 181},
+ {1007000, 298},
+ {1049000, 435},
+ {1089000, 533},
+ {1125000, 533},
+};
+
+unsigned int mtk_cpufreq_lookup_power(const struct mtk_cpu_static_power *table,
+ unsigned int count, unsigned long voltage)
+{
+ int i;
+
+ for (i = 0; i < count; i++) {
+ if (voltage <= table[i].voltage)
+ return table[i].power;
+ }
+
+ return table[count - 1].power;
+}
+
+int mtk_cpufreq_get_static(cpumask_t *cpumask, int interval,
+ unsigned long voltage, u32 *power)
+{
+ int nr_cpus = cpumask_weight(cpumask);
+
+ *power = 0;
+
+ if (nr_cpus) {
+
+ if (cpumask_test_cpu(0, cpumask))
+ *power += mtk_cpufreq_lookup_power(
+ mtk_ca53_static_power,
+ ARRAY_SIZE(mtk_ca53_static_power),
+ voltage);
+
+ if (cpumask_test_cpu(2, cpumask))
+ *power += mtk_cpufreq_lookup_power(
+ mtk_ca57_static_power,
+ ARRAY_SIZE(mtk_ca57_static_power),
+ voltage);
+ }
+ return 0;
+}
+
static int mtk_cpufreq_voltage_tracking(struct mtk_cpu_dvfs_info *info,
int new_vproc)
{
@@ -272,15 +339,21 @@ static void mtk_cpufreq_ready(struct cpufreq_policy *policy)
return;
if (of_find_property(np, "#cooling-cells", NULL)) {
- info->cdev = of_cpufreq_cooling_register(np,
- policy->related_cpus);
-
- if (IS_ERR(info->cdev)) {
- dev_err(info->cpu_dev,
- "running cpufreq without cooling device: %ld\n",
- PTR_ERR(info->cdev));
-
- info->cdev = NULL;
+ u32 capacitance = cpumask_test_cpu(0, policy->related_cpus) ?
+ CAPACITANCE_CA53 : CAPACITANCE_CA57;
+
+ if (!info->cdev) {
+ info->cdev = of_cpufreq_power_cooling_register(np,
+ policy->related_cpus,
+ capacitance,
+ mtk_cpufreq_get_static);
+
+ if (IS_ERR(info->cdev)) {
+ dev_err(info->cpu_dev,
+ "running cpufreq without cooling device: %ld\n",
+ PTR_ERR(info->cdev));
+ info->cdev = NULL;
+ }
}
}
@@ -460,7 +533,9 @@ static int mtk_cpufreq_exit(struct cpufreq_policy *policy)
{
struct mtk_cpu_dvfs_info *info = policy->driver_data;
- cpufreq_cooling_unregister(info->cdev);
+ if (info->cdev)
+ cpufreq_cooling_unregister(info->cdev);
+
dev_pm_opp_free_cpufreq_table(info->cpu_dev, &policy->freq_table);
mtk_cpu_dvfs_info_release(info);
kfree(info);
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Dawei Chien <dawei.chien@mediatek.com> |
|---|---|
| Date | 2015-09-04 11:10 +0200 |
| Subject | [PATCH 2/2] arm64: dts: mt8173: Add thermal zone node for mt8173. |
| Message-ID | <q4Vaq-60u-29@gated-at.bofh.it> |
| In reply to | #1218781 |
Add thermal zone node to mt8173.dtsi.
Signed-off-by: Dawei Chien <dawei.chien@mediatek.com>
---
This patch is base on following patches
https://patchwork.kernel.org/patch/6969581/
https://patchwork.kernel.org/patch/6969571/
https://patchwork.kernel.org/patch/6969381/
---
arch/arm64/boot/dts/mediatek/mt8173.dtsi | 44 ++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
index 208051a..6493bfd 100644
--- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
@@ -17,6 +17,7 @@
#include <dt-bindings/power/mt8173-power.h>
#include <dt-bindings/reset-controller/mt8173-resets.h>
#include "mt8173-pinfunc.h"
+#include <dt-bindings/thermal/thermal.h>
/ {
compatible = "mediatek,mt8173";
@@ -116,6 +117,49 @@
clock-output-names = "clk32k";
};
+ thermal-zones {
+ cpu_thermal: cpu_thermal {
+ polling-delay-passive = <1000>; /* milliseconds */
+ polling-delay = <1000>; /* milliseconds */
+
+ thermal-sensors = <&thermal MT8173_THERMAL_ZONE_CA57>;
+ sustainable-power = <1500>;
+
+ 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Daniel Kurtz <djkurtz@chromium.org> |
|---|---|
| Date | 2015-09-07 06:10 +0200 |
| Subject | Re: [PATCH 2/2] arm64: dts: mt8173: Add thermal zone node for mt8173. |
| Message-ID | <q5VUJ-2P2-1@gated-at.bofh.it> |
| In reply to | #1218784 |
Hi Dawei,
On Fri, Sep 4, 2015 at 5:01 PM, Dawei Chien <dawei.chien@mediatek.com> wrote:
> Add thermal zone node to mt8173.dtsi.
>
> Signed-off-by: Dawei Chien <dawei.chien@mediatek.com>
> ---
> This patch is base on following patches
> https://patchwork.kernel.org/patch/6969581/
> https://patchwork.kernel.org/patch/6969571/
> https://patchwork.kernel.org/patch/6969381/
> ---
> arch/arm64/boot/dts/mediatek/mt8173.dtsi | 44 ++++++++++++++++++++++++++++++
> 1 file changed, 44 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
> index 208051a..6493bfd 100644
> --- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi
> +++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
> @@ -17,6 +17,7 @@
> #include <dt-bindings/power/mt8173-power.h>
> #include <dt-bindings/reset-controller/mt8173-resets.h>
> #include "mt8173-pinfunc.h"
> +#include <dt-bindings/thermal/thermal.h>
This include is not necessary, however...
>
> / {
> compatible = "mediatek,mt8173";
> @@ -116,6 +117,49 @@
> clock-output-names = "clk32k";
> };
>
> + thermal-zones {
> + cpu_thermal: cpu_thermal {
> + polling-delay-passive = <1000>; /* milliseconds */
> + polling-delay = <1000>; /* milliseconds */
> +
> + thermal-sensors = <&thermal MT8173_THERMAL_ZONE_CA57>;
this fails to compile, because MT8173_THERMAL_ZONE_CA57 is defined in:
include/dt-bindings/thermal/mt8173.h
-Dan
> + sustainable-power = <1500>;
> +
> + 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
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Daniel Kurtz <djkurtz@chromium.org> |
|---|---|
| Date | 2015-09-07 06:10 +0200 |
| Subject | Re: [PATCH 2/2] arm64: dts: mt8173: Add thermal zone node for mt8173. |
| Message-ID | <q5VUK-2P2-7@gated-at.bofh.it> |
| In reply to | #1219916 |
On Mon, Sep 7, 2015 at 12:00 PM, Daniel Kurtz <djkurtz@chromium.org> wrote: > Hi Dawei, > > On Fri, Sep 4, 2015 at 5:01 PM, Dawei Chien <dawei.chien@mediatek.com> wrote: >> Add thermal zone node to mt8173.dtsi. >> >> Signed-off-by: Dawei Chien <dawei.chien@mediatek.com> >> --- >> This patch is base on following patches >> https://patchwork.kernel.org/patch/6969581/ >> https://patchwork.kernel.org/patch/6969571/ >> https://patchwork.kernel.org/patch/6969381/ >> --- >> arch/arm64/boot/dts/mediatek/mt8173.dtsi | 44 ++++++++++++++++++++++++++++++ >> 1 file changed, 44 insertions(+) >> >> diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi b/arch/arm64/boot/dts/mediatek/mt8173.dtsi >> index 208051a..6493bfd 100644 >> --- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi >> +++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi >> @@ -17,6 +17,7 @@ >> #include <dt-bindings/power/mt8173-power.h> >> #include <dt-bindings/reset-controller/mt8173-resets.h> >> #include "mt8173-pinfunc.h" >> +#include <dt-bindings/thermal/thermal.h> Also, as a nit, (#include <dt-bindings/thermal/mt8173.h>) should be above '#include "mt8173-pinfunc.h"' -djk -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | dawei chien <dawei.chien@mediatek.com> |
|---|---|
| Date | 2015-09-08 18:00 +0200 |
| Subject | Re: [PATCH 2/2] arm64: dts: mt8173: Add thermal zone node for mt8173. |
| Message-ID | <q6tto-jn-15@gated-at.bofh.it> |
| In reply to | #1219918 |
Hi Daniel, On Mon, 2015-09-07 at 12:05 +0800, Daniel Kurtz wrote: > On Mon, Sep 7, 2015 at 12:00 PM, Daniel Kurtz <djkurtz@chromium.org> wrote: > > Hi Dawei, > > > > On Fri, Sep 4, 2015 at 5:01 PM, Dawei Chien <dawei.chien@mediatek.com> wrote: > >> Add thermal zone node to mt8173.dtsi. > >> > >> Signed-off-by: Dawei Chien <dawei.chien@mediatek.com> > >> --- > >> This patch is base on following patches > >> https://patchwork.kernel.org/patch/6969581/ > >> https://patchwork.kernel.org/patch/6969571/ > >> https://patchwork.kernel.org/patch/6969381/ > >> --- > >> arch/arm64/boot/dts/mediatek/mt8173.dtsi | 44 ++++++++++++++++++++++++++++++ > >> 1 file changed, 44 insertions(+) > >> > >> diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi b/arch/arm64/boot/dts/mediatek/mt8173.dtsi > >> index 208051a..6493bfd 100644 > >> --- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi > >> +++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi > >> @@ -17,6 +17,7 @@ > >> #include <dt-bindings/power/mt8173-power.h> > >> #include <dt-bindings/reset-controller/mt8173-resets.h> > >> #include "mt8173-pinfunc.h" > >> +#include <dt-bindings/thermal/thermal.h> > > Also, as a nit, (#include <dt-bindings/thermal/mt8173.h>) should be > above '#include "mt8173-pinfunc.h"' Thank you, I will resend this patch with mt8171.h and sort header file. > -djk -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | dawei chien <dawei.chien@mediatek.com> |
|---|---|
| Date | 2015-09-04 12:10 +0200 |
| Message-ID | <q4W6u-7nE-1@gated-at.bofh.it> |
| In reply to | #1218781 |
Sorry, forgot to add Rafael and Viresh as reviewer. On Fri, 2015-09-04 at 17:01 +0800, Dawei Chien wrote: > Use Intelligent Power Allocation (IPA) technical to add > static/dynamic power model for binding CPU thermal zone. > The power allocator governor allocates power budget to control > CPU temperature. > > Dawei.Chien (2): > thermal: mediatek: Add cpu power cooling model. > arm64: dts: mt8173: Add thermal zone node for mt8173. > > arch/arm64/boot/dts/mediatek/mt8173.dtsi | 44 ++++++++++++++ > drivers/cpufreq/mt8173-cpufreq.c | 97 ++++++++++++++++++++++++++---- > 2 files changed, 130 insertions(+), 11 deletions(-) > > -- > 1.7.9.5 > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| Date | 2015-09-07 08:10 +0200 |
| Message-ID | <q5XMS-5wH-13@gated-at.bofh.it> |
| In reply to | #1218781 |
On 04-09-15, 17:01, Dawei Chien wrote: > Use Intelligent Power Allocation (IPA) technical to add > static/dynamic power model for binding CPU thermal zone. > The power allocator governor allocates power budget to control > CPU temperature. Sorry but this isn't enough really.. I don't have time to go through the code and understand the purpose of the series. Please explain here in detail: - Why this is needed. - What/How you are doing it. (Don't resend, just reply to this email :) ) -- viresh -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | dawei chien <dawei.chien@mediatek.com> |
|---|---|
| Date | 2015-09-08 17:50 +0200 |
| Message-ID | <q6tjH-7U-9@gated-at.bofh.it> |
| In reply to | #1219944 |
Hi Viresh, On Mon, 2015-09-07 at 11:39 +0530, Viresh Kumar wrote: > On 04-09-15, 17:01, Dawei Chien wrote: > > Use Intelligent Power Allocation (IPA) technical to add > > static/dynamic power model for binding CPU thermal zone. > > The power allocator governor allocates power budget to control > > CPU temperature. > > Sorry but this isn't enough really.. I don't have time to go through > the code and understand the purpose of the series. > > Please explain here in detail: > - Why this is needed. 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. > - What/How you are doing it. Measure and create dynamic/static power model, and register cooling device of_cpufreq_power_cooling_register for MT8173. > > (Don't resend, just reply to this email :) ) > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web