From patchwork Thu Nov 27 01:16:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: navneet kumar X-Patchwork-Id: 5390931 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: X-Original-To: patchwork-linux-pm@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 488B6C11AC for ; Thu, 27 Nov 2014 01:16:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 44B30201F4 for ; Thu, 27 Nov 2014 01:16:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B4AB720108 for ; Thu, 27 Nov 2014 01:16:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751378AbaK0BQv (ORCPT ); Wed, 26 Nov 2014 20:16:51 -0500 Received: from hqemgate15.nvidia.com ([216.228.121.64]:6623 "EHLO hqemgate15.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751134AbaK0BQv (ORCPT ); Wed, 26 Nov 2014 20:16:51 -0500 Received: from hqnvupgp08.nvidia.com (Not Verified[216.228.121.13]) by hqemgate15.nvidia.com id ; Wed, 26 Nov 2014 17:15:56 -0800 Received: from hqemhub03.nvidia.com ([172.20.12.94]) by hqnvupgp08.nvidia.com (PGP Universal service); Wed, 26 Nov 2014 17:15:04 -0800 X-PGP-Universal: processed; by hqnvupgp08.nvidia.com on Wed, 26 Nov 2014 17:15:04 -0800 Received: from navneetk-ASUS.nvidia.com (172.20.144.16) by hqemhub03.nvidia.com (172.20.150.15) with Microsoft SMTP Server (TLS) id 8.3.342.0; Wed, 26 Nov 2014 17:16:50 -0800 From: Navneet Kumar To: , CC: , , navneet kumar , Diwakar Tundlam Subject: [PATCH 1/3] thermal: of: support writable trips via dt Date: Wed, 26 Nov 2014 17:16:27 -0800 Message-ID: <1417050989-25405-1-git-send-email-navneetk@nvidia.com> X-Mailer: git-send-email 1.8.1.5 X-NVConfidentiality: public MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 From: navneet kumar Support writable trip points configuration from the device tree. 'OF' reads this configuration and adjusts the 'trips' mask accordingly to allow the 'set_trip_xxx' calls to be effective. Signed-off-by: Diwakar Tundlam --- drivers/thermal/of-thermal.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c index 62143ba31001..cf9ee3e82fee 100644 --- a/drivers/thermal/of-thermal.c +++ b/drivers/thermal/of-thermal.c @@ -604,7 +604,8 @@ static int thermal_of_get_trip_type(struct device_node *np, * Return: 0 on success, proper error code otherwise */ static int thermal_of_populate_trip(struct device_node *np, - struct __thermal_trip *trip) + struct __thermal_trip *trip, + bool *trip_writable) { int prop; int ret; @@ -629,6 +630,8 @@ static int thermal_of_populate_trip(struct device_node *np, return ret; } + *trip_writable = of_property_read_bool(np, "writable"); + /* Required for cooling map matching */ trip->np = np; of_node_get(np); @@ -657,6 +660,8 @@ thermal_of_build_thermal_zone(struct device_node *np) struct __thermal_zone *tz; int ret, i; u32 prop; + bool trip_writable; + u64 m = 0; if (!np) { pr_err("no thermal zone np\n"); @@ -700,9 +705,14 @@ thermal_of_build_thermal_zone(struct device_node *np) i = 0; for_each_child_of_node(child, gchild) { - ret = thermal_of_populate_trip(gchild, &tz->trips[i++]); + trip_writable = false; + ret = thermal_of_populate_trip(gchild, &tz->trips[i], + &trip_writable); if (ret) goto free_trips; + if (trip_writable) + m |= 1ULL << i; + i++; } of_node_put(child);