From patchwork Thu Oct 9 16:38:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 5059791 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D7207C11AC for ; Thu, 9 Oct 2014 16:44:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DADFC20200 for ; Thu, 9 Oct 2014 16:44:03 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 07E28201FE for ; Thu, 9 Oct 2014 16:44:03 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XcGmQ-0004sB-Sf; Thu, 09 Oct 2014 16:41:30 +0000 Received: from mailout2.samsung.com ([203.254.224.25]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XcGkd-0002kq-Dh for linux-arm-kernel@lists.infradead.org; Thu, 09 Oct 2014 16:39:40 +0000 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0ND600K8ORLKRG50@mailout2.samsung.com> for linux-arm-kernel@lists.infradead.org; Fri, 10 Oct 2014 01:39:20 +0900 (KST) X-AuditID: cbfee61a-f79c06d000004e71-2e-5436ba37e7c7 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 73.CD.20081.73AB6345; Fri, 10 Oct 2014 01:39:20 +0900 (KST) Received: from mcdsrvbld02.digital.local ([106.116.37.23]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0ND600M6SRKZPK30@mmp2.samsung.com>; Fri, 10 Oct 2014 01:39:19 +0900 (KST) From: Lukasz Majewski To: Eduardo Valentin , Zhang Rui Subject: [PATCH 03/21] thermal: of: Extend of-thermal.c to provide number of non critical trip points Date: Thu, 09 Oct 2014 18:38:39 +0200 Message-id: <1412872737-624-4-git-send-email-l.majewski@samsung.com> X-Mailer: git-send-email 1.7.10.4 In-reply-to: <1412872737-624-1-git-send-email-l.majewski@samsung.com> References: <1412872737-624-1-git-send-email-l.majewski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrHLMWRmVeSWpSXmKPExsVy+t9jQV2LXWYhBrfns1s0XA2x2DhjPavF 9S/PWS3mX7nGatG74CqbxdmmN+wWbx5xW7x5uJnRYtNjoPjn3iOMFjPO72OyePKwj82Bx2Pn rLvsHov3vGTy2Lyk3mPdtLfMHn1bVjF6fN4kF8AWxWWTkpqTWZZapG+XwJWxv7mTtWA3X0Xr /C+sDYzzeLoYOTkkBEwkzh7Ywg5hi0lcuLeerYuRi0NIYDqjxIvtBxkhnC4miZt3NzOBVLEJ 6El8vvsUzBYR8JZ4vW86WBGzwFVmicu7V7KCJIQF0iUmXv4CNIqDg0VAVWLLCh0Qk1fAReLC pECIZYoS3c8msIHYnAKuEk8fr2YGsYWASm4/esk+gZF3ASPDKkbR1ILkguKk9FxDveLE3OLS vHS95PzcTYzgUHwmtYNxZYPFIUYBDkYlHt4H/0xDhFgTy4orcw8xSnAwK4nwbp9pFiLEm5JY WZValB9fVJqTWnyIUZqDRUmc90CrdaCQQHpiSWp2ampBahFMlomDU6qBsS8uYFWxQNWrTOUP qpdX6offvzhZzcIx6EUOc0y4xdqlV10ueq/b2DxH/eGfrL3J3WVCO9sPn1UzfO1c9/WJXNfW t/adT3LeNW7bPztR3Mt8Cce9J37fcjf8yxW/8Nlm9kfX4y9W7j9ToR4eMM/pw/3N4X6/Qq88 cypc/2ur7LQfquFvFxqueKLEUpyRaKjFXFScCAAF5jAnQQIAAA== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141009_093939_653027_B9F57A38 X-CRM114-Status: GOOD ( 11.07 ) X-Spam-Score: -5.0 (-----) Cc: Lukasz Majewski , Kukjin Kim , Bartlomiej Zolnierkiewicz , Lukasz Majewski , Linux PM list , Kyungmin Park , Chanwoo Choi , Amit Daniel Kachhap , "linux-samsung-soc@vger.kernel.org" , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch extends the of-thermal.c to provide information about number of available non critical (i.e. non HW) trip points in the system. Signed-off-by: Lukasz Majewski --- drivers/thermal/of-thermal.c | 12 ++++++++++++ drivers/thermal/thermal_core.h | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c index 23c8d6c..cd74e64 100644 --- a/drivers/thermal/of-thermal.c +++ b/drivers/thermal/of-thermal.c @@ -128,6 +128,18 @@ int of_thermal_is_trip_en(struct thermal_zone_device *tz, int trip) return 1; } +int of_thermal_get_non_crit_ntrips(struct thermal_zone_device *tz) +{ + struct __thermal_zone *data = tz->devdata; + int i; + + for (i = 0; i < data->ntrips; i++) + if (data->trips[i].type != THERMAL_TRIP_CRITICAL) + continue; + + return --i; +} + static int of_thermal_get_trend(struct thermal_zone_device *tz, int trip, enum thermal_trend *trend) { diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h index ed8ff05..334a7be 100644 --- a/drivers/thermal/thermal_core.h +++ b/drivers/thermal/thermal_core.h @@ -83,6 +83,7 @@ int of_parse_thermal_zones(void); void of_thermal_destroy_zones(void); int of_thermal_get_ntrips(struct thermal_zone_device *); int of_thermal_is_trip_en(struct thermal_zone_device *, int); +int of_thermal_get_non_crit_ntrips(struct thermal_zone_device *); #else static inline int of_parse_thermal_zones(void) { return 0; } static inline void of_thermal_destroy_zones(void) { } @@ -94,6 +95,10 @@ int of_thermal_is_trip_en(struct thermal_zone_device *, int) { return 0; } +int of_thermal_get_non_crit_ntrips(struct thermal_zone_device *) +{ + return 0; +} #endif #endif /* __THERMAL_CORE_H__ */