From patchwork Thu May 8 14:37:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kachhap X-Patchwork-Id: 4136851 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 2221C9F1E1 for ; Thu, 8 May 2014 14:40:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4A5DA202AE for ; Thu, 8 May 2014 14:40:51 +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 7BEA020270 for ; Thu, 8 May 2014 14:40:50 +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 1WiPTI-0001Oc-3Q; Thu, 08 May 2014 14:38:52 +0000 Received: from mail-pd0-x22b.google.com ([2607:f8b0:400e:c02::22b]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WiPSq-00012s-Nb for linux-arm-kernel@lists.infradead.org; Thu, 08 May 2014 14:38:25 +0000 Received: by mail-pd0-f171.google.com with SMTP id r10so2425847pdi.30 for ; Thu, 08 May 2014 07:38:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=KoYaDmAIbAcKlIaKSU+hnuqZd0tMOgfAEF76V5iuyoM=; b=dsNDiVRxRgNhS/NpGGNO/v82JW6cjrJD0S/DswIu6hure82Ry7DQ9aIKcNw2mJ6DWf Z1X50E9+PsHmBnJ0vUTWVPIjyrlObwH+uCDEGezJ7v73cM85nGnUuHym9z5mmpM051Ag iD5+KQPrcOflHX4Gn7cZEsxi8Hxx0jZy1WeHHE2XVi2TY2EMJNGHHMDADsQHid+LupqX JwkC7RZakY1QeJhnC72CgCGIH3O/tmWKRbqdHGPYYfBj62U0xXYUGzJDZjvtQqHrsEzt jMuEn9wM0FbvveGh3ANexO2lgO6MnJo6c1KpzxM0zmyNbQ58asR96ofTmoJVXkVSw51x MHYQ== X-Received: by 10.66.246.229 with SMTP id xz5mr8165300pac.119.1399559883313; Thu, 08 May 2014 07:38:03 -0700 (PDT) Received: from localhost.localdomain ([14.140.216.146]) by mx.google.com with ESMTPSA id vf9sm2357141pbc.94.2014.05.08.07.37.59 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 08 May 2014 07:38:02 -0700 (PDT) From: Amit Daniel Kachhap To: linux-pm@lists.linux-foundation.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-acpi@vger.kernel.org Subject: [RFC PATCH 4/5] thermal: cpu_cooling: Release the upper cooling limit checks Date: Thu, 8 May 2014 20:07:59 +0530 Message-Id: <1399559880-20562-5-git-send-email-amit.daniel@samsung.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1399559880-20562-1-git-send-email-amit.daniel@samsung.com> References: <1399559880-20562-1-git-send-email-amit.daniel@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140508_073824_826659_C5C44A6E X-CRM114-Status: GOOD ( 13.09 ) X-Spam-Score: 0.0 (/) Cc: eduardo.valentin@ti.com, rui.zhang@intel.com, rjw@rjwysocki.net, lenb@kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 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=-2.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 is required as with addition of cpufreq cooling notifiers mechanism the client can enable some more cooling states at a later point of time. Say when minimum p state is reached then ACPI specific throttling is enabled which may add some more cooling states. Signed-off-by: Amit Daniel Kachhap --- drivers/thermal/step_wise.c | 2 +- drivers/thermal/thermal_core.c | 9 +++------ include/linux/thermal.h | 1 + 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/thermal/step_wise.c b/drivers/thermal/step_wise.c index f251521..7d65617 100644 --- a/drivers/thermal/step_wise.c +++ b/drivers/thermal/step_wise.c @@ -72,7 +72,7 @@ static unsigned long get_target_state(struct thermal_instance *instance, } break; case THERMAL_TREND_RAISE_FULL: - if (throttle) + if (instance->upper != THERMAL_CSTATE_MAX && throttle) next_target = instance->upper; break; case THERMAL_TREND_DROPPING: diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 71b0ec0..36bb107 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -921,7 +921,6 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz, struct thermal_instance *pos; struct thermal_zone_device *pos1; struct thermal_cooling_device *pos2; - unsigned long max_state; int result; if (trip >= tz->trips || (trip < 0 && trip != THERMAL_TRIPS_NONE)) @@ -939,13 +938,11 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz, if (tz != pos1 || cdev != pos2) return -EINVAL; - cdev->ops->get_max_state(cdev, &max_state); - - /* lower default 0, upper default max_state */ + /* lower default 0, upper default THERMAL_CSTATE_MAX */ lower = lower == THERMAL_NO_LIMIT ? 0 : lower; - upper = upper == THERMAL_NO_LIMIT ? max_state : upper; + upper = upper == THERMAL_NO_LIMIT ? THERMAL_CSTATE_MAX : upper; - if (lower > upper || upper > max_state) + if (lower > upper) return -EINVAL; dev = diff --git a/include/linux/thermal.h b/include/linux/thermal.h index f7e11c7..3748e6d 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -36,6 +36,7 @@ /* invalid cooling state */ #define THERMAL_CSTATE_INVALID -1UL +#define THERMAL_CSTATE_MAX 1UL /* No upper/lower limit requirement */ #define THERMAL_NO_LIMIT THERMAL_CSTATE_INVALID