From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755096AbbGPMDG (ORCPT ); Thu, 16 Jul 2015 08:03:06 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:44378 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751697AbbGPMDA (ORCPT ); Thu, 16 Jul 2015 08:03:00 -0400 X-AuditID: cbfee68e-f79c56d000006efb-2c-55a79d716b6f From: Chanwoo Choi To: edubezval@gmail.com, rui.zhang@intel.com, myungjoo.ham@samsung.com, kyungmin.park@samsung.com Cc: ulf.hansson@linaro.org, khilman@linaro.org, robh+dt@kernel.org, pawel.moll@arm.com, mark.rutland@arm.com, ijc+devicetree@hellion.org.uk, inki.dae@samsung.com, l.majewski@samsung.com, cw00.choi@samsung.com, kgene.kim@samsung.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: [RFC PATCH 0/2] thermal: Add generic devfreq cooling device Date: Thu, 16 Jul 2015 21:02:51 +0900 Message-id: <1437048173-23744-1-git-send-email-cw00.choi@samsung.com> X-Mailer: git-send-email 1.8.5.5 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpikeLIzCtJLcpLzFFi42JZI2JSoFs4d3moQesMdovrX56zWsw/cg5I XLnGanHu1UpGi0n3J7BY9C64ymbx9fAKRouzTW/YLd483MxocXnXHDaLz71HGC2WXr/IZHG7 cQWbxYTpa1ksWvceYbd48rCPzeL42nAHQY8189YweuycdZfdY+XyL2wei/e8ZPLYtKqTzePO tT1sHn1bVjF6fN4kF8ARxWWTkpqTWZZapG+XwJWx9M46poKZShVnunexNDAulepi5OSQEDCR mLavhRnCFpO4cG89WxcjF4eQwFJGifOPfgE5HGBF6ybGQ8SnM0os/7+YGcL5wiixeM5JNpBu NgEtif0vboDZIgLJEhtm3GcFKWIWOMwkcWvLGkaQhLCAi8T/IwfBprIIqEo8f+k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x9eagQb0piZVVqUX58UWlOavEh RlOg3ROZpUST84GpIq8k3tDYxMzI0sjc0MLI2FxJnPdkvk+okEB6YklqdmpqQWoRTB8TB6dU A6OlDaOt0yI787wGwYCKxamGjT8mvp6rZRv444od84OuFwbbJm99lZww5f2l1ey/39dz9Cxv /LJBOnz9P9Uj0h6Rkx3Nrf7Z7eZec1zUhNdJf/ev5L1zTF7sPP4sNCj588mPLT//sj4/lVi0 44+O2U3X8D619dc/Vk/mSZDoKjtSFeTt27xyVbYSS3FGoqEWc1FxIgBuHwWE3QIAAA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patchset introduce the generic devfreq cooling device for generic thermal framework. The devfreq devices are used ad cooling device to reduce the overheating temperature. This patch is based on drivers/thermal/cpu_cooling.c. The devfreq cooling device can change the ragne of the frequency table of devfreq device according to cooling level in device tree file. To verify the devfreq cooling device driver, I testd it with following platform: For example, - The Mali GPU of Exynos5433 SoC uses the devfreq framework to support the DVFS feature and Exynos5433 contains the G3D (GPU) thermal sensor. Following example explain the correlation between mali dt node and thermal sensor/zone. : thermal sensor : G3D sensor of Samsung Exynos5433 [1][2] : devfreq cooling device : Mali GPU [3] According to the temperature of g3d thermal sensor inclued in Exynos5433, devfreq cooling device can change the maximum frequency of Mali GPU. 1. In Exynos5433-based board dts file, Mali GPU dt node uses the devfreq framework to suppot the DVFS feature. Following dt node includes the both 'cooling-cells' and 'operating-points' which means the supported frequency entries: mali: mali@14AC0000 { compatible = "arm,mali-midgard"; reg = <0x14AC0000 0x5000>; interrupts = <0 282 0>, <0 283 0>, <0 281 0>; interrupt-names = "JOB", "MMU", "GPU"; clocks = <&cmu_g3d CLK_ACLK_G3D>; clock-names = "clk_mali"; power-domains = <&pd_g3d>; status = "disabled"; #cooling-cells = <2>; operating-points = < 700000 1150000 600000 1150000 550000 1125000 500000 1075000 420000 1025000 350000 1025000 266000 1000000 160000 1000000 >; }; 2. In exynos5433.dtsi, G3D thermal sensor measure the temperature of Mali GPU: tmu_g3d: tmu@10070000 { compatible = "samsung,exynos5433-tmu"; reg = <0x10070000 0x200>; interrupts = <0 99 0>; clocks = <&cmu_peris CLK_PCLK_TMU1_APBIF>, <&cmu_peris CLK_SCLK_TMU1>; clock-names = "tmu_apbif", "tmu_sclk"; #include "exynos5433-tmu-sensor-conf.dtsi" status = "disabled"; }; 3. In exynos5433-tmu.dtsi, thermal-zones includes both trip points and cooling-maps of g3d thermal sensor. Following cooling-maps show the match between each trip point and each cooling device (devfreq device of mali): thermal-zones { /* ...... */ g3d_thermal: g3d-thermal { thermal-sensors = <&tmu_g3d>; polling-delay-passive = <0>; polling-delay = <0>; trips { g3d_alert_0: g3d-alert-0 { temperature = <30000>; /* millicelsius */ hysteresis = <10000>; /* millicelsius */ type = "active"; }; g3d_alert_1: g3d-alert-1 { temperature = <40000>; /* millicelsius */ hysteresis = <10000>; /* millicelsius */ type = "active"; }; /* ...... */ }; cooling-maps { map0 { /* Set maximum frequency as 550MHz */ trip = <&g3d_alert_0>; cooling-device = <&mali 2 2>; }; map1 { /* Set maximum frequency as 420MHz */ trip = <&g3d_alert_1>; cooling-device = <&mali 4 4>; }; /* ...... */ }; }; ...... }; [1] https://git.kernel.org/cgit/linux/kernel/git/kgene/linux-samsung.git/commit/?h=v4.3-next/dt64-samsung&id=ac008f6b537703bb9a6fcc3882ca4af3331aa24f [2] https://git.kernel.org/cgit/linux/kernel/git/kgene/linux-samsung.git/commit/?h=v4.3-next/dt64-samsung&id=bcddc3a84e49ca1c646cf2081687a544a15f9218 [3] malideveloper.arm.com/downloads/drivers/TX041/r5p0-06rel0/TX041-SW-99002-r5p0-06rel0.tgz Chanwoo Choi (2): PM: devfreq: Add the prototype of update_devfreq() to export thermal: devfreq_cooling: Add generic devfreq cooling device implementaion .../devicetree/bindings/thermal/thermal.txt | 8 +- drivers/devfreq/devfreq.c | 22 +- drivers/thermal/Kconfig | 11 + drivers/thermal/Makefile | 3 + drivers/thermal/devfreq-cooling.c | 309 +++++++++++++++++++++ include/linux/devfreq-cooling.h | 80 ++++++ include/linux/devfreq.h | 7 + 7 files changed, 425 insertions(+), 15 deletions(-) create mode 100644 drivers/thermal/devfreq-cooling.c create mode 100644 include/linux/devfreq-cooling.h -- 1.8.5.5