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: 30781 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f70.google.com (mail-oa0-f70.google.com [209.85.219.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 59D112066E for ; Fri, 23 May 2014 13:38:22 +0000 (UTC) Received: by mail-oa0-f70.google.com with SMTP id i4sf23281085oah.1 for ; Fri, 23 May 2014 06:38:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=8yOmillbAmJDmiF3MuoVKOcw+Sd7BCjadGXf8Jb49Mk=; b=HCwjHgurf8UHZnvdBa2kXRt7wirdoP3mcDHocYOHO9AINxbBAvOTtE+X6FBLHdplxO +QbGHtBDnItSpiF/ZE3NTiTMkcTrkpGQELjBvbIcenXteeiNlZe29Va+2tbpfOXlG/Gc Hl36n9jrqZkgWWPqTufJuoTZI3jcIMguhFL40RrQYpbTd8c9U8z8ICbAEFwn/iXHjQ8i eumNgH2GtFWvJ3N9eYa6EeyJscKx6/Vb45BZHmR96qAQJPWxEL4aknIBN41WEgAnyCmv N8rFw9HOpoeXARFov7lzjvM5MpLF4GsLBKcHbVKDz2fLK/Hcyss9RMVztCNAz4tTFaoO rsEg== X-Gm-Message-State: ALoCoQl/kxtNMi6qkdv/h/wg4rqUSOTA9YhJ9lm3/a2O6aL/RvWzQU0pvslH/QWApI4jZlI/N+jU X-Received: by 10.182.22.65 with SMTP id b1mr2172862obf.10.1400852301997; Fri, 23 May 2014 06:38:21 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.84.72 with SMTP id k66ls1564215qgd.96.gmail; Fri, 23 May 2014 06:38:21 -0700 (PDT) X-Received: by 10.58.56.71 with SMTP id y7mr4273673vep.24.1400852301887; Fri, 23 May 2014 06:38:21 -0700 (PDT) Received: from mail-ve0-x230.google.com (mail-ve0-x230.google.com [2607:f8b0:400c:c01::230]) by mx.google.com with ESMTPS id x2si1620470veu.72.2014.05.23.06.38.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 May 2014 06:38:21 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c01::230 as permitted sender) client-ip=2607:f8b0:400c:c01::230; Received: by mail-ve0-f176.google.com with SMTP id jz11so6212874veb.21 for ; Fri, 23 May 2014 06:38:21 -0700 (PDT) X-Received: by 10.53.13.133 with SMTP id ey5mr3564791vdd.8.1400852301823; Fri, 23 May 2014 06:38:21 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp32426vcb; Fri, 23 May 2014 06:38:21 -0700 (PDT) X-Received: by 10.68.110.65 with SMTP id hy1mr5929885pbb.67.1400852300971; Fri, 23 May 2014 06:38:20 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id fg5si3971462pad.120.2014.05.23.06.38.20; Fri, 23 May 2014 06:38:20 -0700 (PDT) Received-SPF: none (google.com: devicetree-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751146AbaEWNiT (ORCPT + 8 others); Fri, 23 May 2014 09:38:19 -0400 Received: from mail-pb0-f52.google.com ([209.85.160.52]:34019 "EHLO mail-pb0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750981AbaEWNiT (ORCPT ); Fri, 23 May 2014 09:38:19 -0400 Received: by mail-pb0-f52.google.com with SMTP id rr13so4197729pbb.11 for ; Fri, 23 May 2014 06:38:18 -0700 (PDT) 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 Cc: rjw@rjwysocki.net, linux-samsung-soc@vger.kernel.org, kgene.kim@samsung.com, t.figa@samsung.com, l.majewski@samsung.com, viresh.kumar@linaro.org, thomas.ab@samsung.com, nm@ti.com 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> Sender: devicetree-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: devicetree@vger.kernel.org X-Original-Sender: thomas.ab@samsung.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c01::230 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=neutral (body hash did not verify) header.i=@ Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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)