From patchwork Thu May 29 14:38:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Abraham X-Patchwork-Id: 31132 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f198.google.com (mail-ob0-f198.google.com [209.85.214.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A1DEC203E6 for ; Thu, 29 May 2014 14:39:09 +0000 (UTC) Received: by mail-ob0-f198.google.com with SMTP id va2sf1892216obc.1 for ; Thu, 29 May 2014 07:39:09 -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=MuGTrM5yGCW1SU8zexWf8cAFdf3cOwFEZlgXf623mlM=; b=h3xO5LLX3i0/8JHTVwIVewv04MQa96HqB3C8Kvm5FbSZlFcPMGJvn1m5jSX2rYUcpu BqRHR424Nkp1sZV5pEfhxhq7FBWapv+Ok+FoynjN85IHiR2Upjxmnrq2C0QaGXfuEYNL oZV9OuXi+GkgFEYf+VKnPfhVqaarHgcQ0qev0kEIVL+iPqD8sPqEoO0cbnIAN72ihvaH 0w+kMrdo/w1mjYc26JgnmXl0avZGArfyKqsOXsiOg8cA7NfA+WNnZH/b8AnMKWzmBACh Pyzl/wKEfa5k5/xn2QUKCF5NN98AvYfEYpiNBtQ8THJhm6lOdn9b8llHMJfnJMHmSC4t L3uA== X-Gm-Message-State: ALoCoQlVuL/XO7UBwA32sFjDu1SkuxEds4O3JqvCbW7X+kdOUnCAMgZ98NQHtSPgA9ZmsFO8xLdN X-Received: by 10.50.70.66 with SMTP id k2mr18988964igu.7.1401374349150; Thu, 29 May 2014 07:39:09 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.105.54 with SMTP id b51ls622905qgf.48.gmail; Thu, 29 May 2014 07:39:08 -0700 (PDT) X-Received: by 10.220.103.141 with SMTP id k13mr6826354vco.25.1401374348715; Thu, 29 May 2014 07:39:08 -0700 (PDT) Received: from mail-ve0-x22b.google.com (mail-ve0-x22b.google.com [2607:f8b0:400c:c01::22b]) by mx.google.com with ESMTPS id q13si617589vci.29.2014.05.29.07.39.08 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 29 May 2014 07:39:08 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2607:f8b0:400c:c01::22b as permitted sender) client-ip=2607:f8b0:400c:c01::22b; Received: by mail-ve0-f171.google.com with SMTP id oz11so484065veb.2 for ; Thu, 29 May 2014 07:39:08 -0700 (PDT) X-Received: by 10.52.25.130 with SMTP id c2mr1097079vdg.27.1401374348627; Thu, 29 May 2014 07:39:08 -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 ib8csp33932vcb; Thu, 29 May 2014 07:39:08 -0700 (PDT) X-Received: by 10.66.163.135 with SMTP id yi7mr9251912pab.150.1401374347797; Thu, 29 May 2014 07:39:07 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qd8si1212673pac.101.2014.05.29.07.39.07; Thu, 29 May 2014 07:39:07 -0700 (PDT) Received-SPF: none (google.com: linux-pm-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 S933692AbaE2OjF (ORCPT + 12 others); Thu, 29 May 2014 10:39:05 -0400 Received: from mail-pa0-f45.google.com ([209.85.220.45]:46018 "EHLO mail-pa0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932605AbaE2OjC (ORCPT ); Thu, 29 May 2014 10:39:02 -0400 Received: by mail-pa0-f45.google.com with SMTP id ey11so461084pad.32 for ; Thu, 29 May 2014 07:39:01 -0700 (PDT) X-Received: by 10.68.134.101 with SMTP id pj5mr9628619pbb.62.1401374341782; Thu, 29 May 2014 07:39:01 -0700 (PDT) Received: from user-ubuntu.sisodomain.com ([14.140.216.146]) by mx.google.com with ESMTPSA id nh8sm1602473pbc.25.2014.05.29.07.38.57 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 29 May 2014 07:39:01 -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, Nishanth Menon Subject: [PATCH v5 1/2] cpufreq / OPP: Allow boost frequency to be looked up from device tree Date: Thu, 29 May 2014 20:08:38 +0530 Message-Id: <1401374319-4480-2-git-send-email-thomas.ab@samsung.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1401374319-4480-1-git-send-email-thomas.ab@samsung.com> References: <1401374319-4480-1-git-send-email-thomas.ab@samsung.com> Sender: linux-pm-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-pm@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::22b 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 Acked-by: Nishanth Menon Acked-by: Lukasz Majewski --- drivers/cpufreq/cpufreq_opp.c | 45 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/drivers/cpufreq/cpufreq_opp.c b/drivers/cpufreq/cpufreq_opp.c index c0c6f4a..05fb115 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,11 @@ 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 + struct cpufreq_frequency_table *ft; + int len, count; + u32 *boost_freqs = NULL; +#endif rcu_read_lock(); @@ -82,6 +88,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)) + goto out; + + if (!len || !IS_ALIGNED(len, sizeof(u32))) { + dev_err(dev, "%s: invalid boost frequency\n", __func__); + ret = -EINVAL; + goto out; + } + + boost_freqs = kmalloc(len, GFP_KERNEL); + if (!boost_freqs) { + dev_err(dev, "%s: no memory for boost freq table\n", __func__); + ret = -ENOMEM; + goto out; + } + + count = len / sizeof(u32); + of_property_read_u32_array(dev->of_node, "boost-frequencies", + boost_freqs, count); + + for (i = 0; i < count; i++) { + cpufreq_for_each_valid_entry(ft, *table) { + if (boost_freqs[i] == ft->frequency) { + ft->flags |= CPUFREQ_BOOST_FREQ; + pr_debug("%s: marked %d as boost frequency\n", + __func__, boost_freqs[i]); + break; + } + } + + if (ft->frequency == CPUFREQ_TABLE_END) + dev_err(dev, "%s: invalid boost frequency %d\n", + __func__, boost_freqs[i]); + } + + kfree(boost_freqs); +#endif + out: rcu_read_unlock(); if (ret)