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: 30131 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f200.google.com (mail-ie0-f200.google.com [209.85.223.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2D4B420446 for ; Wed, 14 May 2014 01:03:35 +0000 (UTC) Received: by mail-ie0-f200.google.com with SMTP id rd18sf5584631iec.7 for ; Tue, 13 May 2014 18:03:34 -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=r+EZs6wi+g/r9DAk0QcmDF/0Iuj2Epv8NFSgLKOKKWw=; b=TS9u2R/5hWbSmLf95U510DfErVLlbRbt7eDlGlhXkzO7Dp+gFurorQ24FWXafwjDdU u13LFNcQ1j8z1uzpxQl3mAzfduLPdOOVgSvs0rPeAAxKuPWTsLqjccSZTYQAYo6VrxTB lJhgbP9rbmwBZhDpeWlbokllYlhLu5EL2mu5pEgwYAcVWk4VE20rt8N5MQahKHrAIaBI CkkEBFQz6gUPFWETzmq8/ir6Yj20d2RjcQwME/G2nOR5tS517WwDpOVrIsLRfazimFLu NjJ3bg/gO2uFwES5sNKk9BU6VJkhYlXQAtiCyMtLI2Fd7Xr75SXS554mZi9jhret42Cw y8Bw== X-Gm-Message-State: ALoCoQm/FIDNAGAtrzUxNgHvPWArRByR/nFKzvJMtQgzDQybRfL36I1XDzVeoAkEO+YGLpKNcnQ3 X-Received: by 10.50.43.161 with SMTP id x1mr15528960igl.0.1400029414664; Tue, 13 May 2014 18:03:34 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.97.200 with SMTP id m66ls2082014qge.83.gmail; Tue, 13 May 2014 18:03:34 -0700 (PDT) X-Received: by 10.58.120.46 with SMTP id kz14mr177245veb.25.1400029414568; Tue, 13 May 2014 18:03:34 -0700 (PDT) Received: from mail-ve0-x22c.google.com (mail-ve0-x22c.google.com [2607:f8b0:400c:c01::22c]) by mx.google.com with ESMTPS id an4si34689vdd.170.2014.05.13.18.03.34 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 13 May 2014 18:03:34 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c01::22c as permitted sender) client-ip=2607:f8b0:400c:c01::22c; Received: by mail-ve0-f172.google.com with SMTP id oz11so1507211veb.3 for ; Tue, 13 May 2014 18:03:34 -0700 (PDT) X-Received: by 10.221.29.137 with SMTP id ry9mr249380vcb.6.1400029414468; Tue, 13 May 2014 18:03:34 -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 ib8csp192832vcb; Tue, 13 May 2014 18:03:34 -0700 (PDT) X-Received: by 10.66.241.66 with SMTP id wg2mr449351pac.132.1400029413681; Tue, 13 May 2014 18:03:33 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id rf7si201178pac.82.2014.05.13.18.03.33; Tue, 13 May 2014 18:03:33 -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 S1751244AbaENBDc (ORCPT + 8 others); Tue, 13 May 2014 21:03:32 -0400 Received: from mail-pa0-f52.google.com ([209.85.220.52]:64593 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750750AbaENBDb (ORCPT ); Tue, 13 May 2014 21:03:31 -0400 Received: by mail-pa0-f52.google.com with SMTP id fa1so950531pad.11 for ; Tue, 13 May 2014 18:03:31 -0700 (PDT) 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) 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 Cc: rjw@rjwysocki.net, kgene.kim@samsung.com, t.figa@samsung.com, l.majewski@samsung.com, viresh.kumar@linaro.org, thomas.ab@samsung.com, Nishanth Menon 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> Sender: devicetree-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: devicetree@vger.kernel.org X-Original-Sender: ta.omasab@gmail.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::22c as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=neutral (body hash did not verify) header.i=@; dmarc=fail (p=NONE dis=NONE) header.from=gmail.com 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 | 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)