From patchwork Fri Apr 17 23:49:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lina Iyer X-Patchwork-Id: 47304 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 19D9A20553 for ; Fri, 17 Apr 2015 23:49:37 +0000 (UTC) Received: by wgtl5 with SMTP id l5sf27510019wgt.1 for ; Fri, 17 Apr 2015 16:49:36 -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=fI1yVqgtt2Pn/Uwi9P6kcX5dER4y2OaDg9Rxg4tLk0U=; b=Mk2CUVZkLTEqxJIzo7uNIdRaarg4vdKO7Qcnd9d7E+hGX5PFE/xpz1IXEI4ixyMQQz cbccuDat+7MqbED0GH2otr8oCTAPZH2k2kVlMOg2sidEc6yfp/YUKLNPI3TwpGd3DjTk PXfg/MYLvY78mRVVF74CdqYOfqTulU2Bggzvs36wRYl0A1WA0J3eCJJtmkWihasnlrSq d9Jkwe87u218b/+56+2nzxyC1KmgarBMk02zHx9fm9N6dCM62LfwqAl0j0WWWwaHSefV 5JvmMlrlujcT+SScvg94a5sfz6ddjY1Oy39QmP9ZeNOI7F90pIm03paPVBC3wRLnxlyv 49gQ== X-Gm-Message-State: ALoCoQlpKKW/9+4easeuprnlfNDQ9Yw4BATn1H3gdKcQp0LwtgFJHa+NO2nQ3YbS9Zb4XiLWbJm7 X-Received: by 10.112.53.102 with SMTP id a6mr2570403lbp.16.1429314576366; Fri, 17 Apr 2015 16:49:36 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.18.225 with SMTP id z1ls612884lad.109.gmail; Fri, 17 Apr 2015 16:49:36 -0700 (PDT) X-Received: by 10.112.41.236 with SMTP id i12mr6468232lbl.14.1429314576221; Fri, 17 Apr 2015 16:49:36 -0700 (PDT) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com. [209.85.217.178]) by mx.google.com with ESMTPS id j2si9818215lam.114.2015.04.17.16.49.35 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Apr 2015 16:49:35 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) client-ip=209.85.217.178; Received: by lbbqq2 with SMTP id qq2so94214309lbb.3 for ; Fri, 17 Apr 2015 16:49:35 -0700 (PDT) X-Received: by 10.152.36.161 with SMTP id r1mr6398738laj.88.1429314575824; Fri, 17 Apr 2015 16:49:35 -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.67.65 with SMTP id l1csp262481lbt; Fri, 17 Apr 2015 16:49:34 -0700 (PDT) X-Received: by 10.68.132.194 with SMTP id ow2mr9471662pbb.51.1429314567597; Fri, 17 Apr 2015 16:49:27 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id by2si18511564pbb.237.2015.04.17.16.49.26; Fri, 17 Apr 2015 16:49:27 -0700 (PDT) Received-SPF: none (google.com: linux-pm-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 S1753582AbbDQXtZ (ORCPT + 11 others); Fri, 17 Apr 2015 19:49:25 -0400 Received: from mail-pa0-f43.google.com ([209.85.220.43]:33594 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753251AbbDQXtZ (ORCPT ); Fri, 17 Apr 2015 19:49:25 -0400 Received: by paboj16 with SMTP id oj16so140450965pab.0 for ; Fri, 17 Apr 2015 16:49:24 -0700 (PDT) X-Received: by 10.70.128.9 with SMTP id nk9mr9574316pdb.58.1429314564782; Fri, 17 Apr 2015 16:49:24 -0700 (PDT) Received: from ubuntu.localdomain (i-global254.qualcomm.com. [199.106.103.254]) by mx.google.com with ESMTPSA id hv7sm11157144pdb.86.2015.04.17.16.49.21 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 17 Apr 2015 16:49:23 -0700 (PDT) From: Lina Iyer To: arnd@arndb.de, catalin.marinas@arm.com, mark.rutland@arm.com, Will.Deacon@arm.com, lorenzo.pieralisi@arm.com Cc: 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, msivasub@codeaurora.org, agross@codeaurora.org, mlocke@codeaurora.org, bryanh@codeaurora.org, Lina Iyer Subject: [PATCH RFC 2/7] arm64: qcom: Add SPM driver support for ARM and ARM64 Date: Fri, 17 Apr 2015 17:49:04 -0600 Message-Id: <1429314549-6730-3-git-send-email-lina.iyer@linaro.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1429314549-6730-1-git-send-email-lina.iyer@linaro.org> References: <1429314549-6730-1-git-send-email-lina.iyer@linaro.org> Sender: linux-pm-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-pm@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.217.178 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: , The SAW power controller can be used with both ARM v7 and v8 cpus. The driver registers with the cpuidle framework as a provider of idle entry points for all idle states. Certain aspects of cpuidle callback registration are different been ARM and ARM64 variants. Use compile time definitions to use appropriate idle and registration functions. Signed-off-by: Lina Iyer --- drivers/soc/qcom/cpu_ops.c | 5 +++++ drivers/soc/qcom/spm.c | 12 +++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/soc/qcom/cpu_ops.c b/drivers/soc/qcom/cpu_ops.c index d831cb0..363147c 100644 --- a/drivers/soc/qcom/cpu_ops.c +++ b/drivers/soc/qcom/cpu_ops.c @@ -32,6 +32,9 @@ #include #include +extern int qcom_idle_enter(unsigned long index); +extern int qcom_cpuidle_init(struct device_node *cpu_node, u32 cpu); + static DEFINE_RAW_SPINLOCK(boot_lock); DEFINE_PER_CPU(int, cold_boot_done); @@ -339,5 +342,7 @@ static const struct cpu_operations msm_cortex_a_ops = { .cpu_prepare = msm_cpu_prepare, .cpu_boot = msm_cpu_boot, .cpu_postboot = msm_cpu_postboot, + .cpu_suspend = qcom_idle_enter, + .cpu_init_idle = qcom_cpuidle_init, }; CPU_METHOD_OF_DECLARE(msm_cortex_a_ops, &msm_cortex_a_ops); diff --git a/drivers/soc/qcom/spm.c b/drivers/soc/qcom/spm.c index 5d0dd8c..b66d86c 100644 --- a/drivers/soc/qcom/spm.c +++ b/drivers/soc/qcom/spm.c @@ -29,6 +29,7 @@ #include #include #include +#include #define MAX_PMIC_DATA 2 #define MAX_SEQ_DATA 64 @@ -185,7 +186,11 @@ static int qcom_cpu_spc(int cpu) struct spm_driver_data *drv = per_cpu(cpu_spm_drv, cpu); spm_set_low_power_mode(drv, PM_SLEEP_MODE_SPC); +#if defined (CONFIG_ARCH_ARM) ret = cpu_suspend(0, qcom_pm_collapse); +#else + ret = __cpu_suspend(0, qcom_pm_collapse); +#endif /* * ARM common code executes WFI without calling into our driver and * if the SPM mode is not reset, then we may accidently power down the @@ -197,7 +202,7 @@ static int qcom_cpu_spc(int cpu) return ret; } -static int qcom_idle_enter(unsigned long index) +int qcom_idle_enter(unsigned long index) { int cpu = smp_processor_id(); return per_cpu(qcom_idle_ops, cpu)[index](cpu); @@ -208,7 +213,7 @@ static const struct of_device_id qcom_idle_state_match[] __initconst = { { }, }; -static int __init qcom_cpuidle_init(struct device_node *cpu_node, u32 cpu) +int __init qcom_cpuidle_init(struct device_node *cpu_node, u32 cpu) { const struct of_device_id *match_id; struct device_node *state_node; @@ -275,13 +280,14 @@ check_spm: return per_cpu(cpu_spm_drv, cpu) ? 0 : -ENXIO; } +#if defined (CONFIG_ARCH_ARM) static struct cpuidle_ops qcom_cpuidle_ops __initdata = { .suspend = qcom_idle_enter, .init = qcom_cpuidle_init, }; - CPUIDLE_METHOD_OF_DECLARE(qcom_idle_v1, "qcom,kpss-acc-v1", &qcom_cpuidle_ops); CPUIDLE_METHOD_OF_DECLARE(qcom_idle_v2, "qcom,kpss-acc-v2", &qcom_cpuidle_ops); +#endif static struct spm_driver_data *spm_get_drv(struct platform_device *pdev, int *spm_cpu)