From patchwork Mon Jul 30 16:56:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anson Huang X-Patchwork-Id: 10549447 X-Patchwork-Delegate: eduardo.valentin@ti.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 11ADB157D for ; Mon, 30 Jul 2018 17:00:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 015852A68F for ; Mon, 30 Jul 2018 17:00:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F38472A6B2; Mon, 30 Jul 2018 17:00:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 75A362A6C6 for ; Mon, 30 Jul 2018 17:00:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726762AbeG3Sgp (ORCPT ); Mon, 30 Jul 2018 14:36:45 -0400 Received: from mail-he1eur01on0058.outbound.protection.outlook.com ([104.47.0.58]:1367 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726668AbeG3Sgo (ORCPT ); Mon, 30 Jul 2018 14:36:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SdS880G+cmmzVJcHPwxqvCGj6lTTjzMSbCkYUcAJ010=; b=KIfo7CwwreELyvJbSa49JvQmsXdwC/qJ9RnPIa92x8T3B3epnKwGUIxLnUzGPgoYOu5ik4X76YUGpxxM+j2tku3+ZZbLyVnhYxLcT1u+BLMKc0l7BXqCdWnT8PocvCC1QsbaPgWMJSD0W3WEAmgAnSrG9fURT1JlgGjy2KMOQkM= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=anson.huang@nxp.com; Received: from anson-OptiPlex-790.ap.freescale.net (119.31.174.66) by HE1PR04MB1323.eurprd04.prod.outlook.com (2a01:111:e400:5889::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.995.17; Mon, 30 Jul 2018 17:00:43 +0000 From: Anson Huang To: rui.zhang@intel.com, edubezval@gmail.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Linux-imx@nxp.com, nitin.garg@nxp.com Subject: [PATCH] thermal: of-thermal: disable passive polling when thermal zone is disabled Date: Tue, 31 Jul 2018 00:56:49 +0800 Message-Id: <1532969809-8300-1-git-send-email-Anson.Huang@nxp.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [119.31.174.66] X-ClientProxiedBy: HK0PR04CA0018.apcprd04.prod.outlook.com (2603:1096:203:36::30) To HE1PR04MB1323.eurprd04.prod.outlook.com (2a01:111:e400:5889::13) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 34d2f37b-0488-4b54-3354-08d5f63dfe11 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020);SRVR:HE1PR04MB1323; X-Microsoft-Exchange-Diagnostics: 1;HE1PR04MB1323;3:EqHTq0S0TzTJHvr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jcVJcFgkfXCDwsNEAXP91bQZQsxSz6wy3RWw95utDfaMbZx+hxbHfSe663HmEDjEUzTshpKdxVQfW58fWz+6dFGz7WH8tgMyhe2DCfdaGK8AT9u8VjBedd87MJ02gpvCTNeWdHbraLNsUXCgAAc/SJ+n9Ub+rXqqn74Iner0pbPf6s7rLoL1/Uj27jU6wB265aps1RWcrul+Ca6TyImfY0lTdio3SDXkqthDbTcBfNALfws67QcueGpWia2OD7samCCcmGq68GuZaXQtrx2rv03eXCFGpJxzvDdh5QZdAHpTwmL5qIep/skSNX+;4:OaPi9atHtoW0SrAGkfq0B0NTM8dp6lKfQxYMcoXWM4zWsJS4W85vC3nI8uKIcfB+o3bI2QhaFCb3L/b5WB5+PFI9y16B2yIP4oJG41ccEIggIUogNRKjoFGcMijNCp4lZ1IKqqARYyKYZa9Vx6uEZOC88KTY/NS743zlqyL7DWe06+sP7iUiEfNC4gBjiJq5s/yqz/X5OLJ+8nQoe3NSqJBgZdL0Rf8vEItEX2asuZ5nB5Ril7rZ8lcuOaoGo5B8p01Qz2BfRltDstIfJu0fRB/Yjl9ZQIbgOx0+sYFWzFYFMXLRIpQq5G2JHB6uWfGZ X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231311)(944501410)(52105095)(3002001)(10201501046)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(20161123562045)(20161123564045)(6072148)(201708071742011)(7699016);SRVR:HE1PR04MB1323;BCL:0;PCL:0;RULEID:;SRVR:HE1PR04MB1323; X-Forefront-PRVS: 0749DC2CE6 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(39860400002)(136003)(366004)(346002)(376002)(396003)(189003)(199004)(36756003)(47776003)(68736007)(2906002)(50226002)(86362001)(48376002)(6506007)(386003)(97736004)(16586007)(106356001)(50466002)(14444005)(52116002)(8936002)(26005)(486006)(81166006)(81156014)(1857600001)(53936002)(4326008)(316002)(39060400002)(51416003)(25786009)(478600001)(5660300001)(6116002)(3846002)(66066001)(956004)(8676002)(2616005)(7736002)(105586002)(16526019)(476003)(6486002)(305945005)(6512007)(186003);DIR:OUT;SFP:1101;SCL:1;SRVR:HE1PR04MB1323;H:anson-OptiPlex-790.ap.freescale.net;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: 1;HE1PR04MB1323;23:rtZtP7kdd6HA3TdyJUCVfNmXpY/ZB+G4pQyQzH1McgA8Acvgj7Moiw5Mxq4eF2IXujWwLIA5AiVZ0xC7byU4coqhH6p5b693UuyH8kZL3KlOFF3+VIdzq8Ef0d6cACVxb0tDbdTpCgg8SpbecJ3EMIOo5oYSArNdtPLReaIZgd6IYENUi5qmqnNe7FK/7MZzJQ/xJ8NO6+vzei6Aa1ZSz9MC21nWStx2LAAdQ8erIhgGqergiBCCO+utGPKhCycbrVPwdYUeNVttFC7YFkrUoYkHnBpc94IOfJuY0laCQySyyFX8ReZ9aq7qEMS/Ll+C+Zh3SBg7HZjo4rPOP6c8lP3Ix4LKhCvFHk3LgRkx4TISDR+f/cGiFOn643uLH339cbGHF87WPhxKAVDcCWTPGTsWeaTxZ7+14l9s0iMMRd47HRomv6p5pSYeLlK5lFpZKsFdNqbDndKn1DWPXDSXlkqPMRszDxaVtvW52w6x/wYnCeRPU8JBj5RBU6yXeoHhHaaQ3bA4B+teTI7NJvBgXAOLQrkZYA9LY0RTXFNYOxyb/AcpSYry0G5dKNakRMOtmRuexflvJw4W4ThxNTXHrn3FpHT5pPVCjtP/8fxKvovFK4QEqeJ9wXCxdTa89jKfp/VBU3Cn8jDiE1rgesyglXRDP84x923fc2DPQC2UesQL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KCtHHHPdouXf8zEYlU5KgGM+7LlNSY5Yj/DeFifEhEzNOEBrAJUYLjgrhxOSAFPCvFVqZCEO3i5pBJSAYMFOueuBhXMtWThUt8uFExBEcbJq+HAB6DbzcaFAYxMbq62U7+8CavbV1vzm51fXWXz0TvA2bVBRGtHtPoJG5IApZDwNAlGOu3uz6OXucCNqn9ehW4x+dmtMEVgf080yuULOC1ggatq3mkykGiCYbNbrijHAqmS7r/kB0n1Yd0WvTBvM3QIss0LotpLVgV5BV5QK8VnZfoTn0w==;5:fQsQD2JRfLcNM0qOxKH6X96j118T04OfcX/jSTfZB1GxzyvA2uoK5An1QFKyHor1a1dDO1jymKi2mVGfWjpmqp+VdT++lElE0mLVegqGCfdH2yAfb5NlY5ZpMhIC7AbX0MWWpG53qJ7oXhlxkd3bVg8tMDC6jyNJHVBVJaTtTIc=;7:ohun7d0vPSM6TBcXg9ey9GjaF2NbXWUpiEdmTdRqK/lmYmT3dewGh5IVVKzxfXrq0Coe7WVf/TU80rKmPezxKxwWnqNC49lj8X9wHUB3gPD9JBO2s92p9LBMGJ9RHt9rqdvsLyLbcmfwQLmXZc7NzBa2CTS5Smz+E79UptU8ET7ES2fGFmMFRT6mR582GzAxPqgKe1sbZUhvT+w4UFVARp47aAk9Ze1s2DdBNHanvzWk4dYYG6CE5aCIMFdnorq6 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2018 17:00:43.3869 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 34d2f37b-0488-4b54-3354-08d5f63dfe11 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR04MB1323 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When thermal zone is in passive mode, disabling its mode from sysfs is NOT taking effect at all, it is still polling the temperature of the disabled thermal zone and handling all thermal trips, it makes user confused. The disabling operation should disable the thermal zone behavior completely, for both active and passive mode, this patch clears the passive_delay when thermal zone is disabled and restores it when it is enabled. Signed-off-by: Anson Huang --- drivers/thermal/of-thermal.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c index 977a830..4f28165 100644 --- a/drivers/thermal/of-thermal.c +++ b/drivers/thermal/of-thermal.c @@ -260,10 +260,13 @@ static int of_thermal_set_mode(struct thermal_zone_device *tz, mutex_lock(&tz->lock); - if (mode == THERMAL_DEVICE_ENABLED) + if (mode == THERMAL_DEVICE_ENABLED) { tz->polling_delay = data->polling_delay; - else + tz->passive_delay = data->passive_delay; + } else { tz->polling_delay = 0; + tz->passive_delay = 0; + } mutex_unlock(&tz->lock);