From patchwork Wed Jan 6 08:53:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 59228 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp6449784lbb; Wed, 6 Jan 2016 00:54:43 -0800 (PST) X-Received: by 10.66.237.35 with SMTP id uz3mr140069306pac.96.1452070483427; Wed, 06 Jan 2016 00:54:43 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q78si13135131pfa.3.2016.01.06.00.54.43; Wed, 06 Jan 2016 00:54:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752575AbcAFIyf (ORCPT + 29 others); Wed, 6 Jan 2016 03:54:35 -0500 Received: from mail-pf0-f179.google.com ([209.85.192.179]:35346 "EHLO mail-pf0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752451AbcAFIyW (ORCPT ); Wed, 6 Jan 2016 03:54:22 -0500 Received: by mail-pf0-f179.google.com with SMTP id 78so238511555pfw.2 for ; Wed, 06 Jan 2016 00:54:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=YEjBdh1n7zIq5rmnA3UEy+TZdSjlgsdJ++rjywzibbc=; b=jDwyIko4gBmKkcitlCwXhFRyGRSatEb73YaPrTKvtTOaIAkxkK0riuTm80pOE8jVBd BN6/xH9OU1gi5T/IV7v8M+AJDA2RXJetuOCoKF82nbguAOEwjf6GCVm3NaRxSfRhr8zW iBn59IoskRnBWybyZ3bp/8dhHpycjszSgyyAc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=YEjBdh1n7zIq5rmnA3UEy+TZdSjlgsdJ++rjywzibbc=; b=E7DayZjnWsqi2H503bLvBgw5ob/gSK4Z9eMom7NgoDuGGsIlrj57/qnhyPWe1HoVOV mrBTyh67wN3vJMtudJauXcUpzhjoKNlRhSL4XcmI7KJ1SCjxDPv4l41GG9Z2kZXzYBD1 toZVVIO+6GAHqk0lDqGtLHLyY3XedvN5h2PnTmp/VqLMv4H3GQzgdJCkdnI+JqzeqcPx 4FcAhrPJ7QKuta5F63PQXHRtOJOppfR8Ioov5AwrQIp+wUoFJbyDcUDyNu8HMl17mXdP bsyvS4A8aV3R4DMzvoeTOOGXE2QGapEQR4PPKi5oJJLgoLB/nrQstSAwxnCOuRuqv+fG gxwA== X-Gm-Message-State: ALoCoQmL7GbNOYzCMpEg6bPlwuD6FftHqHX+dUHrfaXZ+Z29nVRTSlxGt6hNsgWZiqW2v9s1kAouhs9hygyNwCTnjgb29PDDSg== X-Received: by 10.98.71.91 with SMTP id u88mr130660243pfa.30.1452070461533; Wed, 06 Jan 2016 00:54:21 -0800 (PST) Received: from localhost.localdomain (v17.blockcn.net. [192.241.236.26]) by smtp.gmail.com with ESMTPSA id ux2sm138843233pac.46.2016.01.06.00.54.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 06 Jan 2016 00:54:20 -0800 (PST) From: Leo Yan To: Jonathan Corbet , Zhang Rui , Eduardo Valentin , Javi Merino , Punit Agrawal , Daniel Kurtz , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Daniel Thompson Cc: Leo Yan Subject: [PATCH v3 3/4] thermal: add sys node for k_pu_ratio/k_po_ratio Date: Wed, 6 Jan 2016 16:53:47 +0800 Message-Id: <1452070428-2567-4-git-send-email-leo.yan@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1452070428-2567-1-git-send-email-leo.yan@linaro.org> References: <1452070428-2567-1-git-send-email-leo.yan@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add two sys nodes for k_pu_ratio and k_po_ratio, so user can set ratio value from them. Also change k_pu/k_po as read only nodes, it will only be used to show proportional term constants which are calculated by ratio. Signed-off-by: Leo Yan --- drivers/thermal/thermal_core.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index d9e525c..bc149a67 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -955,8 +955,25 @@ static DEVICE_ATTR(sustainable_power, S_IWUSR | S_IRUGO, sustainable_power_show, } \ static DEVICE_ATTR(name, S_IWUSR | S_IRUGO, name##_show, name##_store) -create_s32_tzp_attr(k_po); -create_s32_tzp_attr(k_pu); + +#define create_s32_tzp_attr_ro(name) \ + static ssize_t \ + name##_show(struct device *dev, struct device_attribute *devattr, \ + char *buf) \ + { \ + struct thermal_zone_device *tz = to_thermal_zone(dev); \ + \ + if (tz->tzp) \ + return sprintf(buf, "%u\n", tz->tzp->name); \ + else \ + return -EIO; \ + } \ + static DEVICE_ATTR(name, S_IRUGO, name##_show, NULL) + +create_s32_tzp_attr_ro(k_po); +create_s32_tzp_attr_ro(k_pu); +create_s32_tzp_attr(k_po_ratio); +create_s32_tzp_attr(k_pu_ratio); create_s32_tzp_attr(k_i); create_s32_tzp_attr(k_d); create_s32_tzp_attr(integral_cutoff); @@ -968,6 +985,8 @@ static struct device_attribute *dev_tzp_attrs[] = { &dev_attr_sustainable_power, &dev_attr_k_po, &dev_attr_k_pu, + &dev_attr_k_po_ratio, + &dev_attr_k_pu_ratio, &dev_attr_k_i, &dev_attr_k_d, &dev_attr_integral_cutoff,