From patchwork Thu Aug 28 05:52:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 4792781 Return-Path: X-Original-To: patchwork-linux-arm-msm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2E69EC0338 for ; Thu, 28 Aug 2014 05:53:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5BC6E2016C for ; Thu, 28 Aug 2014 05:53:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6D66A20145 for ; Thu, 28 Aug 2014 05:53:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934221AbaH1FxV (ORCPT ); Thu, 28 Aug 2014 01:53:21 -0400 Received: from mail-pa0-f44.google.com ([209.85.220.44]:50248 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934124AbaH1FxU (ORCPT ); Thu, 28 Aug 2014 01:53:20 -0400 Received: by mail-pa0-f44.google.com with SMTP id rd3so1138044pab.3 for ; Wed, 27 Aug 2014 22:53:20 -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=V8Wlq0v2zc+f+YFb3P0l9ZtVq2K/r3o1gPNMNX+gNXc=; b=bZlO12PipOQroB0Elg8XIb6t1oqvYI/nso+IRFItgkmiV/xdAwzon7COCLkEcuNqkK VlZU9rkHoRvhJq70dECZ+QV5BkI2/4Zgmy4fJo2LkOdMuavfLv+wk/le0bFos9vG+AQ8 lxPAES68pn/E0kqSig4suxJ76Ejfz4g3EdcpEMO3ZBHx3zAJkRAnjcE1sFf4dWQnTX1n pKHWYHOAROOlPk41VZMmcqwScR1VGrlAOQcGFEHQQdO3Ch4qZ+OnLK/6TFHm71zr+Zj4 pQyxYmOF8FrkmbMXBl73SDjlf2bPFf9H0fm3qTzvz0jcxWJ5LpL9ZhWF0acdg1Cmt9JH J01w== X-Gm-Message-State: ALoCoQlczj2A1DprnOSvc4U8f59U9AJt/nhT0faEHRkDRronbVyGKc/E+OQpY8oBHdk9yyrl0X0F X-Received: by 10.68.224.40 with SMTP id qz8mr2358971pbc.9.1409205200590; Wed, 27 Aug 2014 22:53:20 -0700 (PDT) Received: from localhost ([122.167.123.172]) by mx.google.com with ESMTPSA id pv10sm3640832pdb.60.2014.08.27.22.53.18 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 27 Aug 2014 22:53:19 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, shawn.guo@linaro.org, sboyd@codeaurora.org, linux-arm-msm@vger.kernel.org, spk.linux@gmail.com, thomas.ab@samsung.com, t.figa@samsung.com, santosh.shilimkar@ti.com, thomas.petazzoni@free-electrons.com, pramod.gurav@smartplayin.com, Viresh Kumar Subject: [PATCH V3 07/10] cpufreq: cpu0: try regulators with name "cpu-supply" Date: Thu, 28 Aug 2014 11:22:29 +0530 Message-Id: <65c2c6931b4787091b865252a784f026476d4586.1409201048.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.0.3.693.g996b0fd 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, 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 Tested-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 03e352b..de38952 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_dbg(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)); }