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 Daniel Kachhap X-Patchwork-Id: 29841 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f70.google.com (mail-oa0-f70.google.com [209.85.219.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 407F2202DD for ; Thu, 8 May 2014 14:38:38 +0000 (UTC) Received: by mail-oa0-f70.google.com with SMTP id i4sf12821098oah.9 for ; Thu, 08 May 2014 07:38:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=3A1KQQ+AA0x1oQVRAbgTMmyp9OIywKLuVLuyvgm1Hx4=; b=PW8ONHYm1aQ1DcGBpUw8vShR/XFeCJZGwW5oiSi4vyrzNfLYSeM6LfEDsTOXmKteqL JkrTwWkeXM894fT7NMWVXIxqghiOh6djnzbiMwu3/2sYYlogi7EGJ7TBFjVrxc3EhIws UJJ+nCHrguxfC7UJ+FAZdW6JaYNB7yW9SQvfu+M0TrtJsWYAv6ew2RK9NerGW6ERCLIe SDOulKIbhd1ahm+YG+IQq4m8FKlBajPNnbVpxuY786Jow8tcACkGywSXAIsDy58Ijjvi As2o1sMC75paGlduzfERNKC1bGyjYEB9h1NH+ksHbNbA6uwvDl6qpn7klbl15qPWwnVP ZgVg== X-Gm-Message-State: ALoCoQmfkT4RoxH1EUk/kB6fApKUyufEv9PZ6ap5YQGgrkrS56hjyGyRxzDqf/Bj7LXysWh82qfG X-Received: by 10.42.87.140 with SMTP id y12mr1518982icl.31.1399559917448; Thu, 08 May 2014 07:38:37 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.103.118 with SMTP id x109ls3724619qge.74.gmail; Thu, 08 May 2014 07:38:37 -0700 (PDT) X-Received: by 10.58.22.38 with SMTP id a6mr1015752vef.58.1399559917272; Thu, 08 May 2014 07:38:37 -0700 (PDT) Received: from mail-ve0-x235.google.com (mail-ve0-x235.google.com [2607:f8b0:400c:c01::235]) by mx.google.com with ESMTPS id cx1si207782vdb.110.2014.05.08.07.38.37 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 08 May 2014 07:38:37 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=2607:f8b0:400c:c01::235; Received: by mail-ve0-f181.google.com with SMTP id pa12so3341201veb.26 for ; Thu, 08 May 2014 07:38:37 -0700 (PDT) X-Received: by 10.58.216.163 with SMTP id or3mr553093vec.80.1399559917190; Thu, 08 May 2014 07:38:37 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp409715vcb; Thu, 8 May 2014 07:38:36 -0700 (PDT) X-Received: by 10.66.190.73 with SMTP id go9mr8633885pac.18.1399559916491; Thu, 08 May 2014 07:38:36 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id db3si610510pbc.402.2014.05.08.07.38.35; Thu, 08 May 2014 07:38:35 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754672AbaEHOiH (ORCPT + 27 others); Thu, 8 May 2014 10:38:07 -0400 Received: from mail-pd0-f178.google.com ([209.85.192.178]:65016 "EHLO mail-pd0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753442AbaEHOiD (ORCPT ); Thu, 8 May 2014 10:38:03 -0400 Received: by mail-pd0-f178.google.com with SMTP id r10so2417347pdi.37 for ; Thu, 08 May 2014 07:38:03 -0700 (PDT) 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 Cc: lenb@kernel.org, rui.zhang@intel.com, eduardo.valentin@ti.com, rjw@rjwysocki.net 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Original-Sender: amit.daniel@samsung.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=neutral (body hash did not verify) header.i=@ Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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