From patchwork Wed Jan 6 08:30:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 7965341 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 878989F38D for ; Wed, 6 Jan 2016 08:31:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AD1CC20165 for ; Wed, 6 Jan 2016 08:31:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D184C20160 for ; Wed, 6 Jan 2016 08:31:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752522AbcAFIav (ORCPT ); Wed, 6 Jan 2016 03:30:51 -0500 Received: from mail-pf0-f180.google.com ([209.85.192.180]:34049 "EHLO mail-pf0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752335AbcAFIar (ORCPT ); Wed, 6 Jan 2016 03:30:47 -0500 Received: by mail-pf0-f180.google.com with SMTP id e65so182199916pfe.1 for ; Wed, 06 Jan 2016 00:30:47 -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=WpkEJOFnjt5ECV3pTZWq3WUlbM4TSyQ/iSh+phcKfJhglnHnsW3VTHQAFBcIeGOrV5 OdDIxLv3eoNMCW06axPYjwmLu+NMgH1q+t6DTPq/CsWeS8avAnfYBp0x9dh8RwseYfry Wvz1Q4lpGwceiJtEh9Dy7q3JvX5KekImdSUjw= 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=QlDcb5ZvxZcosODAfKD8s6Aei+428XL+Vmw7WEdFCTBCWU0C/vgrMCvdBEb4voaCxM NXRPVfH0+8Ah/MCD3ZzvGyovzFMBMoqMM2hoT/IanoC11T8XkZiWobIR5bhbbNt3fNIy +O+vLidLwVLBNcz1otnwZJZp5LSGyQVdQ7lwislvcNZsCT7FVDyuoK5YkgSVZzWVRKM3 6tgKWG6qCPMPVrD/bx278gz2qDehNH0/B/MJTxhhrCKbkEhPMVArSJ4EKbKtpjQ/VMe4 aARLaFHkLiJHMexhb6mzDcHfLN2ce9a1UGar6NDTY220r7D0bklaLrprGDOhipM/69XK okUQ== X-Gm-Message-State: ALoCoQlOtTY1yTCcqJt19EtnJRfFMVrZrfR360Aff5j+ysRzV5+eAnmt1daVIdSgiywQcd82Lt1xsXwR8j+noa8kTGUy+JZOoQ== X-Received: by 10.98.14.65 with SMTP id w62mr102820908pfi.53.1452069047265; Wed, 06 Jan 2016 00:30:47 -0800 (PST) Received: from localhost.localdomain (v17.blockcn.net. [192.241.236.26]) by smtp.gmail.com with ESMTPSA id f24sm133416478pff.68.2016.01.06.00.30.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 06 Jan 2016 00:30:46 -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 v2 3/4] thermal: add sys node for k_pu_ratio/k_po_ratio Date: Wed, 6 Jan 2016 16:30:22 +0800 Message-Id: <1452069023-32149-4-git-send-email-leo.yan@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1452069023-32149-1-git-send-email-leo.yan@linaro.org> References: <1452069023-32149-1-git-send-email-leo.yan@linaro.org> 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.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham 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 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(-) 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,