From patchwork Fri Sep 9 11:18:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 75876 Delivered-To: patch@linaro.org Received: by 10.140.106.11 with SMTP id d11csp290228qgf; Fri, 9 Sep 2016 04:18:40 -0700 (PDT) X-Received: by 10.98.7.200 with SMTP id 69mr5578534pfh.33.1473419917761; Fri, 09 Sep 2016 04:18:37 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id kg11si3500692pab.248.2016.09.09.04.18.37; Fri, 09 Sep 2016 04:18:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753716AbcIILS3 (ORCPT + 14 others); Fri, 9 Sep 2016 07:18:29 -0400 Received: from mail-pa0-f49.google.com ([209.85.220.49]:32973 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753732AbcIILS1 (ORCPT ); Fri, 9 Sep 2016 07:18:27 -0400 Received: by mail-pa0-f49.google.com with SMTP id cm16so27657580pac.0 for ; Fri, 09 Sep 2016 04:18:21 -0700 (PDT) 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 :in-reply-to:references; bh=xubp/jv3KpTCEm3JWxOIDGld5NPsPIFG0+eNE5UiIuo=; b=NawMHiPls8ALcXZtfbvqXZ8a+s8rQukdzvD4FqKylYGIMjYyBGoeeOL1N8oGdS29Hy RBe+mS2g9qLBiEUwOGOKGy3c10fH+JY8+kC0pKQ1Baeg+t8WuDpu/dsAuluH3Q3CGUMW Ilhx5lqgmhm/mn3va+l2mh7iMxn+nHtmued/o= 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:in-reply-to:references; bh=xubp/jv3KpTCEm3JWxOIDGld5NPsPIFG0+eNE5UiIuo=; b=JRrPnKKJuJy8nOuFm82hW05eOX/BQbTDVablxhdZ0F5551cqBz05vVaeaei9Al1zHW c04oKXo1n5HV7zQrMLvnzK5Md65rBi4Ggbu55kXViRNjuoJa1W6DQZWvuRHFe9KwWAIR vCUgMQYdKE4MKL/YWvE3ZIdl31m4HFPVmoViGnqEXh9SUF2BPZndhUdGZGb0vfRGH+sg 76k8EaHoR1N9+QhctjHVOV9f6qmtSR3r20cWLIep+tV231U0nfqdWFoIhof350v/v50O yfDGZHw+cTZfgWbzr7iwxS76U4znlWn8+2wRLwfLDkiF3hhZZPlUGGMP5FyA5/h7pIrq z7mA== X-Gm-Message-State: AE9vXwNh3DAW50qoMdp0zltcty+S5OtlgNXIcA2IaOChiM7AopiuWtJ+6o74rrb9RYLxTo9m X-Received: by 10.66.76.106 with SMTP id j10mr5538107paw.65.1473419901331; Fri, 09 Sep 2016 04:18:21 -0700 (PDT) Received: from localhost ([171.61.121.167]) by smtp.gmail.com with ESMTPSA id tq5sm4582261pac.42.2016.09.09.04.18.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Sep 2016 04:18:20 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Viresh Kumar Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Juri.Lelli@arm.com, arnd.bergmann@linaro.org Subject: [PATCH 3/3] cpufreq: dt: Support governor tunables per policy Date: Fri, 9 Sep 2016 16:48:08 +0530 Message-Id: <186c7da02a81faaf13d4b6323c0d331ae0bdd174.1473419844.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.7.1.410.g6faf27b In-Reply-To: <1f5ea403f4a540a0187586e60b4f3a934fa0fc7d.1473419844.git.viresh.kumar@linaro.org> References: <1f5ea403f4a540a0187586e60b4f3a934fa0fc7d.1473419844.git.viresh.kumar@linaro.org> In-Reply-To: <1f5ea403f4a540a0187586e60b4f3a934fa0fc7d.1473419844.git.viresh.kumar@linaro.org> References: <1f5ea403f4a540a0187586e60b4f3a934fa0fc7d.1473419844.git.viresh.kumar@linaro.org> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The cpufreq-dt driver is also used for systems with multiple clock/voltage domains for CPUs, i.e. multiple cpufreq policies in a system. And in such cases the platform users may want to enable "governor tunables per policy". Support that via platform data, as not all users of the driver would want that behavior. Reported-by: Juri Lelli Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq-dt-platdev.c | 7 +++++-- drivers/cpufreq/cpufreq-dt.c | 6 ++++++ drivers/cpufreq/cpufreq-dt.h | 19 +++++++++++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 drivers/cpufreq/cpufreq-dt.h -- 2.7.1.410.g6faf27b -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/cpufreq/cpufreq-dt-platdev.c b/drivers/cpufreq/cpufreq-dt-platdev.c index 285ed3e6494e..da2fa27b5b30 100644 --- a/drivers/cpufreq/cpufreq-dt-platdev.c +++ b/drivers/cpufreq/cpufreq-dt-platdev.c @@ -11,6 +11,8 @@ #include #include +#include "cpufreq-dt.h" + static const struct of_device_id machines[] __initconst = { { .compatible = "allwinner,sun4i-a10", }, { .compatible = "allwinner,sun5i-a10s", }, @@ -92,7 +94,8 @@ static int __init cpufreq_dt_platdev_init(void) if (!match) return -ENODEV; - return PTR_ERR_OR_ZERO(platform_device_register_simple("cpufreq-dt", -1, - NULL, 0)); + return PTR_ERR_OR_ZERO(platform_device_register_data(NULL, "cpufreq-dt", + -1, match->data, + sizeof(struct cpufreq_dt_platform_data))); } device_initcall(cpufreq_dt_platdev_init); diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c index 2bd20534155d..5c07ae05d69a 100644 --- a/drivers/cpufreq/cpufreq-dt.c +++ b/drivers/cpufreq/cpufreq-dt.c @@ -25,6 +25,8 @@ #include #include +#include "cpufreq-dt.h" + struct private_data { struct device *cpu_dev; struct thermal_cooling_device *cdev; @@ -353,6 +355,7 @@ static struct cpufreq_driver dt_cpufreq_driver = { static int dt_cpufreq_probe(struct platform_device *pdev) { + struct cpufreq_dt_platform_data *data = dev_get_platdata(&pdev->dev); int ret; /* @@ -366,6 +369,9 @@ static int dt_cpufreq_probe(struct platform_device *pdev) if (ret) return ret; + if (data && data->have_governor_per_policy) + dt_cpufreq_driver.flags |= CPUFREQ_HAVE_GOVERNOR_PER_POLICY; + ret = cpufreq_register_driver(&dt_cpufreq_driver); if (ret) dev_err(&pdev->dev, "failed register driver: %d\n", ret); diff --git a/drivers/cpufreq/cpufreq-dt.h b/drivers/cpufreq/cpufreq-dt.h new file mode 100644 index 000000000000..54d774e46c43 --- /dev/null +++ b/drivers/cpufreq/cpufreq-dt.h @@ -0,0 +1,19 @@ +/* + * Copyright (C) 2016 Linaro + * Viresh Kumar + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#ifndef __CPUFREQ_DT_H__ +#define __CPUFREQ_DT_H__ + +#include + +struct cpufreq_dt_platform_data { + bool have_governor_per_policy; +}; + +#endif /* __CPUFREQ_DT_H__ */