From patchwork Tue Jul 1 16:32:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 32916 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f200.google.com (mail-ob0-f200.google.com [209.85.214.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6BC8520672 for ; Tue, 1 Jul 2014 16:35:13 +0000 (UTC) Received: by mail-ob0-f200.google.com with SMTP id wm4sf59734572obc.3 for ; Tue, 01 Jul 2014 09:35:13 -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: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=+7uWRRQy5K3LxDPw3TyhytxQx9j7/KLytXPQ9rEnXpM=; b=QFg9G0XUmfcqmRPuwMfY+vjber3yniLVmoowsn/Wt+dPX6RW0lGbvFTZOG5lurcsKn gSVvaYx1IWN9/P6TROD5oybeMf1ylK8sSfuCWIMznaJlpoGQOL3jPkN2JiD21SpOA2gW hjHay+inVKy5vAOcg7KUy35T918+l6zIaSi4svlo2IpxsT+XrF5sQDrlTyYrQ2LKYQ2d 35/6bS6vqRzCdKgTaRMKjiOygKiWk0L7FlsUXj44MiLLpzSPIAe94f4kVhZOIU7ZmKEh xaeUMpc95Huh1Oc5BEarQ0JWWc2Z/WJGoY6KeJKEyQwR8yf2YFaKCSZaBzdkXrxEX7XO qUqA== X-Gm-Message-State: ALoCoQmgVzBeLZfzZwBeJAqtScpmUN3IKgLOSfBMG9e66h0Qsb7ivzxTjo1reX0VJBXsSu+f0lgz X-Received: by 10.50.44.69 with SMTP id c5mr2902137igm.3.1404232512955; Tue, 01 Jul 2014 09:35:12 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.88.165 with SMTP id t34ls2039954qgd.93.gmail; Tue, 01 Jul 2014 09:35:12 -0700 (PDT) X-Received: by 10.58.234.199 with SMTP id ug7mr1579919vec.40.1404232512813; Tue, 01 Jul 2014 09:35:12 -0700 (PDT) Received: from mail-ve0-f177.google.com (mail-ve0-f177.google.com [209.85.128.177]) by mx.google.com with ESMTPS id yw1si11612858vdb.44.2014.07.01.09.35.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 01 Jul 2014 09:35:12 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.177 as permitted sender) client-ip=209.85.128.177; Received: by mail-ve0-f177.google.com with SMTP id i13so9858783veh.36 for ; Tue, 01 Jul 2014 09:35:12 -0700 (PDT) X-Received: by 10.58.69.76 with SMTP id c12mr1555279veu.35.1404232512751; Tue, 01 Jul 2014 09:35:12 -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.221.37.5 with SMTP id tc5csp228393vcb; Tue, 1 Jul 2014 09:35:12 -0700 (PDT) X-Received: by 10.68.173.1 with SMTP id bg1mr63503036pbc.13.1404232512064; Tue, 01 Jul 2014 09:35:12 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ea5si27536687pad.63.2014.07.01.09.35.11; Tue, 01 Jul 2014 09:35:11 -0700 (PDT) Received-SPF: none (google.com: linux-arm-msm-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 S1758542AbaGAQfG (ORCPT + 3 others); Tue, 1 Jul 2014 12:35:06 -0400 Received: from mail-pa0-f46.google.com ([209.85.220.46]:33956 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758522AbaGAQfF (ORCPT ); Tue, 1 Jul 2014 12:35:05 -0400 Received: by mail-pa0-f46.google.com with SMTP id eu11so10851653pac.19 for ; Tue, 01 Jul 2014 09:35:04 -0700 (PDT) X-Received: by 10.66.220.169 with SMTP id px9mr1813061pac.79.1404232504752; Tue, 01 Jul 2014 09:35:04 -0700 (PDT) Received: from localhost ([122.166.172.22]) by mx.google.com with ESMTPSA id iq10sm33451666pbc.14.2014.07.01.09.34.58 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 01 Jul 2014 09:35:04 -0700 (PDT) From: Viresh Kumar To: rjw@rjwysocki.net, shawn.guo@linaro.org Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, arvind.chauhan@arm.com, sboyd@codeaurora.org, linux-arm-msm@vger.kernel.org, spk.linux@gmail.com, thomas.ab@samsung.com, nm@ti.com, t.figa@samsung.com, Viresh Kumar Subject: [PATCH 10/14] cpufreq: cpu0: try regulators with name "cpu-supply" Date: Tue, 1 Jul 2014 22:02:39 +0530 Message-Id: X-Mailer: git-send-email 2.0.0.rc2 In-Reply-To: References: In-Reply-To: References: Sender: linux-arm-msm-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.177 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org 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: , Currently, we expect regulator name to be "cpu0", but as we are going to support multiple cpu-blocks (all CPUs in a block share clock/voltage) later, we need to pass some generic string instead of that. For backwards compatibility try for "cpu0" first and if it fails, then try for "cpu". Suggested-by: Stephen Boyd Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq-cpu0.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c index 15b8e7a..17001a8 100644 --- a/drivers/cpufreq/cpufreq-cpu0.c +++ b/drivers/cpufreq/cpufreq-cpu0.c @@ -113,6 +113,7 @@ static int allocate_resources(struct device **cdev, struct regulator *cpu_reg; struct clk *cpu_clk; int ret = 0; + char *reg_cpu0 = "cpu0", *reg_cpu = "cpu", *reg; cpu_dev = get_cpu_device(0); if (!cpu_dev) { @@ -120,7 +121,11 @@ static int allocate_resources(struct device **cdev, return -ENODEV; } - cpu_reg = regulator_get_optional(cpu_dev, "cpu0"); + /* Try "cpu0" for older DTs */ + reg = reg_cpu0; + +try_again: + cpu_reg = regulator_get_optional(cpu_dev, reg); if (IS_ERR(cpu_reg)) { /* * If cpu0 regulator supply node is present, but regulator is @@ -130,6 +135,13 @@ static int allocate_resources(struct device **cdev, dev_err(cpu_dev, "cpu0 regulator not ready, retry\n"); return -EPROBE_DEFER; } + + /* Try with "cpu-supply" */ + if (reg == reg_cpu0) { + reg = reg_cpu; + goto try_again; + } + dev_warn(cpu_dev, "failed to get cpu0 regulator: %ld\n", PTR_ERR(cpu_reg)); }