From patchwork Wed Apr 27 03:22:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 66762 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp1955670qge; Tue, 26 Apr 2016 20:23:39 -0700 (PDT) X-Received: by 10.66.122.139 with SMTP id ls11mr8629146pab.14.1461727418859; Tue, 26 Apr 2016 20:23:38 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g7si2611275pat.103.2016.04.26.20.23.38; Tue, 26 Apr 2016 20:23:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752905AbcD0DX1 (ORCPT + 29 others); Tue, 26 Apr 2016 23:23:27 -0400 Received: from mail-pf0-f177.google.com ([209.85.192.177]:36844 "EHLO mail-pf0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751920AbcD0DXY (ORCPT ); Tue, 26 Apr 2016 23:23:24 -0400 Received: by mail-pf0-f177.google.com with SMTP id c189so14772644pfb.3 for ; Tue, 26 Apr 2016 20:23:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=AWxM3vJFA9XXd50C1ieaop7Xzpl5fmXRccPH7TqGb2Y=; b=aD7CEFlz04hcqsbJxt/CH283Kc4jP8sArInFmzqUqHMkruVeF6F+eT7L4/TCZIvRn1 kMBF0dXu+51f5CAmbnoufx6mZj4NExTmoYGr8Cfjz6uYAqLl3V8JK1iCwl9bProABLl7 OWGEhhYEmQ2MWPKDT6Y21yLALoweW1nNNaG/w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=AWxM3vJFA9XXd50C1ieaop7Xzpl5fmXRccPH7TqGb2Y=; b=DyRBSS/LTVCEtw6rTUGxYidu8r87klZTpQX+TX0iKsLzPfyEo2ZWYEWzk1fIOztuVM eaoxI3yQGUvLq0YVb+vP0TUCA5cRsy+lobwReY/i6gvuqcBAqPHYrC7tGn5j8J6l08zq Sb7cuLTgdvrpb1NqZMlEycKM4aoAVzCpAC4N0d74UULLjqXK/X0/bKsPYwSi+fvXGOfZ ISIcilhSYNkHeT4syWRUTZCqovCpnw68zZ4chuf4pqMvQwlRmXM2R+yfNwtCvIJIecwe Q1/oythkBq/YtJ1ySMiMKR+pHVLF0H/tRz8duwuM0lzTNiFtNIE5rO3JtjfSk31Qi1wb nU7g== X-Gm-Message-State: AOPr4FVKqF+bAgAeDx9ZPX1jwY3NWYxq/M7OF6vSINiuPq219rcxkO5bSQXGKejwGbf3GTzC X-Received: by 10.98.11.78 with SMTP id t75mr8508217pfi.72.1461727404115; Tue, 26 Apr 2016 20:23:24 -0700 (PDT) Received: from localhost ([122.167.143.140]) by smtp.gmail.com with ESMTPSA id yp9sm1967182pab.42.2016.04.26.20.23.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Apr 2016 20:23:23 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Viresh Kumar Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, nm@ti.com, sboyd@codeaurora.org, arnd.bergmann@linaro.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 4/7] cpufreq: dt: Identify cpu-sharing for platforms without operating-points-v2 Date: Wed, 27 Apr 2016 08:52:24 +0530 Message-Id: <63799f4fb97a958852ab5f5c055358f669da4772.1461727086.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.7.1.410.g6faf27b In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Existing platforms, which do not support operating-points-v2, can explicitly tell the opp core that some of the CPUs share opp tables, with help of dev_pm_opp_set_sharing_cpus(). For such platforms, explicitly ask the opp core to provide list of CPUs sharing the opp table with current cpu device, before falling back to platform data. Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq-dt.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) -- 2.7.1.410.g6faf27b diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c index 5f8dbe640a20..aca9bec00f91 100644 --- a/drivers/cpufreq/cpufreq-dt.c +++ b/drivers/cpufreq/cpufreq-dt.c @@ -147,7 +147,7 @@ static int cpufreq_init(struct cpufreq_policy *policy) struct clk *cpu_clk; struct dev_pm_opp *suspend_opp; unsigned int transition_latency; - bool opp_v1 = false; + bool fallback = false; const char *name; int ret; @@ -167,14 +167,16 @@ static int cpufreq_init(struct cpufreq_policy *policy) /* Get OPP-sharing information from "operating-points-v2" bindings */ ret = dev_pm_opp_of_get_sharing_cpus(cpu_dev, policy->cpus); if (ret) { + if (ret != -ENOENT) + goto out_put_clk; + /* * operating-points-v2 not supported, fallback to old method of - * finding shared-OPPs for backward compatibility. + * finding shared-OPPs for backward compatibility if the + * platform hasn't set sharing CPUs. */ - if (ret == -ENOENT) - opp_v1 = true; - else - goto out_put_clk; + if (dev_pm_opp_get_sharing_cpus(cpu_dev, policy->cpus)) + fallback = true; } /* @@ -214,7 +216,7 @@ static int cpufreq_init(struct cpufreq_policy *policy) goto out_free_opp; } - if (opp_v1) { + if (fallback) { struct cpufreq_dt_platform_data *pd = cpufreq_get_driver_data(); if (!pd || !pd->independent_clocks)