From patchwork Wed May 14 01:02:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Abraham X-Patchwork-Id: 4171491 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 C57719F1C0 for ; Wed, 14 May 2014 01:06:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 01BE720306 for ; Wed, 14 May 2014 01:06:32 +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 E484420222 for ; Wed, 14 May 2014 01:06:30 +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 1WkNbx-0003y7-T9; Wed, 14 May 2014 01:03:57 +0000 Received: from mail-pa0-x234.google.com ([2607:f8b0:400e:c03::234]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WkNbs-0003wj-H8 for linux-arm-kernel@lists.infradead.org; Wed, 14 May 2014 01:03:56 +0000 Received: by mail-pa0-f52.google.com with SMTP id fa1so934765pad.39 for ; Tue, 13 May 2014 18:03:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8onKjulza586Ae4lEh1an0i8Ax1OjbLbeiCjJ6Z5S+s=; b=dfjWA7CYTD09Tjj9BJI394W4Cgd/VLDF2jzCHnQlhPWKuM7m+5j2brjdO31/6b154Q flg3ntkfYOzCnoXsIW0F6uBNsOsgZfzY/cin1ep0WdWU+uL4PjfsTxEypZRB3GHByoed MufwSBlMqX1XbxZoht7D2sldHQ4a7TKEbTFg2O232BbkP3Rvzjb02ORQLD5t0f8YhCcO fxHYkiWxFJ+u7ADHhtlPUtlJm70aAZBnz/ULWNrfGspp3ki6Dww8xO3sRdbXnssBkBVS 3w8UHifh2nM9Vqlhjg5uQoMtFI+SFqa9fTDUcOBOkBhBobQ8f5Dt3ketJvm3s+u/AeUz SZgA== X-Received: by 10.68.231.229 with SMTP id tj5mr354435pbc.101.1400029411275; Tue, 13 May 2014 18:03:31 -0700 (PDT) Received: from localhost.localdomain ([117.213.250.141]) by mx.google.com with ESMTPSA id bq4sm266991pbb.60.2014.05.13.18.03.22 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 13 May 2014 18:03:30 -0700 (PDT) X-Google-Original-From: Thomas Abraham From: Thomas Abraham To: linux-samsung-soc@vger.kernel.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v3 1/2] cpufreq / OPP: Allow boost frequency to be looked up from device tree Date: Wed, 14 May 2014 06:32:59 +0530 Message-Id: <1400029380-5372-2-git-send-email-thomas.ab@samsung.com> X-Mailer: git-send-email 1.7.4.4 In-Reply-To: <1400029380-5372-1-git-send-email-thomas.ab@samsung.com> References: <1400029380-5372-1-git-send-email-thomas.ab@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140513_180352_587107_9E213091 X-CRM114-Status: GOOD ( 15.65 ) X-Spam-Score: -0.1 (/) Cc: Nishanth Menon , l.majewski@samsung.com, kgene.kim@samsung.com, viresh.kumar@linaro.org, t.figa@samsung.com, rjw@rjwysocki.net, 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_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 | 39 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 39 insertions(+), 0 deletions(-) diff --git a/drivers/cpufreq/cpufreq_opp.c b/drivers/cpufreq/cpufreq_opp.c index c0c6f4a..e3c97f3 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,40 @@ 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-frequency", &len)) { + 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-frequency", + boost_freqs, len / sizeof(u32)); + } + + for (j = 0; j < len / sizeof(u32) && boost_freqs; j++) { + for (i = 0; freq_table[i].frequency != CPUFREQ_TABLE_END; i++) { + if (boost_freqs[j] == freq_table[i].frequency) { + freq_table[i].flags |= CPUFREQ_BOOST_FREQ; + break; + } + } + if (freq_table[i].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)