From: sboyd@codeaurora.org (Stephen Boyd)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v7 5/7] qcom: cpuidle: Add cpuidle driver for QCOM cpus
Date: Mon, 29 Sep 2014 16:18:46 -0700 [thread overview]
Message-ID: <5429E8D6.6080101@codeaurora.org> (raw)
In-Reply-To: <1411779495-39724-6-git-send-email-lina.iyer@linaro.org>
On 09/26/14 17:58, Lina Iyer wrote:
> diff --git a/drivers/cpuidle/cpuidle-qcom.c b/drivers/cpuidle/cpuidle-qcom.c
> new file mode 100644
> index 0000000..2fcf79a
> --- /dev/null
> +++ b/drivers/cpuidle/cpuidle-qcom.c
> @@ -0,0 +1,89 @@
> +/*
> + * Copyright (c) 2014, Linaro Limited.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 and
> + * only version 2 as published by the Free Software Foundation.
> + *
> + * 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.
> + *
> + */
> +
> +#include <linux/cpu_pm.h>
> +#include <linux/cpuidle.h>
> +#include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/of_device.h>
> +#include <linux/platform_device.h>
> +
> +#include <soc/qcom/pm.h>
> +#include "dt_idle_states.h"
> +
> +static void (*qcom_idle_enter)(enum pm_sleep_mode);
> +
> +static int qcom_lpm_enter_wfi(struct cpuidle_device *dev,
> + struct cpuidle_driver *drv, int index)
> +{
> + qcom_idle_enter(PM_SLEEP_MODE_WFI);
Why can't we just pass index here? It would be nice to not need to
include soc/qcom/pm.h in this file.
> +
> + return index;
> +}
> +
> +static int qcom_lpm_enter_spc(struct cpuidle_device *dev,
> + struct cpuidle_driver *drv, int index)
> +{
> + cpu_pm_enter();
> + qcom_idle_enter(PM_SLEEP_MODE_SPC);
> + cpu_pm_exit();
> +
> + return index;
> +}
> +
> +static struct cpuidle_driver qcom_cpuidle_driver = {
> + .name = "qcom_cpuidle",
> + .owner = THIS_MODULE,
> +};
> +
> +static const struct of_device_id qcom_idle_state_match[] __initconst = {
> + { .compatible = "qcom,idle-state-wfi", .data = qcom_lpm_enter_wfi },
> + { .compatible = "qcom,idle-state-spc", .data = qcom_lpm_enter_spc },
> + { },
> +};
> +
> +static int qcom_cpuidle_probe(struct platform_device *pdev)
> +{
> + struct cpuidle_driver *drv = &qcom_cpuidle_driver;
> + int ret;
> +
> + qcom_idle_enter = (void *)(pdev->dev.platform_data);
> + if (!qcom_idle_enter)
> + return -EFAULT;
Error code looks a little wrong. -ENODEV?
> +
> + /* Probe for other states including platform WFI */
> + ret = dt_init_idle_driver(drv, qcom_idle_state_match, 0);
> + if (ret <= 0) {
> + pr_err("%s: No cpuidle state found.\n", __func__);
This would be true if ret == 0, but if it's < 0 that isn't true. Drop
the print?
> + return ret;
> + }
> +
> + ret = cpuidle_register(drv, NULL);
> + if (ret) {
> + pr_err("%s: failed to register cpuidle driver\n", __func__);
This seems redundant given that cpuidle_register() already prints an
error when it fails.
> + return ret;
> + }
> +
> + return 0;
Could just be return cpuidle_register(drv, NULL);
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
next prev parent reply other threads:[~2014-09-29 23:18 UTC|newest]
Thread overview: 41+ 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 ` [PATCH v7 1/7] qcom: spm: Add Subsystem Power Manager driver Lina Iyer
2014-09-27 8:07 ` Pramod Gurav
2014-09-29 10:29 ` Pramod Gurav
2014-09-29 23:19 ` Stephen Boyd
2014-09-30 16:27 ` Lina Iyer
2014-09-30 17:26 ` Kevin Hilman
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-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-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 8:22 ` Pramod Gurav
2014-09-29 23:37 ` Stephen Boyd
2014-09-30 16:03 ` Lina Iyer
2014-09-30 17:35 ` Kevin Hilman
2014-10-02 0:10 ` Stephen Boyd
2014-10-02 9:50 ` Lorenzo Pieralisi
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 8:18 ` Pramod Gurav
2014-09-29 10:31 ` Pramod Gurav
2014-09-29 15:04 ` Lina Iyer
2014-09-29 15:31 ` Lorenzo Pieralisi
2014-09-29 16:16 ` Lina Iyer
2014-09-29 17:22 ` Lorenzo Pieralisi
2014-09-30 17:41 ` Kevin Hilman
2014-09-30 17:51 ` Nicolas Pitre
2014-09-30 18:06 ` Kevin Hilman
2014-09-30 18:30 ` Nicolas Pitre
2014-09-30 18:41 ` Kevin Hilman
2014-09-30 20:36 ` Lina Iyer
2014-09-29 23:18 ` Stephen Boyd [this message]
2014-09-30 8:58 ` Lorenzo Pieralisi
2014-09-30 15:46 ` 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 ` [PATCH v7 7/7] arm: dts: qcom: Add idle states device nodes for 8084 Lina Iyer
2014-09-29 12:21 ` [PATCH v7 0/7] QCOM 8974 and 8084 cpuidle driver Pramod Gurav
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=5429E8D6.6080101@codeaurora.org \
--to=sboyd@codeaurora.org \
--cc=linux-arm-kernel@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).