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: 4460491 Return-Path: X-Original-To: patchwork-linux-arm-msm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 439C69F358 for ; Tue, 1 Jul 2014 16:35:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5E847203DA for ; Tue, 1 Jul 2014 16:35:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 83BC8203FB for ; Tue, 1 Jul 2014 16:35:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758542AbaGAQfG (ORCPT ); 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-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=n9ewfGIvK3e34F04DfJMEFqjKWYGb0TIKVo1dcJTGrA=; b=Gu5dACdJJIfoc9QaNoH73bGVnfACmndapsoQTjUie55oAAWCoQnP9XbEABcpBJU8gr YD/xxX7qzxLp9LAU5Yk/k48unvDlXuSQfa0+NDP1vc+hzSdE+cNG6Frn+vVso4BqvarM UU8jXlxFXVnBfEGMKXxAyYQDWW7mGuI/8Jm53h2O6e280bmYRRno/azocYX8FtmZkkSW AXqH5g8TERRYWlqMTwiBu3yhXmMW51DdL52is/jwUs65iveISbJQNsWxFnGnc8mqwlvx nqaINsQ+nRnGJNN5HIhAfmzs72OEAkhcshh3qaY4owyGb1+6DbCGF5AUbiLiffGAMPqq LJgg== X-Gm-Message-State: ALoCoQm1qxRdqgce0hgc3ZCYA7J0Uhb27pLH7Xcr8Yrcwb/ytLRTJsMV8dWGKGtwCJe0+2lWG+LG 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: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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)); }