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: 6236001 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D72C0BF4A6 for ; Fri, 17 Apr 2015 23:52:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EC9412039D for ; Fri, 17 Apr 2015 23:52:42 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0543B20397 for ; Fri, 17 Apr 2015 23:52:42 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YjG1e-0007Eg-JF; Fri, 17 Apr 2015 23:50:22 +0000 Received: from mail-pa0-f42.google.com ([209.85.220.42]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YjG13-0005xr-Of for linux-arm-kernel@lists.infradead.org; Fri, 17 Apr 2015 23:49:46 +0000 Received: by pacyx8 with SMTP id yx8so140254214pac.1 for ; Fri, 17 Apr 2015 16:49: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:from:to:cc:subject:date:message-id:in-reply-to :references; bh=GpJtSUpxf9HGpds5LkWWPE106iIiVkIsSAkCHohtk74=; b=dRWD3gShCJii6w/hpdqTnhXrbE8cVQ+o1qRs1etbtzVtoGLFufK0NUEUd7W6f83pX8 SXA2okep0geicF9IRJ4o2rd75sliLpzZ3hprLRzdxYyjL4hl32xby5U4VM5R91k4wbZv D0thizftBn9npb7i7FwPDtIuHQGizqp3Es1TlD5NEOiQ+AIaW/nzVd9l3Qhxm5Pa7DEJ BwNCrORw+yHcwSXcoOLuRUHyldp0SDr2b+gyoxsCkNERUOr35nXjV55lZz1gkzQIKDyH RYzZdKfrNUAtKsD7IjuseaVsFTrsSUCdoGRbZaCzD55N+8PQxxcQpXHG64gp5p16EiQV 1bLw== X-Gm-Message-State: ALoCoQlq1/xmz9Gnbk9K5ivLVEPIXv9aCG5d1nct7e1fOvSbzE3CsuZQat47JXRSUDCUDHp9B6mv 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150417_164945_859941_4FC7BB44 X-CRM114-Status: GOOD ( 11.91 ) X-Spam-Score: -0.7 (/) Cc: khilman@linaro.org, mlocke@codeaurora.org, linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org, daniel.lezcano@linaro.org, sboyd@codeaurora.org, msivasub@codeaurora.org, bryanh@codeaurora.org, Lina Iyer , galak@codeaurora.org, linux-arm-kernel@lists.infradead.org, agross@codeaurora.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 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)