From patchwork Fri Sep 21 06:57:17 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongbo Zhang X-Patchwork-Id: 11621 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id D20E319D196 for ; Fri, 21 Sep 2012 06:58:01 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id 85C03A18B21 for ; Fri, 21 Sep 2012 06:58:01 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so4198293iej.11 for ; Thu, 20 Sep 2012 23:58:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=ftHDmuHR/l9bxdWstnksxXlS2A3z84siB9kssBEJhws=; b=DSIrinBAQOjU0TMoc0o87JobjKA0pO4vrO0uuiB/xbxiYucn85aCUX5l02h+lPsOE5 cKSQq9+/MgsVFAY0klV3v0x9CunAIGwFc2KwFMXG1fhoc5DUql8+0WHXm5hfeBokCh1i homlKuG30PC0Oxxglbjr5WiUZ1zjF0W55JH68PoQ3qKG9hpIrw4A8Y70iccTF9+la5o4 xgN58kS7yQbRdUQE5RKrEGylFQvh1CEJAmTbsVwPBZ5hHwLH2TxBlwzAB2MSdML2JTMK oZUooYP6LXqQSncx12lT5B55lg1Wi7PqLiquFN/qtIO0SfjbNSDIIoaPrGvCjrP8w5Xj xhCA== Received: by 10.50.217.227 with SMTP id pb3mr836267igc.28.1348210681270; Thu, 20 Sep 2012 23:58:01 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.184.232 with SMTP id ex8csp114869igc; Thu, 20 Sep 2012 23:58:00 -0700 (PDT) Received: by 10.68.204.169 with SMTP id kz9mr13044751pbc.39.1348210680577; Thu, 20 Sep 2012 23:58:00 -0700 (PDT) Received: from mail-pb0-f50.google.com (mail-pb0-f50.google.com [209.85.160.50]) by mx.google.com with ESMTPS id si9si10569455pbc.302.2012.09.20.23.58.00 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 20 Sep 2012 23:58:00 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of hongbo.zhang@linaro.org) client-ip=209.85.160.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of hongbo.zhang@linaro.org) smtp.mail=hongbo.zhang@linaro.org Received: by mail-pb0-f50.google.com with SMTP id md12so7386004pbc.37 for ; Thu, 20 Sep 2012 23:58:00 -0700 (PDT) Received: by 10.68.242.10 with SMTP id wm10mr12988943pbc.61.1348210680240; Thu, 20 Sep 2012 23:58:00 -0700 (PDT) Received: from stebjsxu0064.bjs.st.com ([117.136.0.224]) by mx.google.com with ESMTPS id c5sm3687340pay.5.2012.09.20.23.57.54 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 20 Sep 2012 23:57:59 -0700 (PDT) From: zhanghongbo To: linux-pm@vger.kernel.org, len.brown@intel.com, rui.zhang@intel.com Cc: patches@linaro.org, linaro-dev@lists.linaro.org, "hongbo.zhang" Subject: [PATCH 1/2] Thermal: Add interface to deactive cooling devices. Date: Fri, 21 Sep 2012 14:57:17 +0800 Message-Id: <1348210638-4746-2-git-send-email-hongbo.zhang@linaro.org> X-Mailer: git-send-email 1.7.11.3 In-Reply-To: <1348210638-4746-1-git-send-email-hongbo.zhang@linaro.org> References: <1348210638-4746-1-git-send-email-hongbo.zhang@linaro.org> X-Gm-Message-State: ALoCoQnVlYsjuUHue3VEKRMPMLrpeznPQZxMX2Ou5AETZaXH20UwXoybNvx1nk7bEGX1hZaGdyEd From: "hongbo.zhang" If the thermal zone mode is disabled, all the referenced cooling devices should be put into state zero. Without this patch the thermal driver cannot deactive all its cooling devices in .set_mode callback, because the cooling device list is maintained in the generic thermal layer. This interface is introduced to fix it. Signed-off-by: hongbo.zhang --- drivers/thermal/thermal_sys.c | 22 ++++++++++++++++++++++ include/linux/thermal.h | 1 + 2 files changed, 23 insertions(+) diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c index 2ab31e4..2c28c85 100644 --- a/drivers/thermal/thermal_sys.c +++ b/drivers/thermal/thermal_sys.c @@ -1130,6 +1130,28 @@ leave: EXPORT_SYMBOL(thermal_zone_device_update); /** + * thermal_zone_device_deactive - deactive cooling devices of thermal zone + * @tz: thermal zone device + * + * This function should be called in the thermal zone device .set_mode + * callback when the thermal zone is disabled. + */ +void thermal_zone_device_deactive(struct thermal_zone_device *tz) +{ + struct thermal_cooling_device_instance *instance; + struct thermal_cooling_device *cdev; + + mutex_lock(&tz->lock); + list_for_each_entry(instance, &tz->cooling_devices, node) { + cdev = instance->cdev; + if (cdev->ops->set_cur_state) + cdev->ops->set_cur_state(cdev, 0); + } + mutex_unlock(&tz->lock); +} +EXPORT_SYMBOL(thermal_zone_device_deactive); + +/** * create_trip_attrs - create attributes for trip points * @tz: the thermal zone device * @mask: Writeable trip point bitmap. diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 4b94a61..5e915a3 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -161,6 +161,7 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *, int, int thermal_zone_unbind_cooling_device(struct thermal_zone_device *, int, struct thermal_cooling_device *); void thermal_zone_device_update(struct thermal_zone_device *); +void thermal_zone_device_deactive(struct thermal_zone_device *); struct thermal_cooling_device *thermal_cooling_device_register(char *, void *, const struct thermal_cooling_device_ops *); void thermal_cooling_device_unregister(struct thermal_cooling_device *);