From patchwork Fri Aug 8 04:05:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lina Iyer X-Patchwork-Id: 4693571 Return-Path: X-Original-To: patchwork-linux-arm-msm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 75B5FC0338 for ; Fri, 8 Aug 2014 04:05:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A37712017D for ; Fri, 8 Aug 2014 04:05:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C85E22018A for ; Fri, 8 Aug 2014 04:05:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752787AbaHHEFo (ORCPT ); Fri, 8 Aug 2014 00:05:44 -0400 Received: from mail-pd0-f173.google.com ([209.85.192.173]:45331 "EHLO mail-pd0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752761AbaHHEFn (ORCPT ); Fri, 8 Aug 2014 00:05:43 -0400 Received: by mail-pd0-f173.google.com with SMTP id w10so6323965pde.18 for ; Thu, 07 Aug 2014 21:05:43 -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=o9XeQKnufmLQ1mA8RH/0rmVFKCS78jPYSWtdQ/8OI4w=; b=B6PveLheLs85yQ/39WyppFHkBc2NajlrlvChlOjHAwRgoBZCA8rBxp10h2juYZs0dN legJPdtY/2YNqzz0TkZ7se7kykSDJAvgpGaG9y5RhqI05OT830iWz6UCNTzsQQQrIqtB xxwMNVmWY29/noKqv72/zjUxqp3SMPAcVkvoh1OQpoqGsHbZxMVr04cat5LtwAUG9MRB PSD3Sx2bZv0eilRvQuh/s+8ukUbBS8ysIkuaaxGceStv/AzBCGcdLV64GCEuLFAAb6D7 Uu1j4EQPm/wNruiNayGTZjNmeolx6RRYHCZrtprhKZuK8R1oYpB9AU+8/OP0BkGj2N2i JLbw== X-Gm-Message-State: ALoCoQnkAUZnW4Gh5UanVgNYY/mGKd3iLcSe4WNBxyHy/uG4qoAkUrGyBtlPNzkVGUDnC4gBgSoH X-Received: by 10.70.92.81 with SMTP id ck17mr21531533pdb.2.1407470743205; Thu, 07 Aug 2014 21:05:43 -0700 (PDT) Received: from localhost.localdomain (c-24-8-37-141.hsd1.co.comcast.net. [24.8.37.141]) by mx.google.com with ESMTPSA id n8sm2163342pdm.22.2014.08.07.21.05.41 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 07 Aug 2014 21:05:42 -0700 (PDT) From: Lina Iyer To: daniel.lezcano@linaro.org, khilman@linaro.org, amit.kucheria@linaro.org, sboyd@codeaurora.org, davidb@codeaurora.org, galak@codeaurora.org, linux-arm-msm@vger.kernel.org Cc: msivasub@codeaurora.org, bryanh@codeaurora.org, Lina Iyer Subject: [RFC] [PATCH 06/13] qcom: msm-pm: Add support for hotplug and secondary startup Date: Thu, 7 Aug 2014 22:05:15 -0600 Message-Id: <1407470722-23015-7-git-send-email-lina.iyer@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1407470722-23015-1-git-send-email-lina.iyer@linaro.org> References: <1407470722-23015-1-git-send-email-lina.iyer@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 Add hotplug and secondary startup entry point to cold or warm boot secondary cpus. Signed-off-by: Mahesh Sivasubramanian Signed-off-by: Lina Iyer --- drivers/soc/qcom/msm-pm.c | 36 ++++++++++++++++++++++++++++++++++++ include/soc/qcom/pm.h | 4 ++++ 2 files changed, 40 insertions(+) diff --git a/drivers/soc/qcom/msm-pm.c b/drivers/soc/qcom/msm-pm.c index 17a7c8c..4a6471d 100644 --- a/drivers/soc/qcom/msm-pm.c +++ b/drivers/soc/qcom/msm-pm.c @@ -216,3 +216,39 @@ bool msm_cpu_pm_enter_sleep(enum msm_pm_sleep_mode mode, bool from_idle) return exit_stat; } EXPORT_SYMBOL(msm_cpu_pm_enter_sleep); + +/** + * msm_pm_cpu_hotplug_enter - Entry point for SoC hotplug interface + * Set up cores to enter deeper sleep modes than just clock gating + * Find the best deepest low power mode that can enter + * + * @cpu - The cpu that is being hotplugged off + */ +int msm_pm_cpu_hotplug_enter(unsigned int cpu) +{ + enum msm_pm_sleep_mode mode = MSM_PM_SLEEP_MODE_NR; + int ret; + + if (msm_spm_is_mode_avail(MSM_SPM_MODE_POWER_COLLAPSE)) + mode = MSM_PM_SLEEP_MODE_POWER_COLLAPSE; + else if (msm_spm_is_mode_avail( MSM_SPM_MODE_RETENTION)) + mode = MSM_PM_SLEEP_MODE_RETENTION; + else + mode = MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT; + + ret = msm_cpu_pm_enter_sleep(mode, false) ? 0 : -EFAULT; + + return ret; +} +EXPORT_SYMBOL(msm_pm_cpu_hotplug_enter); + +/** + * msm_pm_secondary_startup() - Restore after hotplug resume + * + * @ cpu: the cpu thats coming up. + */ +int msm_pm_secondary_startup(unsigned int cpu) +{ + return msm_spm_set_low_power_mode(MSM_SPM_MODE_CLOCK_GATING, false); +} +EXPORT_SYMBOL(msm_pm_secondary_startup); diff --git a/include/soc/qcom/pm.h b/include/soc/qcom/pm.h index 01872ad..ed6124a 100644 --- a/include/soc/qcom/pm.h +++ b/include/soc/qcom/pm.h @@ -30,10 +30,14 @@ enum msm_pm_l2_scm_flag { #ifdef CONFIG_QCOM_PM bool msm_cpu_pm_enter_sleep(enum msm_pm_sleep_mode mode, bool from_idle); +int msm_pm_cpu_hotplug_enter(unsigned int cpu); +int msm_pm_secondary_startup(unsigned int cpu); #else static inline bool msm_cpu_pm_enter_sleep(enum msm_pm_sleep_mode mode, bool from_idle) { return true; } +static inline int msm_pm_cpu_hotplug_enter(unsigned int cpu) { return 0; } +static inline int msm_pm_secondary_startup(unsigned int cpu) { return 0; } #endif #endif /* __QCOM_PM_H */