From: Lina Iyer <lina.iyer@linaro.org>
To: Stephen Boyd <sboyd@codeaurora.org>
Cc: daniel.lezcano@linaro.org, khilman@linaro.org,
galak@codeaurora.org, linux-arm-msm@vger.kernel.org,
linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
lorenzo.pieralisi@arm.com, msivasub@codeaurora.org
Subject: Re: [PATCH v7 4/7] qcom: pm: Add cpu low power mode functions
Date: Tue, 30 Sep 2014 10:03:10 -0600 [thread overview]
Message-ID: <20140930160310.GC528@ilina-mac.local> (raw)
In-Reply-To: <5429ED1D.5060809@codeaurora.org>
On Mon, Sep 29 2014 at 17:37 -0600, Stephen Boyd wrote:
>On 09/26/14 17:58, Lina Iyer wrote:
>> Based on work by many authors, available at codeaurora.org
>>
>
>> Signed-off-by: Lina Iyer <lina.iyer@linaro.org>
>> [lina: simplify the driver for an initial submission, add commit text
>> description of idle states]
>
>Maintainer tags don't really make sense unless there is another author.
>
Hmm.. Since this patch is a derivative work, I wanted to clarify, what
changed seems important. The work was done by many authors. Adding
signed-off from everybody who could have contributed to the patch
downstream is confusing.
I would be okay removing it.
> +
[...]
>> +static int qcom_pm_collapse(unsigned long int unused)
>> +{
>> + int ret;
>> + u32 flag;
>> +
>> + ret = set_up_boot_address(cpu_resume, raw_smp_processor_id());
>
>Preemption better be off here, so why are we using raw_smp_processor_id()?
>
True, so raw_ returns without premeption disable, no?
>> + if (ret) {
>> + pr_err("Failed to set warm boot address for cpu %d\n",
>> + raw_smp_processor_id());
>
>Stuff cpu into a local variable?
>
Yeah
>> + return ret;
>> + }
>> +
>> + flag = SCM_L2_ON & SCM_FLUSH_FLAG_MASK;
>> + scm_call_atomic1(SCM_SVC_BOOT, SCM_CMD_TERMINATE_PC, flag);
>> +
>> + return 0;
>> +}
>> +
>> +/**
>> + * qcom_cpu_pm_enter_sleep(): Enter a low power mode on current cpu
>> + *
>> + * @mode - sleep mode to enter
>> + *
>> + * The code should be called with interrupts disabled and on the core on
>> + * which the low power mode is to be executed.
>> + *
>> + */
>> +static int qcom_cpu_pm_enter_sleep(enum pm_sleep_mode mode)
>> +{
>> + int ret;
>> +
>> + switch (mode) {
>> + case PM_SLEEP_MODE_SPC:
>> + qcom_spm_set_low_power_mode(SPM_MODE_POWER_COLLAPSE);
>
>Isn't it a one-to-one between PM_SLEEP_MODE_SPC and
>SPM_MODE_POWER_COLLAPSE? The enum to enum map seems overly complicated.
>
Not really. SPM modes, differ when the idle state has to notify RPM. It
does not have 2 enums for those modes, but uses an overloaded enum with
an additional flag.
>> + ret = cpu_suspend(0, qcom_pm_collapse);
>> + break;
>> + default:
>> + case PM_SLEEP_MODE_WFI:
>> + qcom_spm_set_low_power_mode(SPM_MODE_CLOCK_GATING);
>> + ret = cpu_do_idle();
>> + break;
>> + }
>> +
>> + local_irq_enable();
>> +
>> + return ret;
>> +}
>> +
>> +static struct platform_device qcom_cpuidle_device = {
>> + .name = "qcom_cpuidle",
>> + .id = -1,
>> + .dev.platform_data = qcom_cpu_pm_enter_sleep,
>> +};
>
>This doesn't need to be static. Use platform_device_register_full() instead.
>
Okay
>> +
>> +static int __init qcom_pm_device_init(void)
>> +{
>> + platform_device_register(&qcom_cpuidle_device);
>> +
>> + return 0;
>> +}
>> +device_initcall(qcom_pm_device_init);
>
>modules?
>
Why? An earlier initialization helps with power saving
>> diff --git a/include/soc/qcom/pm.h b/include/soc/qcom/pm.h
>> new file mode 100644
>> index 0000000..563b9c3
>> --- /dev/null
>> +++ b/include/soc/qcom/pm.h
>> @@ -0,0 +1,26 @@
>> +/*
>> + * Copyright (c) 2009-2014, The Linux Foundation. All rights reserved.
>> + *
>> + * This software is licensed under the terms of the GNU General Public
>> + * License version 2, as published by the Free Software Foundation, and
>> + * may be copied, distributed, and modified under those terms.
>> + *
>> + * This program is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
>> + * GNU General Public License for more details.
>> + *
>> + */
>> +
>> +#ifndef __QCOM_PM_H
>> +#define __QCOM_PM_H
>> +
>> +enum pm_sleep_mode {
>> + PM_SLEEP_MODE_WFI,
>> + PM_SLEEP_MODE_RET,
>> + PM_SLEEP_MODE_SPC,
>> + PM_SLEEP_MODE_PC,
>> + PM_SLEEP_MODE_NR,
>> +};
>> +
>> +#endif /* __QCOM_PM_H */
>
>Hopefully this header is not necessary.
>
>--
>Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
>hosted by The Linux Foundation
>
WARNING: multiple messages have this Message-ID (diff)
From: lina.iyer@linaro.org (Lina Iyer)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v7 4/7] qcom: pm: Add cpu low power mode functions
Date: Tue, 30 Sep 2014 10:03:10 -0600 [thread overview]
Message-ID: <20140930160310.GC528@ilina-mac.local> (raw)
In-Reply-To: <5429ED1D.5060809@codeaurora.org>
On Mon, Sep 29 2014 at 17:37 -0600, Stephen Boyd wrote:
>On 09/26/14 17:58, Lina Iyer wrote:
>> Based on work by many authors, available at codeaurora.org
>>
>
>> Signed-off-by: Lina Iyer <lina.iyer@linaro.org>
>> [lina: simplify the driver for an initial submission, add commit text
>> description of idle states]
>
>Maintainer tags don't really make sense unless there is another author.
>
Hmm.. Since this patch is a derivative work, I wanted to clarify, what
changed seems important. The work was done by many authors. Adding
signed-off from everybody who could have contributed to the patch
downstream is confusing.
I would be okay removing it.
> +
[...]
>> +static int qcom_pm_collapse(unsigned long int unused)
>> +{
>> + int ret;
>> + u32 flag;
>> +
>> + ret = set_up_boot_address(cpu_resume, raw_smp_processor_id());
>
>Preemption better be off here, so why are we using raw_smp_processor_id()?
>
True, so raw_ returns without premeption disable, no?
>> + if (ret) {
>> + pr_err("Failed to set warm boot address for cpu %d\n",
>> + raw_smp_processor_id());
>
>Stuff cpu into a local variable?
>
Yeah
>> + return ret;
>> + }
>> +
>> + flag = SCM_L2_ON & SCM_FLUSH_FLAG_MASK;
>> + scm_call_atomic1(SCM_SVC_BOOT, SCM_CMD_TERMINATE_PC, flag);
>> +
>> + return 0;
>> +}
>> +
>> +/**
>> + * qcom_cpu_pm_enter_sleep(): Enter a low power mode on current cpu
>> + *
>> + * @mode - sleep mode to enter
>> + *
>> + * The code should be called with interrupts disabled and on the core on
>> + * which the low power mode is to be executed.
>> + *
>> + */
>> +static int qcom_cpu_pm_enter_sleep(enum pm_sleep_mode mode)
>> +{
>> + int ret;
>> +
>> + switch (mode) {
>> + case PM_SLEEP_MODE_SPC:
>> + qcom_spm_set_low_power_mode(SPM_MODE_POWER_COLLAPSE);
>
>Isn't it a one-to-one between PM_SLEEP_MODE_SPC and
>SPM_MODE_POWER_COLLAPSE? The enum to enum map seems overly complicated.
>
Not really. SPM modes, differ when the idle state has to notify RPM. It
does not have 2 enums for those modes, but uses an overloaded enum with
an additional flag.
>> + ret = cpu_suspend(0, qcom_pm_collapse);
>> + break;
>> + default:
>> + case PM_SLEEP_MODE_WFI:
>> + qcom_spm_set_low_power_mode(SPM_MODE_CLOCK_GATING);
>> + ret = cpu_do_idle();
>> + break;
>> + }
>> +
>> + local_irq_enable();
>> +
>> + return ret;
>> +}
>> +
>> +static struct platform_device qcom_cpuidle_device = {
>> + .name = "qcom_cpuidle",
>> + .id = -1,
>> + .dev.platform_data = qcom_cpu_pm_enter_sleep,
>> +};
>
>This doesn't need to be static. Use platform_device_register_full() instead.
>
Okay
>> +
>> +static int __init qcom_pm_device_init(void)
>> +{
>> + platform_device_register(&qcom_cpuidle_device);
>> +
>> + return 0;
>> +}
>> +device_initcall(qcom_pm_device_init);
>
>modules?
>
Why? An earlier initialization helps with power saving
>> diff --git a/include/soc/qcom/pm.h b/include/soc/qcom/pm.h
>> new file mode 100644
>> index 0000000..563b9c3
>> --- /dev/null
>> +++ b/include/soc/qcom/pm.h
>> @@ -0,0 +1,26 @@
>> +/*
>> + * Copyright (c) 2009-2014, The Linux Foundation. All rights reserved.
>> + *
>> + * This software is licensed under the terms of the GNU General Public
>> + * License version 2, as published by the Free Software Foundation, and
>> + * may be copied, distributed, and modified under those terms.
>> + *
>> + * This program is distributed in the hope that it will be useful,
>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
>> + * GNU General Public License for more details.
>> + *
>> + */
>> +
>> +#ifndef __QCOM_PM_H
>> +#define __QCOM_PM_H
>> +
>> +enum pm_sleep_mode {
>> + PM_SLEEP_MODE_WFI,
>> + PM_SLEEP_MODE_RET,
>> + PM_SLEEP_MODE_SPC,
>> + PM_SLEEP_MODE_PC,
>> + PM_SLEEP_MODE_NR,
>> +};
>> +
>> +#endif /* __QCOM_PM_H */
>
>Hopefully this header is not necessary.
>
>--
>Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
>hosted by The Linux Foundation
>
next prev parent reply other threads:[~2014-09-30 16:03 UTC|newest]
Thread overview: 82+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-27 0:58 [PATCH v7 0/7] QCOM 8974 and 8084 cpuidle driver Lina Iyer
2014-09-27 0:58 ` Lina Iyer
2014-09-27 0:58 ` [PATCH v7 1/7] qcom: spm: Add Subsystem Power Manager driver Lina Iyer
2014-09-27 0:58 ` Lina Iyer
2014-09-27 8:07 ` Pramod Gurav
2014-09-27 8:07 ` Pramod Gurav
2014-09-29 10:29 ` Pramod Gurav
2014-09-29 10:29 ` Pramod Gurav
2014-09-29 23:19 ` Stephen Boyd
2014-09-29 23:19 ` Stephen Boyd
2014-09-30 16:27 ` Lina Iyer
2014-09-30 16:27 ` Lina Iyer
2014-09-30 17:26 ` Kevin Hilman
2014-09-30 17:26 ` Kevin Hilman
2014-09-30 21:18 ` Lina Iyer
2014-09-30 21:18 ` Lina Iyer
2014-09-27 0:58 ` [PATCH v7 2/7] arm: dts: qcom: Add SPM device bindings for 8974 Lina Iyer
2014-09-27 0:58 ` Lina Iyer
2014-09-29 23:02 ` Stephen Boyd
2014-09-29 23:02 ` Stephen Boyd
2014-09-27 0:58 ` [PATCH v7 3/7] arm: dts: qcom: Add SPM device bindings for 8084 Lina Iyer
2014-09-27 0:58 ` Lina Iyer
2014-09-30 17:31 ` Kevin Hilman
2014-09-30 17:31 ` Kevin Hilman
2014-09-27 0:58 ` [PATCH v7 4/7] qcom: pm: Add cpu low power mode functions Lina Iyer
2014-09-27 0:58 ` Lina Iyer
2014-09-27 8:22 ` Pramod Gurav
2014-09-27 8:22 ` Pramod Gurav
2014-09-29 23:37 ` Stephen Boyd
2014-09-29 23:37 ` Stephen Boyd
2014-09-30 16:03 ` Lina Iyer [this message]
2014-09-30 16:03 ` Lina Iyer
2014-09-30 17:35 ` Kevin Hilman
2014-09-30 17:35 ` Kevin Hilman
2014-10-02 0:10 ` Stephen Boyd
2014-10-02 0:10 ` Stephen Boyd
2014-10-02 9:50 ` Lorenzo Pieralisi
2014-10-02 9:50 ` Lorenzo Pieralisi
2014-10-06 17:10 ` Lina Iyer
2014-10-06 17:10 ` Lina Iyer
2014-09-27 0:58 ` [PATCH v7 5/7] qcom: cpuidle: Add cpuidle driver for QCOM cpus Lina Iyer
2014-09-27 0:58 ` Lina Iyer
2014-09-27 8:18 ` Pramod Gurav
2014-09-27 8:18 ` Pramod Gurav
2014-09-29 10:31 ` Pramod Gurav
2014-09-29 10:31 ` Pramod Gurav
2014-09-29 15:04 ` Lina Iyer
2014-09-29 15:04 ` Lina Iyer
2014-09-29 15:31 ` Lorenzo Pieralisi
2014-09-29 15:31 ` Lorenzo Pieralisi
2014-09-29 16:16 ` Lina Iyer
2014-09-29 16:16 ` Lina Iyer
2014-09-29 17:22 ` Lorenzo Pieralisi
2014-09-29 17:22 ` Lorenzo Pieralisi
2014-09-30 17:41 ` Kevin Hilman
2014-09-30 17:41 ` Kevin Hilman
2014-09-30 17:51 ` Nicolas Pitre
2014-09-30 17:51 ` Nicolas Pitre
2014-09-30 18:06 ` Kevin Hilman
2014-09-30 18:06 ` Kevin Hilman
2014-09-30 18:30 ` Nicolas Pitre
2014-09-30 18:30 ` Nicolas Pitre
2014-09-30 18:41 ` Kevin Hilman
2014-09-30 18:41 ` Kevin Hilman
2014-09-30 20:36 ` Lina Iyer
2014-09-30 20:36 ` Lina Iyer
2014-09-29 23:18 ` Stephen Boyd
2014-09-29 23:18 ` Stephen Boyd
2014-09-30 8:58 ` Lorenzo Pieralisi
2014-09-30 8:58 ` Lorenzo Pieralisi
2014-09-30 15:46 ` Lina Iyer
2014-09-30 15:46 ` Lina Iyer
2014-09-30 15:41 ` Lina Iyer
2014-09-30 15:41 ` Lina Iyer
2014-09-27 0:58 ` [PATCH v7 6/7] arm: dts: qcom: Add idle states device nodes for 8974 Lina Iyer
2014-09-27 0:58 ` Lina Iyer
2014-09-27 0:58 ` [PATCH v7 7/7] arm: dts: qcom: Add idle states device nodes for 8084 Lina Iyer
2014-09-27 0:58 ` Lina Iyer
2014-09-29 12:21 ` [PATCH v7 0/7] QCOM 8974 and 8084 cpuidle driver Pramod Gurav
2014-09-29 12:21 ` Pramod Gurav
2014-09-29 15:05 ` Lina Iyer
2014-09-29 15:05 ` Lina Iyer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140930160310.GC528@ilina-mac.local \
--to=lina.iyer@linaro.org \
--cc=daniel.lezcano@linaro.org \
--cc=galak@codeaurora.org \
--cc=khilman@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=msivasub@codeaurora.org \
--cc=sboyd@codeaurora.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.