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: 36155 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f72.google.com (mail-pa0-f72.google.com [209.85.220.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id DB25D2054F for ; Thu, 28 Aug 2014 05:53:24 +0000 (UTC) Received: by mail-pa0-f72.google.com with SMTP id eu11sf13235123pac.11 for ; Wed, 27 Aug 2014 22:53:24 -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=Aa3wGiIeM4qt/4/xOIH0kM+VVLHd2/Oqx7L31qWj2sI=; b=O9nWgqTCbRCKTQoJNoVjKxUZ+BDCrwEUoiWsrQHwjLKn7PvpN3GDVjU1ObjNG8M/Gs Dg8sNjxopB3gJQ8czt7FAIWebNLBnvbwOcNlWRcti6ZlrsuOqkUkzsa9epaKpNCJVUBG USZQMI4AMlTcwiam75ciR19fNCvUXeR5UJX0mHdoBYbC+i3oitiUhbt9z5gDDZ+626YX xkw0luyzIZ4X7ApdR1an6JuXvrX3dJUpwBX2TZf9wsJvMMsk4Fp1ROl5CXGPJoS1L0Xa yZuai7JKSlXdxtHMt3LzhMRbts4/tqnmtpn7at/GEbsfPJxcXB69pm0gIPqrBUfwc+j2 mfsA== X-Gm-Message-State: ALoCoQlhUs/rurtaZCpvR3KEEJCYMNS8egXqXGQc++XjDpYYL6SLSOBWLmCM5lJcSqhn7VdPZeU5 X-Received: by 10.66.249.197 with SMTP id yw5mr1072278pac.34.1409205204120; Wed, 27 Aug 2014 22:53:24 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.96.42 with SMTP id j39ls492233qge.89.gmail; Wed, 27 Aug 2014 22:53:24 -0700 (PDT) X-Received: by 10.221.6.201 with SMTP id ol9mr1495031vcb.2.1409205203972; Wed, 27 Aug 2014 22:53:23 -0700 (PDT) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id vv5si2799752vcb.57.2014.08.27.22.53.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 27 Aug 2014 22:53:23 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.180 as permitted sender) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id lf12so295530vcb.39 for ; Wed, 27 Aug 2014 22:53:23 -0700 (PDT) X-Received: by 10.220.190.197 with SMTP id dj5mr1364728vcb.19.1409205203893; Wed, 27 Aug 2014 22:53:23 -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.45.67 with SMTP id uj3csp184463vcb; Wed, 27 Aug 2014 22:53:23 -0700 (PDT) X-Received: by 10.70.102.175 with SMTP id fp15mr2458070pdb.52.1409205203040; Wed, 27 Aug 2014 22:53:23 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id oz2si4047100pbc.237.2014.08.27.22.53.22 for ; Wed, 27 Aug 2014 22:53:23 -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 S934221AbaH1FxV (ORCPT + 5 others); 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-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: 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.220.180 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 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)); }