From patchwork Fri May 23 13:37:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Abraham X-Patchwork-Id: 4232831 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 62F229F1CD for ; Fri, 23 May 2014 13:41:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8DC24201DD for ; Fri, 23 May 2014 13:41:02 +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 B5E052018B for ; Fri, 23 May 2014 13:41:01 +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 1WnpgP-0006Cs-NP; Fri, 23 May 2014 13:38:49 +0000 Received: from mail-pa0-x229.google.com ([2607:f8b0:400e:c03::229]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WnpgF-00063s-QM for linux-arm-kernel@lists.infradead.org; Fri, 23 May 2014 13:38:40 +0000 Received: by mail-pa0-f41.google.com with SMTP id lj1so4113985pab.14 for ; Fri, 23 May 2014 06:38:18 -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=oMXRJXQhp03p+sLjGt8WUG4O2DIbqh89yLzuVlGGNE0=; b=ZsxSSwPyQvMwma6cWQWFKM/nLj3SV8+HDRaTdBBfBMKqnUQqV0iNowClzKM2aufrhc 4HWnkzygVPf88ZflKsHcm09VObTPQtsGcJ7oYs4m8Ef+veHYWIGQOdcCd2Q4QKFyzmOR kIM7C7si4FcJ+cbR1WPTVfSnlHZ/YowFN8E/IuUshBApaPt8hb7D8TwwSIdroj5HSVRr /l7q4/hV91yjJ8IIDQF7njOSA8YVGEJsryQP4MarKnepLJ+Nu8uyC5c3y4HtxGhcbfPc q5yYABoSE/xFa7KLBnEAqzz9bCm42ZZzWvavRpmoxow3Lhy+hdvl7EpTkoIVOTubW3wG DiQQ== X-Received: by 10.66.147.99 with SMTP id tj3mr6066203pab.47.1400852298443; Fri, 23 May 2014 06:38:18 -0700 (PDT) Received: from user-ubuntu.sisodomain.com ([14.140.216.146]) by mx.google.com with ESMTPSA id kj1sm4775966pbd.20.2014.05.23.06.38.14 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 May 2014 06:38:17 -0700 (PDT) From: Thomas Abraham To: linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v4 1/2] cpufreq / OPP: Allow boost frequency to be looked up from device tree Date: Fri, 23 May 2014 19:07:41 +0530 Message-Id: <1400852262-6290-2-git-send-email-thomas.ab@samsung.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1400852262-6290-1-git-send-email-thomas.ab@samsung.com> References: <1400852262-6290-1-git-send-email-thomas.ab@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140523_063839_869899_B3D4F21D X-CRM114-Status: GOOD ( 14.76 ) X-Spam-Score: 0.0 (/) Cc: nm@ti.com, l.majewski@samsung.com, kgene.kim@samsung.com, viresh.kumar@linaro.org, t.figa@samsung.com, rjw@rjwysocki.net, linux-samsung-soc@vger.kernel.org, thomas.ab@samsung.com 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 From: Thomas Abraham Commit 6f19efc0 ("cpufreq: Add boost frequency support in core") adds support for CPU boost mode. This patch adds support for finding available boost frequencies from device tree and marking them as usable in boost mode. Cc: Nishanth Menon Cc: Lukasz Majewski Signed-off-by: Thomas Abraham --- drivers/cpufreq/cpufreq_opp.c | 44 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/drivers/cpufreq/cpufreq_opp.c b/drivers/cpufreq/cpufreq_opp.c index c0c6f4a..2b3905b 100644 --- a/drivers/cpufreq/cpufreq_opp.c +++ b/drivers/cpufreq/cpufreq_opp.c @@ -19,6 +19,7 @@ #include #include #include +#include /** * dev_pm_opp_init_cpufreq_table() - create a cpufreq table for a device @@ -51,6 +52,10 @@ int dev_pm_opp_init_cpufreq_table(struct device *dev, struct cpufreq_frequency_table *freq_table = NULL; int i, max_opps, ret = 0; unsigned long rate; +#ifdef CONFIG_CPU_FREQ_BOOST_SW + int j, len; + u32 *boost_freqs = NULL; +#endif rcu_read_lock(); @@ -82,6 +87,45 @@ int dev_pm_opp_init_cpufreq_table(struct device *dev, *table = &freq_table[0]; +#ifdef CONFIG_CPU_FREQ_BOOST_SW + if (of_find_property(dev->of_node, "boost-frequencies", &len)) { + struct cpufreq_frequency_table *ft; + + if (len == 0 || (len & (sizeof(u32) - 1)) != 0) { + dev_err(dev, "%s: invalid boost frequency\n", __func__); + ret = -EINVAL; + goto out; + } + + boost_freqs = kzalloc(len, GFP_KERNEL); + if (!boost_freqs) { + dev_warn(dev, "%s: no memory for boost freq table\n", + __func__); + ret = -ENOMEM; + goto out; + } + of_property_read_u32_array(dev->of_node, "boost-frequencies", + boost_freqs, len / sizeof(u32)); + + for (j = 0; j < len / sizeof(u32); j++) { + ft = *table; + for (i = 0; ft->frequency != CPUFREQ_TABLE_END; i++) { + if (boost_freqs[j] == ft->frequency) { + ft->flags |= CPUFREQ_BOOST_FREQ; + break; + } + ft++; + } + + if (ft->frequency == CPUFREQ_TABLE_END) + pr_err("%s: invalid boost frequency %d\n", + __func__, boost_freqs[j]); + } + } + + kfree(boost_freqs); +#endif + out: rcu_read_unlock(); if (ret)