From patchwork Thu May 19 05:00:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Gross X-Patchwork-Id: 68075 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp2994901qge; Wed, 18 May 2016 22:00:43 -0700 (PDT) X-Received: by 10.66.153.105 with SMTP id vf9mr16577215pab.47.1463634041886; Wed, 18 May 2016 22:00:41 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ur4si17170972pab.237.2016.05.18.22.00.41; Wed, 18 May 2016 22:00:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751775AbcESFAk (ORCPT + 8 others); Thu, 19 May 2016 01:00:40 -0400 Received: from mail-oi0-f41.google.com ([209.85.218.41]:35704 "EHLO mail-oi0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751610AbcESFAj (ORCPT ); Thu, 19 May 2016 01:00:39 -0400 Received: by mail-oi0-f41.google.com with SMTP id x19so111190446oix.2 for ; Wed, 18 May 2016 22:00:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=I8Zayg1ognZPllB4A7U6grN+01+J16XIDGxBK0O0xCc=; b=SKAEqHIamhqBYDMTSonWDtkUjLojtBqreBuJ+jkGvUtSRjFySeaXXpUQbrROi0D3gb wOaCkqCbrRHCuYjbz0BLIi1QDJaY5bdy+SIbmy+3+eEZY3zEzb7FFQYqIyZBs5pt7okh W1qzfqlSj+aNKw+/3vp5ixA4jHQUwLW7nJnXg= 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=I8Zayg1ognZPllB4A7U6grN+01+J16XIDGxBK0O0xCc=; b=MYZLclO5Db+nt1wBxDf9iF/PR/4rif7G4uIyg9PRWfMHmY1XqBrm4sliyx/eJu6uJR 9gMu45Z9zjlsJKrP2xFjQSRy9mdBVpZY0jFWPF/2cQifDL7z8jFwsFgt2jyotiw17nGd RnLE/p+ZgYi5w/VilK/4aOd8+sLoXs0RAFwmEnAX02BIDr/HWh1xZFDHJjlB06ni+Usv ECnFuDeevyruLE4amKTvC0j63xt64ewk3KaTfTAOnaZUaenfPkIIC1m8oSUd0k6uWXUz gbkl5bu8TdMXMoQq1w1snNPhNRkS9snukduvGUDaNYS02PgXZGBsqr2qFCS82DkASQhz dTcw== X-Gm-Message-State: AOPr4FWdWk0NadvA0q7gougPID3bSJi464I+oFHeddxj42IfpSg86D7l5sRLY3sv5hJgGymU X-Received: by 10.157.14.236 with SMTP id 99mr6274427otj.83.1463634038900; Wed, 18 May 2016 22:00:38 -0700 (PDT) Received: from localhost ([2602:306:c558:19b0:a405:4675:28db:e07c]) by smtp.gmail.com with ESMTPSA id d75sm3446371oig.15.2016.05.18.22.00.38 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 18 May 2016 22:00:38 -0700 (PDT) From: Andy Gross To: linux-pm@vger.kernel.org Cc: linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, stanimir.varbanov@linaro.org, Andy Gross Subject: [PATCH 1/5] soc: qcom: Add suspend to idle support Date: Thu, 19 May 2016 00:00:16 -0500 Message-Id: <1463634020-17252-2-git-send-email-andy.gross@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1463634020-17252-1-git-send-email-andy.gross@linaro.org> References: <1463634020-17252-1-git-send-email-andy.gross@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org This patch adds suspend to idle support for Qualcomm processors. While suspend to memory will be a valid state, there won't be any special handling or power savings over the suspend to idle. Signed-off-by: Andy Gross --- drivers/soc/qcom/Makefile | 1 + drivers/soc/qcom/suspend.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 drivers/soc/qcom/suspend.c -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/soc/qcom/Makefile b/drivers/soc/qcom/Makefile index fdd664e..7c479d3 100644 --- a/drivers/soc/qcom/Makefile +++ b/drivers/soc/qcom/Makefile @@ -7,3 +7,4 @@ obj-$(CONFIG_QCOM_SMEM_STATE) += smem_state.o obj-$(CONFIG_QCOM_SMP2P) += smp2p.o obj-$(CONFIG_QCOM_SMSM) += smsm.o obj-$(CONFIG_QCOM_WCNSS_CTRL) += wcnss_ctrl.o +obj-$(CONFIG_SUSPEND) += suspend.o diff --git a/drivers/soc/qcom/suspend.c b/drivers/soc/qcom/suspend.c new file mode 100644 index 0000000..7d3f2dd --- /dev/null +++ b/drivers/soc/qcom/suspend.c @@ -0,0 +1,77 @@ +/* + * (C) Copyright 2016 Linaro Ltd. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; version 2 + * of the License. + */ +#include +#include +#include +#include + + +static void qcom_pm_enter_freeze(struct cpuidle_device *dev, + struct cpuidle_driver *drv, + int index) +{ + drv->states[index].enter(dev, drv, index); +} + +static const struct of_device_id qcom_idle_state_match[] = { + { .compatible = "qcom,idle-state-spc", }, + { }, +}; + +static const struct platform_suspend_ops qcom_suspend_ops = { + .valid = suspend_valid_only_mem, +}; + +static int __init qcom_pm_init(void) +{ + struct cpuidle_device *cpu_dev; + struct cpuidle_driver *cpu_drv; + int state_count; + struct device_node *state_np, *cpu_np; + const struct of_device_id *match; + int i; + + /* configure CPU enter_freeze if applicable */ + for_each_present_cpu(i) { + cpu_np = of_get_cpu_node(i, NULL); + cpu_dev = per_cpu_ptr(cpuidle_devices, i); + cpu_drv = cpuidle_get_cpu_driver(cpu_dev); + + if (!cpu_dev || !cpu_drv) { + of_node_put(cpu_np); + return -EPROBE_DEFER; + } + + state_count = 0; + state_np = of_parse_phandle(cpu_np, "cpu-idle-states", + state_count); + + while (state_np) { + match = of_match_node(qcom_idle_state_match, + state_np); + + state_count++; + if (match) + cpu_drv->states[state_count].enter_freeze = + &qcom_pm_enter_freeze; + of_node_put(state_np); + + state_np = of_parse_phandle(cpu_np, "cpu-idle-states", + state_count); + } + + of_node_put(cpu_np); + } + + suspend_set_ops(&qcom_suspend_ops); + + return 0; +} + +late_initcall(qcom_pm_init);