From patchwork Tue Mar 17 22:33:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lina Iyer X-Patchwork-Id: 45903 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0BF082157E for ; Tue, 17 Mar 2015 22:34:43 +0000 (UTC) Received: by wghk14 with SMTP id k14sf4202992wgh.3 for ; Tue, 17 Mar 2015 15:34:42 -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:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=YRgl6pb0QMXuzbyTM8xI5ZMhp8UpJtbrMs7t+G7G8LA=; b=YdPVvA0mn0A9hdfeDuFOXHBGQz42UZZwLydbYqo2qH+SOmdBRcmSFNAiO05Urzy7F0 00E9vesqpfX5buqdeVJil6K8aZ7RFwdj9+106iY0wdbtbkmV0dcDfFc9WxtRwb1N0Zxu kTGdEwEurQvMrsJCQSJWSu4iX/4J7ZwpnVq9ceiUBtGMbneeRN9GF50yEO4mv/LQD1YI 2sqCwZjuMYVpPQvKf5ERRjxn3HgBkHCw4XwabXr4X6IFzrEFLXF2+yN2bLU5TScZ+Fdl Epcf6a94N+Mv7p9rX+OrzwjmCXum4C2Sb9LHeP0SRNOzdG1HAHI49ujvBAiR91+rOgOW 9E/Q== X-Gm-Message-State: ALoCoQmTybVw8x+KgKD0oMa5bhemhic8mIxdFs7gXAF7N/TIiE/8P9fJtpRAm/KOTA2NsC58YS4Z X-Received: by 10.112.162.135 with SMTP id ya7mr10362569lbb.14.1426631682320; Tue, 17 Mar 2015 15:34:42 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.180.88.98 with SMTP id bf2ls183761wib.30.gmail; Tue, 17 Mar 2015 15:34:42 -0700 (PDT) X-Received: by 10.112.26.209 with SMTP id n17mr56465939lbg.84.1426631681988; Tue, 17 Mar 2015 15:34:41 -0700 (PDT) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com. [209.85.215.41]) by mx.google.com with ESMTPS id v5si11540735laj.98.2015.03.17.15.34.41 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Mar 2015 15:34:41 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) client-ip=209.85.215.41; Received: by lamx15 with SMTP id x15so21495363lam.3 for ; Tue, 17 Mar 2015 15:34:41 -0700 (PDT) X-Received: by 10.112.201.231 with SMTP id kd7mr41609207lbc.35.1426631681794; Tue, 17 Mar 2015 15:34:41 -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.112.35.133 with SMTP id h5csp797742lbj; Tue, 17 Mar 2015 15:34:40 -0700 (PDT) X-Received: by 10.70.90.233 with SMTP id bz9mr74657440pdb.47.1426631672183; Tue, 17 Mar 2015 15:34:32 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f2si31927613pas.167.2015.03.17.15.34.31; Tue, 17 Mar 2015 15:34:32 -0700 (PDT) Received-SPF: none (google.com: devicetree-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 S932560AbbCQWe1 (ORCPT + 5 others); Tue, 17 Mar 2015 18:34:27 -0400 Received: from mail-pa0-f51.google.com ([209.85.220.51]:36568 "EHLO mail-pa0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932523AbbCQWe0 (ORCPT ); Tue, 17 Mar 2015 18:34:26 -0400 Received: by padcy3 with SMTP id cy3so22199161pad.3 for ; Tue, 17 Mar 2015 15:34:26 -0700 (PDT) X-Received: by 10.66.249.68 with SMTP id ys4mr4708129pac.82.1426631666165; Tue, 17 Mar 2015 15:34:26 -0700 (PDT) Received: from ubuntu.localdomain (i-global254.qualcomm.com. [199.106.103.254]) by mx.google.com with ESMTPSA id n10sm11749880pdk.68.2015.03.17.15.34.24 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 Mar 2015 15:34:25 -0700 (PDT) From: Lina Iyer To: daniel.lezcano@linaro.org, khilman@linaro.org, sboyd@codeaurora.org, galak@codeaurora.org, linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: lorenzo.pieralisi@arm.com, msivasub@codeaurora.org, devicetree@vger.kernel.org, agross@codeaurora.org, Lina Iyer Subject: [PATCH v16 01/11] ARM: cpuidle: Register per cpuidle device Date: Tue, 17 Mar 2015 16:33:41 -0600 Message-Id: <1426631631-56937-2-git-send-email-lina.iyer@linaro.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1426631631-56937-1-git-send-email-lina.iyer@linaro.org> References: <1426631631-56937-1-git-send-email-lina.iyer@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: devicetree@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: lina.iyer@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.215.41 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: , From: Daniel Lezcano Some architectures have some cpus which does not support idle states or may be ready to do idle states only when the platform dependencies are probed. Let the underlying low level code return -ENOSYS when it is not possible to set an idle state at this time. Signed-off-by: Daniel Lezcano Signed-off-by: Lina Iyer [Minor clean ups] --- drivers/cpuidle/cpuidle-arm.c | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/drivers/cpuidle/cpuidle-arm.c b/drivers/cpuidle/cpuidle-arm.c index 1c94b88..e176469 100644 --- a/drivers/cpuidle/cpuidle-arm.c +++ b/drivers/cpuidle/cpuidle-arm.c @@ -17,6 +17,9 @@ #include #include #include +#include +#include +#include #include @@ -93,6 +96,7 @@ static const struct of_device_id arm_idle_state_match[] __initconst = { static int __init arm_idle_init(void) { int cpu, ret; + struct cpuidle_device *dev; struct cpuidle_driver *drv = &arm_idle_driver; /* @@ -105,18 +109,49 @@ static int __init arm_idle_init(void) if (ret <= 0) return ret ? : -ENODEV; + + ret = cpuidle_register_driver(drv); + if (ret) { + pr_err("Failed to register cpuidle driver\n"); + return ret; + } + /* * Call arch CPU operations in order to initialize * idle states suspend back-end specific data */ for_each_possible_cpu(cpu) { ret = arm_cpuidle_init(cpu); + + /* + * -ENOSYS: Either the platform driver shall register + * a cpuidle device for this cpu, or there are no + * supported idle states. + */ + if (ret == -ENOSYS) + continue; + if (ret) { - pr_err("CPU %d failed to init idle CPU ops\n", cpu); + pr_err("CPU %d failed to init idle CPU ops, err=%d\n", + cpu, ret); return ret; } + + dev = devm_kzalloc(get_cpu_device(cpu), sizeof(*dev), + GFP_KERNEL); + if (!dev) + return -ENOMEM; + + dev->cpu = cpu; + ret = cpuidle_register_device(dev); + if (ret) { + pr_err("Failed to register cpuidle device for CPU %d, err=%d\n", + cpu, ret); + kfree(dev); + continue; + } } - return cpuidle_register(drv, NULL); + return ret; } device_initcall(arm_idle_init);