From patchwork Wed Feb 24 04:11:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srikar Srimath Tirumala X-Patchwork-Id: 8399161 X-Patchwork-Delegate: rui.zhang@intel.com Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1B7E49F372 for ; Wed, 24 Feb 2016 04:12:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4C2812035B for ; Wed, 24 Feb 2016 04:12:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 69C3B202E9 for ; Wed, 24 Feb 2016 04:12:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756562AbcBXEMF (ORCPT ); Tue, 23 Feb 2016 23:12:05 -0500 Received: from hqemgate15.nvidia.com ([216.228.121.64]:1296 "EHLO hqemgate15.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756355AbcBXEMD (ORCPT ); Tue, 23 Feb 2016 23:12:03 -0500 Received: from hqnvupgp08.nvidia.com (Not Verified[216.228.121.13]) by hqemgate15.nvidia.com id ; Tue, 23 Feb 2016 20:11:46 -0800 Received: from hqemhub02.nvidia.com ([172.20.12.94]) by hqnvupgp08.nvidia.com (PGP Universal service); Tue, 23 Feb 2016 20:11:53 -0800 X-PGP-Universal: processed; by hqnvupgp08.nvidia.com on Tue, 23 Feb 2016 20:11:53 -0800 Received: from srikars-mint.nvidia.com (172.20.144.16) by hqemhub02.nvidia.com (172.20.150.31) with Microsoft SMTP Server id 8.3.406.0; Tue, 23 Feb 2016 20:11:56 -0800 From: Srikar Srimath Tirumala To: srikars@nvidia.com, linux-pm@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC][PATCH] thermal: add sysfs_notify on some attributes Date: Tue, 23 Feb 2016 20:11:58 -0800 Message-ID: <1456287118-32510-1-git-send-email-srikars@nvidia.com> X-Mailer: git-send-email 2.1.4 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, 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 Add a sysfs_notify on thermal_zone*/temp and cooling_device*/ cur_state whenever a passive or critical trip is triggered. This change allows usermode apps to register itself to get notified, when certain thermal conditions occur and reduce their workload. This workload throttling can reduce\prevent throttling of hardware clocks while allowing some other critical apps to run longer reliably. Signed-off-by: Srikar Srimath Tirumala --- drivers/thermal/thermal_core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index a0a8fd1..d8d257d 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -567,6 +567,8 @@ void thermal_zone_device_update(struct thermal_zone_device *tz) for (count = 0; count < tz->trips; count++) handle_thermal_trip(tz, count); + + sysfs_notify(&tz->device.kobj, NULL, "temp"); } EXPORT_SYMBOL_GPL(thermal_zone_device_update); @@ -1638,6 +1640,7 @@ void thermal_cdev_update(struct thermal_cooling_device *cdev) cdev->updated = true; trace_cdev_update(cdev, target); dev_dbg(&cdev->device, "set to state %lu\n", target); + sysfs_notify(&cdev->device.kobj, NULL, "cur_state"); } EXPORT_SYMBOL(thermal_cdev_update);