All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/8] ARM: move cpuidle drivers to drivers/cpuidle/
@ 2013-06-26 10:15 ` Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 42+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2013-06-26 10:15 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux-pm, linux, nicolas.ferre, plagnioj, nsekhar, khilman,
	kernel, shawn.guo, tony, ben-linux, kgene.kim, horms,
	magnus.damm, swarren, srinidhi.kasagar, linus.walleij,
	daniel.lezcano, rjw, kyungmin.park, b.zolnierkie

Hi,

This patchset moves ARM cpuidle drivers to drivers/cpuidle/ to make
code match new driver placement rules (per commit a8e39c3 "cpuidle: add
maintainer entry").

[ Please note that movement of Samsung EXYNOS cpuidle driver is handled
  in separate patchset since it needs some other changes applied first. ]

Patches are based on linux-next (next-20130624) and are compile tested
only.  If agreed they all should probably go together through one tree
(linux-pm or arm-soc) since they all modify drivers/cpuidle/Makefile.

PS It seems that majority of cpuidle drivers is not used by default
(CONFIG_CPU_IDLE is not turned on in corresponding defconfigs). The only
exceptions are shmobile (kota2_defconfig) and tegra (tegra_defconfig).
This is probably also something that needs updating.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics


Bartlomiej Zolnierkiewicz (8):
  ARM: at91: move cpuidle driver to drivers/cpuidle/
  ARM: davinci: move cpuidle driver to drivers/cpuidle/
  ARM: imx: move cpuidle drivers to drivers/cpuidle/
  ARM: OMAP: move cpuidle drivers to drivers/cpuidle/
  ARM: S3C64XX: move cpuidle driver to drivers/cpuidle/
  ARM: shmobile: move cpuidle driver to drivers/cpuidle/
  ARM: tegra: move cpuidle drivers to drivers/cpuidle/
  ARM: ux500: move cpuidle drivers to drivers/cpuidle/

 arch/arm/mach-at91/Makefile            |   1 -
 arch/arm/mach-at91/cpuidle.c           |  68 -------
 arch/arm/mach-davinci/Makefile         |   1 -
 arch/arm/mach-davinci/cpuidle.c        | 105 ----------
 arch/arm/mach-imx/Makefile             |   5 -
 arch/arm/mach-imx/cpuidle-imx5.c       |  37 ----
 arch/arm/mach-imx/cpuidle-imx6q.c      |  75 -------
 arch/arm/mach-omap2/Makefile           |   5 -
 arch/arm/mach-omap2/cpuidle34xx.c      | 344 ---------------------------------
 arch/arm/mach-omap2/cpuidle44xx.c      | 217 ---------------------
 arch/arm/mach-s3c64xx/Makefile         |   1 -
 arch/arm/mach-s3c64xx/cpuidle.c        |  63 ------
 arch/arm/mach-shmobile/Makefile        |   1 -
 arch/arm/mach-shmobile/cpuidle.c       |  37 ----
 arch/arm/mach-tegra/Makefile           |   9 -
 arch/arm/mach-tegra/cpuidle-tegra114.c |  35 ----
 arch/arm/mach-tegra/cpuidle-tegra20.c  | 217 ---------------------
 arch/arm/mach-tegra/cpuidle-tegra30.c  | 149 --------------
 arch/arm/mach-ux500/Makefile           |   1 -
 arch/arm/mach-ux500/cpuidle.c          | 128 ------------
 drivers/cpuidle/Makefile               |  42 ++++
 drivers/cpuidle/cpuidle-at91.c         |  68 +++++++
 drivers/cpuidle/cpuidle-davinci.c      | 104 ++++++++++
 drivers/cpuidle/cpuidle-imx5.c         |  37 ++++
 drivers/cpuidle/cpuidle-imx6q.c        |  74 +++++++
 drivers/cpuidle/cpuidle-omap34xx.c     | 342 ++++++++++++++++++++++++++++++++
 drivers/cpuidle/cpuidle-omap44xx.c     | 216 +++++++++++++++++++++
 drivers/cpuidle/cpuidle-s3c64xx.c      |  62 ++++++
 drivers/cpuidle/cpuidle-shmobile.c     |  37 ++++
 drivers/cpuidle/cpuidle-tegra114.c     |  35 ++++
 drivers/cpuidle/cpuidle-tegra20.c      | 217 +++++++++++++++++++++
 drivers/cpuidle/cpuidle-tegra30.c      | 149 ++++++++++++++
 drivers/cpuidle/cpuidle-ux500.c        | 128 ++++++++++++
 33 files changed, 1511 insertions(+), 1499 deletions(-)
 delete mode 100644 arch/arm/mach-at91/cpuidle.c
 delete mode 100644 arch/arm/mach-davinci/cpuidle.c
 delete mode 100644 arch/arm/mach-imx/cpuidle-imx5.c
 delete mode 100644 arch/arm/mach-imx/cpuidle-imx6q.c
 delete mode 100644 arch/arm/mach-omap2/cpuidle34xx.c
 delete mode 100644 arch/arm/mach-omap2/cpuidle44xx.c
 delete mode 100644 arch/arm/mach-s3c64xx/cpuidle.c
 delete mode 100644 arch/arm/mach-shmobile/cpuidle.c
 delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra114.c
 delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra20.c
 delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra30.c
 delete mode 100644 arch/arm/mach-ux500/cpuidle.c
 create mode 100644 drivers/cpuidle/cpuidle-at91.c
 create mode 100644 drivers/cpuidle/cpuidle-davinci.c
 create mode 100644 drivers/cpuidle/cpuidle-imx5.c
 create mode 100644 drivers/cpuidle/cpuidle-imx6q.c
 create mode 100644 drivers/cpuidle/cpuidle-omap34xx.c
 create mode 100644 drivers/cpuidle/cpuidle-omap44xx.c
 create mode 100644 drivers/cpuidle/cpuidle-s3c64xx.c
 create mode 100644 drivers/cpuidle/cpuidle-shmobile.c
 create mode 100644 drivers/cpuidle/cpuidle-tegra114.c
 create mode 100644 drivers/cpuidle/cpuidle-tegra20.c
 create mode 100644 drivers/cpuidle/cpuidle-tegra30.c
 create mode 100644 drivers/cpuidle/cpuidle-ux500.c

-- 
1.8.2.3


^ permalink raw reply	[flat|nested] 42+ messages in thread

* [PATCH 0/8] ARM: move cpuidle drivers to drivers/cpuidle/
@ 2013-06-26 10:15 ` Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 42+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2013-06-26 10:15 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

This patchset moves ARM cpuidle drivers to drivers/cpuidle/ to make
code match new driver placement rules (per commit a8e39c3 "cpuidle: add
maintainer entry").

[ Please note that movement of Samsung EXYNOS cpuidle driver is handled
  in separate patchset since it needs some other changes applied first. ]

Patches are based on linux-next (next-20130624) and are compile tested
only.  If agreed they all should probably go together through one tree
(linux-pm or arm-soc) since they all modify drivers/cpuidle/Makefile.

PS It seems that majority of cpuidle drivers is not used by default
(CONFIG_CPU_IDLE is not turned on in corresponding defconfigs). The only
exceptions are shmobile (kota2_defconfig) and tegra (tegra_defconfig).
This is probably also something that needs updating.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics


Bartlomiej Zolnierkiewicz (8):
  ARM: at91: move cpuidle driver to drivers/cpuidle/
  ARM: davinci: move cpuidle driver to drivers/cpuidle/
  ARM: imx: move cpuidle drivers to drivers/cpuidle/
  ARM: OMAP: move cpuidle drivers to drivers/cpuidle/
  ARM: S3C64XX: move cpuidle driver to drivers/cpuidle/
  ARM: shmobile: move cpuidle driver to drivers/cpuidle/
  ARM: tegra: move cpuidle drivers to drivers/cpuidle/
  ARM: ux500: move cpuidle drivers to drivers/cpuidle/

 arch/arm/mach-at91/Makefile            |   1 -
 arch/arm/mach-at91/cpuidle.c           |  68 -------
 arch/arm/mach-davinci/Makefile         |   1 -
 arch/arm/mach-davinci/cpuidle.c        | 105 ----------
 arch/arm/mach-imx/Makefile             |   5 -
 arch/arm/mach-imx/cpuidle-imx5.c       |  37 ----
 arch/arm/mach-imx/cpuidle-imx6q.c      |  75 -------
 arch/arm/mach-omap2/Makefile           |   5 -
 arch/arm/mach-omap2/cpuidle34xx.c      | 344 ---------------------------------
 arch/arm/mach-omap2/cpuidle44xx.c      | 217 ---------------------
 arch/arm/mach-s3c64xx/Makefile         |   1 -
 arch/arm/mach-s3c64xx/cpuidle.c        |  63 ------
 arch/arm/mach-shmobile/Makefile        |   1 -
 arch/arm/mach-shmobile/cpuidle.c       |  37 ----
 arch/arm/mach-tegra/Makefile           |   9 -
 arch/arm/mach-tegra/cpuidle-tegra114.c |  35 ----
 arch/arm/mach-tegra/cpuidle-tegra20.c  | 217 ---------------------
 arch/arm/mach-tegra/cpuidle-tegra30.c  | 149 --------------
 arch/arm/mach-ux500/Makefile           |   1 -
 arch/arm/mach-ux500/cpuidle.c          | 128 ------------
 drivers/cpuidle/Makefile               |  42 ++++
 drivers/cpuidle/cpuidle-at91.c         |  68 +++++++
 drivers/cpuidle/cpuidle-davinci.c      | 104 ++++++++++
 drivers/cpuidle/cpuidle-imx5.c         |  37 ++++
 drivers/cpuidle/cpuidle-imx6q.c        |  74 +++++++
 drivers/cpuidle/cpuidle-omap34xx.c     | 342 ++++++++++++++++++++++++++++++++
 drivers/cpuidle/cpuidle-omap44xx.c     | 216 +++++++++++++++++++++
 drivers/cpuidle/cpuidle-s3c64xx.c      |  62 ++++++
 drivers/cpuidle/cpuidle-shmobile.c     |  37 ++++
 drivers/cpuidle/cpuidle-tegra114.c     |  35 ++++
 drivers/cpuidle/cpuidle-tegra20.c      | 217 +++++++++++++++++++++
 drivers/cpuidle/cpuidle-tegra30.c      | 149 ++++++++++++++
 drivers/cpuidle/cpuidle-ux500.c        | 128 ++++++++++++
 33 files changed, 1511 insertions(+), 1499 deletions(-)
 delete mode 100644 arch/arm/mach-at91/cpuidle.c
 delete mode 100644 arch/arm/mach-davinci/cpuidle.c
 delete mode 100644 arch/arm/mach-imx/cpuidle-imx5.c
 delete mode 100644 arch/arm/mach-imx/cpuidle-imx6q.c
 delete mode 100644 arch/arm/mach-omap2/cpuidle34xx.c
 delete mode 100644 arch/arm/mach-omap2/cpuidle44xx.c
 delete mode 100644 arch/arm/mach-s3c64xx/cpuidle.c
 delete mode 100644 arch/arm/mach-shmobile/cpuidle.c
 delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra114.c
 delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra20.c
 delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra30.c
 delete mode 100644 arch/arm/mach-ux500/cpuidle.c
 create mode 100644 drivers/cpuidle/cpuidle-at91.c
 create mode 100644 drivers/cpuidle/cpuidle-davinci.c
 create mode 100644 drivers/cpuidle/cpuidle-imx5.c
 create mode 100644 drivers/cpuidle/cpuidle-imx6q.c
 create mode 100644 drivers/cpuidle/cpuidle-omap34xx.c
 create mode 100644 drivers/cpuidle/cpuidle-omap44xx.c
 create mode 100644 drivers/cpuidle/cpuidle-s3c64xx.c
 create mode 100644 drivers/cpuidle/cpuidle-shmobile.c
 create mode 100644 drivers/cpuidle/cpuidle-tegra114.c
 create mode 100644 drivers/cpuidle/cpuidle-tegra20.c
 create mode 100644 drivers/cpuidle/cpuidle-tegra30.c
 create mode 100644 drivers/cpuidle/cpuidle-ux500.c

-- 
1.8.2.3

^ permalink raw reply	[flat|nested] 42+ messages in thread

* [PATCH 1/8] ARM: at91: move cpuidle driver to drivers/cpuidle/
  2013-06-26 10:15 ` Bartlomiej Zolnierkiewicz
@ 2013-06-26 10:15   ` Bartlomiej Zolnierkiewicz
  -1 siblings, 0 replies; 42+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2013-06-26 10:15 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux-pm, linux, nicolas.ferre, plagnioj, nsekhar, khilman,
	kernel, shawn.guo, tony, ben-linux, kgene.kim, horms,
	magnus.damm, swarren, srinidhi.kasagar, linus.walleij,
	daniel.lezcano, rjw, kyungmin.park, b.zolnierkie

Compile tested only.

Cc: Andrew Victor <linux@maxim.org.za>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
 arch/arm/mach-at91/Makefile    |  1 -
 arch/arm/mach-at91/cpuidle.c   | 68 ------------------------------------------
 drivers/cpuidle/Makefile       |  3 ++
 drivers/cpuidle/cpuidle-at91.c | 68 ++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 71 insertions(+), 69 deletions(-)
 delete mode 100644 arch/arm/mach-at91/cpuidle.c
 create mode 100644 drivers/cpuidle/cpuidle-at91.c

diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index 3b0a953..c1b7370 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -98,7 +98,6 @@ obj-y				+= leds.o
 # Power Management
 obj-$(CONFIG_PM)		+= pm.o
 obj-$(CONFIG_AT91_SLOW_CLOCK)	+= pm_slowclock.o
-obj-$(CONFIG_CPU_IDLE)	+= cpuidle.o
 
 ifeq ($(CONFIG_PM_DEBUG),y)
 CFLAGS_pm.o += -DDEBUG
diff --git a/arch/arm/mach-at91/cpuidle.c b/arch/arm/mach-at91/cpuidle.c
deleted file mode 100644
index 69f9e3b..0000000
--- a/arch/arm/mach-at91/cpuidle.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * based on arch/arm/mach-kirkwood/cpuidle.c
- *
- * CPU idle support for AT91 SoC
- *
- * This file is licensed under the terms of the GNU General Public
- * License version 2.  This program is licensed "as is" without any
- * warranty of any kind, whether express or implied.
- *
- * The cpu idle uses wait-for-interrupt and RAM self refresh in order
- * to implement two idle states -
- * #1 wait-for-interrupt
- * #2 wait-for-interrupt and RAM self refresh
- */
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/platform_device.h>
-#include <linux/cpuidle.h>
-#include <linux/io.h>
-#include <linux/export.h>
-#include <asm/proc-fns.h>
-#include <asm/cpuidle.h>
-#include <mach/cpu.h>
-
-#include "pm.h"
-
-#define AT91_MAX_STATES	2
-
-/* Actual code that puts the SoC in different idle states */
-static int at91_enter_idle(struct cpuidle_device *dev,
-			struct cpuidle_driver *drv,
-			       int index)
-{
-	if (cpu_is_at91rm9200())
-		at91rm9200_standby();
-	else if (cpu_is_at91sam9g45())
-		at91sam9g45_standby();
-	else if (cpu_is_at91sam9263())
-		at91sam9263_standby();
-	else
-		at91sam9_standby();
-
-	return index;
-}
-
-static struct cpuidle_driver at91_idle_driver = {
-	.name			= "at91_idle",
-	.owner			= THIS_MODULE,
-	.states[0]		= ARM_CPUIDLE_WFI_STATE,
-	.states[1]		= {
-		.enter			= at91_enter_idle,
-		.exit_latency		= 10,
-		.target_residency	= 100000,
-		.flags			= CPUIDLE_FLAG_TIME_VALID,
-		.name			= "RAM_SR",
-		.desc			= "WFI and DDR Self Refresh",
-	},
-	.state_count = AT91_MAX_STATES,
-};
-
-/* Initialize CPU idle by registering the idle states */
-static int __init at91_init_cpuidle(void)
-{
-	return cpuidle_register(&at91_idle_driver, NULL);
-}
-
-device_initcall(at91_init_cpuidle);
diff --git a/drivers/cpuidle/Makefile b/drivers/cpuidle/Makefile
index 8767a7b..9dd4091 100644
--- a/drivers/cpuidle/Makefile
+++ b/drivers/cpuidle/Makefile
@@ -5,6 +5,9 @@
 obj-y += cpuidle.o driver.o governor.o sysfs.o governors/
 obj-$(CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED) += coupled.o
 
+ifeq ($(CONFIG_ARCH_AT91),y)
+	obj-y += cpuidle-at91.o
+endif
 obj-$(CONFIG_CPU_IDLE_CALXEDA) += cpuidle-calxeda.o
 obj-$(CONFIG_ARCH_KIRKWOOD) += cpuidle-kirkwood.o
 obj-$(CONFIG_CPU_IDLE_ZYNQ) += cpuidle-zynq.o
diff --git a/drivers/cpuidle/cpuidle-at91.c b/drivers/cpuidle/cpuidle-at91.c
new file mode 100644
index 0000000..2545218
--- /dev/null
+++ b/drivers/cpuidle/cpuidle-at91.c
@@ -0,0 +1,68 @@
+/*
+ * based on arch/arm/mach-kirkwood/cpuidle.c
+ *
+ * CPU idle support for AT91 SoC
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ *
+ * The cpu idle uses wait-for-interrupt and RAM self refresh in order
+ * to implement two idle states -
+ * #1 wait-for-interrupt
+ * #2 wait-for-interrupt and RAM self refresh
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/cpuidle.h>
+#include <linux/io.h>
+#include <linux/export.h>
+#include <asm/proc-fns.h>
+#include <asm/cpuidle.h>
+#include <mach/cpu.h>
+
+#include "../../arch/arm/mach-at91/pm.h"
+
+#define AT91_MAX_STATES	2
+
+/* Actual code that puts the SoC in different idle states */
+static int at91_enter_idle(struct cpuidle_device *dev,
+			struct cpuidle_driver *drv,
+			       int index)
+{
+	if (cpu_is_at91rm9200())
+		at91rm9200_standby();
+	else if (cpu_is_at91sam9g45())
+		at91sam9g45_standby();
+	else if (cpu_is_at91sam9263())
+		at91sam9263_standby();
+	else
+		at91sam9_standby();
+
+	return index;
+}
+
+static struct cpuidle_driver at91_idle_driver = {
+	.name			= "at91_idle",
+	.owner			= THIS_MODULE,
+	.states[0]		= ARM_CPUIDLE_WFI_STATE,
+	.states[1]		= {
+		.enter			= at91_enter_idle,
+		.exit_latency		= 10,
+		.target_residency	= 100000,
+		.flags			= CPUIDLE_FLAG_TIME_VALID,
+		.name			= "RAM_SR",
+		.desc			= "WFI and DDR Self Refresh",
+	},
+	.state_count = AT91_MAX_STATES,
+};
+
+/* Initialize CPU idle by registering the idle states */
+static int __init at91_init_cpuidle(void)
+{
+	return cpuidle_register(&at91_idle_driver, NULL);
+}
+
+device_initcall(at91_init_cpuidle);
-- 
1.8.2.3


^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH 1/8] ARM: at91: move cpuidle driver to drivers/cpuidle/
@ 2013-06-26 10:15   ` Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 42+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2013-06-26 10:15 UTC (permalink / raw)
  To: linux-arm-kernel

Compile tested only.

Cc: Andrew Victor <linux@maxim.org.za>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
 arch/arm/mach-at91/Makefile    |  1 -
 arch/arm/mach-at91/cpuidle.c   | 68 ------------------------------------------
 drivers/cpuidle/Makefile       |  3 ++
 drivers/cpuidle/cpuidle-at91.c | 68 ++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 71 insertions(+), 69 deletions(-)
 delete mode 100644 arch/arm/mach-at91/cpuidle.c
 create mode 100644 drivers/cpuidle/cpuidle-at91.c

diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index 3b0a953..c1b7370 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -98,7 +98,6 @@ obj-y				+= leds.o
 # Power Management
 obj-$(CONFIG_PM)		+= pm.o
 obj-$(CONFIG_AT91_SLOW_CLOCK)	+= pm_slowclock.o
-obj-$(CONFIG_CPU_IDLE)	+= cpuidle.o
 
 ifeq ($(CONFIG_PM_DEBUG),y)
 CFLAGS_pm.o += -DDEBUG
diff --git a/arch/arm/mach-at91/cpuidle.c b/arch/arm/mach-at91/cpuidle.c
deleted file mode 100644
index 69f9e3b..0000000
--- a/arch/arm/mach-at91/cpuidle.c
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * based on arch/arm/mach-kirkwood/cpuidle.c
- *
- * CPU idle support for AT91 SoC
- *
- * This file is licensed under the terms of the GNU General Public
- * License version 2.  This program is licensed "as is" without any
- * warranty of any kind, whether express or implied.
- *
- * The cpu idle uses wait-for-interrupt and RAM self refresh in order
- * to implement two idle states -
- * #1 wait-for-interrupt
- * #2 wait-for-interrupt and RAM self refresh
- */
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/platform_device.h>
-#include <linux/cpuidle.h>
-#include <linux/io.h>
-#include <linux/export.h>
-#include <asm/proc-fns.h>
-#include <asm/cpuidle.h>
-#include <mach/cpu.h>
-
-#include "pm.h"
-
-#define AT91_MAX_STATES	2
-
-/* Actual code that puts the SoC in different idle states */
-static int at91_enter_idle(struct cpuidle_device *dev,
-			struct cpuidle_driver *drv,
-			       int index)
-{
-	if (cpu_is_at91rm9200())
-		at91rm9200_standby();
-	else if (cpu_is_at91sam9g45())
-		at91sam9g45_standby();
-	else if (cpu_is_at91sam9263())
-		at91sam9263_standby();
-	else
-		at91sam9_standby();
-
-	return index;
-}
-
-static struct cpuidle_driver at91_idle_driver = {
-	.name			= "at91_idle",
-	.owner			= THIS_MODULE,
-	.states[0]		= ARM_CPUIDLE_WFI_STATE,
-	.states[1]		= {
-		.enter			= at91_enter_idle,
-		.exit_latency		= 10,
-		.target_residency	= 100000,
-		.flags			= CPUIDLE_FLAG_TIME_VALID,
-		.name			= "RAM_SR",
-		.desc			= "WFI and DDR Self Refresh",
-	},
-	.state_count = AT91_MAX_STATES,
-};
-
-/* Initialize CPU idle by registering the idle states */
-static int __init at91_init_cpuidle(void)
-{
-	return cpuidle_register(&at91_idle_driver, NULL);
-}
-
-device_initcall(at91_init_cpuidle);
diff --git a/drivers/cpuidle/Makefile b/drivers/cpuidle/Makefile
index 8767a7b..9dd4091 100644
--- a/drivers/cpuidle/Makefile
+++ b/drivers/cpuidle/Makefile
@@ -5,6 +5,9 @@
 obj-y += cpuidle.o driver.o governor.o sysfs.o governors/
 obj-$(CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED) += coupled.o
 
+ifeq ($(CONFIG_ARCH_AT91),y)
+	obj-y += cpuidle-at91.o
+endif
 obj-$(CONFIG_CPU_IDLE_CALXEDA) += cpuidle-calxeda.o
 obj-$(CONFIG_ARCH_KIRKWOOD) += cpuidle-kirkwood.o
 obj-$(CONFIG_CPU_IDLE_ZYNQ) += cpuidle-zynq.o
diff --git a/drivers/cpuidle/cpuidle-at91.c b/drivers/cpuidle/cpuidle-at91.c
new file mode 100644
index 0000000..2545218
--- /dev/null
+++ b/drivers/cpuidle/cpuidle-at91.c
@@ -0,0 +1,68 @@
+/*
+ * based on arch/arm/mach-kirkwood/cpuidle.c
+ *
+ * CPU idle support for AT91 SoC
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ *
+ * The cpu idle uses wait-for-interrupt and RAM self refresh in order
+ * to implement two idle states -
+ * #1 wait-for-interrupt
+ * #2 wait-for-interrupt and RAM self refresh
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/cpuidle.h>
+#include <linux/io.h>
+#include <linux/export.h>
+#include <asm/proc-fns.h>
+#include <asm/cpuidle.h>
+#include <mach/cpu.h>
+
+#include "../../arch/arm/mach-at91/pm.h"
+
+#define AT91_MAX_STATES	2
+
+/* Actual code that puts the SoC in different idle states */
+static int at91_enter_idle(struct cpuidle_device *dev,
+			struct cpuidle_driver *drv,
+			       int index)
+{
+	if (cpu_is_at91rm9200())
+		at91rm9200_standby();
+	else if (cpu_is_at91sam9g45())
+		at91sam9g45_standby();
+	else if (cpu_is_at91sam9263())
+		at91sam9263_standby();
+	else
+		at91sam9_standby();
+
+	return index;
+}
+
+static struct cpuidle_driver at91_idle_driver = {
+	.name			= "at91_idle",
+	.owner			= THIS_MODULE,
+	.states[0]		= ARM_CPUIDLE_WFI_STATE,
+	.states[1]		= {
+		.enter			= at91_enter_idle,
+		.exit_latency		= 10,
+		.target_residency	= 100000,
+		.flags			= CPUIDLE_FLAG_TIME_VALID,
+		.name			= "RAM_SR",
+		.desc			= "WFI and DDR Self Refresh",
+	},
+	.state_count = AT91_MAX_STATES,
+};
+
+/* Initialize CPU idle by registering the idle states */
+static int __init at91_init_cpuidle(void)
+{
+	return cpuidle_register(&at91_idle_driver, NULL);
+}
+
+device_initcall(at91_init_cpuidle);
-- 
1.8.2.3

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH 2/8] ARM: davinci: move cpuidle driver to drivers/cpuidle/
  2013-06-26 10:15 ` Bartlomiej Zolnierkiewicz
@ 2013-06-26 10:15   ` Bartlomiej Zolnierkiewicz
  -1 siblings, 0 replies; 42+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2013-06-26 10:15 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux-pm, linux, nicolas.ferre, plagnioj, nsekhar, khilman,
	kernel, shawn.guo, tony, ben-linux, kgene.kim, horms,
	magnus.damm, swarren, srinidhi.kasagar, linus.walleij,
	daniel.lezcano, rjw, kyungmin.park, b.zolnierkie

Compile tested only.

Cc: Sekhar Nori <nsekhar@ti.com>
Cc: Kevin Hilman <khilman@deeprootsystems.com>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
 arch/arm/mach-davinci/Makefile    |   1 -
 arch/arm/mach-davinci/cpuidle.c   | 105 --------------------------------------
 drivers/cpuidle/Makefile          |   3 ++
 drivers/cpuidle/cpuidle-davinci.c | 104 +++++++++++++++++++++++++++++++++++++
 4 files changed, 107 insertions(+), 106 deletions(-)
 delete mode 100644 arch/arm/mach-davinci/cpuidle.c
 create mode 100644 drivers/cpuidle/cpuidle-davinci.c

diff --git a/arch/arm/mach-davinci/Makefile b/arch/arm/mach-davinci/Makefile
index 63997a1..76712e2 100644
--- a/arch/arm/mach-davinci/Makefile
+++ b/arch/arm/mach-davinci/Makefile
@@ -37,6 +37,5 @@ obj-$(CONFIG_MACH_MITYOMAPL138)		+= board-mityomapl138.o
 obj-$(CONFIG_MACH_OMAPL138_HAWKBOARD)	+= board-omapl138-hawk.o
 
 # Power Management
-obj-$(CONFIG_CPU_IDLE)			+= cpuidle.o
 obj-$(CONFIG_SUSPEND)			+= pm.o sleep.o
 obj-$(CONFIG_HAVE_CLK)			+= pm_domain.o
diff --git a/arch/arm/mach-davinci/cpuidle.c b/arch/arm/mach-davinci/cpuidle.c
deleted file mode 100644
index 36aef3a..0000000
--- a/arch/arm/mach-davinci/cpuidle.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * CPU idle for DaVinci SoCs
- *
- * Copyright (C) 2009 Texas Instruments Incorporated. http://www.ti.com/
- *
- * Derived from Marvell Kirkwood CPU idle code
- * (arch/arm/mach-kirkwood/cpuidle.c)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/platform_device.h>
-#include <linux/cpuidle.h>
-#include <linux/io.h>
-#include <linux/export.h>
-#include <asm/proc-fns.h>
-#include <asm/cpuidle.h>
-
-#include <mach/cpuidle.h>
-#include <mach/ddr2.h>
-
-#define DAVINCI_CPUIDLE_MAX_STATES	2
-
-static void __iomem *ddr2_reg_base;
-static bool ddr2_pdown;
-
-static void davinci_save_ddr_power(int enter, bool pdown)
-{
-	u32 val;
-
-	val = __raw_readl(ddr2_reg_base + DDR2_SDRCR_OFFSET);
-
-	if (enter) {
-		if (pdown)
-			val |= DDR2_SRPD_BIT;
-		else
-			val &= ~DDR2_SRPD_BIT;
-		val |= DDR2_LPMODEN_BIT;
-	} else {
-		val &= ~(DDR2_SRPD_BIT | DDR2_LPMODEN_BIT);
-	}
-
-	__raw_writel(val, ddr2_reg_base + DDR2_SDRCR_OFFSET);
-}
-
-/* Actual code that puts the SoC in different idle states */
-static int davinci_enter_idle(struct cpuidle_device *dev,
-			      struct cpuidle_driver *drv, int index)
-{
-	davinci_save_ddr_power(1, ddr2_pdown);
-	cpu_do_idle();
-	davinci_save_ddr_power(0, ddr2_pdown);
-
-	return index;
-}
-
-static struct cpuidle_driver davinci_idle_driver = {
-	.name			= "cpuidle-davinci",
-	.owner			= THIS_MODULE,
-	.states[0]		= ARM_CPUIDLE_WFI_STATE,
-	.states[1]		= {
-		.enter			= davinci_enter_idle,
-		.exit_latency		= 10,
-		.target_residency	= 100000,
-		.flags			= CPUIDLE_FLAG_TIME_VALID,
-		.name			= "DDR SR",
-		.desc			= "WFI and DDR Self Refresh",
-	},
-	.state_count = DAVINCI_CPUIDLE_MAX_STATES,
-};
-
-static int __init davinci_cpuidle_probe(struct platform_device *pdev)
-{
-	struct davinci_cpuidle_config *pdata = pdev->dev.platform_data;
-
-	if (!pdata) {
-		dev_err(&pdev->dev, "cannot get platform data\n");
-		return -ENOENT;
-	}
-
-	ddr2_reg_base = pdata->ddr2_ctlr_base;
-
-	ddr2_pdown = pdata->ddr2_pdown;
-
-	return cpuidle_register(&davinci_idle_driver, NULL);
-}
-
-static struct platform_driver davinci_cpuidle_driver = {
-	.driver = {
-		.name	= "cpuidle-davinci",
-		.owner	= THIS_MODULE,
-	},
-};
-
-static int __init davinci_cpuidle_init(void)
-{
-	return platform_driver_probe(&davinci_cpuidle_driver,
-						davinci_cpuidle_probe);
-}
-device_initcall(davinci_cpuidle_init);
-
diff --git a/drivers/cpuidle/Makefile b/drivers/cpuidle/Makefile
index 9dd4091..3bbb828 100644
--- a/drivers/cpuidle/Makefile
+++ b/drivers/cpuidle/Makefile
@@ -9,5 +9,8 @@ ifeq ($(CONFIG_ARCH_AT91),y)
 	obj-y += cpuidle-at91.o
 endif
 obj-$(CONFIG_CPU_IDLE_CALXEDA) += cpuidle-calxeda.o
+ifeq ($(CONFIG_ARCH_DAVINCI),y)
+	obj-y += cpuidle-davinci.o
+endif
 obj-$(CONFIG_ARCH_KIRKWOOD) += cpuidle-kirkwood.o
 obj-$(CONFIG_CPU_IDLE_ZYNQ) += cpuidle-zynq.o
diff --git a/drivers/cpuidle/cpuidle-davinci.c b/drivers/cpuidle/cpuidle-davinci.c
new file mode 100644
index 0000000..b5a6476
--- /dev/null
+++ b/drivers/cpuidle/cpuidle-davinci.c
@@ -0,0 +1,104 @@
+/*
+ * CPU idle for DaVinci SoCs
+ *
+ * Copyright (C) 2009 Texas Instruments Incorporated. http://www.ti.com/
+ *
+ * Derived from Marvell Kirkwood CPU idle code
+ * (arch/arm/mach-kirkwood/cpuidle.c)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/cpuidle.h>
+#include <linux/io.h>
+#include <linux/export.h>
+#include <asm/proc-fns.h>
+#include <asm/cpuidle.h>
+
+#include <mach/cpuidle.h>
+#include <mach/ddr2.h>
+
+#define DAVINCI_CPUIDLE_MAX_STATES	2
+
+static void __iomem *ddr2_reg_base;
+static bool ddr2_pdown;
+
+static void davinci_save_ddr_power(int enter, bool pdown)
+{
+	u32 val;
+
+	val = __raw_readl(ddr2_reg_base + DDR2_SDRCR_OFFSET);
+
+	if (enter) {
+		if (pdown)
+			val |= DDR2_SRPD_BIT;
+		else
+			val &= ~DDR2_SRPD_BIT;
+		val |= DDR2_LPMODEN_BIT;
+	} else {
+		val &= ~(DDR2_SRPD_BIT | DDR2_LPMODEN_BIT);
+	}
+
+	__raw_writel(val, ddr2_reg_base + DDR2_SDRCR_OFFSET);
+}
+
+/* Actual code that puts the SoC in different idle states */
+static int davinci_enter_idle(struct cpuidle_device *dev,
+			      struct cpuidle_driver *drv, int index)
+{
+	davinci_save_ddr_power(1, ddr2_pdown);
+	cpu_do_idle();
+	davinci_save_ddr_power(0, ddr2_pdown);
+
+	return index;
+}
+
+static struct cpuidle_driver davinci_idle_driver = {
+	.name			= "cpuidle-davinci",
+	.owner			= THIS_MODULE,
+	.states[0]		= ARM_CPUIDLE_WFI_STATE,
+	.states[1]		= {
+		.enter			= davinci_enter_idle,
+		.exit_latency		= 10,
+		.target_residency	= 100000,
+		.flags			= CPUIDLE_FLAG_TIME_VALID,
+		.name			= "DDR SR",
+		.desc			= "WFI and DDR Self Refresh",
+	},
+	.state_count = DAVINCI_CPUIDLE_MAX_STATES,
+};
+
+static int __init davinci_cpuidle_probe(struct platform_device *pdev)
+{
+	struct davinci_cpuidle_config *pdata = pdev->dev.platform_data;
+
+	if (!pdata) {
+		dev_err(&pdev->dev, "cannot get platform data\n");
+		return -ENOENT;
+	}
+
+	ddr2_reg_base = pdata->ddr2_ctlr_base;
+
+	ddr2_pdown = pdata->ddr2_pdown;
+
+	return cpuidle_register(&davinci_idle_driver, NULL);
+}
+
+static struct platform_driver davinci_cpuidle_driver = {
+	.driver = {
+		.name	= "cpuidle-davinci",
+		.owner	= THIS_MODULE,
+	},
+};
+
+static int __init davinci_cpuidle_init(void)
+{
+	return platform_driver_probe(&davinci_cpuidle_driver,
+						davinci_cpuidle_probe);
+}
+device_initcall(davinci_cpuidle_init);
-- 
1.8.2.3


^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH 2/8] ARM: davinci: move cpuidle driver to drivers/cpuidle/
@ 2013-06-26 10:15   ` Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 42+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2013-06-26 10:15 UTC (permalink / raw)
  To: linux-arm-kernel

Compile tested only.

Cc: Sekhar Nori <nsekhar@ti.com>
Cc: Kevin Hilman <khilman@deeprootsystems.com>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
 arch/arm/mach-davinci/Makefile    |   1 -
 arch/arm/mach-davinci/cpuidle.c   | 105 --------------------------------------
 drivers/cpuidle/Makefile          |   3 ++
 drivers/cpuidle/cpuidle-davinci.c | 104 +++++++++++++++++++++++++++++++++++++
 4 files changed, 107 insertions(+), 106 deletions(-)
 delete mode 100644 arch/arm/mach-davinci/cpuidle.c
 create mode 100644 drivers/cpuidle/cpuidle-davinci.c

diff --git a/arch/arm/mach-davinci/Makefile b/arch/arm/mach-davinci/Makefile
index 63997a1..76712e2 100644
--- a/arch/arm/mach-davinci/Makefile
+++ b/arch/arm/mach-davinci/Makefile
@@ -37,6 +37,5 @@ obj-$(CONFIG_MACH_MITYOMAPL138)		+= board-mityomapl138.o
 obj-$(CONFIG_MACH_OMAPL138_HAWKBOARD)	+= board-omapl138-hawk.o
 
 # Power Management
-obj-$(CONFIG_CPU_IDLE)			+= cpuidle.o
 obj-$(CONFIG_SUSPEND)			+= pm.o sleep.o
 obj-$(CONFIG_HAVE_CLK)			+= pm_domain.o
diff --git a/arch/arm/mach-davinci/cpuidle.c b/arch/arm/mach-davinci/cpuidle.c
deleted file mode 100644
index 36aef3a..0000000
--- a/arch/arm/mach-davinci/cpuidle.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * CPU idle for DaVinci SoCs
- *
- * Copyright (C) 2009 Texas Instruments Incorporated. http://www.ti.com/
- *
- * Derived from Marvell Kirkwood CPU idle code
- * (arch/arm/mach-kirkwood/cpuidle.c)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/platform_device.h>
-#include <linux/cpuidle.h>
-#include <linux/io.h>
-#include <linux/export.h>
-#include <asm/proc-fns.h>
-#include <asm/cpuidle.h>
-
-#include <mach/cpuidle.h>
-#include <mach/ddr2.h>
-
-#define DAVINCI_CPUIDLE_MAX_STATES	2
-
-static void __iomem *ddr2_reg_base;
-static bool ddr2_pdown;
-
-static void davinci_save_ddr_power(int enter, bool pdown)
-{
-	u32 val;
-
-	val = __raw_readl(ddr2_reg_base + DDR2_SDRCR_OFFSET);
-
-	if (enter) {
-		if (pdown)
-			val |= DDR2_SRPD_BIT;
-		else
-			val &= ~DDR2_SRPD_BIT;
-		val |= DDR2_LPMODEN_BIT;
-	} else {
-		val &= ~(DDR2_SRPD_BIT | DDR2_LPMODEN_BIT);
-	}
-
-	__raw_writel(val, ddr2_reg_base + DDR2_SDRCR_OFFSET);
-}
-
-/* Actual code that puts the SoC in different idle states */
-static int davinci_enter_idle(struct cpuidle_device *dev,
-			      struct cpuidle_driver *drv, int index)
-{
-	davinci_save_ddr_power(1, ddr2_pdown);
-	cpu_do_idle();
-	davinci_save_ddr_power(0, ddr2_pdown);
-
-	return index;
-}
-
-static struct cpuidle_driver davinci_idle_driver = {
-	.name			= "cpuidle-davinci",
-	.owner			= THIS_MODULE,
-	.states[0]		= ARM_CPUIDLE_WFI_STATE,
-	.states[1]		= {
-		.enter			= davinci_enter_idle,
-		.exit_latency		= 10,
-		.target_residency	= 100000,
-		.flags			= CPUIDLE_FLAG_TIME_VALID,
-		.name			= "DDR SR",
-		.desc			= "WFI and DDR Self Refresh",
-	},
-	.state_count = DAVINCI_CPUIDLE_MAX_STATES,
-};
-
-static int __init davinci_cpuidle_probe(struct platform_device *pdev)
-{
-	struct davinci_cpuidle_config *pdata = pdev->dev.platform_data;
-
-	if (!pdata) {
-		dev_err(&pdev->dev, "cannot get platform data\n");
-		return -ENOENT;
-	}
-
-	ddr2_reg_base = pdata->ddr2_ctlr_base;
-
-	ddr2_pdown = pdata->ddr2_pdown;
-
-	return cpuidle_register(&davinci_idle_driver, NULL);
-}
-
-static struct platform_driver davinci_cpuidle_driver = {
-	.driver = {
-		.name	= "cpuidle-davinci",
-		.owner	= THIS_MODULE,
-	},
-};
-
-static int __init davinci_cpuidle_init(void)
-{
-	return platform_driver_probe(&davinci_cpuidle_driver,
-						davinci_cpuidle_probe);
-}
-device_initcall(davinci_cpuidle_init);
-
diff --git a/drivers/cpuidle/Makefile b/drivers/cpuidle/Makefile
index 9dd4091..3bbb828 100644
--- a/drivers/cpuidle/Makefile
+++ b/drivers/cpuidle/Makefile
@@ -9,5 +9,8 @@ ifeq ($(CONFIG_ARCH_AT91),y)
 	obj-y += cpuidle-at91.o
 endif
 obj-$(CONFIG_CPU_IDLE_CALXEDA) += cpuidle-calxeda.o
+ifeq ($(CONFIG_ARCH_DAVINCI),y)
+	obj-y += cpuidle-davinci.o
+endif
 obj-$(CONFIG_ARCH_KIRKWOOD) += cpuidle-kirkwood.o
 obj-$(CONFIG_CPU_IDLE_ZYNQ) += cpuidle-zynq.o
diff --git a/drivers/cpuidle/cpuidle-davinci.c b/drivers/cpuidle/cpuidle-davinci.c
new file mode 100644
index 0000000..b5a6476
--- /dev/null
+++ b/drivers/cpuidle/cpuidle-davinci.c
@@ -0,0 +1,104 @@
+/*
+ * CPU idle for DaVinci SoCs
+ *
+ * Copyright (C) 2009 Texas Instruments Incorporated. http://www.ti.com/
+ *
+ * Derived from Marvell Kirkwood CPU idle code
+ * (arch/arm/mach-kirkwood/cpuidle.c)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/cpuidle.h>
+#include <linux/io.h>
+#include <linux/export.h>
+#include <asm/proc-fns.h>
+#include <asm/cpuidle.h>
+
+#include <mach/cpuidle.h>
+#include <mach/ddr2.h>
+
+#define DAVINCI_CPUIDLE_MAX_STATES	2
+
+static void __iomem *ddr2_reg_base;
+static bool ddr2_pdown;
+
+static void davinci_save_ddr_power(int enter, bool pdown)
+{
+	u32 val;
+
+	val = __raw_readl(ddr2_reg_base + DDR2_SDRCR_OFFSET);
+
+	if (enter) {
+		if (pdown)
+			val |= DDR2_SRPD_BIT;
+		else
+			val &= ~DDR2_SRPD_BIT;
+		val |= DDR2_LPMODEN_BIT;
+	} else {
+		val &= ~(DDR2_SRPD_BIT | DDR2_LPMODEN_BIT);
+	}
+
+	__raw_writel(val, ddr2_reg_base + DDR2_SDRCR_OFFSET);
+}
+
+/* Actual code that puts the SoC in different idle states */
+static int davinci_enter_idle(struct cpuidle_device *dev,
+			      struct cpuidle_driver *drv, int index)
+{
+	davinci_save_ddr_power(1, ddr2_pdown);
+	cpu_do_idle();
+	davinci_save_ddr_power(0, ddr2_pdown);
+
+	return index;
+}
+
+static struct cpuidle_driver davinci_idle_driver = {
+	.name			= "cpuidle-davinci",
+	.owner			= THIS_MODULE,
+	.states[0]		= ARM_CPUIDLE_WFI_STATE,
+	.states[1]		= {
+		.enter			= davinci_enter_idle,
+		.exit_latency		= 10,
+		.target_residency	= 100000,
+		.flags			= CPUIDLE_FLAG_TIME_VALID,
+		.name			= "DDR SR",
+		.desc			= "WFI and DDR Self Refresh",
+	},
+	.state_count = DAVINCI_CPUIDLE_MAX_STATES,
+};
+
+static int __init davinci_cpuidle_probe(struct platform_device *pdev)
+{
+	struct davinci_cpuidle_config *pdata = pdev->dev.platform_data;
+
+	if (!pdata) {
+		dev_err(&pdev->dev, "cannot get platform data\n");
+		return -ENOENT;
+	}
+
+	ddr2_reg_base = pdata->ddr2_ctlr_base;
+
+	ddr2_pdown = pdata->ddr2_pdown;
+
+	return cpuidle_register(&davinci_idle_driver, NULL);
+}
+
+static struct platform_driver davinci_cpuidle_driver = {
+	.driver = {
+		.name	= "cpuidle-davinci",
+		.owner	= THIS_MODULE,
+	},
+};
+
+static int __init davinci_cpuidle_init(void)
+{
+	return platform_driver_probe(&davinci_cpuidle_driver,
+						davinci_cpuidle_probe);
+}
+device_initcall(davinci_cpuidle_init);
-- 
1.8.2.3

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH 3/8] ARM: imx: move cpuidle drivers to drivers/cpuidle/
  2013-06-26 10:15 ` Bartlomiej Zolnierkiewicz
@ 2013-06-26 10:15   ` Bartlomiej Zolnierkiewicz
  -1 siblings, 0 replies; 42+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2013-06-26 10:15 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux-pm, linux, nicolas.ferre, plagnioj, nsekhar, khilman,
	kernel, shawn.guo, tony, ben-linux, kgene.kim, horms,
	magnus.damm, swarren, srinidhi.kasagar, linus.walleij,
	daniel.lezcano, rjw, kyungmin.park, b.zolnierkie

While at it:
- remove needless "cpuidle.h" include from cpuidle-imx6q.c
- fix whitespace issue in cpuidle-imx6q.c

Compile tested only.

Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: Shawn Guo <shawn.guo@linaro.org>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
 arch/arm/mach-imx/Makefile        |  5 ---
 arch/arm/mach-imx/cpuidle-imx5.c  | 37 -------------------
 arch/arm/mach-imx/cpuidle-imx6q.c | 75 ---------------------------------------
 drivers/cpuidle/Makefile          |  8 +++++
 drivers/cpuidle/cpuidle-imx5.c    | 37 +++++++++++++++++++
 drivers/cpuidle/cpuidle-imx6q.c   | 74 ++++++++++++++++++++++++++++++++++++++
 6 files changed, 119 insertions(+), 117 deletions(-)
 delete mode 100644 arch/arm/mach-imx/cpuidle-imx5.c
 delete mode 100644 arch/arm/mach-imx/cpuidle-imx6q.c
 create mode 100644 drivers/cpuidle/cpuidle-imx5.c
 create mode 100644 drivers/cpuidle/cpuidle-imx6q.c

diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index e20f22d..4affcbb 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -26,11 +26,6 @@ obj-$(CONFIG_MXC_AVIC) += avic.o
 obj-$(CONFIG_MXC_USE_EPIT) += epit.o
 obj-$(CONFIG_MXC_DEBUG_BOARD) += 3ds_debugboard.o
 
-ifeq ($(CONFIG_CPU_IDLE),y)
-obj-$(CONFIG_SOC_IMX5) += cpuidle-imx5.o
-obj-$(CONFIG_SOC_IMX6Q) += cpuidle-imx6q.o
-endif
-
 ifdef CONFIG_SND_IMX_SOC
 obj-y += ssi-fiq.o
 obj-y += ssi-fiq-ksym.o
diff --git a/arch/arm/mach-imx/cpuidle-imx5.c b/arch/arm/mach-imx/cpuidle-imx5.c
deleted file mode 100644
index 5a47e3c..0000000
--- a/arch/arm/mach-imx/cpuidle-imx5.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2012 Freescale Semiconductor, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <linux/cpuidle.h>
-#include <linux/module.h>
-#include <asm/system_misc.h>
-
-static int imx5_cpuidle_enter(struct cpuidle_device *dev,
-			      struct cpuidle_driver *drv, int index)
-{
-	arm_pm_idle();
-	return index;
-}
-
-static struct cpuidle_driver imx5_cpuidle_driver = {
-	.name             = "imx5_cpuidle",
-	.owner            = THIS_MODULE,
-	.states[0] = {
-		.enter            = imx5_cpuidle_enter,
-		.exit_latency     = 2,
-		.target_residency = 1,
-		.flags            = CPUIDLE_FLAG_TIME_VALID,
-		.name             = "IMX5 SRPG",
-		.desc             = "CPU state retained,powered off",
-	},
-	.state_count = 1,
-};
-
-int __init imx5_cpuidle_init(void)
-{
-	return cpuidle_register(&imx5_cpuidle_driver, NULL);
-}
diff --git a/arch/arm/mach-imx/cpuidle-imx6q.c b/arch/arm/mach-imx/cpuidle-imx6q.c
deleted file mode 100644
index 23ddfb6..0000000
--- a/arch/arm/mach-imx/cpuidle-imx6q.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2012 Freescale Semiconductor, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <linux/cpuidle.h>
-#include <linux/module.h>
-#include <asm/cpuidle.h>
-#include <asm/proc-fns.h>
-
-#include "common.h"
-#include "cpuidle.h"
-
-static atomic_t master = ATOMIC_INIT(0);
-static DEFINE_SPINLOCK(master_lock);
-
-static int imx6q_enter_wait(struct cpuidle_device *dev,
-			    struct cpuidle_driver *drv, int index)
-{
-	if (atomic_inc_return(&master) == num_online_cpus()) {
-		/*
-		 * With this lock, we prevent other cpu to exit and enter
-		 * this function again and become the master.
-		 */
-		if (!spin_trylock(&master_lock))
-			goto idle;
-		imx6q_set_lpm(WAIT_UNCLOCKED);
-		cpu_do_idle();
-		imx6q_set_lpm(WAIT_CLOCKED);
-		spin_unlock(&master_lock);
-		goto done;
-	}
-
-idle:
-	cpu_do_idle();
-done:
-	atomic_dec(&master);
-
-	return index;
-}
-
-static struct cpuidle_driver imx6q_cpuidle_driver = {
-	.name = "imx6q_cpuidle",
-	.owner = THIS_MODULE,
-	.states = {
-		/* WFI */
-		ARM_CPUIDLE_WFI_STATE,
-		/* WAIT */
-		{
-			.exit_latency = 50,
-			.target_residency = 75,
-			.flags = CPUIDLE_FLAG_TIME_VALID |
-			         CPUIDLE_FLAG_TIMER_STOP,
-			.enter = imx6q_enter_wait,
-			.name = "WAIT",
-			.desc = "Clock off",
-		},
-	},
-	.state_count = 2,
-	.safe_state_index = 0,
-};
-
-int __init imx6q_cpuidle_init(void)
-{
-	/* Need to enable SCU standby for entering WAIT modes */
-	imx_scu_standby_enable();
-
-	/* Set chicken bit to get a reliable WAIT mode support */
-	imx6q_set_chicken_bit();
-
-	return cpuidle_register(&imx6q_cpuidle_driver, NULL);
-}
diff --git a/drivers/cpuidle/Makefile b/drivers/cpuidle/Makefile
index 3bbb828..9bacf85 100644
--- a/drivers/cpuidle/Makefile
+++ b/drivers/cpuidle/Makefile
@@ -13,4 +13,12 @@ ifeq ($(CONFIG_ARCH_DAVINCI),y)
 	obj-y += cpuidle-davinci.o
 endif
 obj-$(CONFIG_ARCH_KIRKWOOD) += cpuidle-kirkwood.o
+ifeq ($(CONFIG_ARCH_MXC),y)
+	ifeq ($(CONFIG_SOC_IMX5),y)
+		obj-y += cpuidle-imx5.o
+	endif
+	ifeq ($(CONFIG_SOC_IMX6Q),y)
+		obj-y += cpuidle-imx6q.o
+	endif
+endif
 obj-$(CONFIG_CPU_IDLE_ZYNQ) += cpuidle-zynq.o
diff --git a/drivers/cpuidle/cpuidle-imx5.c b/drivers/cpuidle/cpuidle-imx5.c
new file mode 100644
index 0000000..5a47e3c
--- /dev/null
+++ b/drivers/cpuidle/cpuidle-imx5.c
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2012 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/cpuidle.h>
+#include <linux/module.h>
+#include <asm/system_misc.h>
+
+static int imx5_cpuidle_enter(struct cpuidle_device *dev,
+			      struct cpuidle_driver *drv, int index)
+{
+	arm_pm_idle();
+	return index;
+}
+
+static struct cpuidle_driver imx5_cpuidle_driver = {
+	.name             = "imx5_cpuidle",
+	.owner            = THIS_MODULE,
+	.states[0] = {
+		.enter            = imx5_cpuidle_enter,
+		.exit_latency     = 2,
+		.target_residency = 1,
+		.flags            = CPUIDLE_FLAG_TIME_VALID,
+		.name             = "IMX5 SRPG",
+		.desc             = "CPU state retained,powered off",
+	},
+	.state_count = 1,
+};
+
+int __init imx5_cpuidle_init(void)
+{
+	return cpuidle_register(&imx5_cpuidle_driver, NULL);
+}
diff --git a/drivers/cpuidle/cpuidle-imx6q.c b/drivers/cpuidle/cpuidle-imx6q.c
new file mode 100644
index 0000000..01b8622
--- /dev/null
+++ b/drivers/cpuidle/cpuidle-imx6q.c
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2012 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/cpuidle.h>
+#include <linux/module.h>
+#include <asm/cpuidle.h>
+#include <asm/proc-fns.h>
+
+#include "../../arch/arm/mach-imx/common.h"
+
+static atomic_t master = ATOMIC_INIT(0);
+static DEFINE_SPINLOCK(master_lock);
+
+static int imx6q_enter_wait(struct cpuidle_device *dev,
+			    struct cpuidle_driver *drv, int index)
+{
+	if (atomic_inc_return(&master) == num_online_cpus()) {
+		/*
+		 * With this lock, we prevent other cpu to exit and enter
+		 * this function again and become the master.
+		 */
+		if (!spin_trylock(&master_lock))
+			goto idle;
+		imx6q_set_lpm(WAIT_UNCLOCKED);
+		cpu_do_idle();
+		imx6q_set_lpm(WAIT_CLOCKED);
+		spin_unlock(&master_lock);
+		goto done;
+	}
+
+idle:
+	cpu_do_idle();
+done:
+	atomic_dec(&master);
+
+	return index;
+}
+
+static struct cpuidle_driver imx6q_cpuidle_driver = {
+	.name = "imx6q_cpuidle",
+	.owner = THIS_MODULE,
+	.states = {
+		/* WFI */
+		ARM_CPUIDLE_WFI_STATE,
+		/* WAIT */
+		{
+			.exit_latency = 50,
+			.target_residency = 75,
+			.flags = CPUIDLE_FLAG_TIME_VALID |
+				 CPUIDLE_FLAG_TIMER_STOP,
+			.enter = imx6q_enter_wait,
+			.name = "WAIT",
+			.desc = "Clock off",
+		},
+	},
+	.state_count = 2,
+	.safe_state_index = 0,
+};
+
+int __init imx6q_cpuidle_init(void)
+{
+	/* Need to enable SCU standby for entering WAIT modes */
+	imx_scu_standby_enable();
+
+	/* Set chicken bit to get a reliable WAIT mode support */
+	imx6q_set_chicken_bit();
+
+	return cpuidle_register(&imx6q_cpuidle_driver, NULL);
+}
-- 
1.8.2.3


^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH 3/8] ARM: imx: move cpuidle drivers to drivers/cpuidle/
@ 2013-06-26 10:15   ` Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 42+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2013-06-26 10:15 UTC (permalink / raw)
  To: linux-arm-kernel

While at it:
- remove needless "cpuidle.h" include from cpuidle-imx6q.c
- fix whitespace issue in cpuidle-imx6q.c

Compile tested only.

Cc: Sascha Hauer <kernel@pengutronix.de>
Cc: Shawn Guo <shawn.guo@linaro.org>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
 arch/arm/mach-imx/Makefile        |  5 ---
 arch/arm/mach-imx/cpuidle-imx5.c  | 37 -------------------
 arch/arm/mach-imx/cpuidle-imx6q.c | 75 ---------------------------------------
 drivers/cpuidle/Makefile          |  8 +++++
 drivers/cpuidle/cpuidle-imx5.c    | 37 +++++++++++++++++++
 drivers/cpuidle/cpuidle-imx6q.c   | 74 ++++++++++++++++++++++++++++++++++++++
 6 files changed, 119 insertions(+), 117 deletions(-)
 delete mode 100644 arch/arm/mach-imx/cpuidle-imx5.c
 delete mode 100644 arch/arm/mach-imx/cpuidle-imx6q.c
 create mode 100644 drivers/cpuidle/cpuidle-imx5.c
 create mode 100644 drivers/cpuidle/cpuidle-imx6q.c

diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index e20f22d..4affcbb 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -26,11 +26,6 @@ obj-$(CONFIG_MXC_AVIC) += avic.o
 obj-$(CONFIG_MXC_USE_EPIT) += epit.o
 obj-$(CONFIG_MXC_DEBUG_BOARD) += 3ds_debugboard.o
 
-ifeq ($(CONFIG_CPU_IDLE),y)
-obj-$(CONFIG_SOC_IMX5) += cpuidle-imx5.o
-obj-$(CONFIG_SOC_IMX6Q) += cpuidle-imx6q.o
-endif
-
 ifdef CONFIG_SND_IMX_SOC
 obj-y += ssi-fiq.o
 obj-y += ssi-fiq-ksym.o
diff --git a/arch/arm/mach-imx/cpuidle-imx5.c b/arch/arm/mach-imx/cpuidle-imx5.c
deleted file mode 100644
index 5a47e3c..0000000
--- a/arch/arm/mach-imx/cpuidle-imx5.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2012 Freescale Semiconductor, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <linux/cpuidle.h>
-#include <linux/module.h>
-#include <asm/system_misc.h>
-
-static int imx5_cpuidle_enter(struct cpuidle_device *dev,
-			      struct cpuidle_driver *drv, int index)
-{
-	arm_pm_idle();
-	return index;
-}
-
-static struct cpuidle_driver imx5_cpuidle_driver = {
-	.name             = "imx5_cpuidle",
-	.owner            = THIS_MODULE,
-	.states[0] = {
-		.enter            = imx5_cpuidle_enter,
-		.exit_latency     = 2,
-		.target_residency = 1,
-		.flags            = CPUIDLE_FLAG_TIME_VALID,
-		.name             = "IMX5 SRPG",
-		.desc             = "CPU state retained,powered off",
-	},
-	.state_count = 1,
-};
-
-int __init imx5_cpuidle_init(void)
-{
-	return cpuidle_register(&imx5_cpuidle_driver, NULL);
-}
diff --git a/arch/arm/mach-imx/cpuidle-imx6q.c b/arch/arm/mach-imx/cpuidle-imx6q.c
deleted file mode 100644
index 23ddfb6..0000000
--- a/arch/arm/mach-imx/cpuidle-imx6q.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2012 Freescale Semiconductor, Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <linux/cpuidle.h>
-#include <linux/module.h>
-#include <asm/cpuidle.h>
-#include <asm/proc-fns.h>
-
-#include "common.h"
-#include "cpuidle.h"
-
-static atomic_t master = ATOMIC_INIT(0);
-static DEFINE_SPINLOCK(master_lock);
-
-static int imx6q_enter_wait(struct cpuidle_device *dev,
-			    struct cpuidle_driver *drv, int index)
-{
-	if (atomic_inc_return(&master) == num_online_cpus()) {
-		/*
-		 * With this lock, we prevent other cpu to exit and enter
-		 * this function again and become the master.
-		 */
-		if (!spin_trylock(&master_lock))
-			goto idle;
-		imx6q_set_lpm(WAIT_UNCLOCKED);
-		cpu_do_idle();
-		imx6q_set_lpm(WAIT_CLOCKED);
-		spin_unlock(&master_lock);
-		goto done;
-	}
-
-idle:
-	cpu_do_idle();
-done:
-	atomic_dec(&master);
-
-	return index;
-}
-
-static struct cpuidle_driver imx6q_cpuidle_driver = {
-	.name = "imx6q_cpuidle",
-	.owner = THIS_MODULE,
-	.states = {
-		/* WFI */
-		ARM_CPUIDLE_WFI_STATE,
-		/* WAIT */
-		{
-			.exit_latency = 50,
-			.target_residency = 75,
-			.flags = CPUIDLE_FLAG_TIME_VALID |
-			         CPUIDLE_FLAG_TIMER_STOP,
-			.enter = imx6q_enter_wait,
-			.name = "WAIT",
-			.desc = "Clock off",
-		},
-	},
-	.state_count = 2,
-	.safe_state_index = 0,
-};
-
-int __init imx6q_cpuidle_init(void)
-{
-	/* Need to enable SCU standby for entering WAIT modes */
-	imx_scu_standby_enable();
-
-	/* Set chicken bit to get a reliable WAIT mode support */
-	imx6q_set_chicken_bit();
-
-	return cpuidle_register(&imx6q_cpuidle_driver, NULL);
-}
diff --git a/drivers/cpuidle/Makefile b/drivers/cpuidle/Makefile
index 3bbb828..9bacf85 100644
--- a/drivers/cpuidle/Makefile
+++ b/drivers/cpuidle/Makefile
@@ -13,4 +13,12 @@ ifeq ($(CONFIG_ARCH_DAVINCI),y)
 	obj-y += cpuidle-davinci.o
 endif
 obj-$(CONFIG_ARCH_KIRKWOOD) += cpuidle-kirkwood.o
+ifeq ($(CONFIG_ARCH_MXC),y)
+	ifeq ($(CONFIG_SOC_IMX5),y)
+		obj-y += cpuidle-imx5.o
+	endif
+	ifeq ($(CONFIG_SOC_IMX6Q),y)
+		obj-y += cpuidle-imx6q.o
+	endif
+endif
 obj-$(CONFIG_CPU_IDLE_ZYNQ) += cpuidle-zynq.o
diff --git a/drivers/cpuidle/cpuidle-imx5.c b/drivers/cpuidle/cpuidle-imx5.c
new file mode 100644
index 0000000..5a47e3c
--- /dev/null
+++ b/drivers/cpuidle/cpuidle-imx5.c
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2012 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/cpuidle.h>
+#include <linux/module.h>
+#include <asm/system_misc.h>
+
+static int imx5_cpuidle_enter(struct cpuidle_device *dev,
+			      struct cpuidle_driver *drv, int index)
+{
+	arm_pm_idle();
+	return index;
+}
+
+static struct cpuidle_driver imx5_cpuidle_driver = {
+	.name             = "imx5_cpuidle",
+	.owner            = THIS_MODULE,
+	.states[0] = {
+		.enter            = imx5_cpuidle_enter,
+		.exit_latency     = 2,
+		.target_residency = 1,
+		.flags            = CPUIDLE_FLAG_TIME_VALID,
+		.name             = "IMX5 SRPG",
+		.desc             = "CPU state retained,powered off",
+	},
+	.state_count = 1,
+};
+
+int __init imx5_cpuidle_init(void)
+{
+	return cpuidle_register(&imx5_cpuidle_driver, NULL);
+}
diff --git a/drivers/cpuidle/cpuidle-imx6q.c b/drivers/cpuidle/cpuidle-imx6q.c
new file mode 100644
index 0000000..01b8622
--- /dev/null
+++ b/drivers/cpuidle/cpuidle-imx6q.c
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2012 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/cpuidle.h>
+#include <linux/module.h>
+#include <asm/cpuidle.h>
+#include <asm/proc-fns.h>
+
+#include "../../arch/arm/mach-imx/common.h"
+
+static atomic_t master = ATOMIC_INIT(0);
+static DEFINE_SPINLOCK(master_lock);
+
+static int imx6q_enter_wait(struct cpuidle_device *dev,
+			    struct cpuidle_driver *drv, int index)
+{
+	if (atomic_inc_return(&master) == num_online_cpus()) {
+		/*
+		 * With this lock, we prevent other cpu to exit and enter
+		 * this function again and become the master.
+		 */
+		if (!spin_trylock(&master_lock))
+			goto idle;
+		imx6q_set_lpm(WAIT_UNCLOCKED);
+		cpu_do_idle();
+		imx6q_set_lpm(WAIT_CLOCKED);
+		spin_unlock(&master_lock);
+		goto done;
+	}
+
+idle:
+	cpu_do_idle();
+done:
+	atomic_dec(&master);
+
+	return index;
+}
+
+static struct cpuidle_driver imx6q_cpuidle_driver = {
+	.name = "imx6q_cpuidle",
+	.owner = THIS_MODULE,
+	.states = {
+		/* WFI */
+		ARM_CPUIDLE_WFI_STATE,
+		/* WAIT */
+		{
+			.exit_latency = 50,
+			.target_residency = 75,
+			.flags = CPUIDLE_FLAG_TIME_VALID |
+				 CPUIDLE_FLAG_TIMER_STOP,
+			.enter = imx6q_enter_wait,
+			.name = "WAIT",
+			.desc = "Clock off",
+		},
+	},
+	.state_count = 2,
+	.safe_state_index = 0,
+};
+
+int __init imx6q_cpuidle_init(void)
+{
+	/* Need to enable SCU standby for entering WAIT modes */
+	imx_scu_standby_enable();
+
+	/* Set chicken bit to get a reliable WAIT mode support */
+	imx6q_set_chicken_bit();
+
+	return cpuidle_register(&imx6q_cpuidle_driver, NULL);
+}
-- 
1.8.2.3

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH 4/8] ARM: OMAP: move cpuidle drivers to drivers/cpuidle/
  2013-06-26 10:15 ` Bartlomiej Zolnierkiewicz
@ 2013-06-26 10:15   ` Bartlomiej Zolnierkiewicz
  -1 siblings, 0 replies; 42+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2013-06-26 10:15 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux-pm, linux, nicolas.ferre, plagnioj, nsekhar, khilman,
	kernel, shawn.guo, tony, ben-linux, kgene.kim, horms,
	magnus.damm, swarren, srinidhi.kasagar, linus.walleij,
	daniel.lezcano, rjw, kyungmin.park, b.zolnierkie

While at it:
- remove file path from comment
- fix whitespace issues

Compile tested only.

Cc: Tony Lindgren <tony@atomide.com>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
 arch/arm/mach-omap2/Makefile       |   5 -
 arch/arm/mach-omap2/cpuidle34xx.c  | 344 -------------------------------------
 arch/arm/mach-omap2/cpuidle44xx.c  | 217 -----------------------
 drivers/cpuidle/Makefile           |  10 ++
 drivers/cpuidle/cpuidle-omap34xx.c | 342 ++++++++++++++++++++++++++++++++++++
 drivers/cpuidle/cpuidle-omap44xx.c | 216 +++++++++++++++++++++++
 6 files changed, 568 insertions(+), 566 deletions(-)
 delete mode 100644 arch/arm/mach-omap2/cpuidle34xx.c
 delete mode 100644 arch/arm/mach-omap2/cpuidle44xx.c
 create mode 100644 drivers/cpuidle/cpuidle-omap34xx.c
 create mode 100644 drivers/cpuidle/cpuidle-omap44xx.c

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 0520dc4..b80b086 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -102,11 +102,6 @@ endif
 
 endif
 
-ifeq ($(CONFIG_CPU_IDLE),y)
-obj-$(CONFIG_ARCH_OMAP3)                += cpuidle34xx.o
-obj-$(CONFIG_ARCH_OMAP4)                += cpuidle44xx.o
-endif
-
 # PRCM
 obj-y					+= prm_common.o cm_common.o
 obj-$(CONFIG_ARCH_OMAP2)		+= prm2xxx_3xxx.o prm2xxx.o cm2xxx.o
diff --git a/arch/arm/mach-omap2/cpuidle34xx.c b/arch/arm/mach-omap2/cpuidle34xx.c
deleted file mode 100644
index e18709d..0000000
--- a/arch/arm/mach-omap2/cpuidle34xx.c
+++ /dev/null
@@ -1,344 +0,0 @@
-/*
- * linux/arch/arm/mach-omap2/cpuidle34xx.c
- *
- * OMAP3 CPU IDLE Routines
- *
- * Copyright (C) 2008 Texas Instruments, Inc.
- * Rajendra Nayak <rnayak@ti.com>
- *
- * Copyright (C) 2007 Texas Instruments, Inc.
- * Karthik Dasu <karthik-dp@ti.com>
- *
- * Copyright (C) 2006 Nokia Corporation
- * Tony Lindgren <tony@atomide.com>
- *
- * Copyright (C) 2005 Texas Instruments, Inc.
- * Richard Woodruff <r-woodruff2@ti.com>
- *
- * Based on pm.c for omap2
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <linux/sched.h>
-#include <linux/cpuidle.h>
-#include <linux/export.h>
-#include <linux/cpu_pm.h>
-#include <asm/cpuidle.h>
-
-#include "powerdomain.h"
-#include "clockdomain.h"
-
-#include "pm.h"
-#include "control.h"
-#include "common.h"
-
-/* Mach specific information to be recorded in the C-state driver_data */
-struct omap3_idle_statedata {
-	u8 mpu_state;
-	u8 core_state;
-	u8 per_min_state;
-	u8 flags;
-};
-
-static struct powerdomain *mpu_pd, *core_pd, *per_pd, *cam_pd;
-
-/*
- * Possible flag bits for struct omap3_idle_statedata.flags:
- *
- * OMAP_CPUIDLE_CX_NO_CLKDM_IDLE: don't allow the MPU clockdomain to go
- *    inactive.  This in turn prevents the MPU DPLL from entering autoidle
- *    mode, so wakeup latency is greatly reduced, at the cost of additional
- *    energy consumption.  This also prevents the CORE clockdomain from
- *    entering idle.
- */
-#define OMAP_CPUIDLE_CX_NO_CLKDM_IDLE		BIT(0)
-
-/*
- * Prevent PER OFF if CORE is not in RETention or OFF as this would
- * disable PER wakeups completely.
- */
-static struct omap3_idle_statedata omap3_idle_data[] = {
-	{
-		.mpu_state = PWRDM_POWER_ON,
-		.core_state = PWRDM_POWER_ON,
-		/* In C1 do not allow PER state lower than CORE state */
-		.per_min_state = PWRDM_POWER_ON,
-		.flags = OMAP_CPUIDLE_CX_NO_CLKDM_IDLE,
-	},
-	{
-		.mpu_state = PWRDM_POWER_ON,
-		.core_state = PWRDM_POWER_ON,
-		.per_min_state = PWRDM_POWER_RET,
-	},
-	{
-		.mpu_state = PWRDM_POWER_RET,
-		.core_state = PWRDM_POWER_ON,
-		.per_min_state = PWRDM_POWER_RET,
-	},
-	{
-		.mpu_state = PWRDM_POWER_OFF,
-		.core_state = PWRDM_POWER_ON,
-		.per_min_state = PWRDM_POWER_RET,
-	},
-	{
-		.mpu_state = PWRDM_POWER_RET,
-		.core_state = PWRDM_POWER_RET,
-		.per_min_state = PWRDM_POWER_OFF,
-	},
-	{
-		.mpu_state = PWRDM_POWER_OFF,
-		.core_state = PWRDM_POWER_RET,
-		.per_min_state = PWRDM_POWER_OFF,
-	},
-	{
-		.mpu_state = PWRDM_POWER_OFF,
-		.core_state = PWRDM_POWER_OFF,
-		.per_min_state = PWRDM_POWER_OFF,
-	},
-};
-
-/**
- * omap3_enter_idle - Programs OMAP3 to enter the specified state
- * @dev: cpuidle device
- * @drv: cpuidle driver
- * @index: the index of state to be entered
- */
-static int omap3_enter_idle(struct cpuidle_device *dev,
-			    struct cpuidle_driver *drv,
-			    int index)
-{
-	struct omap3_idle_statedata *cx = &omap3_idle_data[index];
-
-	if (omap_irq_pending() || need_resched())
-		goto return_sleep_time;
-
-	/* Deny idle for C1 */
-	if (cx->flags & OMAP_CPUIDLE_CX_NO_CLKDM_IDLE) {
-		clkdm_deny_idle(mpu_pd->pwrdm_clkdms[0]);
-	} else {
-		pwrdm_set_next_pwrst(mpu_pd, cx->mpu_state);
-		pwrdm_set_next_pwrst(core_pd, cx->core_state);
-	}
-
-	/*
-	 * Call idle CPU PM enter notifier chain so that
-	 * VFP context is saved.
-	 */
-	if (cx->mpu_state == PWRDM_POWER_OFF)
-		cpu_pm_enter();
-
-	/* Execute ARM wfi */
-	omap_sram_idle();
-
-	/*
-	 * Call idle CPU PM enter notifier chain to restore
-	 * VFP context.
-	 */
-	if (cx->mpu_state == PWRDM_POWER_OFF &&
-	    pwrdm_read_prev_pwrst(mpu_pd) == PWRDM_POWER_OFF)
-		cpu_pm_exit();
-
-	/* Re-allow idle for C1 */
-	if (cx->flags & OMAP_CPUIDLE_CX_NO_CLKDM_IDLE)
-		clkdm_allow_idle(mpu_pd->pwrdm_clkdms[0]);
-
-return_sleep_time:
-
-	return index;
-}
-
-/**
- * next_valid_state - Find next valid C-state
- * @dev: cpuidle device
- * @drv: cpuidle driver
- * @index: Index of currently selected c-state
- *
- * If the state corresponding to index is valid, index is returned back
- * to the caller. Else, this function searches for a lower c-state which is
- * still valid (as defined in omap3_power_states[]) and returns its index.
- *
- * A state is valid if the 'valid' field is enabled and
- * if it satisfies the enable_off_mode condition.
- */
-static int next_valid_state(struct cpuidle_device *dev,
-			    struct cpuidle_driver *drv, int index)
-{
-	struct omap3_idle_statedata *cx = &omap3_idle_data[index];
-	u32 mpu_deepest_state = PWRDM_POWER_RET;
-	u32 core_deepest_state = PWRDM_POWER_RET;
-	int idx;
-	int next_index = 0; /* C1 is the default value */
-
-	if (enable_off_mode) {
-		mpu_deepest_state = PWRDM_POWER_OFF;
-		/*
-		 * Erratum i583: valable for ES rev < Es1.2 on 3630.
-		 * CORE OFF mode is not supported in a stable form, restrict
-		 * instead the CORE state to RET.
-		 */
-		if (!IS_PM34XX_ERRATUM(PM_SDRC_WAKEUP_ERRATUM_i583))
-			core_deepest_state = PWRDM_POWER_OFF;
-	}
-
-	/* Check if current state is valid */
-	if ((cx->mpu_state >= mpu_deepest_state) &&
-	    (cx->core_state >= core_deepest_state))
-		return index;
-
-	/*
-	 * Drop to next valid state.
-	 * Start search from the next (lower) state.
-	 */
-	for (idx = index - 1; idx >= 0; idx--) {
-		cx = &omap3_idle_data[idx];
-		if ((cx->mpu_state >= mpu_deepest_state) &&
-		    (cx->core_state >= core_deepest_state)) {
-			next_index = idx;
-			break;
-		}
-	}
-
-	return next_index;
-}
-
-/**
- * omap3_enter_idle_bm - Checks for any bus activity
- * @dev: cpuidle device
- * @drv: cpuidle driver
- * @index: array index of target state to be programmed
- *
- * This function checks for any pending activity and then programs
- * the device to the specified or a safer state.
- */
-static int omap3_enter_idle_bm(struct cpuidle_device *dev,
-			       struct cpuidle_driver *drv,
-			       int index)
-{
-	int new_state_idx, ret;
-	u8 per_next_state, per_saved_state;
-	struct omap3_idle_statedata *cx;
-
-	/*
-	 * Use only C1 if CAM is active.
-	 * CAM does not have wakeup capability in OMAP3.
-	 */
-	if (pwrdm_read_pwrst(cam_pd) == PWRDM_POWER_ON)
-		new_state_idx = drv->safe_state_index;
-	else
-		new_state_idx = next_valid_state(dev, drv, index);
-
-	/*
-	 * FIXME: we currently manage device-specific idle states
-	 *        for PER and CORE in combination with CPU-specific
-	 *        idle states.  This is wrong, and device-specific
-	 *        idle management needs to be separated out into
-	 *        its own code.
-	 */
-
-	/* Program PER state */
-	cx = &omap3_idle_data[new_state_idx];
-
-	per_next_state = pwrdm_read_next_pwrst(per_pd);
-	per_saved_state = per_next_state;
-	if (per_next_state < cx->per_min_state) {
-		per_next_state = cx->per_min_state;
-		pwrdm_set_next_pwrst(per_pd, per_next_state);
-	}
-
-	ret = omap3_enter_idle(dev, drv, new_state_idx);
-
-	/* Restore original PER state if it was modified */
-	if (per_next_state != per_saved_state)
-		pwrdm_set_next_pwrst(per_pd, per_saved_state);
-
-	return ret;
-}
-
-static struct cpuidle_driver omap3_idle_driver = {
-	.name             = "omap3_idle",
-	.owner            = THIS_MODULE,
-	.states = {
-		{
-			.enter		  = omap3_enter_idle_bm,
-			.exit_latency	  = 2 + 2,
-			.target_residency = 5,
-			.flags		  = CPUIDLE_FLAG_TIME_VALID,
-			.name		  = "C1",
-			.desc		  = "MPU ON + CORE ON",
-		},
-		{
-			.enter		  = omap3_enter_idle_bm,
-			.exit_latency	  = 10 + 10,
-			.target_residency = 30,
-			.flags		  = CPUIDLE_FLAG_TIME_VALID,
-			.name		  = "C2",
-			.desc		  = "MPU ON + CORE ON",
-		},
-		{
-			.enter		  = omap3_enter_idle_bm,
-			.exit_latency	  = 50 + 50,
-			.target_residency = 300,
-			.flags		  = CPUIDLE_FLAG_TIME_VALID,
-			.name		  = "C3",
-			.desc		  = "MPU RET + CORE ON",
-		},
-		{
-			.enter		  = omap3_enter_idle_bm,
-			.exit_latency	  = 1500 + 1800,
-			.target_residency = 4000,
-			.flags		  = CPUIDLE_FLAG_TIME_VALID,
-			.name		  = "C4",
-			.desc		  = "MPU OFF + CORE ON",
-		},
-		{
-			.enter		  = omap3_enter_idle_bm,
-			.exit_latency	  = 2500 + 7500,
-			.target_residency = 12000,
-			.flags		  = CPUIDLE_FLAG_TIME_VALID,
-			.name		  = "C5",
-			.desc		  = "MPU RET + CORE RET",
-		},
-		{
-			.enter		  = omap3_enter_idle_bm,
-			.exit_latency	  = 3000 + 8500,
-			.target_residency = 15000,
-			.flags		  = CPUIDLE_FLAG_TIME_VALID,
-			.name		  = "C6",
-			.desc		  = "MPU OFF + CORE RET",
-		},
-		{
-			.enter		  = omap3_enter_idle_bm,
-			.exit_latency	  = 10000 + 30000,
-			.target_residency = 30000,
-			.flags		  = CPUIDLE_FLAG_TIME_VALID,
-			.name		  = "C7",
-			.desc		  = "MPU OFF + CORE OFF",
-		},
-	},
-	.state_count = ARRAY_SIZE(omap3_idle_data),
-	.safe_state_index = 0,
-};
-
-/* Public functions */
-
-/**
- * omap3_idle_init - Init routine for OMAP3 idle
- *
- * Registers the OMAP3 specific cpuidle driver to the cpuidle
- * framework with the valid set of states.
- */
-int __init omap3_idle_init(void)
-{
-	mpu_pd = pwrdm_lookup("mpu_pwrdm");
-	core_pd = pwrdm_lookup("core_pwrdm");
-	per_pd = pwrdm_lookup("per_pwrdm");
-	cam_pd = pwrdm_lookup("cam_pwrdm");
-
-	if (!mpu_pd || !core_pd || !per_pd || !cam_pd)
-		return -ENODEV;
-
-	return cpuidle_register(&omap3_idle_driver, NULL);
-}
diff --git a/arch/arm/mach-omap2/cpuidle44xx.c b/arch/arm/mach-omap2/cpuidle44xx.c
deleted file mode 100644
index c443f2e..0000000
--- a/arch/arm/mach-omap2/cpuidle44xx.c
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * OMAP4+ CPU idle Routines
- *
- * Copyright (C) 2011-2013 Texas Instruments, Inc.
- * Santosh Shilimkar <santosh.shilimkar@ti.com>
- * Rajendra Nayak <rnayak@ti.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <linux/sched.h>
-#include <linux/cpuidle.h>
-#include <linux/cpu_pm.h>
-#include <linux/export.h>
-
-#include <asm/cpuidle.h>
-#include <asm/proc-fns.h>
-
-#include "common.h"
-#include "pm.h"
-#include "prm.h"
-#include "clockdomain.h"
-
-/* Machine specific information */
-struct idle_statedata {
-	u32 cpu_state;
-	u32 mpu_logic_state;
-	u32 mpu_state;
-};
-
-static struct idle_statedata omap4_idle_data[] = {
-	{
-		.cpu_state = PWRDM_POWER_ON,
-		.mpu_state = PWRDM_POWER_ON,
-		.mpu_logic_state = PWRDM_POWER_RET,
-	},
-	{
-		.cpu_state = PWRDM_POWER_OFF,
-		.mpu_state = PWRDM_POWER_RET,
-		.mpu_logic_state = PWRDM_POWER_RET,
-	},
-	{
-		.cpu_state = PWRDM_POWER_OFF,
-		.mpu_state = PWRDM_POWER_RET,
-		.mpu_logic_state = PWRDM_POWER_OFF,
-	},
-};
-
-static struct powerdomain *mpu_pd, *cpu_pd[NR_CPUS];
-static struct clockdomain *cpu_clkdm[NR_CPUS];
-
-static atomic_t abort_barrier;
-static bool cpu_done[NR_CPUS];
-static struct idle_statedata *state_ptr = &omap4_idle_data[0];
-
-/* Private functions */
-
-/**
- * omap_enter_idle_[simple/coupled] - OMAP4PLUS cpuidle entry functions
- * @dev: cpuidle device
- * @drv: cpuidle driver
- * @index: the index of state to be entered
- *
- * Called from the CPUidle framework to program the device to the
- * specified low power state selected by the governor.
- * Returns the amount of time spent in the low power state.
- */
-static int omap_enter_idle_simple(struct cpuidle_device *dev,
-			struct cpuidle_driver *drv,
-			int index)
-{
-	omap_do_wfi();
-	return index;
-}
-
-static int omap_enter_idle_coupled(struct cpuidle_device *dev,
-			struct cpuidle_driver *drv,
-			int index)
-{
-	struct idle_statedata *cx = state_ptr + index;
-
-	/*
-	 * CPU0 has to wait and stay ON until CPU1 is OFF state.
-	 * This is necessary to honour hardware recommondation
-	 * of triggeing all the possible low power modes once CPU1 is
-	 * out of coherency and in OFF mode.
-	 */
-	if (dev->cpu == 0 && cpumask_test_cpu(1, cpu_online_mask)) {
-		while (pwrdm_read_pwrst(cpu_pd[1]) != PWRDM_POWER_OFF) {
-			cpu_relax();
-
-			/*
-			 * CPU1 could have already entered & exited idle
-			 * without hitting off because of a wakeup
-			 * or a failed attempt to hit off mode.  Check for
-			 * that here, otherwise we could spin forever
-			 * waiting for CPU1 off.
-			 */
-			if (cpu_done[1])
-			    goto fail;
-
-		}
-	}
-
-	/*
-	 * Call idle CPU PM enter notifier chain so that
-	 * VFP and per CPU interrupt context is saved.
-	 */
-	cpu_pm_enter();
-
-	if (dev->cpu == 0) {
-		pwrdm_set_logic_retst(mpu_pd, cx->mpu_logic_state);
-		omap_set_pwrdm_state(mpu_pd, cx->mpu_state);
-
-		/*
-		 * Call idle CPU cluster PM enter notifier chain
-		 * to save GIC and wakeupgen context.
-		 */
-		if ((cx->mpu_state == PWRDM_POWER_RET) &&
-			(cx->mpu_logic_state == PWRDM_POWER_OFF))
-				cpu_cluster_pm_enter();
-	}
-
-	omap4_enter_lowpower(dev->cpu, cx->cpu_state);
-	cpu_done[dev->cpu] = true;
-
-	/* Wakeup CPU1 only if it is not offlined */
-	if (dev->cpu == 0 && cpumask_test_cpu(1, cpu_online_mask)) {
-		clkdm_wakeup(cpu_clkdm[1]);
-		omap_set_pwrdm_state(cpu_pd[1], PWRDM_POWER_ON);
-		clkdm_allow_idle(cpu_clkdm[1]);
-	}
-
-	/*
-	 * Call idle CPU PM exit notifier chain to restore
-	 * VFP and per CPU IRQ context.
-	 */
-	cpu_pm_exit();
-
-	/*
-	 * Call idle CPU cluster PM exit notifier chain
-	 * to restore GIC and wakeupgen context.
-	 */
-	if ((cx->mpu_state == PWRDM_POWER_RET) &&
-		(cx->mpu_logic_state == PWRDM_POWER_OFF))
-		cpu_cluster_pm_exit();
-
-fail:
-	cpuidle_coupled_parallel_barrier(dev, &abort_barrier);
-	cpu_done[dev->cpu] = false;
-
-	return index;
-}
-
-static struct cpuidle_driver omap4_idle_driver = {
-	.name				= "omap4_idle",
-	.owner				= THIS_MODULE,
-	.states = {
-		{
-			/* C1 - CPU0 ON + CPU1 ON + MPU ON */
-			.exit_latency = 2 + 2,
-			.target_residency = 5,
-			.flags = CPUIDLE_FLAG_TIME_VALID,
-			.enter = omap_enter_idle_simple,
-			.name = "C1",
-			.desc = "CPUx ON, MPUSS ON"
-		},
-		{
-			/* C2 - CPU0 OFF + CPU1 OFF + MPU CSWR */
-			.exit_latency = 328 + 440,
-			.target_residency = 960,
-			.flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_COUPLED |
-			         CPUIDLE_FLAG_TIMER_STOP,
-			.enter = omap_enter_idle_coupled,
-			.name = "C2",
-			.desc = "CPUx OFF, MPUSS CSWR",
-		},
-		{
-			/* C3 - CPU0 OFF + CPU1 OFF + MPU OSWR */
-			.exit_latency = 460 + 518,
-			.target_residency = 1100,
-			.flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_COUPLED |
-			         CPUIDLE_FLAG_TIMER_STOP,
-			.enter = omap_enter_idle_coupled,
-			.name = "C3",
-			.desc = "CPUx OFF, MPUSS OSWR",
-		},
-	},
-	.state_count = ARRAY_SIZE(omap4_idle_data),
-	.safe_state_index = 0,
-};
-
-/* Public functions */
-
-/**
- * omap4_idle_init - Init routine for OMAP4+ idle
- *
- * Registers the OMAP4+ specific cpuidle driver to the cpuidle
- * framework with the valid set of states.
- */
-int __init omap4_idle_init(void)
-{
-	mpu_pd = pwrdm_lookup("mpu_pwrdm");
-	cpu_pd[0] = pwrdm_lookup("cpu0_pwrdm");
-	cpu_pd[1] = pwrdm_lookup("cpu1_pwrdm");
-	if ((!mpu_pd) || (!cpu_pd[0]) || (!cpu_pd[1]))
-		return -ENODEV;
-
-	cpu_clkdm[0] = clkdm_lookup("mpu0_clkdm");
-	cpu_clkdm[1] = clkdm_lookup("mpu1_clkdm");
-	if (!cpu_clkdm[0] || !cpu_clkdm[1])
-		return -ENODEV;
-
-	return cpuidle_register(&omap4_idle_driver, cpu_online_mask);
-}
diff --git a/drivers/cpuidle/Makefile b/drivers/cpuidle/Makefile
index 9bacf85..6436c67 100644
--- a/drivers/cpuidle/Makefile
+++ b/drivers/cpuidle/Makefile
@@ -21,4 +21,14 @@ ifeq ($(CONFIG_ARCH_MXC),y)
 		obj-y += cpuidle-imx6q.o
 	endif
 endif
+ifeq ($(CONFIG_ARCH_OMAP3),y)
+	ccflags-y += -I$(srctree)/arch/arm/plat-omap/include
+	ccflags-y += -I$(srctree)/arch/arm/mach-omap2/include
+	obj-y += cpuidle-omap34xx.o
+endif
+ifeq ($(CONFIG_ARCH_OMAP4),y)
+	ccflags-y += -I$(srctree)/arch/arm/plat-omap/include
+	ccflags-y += -I$(srctree)/arch/arm/mach-omap2/include
+	obj-y += cpuidle-omap44xx.o
+endif
 obj-$(CONFIG_CPU_IDLE_ZYNQ) += cpuidle-zynq.o
diff --git a/drivers/cpuidle/cpuidle-omap34xx.c b/drivers/cpuidle/cpuidle-omap34xx.c
new file mode 100644
index 0000000..0c14077
--- /dev/null
+++ b/drivers/cpuidle/cpuidle-omap34xx.c
@@ -0,0 +1,342 @@
+/*
+ * OMAP3 CPU IDLE Routines
+ *
+ * Copyright (C) 2008 Texas Instruments, Inc.
+ * Rajendra Nayak <rnayak@ti.com>
+ *
+ * Copyright (C) 2007 Texas Instruments, Inc.
+ * Karthik Dasu <karthik-dp@ti.com>
+ *
+ * Copyright (C) 2006 Nokia Corporation
+ * Tony Lindgren <tony@atomide.com>
+ *
+ * Copyright (C) 2005 Texas Instruments, Inc.
+ * Richard Woodruff <r-woodruff2@ti.com>
+ *
+ * Based on pm.c for omap2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/sched.h>
+#include <linux/cpuidle.h>
+#include <linux/export.h>
+#include <linux/cpu_pm.h>
+#include <asm/cpuidle.h>
+
+#include "../../arch/arm/mach-omap2/powerdomain.h"
+#include "../../arch/arm/mach-omap2/clockdomain.h"
+
+#include "../../arch/arm/mach-omap2/pm.h"
+#include "../../arch/arm/mach-omap2/control.h"
+#include "../../arch/arm/mach-omap2/common.h"
+
+/* Mach specific information to be recorded in the C-state driver_data */
+struct omap3_idle_statedata {
+	u8 mpu_state;
+	u8 core_state;
+	u8 per_min_state;
+	u8 flags;
+};
+
+static struct powerdomain *mpu_pd, *core_pd, *per_pd, *cam_pd;
+
+/*
+ * Possible flag bits for struct omap3_idle_statedata.flags:
+ *
+ * OMAP_CPUIDLE_CX_NO_CLKDM_IDLE: don't allow the MPU clockdomain to go
+ *    inactive.  This in turn prevents the MPU DPLL from entering autoidle
+ *    mode, so wakeup latency is greatly reduced, at the cost of additional
+ *    energy consumption.  This also prevents the CORE clockdomain from
+ *    entering idle.
+ */
+#define OMAP_CPUIDLE_CX_NO_CLKDM_IDLE		BIT(0)
+
+/*
+ * Prevent PER OFF if CORE is not in RETention or OFF as this would
+ * disable PER wakeups completely.
+ */
+static struct omap3_idle_statedata omap3_idle_data[] = {
+	{
+		.mpu_state = PWRDM_POWER_ON,
+		.core_state = PWRDM_POWER_ON,
+		/* In C1 do not allow PER state lower than CORE state */
+		.per_min_state = PWRDM_POWER_ON,
+		.flags = OMAP_CPUIDLE_CX_NO_CLKDM_IDLE,
+	},
+	{
+		.mpu_state = PWRDM_POWER_ON,
+		.core_state = PWRDM_POWER_ON,
+		.per_min_state = PWRDM_POWER_RET,
+	},
+	{
+		.mpu_state = PWRDM_POWER_RET,
+		.core_state = PWRDM_POWER_ON,
+		.per_min_state = PWRDM_POWER_RET,
+	},
+	{
+		.mpu_state = PWRDM_POWER_OFF,
+		.core_state = PWRDM_POWER_ON,
+		.per_min_state = PWRDM_POWER_RET,
+	},
+	{
+		.mpu_state = PWRDM_POWER_RET,
+		.core_state = PWRDM_POWER_RET,
+		.per_min_state = PWRDM_POWER_OFF,
+	},
+	{
+		.mpu_state = PWRDM_POWER_OFF,
+		.core_state = PWRDM_POWER_RET,
+		.per_min_state = PWRDM_POWER_OFF,
+	},
+	{
+		.mpu_state = PWRDM_POWER_OFF,
+		.core_state = PWRDM_POWER_OFF,
+		.per_min_state = PWRDM_POWER_OFF,
+	},
+};
+
+/**
+ * omap3_enter_idle - Programs OMAP3 to enter the specified state
+ * @dev: cpuidle device
+ * @drv: cpuidle driver
+ * @index: the index of state to be entered
+ */
+static int omap3_enter_idle(struct cpuidle_device *dev,
+			    struct cpuidle_driver *drv,
+			    int index)
+{
+	struct omap3_idle_statedata *cx = &omap3_idle_data[index];
+
+	if (omap_irq_pending() || need_resched())
+		goto return_sleep_time;
+
+	/* Deny idle for C1 */
+	if (cx->flags & OMAP_CPUIDLE_CX_NO_CLKDM_IDLE) {
+		clkdm_deny_idle(mpu_pd->pwrdm_clkdms[0]);
+	} else {
+		pwrdm_set_next_pwrst(mpu_pd, cx->mpu_state);
+		pwrdm_set_next_pwrst(core_pd, cx->core_state);
+	}
+
+	/*
+	 * Call idle CPU PM enter notifier chain so that
+	 * VFP context is saved.
+	 */
+	if (cx->mpu_state == PWRDM_POWER_OFF)
+		cpu_pm_enter();
+
+	/* Execute ARM wfi */
+	omap_sram_idle();
+
+	/*
+	 * Call idle CPU PM enter notifier chain to restore
+	 * VFP context.
+	 */
+	if (cx->mpu_state == PWRDM_POWER_OFF &&
+	    pwrdm_read_prev_pwrst(mpu_pd) == PWRDM_POWER_OFF)
+		cpu_pm_exit();
+
+	/* Re-allow idle for C1 */
+	if (cx->flags & OMAP_CPUIDLE_CX_NO_CLKDM_IDLE)
+		clkdm_allow_idle(mpu_pd->pwrdm_clkdms[0]);
+
+return_sleep_time:
+
+	return index;
+}
+
+/**
+ * next_valid_state - Find next valid C-state
+ * @dev: cpuidle device
+ * @drv: cpuidle driver
+ * @index: Index of currently selected c-state
+ *
+ * If the state corresponding to index is valid, index is returned back
+ * to the caller. Else, this function searches for a lower c-state which is
+ * still valid (as defined in omap3_power_states[]) and returns its index.
+ *
+ * A state is valid if the 'valid' field is enabled and
+ * if it satisfies the enable_off_mode condition.
+ */
+static int next_valid_state(struct cpuidle_device *dev,
+			    struct cpuidle_driver *drv, int index)
+{
+	struct omap3_idle_statedata *cx = &omap3_idle_data[index];
+	u32 mpu_deepest_state = PWRDM_POWER_RET;
+	u32 core_deepest_state = PWRDM_POWER_RET;
+	int idx;
+	int next_index = 0; /* C1 is the default value */
+
+	if (enable_off_mode) {
+		mpu_deepest_state = PWRDM_POWER_OFF;
+		/*
+		 * Erratum i583: valable for ES rev < Es1.2 on 3630.
+		 * CORE OFF mode is not supported in a stable form, restrict
+		 * instead the CORE state to RET.
+		 */
+		if (!IS_PM34XX_ERRATUM(PM_SDRC_WAKEUP_ERRATUM_i583))
+			core_deepest_state = PWRDM_POWER_OFF;
+	}
+
+	/* Check if current state is valid */
+	if ((cx->mpu_state >= mpu_deepest_state) &&
+	    (cx->core_state >= core_deepest_state))
+		return index;
+
+	/*
+	 * Drop to next valid state.
+	 * Start search from the next (lower) state.
+	 */
+	for (idx = index - 1; idx >= 0; idx--) {
+		cx = &omap3_idle_data[idx];
+		if ((cx->mpu_state >= mpu_deepest_state) &&
+		    (cx->core_state >= core_deepest_state)) {
+			next_index = idx;
+			break;
+		}
+	}
+
+	return next_index;
+}
+
+/**
+ * omap3_enter_idle_bm - Checks for any bus activity
+ * @dev: cpuidle device
+ * @drv: cpuidle driver
+ * @index: array index of target state to be programmed
+ *
+ * This function checks for any pending activity and then programs
+ * the device to the specified or a safer state.
+ */
+static int omap3_enter_idle_bm(struct cpuidle_device *dev,
+			       struct cpuidle_driver *drv,
+			       int index)
+{
+	int new_state_idx, ret;
+	u8 per_next_state, per_saved_state;
+	struct omap3_idle_statedata *cx;
+
+	/*
+	 * Use only C1 if CAM is active.
+	 * CAM does not have wakeup capability in OMAP3.
+	 */
+	if (pwrdm_read_pwrst(cam_pd) == PWRDM_POWER_ON)
+		new_state_idx = drv->safe_state_index;
+	else
+		new_state_idx = next_valid_state(dev, drv, index);
+
+	/*
+	 * FIXME: we currently manage device-specific idle states
+	 *        for PER and CORE in combination with CPU-specific
+	 *        idle states.  This is wrong, and device-specific
+	 *        idle management needs to be separated out into
+	 *        its own code.
+	 */
+
+	/* Program PER state */
+	cx = &omap3_idle_data[new_state_idx];
+
+	per_next_state = pwrdm_read_next_pwrst(per_pd);
+	per_saved_state = per_next_state;
+	if (per_next_state < cx->per_min_state) {
+		per_next_state = cx->per_min_state;
+		pwrdm_set_next_pwrst(per_pd, per_next_state);
+	}
+
+	ret = omap3_enter_idle(dev, drv, new_state_idx);
+
+	/* Restore original PER state if it was modified */
+	if (per_next_state != per_saved_state)
+		pwrdm_set_next_pwrst(per_pd, per_saved_state);
+
+	return ret;
+}
+
+static struct cpuidle_driver omap3_idle_driver = {
+	.name             = "omap3_idle",
+	.owner            = THIS_MODULE,
+	.states = {
+		{
+			.enter		  = omap3_enter_idle_bm,
+			.exit_latency	  = 2 + 2,
+			.target_residency = 5,
+			.flags		  = CPUIDLE_FLAG_TIME_VALID,
+			.name		  = "C1",
+			.desc		  = "MPU ON + CORE ON",
+		},
+		{
+			.enter		  = omap3_enter_idle_bm,
+			.exit_latency	  = 10 + 10,
+			.target_residency = 30,
+			.flags		  = CPUIDLE_FLAG_TIME_VALID,
+			.name		  = "C2",
+			.desc		  = "MPU ON + CORE ON",
+		},
+		{
+			.enter		  = omap3_enter_idle_bm,
+			.exit_latency	  = 50 + 50,
+			.target_residency = 300,
+			.flags		  = CPUIDLE_FLAG_TIME_VALID,
+			.name		  = "C3",
+			.desc		  = "MPU RET + CORE ON",
+		},
+		{
+			.enter		  = omap3_enter_idle_bm,
+			.exit_latency	  = 1500 + 1800,
+			.target_residency = 4000,
+			.flags		  = CPUIDLE_FLAG_TIME_VALID,
+			.name		  = "C4",
+			.desc		  = "MPU OFF + CORE ON",
+		},
+		{
+			.enter		  = omap3_enter_idle_bm,
+			.exit_latency	  = 2500 + 7500,
+			.target_residency = 12000,
+			.flags		  = CPUIDLE_FLAG_TIME_VALID,
+			.name		  = "C5",
+			.desc		  = "MPU RET + CORE RET",
+		},
+		{
+			.enter		  = omap3_enter_idle_bm,
+			.exit_latency	  = 3000 + 8500,
+			.target_residency = 15000,
+			.flags		  = CPUIDLE_FLAG_TIME_VALID,
+			.name		  = "C6",
+			.desc		  = "MPU OFF + CORE RET",
+		},
+		{
+			.enter		  = omap3_enter_idle_bm,
+			.exit_latency	  = 10000 + 30000,
+			.target_residency = 30000,
+			.flags		  = CPUIDLE_FLAG_TIME_VALID,
+			.name		  = "C7",
+			.desc		  = "MPU OFF + CORE OFF",
+		},
+	},
+	.state_count = ARRAY_SIZE(omap3_idle_data),
+	.safe_state_index = 0,
+};
+
+/* Public functions */
+
+/**
+ * omap3_idle_init - Init routine for OMAP3 idle
+ *
+ * Registers the OMAP3 specific cpuidle driver to the cpuidle
+ * framework with the valid set of states.
+ */
+int __init omap3_idle_init(void)
+{
+	mpu_pd = pwrdm_lookup("mpu_pwrdm");
+	core_pd = pwrdm_lookup("core_pwrdm");
+	per_pd = pwrdm_lookup("per_pwrdm");
+	cam_pd = pwrdm_lookup("cam_pwrdm");
+
+	if (!mpu_pd || !core_pd || !per_pd || !cam_pd)
+		return -ENODEV;
+
+	return cpuidle_register(&omap3_idle_driver, NULL);
+}
diff --git a/drivers/cpuidle/cpuidle-omap44xx.c b/drivers/cpuidle/cpuidle-omap44xx.c
new file mode 100644
index 0000000..86b8a51
--- /dev/null
+++ b/drivers/cpuidle/cpuidle-omap44xx.c
@@ -0,0 +1,216 @@
+/*
+ * OMAP4+ CPU idle Routines
+ *
+ * Copyright (C) 2011-2013 Texas Instruments, Inc.
+ * Santosh Shilimkar <santosh.shilimkar@ti.com>
+ * Rajendra Nayak <rnayak@ti.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/sched.h>
+#include <linux/cpuidle.h>
+#include <linux/cpu_pm.h>
+#include <linux/export.h>
+
+#include <asm/cpuidle.h>
+#include <asm/proc-fns.h>
+
+#include "../../arch/arm/mach-omap2/common.h"
+#include "../../arch/arm/mach-omap2/pm.h"
+#include "../../arch/arm/mach-omap2/prm.h"
+#include "../../arch/arm/mach-omap2/clockdomain.h"
+
+/* Machine specific information */
+struct idle_statedata {
+	u32 cpu_state;
+	u32 mpu_logic_state;
+	u32 mpu_state;
+};
+
+static struct idle_statedata omap4_idle_data[] = {
+	{
+		.cpu_state = PWRDM_POWER_ON,
+		.mpu_state = PWRDM_POWER_ON,
+		.mpu_logic_state = PWRDM_POWER_RET,
+	},
+	{
+		.cpu_state = PWRDM_POWER_OFF,
+		.mpu_state = PWRDM_POWER_RET,
+		.mpu_logic_state = PWRDM_POWER_RET,
+	},
+	{
+		.cpu_state = PWRDM_POWER_OFF,
+		.mpu_state = PWRDM_POWER_RET,
+		.mpu_logic_state = PWRDM_POWER_OFF,
+	},
+};
+
+static struct powerdomain *mpu_pd, *cpu_pd[NR_CPUS];
+static struct clockdomain *cpu_clkdm[NR_CPUS];
+
+static atomic_t abort_barrier;
+static bool cpu_done[NR_CPUS];
+static struct idle_statedata *state_ptr = &omap4_idle_data[0];
+
+/* Private functions */
+
+/**
+ * omap_enter_idle_[simple/coupled] - OMAP4PLUS cpuidle entry functions
+ * @dev: cpuidle device
+ * @drv: cpuidle driver
+ * @index: the index of state to be entered
+ *
+ * Called from the CPUidle framework to program the device to the
+ * specified low power state selected by the governor.
+ * Returns the amount of time spent in the low power state.
+ */
+static int omap_enter_idle_simple(struct cpuidle_device *dev,
+			struct cpuidle_driver *drv,
+			int index)
+{
+	omap_do_wfi();
+	return index;
+}
+
+static int omap_enter_idle_coupled(struct cpuidle_device *dev,
+			struct cpuidle_driver *drv,
+			int index)
+{
+	struct idle_statedata *cx = state_ptr + index;
+
+	/*
+	 * CPU0 has to wait and stay ON until CPU1 is OFF state.
+	 * This is necessary to honour hardware recommondation
+	 * of triggeing all the possible low power modes once CPU1 is
+	 * out of coherency and in OFF mode.
+	 */
+	if (dev->cpu == 0 && cpumask_test_cpu(1, cpu_online_mask)) {
+		while (pwrdm_read_pwrst(cpu_pd[1]) != PWRDM_POWER_OFF) {
+			cpu_relax();
+
+			/*
+			 * CPU1 could have already entered & exited idle
+			 * without hitting off because of a wakeup
+			 * or a failed attempt to hit off mode.  Check for
+			 * that here, otherwise we could spin forever
+			 * waiting for CPU1 off.
+			 */
+			if (cpu_done[1])
+				goto fail;
+		}
+	}
+
+	/*
+	 * Call idle CPU PM enter notifier chain so that
+	 * VFP and per CPU interrupt context is saved.
+	 */
+	cpu_pm_enter();
+
+	if (dev->cpu == 0) {
+		pwrdm_set_logic_retst(mpu_pd, cx->mpu_logic_state);
+		omap_set_pwrdm_state(mpu_pd, cx->mpu_state);
+
+		/*
+		 * Call idle CPU cluster PM enter notifier chain
+		 * to save GIC and wakeupgen context.
+		 */
+		if ((cx->mpu_state == PWRDM_POWER_RET) &&
+			(cx->mpu_logic_state == PWRDM_POWER_OFF))
+				cpu_cluster_pm_enter();
+	}
+
+	omap4_enter_lowpower(dev->cpu, cx->cpu_state);
+	cpu_done[dev->cpu] = true;
+
+	/* Wakeup CPU1 only if it is not offlined */
+	if (dev->cpu == 0 && cpumask_test_cpu(1, cpu_online_mask)) {
+		clkdm_wakeup(cpu_clkdm[1]);
+		omap_set_pwrdm_state(cpu_pd[1], PWRDM_POWER_ON);
+		clkdm_allow_idle(cpu_clkdm[1]);
+	}
+
+	/*
+	 * Call idle CPU PM exit notifier chain to restore
+	 * VFP and per CPU IRQ context.
+	 */
+	cpu_pm_exit();
+
+	/*
+	 * Call idle CPU cluster PM exit notifier chain
+	 * to restore GIC and wakeupgen context.
+	 */
+	if ((cx->mpu_state == PWRDM_POWER_RET) &&
+		(cx->mpu_logic_state == PWRDM_POWER_OFF))
+		cpu_cluster_pm_exit();
+
+fail:
+	cpuidle_coupled_parallel_barrier(dev, &abort_barrier);
+	cpu_done[dev->cpu] = false;
+
+	return index;
+}
+
+static struct cpuidle_driver omap4_idle_driver = {
+	.name				= "omap4_idle",
+	.owner				= THIS_MODULE,
+	.states = {
+		{
+			/* C1 - CPU0 ON + CPU1 ON + MPU ON */
+			.exit_latency = 2 + 2,
+			.target_residency = 5,
+			.flags = CPUIDLE_FLAG_TIME_VALID,
+			.enter = omap_enter_idle_simple,
+			.name = "C1",
+			.desc = "CPUx ON, MPUSS ON"
+		},
+		{
+			/* C2 - CPU0 OFF + CPU1 OFF + MPU CSWR */
+			.exit_latency = 328 + 440,
+			.target_residency = 960,
+			.flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_COUPLED |
+				 CPUIDLE_FLAG_TIMER_STOP,
+			.enter = omap_enter_idle_coupled,
+			.name = "C2",
+			.desc = "CPUx OFF, MPUSS CSWR",
+		},
+		{
+			/* C3 - CPU0 OFF + CPU1 OFF + MPU OSWR */
+			.exit_latency = 460 + 518,
+			.target_residency = 1100,
+			.flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_COUPLED |
+				 CPUIDLE_FLAG_TIMER_STOP,
+			.enter = omap_enter_idle_coupled,
+			.name = "C3",
+			.desc = "CPUx OFF, MPUSS OSWR",
+		},
+	},
+	.state_count = ARRAY_SIZE(omap4_idle_data),
+	.safe_state_index = 0,
+};
+
+/* Public functions */
+
+/**
+ * omap4_idle_init - Init routine for OMAP4+ idle
+ *
+ * Registers the OMAP4+ specific cpuidle driver to the cpuidle
+ * framework with the valid set of states.
+ */
+int __init omap4_idle_init(void)
+{
+	mpu_pd = pwrdm_lookup("mpu_pwrdm");
+	cpu_pd[0] = pwrdm_lookup("cpu0_pwrdm");
+	cpu_pd[1] = pwrdm_lookup("cpu1_pwrdm");
+	if ((!mpu_pd) || (!cpu_pd[0]) || (!cpu_pd[1]))
+		return -ENODEV;
+
+	cpu_clkdm[0] = clkdm_lookup("mpu0_clkdm");
+	cpu_clkdm[1] = clkdm_lookup("mpu1_clkdm");
+	if (!cpu_clkdm[0] || !cpu_clkdm[1])
+		return -ENODEV;
+
+	return cpuidle_register(&omap4_idle_driver, cpu_online_mask);
+}
-- 
1.8.2.3


^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH 4/8] ARM: OMAP: move cpuidle drivers to drivers/cpuidle/
@ 2013-06-26 10:15   ` Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 42+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2013-06-26 10:15 UTC (permalink / raw)
  To: linux-arm-kernel

While at it:
- remove file path from comment
- fix whitespace issues

Compile tested only.

Cc: Tony Lindgren <tony@atomide.com>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
 arch/arm/mach-omap2/Makefile       |   5 -
 arch/arm/mach-omap2/cpuidle34xx.c  | 344 -------------------------------------
 arch/arm/mach-omap2/cpuidle44xx.c  | 217 -----------------------
 drivers/cpuidle/Makefile           |  10 ++
 drivers/cpuidle/cpuidle-omap34xx.c | 342 ++++++++++++++++++++++++++++++++++++
 drivers/cpuidle/cpuidle-omap44xx.c | 216 +++++++++++++++++++++++
 6 files changed, 568 insertions(+), 566 deletions(-)
 delete mode 100644 arch/arm/mach-omap2/cpuidle34xx.c
 delete mode 100644 arch/arm/mach-omap2/cpuidle44xx.c
 create mode 100644 drivers/cpuidle/cpuidle-omap34xx.c
 create mode 100644 drivers/cpuidle/cpuidle-omap44xx.c

diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 0520dc4..b80b086 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -102,11 +102,6 @@ endif
 
 endif
 
-ifeq ($(CONFIG_CPU_IDLE),y)
-obj-$(CONFIG_ARCH_OMAP3)                += cpuidle34xx.o
-obj-$(CONFIG_ARCH_OMAP4)                += cpuidle44xx.o
-endif
-
 # PRCM
 obj-y					+= prm_common.o cm_common.o
 obj-$(CONFIG_ARCH_OMAP2)		+= prm2xxx_3xxx.o prm2xxx.o cm2xxx.o
diff --git a/arch/arm/mach-omap2/cpuidle34xx.c b/arch/arm/mach-omap2/cpuidle34xx.c
deleted file mode 100644
index e18709d..0000000
--- a/arch/arm/mach-omap2/cpuidle34xx.c
+++ /dev/null
@@ -1,344 +0,0 @@
-/*
- * linux/arch/arm/mach-omap2/cpuidle34xx.c
- *
- * OMAP3 CPU IDLE Routines
- *
- * Copyright (C) 2008 Texas Instruments, Inc.
- * Rajendra Nayak <rnayak@ti.com>
- *
- * Copyright (C) 2007 Texas Instruments, Inc.
- * Karthik Dasu <karthik-dp@ti.com>
- *
- * Copyright (C) 2006 Nokia Corporation
- * Tony Lindgren <tony@atomide.com>
- *
- * Copyright (C) 2005 Texas Instruments, Inc.
- * Richard Woodruff <r-woodruff2@ti.com>
- *
- * Based on pm.c for omap2
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <linux/sched.h>
-#include <linux/cpuidle.h>
-#include <linux/export.h>
-#include <linux/cpu_pm.h>
-#include <asm/cpuidle.h>
-
-#include "powerdomain.h"
-#include "clockdomain.h"
-
-#include "pm.h"
-#include "control.h"
-#include "common.h"
-
-/* Mach specific information to be recorded in the C-state driver_data */
-struct omap3_idle_statedata {
-	u8 mpu_state;
-	u8 core_state;
-	u8 per_min_state;
-	u8 flags;
-};
-
-static struct powerdomain *mpu_pd, *core_pd, *per_pd, *cam_pd;
-
-/*
- * Possible flag bits for struct omap3_idle_statedata.flags:
- *
- * OMAP_CPUIDLE_CX_NO_CLKDM_IDLE: don't allow the MPU clockdomain to go
- *    inactive.  This in turn prevents the MPU DPLL from entering autoidle
- *    mode, so wakeup latency is greatly reduced, at the cost of additional
- *    energy consumption.  This also prevents the CORE clockdomain from
- *    entering idle.
- */
-#define OMAP_CPUIDLE_CX_NO_CLKDM_IDLE		BIT(0)
-
-/*
- * Prevent PER OFF if CORE is not in RETention or OFF as this would
- * disable PER wakeups completely.
- */
-static struct omap3_idle_statedata omap3_idle_data[] = {
-	{
-		.mpu_state = PWRDM_POWER_ON,
-		.core_state = PWRDM_POWER_ON,
-		/* In C1 do not allow PER state lower than CORE state */
-		.per_min_state = PWRDM_POWER_ON,
-		.flags = OMAP_CPUIDLE_CX_NO_CLKDM_IDLE,
-	},
-	{
-		.mpu_state = PWRDM_POWER_ON,
-		.core_state = PWRDM_POWER_ON,
-		.per_min_state = PWRDM_POWER_RET,
-	},
-	{
-		.mpu_state = PWRDM_POWER_RET,
-		.core_state = PWRDM_POWER_ON,
-		.per_min_state = PWRDM_POWER_RET,
-	},
-	{
-		.mpu_state = PWRDM_POWER_OFF,
-		.core_state = PWRDM_POWER_ON,
-		.per_min_state = PWRDM_POWER_RET,
-	},
-	{
-		.mpu_state = PWRDM_POWER_RET,
-		.core_state = PWRDM_POWER_RET,
-		.per_min_state = PWRDM_POWER_OFF,
-	},
-	{
-		.mpu_state = PWRDM_POWER_OFF,
-		.core_state = PWRDM_POWER_RET,
-		.per_min_state = PWRDM_POWER_OFF,
-	},
-	{
-		.mpu_state = PWRDM_POWER_OFF,
-		.core_state = PWRDM_POWER_OFF,
-		.per_min_state = PWRDM_POWER_OFF,
-	},
-};
-
-/**
- * omap3_enter_idle - Programs OMAP3 to enter the specified state
- * @dev: cpuidle device
- * @drv: cpuidle driver
- * @index: the index of state to be entered
- */
-static int omap3_enter_idle(struct cpuidle_device *dev,
-			    struct cpuidle_driver *drv,
-			    int index)
-{
-	struct omap3_idle_statedata *cx = &omap3_idle_data[index];
-
-	if (omap_irq_pending() || need_resched())
-		goto return_sleep_time;
-
-	/* Deny idle for C1 */
-	if (cx->flags & OMAP_CPUIDLE_CX_NO_CLKDM_IDLE) {
-		clkdm_deny_idle(mpu_pd->pwrdm_clkdms[0]);
-	} else {
-		pwrdm_set_next_pwrst(mpu_pd, cx->mpu_state);
-		pwrdm_set_next_pwrst(core_pd, cx->core_state);
-	}
-
-	/*
-	 * Call idle CPU PM enter notifier chain so that
-	 * VFP context is saved.
-	 */
-	if (cx->mpu_state == PWRDM_POWER_OFF)
-		cpu_pm_enter();
-
-	/* Execute ARM wfi */
-	omap_sram_idle();
-
-	/*
-	 * Call idle CPU PM enter notifier chain to restore
-	 * VFP context.
-	 */
-	if (cx->mpu_state == PWRDM_POWER_OFF &&
-	    pwrdm_read_prev_pwrst(mpu_pd) == PWRDM_POWER_OFF)
-		cpu_pm_exit();
-
-	/* Re-allow idle for C1 */
-	if (cx->flags & OMAP_CPUIDLE_CX_NO_CLKDM_IDLE)
-		clkdm_allow_idle(mpu_pd->pwrdm_clkdms[0]);
-
-return_sleep_time:
-
-	return index;
-}
-
-/**
- * next_valid_state - Find next valid C-state
- * @dev: cpuidle device
- * @drv: cpuidle driver
- * @index: Index of currently selected c-state
- *
- * If the state corresponding to index is valid, index is returned back
- * to the caller. Else, this function searches for a lower c-state which is
- * still valid (as defined in omap3_power_states[]) and returns its index.
- *
- * A state is valid if the 'valid' field is enabled and
- * if it satisfies the enable_off_mode condition.
- */
-static int next_valid_state(struct cpuidle_device *dev,
-			    struct cpuidle_driver *drv, int index)
-{
-	struct omap3_idle_statedata *cx = &omap3_idle_data[index];
-	u32 mpu_deepest_state = PWRDM_POWER_RET;
-	u32 core_deepest_state = PWRDM_POWER_RET;
-	int idx;
-	int next_index = 0; /* C1 is the default value */
-
-	if (enable_off_mode) {
-		mpu_deepest_state = PWRDM_POWER_OFF;
-		/*
-		 * Erratum i583: valable for ES rev < Es1.2 on 3630.
-		 * CORE OFF mode is not supported in a stable form, restrict
-		 * instead the CORE state to RET.
-		 */
-		if (!IS_PM34XX_ERRATUM(PM_SDRC_WAKEUP_ERRATUM_i583))
-			core_deepest_state = PWRDM_POWER_OFF;
-	}
-
-	/* Check if current state is valid */
-	if ((cx->mpu_state >= mpu_deepest_state) &&
-	    (cx->core_state >= core_deepest_state))
-		return index;
-
-	/*
-	 * Drop to next valid state.
-	 * Start search from the next (lower) state.
-	 */
-	for (idx = index - 1; idx >= 0; idx--) {
-		cx = &omap3_idle_data[idx];
-		if ((cx->mpu_state >= mpu_deepest_state) &&
-		    (cx->core_state >= core_deepest_state)) {
-			next_index = idx;
-			break;
-		}
-	}
-
-	return next_index;
-}
-
-/**
- * omap3_enter_idle_bm - Checks for any bus activity
- * @dev: cpuidle device
- * @drv: cpuidle driver
- * @index: array index of target state to be programmed
- *
- * This function checks for any pending activity and then programs
- * the device to the specified or a safer state.
- */
-static int omap3_enter_idle_bm(struct cpuidle_device *dev,
-			       struct cpuidle_driver *drv,
-			       int index)
-{
-	int new_state_idx, ret;
-	u8 per_next_state, per_saved_state;
-	struct omap3_idle_statedata *cx;
-
-	/*
-	 * Use only C1 if CAM is active.
-	 * CAM does not have wakeup capability in OMAP3.
-	 */
-	if (pwrdm_read_pwrst(cam_pd) == PWRDM_POWER_ON)
-		new_state_idx = drv->safe_state_index;
-	else
-		new_state_idx = next_valid_state(dev, drv, index);
-
-	/*
-	 * FIXME: we currently manage device-specific idle states
-	 *        for PER and CORE in combination with CPU-specific
-	 *        idle states.  This is wrong, and device-specific
-	 *        idle management needs to be separated out into
-	 *        its own code.
-	 */
-
-	/* Program PER state */
-	cx = &omap3_idle_data[new_state_idx];
-
-	per_next_state = pwrdm_read_next_pwrst(per_pd);
-	per_saved_state = per_next_state;
-	if (per_next_state < cx->per_min_state) {
-		per_next_state = cx->per_min_state;
-		pwrdm_set_next_pwrst(per_pd, per_next_state);
-	}
-
-	ret = omap3_enter_idle(dev, drv, new_state_idx);
-
-	/* Restore original PER state if it was modified */
-	if (per_next_state != per_saved_state)
-		pwrdm_set_next_pwrst(per_pd, per_saved_state);
-
-	return ret;
-}
-
-static struct cpuidle_driver omap3_idle_driver = {
-	.name             = "omap3_idle",
-	.owner            = THIS_MODULE,
-	.states = {
-		{
-			.enter		  = omap3_enter_idle_bm,
-			.exit_latency	  = 2 + 2,
-			.target_residency = 5,
-			.flags		  = CPUIDLE_FLAG_TIME_VALID,
-			.name		  = "C1",
-			.desc		  = "MPU ON + CORE ON",
-		},
-		{
-			.enter		  = omap3_enter_idle_bm,
-			.exit_latency	  = 10 + 10,
-			.target_residency = 30,
-			.flags		  = CPUIDLE_FLAG_TIME_VALID,
-			.name		  = "C2",
-			.desc		  = "MPU ON + CORE ON",
-		},
-		{
-			.enter		  = omap3_enter_idle_bm,
-			.exit_latency	  = 50 + 50,
-			.target_residency = 300,
-			.flags		  = CPUIDLE_FLAG_TIME_VALID,
-			.name		  = "C3",
-			.desc		  = "MPU RET + CORE ON",
-		},
-		{
-			.enter		  = omap3_enter_idle_bm,
-			.exit_latency	  = 1500 + 1800,
-			.target_residency = 4000,
-			.flags		  = CPUIDLE_FLAG_TIME_VALID,
-			.name		  = "C4",
-			.desc		  = "MPU OFF + CORE ON",
-		},
-		{
-			.enter		  = omap3_enter_idle_bm,
-			.exit_latency	  = 2500 + 7500,
-			.target_residency = 12000,
-			.flags		  = CPUIDLE_FLAG_TIME_VALID,
-			.name		  = "C5",
-			.desc		  = "MPU RET + CORE RET",
-		},
-		{
-			.enter		  = omap3_enter_idle_bm,
-			.exit_latency	  = 3000 + 8500,
-			.target_residency = 15000,
-			.flags		  = CPUIDLE_FLAG_TIME_VALID,
-			.name		  = "C6",
-			.desc		  = "MPU OFF + CORE RET",
-		},
-		{
-			.enter		  = omap3_enter_idle_bm,
-			.exit_latency	  = 10000 + 30000,
-			.target_residency = 30000,
-			.flags		  = CPUIDLE_FLAG_TIME_VALID,
-			.name		  = "C7",
-			.desc		  = "MPU OFF + CORE OFF",
-		},
-	},
-	.state_count = ARRAY_SIZE(omap3_idle_data),
-	.safe_state_index = 0,
-};
-
-/* Public functions */
-
-/**
- * omap3_idle_init - Init routine for OMAP3 idle
- *
- * Registers the OMAP3 specific cpuidle driver to the cpuidle
- * framework with the valid set of states.
- */
-int __init omap3_idle_init(void)
-{
-	mpu_pd = pwrdm_lookup("mpu_pwrdm");
-	core_pd = pwrdm_lookup("core_pwrdm");
-	per_pd = pwrdm_lookup("per_pwrdm");
-	cam_pd = pwrdm_lookup("cam_pwrdm");
-
-	if (!mpu_pd || !core_pd || !per_pd || !cam_pd)
-		return -ENODEV;
-
-	return cpuidle_register(&omap3_idle_driver, NULL);
-}
diff --git a/arch/arm/mach-omap2/cpuidle44xx.c b/arch/arm/mach-omap2/cpuidle44xx.c
deleted file mode 100644
index c443f2e..0000000
--- a/arch/arm/mach-omap2/cpuidle44xx.c
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * OMAP4+ CPU idle Routines
- *
- * Copyright (C) 2011-2013 Texas Instruments, Inc.
- * Santosh Shilimkar <santosh.shilimkar@ti.com>
- * Rajendra Nayak <rnayak@ti.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <linux/sched.h>
-#include <linux/cpuidle.h>
-#include <linux/cpu_pm.h>
-#include <linux/export.h>
-
-#include <asm/cpuidle.h>
-#include <asm/proc-fns.h>
-
-#include "common.h"
-#include "pm.h"
-#include "prm.h"
-#include "clockdomain.h"
-
-/* Machine specific information */
-struct idle_statedata {
-	u32 cpu_state;
-	u32 mpu_logic_state;
-	u32 mpu_state;
-};
-
-static struct idle_statedata omap4_idle_data[] = {
-	{
-		.cpu_state = PWRDM_POWER_ON,
-		.mpu_state = PWRDM_POWER_ON,
-		.mpu_logic_state = PWRDM_POWER_RET,
-	},
-	{
-		.cpu_state = PWRDM_POWER_OFF,
-		.mpu_state = PWRDM_POWER_RET,
-		.mpu_logic_state = PWRDM_POWER_RET,
-	},
-	{
-		.cpu_state = PWRDM_POWER_OFF,
-		.mpu_state = PWRDM_POWER_RET,
-		.mpu_logic_state = PWRDM_POWER_OFF,
-	},
-};
-
-static struct powerdomain *mpu_pd, *cpu_pd[NR_CPUS];
-static struct clockdomain *cpu_clkdm[NR_CPUS];
-
-static atomic_t abort_barrier;
-static bool cpu_done[NR_CPUS];
-static struct idle_statedata *state_ptr = &omap4_idle_data[0];
-
-/* Private functions */
-
-/**
- * omap_enter_idle_[simple/coupled] - OMAP4PLUS cpuidle entry functions
- * @dev: cpuidle device
- * @drv: cpuidle driver
- * @index: the index of state to be entered
- *
- * Called from the CPUidle framework to program the device to the
- * specified low power state selected by the governor.
- * Returns the amount of time spent in the low power state.
- */
-static int omap_enter_idle_simple(struct cpuidle_device *dev,
-			struct cpuidle_driver *drv,
-			int index)
-{
-	omap_do_wfi();
-	return index;
-}
-
-static int omap_enter_idle_coupled(struct cpuidle_device *dev,
-			struct cpuidle_driver *drv,
-			int index)
-{
-	struct idle_statedata *cx = state_ptr + index;
-
-	/*
-	 * CPU0 has to wait and stay ON until CPU1 is OFF state.
-	 * This is necessary to honour hardware recommondation
-	 * of triggeing all the possible low power modes once CPU1 is
-	 * out of coherency and in OFF mode.
-	 */
-	if (dev->cpu == 0 && cpumask_test_cpu(1, cpu_online_mask)) {
-		while (pwrdm_read_pwrst(cpu_pd[1]) != PWRDM_POWER_OFF) {
-			cpu_relax();
-
-			/*
-			 * CPU1 could have already entered & exited idle
-			 * without hitting off because of a wakeup
-			 * or a failed attempt to hit off mode.  Check for
-			 * that here, otherwise we could spin forever
-			 * waiting for CPU1 off.
-			 */
-			if (cpu_done[1])
-			    goto fail;
-
-		}
-	}
-
-	/*
-	 * Call idle CPU PM enter notifier chain so that
-	 * VFP and per CPU interrupt context is saved.
-	 */
-	cpu_pm_enter();
-
-	if (dev->cpu == 0) {
-		pwrdm_set_logic_retst(mpu_pd, cx->mpu_logic_state);
-		omap_set_pwrdm_state(mpu_pd, cx->mpu_state);
-
-		/*
-		 * Call idle CPU cluster PM enter notifier chain
-		 * to save GIC and wakeupgen context.
-		 */
-		if ((cx->mpu_state == PWRDM_POWER_RET) &&
-			(cx->mpu_logic_state == PWRDM_POWER_OFF))
-				cpu_cluster_pm_enter();
-	}
-
-	omap4_enter_lowpower(dev->cpu, cx->cpu_state);
-	cpu_done[dev->cpu] = true;
-
-	/* Wakeup CPU1 only if it is not offlined */
-	if (dev->cpu == 0 && cpumask_test_cpu(1, cpu_online_mask)) {
-		clkdm_wakeup(cpu_clkdm[1]);
-		omap_set_pwrdm_state(cpu_pd[1], PWRDM_POWER_ON);
-		clkdm_allow_idle(cpu_clkdm[1]);
-	}
-
-	/*
-	 * Call idle CPU PM exit notifier chain to restore
-	 * VFP and per CPU IRQ context.
-	 */
-	cpu_pm_exit();
-
-	/*
-	 * Call idle CPU cluster PM exit notifier chain
-	 * to restore GIC and wakeupgen context.
-	 */
-	if ((cx->mpu_state == PWRDM_POWER_RET) &&
-		(cx->mpu_logic_state == PWRDM_POWER_OFF))
-		cpu_cluster_pm_exit();
-
-fail:
-	cpuidle_coupled_parallel_barrier(dev, &abort_barrier);
-	cpu_done[dev->cpu] = false;
-
-	return index;
-}
-
-static struct cpuidle_driver omap4_idle_driver = {
-	.name				= "omap4_idle",
-	.owner				= THIS_MODULE,
-	.states = {
-		{
-			/* C1 - CPU0 ON + CPU1 ON + MPU ON */
-			.exit_latency = 2 + 2,
-			.target_residency = 5,
-			.flags = CPUIDLE_FLAG_TIME_VALID,
-			.enter = omap_enter_idle_simple,
-			.name = "C1",
-			.desc = "CPUx ON, MPUSS ON"
-		},
-		{
-			/* C2 - CPU0 OFF + CPU1 OFF + MPU CSWR */
-			.exit_latency = 328 + 440,
-			.target_residency = 960,
-			.flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_COUPLED |
-			         CPUIDLE_FLAG_TIMER_STOP,
-			.enter = omap_enter_idle_coupled,
-			.name = "C2",
-			.desc = "CPUx OFF, MPUSS CSWR",
-		},
-		{
-			/* C3 - CPU0 OFF + CPU1 OFF + MPU OSWR */
-			.exit_latency = 460 + 518,
-			.target_residency = 1100,
-			.flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_COUPLED |
-			         CPUIDLE_FLAG_TIMER_STOP,
-			.enter = omap_enter_idle_coupled,
-			.name = "C3",
-			.desc = "CPUx OFF, MPUSS OSWR",
-		},
-	},
-	.state_count = ARRAY_SIZE(omap4_idle_data),
-	.safe_state_index = 0,
-};
-
-/* Public functions */
-
-/**
- * omap4_idle_init - Init routine for OMAP4+ idle
- *
- * Registers the OMAP4+ specific cpuidle driver to the cpuidle
- * framework with the valid set of states.
- */
-int __init omap4_idle_init(void)
-{
-	mpu_pd = pwrdm_lookup("mpu_pwrdm");
-	cpu_pd[0] = pwrdm_lookup("cpu0_pwrdm");
-	cpu_pd[1] = pwrdm_lookup("cpu1_pwrdm");
-	if ((!mpu_pd) || (!cpu_pd[0]) || (!cpu_pd[1]))
-		return -ENODEV;
-
-	cpu_clkdm[0] = clkdm_lookup("mpu0_clkdm");
-	cpu_clkdm[1] = clkdm_lookup("mpu1_clkdm");
-	if (!cpu_clkdm[0] || !cpu_clkdm[1])
-		return -ENODEV;
-
-	return cpuidle_register(&omap4_idle_driver, cpu_online_mask);
-}
diff --git a/drivers/cpuidle/Makefile b/drivers/cpuidle/Makefile
index 9bacf85..6436c67 100644
--- a/drivers/cpuidle/Makefile
+++ b/drivers/cpuidle/Makefile
@@ -21,4 +21,14 @@ ifeq ($(CONFIG_ARCH_MXC),y)
 		obj-y += cpuidle-imx6q.o
 	endif
 endif
+ifeq ($(CONFIG_ARCH_OMAP3),y)
+	ccflags-y += -I$(srctree)/arch/arm/plat-omap/include
+	ccflags-y += -I$(srctree)/arch/arm/mach-omap2/include
+	obj-y += cpuidle-omap34xx.o
+endif
+ifeq ($(CONFIG_ARCH_OMAP4),y)
+	ccflags-y += -I$(srctree)/arch/arm/plat-omap/include
+	ccflags-y += -I$(srctree)/arch/arm/mach-omap2/include
+	obj-y += cpuidle-omap44xx.o
+endif
 obj-$(CONFIG_CPU_IDLE_ZYNQ) += cpuidle-zynq.o
diff --git a/drivers/cpuidle/cpuidle-omap34xx.c b/drivers/cpuidle/cpuidle-omap34xx.c
new file mode 100644
index 0000000..0c14077
--- /dev/null
+++ b/drivers/cpuidle/cpuidle-omap34xx.c
@@ -0,0 +1,342 @@
+/*
+ * OMAP3 CPU IDLE Routines
+ *
+ * Copyright (C) 2008 Texas Instruments, Inc.
+ * Rajendra Nayak <rnayak@ti.com>
+ *
+ * Copyright (C) 2007 Texas Instruments, Inc.
+ * Karthik Dasu <karthik-dp@ti.com>
+ *
+ * Copyright (C) 2006 Nokia Corporation
+ * Tony Lindgren <tony@atomide.com>
+ *
+ * Copyright (C) 2005 Texas Instruments, Inc.
+ * Richard Woodruff <r-woodruff2@ti.com>
+ *
+ * Based on pm.c for omap2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/sched.h>
+#include <linux/cpuidle.h>
+#include <linux/export.h>
+#include <linux/cpu_pm.h>
+#include <asm/cpuidle.h>
+
+#include "../../arch/arm/mach-omap2/powerdomain.h"
+#include "../../arch/arm/mach-omap2/clockdomain.h"
+
+#include "../../arch/arm/mach-omap2/pm.h"
+#include "../../arch/arm/mach-omap2/control.h"
+#include "../../arch/arm/mach-omap2/common.h"
+
+/* Mach specific information to be recorded in the C-state driver_data */
+struct omap3_idle_statedata {
+	u8 mpu_state;
+	u8 core_state;
+	u8 per_min_state;
+	u8 flags;
+};
+
+static struct powerdomain *mpu_pd, *core_pd, *per_pd, *cam_pd;
+
+/*
+ * Possible flag bits for struct omap3_idle_statedata.flags:
+ *
+ * OMAP_CPUIDLE_CX_NO_CLKDM_IDLE: don't allow the MPU clockdomain to go
+ *    inactive.  This in turn prevents the MPU DPLL from entering autoidle
+ *    mode, so wakeup latency is greatly reduced, at the cost of additional
+ *    energy consumption.  This also prevents the CORE clockdomain from
+ *    entering idle.
+ */
+#define OMAP_CPUIDLE_CX_NO_CLKDM_IDLE		BIT(0)
+
+/*
+ * Prevent PER OFF if CORE is not in RETention or OFF as this would
+ * disable PER wakeups completely.
+ */
+static struct omap3_idle_statedata omap3_idle_data[] = {
+	{
+		.mpu_state = PWRDM_POWER_ON,
+		.core_state = PWRDM_POWER_ON,
+		/* In C1 do not allow PER state lower than CORE state */
+		.per_min_state = PWRDM_POWER_ON,
+		.flags = OMAP_CPUIDLE_CX_NO_CLKDM_IDLE,
+	},
+	{
+		.mpu_state = PWRDM_POWER_ON,
+		.core_state = PWRDM_POWER_ON,
+		.per_min_state = PWRDM_POWER_RET,
+	},
+	{
+		.mpu_state = PWRDM_POWER_RET,
+		.core_state = PWRDM_POWER_ON,
+		.per_min_state = PWRDM_POWER_RET,
+	},
+	{
+		.mpu_state = PWRDM_POWER_OFF,
+		.core_state = PWRDM_POWER_ON,
+		.per_min_state = PWRDM_POWER_RET,
+	},
+	{
+		.mpu_state = PWRDM_POWER_RET,
+		.core_state = PWRDM_POWER_RET,
+		.per_min_state = PWRDM_POWER_OFF,
+	},
+	{
+		.mpu_state = PWRDM_POWER_OFF,
+		.core_state = PWRDM_POWER_RET,
+		.per_min_state = PWRDM_POWER_OFF,
+	},
+	{
+		.mpu_state = PWRDM_POWER_OFF,
+		.core_state = PWRDM_POWER_OFF,
+		.per_min_state = PWRDM_POWER_OFF,
+	},
+};
+
+/**
+ * omap3_enter_idle - Programs OMAP3 to enter the specified state
+ * @dev: cpuidle device
+ * @drv: cpuidle driver
+ * @index: the index of state to be entered
+ */
+static int omap3_enter_idle(struct cpuidle_device *dev,
+			    struct cpuidle_driver *drv,
+			    int index)
+{
+	struct omap3_idle_statedata *cx = &omap3_idle_data[index];
+
+	if (omap_irq_pending() || need_resched())
+		goto return_sleep_time;
+
+	/* Deny idle for C1 */
+	if (cx->flags & OMAP_CPUIDLE_CX_NO_CLKDM_IDLE) {
+		clkdm_deny_idle(mpu_pd->pwrdm_clkdms[0]);
+	} else {
+		pwrdm_set_next_pwrst(mpu_pd, cx->mpu_state);
+		pwrdm_set_next_pwrst(core_pd, cx->core_state);
+	}
+
+	/*
+	 * Call idle CPU PM enter notifier chain so that
+	 * VFP context is saved.
+	 */
+	if (cx->mpu_state == PWRDM_POWER_OFF)
+		cpu_pm_enter();
+
+	/* Execute ARM wfi */
+	omap_sram_idle();
+
+	/*
+	 * Call idle CPU PM enter notifier chain to restore
+	 * VFP context.
+	 */
+	if (cx->mpu_state == PWRDM_POWER_OFF &&
+	    pwrdm_read_prev_pwrst(mpu_pd) == PWRDM_POWER_OFF)
+		cpu_pm_exit();
+
+	/* Re-allow idle for C1 */
+	if (cx->flags & OMAP_CPUIDLE_CX_NO_CLKDM_IDLE)
+		clkdm_allow_idle(mpu_pd->pwrdm_clkdms[0]);
+
+return_sleep_time:
+
+	return index;
+}
+
+/**
+ * next_valid_state - Find next valid C-state
+ * @dev: cpuidle device
+ * @drv: cpuidle driver
+ * @index: Index of currently selected c-state
+ *
+ * If the state corresponding to index is valid, index is returned back
+ * to the caller. Else, this function searches for a lower c-state which is
+ * still valid (as defined in omap3_power_states[]) and returns its index.
+ *
+ * A state is valid if the 'valid' field is enabled and
+ * if it satisfies the enable_off_mode condition.
+ */
+static int next_valid_state(struct cpuidle_device *dev,
+			    struct cpuidle_driver *drv, int index)
+{
+	struct omap3_idle_statedata *cx = &omap3_idle_data[index];
+	u32 mpu_deepest_state = PWRDM_POWER_RET;
+	u32 core_deepest_state = PWRDM_POWER_RET;
+	int idx;
+	int next_index = 0; /* C1 is the default value */
+
+	if (enable_off_mode) {
+		mpu_deepest_state = PWRDM_POWER_OFF;
+		/*
+		 * Erratum i583: valable for ES rev < Es1.2 on 3630.
+		 * CORE OFF mode is not supported in a stable form, restrict
+		 * instead the CORE state to RET.
+		 */
+		if (!IS_PM34XX_ERRATUM(PM_SDRC_WAKEUP_ERRATUM_i583))
+			core_deepest_state = PWRDM_POWER_OFF;
+	}
+
+	/* Check if current state is valid */
+	if ((cx->mpu_state >= mpu_deepest_state) &&
+	    (cx->core_state >= core_deepest_state))
+		return index;
+
+	/*
+	 * Drop to next valid state.
+	 * Start search from the next (lower) state.
+	 */
+	for (idx = index - 1; idx >= 0; idx--) {
+		cx = &omap3_idle_data[idx];
+		if ((cx->mpu_state >= mpu_deepest_state) &&
+		    (cx->core_state >= core_deepest_state)) {
+			next_index = idx;
+			break;
+		}
+	}
+
+	return next_index;
+}
+
+/**
+ * omap3_enter_idle_bm - Checks for any bus activity
+ * @dev: cpuidle device
+ * @drv: cpuidle driver
+ * @index: array index of target state to be programmed
+ *
+ * This function checks for any pending activity and then programs
+ * the device to the specified or a safer state.
+ */
+static int omap3_enter_idle_bm(struct cpuidle_device *dev,
+			       struct cpuidle_driver *drv,
+			       int index)
+{
+	int new_state_idx, ret;
+	u8 per_next_state, per_saved_state;
+	struct omap3_idle_statedata *cx;
+
+	/*
+	 * Use only C1 if CAM is active.
+	 * CAM does not have wakeup capability in OMAP3.
+	 */
+	if (pwrdm_read_pwrst(cam_pd) == PWRDM_POWER_ON)
+		new_state_idx = drv->safe_state_index;
+	else
+		new_state_idx = next_valid_state(dev, drv, index);
+
+	/*
+	 * FIXME: we currently manage device-specific idle states
+	 *        for PER and CORE in combination with CPU-specific
+	 *        idle states.  This is wrong, and device-specific
+	 *        idle management needs to be separated out into
+	 *        its own code.
+	 */
+
+	/* Program PER state */
+	cx = &omap3_idle_data[new_state_idx];
+
+	per_next_state = pwrdm_read_next_pwrst(per_pd);
+	per_saved_state = per_next_state;
+	if (per_next_state < cx->per_min_state) {
+		per_next_state = cx->per_min_state;
+		pwrdm_set_next_pwrst(per_pd, per_next_state);
+	}
+
+	ret = omap3_enter_idle(dev, drv, new_state_idx);
+
+	/* Restore original PER state if it was modified */
+	if (per_next_state != per_saved_state)
+		pwrdm_set_next_pwrst(per_pd, per_saved_state);
+
+	return ret;
+}
+
+static struct cpuidle_driver omap3_idle_driver = {
+	.name             = "omap3_idle",
+	.owner            = THIS_MODULE,
+	.states = {
+		{
+			.enter		  = omap3_enter_idle_bm,
+			.exit_latency	  = 2 + 2,
+			.target_residency = 5,
+			.flags		  = CPUIDLE_FLAG_TIME_VALID,
+			.name		  = "C1",
+			.desc		  = "MPU ON + CORE ON",
+		},
+		{
+			.enter		  = omap3_enter_idle_bm,
+			.exit_latency	  = 10 + 10,
+			.target_residency = 30,
+			.flags		  = CPUIDLE_FLAG_TIME_VALID,
+			.name		  = "C2",
+			.desc		  = "MPU ON + CORE ON",
+		},
+		{
+			.enter		  = omap3_enter_idle_bm,
+			.exit_latency	  = 50 + 50,
+			.target_residency = 300,
+			.flags		  = CPUIDLE_FLAG_TIME_VALID,
+			.name		  = "C3",
+			.desc		  = "MPU RET + CORE ON",
+		},
+		{
+			.enter		  = omap3_enter_idle_bm,
+			.exit_latency	  = 1500 + 1800,
+			.target_residency = 4000,
+			.flags		  = CPUIDLE_FLAG_TIME_VALID,
+			.name		  = "C4",
+			.desc		  = "MPU OFF + CORE ON",
+		},
+		{
+			.enter		  = omap3_enter_idle_bm,
+			.exit_latency	  = 2500 + 7500,
+			.target_residency = 12000,
+			.flags		  = CPUIDLE_FLAG_TIME_VALID,
+			.name		  = "C5",
+			.desc		  = "MPU RET + CORE RET",
+		},
+		{
+			.enter		  = omap3_enter_idle_bm,
+			.exit_latency	  = 3000 + 8500,
+			.target_residency = 15000,
+			.flags		  = CPUIDLE_FLAG_TIME_VALID,
+			.name		  = "C6",
+			.desc		  = "MPU OFF + CORE RET",
+		},
+		{
+			.enter		  = omap3_enter_idle_bm,
+			.exit_latency	  = 10000 + 30000,
+			.target_residency = 30000,
+			.flags		  = CPUIDLE_FLAG_TIME_VALID,
+			.name		  = "C7",
+			.desc		  = "MPU OFF + CORE OFF",
+		},
+	},
+	.state_count = ARRAY_SIZE(omap3_idle_data),
+	.safe_state_index = 0,
+};
+
+/* Public functions */
+
+/**
+ * omap3_idle_init - Init routine for OMAP3 idle
+ *
+ * Registers the OMAP3 specific cpuidle driver to the cpuidle
+ * framework with the valid set of states.
+ */
+int __init omap3_idle_init(void)
+{
+	mpu_pd = pwrdm_lookup("mpu_pwrdm");
+	core_pd = pwrdm_lookup("core_pwrdm");
+	per_pd = pwrdm_lookup("per_pwrdm");
+	cam_pd = pwrdm_lookup("cam_pwrdm");
+
+	if (!mpu_pd || !core_pd || !per_pd || !cam_pd)
+		return -ENODEV;
+
+	return cpuidle_register(&omap3_idle_driver, NULL);
+}
diff --git a/drivers/cpuidle/cpuidle-omap44xx.c b/drivers/cpuidle/cpuidle-omap44xx.c
new file mode 100644
index 0000000..86b8a51
--- /dev/null
+++ b/drivers/cpuidle/cpuidle-omap44xx.c
@@ -0,0 +1,216 @@
+/*
+ * OMAP4+ CPU idle Routines
+ *
+ * Copyright (C) 2011-2013 Texas Instruments, Inc.
+ * Santosh Shilimkar <santosh.shilimkar@ti.com>
+ * Rajendra Nayak <rnayak@ti.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/sched.h>
+#include <linux/cpuidle.h>
+#include <linux/cpu_pm.h>
+#include <linux/export.h>
+
+#include <asm/cpuidle.h>
+#include <asm/proc-fns.h>
+
+#include "../../arch/arm/mach-omap2/common.h"
+#include "../../arch/arm/mach-omap2/pm.h"
+#include "../../arch/arm/mach-omap2/prm.h"
+#include "../../arch/arm/mach-omap2/clockdomain.h"
+
+/* Machine specific information */
+struct idle_statedata {
+	u32 cpu_state;
+	u32 mpu_logic_state;
+	u32 mpu_state;
+};
+
+static struct idle_statedata omap4_idle_data[] = {
+	{
+		.cpu_state = PWRDM_POWER_ON,
+		.mpu_state = PWRDM_POWER_ON,
+		.mpu_logic_state = PWRDM_POWER_RET,
+	},
+	{
+		.cpu_state = PWRDM_POWER_OFF,
+		.mpu_state = PWRDM_POWER_RET,
+		.mpu_logic_state = PWRDM_POWER_RET,
+	},
+	{
+		.cpu_state = PWRDM_POWER_OFF,
+		.mpu_state = PWRDM_POWER_RET,
+		.mpu_logic_state = PWRDM_POWER_OFF,
+	},
+};
+
+static struct powerdomain *mpu_pd, *cpu_pd[NR_CPUS];
+static struct clockdomain *cpu_clkdm[NR_CPUS];
+
+static atomic_t abort_barrier;
+static bool cpu_done[NR_CPUS];
+static struct idle_statedata *state_ptr = &omap4_idle_data[0];
+
+/* Private functions */
+
+/**
+ * omap_enter_idle_[simple/coupled] - OMAP4PLUS cpuidle entry functions
+ * @dev: cpuidle device
+ * @drv: cpuidle driver
+ * @index: the index of state to be entered
+ *
+ * Called from the CPUidle framework to program the device to the
+ * specified low power state selected by the governor.
+ * Returns the amount of time spent in the low power state.
+ */
+static int omap_enter_idle_simple(struct cpuidle_device *dev,
+			struct cpuidle_driver *drv,
+			int index)
+{
+	omap_do_wfi();
+	return index;
+}
+
+static int omap_enter_idle_coupled(struct cpuidle_device *dev,
+			struct cpuidle_driver *drv,
+			int index)
+{
+	struct idle_statedata *cx = state_ptr + index;
+
+	/*
+	 * CPU0 has to wait and stay ON until CPU1 is OFF state.
+	 * This is necessary to honour hardware recommondation
+	 * of triggeing all the possible low power modes once CPU1 is
+	 * out of coherency and in OFF mode.
+	 */
+	if (dev->cpu == 0 && cpumask_test_cpu(1, cpu_online_mask)) {
+		while (pwrdm_read_pwrst(cpu_pd[1]) != PWRDM_POWER_OFF) {
+			cpu_relax();
+
+			/*
+			 * CPU1 could have already entered & exited idle
+			 * without hitting off because of a wakeup
+			 * or a failed attempt to hit off mode.  Check for
+			 * that here, otherwise we could spin forever
+			 * waiting for CPU1 off.
+			 */
+			if (cpu_done[1])
+				goto fail;
+		}
+	}
+
+	/*
+	 * Call idle CPU PM enter notifier chain so that
+	 * VFP and per CPU interrupt context is saved.
+	 */
+	cpu_pm_enter();
+
+	if (dev->cpu == 0) {
+		pwrdm_set_logic_retst(mpu_pd, cx->mpu_logic_state);
+		omap_set_pwrdm_state(mpu_pd, cx->mpu_state);
+
+		/*
+		 * Call idle CPU cluster PM enter notifier chain
+		 * to save GIC and wakeupgen context.
+		 */
+		if ((cx->mpu_state == PWRDM_POWER_RET) &&
+			(cx->mpu_logic_state == PWRDM_POWER_OFF))
+				cpu_cluster_pm_enter();
+	}
+
+	omap4_enter_lowpower(dev->cpu, cx->cpu_state);
+	cpu_done[dev->cpu] = true;
+
+	/* Wakeup CPU1 only if it is not offlined */
+	if (dev->cpu == 0 && cpumask_test_cpu(1, cpu_online_mask)) {
+		clkdm_wakeup(cpu_clkdm[1]);
+		omap_set_pwrdm_state(cpu_pd[1], PWRDM_POWER_ON);
+		clkdm_allow_idle(cpu_clkdm[1]);
+	}
+
+	/*
+	 * Call idle CPU PM exit notifier chain to restore
+	 * VFP and per CPU IRQ context.
+	 */
+	cpu_pm_exit();
+
+	/*
+	 * Call idle CPU cluster PM exit notifier chain
+	 * to restore GIC and wakeupgen context.
+	 */
+	if ((cx->mpu_state == PWRDM_POWER_RET) &&
+		(cx->mpu_logic_state == PWRDM_POWER_OFF))
+		cpu_cluster_pm_exit();
+
+fail:
+	cpuidle_coupled_parallel_barrier(dev, &abort_barrier);
+	cpu_done[dev->cpu] = false;
+
+	return index;
+}
+
+static struct cpuidle_driver omap4_idle_driver = {
+	.name				= "omap4_idle",
+	.owner				= THIS_MODULE,
+	.states = {
+		{
+			/* C1 - CPU0 ON + CPU1 ON + MPU ON */
+			.exit_latency = 2 + 2,
+			.target_residency = 5,
+			.flags = CPUIDLE_FLAG_TIME_VALID,
+			.enter = omap_enter_idle_simple,
+			.name = "C1",
+			.desc = "CPUx ON, MPUSS ON"
+		},
+		{
+			/* C2 - CPU0 OFF + CPU1 OFF + MPU CSWR */
+			.exit_latency = 328 + 440,
+			.target_residency = 960,
+			.flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_COUPLED |
+				 CPUIDLE_FLAG_TIMER_STOP,
+			.enter = omap_enter_idle_coupled,
+			.name = "C2",
+			.desc = "CPUx OFF, MPUSS CSWR",
+		},
+		{
+			/* C3 - CPU0 OFF + CPU1 OFF + MPU OSWR */
+			.exit_latency = 460 + 518,
+			.target_residency = 1100,
+			.flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_COUPLED |
+				 CPUIDLE_FLAG_TIMER_STOP,
+			.enter = omap_enter_idle_coupled,
+			.name = "C3",
+			.desc = "CPUx OFF, MPUSS OSWR",
+		},
+	},
+	.state_count = ARRAY_SIZE(omap4_idle_data),
+	.safe_state_index = 0,
+};
+
+/* Public functions */
+
+/**
+ * omap4_idle_init - Init routine for OMAP4+ idle
+ *
+ * Registers the OMAP4+ specific cpuidle driver to the cpuidle
+ * framework with the valid set of states.
+ */
+int __init omap4_idle_init(void)
+{
+	mpu_pd = pwrdm_lookup("mpu_pwrdm");
+	cpu_pd[0] = pwrdm_lookup("cpu0_pwrdm");
+	cpu_pd[1] = pwrdm_lookup("cpu1_pwrdm");
+	if ((!mpu_pd) || (!cpu_pd[0]) || (!cpu_pd[1]))
+		return -ENODEV;
+
+	cpu_clkdm[0] = clkdm_lookup("mpu0_clkdm");
+	cpu_clkdm[1] = clkdm_lookup("mpu1_clkdm");
+	if (!cpu_clkdm[0] || !cpu_clkdm[1])
+		return -ENODEV;
+
+	return cpuidle_register(&omap4_idle_driver, cpu_online_mask);
+}
-- 
1.8.2.3

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH 5/8] ARM: S3C64XX: move cpuidle driver to drivers/cpuidle/
  2013-06-26 10:15 ` Bartlomiej Zolnierkiewicz
@ 2013-06-26 10:15   ` Bartlomiej Zolnierkiewicz
  -1 siblings, 0 replies; 42+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2013-06-26 10:15 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux-pm, linux, nicolas.ferre, plagnioj, nsekhar, khilman,
	kernel, shawn.guo, tony, ben-linux, kgene.kim, horms,
	magnus.damm, swarren, srinidhi.kasagar, linus.walleij,
	daniel.lezcano, rjw, kyungmin.park, b.zolnierkie

While at it:
- remove file path from comment

Compile tested only.

Cc: Ben Dooks <ben-linux@fluff.org>
Cc: Kukjin Kim <kgene.kim@samsung.com>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
 arch/arm/mach-s3c64xx/Makefile    |  1 -
 arch/arm/mach-s3c64xx/cpuidle.c   | 63 ---------------------------------------
 drivers/cpuidle/Makefile          |  3 ++
 drivers/cpuidle/cpuidle-s3c64xx.c | 62 ++++++++++++++++++++++++++++++++++++++
 4 files changed, 65 insertions(+), 64 deletions(-)
 delete mode 100644 arch/arm/mach-s3c64xx/cpuidle.c
 create mode 100644 drivers/cpuidle/cpuidle-s3c64xx.c

diff --git a/arch/arm/mach-s3c64xx/Makefile b/arch/arm/mach-s3c64xx/Makefile
index 31d0c91..e7a3ee7 100644
--- a/arch/arm/mach-s3c64xx/Makefile
+++ b/arch/arm/mach-s3c64xx/Makefile
@@ -22,7 +22,6 @@ obj-$(CONFIG_CPU_S3C6410)	+= s3c6410.o
 # PM
 
 obj-$(CONFIG_PM)		+= pm.o irq-pm.o sleep.o
-obj-$(CONFIG_CPU_IDLE)		+= cpuidle.o
 
 # DMA support
 
diff --git a/arch/arm/mach-s3c64xx/cpuidle.c b/arch/arm/mach-s3c64xx/cpuidle.c
deleted file mode 100644
index 3c8ab07..0000000
--- a/arch/arm/mach-s3c64xx/cpuidle.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/* linux/arch/arm/mach-s3c64xx/cpuidle.c
- *
- * Copyright (c) 2011 Wolfson Microelectronics, plc
- * Copyright (c) 2011 Samsung Electronics Co., Ltd.
- *		http://www.samsung.com
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
-*/
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/cpuidle.h>
-#include <linux/io.h>
-#include <linux/export.h>
-#include <linux/time.h>
-
-#include <asm/proc-fns.h>
-
-#include <mach/map.h>
-
-#include "regs-sys.h"
-#include "regs-syscon-power.h"
-
-static int s3c64xx_enter_idle(struct cpuidle_device *dev,
-			      struct cpuidle_driver *drv,
-			      int index)
-{
-	unsigned long tmp;
-
-	/* Setup PWRCFG to enter idle mode */
-	tmp = __raw_readl(S3C64XX_PWR_CFG);
-	tmp &= ~S3C64XX_PWRCFG_CFG_WFI_MASK;
-	tmp |= S3C64XX_PWRCFG_CFG_WFI_IDLE;
-	__raw_writel(tmp, S3C64XX_PWR_CFG);
-
-	cpu_do_idle();
-
-	return index;
-}
-
-static struct cpuidle_driver s3c64xx_cpuidle_driver = {
-	.name	= "s3c64xx_cpuidle",
-	.owner  = THIS_MODULE,
-	.states = {
-		{
-			.enter            = s3c64xx_enter_idle,
-			.exit_latency     = 1,
-			.target_residency = 1,
-			.flags            = CPUIDLE_FLAG_TIME_VALID,
-			.name             = "IDLE",
-			.desc             = "System active, ARM gated",
-		},
-	},
-	.state_count = 1,
-};
-
-static int __init s3c64xx_init_cpuidle(void)
-{
-	return cpuidle_register(&s3c64xx_cpuidle_driver, NULL);
-}
-device_initcall(s3c64xx_init_cpuidle);
diff --git a/drivers/cpuidle/Makefile b/drivers/cpuidle/Makefile
index 6436c67..eed221e 100644
--- a/drivers/cpuidle/Makefile
+++ b/drivers/cpuidle/Makefile
@@ -31,4 +31,7 @@ ifeq ($(CONFIG_ARCH_OMAP4),y)
 	ccflags-y += -I$(srctree)/arch/arm/mach-omap2/include
 	obj-y += cpuidle-omap44xx.o
 endif
+ifeq ($(CONFIG_ARCH_S3C64XX),y)
+	obj-y += cpuidle-s3c64xx.o
+endif
 obj-$(CONFIG_CPU_IDLE_ZYNQ) += cpuidle-zynq.o
diff --git a/drivers/cpuidle/cpuidle-s3c64xx.c b/drivers/cpuidle/cpuidle-s3c64xx.c
new file mode 100644
index 0000000..c18d075
--- /dev/null
+++ b/drivers/cpuidle/cpuidle-s3c64xx.c
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2011 Wolfson Microelectronics, plc
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/cpuidle.h>
+#include <linux/io.h>
+#include <linux/export.h>
+#include <linux/time.h>
+
+#include <asm/proc-fns.h>
+
+#include <mach/map.h>
+
+#include "../../arch/arm/mach-s3c64xx/regs-sys.h"
+#include "../../arch/arm/mach-s3c64xx/regs-syscon-power.h"
+
+static int s3c64xx_enter_idle(struct cpuidle_device *dev,
+			      struct cpuidle_driver *drv,
+			      int index)
+{
+	unsigned long tmp;
+
+	/* Setup PWRCFG to enter idle mode */
+	tmp = __raw_readl(S3C64XX_PWR_CFG);
+	tmp &= ~S3C64XX_PWRCFG_CFG_WFI_MASK;
+	tmp |= S3C64XX_PWRCFG_CFG_WFI_IDLE;
+	__raw_writel(tmp, S3C64XX_PWR_CFG);
+
+	cpu_do_idle();
+
+	return index;
+}
+
+static struct cpuidle_driver s3c64xx_cpuidle_driver = {
+	.name	= "s3c64xx_cpuidle",
+	.owner  = THIS_MODULE,
+	.states = {
+		{
+			.enter            = s3c64xx_enter_idle,
+			.exit_latency     = 1,
+			.target_residency = 1,
+			.flags            = CPUIDLE_FLAG_TIME_VALID,
+			.name             = "IDLE",
+			.desc             = "System active, ARM gated",
+		},
+	},
+	.state_count = 1,
+};
+
+static int __init s3c64xx_init_cpuidle(void)
+{
+	return cpuidle_register(&s3c64xx_cpuidle_driver, NULL);
+}
+device_initcall(s3c64xx_init_cpuidle);
-- 
1.8.2.3


^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH 5/8] ARM: S3C64XX: move cpuidle driver to drivers/cpuidle/
@ 2013-06-26 10:15   ` Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 42+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2013-06-26 10:15 UTC (permalink / raw)
  To: linux-arm-kernel

While at it:
- remove file path from comment

Compile tested only.

Cc: Ben Dooks <ben-linux@fluff.org>
Cc: Kukjin Kim <kgene.kim@samsung.com>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
 arch/arm/mach-s3c64xx/Makefile    |  1 -
 arch/arm/mach-s3c64xx/cpuidle.c   | 63 ---------------------------------------
 drivers/cpuidle/Makefile          |  3 ++
 drivers/cpuidle/cpuidle-s3c64xx.c | 62 ++++++++++++++++++++++++++++++++++++++
 4 files changed, 65 insertions(+), 64 deletions(-)
 delete mode 100644 arch/arm/mach-s3c64xx/cpuidle.c
 create mode 100644 drivers/cpuidle/cpuidle-s3c64xx.c

diff --git a/arch/arm/mach-s3c64xx/Makefile b/arch/arm/mach-s3c64xx/Makefile
index 31d0c91..e7a3ee7 100644
--- a/arch/arm/mach-s3c64xx/Makefile
+++ b/arch/arm/mach-s3c64xx/Makefile
@@ -22,7 +22,6 @@ obj-$(CONFIG_CPU_S3C6410)	+= s3c6410.o
 # PM
 
 obj-$(CONFIG_PM)		+= pm.o irq-pm.o sleep.o
-obj-$(CONFIG_CPU_IDLE)		+= cpuidle.o
 
 # DMA support
 
diff --git a/arch/arm/mach-s3c64xx/cpuidle.c b/arch/arm/mach-s3c64xx/cpuidle.c
deleted file mode 100644
index 3c8ab07..0000000
--- a/arch/arm/mach-s3c64xx/cpuidle.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/* linux/arch/arm/mach-s3c64xx/cpuidle.c
- *
- * Copyright (c) 2011 Wolfson Microelectronics, plc
- * Copyright (c) 2011 Samsung Electronics Co., Ltd.
- *		http://www.samsung.com
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
-*/
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/cpuidle.h>
-#include <linux/io.h>
-#include <linux/export.h>
-#include <linux/time.h>
-
-#include <asm/proc-fns.h>
-
-#include <mach/map.h>
-
-#include "regs-sys.h"
-#include "regs-syscon-power.h"
-
-static int s3c64xx_enter_idle(struct cpuidle_device *dev,
-			      struct cpuidle_driver *drv,
-			      int index)
-{
-	unsigned long tmp;
-
-	/* Setup PWRCFG to enter idle mode */
-	tmp = __raw_readl(S3C64XX_PWR_CFG);
-	tmp &= ~S3C64XX_PWRCFG_CFG_WFI_MASK;
-	tmp |= S3C64XX_PWRCFG_CFG_WFI_IDLE;
-	__raw_writel(tmp, S3C64XX_PWR_CFG);
-
-	cpu_do_idle();
-
-	return index;
-}
-
-static struct cpuidle_driver s3c64xx_cpuidle_driver = {
-	.name	= "s3c64xx_cpuidle",
-	.owner  = THIS_MODULE,
-	.states = {
-		{
-			.enter            = s3c64xx_enter_idle,
-			.exit_latency     = 1,
-			.target_residency = 1,
-			.flags            = CPUIDLE_FLAG_TIME_VALID,
-			.name             = "IDLE",
-			.desc             = "System active, ARM gated",
-		},
-	},
-	.state_count = 1,
-};
-
-static int __init s3c64xx_init_cpuidle(void)
-{
-	return cpuidle_register(&s3c64xx_cpuidle_driver, NULL);
-}
-device_initcall(s3c64xx_init_cpuidle);
diff --git a/drivers/cpuidle/Makefile b/drivers/cpuidle/Makefile
index 6436c67..eed221e 100644
--- a/drivers/cpuidle/Makefile
+++ b/drivers/cpuidle/Makefile
@@ -31,4 +31,7 @@ ifeq ($(CONFIG_ARCH_OMAP4),y)
 	ccflags-y += -I$(srctree)/arch/arm/mach-omap2/include
 	obj-y += cpuidle-omap44xx.o
 endif
+ifeq ($(CONFIG_ARCH_S3C64XX),y)
+	obj-y += cpuidle-s3c64xx.o
+endif
 obj-$(CONFIG_CPU_IDLE_ZYNQ) += cpuidle-zynq.o
diff --git a/drivers/cpuidle/cpuidle-s3c64xx.c b/drivers/cpuidle/cpuidle-s3c64xx.c
new file mode 100644
index 0000000..c18d075
--- /dev/null
+++ b/drivers/cpuidle/cpuidle-s3c64xx.c
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2011 Wolfson Microelectronics, plc
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/cpuidle.h>
+#include <linux/io.h>
+#include <linux/export.h>
+#include <linux/time.h>
+
+#include <asm/proc-fns.h>
+
+#include <mach/map.h>
+
+#include "../../arch/arm/mach-s3c64xx/regs-sys.h"
+#include "../../arch/arm/mach-s3c64xx/regs-syscon-power.h"
+
+static int s3c64xx_enter_idle(struct cpuidle_device *dev,
+			      struct cpuidle_driver *drv,
+			      int index)
+{
+	unsigned long tmp;
+
+	/* Setup PWRCFG to enter idle mode */
+	tmp = __raw_readl(S3C64XX_PWR_CFG);
+	tmp &= ~S3C64XX_PWRCFG_CFG_WFI_MASK;
+	tmp |= S3C64XX_PWRCFG_CFG_WFI_IDLE;
+	__raw_writel(tmp, S3C64XX_PWR_CFG);
+
+	cpu_do_idle();
+
+	return index;
+}
+
+static struct cpuidle_driver s3c64xx_cpuidle_driver = {
+	.name	= "s3c64xx_cpuidle",
+	.owner  = THIS_MODULE,
+	.states = {
+		{
+			.enter            = s3c64xx_enter_idle,
+			.exit_latency     = 1,
+			.target_residency = 1,
+			.flags            = CPUIDLE_FLAG_TIME_VALID,
+			.name             = "IDLE",
+			.desc             = "System active, ARM gated",
+		},
+	},
+	.state_count = 1,
+};
+
+static int __init s3c64xx_init_cpuidle(void)
+{
+	return cpuidle_register(&s3c64xx_cpuidle_driver, NULL);
+}
+device_initcall(s3c64xx_init_cpuidle);
-- 
1.8.2.3

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH 6/8] ARM: shmobile: move cpuidle driver to drivers/cpuidle/
  2013-06-26 10:15 ` Bartlomiej Zolnierkiewicz
@ 2013-06-26 10:15   ` Bartlomiej Zolnierkiewicz
  -1 siblings, 0 replies; 42+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2013-06-26 10:15 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux-pm, linux, nicolas.ferre, plagnioj, nsekhar, khilman,
	kernel, shawn.guo, tony, ben-linux, kgene.kim, horms,
	magnus.damm, swarren, srinidhi.kasagar, linus.walleij,
	daniel.lezcano, rjw, kyungmin.park, b.zolnierkie

While at it:
- replace <asm/io.h> by <linux/io.h> one

Compile tested only.

Cc: Simon Horman <horms@verge.net.au>
Cc: Magnus Damm <magnus.damm@gmail.com>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
 arch/arm/mach-shmobile/Makefile    |  1 -
 arch/arm/mach-shmobile/cpuidle.c   | 37 -------------------------------------
 drivers/cpuidle/Makefile           |  3 +++
 drivers/cpuidle/cpuidle-shmobile.c | 37 +++++++++++++++++++++++++++++++++++++
 4 files changed, 40 insertions(+), 38 deletions(-)
 delete mode 100644 arch/arm/mach-shmobile/cpuidle.c
 create mode 100644 drivers/cpuidle/cpuidle-shmobile.c

diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
index 6165a51..cc84ef2 100644
--- a/arch/arm/mach-shmobile/Makefile
+++ b/arch/arm/mach-shmobile/Makefile
@@ -27,7 +27,6 @@ obj-$(CONFIG_ARCH_R8A7740)	+= entry-intc.o
 
 # PM objects
 obj-$(CONFIG_SUSPEND)		+= suspend.o
-obj-$(CONFIG_CPU_IDLE)		+= cpuidle.o
 obj-$(CONFIG_ARCH_SHMOBILE)	+= pm-rmobile.o
 obj-$(CONFIG_ARCH_SH7372)	+= pm-sh7372.o sleep-sh7372.o
 obj-$(CONFIG_ARCH_R8A7740)	+= pm-r8a7740.o
diff --git a/arch/arm/mach-shmobile/cpuidle.c b/arch/arm/mach-shmobile/cpuidle.c
deleted file mode 100644
index 0afeb5c..0000000
--- a/arch/arm/mach-shmobile/cpuidle.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * CPUIdle support code for SH-Mobile ARM
- *
- *  Copyright (C) 2011 Magnus Damm
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-
-#include <linux/pm.h>
-#include <linux/cpuidle.h>
-#include <linux/suspend.h>
-#include <linux/module.h>
-#include <linux/err.h>
-#include <asm/cpuidle.h>
-#include <asm/io.h>
-
-static struct cpuidle_driver shmobile_cpuidle_default_driver = {
-	.name			= "shmobile_cpuidle",
-	.owner			= THIS_MODULE,
-	.states[0]		= ARM_CPUIDLE_WFI_STATE,
-	.safe_state_index	= 0, /* C1 */
-	.state_count		= 1,
-};
-
-static struct cpuidle_driver *cpuidle_drv = &shmobile_cpuidle_default_driver;
-
-void __init shmobile_cpuidle_set_driver(struct cpuidle_driver *drv)
-{
-	cpuidle_drv = drv;
-}
-
-int __init shmobile_cpuidle_init(void)
-{
-	return cpuidle_register(cpuidle_drv, NULL);
-}
diff --git a/drivers/cpuidle/Makefile b/drivers/cpuidle/Makefile
index eed221e..758d0d9 100644
--- a/drivers/cpuidle/Makefile
+++ b/drivers/cpuidle/Makefile
@@ -34,4 +34,7 @@ endif
 ifeq ($(CONFIG_ARCH_S3C64XX),y)
 	obj-y += cpuidle-s3c64xx.o
 endif
+ifeq ($(CONFIG_ARCH_SHMOBILE),y)
+	obj-y += cpuidle-shmobile.o
+endif
 obj-$(CONFIG_CPU_IDLE_ZYNQ) += cpuidle-zynq.o
diff --git a/drivers/cpuidle/cpuidle-shmobile.c b/drivers/cpuidle/cpuidle-shmobile.c
new file mode 100644
index 0000000..5cea47e
--- /dev/null
+++ b/drivers/cpuidle/cpuidle-shmobile.c
@@ -0,0 +1,37 @@
+/*
+ * CPUIdle support code for SH-Mobile ARM
+ *
+ *  Copyright (C) 2011 Magnus Damm
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+
+#include <linux/pm.h>
+#include <linux/cpuidle.h>
+#include <linux/suspend.h>
+#include <linux/module.h>
+#include <linux/err.h>
+#include <linux/io.h>
+#include <asm/cpuidle.h>
+
+static struct cpuidle_driver shmobile_cpuidle_default_driver = {
+	.name			= "shmobile_cpuidle",
+	.owner			= THIS_MODULE,
+	.states[0]		= ARM_CPUIDLE_WFI_STATE,
+	.safe_state_index	= 0, /* C1 */
+	.state_count		= 1,
+};
+
+static struct cpuidle_driver *cpuidle_drv = &shmobile_cpuidle_default_driver;
+
+void __init shmobile_cpuidle_set_driver(struct cpuidle_driver *drv)
+{
+	cpuidle_drv = drv;
+}
+
+int __init shmobile_cpuidle_init(void)
+{
+	return cpuidle_register(cpuidle_drv, NULL);
+}
-- 
1.8.2.3


^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH 6/8] ARM: shmobile: move cpuidle driver to drivers/cpuidle/
@ 2013-06-26 10:15   ` Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 42+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2013-06-26 10:15 UTC (permalink / raw)
  To: linux-arm-kernel

While at it:
- replace <asm/io.h> by <linux/io.h> one

Compile tested only.

Cc: Simon Horman <horms@verge.net.au>
Cc: Magnus Damm <magnus.damm@gmail.com>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
 arch/arm/mach-shmobile/Makefile    |  1 -
 arch/arm/mach-shmobile/cpuidle.c   | 37 -------------------------------------
 drivers/cpuidle/Makefile           |  3 +++
 drivers/cpuidle/cpuidle-shmobile.c | 37 +++++++++++++++++++++++++++++++++++++
 4 files changed, 40 insertions(+), 38 deletions(-)
 delete mode 100644 arch/arm/mach-shmobile/cpuidle.c
 create mode 100644 drivers/cpuidle/cpuidle-shmobile.c

diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
index 6165a51..cc84ef2 100644
--- a/arch/arm/mach-shmobile/Makefile
+++ b/arch/arm/mach-shmobile/Makefile
@@ -27,7 +27,6 @@ obj-$(CONFIG_ARCH_R8A7740)	+= entry-intc.o
 
 # PM objects
 obj-$(CONFIG_SUSPEND)		+= suspend.o
-obj-$(CONFIG_CPU_IDLE)		+= cpuidle.o
 obj-$(CONFIG_ARCH_SHMOBILE)	+= pm-rmobile.o
 obj-$(CONFIG_ARCH_SH7372)	+= pm-sh7372.o sleep-sh7372.o
 obj-$(CONFIG_ARCH_R8A7740)	+= pm-r8a7740.o
diff --git a/arch/arm/mach-shmobile/cpuidle.c b/arch/arm/mach-shmobile/cpuidle.c
deleted file mode 100644
index 0afeb5c..0000000
--- a/arch/arm/mach-shmobile/cpuidle.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * CPUIdle support code for SH-Mobile ARM
- *
- *  Copyright (C) 2011 Magnus Damm
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-
-#include <linux/pm.h>
-#include <linux/cpuidle.h>
-#include <linux/suspend.h>
-#include <linux/module.h>
-#include <linux/err.h>
-#include <asm/cpuidle.h>
-#include <asm/io.h>
-
-static struct cpuidle_driver shmobile_cpuidle_default_driver = {
-	.name			= "shmobile_cpuidle",
-	.owner			= THIS_MODULE,
-	.states[0]		= ARM_CPUIDLE_WFI_STATE,
-	.safe_state_index	= 0, /* C1 */
-	.state_count		= 1,
-};
-
-static struct cpuidle_driver *cpuidle_drv = &shmobile_cpuidle_default_driver;
-
-void __init shmobile_cpuidle_set_driver(struct cpuidle_driver *drv)
-{
-	cpuidle_drv = drv;
-}
-
-int __init shmobile_cpuidle_init(void)
-{
-	return cpuidle_register(cpuidle_drv, NULL);
-}
diff --git a/drivers/cpuidle/Makefile b/drivers/cpuidle/Makefile
index eed221e..758d0d9 100644
--- a/drivers/cpuidle/Makefile
+++ b/drivers/cpuidle/Makefile
@@ -34,4 +34,7 @@ endif
 ifeq ($(CONFIG_ARCH_S3C64XX),y)
 	obj-y += cpuidle-s3c64xx.o
 endif
+ifeq ($(CONFIG_ARCH_SHMOBILE),y)
+	obj-y += cpuidle-shmobile.o
+endif
 obj-$(CONFIG_CPU_IDLE_ZYNQ) += cpuidle-zynq.o
diff --git a/drivers/cpuidle/cpuidle-shmobile.c b/drivers/cpuidle/cpuidle-shmobile.c
new file mode 100644
index 0000000..5cea47e
--- /dev/null
+++ b/drivers/cpuidle/cpuidle-shmobile.c
@@ -0,0 +1,37 @@
+/*
+ * CPUIdle support code for SH-Mobile ARM
+ *
+ *  Copyright (C) 2011 Magnus Damm
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+
+#include <linux/pm.h>
+#include <linux/cpuidle.h>
+#include <linux/suspend.h>
+#include <linux/module.h>
+#include <linux/err.h>
+#include <linux/io.h>
+#include <asm/cpuidle.h>
+
+static struct cpuidle_driver shmobile_cpuidle_default_driver = {
+	.name			= "shmobile_cpuidle",
+	.owner			= THIS_MODULE,
+	.states[0]		= ARM_CPUIDLE_WFI_STATE,
+	.safe_state_index	= 0, /* C1 */
+	.state_count		= 1,
+};
+
+static struct cpuidle_driver *cpuidle_drv = &shmobile_cpuidle_default_driver;
+
+void __init shmobile_cpuidle_set_driver(struct cpuidle_driver *drv)
+{
+	cpuidle_drv = drv;
+}
+
+int __init shmobile_cpuidle_init(void)
+{
+	return cpuidle_register(cpuidle_drv, NULL);
+}
-- 
1.8.2.3

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH 7/8] ARM: tegra: move cpuidle drivers to drivers/cpuidle/
  2013-06-26 10:15 ` Bartlomiej Zolnierkiewicz
@ 2013-06-26 10:15   ` Bartlomiej Zolnierkiewicz
  -1 siblings, 0 replies; 42+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2013-06-26 10:15 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux-pm, linux, nicolas.ferre, plagnioj, nsekhar, khilman,
	kernel, shawn.guo, tony, ben-linux, kgene.kim, horms,
	magnus.damm, swarren, srinidhi.kasagar, linus.walleij,
	daniel.lezcano, rjw, kyungmin.park, b.zolnierkie

Compile tested only.

Cc: Stephen Warren <swarren@wwwdotorg.org>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
 arch/arm/mach-tegra/Makefile           |   9 --
 arch/arm/mach-tegra/cpuidle-tegra114.c |  35 ------
 arch/arm/mach-tegra/cpuidle-tegra20.c  | 217 ---------------------------------
 arch/arm/mach-tegra/cpuidle-tegra30.c  | 149 ----------------------
 drivers/cpuidle/Makefile               |   9 ++
 drivers/cpuidle/cpuidle-tegra114.c     |  35 ++++++
 drivers/cpuidle/cpuidle-tegra20.c      | 217 +++++++++++++++++++++++++++++++++
 drivers/cpuidle/cpuidle-tegra30.c      | 149 ++++++++++++++++++++++
 8 files changed, 410 insertions(+), 410 deletions(-)
 delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra114.c
 delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra20.c
 delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra30.c
 create mode 100644 drivers/cpuidle/cpuidle-tegra114.c
 create mode 100644 drivers/cpuidle/cpuidle-tegra20.c
 create mode 100644 drivers/cpuidle/cpuidle-tegra30.c

diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile
index 98b184e..7b33f82 100644
--- a/arch/arm/mach-tegra/Makefile
+++ b/arch/arm/mach-tegra/Makefile
@@ -17,23 +17,14 @@ obj-$(CONFIG_CPU_IDLE)			+= cpuidle.o
 obj-$(CONFIG_ARCH_TEGRA_2x_SOC)		+= tegra20_speedo.o
 obj-$(CONFIG_ARCH_TEGRA_2x_SOC)		+= tegra2_emc.o
 obj-$(CONFIG_ARCH_TEGRA_2x_SOC)		+= sleep-tegra20.o
-ifeq ($(CONFIG_CPU_IDLE),y)
-obj-$(CONFIG_ARCH_TEGRA_2x_SOC)		+= cpuidle-tegra20.o
-endif
 obj-$(CONFIG_ARCH_TEGRA_3x_SOC)		+= tegra30_speedo.o
 obj-$(CONFIG_ARCH_TEGRA_3x_SOC)		+= sleep-tegra30.o
-ifeq ($(CONFIG_CPU_IDLE),y)
-obj-$(CONFIG_ARCH_TEGRA_3x_SOC)		+= cpuidle-tegra30.o
-endif
 obj-$(CONFIG_SMP)			+= platsmp.o headsmp.o
 obj-$(CONFIG_HOTPLUG_CPU)               += hotplug.o
 obj-$(CONFIG_TEGRA_PCI)			+= pcie.o
 
 obj-$(CONFIG_ARCH_TEGRA_114_SOC)	+= tegra114_speedo.o
 obj-$(CONFIG_ARCH_TEGRA_114_SOC)	+= sleep-tegra30.o
-ifeq ($(CONFIG_CPU_IDLE),y)
-obj-$(CONFIG_ARCH_TEGRA_114_SOC)	+= cpuidle-tegra114.o
-endif
 
 obj-$(CONFIG_ARCH_TEGRA_2x_SOC)		+= board-harmony-pcie.o
 
diff --git a/arch/arm/mach-tegra/cpuidle-tegra114.c b/arch/arm/mach-tegra/cpuidle-tegra114.c
deleted file mode 100644
index 1d1c602..0000000
--- a/arch/arm/mach-tegra/cpuidle-tegra114.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2013, NVIDIA Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/cpuidle.h>
-
-#include <asm/cpuidle.h>
-
-static struct cpuidle_driver tegra_idle_driver = {
-	.name = "tegra_idle",
-	.owner = THIS_MODULE,
-	.state_count = 1,
-	.states = {
-		[0] = ARM_CPUIDLE_WFI_STATE_PWR(600),
-	},
-};
-
-int __init tegra114_cpuidle_init(void)
-{
-	return cpuidle_register(&tegra_idle_driver, NULL);
-}
diff --git a/arch/arm/mach-tegra/cpuidle-tegra20.c b/arch/arm/mach-tegra/cpuidle-tegra20.c
deleted file mode 100644
index 706aa42..0000000
--- a/arch/arm/mach-tegra/cpuidle-tegra20.c
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * CPU idle driver for Tegra CPUs
- *
- * Copyright (c) 2010-2012, NVIDIA Corporation.
- * Copyright (c) 2011 Google, Inc.
- * Author: Colin Cross <ccross@android.com>
- *         Gary King <gking@nvidia.com>
- *
- * Rework for 3.3 by Peter De Schrijver <pdeschrijver@nvidia.com>
- *
- * 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; either version 2 of the License, or
- * (at your option) any later version.
- *
- * 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/kernel.h>
-#include <linux/module.h>
-#include <linux/cpuidle.h>
-#include <linux/cpu_pm.h>
-#include <linux/clockchips.h>
-#include <linux/clk/tegra.h>
-
-#include <asm/cpuidle.h>
-#include <asm/proc-fns.h>
-#include <asm/suspend.h>
-#include <asm/smp_plat.h>
-
-#include "pm.h"
-#include "sleep.h"
-#include "iomap.h"
-#include "irq.h"
-#include "flowctrl.h"
-
-#ifdef CONFIG_PM_SLEEP
-static bool abort_flag;
-static atomic_t abort_barrier;
-static int tegra20_idle_lp2_coupled(struct cpuidle_device *dev,
-				    struct cpuidle_driver *drv,
-				    int index);
-#define TEGRA20_MAX_STATES 2
-#else
-#define TEGRA20_MAX_STATES 1
-#endif
-
-static struct cpuidle_driver tegra_idle_driver = {
-	.name = "tegra_idle",
-	.owner = THIS_MODULE,
-	.states = {
-		ARM_CPUIDLE_WFI_STATE_PWR(600),
-#ifdef CONFIG_PM_SLEEP
-		{
-			.enter            = tegra20_idle_lp2_coupled,
-			.exit_latency     = 5000,
-			.target_residency = 10000,
-			.power_usage      = 0,
-			.flags            = CPUIDLE_FLAG_TIME_VALID |
-			CPUIDLE_FLAG_COUPLED,
-			.name             = "powered-down",
-			.desc             = "CPU power gated",
-		},
-#endif
-	},
-	.state_count = TEGRA20_MAX_STATES,
-	.safe_state_index = 0,
-};
-
-#ifdef CONFIG_PM_SLEEP
-#ifdef CONFIG_SMP
-static void __iomem *pmc = IO_ADDRESS(TEGRA_PMC_BASE);
-
-static int tegra20_reset_sleeping_cpu_1(void)
-{
-	int ret = 0;
-
-	tegra_pen_lock();
-
-	if (readl(pmc + PMC_SCRATCH41) == CPU_RESETTABLE)
-		tegra20_cpu_shutdown(1);
-	else
-		ret = -EINVAL;
-
-	tegra_pen_unlock();
-
-	return ret;
-}
-
-static void tegra20_wake_cpu1_from_reset(void)
-{
-	tegra_pen_lock();
-
-	tegra20_cpu_clear_resettable();
-
-	/* enable cpu clock on cpu */
-	tegra_enable_cpu_clock(1);
-
-	/* take the CPU out of reset */
-	tegra_cpu_out_of_reset(1);
-
-	/* unhalt the cpu */
-	flowctrl_write_cpu_halt(1, 0);
-
-	tegra_pen_unlock();
-}
-
-static int tegra20_reset_cpu_1(void)
-{
-	if (!cpu_online(1) || !tegra20_reset_sleeping_cpu_1())
-		return 0;
-
-	tegra20_wake_cpu1_from_reset();
-	return -EBUSY;
-}
-#else
-static inline void tegra20_wake_cpu1_from_reset(void)
-{
-}
-
-static inline int tegra20_reset_cpu_1(void)
-{
-	return 0;
-}
-#endif
-
-static bool tegra20_cpu_cluster_power_down(struct cpuidle_device *dev,
-					   struct cpuidle_driver *drv,
-					   int index)
-{
-	while (tegra20_cpu_is_resettable_soon())
-		cpu_relax();
-
-	if (tegra20_reset_cpu_1() || !tegra_cpu_rail_off_ready())
-		return false;
-
-	clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &dev->cpu);
-
-	tegra_idle_lp2_last();
-
-	clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu);
-
-	if (cpu_online(1))
-		tegra20_wake_cpu1_from_reset();
-
-	return true;
-}
-
-#ifdef CONFIG_SMP
-static bool tegra20_idle_enter_lp2_cpu_1(struct cpuidle_device *dev,
-					 struct cpuidle_driver *drv,
-					 int index)
-{
-	clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &dev->cpu);
-
-	cpu_suspend(0, tegra20_sleep_cpu_secondary_finish);
-
-	tegra20_cpu_clear_resettable();
-
-	clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu);
-
-	return true;
-}
-#else
-static inline bool tegra20_idle_enter_lp2_cpu_1(struct cpuidle_device *dev,
-						struct cpuidle_driver *drv,
-						int index)
-{
-	return true;
-}
-#endif
-
-static int tegra20_idle_lp2_coupled(struct cpuidle_device *dev,
-				    struct cpuidle_driver *drv,
-				    int index)
-{
-	bool entered_lp2 = false;
-
-	if (tegra_pending_sgi())
-		ACCESS_ONCE(abort_flag) = true;
-
-	cpuidle_coupled_parallel_barrier(dev, &abort_barrier);
-
-	if (abort_flag) {
-		cpuidle_coupled_parallel_barrier(dev, &abort_barrier);
-		abort_flag = false;	/* clean flag for next coming */
-		return -EINTR;
-	}
-
-	local_fiq_disable();
-
-	tegra_set_cpu_in_lp2();
-	cpu_pm_enter();
-
-	if (dev->cpu == 0)
-		entered_lp2 = tegra20_cpu_cluster_power_down(dev, drv, index);
-	else
-		entered_lp2 = tegra20_idle_enter_lp2_cpu_1(dev, drv, index);
-
-	cpu_pm_exit();
-	tegra_clear_cpu_in_lp2();
-
-	local_fiq_enable();
-
-	smp_rmb();
-
-	return entered_lp2 ? index : 0;
-}
-#endif
-
-int __init tegra20_cpuidle_init(void)
-{
-	return cpuidle_register(&tegra_idle_driver, cpu_possible_mask);
-}
diff --git a/arch/arm/mach-tegra/cpuidle-tegra30.c b/arch/arm/mach-tegra/cpuidle-tegra30.c
deleted file mode 100644
index ed2a2a7..0000000
--- a/arch/arm/mach-tegra/cpuidle-tegra30.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * CPU idle driver for Tegra CPUs
- *
- * Copyright (c) 2010-2012, NVIDIA Corporation.
- * Copyright (c) 2011 Google, Inc.
- * Author: Colin Cross <ccross@android.com>
- *         Gary King <gking@nvidia.com>
- *
- * Rework for 3.3 by Peter De Schrijver <pdeschrijver@nvidia.com>
- *
- * 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; either version 2 of the License, or
- * (at your option) any later version.
- *
- * 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/kernel.h>
-#include <linux/module.h>
-#include <linux/cpuidle.h>
-#include <linux/cpu_pm.h>
-#include <linux/clockchips.h>
-#include <linux/clk/tegra.h>
-
-#include <asm/cpuidle.h>
-#include <asm/proc-fns.h>
-#include <asm/suspend.h>
-#include <asm/smp_plat.h>
-
-#include "pm.h"
-#include "sleep.h"
-
-#ifdef CONFIG_PM_SLEEP
-static int tegra30_idle_lp2(struct cpuidle_device *dev,
-			    struct cpuidle_driver *drv,
-			    int index);
-#endif
-
-static struct cpuidle_driver tegra_idle_driver = {
-	.name = "tegra_idle",
-	.owner = THIS_MODULE,
-#ifdef CONFIG_PM_SLEEP
-	.state_count = 2,
-#else
-	.state_count = 1,
-#endif
-	.states = {
-		[0] = ARM_CPUIDLE_WFI_STATE_PWR(600),
-#ifdef CONFIG_PM_SLEEP
-		[1] = {
-			.enter			= tegra30_idle_lp2,
-			.exit_latency		= 2000,
-			.target_residency	= 2200,
-			.power_usage		= 0,
-			.flags			= CPUIDLE_FLAG_TIME_VALID,
-			.name			= "powered-down",
-			.desc			= "CPU power gated",
-		},
-#endif
-	},
-};
-
-#ifdef CONFIG_PM_SLEEP
-static bool tegra30_cpu_cluster_power_down(struct cpuidle_device *dev,
-					   struct cpuidle_driver *drv,
-					   int index)
-{
-	/* All CPUs entering LP2 is not working.
-	 * Don't let CPU0 enter LP2 when any secondary CPU is online.
-	 */
-	if (num_online_cpus() > 1 || !tegra_cpu_rail_off_ready()) {
-		cpu_do_idle();
-		return false;
-	}
-
-	clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &dev->cpu);
-
-	tegra_idle_lp2_last();
-
-	clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu);
-
-	return true;
-}
-
-#ifdef CONFIG_SMP
-static bool tegra30_cpu_core_power_down(struct cpuidle_device *dev,
-					struct cpuidle_driver *drv,
-					int index)
-{
-	clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &dev->cpu);
-
-	smp_wmb();
-
-	cpu_suspend(0, tegra30_sleep_cpu_secondary_finish);
-
-	clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu);
-
-	return true;
-}
-#else
-static inline bool tegra30_cpu_core_power_down(struct cpuidle_device *dev,
-					       struct cpuidle_driver *drv,
-					       int index)
-{
-	return true;
-}
-#endif
-
-static int tegra30_idle_lp2(struct cpuidle_device *dev,
-			    struct cpuidle_driver *drv,
-			    int index)
-{
-	bool entered_lp2 = false;
-	bool last_cpu;
-
-	local_fiq_disable();
-
-	last_cpu = tegra_set_cpu_in_lp2();
-	cpu_pm_enter();
-
-	if (dev->cpu == 0) {
-		if (last_cpu)
-			entered_lp2 = tegra30_cpu_cluster_power_down(dev, drv,
-								     index);
-		else
-			cpu_do_idle();
-	} else {
-		entered_lp2 = tegra30_cpu_core_power_down(dev, drv, index);
-	}
-
-	cpu_pm_exit();
-	tegra_clear_cpu_in_lp2();
-
-	local_fiq_enable();
-
-	smp_rmb();
-
-	return (entered_lp2) ? index : 0;
-}
-#endif
-
-int __init tegra30_cpuidle_init(void)
-{
-	return cpuidle_register(&tegra_idle_driver, NULL);
-}
diff --git a/drivers/cpuidle/Makefile b/drivers/cpuidle/Makefile
index 758d0d9..953771f 100644
--- a/drivers/cpuidle/Makefile
+++ b/drivers/cpuidle/Makefile
@@ -37,4 +37,13 @@ endif
 ifeq ($(CONFIG_ARCH_SHMOBILE),y)
 	obj-y += cpuidle-shmobile.o
 endif
+ifeq ($(CONFIG_ARCH_TEGRA_2x_SOC),y)
+	obj-y += cpuidle-tegra20.o
+endif
+ifeq ($(CONFIG_ARCH_TEGRA_3x_SOC),y)
+	obj-y += cpuidle-tegra30.o
+endif
+ifeq ($(CONFIG_ARCH_TEGRA_114_SOC),y)
+	obj-y += cpuidle-tegra114.o
+endif
 obj-$(CONFIG_CPU_IDLE_ZYNQ) += cpuidle-zynq.o
diff --git a/drivers/cpuidle/cpuidle-tegra114.c b/drivers/cpuidle/cpuidle-tegra114.c
new file mode 100644
index 0000000..1d1c602
--- /dev/null
+++ b/drivers/cpuidle/cpuidle-tegra114.c
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2013, NVIDIA Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/cpuidle.h>
+
+#include <asm/cpuidle.h>
+
+static struct cpuidle_driver tegra_idle_driver = {
+	.name = "tegra_idle",
+	.owner = THIS_MODULE,
+	.state_count = 1,
+	.states = {
+		[0] = ARM_CPUIDLE_WFI_STATE_PWR(600),
+	},
+};
+
+int __init tegra114_cpuidle_init(void)
+{
+	return cpuidle_register(&tegra_idle_driver, NULL);
+}
diff --git a/drivers/cpuidle/cpuidle-tegra20.c b/drivers/cpuidle/cpuidle-tegra20.c
new file mode 100644
index 0000000..21a749c
--- /dev/null
+++ b/drivers/cpuidle/cpuidle-tegra20.c
@@ -0,0 +1,217 @@
+/*
+ * CPU idle driver for Tegra CPUs
+ *
+ * Copyright (c) 2010-2012, NVIDIA Corporation.
+ * Copyright (c) 2011 Google, Inc.
+ * Author: Colin Cross <ccross@android.com>
+ *         Gary King <gking@nvidia.com>
+ *
+ * Rework for 3.3 by Peter De Schrijver <pdeschrijver@nvidia.com>
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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/kernel.h>
+#include <linux/module.h>
+#include <linux/cpuidle.h>
+#include <linux/cpu_pm.h>
+#include <linux/clockchips.h>
+#include <linux/clk/tegra.h>
+
+#include <asm/cpuidle.h>
+#include <asm/proc-fns.h>
+#include <asm/suspend.h>
+#include <asm/smp_plat.h>
+
+#include "../../arch/arm/mach-tegra/pm.h"
+#include "../../arch/arm/mach-tegra/sleep.h"
+#include "../../arch/arm/mach-tegra/iomap.h"
+#include "../../arch/arm/mach-tegra/irq.h"
+#include "../../arch/arm/mach-tegra/flowctrl.h"
+
+#ifdef CONFIG_PM_SLEEP
+static bool abort_flag;
+static atomic_t abort_barrier;
+static int tegra20_idle_lp2_coupled(struct cpuidle_device *dev,
+				    struct cpuidle_driver *drv,
+				    int index);
+#define TEGRA20_MAX_STATES 2
+#else
+#define TEGRA20_MAX_STATES 1
+#endif
+
+static struct cpuidle_driver tegra_idle_driver = {
+	.name = "tegra_idle",
+	.owner = THIS_MODULE,
+	.states = {
+		ARM_CPUIDLE_WFI_STATE_PWR(600),
+#ifdef CONFIG_PM_SLEEP
+		{
+			.enter            = tegra20_idle_lp2_coupled,
+			.exit_latency     = 5000,
+			.target_residency = 10000,
+			.power_usage      = 0,
+			.flags            = CPUIDLE_FLAG_TIME_VALID |
+			CPUIDLE_FLAG_COUPLED,
+			.name             = "powered-down",
+			.desc             = "CPU power gated",
+		},
+#endif
+	},
+	.state_count = TEGRA20_MAX_STATES,
+	.safe_state_index = 0,
+};
+
+#ifdef CONFIG_PM_SLEEP
+#ifdef CONFIG_SMP
+static void __iomem *pmc = IO_ADDRESS(TEGRA_PMC_BASE);
+
+static int tegra20_reset_sleeping_cpu_1(void)
+{
+	int ret = 0;
+
+	tegra_pen_lock();
+
+	if (readl(pmc + PMC_SCRATCH41) == CPU_RESETTABLE)
+		tegra20_cpu_shutdown(1);
+	else
+		ret = -EINVAL;
+
+	tegra_pen_unlock();
+
+	return ret;
+}
+
+static void tegra20_wake_cpu1_from_reset(void)
+{
+	tegra_pen_lock();
+
+	tegra20_cpu_clear_resettable();
+
+	/* enable cpu clock on cpu */
+	tegra_enable_cpu_clock(1);
+
+	/* take the CPU out of reset */
+	tegra_cpu_out_of_reset(1);
+
+	/* unhalt the cpu */
+	flowctrl_write_cpu_halt(1, 0);
+
+	tegra_pen_unlock();
+}
+
+static int tegra20_reset_cpu_1(void)
+{
+	if (!cpu_online(1) || !tegra20_reset_sleeping_cpu_1())
+		return 0;
+
+	tegra20_wake_cpu1_from_reset();
+	return -EBUSY;
+}
+#else
+static inline void tegra20_wake_cpu1_from_reset(void)
+{
+}
+
+static inline int tegra20_reset_cpu_1(void)
+{
+	return 0;
+}
+#endif
+
+static bool tegra20_cpu_cluster_power_down(struct cpuidle_device *dev,
+					   struct cpuidle_driver *drv,
+					   int index)
+{
+	while (tegra20_cpu_is_resettable_soon())
+		cpu_relax();
+
+	if (tegra20_reset_cpu_1() || !tegra_cpu_rail_off_ready())
+		return false;
+
+	clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &dev->cpu);
+
+	tegra_idle_lp2_last();
+
+	clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu);
+
+	if (cpu_online(1))
+		tegra20_wake_cpu1_from_reset();
+
+	return true;
+}
+
+#ifdef CONFIG_SMP
+static bool tegra20_idle_enter_lp2_cpu_1(struct cpuidle_device *dev,
+					 struct cpuidle_driver *drv,
+					 int index)
+{
+	clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &dev->cpu);
+
+	cpu_suspend(0, tegra20_sleep_cpu_secondary_finish);
+
+	tegra20_cpu_clear_resettable();
+
+	clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu);
+
+	return true;
+}
+#else
+static inline bool tegra20_idle_enter_lp2_cpu_1(struct cpuidle_device *dev,
+						struct cpuidle_driver *drv,
+						int index)
+{
+	return true;
+}
+#endif
+
+static int tegra20_idle_lp2_coupled(struct cpuidle_device *dev,
+				    struct cpuidle_driver *drv,
+				    int index)
+{
+	bool entered_lp2 = false;
+
+	if (tegra_pending_sgi())
+		ACCESS_ONCE(abort_flag) = true;
+
+	cpuidle_coupled_parallel_barrier(dev, &abort_barrier);
+
+	if (abort_flag) {
+		cpuidle_coupled_parallel_barrier(dev, &abort_barrier);
+		abort_flag = false;	/* clean flag for next coming */
+		return -EINTR;
+	}
+
+	local_fiq_disable();
+
+	tegra_set_cpu_in_lp2();
+	cpu_pm_enter();
+
+	if (dev->cpu == 0)
+		entered_lp2 = tegra20_cpu_cluster_power_down(dev, drv, index);
+	else
+		entered_lp2 = tegra20_idle_enter_lp2_cpu_1(dev, drv, index);
+
+	cpu_pm_exit();
+	tegra_clear_cpu_in_lp2();
+
+	local_fiq_enable();
+
+	smp_rmb();
+
+	return entered_lp2 ? index : 0;
+}
+#endif
+
+int __init tegra20_cpuidle_init(void)
+{
+	return cpuidle_register(&tegra_idle_driver, cpu_possible_mask);
+}
diff --git a/drivers/cpuidle/cpuidle-tegra30.c b/drivers/cpuidle/cpuidle-tegra30.c
new file mode 100644
index 0000000..40080ab
--- /dev/null
+++ b/drivers/cpuidle/cpuidle-tegra30.c
@@ -0,0 +1,149 @@
+/*
+ * CPU idle driver for Tegra CPUs
+ *
+ * Copyright (c) 2010-2012, NVIDIA Corporation.
+ * Copyright (c) 2011 Google, Inc.
+ * Author: Colin Cross <ccross@android.com>
+ *         Gary King <gking@nvidia.com>
+ *
+ * Rework for 3.3 by Peter De Schrijver <pdeschrijver@nvidia.com>
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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/kernel.h>
+#include <linux/module.h>
+#include <linux/cpuidle.h>
+#include <linux/cpu_pm.h>
+#include <linux/clockchips.h>
+#include <linux/clk/tegra.h>
+
+#include <asm/cpuidle.h>
+#include <asm/proc-fns.h>
+#include <asm/suspend.h>
+#include <asm/smp_plat.h>
+
+#include "../../arch/arm/mach-tegra/pm.h"
+#include "../../arch/arm/mach-tegra/sleep.h"
+
+#ifdef CONFIG_PM_SLEEP
+static int tegra30_idle_lp2(struct cpuidle_device *dev,
+			    struct cpuidle_driver *drv,
+			    int index);
+#endif
+
+static struct cpuidle_driver tegra_idle_driver = {
+	.name = "tegra_idle",
+	.owner = THIS_MODULE,
+#ifdef CONFIG_PM_SLEEP
+	.state_count = 2,
+#else
+	.state_count = 1,
+#endif
+	.states = {
+		[0] = ARM_CPUIDLE_WFI_STATE_PWR(600),
+#ifdef CONFIG_PM_SLEEP
+		[1] = {
+			.enter			= tegra30_idle_lp2,
+			.exit_latency		= 2000,
+			.target_residency	= 2200,
+			.power_usage		= 0,
+			.flags			= CPUIDLE_FLAG_TIME_VALID,
+			.name			= "powered-down",
+			.desc			= "CPU power gated",
+		},
+#endif
+	},
+};
+
+#ifdef CONFIG_PM_SLEEP
+static bool tegra30_cpu_cluster_power_down(struct cpuidle_device *dev,
+					   struct cpuidle_driver *drv,
+					   int index)
+{
+	/* All CPUs entering LP2 is not working.
+	 * Don't let CPU0 enter LP2 when any secondary CPU is online.
+	 */
+	if (num_online_cpus() > 1 || !tegra_cpu_rail_off_ready()) {
+		cpu_do_idle();
+		return false;
+	}
+
+	clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &dev->cpu);
+
+	tegra_idle_lp2_last();
+
+	clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu);
+
+	return true;
+}
+
+#ifdef CONFIG_SMP
+static bool tegra30_cpu_core_power_down(struct cpuidle_device *dev,
+					struct cpuidle_driver *drv,
+					int index)
+{
+	clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &dev->cpu);
+
+	smp_wmb();
+
+	cpu_suspend(0, tegra30_sleep_cpu_secondary_finish);
+
+	clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu);
+
+	return true;
+}
+#else
+static inline bool tegra30_cpu_core_power_down(struct cpuidle_device *dev,
+					       struct cpuidle_driver *drv,
+					       int index)
+{
+	return true;
+}
+#endif
+
+static int tegra30_idle_lp2(struct cpuidle_device *dev,
+			    struct cpuidle_driver *drv,
+			    int index)
+{
+	bool entered_lp2 = false;
+	bool last_cpu;
+
+	local_fiq_disable();
+
+	last_cpu = tegra_set_cpu_in_lp2();
+	cpu_pm_enter();
+
+	if (dev->cpu == 0) {
+		if (last_cpu)
+			entered_lp2 = tegra30_cpu_cluster_power_down(dev, drv,
+								     index);
+		else
+			cpu_do_idle();
+	} else {
+		entered_lp2 = tegra30_cpu_core_power_down(dev, drv, index);
+	}
+
+	cpu_pm_exit();
+	tegra_clear_cpu_in_lp2();
+
+	local_fiq_enable();
+
+	smp_rmb();
+
+	return (entered_lp2) ? index : 0;
+}
+#endif
+
+int __init tegra30_cpuidle_init(void)
+{
+	return cpuidle_register(&tegra_idle_driver, NULL);
+}
-- 
1.8.2.3


^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH 7/8] ARM: tegra: move cpuidle drivers to drivers/cpuidle/
@ 2013-06-26 10:15   ` Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 42+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2013-06-26 10:15 UTC (permalink / raw)
  To: linux-arm-kernel

Compile tested only.

Cc: Stephen Warren <swarren@wwwdotorg.org>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
 arch/arm/mach-tegra/Makefile           |   9 --
 arch/arm/mach-tegra/cpuidle-tegra114.c |  35 ------
 arch/arm/mach-tegra/cpuidle-tegra20.c  | 217 ---------------------------------
 arch/arm/mach-tegra/cpuidle-tegra30.c  | 149 ----------------------
 drivers/cpuidle/Makefile               |   9 ++
 drivers/cpuidle/cpuidle-tegra114.c     |  35 ++++++
 drivers/cpuidle/cpuidle-tegra20.c      | 217 +++++++++++++++++++++++++++++++++
 drivers/cpuidle/cpuidle-tegra30.c      | 149 ++++++++++++++++++++++
 8 files changed, 410 insertions(+), 410 deletions(-)
 delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra114.c
 delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra20.c
 delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra30.c
 create mode 100644 drivers/cpuidle/cpuidle-tegra114.c
 create mode 100644 drivers/cpuidle/cpuidle-tegra20.c
 create mode 100644 drivers/cpuidle/cpuidle-tegra30.c

diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile
index 98b184e..7b33f82 100644
--- a/arch/arm/mach-tegra/Makefile
+++ b/arch/arm/mach-tegra/Makefile
@@ -17,23 +17,14 @@ obj-$(CONFIG_CPU_IDLE)			+= cpuidle.o
 obj-$(CONFIG_ARCH_TEGRA_2x_SOC)		+= tegra20_speedo.o
 obj-$(CONFIG_ARCH_TEGRA_2x_SOC)		+= tegra2_emc.o
 obj-$(CONFIG_ARCH_TEGRA_2x_SOC)		+= sleep-tegra20.o
-ifeq ($(CONFIG_CPU_IDLE),y)
-obj-$(CONFIG_ARCH_TEGRA_2x_SOC)		+= cpuidle-tegra20.o
-endif
 obj-$(CONFIG_ARCH_TEGRA_3x_SOC)		+= tegra30_speedo.o
 obj-$(CONFIG_ARCH_TEGRA_3x_SOC)		+= sleep-tegra30.o
-ifeq ($(CONFIG_CPU_IDLE),y)
-obj-$(CONFIG_ARCH_TEGRA_3x_SOC)		+= cpuidle-tegra30.o
-endif
 obj-$(CONFIG_SMP)			+= platsmp.o headsmp.o
 obj-$(CONFIG_HOTPLUG_CPU)               += hotplug.o
 obj-$(CONFIG_TEGRA_PCI)			+= pcie.o
 
 obj-$(CONFIG_ARCH_TEGRA_114_SOC)	+= tegra114_speedo.o
 obj-$(CONFIG_ARCH_TEGRA_114_SOC)	+= sleep-tegra30.o
-ifeq ($(CONFIG_CPU_IDLE),y)
-obj-$(CONFIG_ARCH_TEGRA_114_SOC)	+= cpuidle-tegra114.o
-endif
 
 obj-$(CONFIG_ARCH_TEGRA_2x_SOC)		+= board-harmony-pcie.o
 
diff --git a/arch/arm/mach-tegra/cpuidle-tegra114.c b/arch/arm/mach-tegra/cpuidle-tegra114.c
deleted file mode 100644
index 1d1c602..0000000
--- a/arch/arm/mach-tegra/cpuidle-tegra114.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2013, NVIDIA Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/cpuidle.h>
-
-#include <asm/cpuidle.h>
-
-static struct cpuidle_driver tegra_idle_driver = {
-	.name = "tegra_idle",
-	.owner = THIS_MODULE,
-	.state_count = 1,
-	.states = {
-		[0] = ARM_CPUIDLE_WFI_STATE_PWR(600),
-	},
-};
-
-int __init tegra114_cpuidle_init(void)
-{
-	return cpuidle_register(&tegra_idle_driver, NULL);
-}
diff --git a/arch/arm/mach-tegra/cpuidle-tegra20.c b/arch/arm/mach-tegra/cpuidle-tegra20.c
deleted file mode 100644
index 706aa42..0000000
--- a/arch/arm/mach-tegra/cpuidle-tegra20.c
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * CPU idle driver for Tegra CPUs
- *
- * Copyright (c) 2010-2012, NVIDIA Corporation.
- * Copyright (c) 2011 Google, Inc.
- * Author: Colin Cross <ccross@android.com>
- *         Gary King <gking@nvidia.com>
- *
- * Rework for 3.3 by Peter De Schrijver <pdeschrijver@nvidia.com>
- *
- * 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; either version 2 of the License, or
- * (at your option) any later version.
- *
- * 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/kernel.h>
-#include <linux/module.h>
-#include <linux/cpuidle.h>
-#include <linux/cpu_pm.h>
-#include <linux/clockchips.h>
-#include <linux/clk/tegra.h>
-
-#include <asm/cpuidle.h>
-#include <asm/proc-fns.h>
-#include <asm/suspend.h>
-#include <asm/smp_plat.h>
-
-#include "pm.h"
-#include "sleep.h"
-#include "iomap.h"
-#include "irq.h"
-#include "flowctrl.h"
-
-#ifdef CONFIG_PM_SLEEP
-static bool abort_flag;
-static atomic_t abort_barrier;
-static int tegra20_idle_lp2_coupled(struct cpuidle_device *dev,
-				    struct cpuidle_driver *drv,
-				    int index);
-#define TEGRA20_MAX_STATES 2
-#else
-#define TEGRA20_MAX_STATES 1
-#endif
-
-static struct cpuidle_driver tegra_idle_driver = {
-	.name = "tegra_idle",
-	.owner = THIS_MODULE,
-	.states = {
-		ARM_CPUIDLE_WFI_STATE_PWR(600),
-#ifdef CONFIG_PM_SLEEP
-		{
-			.enter            = tegra20_idle_lp2_coupled,
-			.exit_latency     = 5000,
-			.target_residency = 10000,
-			.power_usage      = 0,
-			.flags            = CPUIDLE_FLAG_TIME_VALID |
-			CPUIDLE_FLAG_COUPLED,
-			.name             = "powered-down",
-			.desc             = "CPU power gated",
-		},
-#endif
-	},
-	.state_count = TEGRA20_MAX_STATES,
-	.safe_state_index = 0,
-};
-
-#ifdef CONFIG_PM_SLEEP
-#ifdef CONFIG_SMP
-static void __iomem *pmc = IO_ADDRESS(TEGRA_PMC_BASE);
-
-static int tegra20_reset_sleeping_cpu_1(void)
-{
-	int ret = 0;
-
-	tegra_pen_lock();
-
-	if (readl(pmc + PMC_SCRATCH41) == CPU_RESETTABLE)
-		tegra20_cpu_shutdown(1);
-	else
-		ret = -EINVAL;
-
-	tegra_pen_unlock();
-
-	return ret;
-}
-
-static void tegra20_wake_cpu1_from_reset(void)
-{
-	tegra_pen_lock();
-
-	tegra20_cpu_clear_resettable();
-
-	/* enable cpu clock on cpu */
-	tegra_enable_cpu_clock(1);
-
-	/* take the CPU out of reset */
-	tegra_cpu_out_of_reset(1);
-
-	/* unhalt the cpu */
-	flowctrl_write_cpu_halt(1, 0);
-
-	tegra_pen_unlock();
-}
-
-static int tegra20_reset_cpu_1(void)
-{
-	if (!cpu_online(1) || !tegra20_reset_sleeping_cpu_1())
-		return 0;
-
-	tegra20_wake_cpu1_from_reset();
-	return -EBUSY;
-}
-#else
-static inline void tegra20_wake_cpu1_from_reset(void)
-{
-}
-
-static inline int tegra20_reset_cpu_1(void)
-{
-	return 0;
-}
-#endif
-
-static bool tegra20_cpu_cluster_power_down(struct cpuidle_device *dev,
-					   struct cpuidle_driver *drv,
-					   int index)
-{
-	while (tegra20_cpu_is_resettable_soon())
-		cpu_relax();
-
-	if (tegra20_reset_cpu_1() || !tegra_cpu_rail_off_ready())
-		return false;
-
-	clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &dev->cpu);
-
-	tegra_idle_lp2_last();
-
-	clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu);
-
-	if (cpu_online(1))
-		tegra20_wake_cpu1_from_reset();
-
-	return true;
-}
-
-#ifdef CONFIG_SMP
-static bool tegra20_idle_enter_lp2_cpu_1(struct cpuidle_device *dev,
-					 struct cpuidle_driver *drv,
-					 int index)
-{
-	clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &dev->cpu);
-
-	cpu_suspend(0, tegra20_sleep_cpu_secondary_finish);
-
-	tegra20_cpu_clear_resettable();
-
-	clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu);
-
-	return true;
-}
-#else
-static inline bool tegra20_idle_enter_lp2_cpu_1(struct cpuidle_device *dev,
-						struct cpuidle_driver *drv,
-						int index)
-{
-	return true;
-}
-#endif
-
-static int tegra20_idle_lp2_coupled(struct cpuidle_device *dev,
-				    struct cpuidle_driver *drv,
-				    int index)
-{
-	bool entered_lp2 = false;
-
-	if (tegra_pending_sgi())
-		ACCESS_ONCE(abort_flag) = true;
-
-	cpuidle_coupled_parallel_barrier(dev, &abort_barrier);
-
-	if (abort_flag) {
-		cpuidle_coupled_parallel_barrier(dev, &abort_barrier);
-		abort_flag = false;	/* clean flag for next coming */
-		return -EINTR;
-	}
-
-	local_fiq_disable();
-
-	tegra_set_cpu_in_lp2();
-	cpu_pm_enter();
-
-	if (dev->cpu == 0)
-		entered_lp2 = tegra20_cpu_cluster_power_down(dev, drv, index);
-	else
-		entered_lp2 = tegra20_idle_enter_lp2_cpu_1(dev, drv, index);
-
-	cpu_pm_exit();
-	tegra_clear_cpu_in_lp2();
-
-	local_fiq_enable();
-
-	smp_rmb();
-
-	return entered_lp2 ? index : 0;
-}
-#endif
-
-int __init tegra20_cpuidle_init(void)
-{
-	return cpuidle_register(&tegra_idle_driver, cpu_possible_mask);
-}
diff --git a/arch/arm/mach-tegra/cpuidle-tegra30.c b/arch/arm/mach-tegra/cpuidle-tegra30.c
deleted file mode 100644
index ed2a2a7..0000000
--- a/arch/arm/mach-tegra/cpuidle-tegra30.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * CPU idle driver for Tegra CPUs
- *
- * Copyright (c) 2010-2012, NVIDIA Corporation.
- * Copyright (c) 2011 Google, Inc.
- * Author: Colin Cross <ccross@android.com>
- *         Gary King <gking@nvidia.com>
- *
- * Rework for 3.3 by Peter De Schrijver <pdeschrijver@nvidia.com>
- *
- * 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; either version 2 of the License, or
- * (at your option) any later version.
- *
- * 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/kernel.h>
-#include <linux/module.h>
-#include <linux/cpuidle.h>
-#include <linux/cpu_pm.h>
-#include <linux/clockchips.h>
-#include <linux/clk/tegra.h>
-
-#include <asm/cpuidle.h>
-#include <asm/proc-fns.h>
-#include <asm/suspend.h>
-#include <asm/smp_plat.h>
-
-#include "pm.h"
-#include "sleep.h"
-
-#ifdef CONFIG_PM_SLEEP
-static int tegra30_idle_lp2(struct cpuidle_device *dev,
-			    struct cpuidle_driver *drv,
-			    int index);
-#endif
-
-static struct cpuidle_driver tegra_idle_driver = {
-	.name = "tegra_idle",
-	.owner = THIS_MODULE,
-#ifdef CONFIG_PM_SLEEP
-	.state_count = 2,
-#else
-	.state_count = 1,
-#endif
-	.states = {
-		[0] = ARM_CPUIDLE_WFI_STATE_PWR(600),
-#ifdef CONFIG_PM_SLEEP
-		[1] = {
-			.enter			= tegra30_idle_lp2,
-			.exit_latency		= 2000,
-			.target_residency	= 2200,
-			.power_usage		= 0,
-			.flags			= CPUIDLE_FLAG_TIME_VALID,
-			.name			= "powered-down",
-			.desc			= "CPU power gated",
-		},
-#endif
-	},
-};
-
-#ifdef CONFIG_PM_SLEEP
-static bool tegra30_cpu_cluster_power_down(struct cpuidle_device *dev,
-					   struct cpuidle_driver *drv,
-					   int index)
-{
-	/* All CPUs entering LP2 is not working.
-	 * Don't let CPU0 enter LP2 when any secondary CPU is online.
-	 */
-	if (num_online_cpus() > 1 || !tegra_cpu_rail_off_ready()) {
-		cpu_do_idle();
-		return false;
-	}
-
-	clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &dev->cpu);
-
-	tegra_idle_lp2_last();
-
-	clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu);
-
-	return true;
-}
-
-#ifdef CONFIG_SMP
-static bool tegra30_cpu_core_power_down(struct cpuidle_device *dev,
-					struct cpuidle_driver *drv,
-					int index)
-{
-	clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &dev->cpu);
-
-	smp_wmb();
-
-	cpu_suspend(0, tegra30_sleep_cpu_secondary_finish);
-
-	clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu);
-
-	return true;
-}
-#else
-static inline bool tegra30_cpu_core_power_down(struct cpuidle_device *dev,
-					       struct cpuidle_driver *drv,
-					       int index)
-{
-	return true;
-}
-#endif
-
-static int tegra30_idle_lp2(struct cpuidle_device *dev,
-			    struct cpuidle_driver *drv,
-			    int index)
-{
-	bool entered_lp2 = false;
-	bool last_cpu;
-
-	local_fiq_disable();
-
-	last_cpu = tegra_set_cpu_in_lp2();
-	cpu_pm_enter();
-
-	if (dev->cpu == 0) {
-		if (last_cpu)
-			entered_lp2 = tegra30_cpu_cluster_power_down(dev, drv,
-								     index);
-		else
-			cpu_do_idle();
-	} else {
-		entered_lp2 = tegra30_cpu_core_power_down(dev, drv, index);
-	}
-
-	cpu_pm_exit();
-	tegra_clear_cpu_in_lp2();
-
-	local_fiq_enable();
-
-	smp_rmb();
-
-	return (entered_lp2) ? index : 0;
-}
-#endif
-
-int __init tegra30_cpuidle_init(void)
-{
-	return cpuidle_register(&tegra_idle_driver, NULL);
-}
diff --git a/drivers/cpuidle/Makefile b/drivers/cpuidle/Makefile
index 758d0d9..953771f 100644
--- a/drivers/cpuidle/Makefile
+++ b/drivers/cpuidle/Makefile
@@ -37,4 +37,13 @@ endif
 ifeq ($(CONFIG_ARCH_SHMOBILE),y)
 	obj-y += cpuidle-shmobile.o
 endif
+ifeq ($(CONFIG_ARCH_TEGRA_2x_SOC),y)
+	obj-y += cpuidle-tegra20.o
+endif
+ifeq ($(CONFIG_ARCH_TEGRA_3x_SOC),y)
+	obj-y += cpuidle-tegra30.o
+endif
+ifeq ($(CONFIG_ARCH_TEGRA_114_SOC),y)
+	obj-y += cpuidle-tegra114.o
+endif
 obj-$(CONFIG_CPU_IDLE_ZYNQ) += cpuidle-zynq.o
diff --git a/drivers/cpuidle/cpuidle-tegra114.c b/drivers/cpuidle/cpuidle-tegra114.c
new file mode 100644
index 0000000..1d1c602
--- /dev/null
+++ b/drivers/cpuidle/cpuidle-tegra114.c
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2013, NVIDIA Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/cpuidle.h>
+
+#include <asm/cpuidle.h>
+
+static struct cpuidle_driver tegra_idle_driver = {
+	.name = "tegra_idle",
+	.owner = THIS_MODULE,
+	.state_count = 1,
+	.states = {
+		[0] = ARM_CPUIDLE_WFI_STATE_PWR(600),
+	},
+};
+
+int __init tegra114_cpuidle_init(void)
+{
+	return cpuidle_register(&tegra_idle_driver, NULL);
+}
diff --git a/drivers/cpuidle/cpuidle-tegra20.c b/drivers/cpuidle/cpuidle-tegra20.c
new file mode 100644
index 0000000..21a749c
--- /dev/null
+++ b/drivers/cpuidle/cpuidle-tegra20.c
@@ -0,0 +1,217 @@
+/*
+ * CPU idle driver for Tegra CPUs
+ *
+ * Copyright (c) 2010-2012, NVIDIA Corporation.
+ * Copyright (c) 2011 Google, Inc.
+ * Author: Colin Cross <ccross@android.com>
+ *         Gary King <gking@nvidia.com>
+ *
+ * Rework for 3.3 by Peter De Schrijver <pdeschrijver@nvidia.com>
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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/kernel.h>
+#include <linux/module.h>
+#include <linux/cpuidle.h>
+#include <linux/cpu_pm.h>
+#include <linux/clockchips.h>
+#include <linux/clk/tegra.h>
+
+#include <asm/cpuidle.h>
+#include <asm/proc-fns.h>
+#include <asm/suspend.h>
+#include <asm/smp_plat.h>
+
+#include "../../arch/arm/mach-tegra/pm.h"
+#include "../../arch/arm/mach-tegra/sleep.h"
+#include "../../arch/arm/mach-tegra/iomap.h"
+#include "../../arch/arm/mach-tegra/irq.h"
+#include "../../arch/arm/mach-tegra/flowctrl.h"
+
+#ifdef CONFIG_PM_SLEEP
+static bool abort_flag;
+static atomic_t abort_barrier;
+static int tegra20_idle_lp2_coupled(struct cpuidle_device *dev,
+				    struct cpuidle_driver *drv,
+				    int index);
+#define TEGRA20_MAX_STATES 2
+#else
+#define TEGRA20_MAX_STATES 1
+#endif
+
+static struct cpuidle_driver tegra_idle_driver = {
+	.name = "tegra_idle",
+	.owner = THIS_MODULE,
+	.states = {
+		ARM_CPUIDLE_WFI_STATE_PWR(600),
+#ifdef CONFIG_PM_SLEEP
+		{
+			.enter            = tegra20_idle_lp2_coupled,
+			.exit_latency     = 5000,
+			.target_residency = 10000,
+			.power_usage      = 0,
+			.flags            = CPUIDLE_FLAG_TIME_VALID |
+			CPUIDLE_FLAG_COUPLED,
+			.name             = "powered-down",
+			.desc             = "CPU power gated",
+		},
+#endif
+	},
+	.state_count = TEGRA20_MAX_STATES,
+	.safe_state_index = 0,
+};
+
+#ifdef CONFIG_PM_SLEEP
+#ifdef CONFIG_SMP
+static void __iomem *pmc = IO_ADDRESS(TEGRA_PMC_BASE);
+
+static int tegra20_reset_sleeping_cpu_1(void)
+{
+	int ret = 0;
+
+	tegra_pen_lock();
+
+	if (readl(pmc + PMC_SCRATCH41) == CPU_RESETTABLE)
+		tegra20_cpu_shutdown(1);
+	else
+		ret = -EINVAL;
+
+	tegra_pen_unlock();
+
+	return ret;
+}
+
+static void tegra20_wake_cpu1_from_reset(void)
+{
+	tegra_pen_lock();
+
+	tegra20_cpu_clear_resettable();
+
+	/* enable cpu clock on cpu */
+	tegra_enable_cpu_clock(1);
+
+	/* take the CPU out of reset */
+	tegra_cpu_out_of_reset(1);
+
+	/* unhalt the cpu */
+	flowctrl_write_cpu_halt(1, 0);
+
+	tegra_pen_unlock();
+}
+
+static int tegra20_reset_cpu_1(void)
+{
+	if (!cpu_online(1) || !tegra20_reset_sleeping_cpu_1())
+		return 0;
+
+	tegra20_wake_cpu1_from_reset();
+	return -EBUSY;
+}
+#else
+static inline void tegra20_wake_cpu1_from_reset(void)
+{
+}
+
+static inline int tegra20_reset_cpu_1(void)
+{
+	return 0;
+}
+#endif
+
+static bool tegra20_cpu_cluster_power_down(struct cpuidle_device *dev,
+					   struct cpuidle_driver *drv,
+					   int index)
+{
+	while (tegra20_cpu_is_resettable_soon())
+		cpu_relax();
+
+	if (tegra20_reset_cpu_1() || !tegra_cpu_rail_off_ready())
+		return false;
+
+	clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &dev->cpu);
+
+	tegra_idle_lp2_last();
+
+	clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu);
+
+	if (cpu_online(1))
+		tegra20_wake_cpu1_from_reset();
+
+	return true;
+}
+
+#ifdef CONFIG_SMP
+static bool tegra20_idle_enter_lp2_cpu_1(struct cpuidle_device *dev,
+					 struct cpuidle_driver *drv,
+					 int index)
+{
+	clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &dev->cpu);
+
+	cpu_suspend(0, tegra20_sleep_cpu_secondary_finish);
+
+	tegra20_cpu_clear_resettable();
+
+	clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu);
+
+	return true;
+}
+#else
+static inline bool tegra20_idle_enter_lp2_cpu_1(struct cpuidle_device *dev,
+						struct cpuidle_driver *drv,
+						int index)
+{
+	return true;
+}
+#endif
+
+static int tegra20_idle_lp2_coupled(struct cpuidle_device *dev,
+				    struct cpuidle_driver *drv,
+				    int index)
+{
+	bool entered_lp2 = false;
+
+	if (tegra_pending_sgi())
+		ACCESS_ONCE(abort_flag) = true;
+
+	cpuidle_coupled_parallel_barrier(dev, &abort_barrier);
+
+	if (abort_flag) {
+		cpuidle_coupled_parallel_barrier(dev, &abort_barrier);
+		abort_flag = false;	/* clean flag for next coming */
+		return -EINTR;
+	}
+
+	local_fiq_disable();
+
+	tegra_set_cpu_in_lp2();
+	cpu_pm_enter();
+
+	if (dev->cpu == 0)
+		entered_lp2 = tegra20_cpu_cluster_power_down(dev, drv, index);
+	else
+		entered_lp2 = tegra20_idle_enter_lp2_cpu_1(dev, drv, index);
+
+	cpu_pm_exit();
+	tegra_clear_cpu_in_lp2();
+
+	local_fiq_enable();
+
+	smp_rmb();
+
+	return entered_lp2 ? index : 0;
+}
+#endif
+
+int __init tegra20_cpuidle_init(void)
+{
+	return cpuidle_register(&tegra_idle_driver, cpu_possible_mask);
+}
diff --git a/drivers/cpuidle/cpuidle-tegra30.c b/drivers/cpuidle/cpuidle-tegra30.c
new file mode 100644
index 0000000..40080ab
--- /dev/null
+++ b/drivers/cpuidle/cpuidle-tegra30.c
@@ -0,0 +1,149 @@
+/*
+ * CPU idle driver for Tegra CPUs
+ *
+ * Copyright (c) 2010-2012, NVIDIA Corporation.
+ * Copyright (c) 2011 Google, Inc.
+ * Author: Colin Cross <ccross@android.com>
+ *         Gary King <gking@nvidia.com>
+ *
+ * Rework for 3.3 by Peter De Schrijver <pdeschrijver@nvidia.com>
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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/kernel.h>
+#include <linux/module.h>
+#include <linux/cpuidle.h>
+#include <linux/cpu_pm.h>
+#include <linux/clockchips.h>
+#include <linux/clk/tegra.h>
+
+#include <asm/cpuidle.h>
+#include <asm/proc-fns.h>
+#include <asm/suspend.h>
+#include <asm/smp_plat.h>
+
+#include "../../arch/arm/mach-tegra/pm.h"
+#include "../../arch/arm/mach-tegra/sleep.h"
+
+#ifdef CONFIG_PM_SLEEP
+static int tegra30_idle_lp2(struct cpuidle_device *dev,
+			    struct cpuidle_driver *drv,
+			    int index);
+#endif
+
+static struct cpuidle_driver tegra_idle_driver = {
+	.name = "tegra_idle",
+	.owner = THIS_MODULE,
+#ifdef CONFIG_PM_SLEEP
+	.state_count = 2,
+#else
+	.state_count = 1,
+#endif
+	.states = {
+		[0] = ARM_CPUIDLE_WFI_STATE_PWR(600),
+#ifdef CONFIG_PM_SLEEP
+		[1] = {
+			.enter			= tegra30_idle_lp2,
+			.exit_latency		= 2000,
+			.target_residency	= 2200,
+			.power_usage		= 0,
+			.flags			= CPUIDLE_FLAG_TIME_VALID,
+			.name			= "powered-down",
+			.desc			= "CPU power gated",
+		},
+#endif
+	},
+};
+
+#ifdef CONFIG_PM_SLEEP
+static bool tegra30_cpu_cluster_power_down(struct cpuidle_device *dev,
+					   struct cpuidle_driver *drv,
+					   int index)
+{
+	/* All CPUs entering LP2 is not working.
+	 * Don't let CPU0 enter LP2 when any secondary CPU is online.
+	 */
+	if (num_online_cpus() > 1 || !tegra_cpu_rail_off_ready()) {
+		cpu_do_idle();
+		return false;
+	}
+
+	clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &dev->cpu);
+
+	tegra_idle_lp2_last();
+
+	clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu);
+
+	return true;
+}
+
+#ifdef CONFIG_SMP
+static bool tegra30_cpu_core_power_down(struct cpuidle_device *dev,
+					struct cpuidle_driver *drv,
+					int index)
+{
+	clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &dev->cpu);
+
+	smp_wmb();
+
+	cpu_suspend(0, tegra30_sleep_cpu_secondary_finish);
+
+	clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu);
+
+	return true;
+}
+#else
+static inline bool tegra30_cpu_core_power_down(struct cpuidle_device *dev,
+					       struct cpuidle_driver *drv,
+					       int index)
+{
+	return true;
+}
+#endif
+
+static int tegra30_idle_lp2(struct cpuidle_device *dev,
+			    struct cpuidle_driver *drv,
+			    int index)
+{
+	bool entered_lp2 = false;
+	bool last_cpu;
+
+	local_fiq_disable();
+
+	last_cpu = tegra_set_cpu_in_lp2();
+	cpu_pm_enter();
+
+	if (dev->cpu == 0) {
+		if (last_cpu)
+			entered_lp2 = tegra30_cpu_cluster_power_down(dev, drv,
+								     index);
+		else
+			cpu_do_idle();
+	} else {
+		entered_lp2 = tegra30_cpu_core_power_down(dev, drv, index);
+	}
+
+	cpu_pm_exit();
+	tegra_clear_cpu_in_lp2();
+
+	local_fiq_enable();
+
+	smp_rmb();
+
+	return (entered_lp2) ? index : 0;
+}
+#endif
+
+int __init tegra30_cpuidle_init(void)
+{
+	return cpuidle_register(&tegra_idle_driver, NULL);
+}
-- 
1.8.2.3

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH 8/8] ARM: ux500: move cpuidle drivers to drivers/cpuidle/
  2013-06-26 10:15 ` Bartlomiej Zolnierkiewicz
@ 2013-06-26 10:15   ` Bartlomiej Zolnierkiewicz
  -1 siblings, 0 replies; 42+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2013-06-26 10:15 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: linux-pm, linux, nicolas.ferre, plagnioj, nsekhar, khilman,
	kernel, shawn.guo, tony, ben-linux, kgene.kim, horms,
	magnus.damm, swarren, srinidhi.kasagar, linus.walleij,
	daniel.lezcano, rjw, kyungmin.park, b.zolnierkie

Compile tested only.

Cc: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
 arch/arm/mach-ux500/Makefile    |   1 -
 arch/arm/mach-ux500/cpuidle.c   | 128 ----------------------------------------
 drivers/cpuidle/Makefile        |   3 +
 drivers/cpuidle/cpuidle-ux500.c | 128 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 131 insertions(+), 129 deletions(-)
 delete mode 100644 arch/arm/mach-ux500/cpuidle.c
 create mode 100644 drivers/cpuidle/cpuidle-ux500.c

diff --git a/arch/arm/mach-ux500/Makefile b/arch/arm/mach-ux500/Makefile
index bf9b6be..fe1f3e2 100644
--- a/arch/arm/mach-ux500/Makefile
+++ b/arch/arm/mach-ux500/Makefile
@@ -4,7 +4,6 @@
 
 obj-y				:= cpu.o devices.o devices-common.o \
 				   id.o usb.o timer.o pm.o
-obj-$(CONFIG_CPU_IDLE)          += cpuidle.o
 obj-$(CONFIG_CACHE_L2X0)	+= cache-l2x0.o
 obj-$(CONFIG_UX500_SOC_DB8500)	+= cpu-db8500.o devices-db8500.o
 obj-$(CONFIG_MACH_MOP500)	+= board-mop500.o board-mop500-sdi.o \
diff --git a/arch/arm/mach-ux500/cpuidle.c b/arch/arm/mach-ux500/cpuidle.c
deleted file mode 100644
index a45dd09..0000000
--- a/arch/arm/mach-ux500/cpuidle.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (c) 2012 Linaro : Daniel Lezcano <daniel.lezcano@linaro.org> (IBM)
- *
- * Based on the work of Rickard Andersson <rickard.andersson@stericsson.com>
- * and Jonas Aaberg <jonas.aberg@stericsson.com>.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <linux/module.h>
-#include <linux/cpuidle.h>
-#include <linux/spinlock.h>
-#include <linux/atomic.h>
-#include <linux/smp.h>
-#include <linux/mfd/dbx500-prcmu.h>
-#include <linux/platform_data/arm-ux500-pm.h>
-
-#include <asm/cpuidle.h>
-#include <asm/proc-fns.h>
-
-#include "db8500-regs.h"
-#include "id.h"
-
-static atomic_t master = ATOMIC_INIT(0);
-static DEFINE_SPINLOCK(master_lock);
-
-static inline int ux500_enter_idle(struct cpuidle_device *dev,
-				   struct cpuidle_driver *drv, int index)
-{
-	int this_cpu = smp_processor_id();
-	bool recouple = false;
-
-	if (atomic_inc_return(&master) == num_online_cpus()) {
-
-		/* With this lock, we prevent the other cpu to exit and enter
-		 * this function again and become the master */
-		if (!spin_trylock(&master_lock))
-			goto wfi;
-
-		/* decouple the gic from the A9 cores */
-		if (prcmu_gic_decouple()) {
-			spin_unlock(&master_lock);
-			goto out;
-		}
-
-		/* If an error occur, we will have to recouple the gic
-		 * manually */
-		recouple = true;
-
-		/* At this state, as the gic is decoupled, if the other
-		 * cpu is in WFI, we have the guarantee it won't be wake
-		 * up, so we can safely go to retention */
-		if (!prcmu_is_cpu_in_wfi(this_cpu ? 0 : 1))
-			goto out;
-
-		/* The prcmu will be in charge of watching the interrupts
-		 * and wake up the cpus */
-		if (prcmu_copy_gic_settings())
-			goto out;
-
-		/* Check in the meantime an interrupt did
-		 * not occur on the gic ... */
-		if (prcmu_gic_pending_irq())
-			goto out;
-
-		/* ... and the prcmu */
-		if (prcmu_pending_irq())
-			goto out;
-
-		/* Go to the retention state, the prcmu will wait for the
-		 * cpu to go WFI and this is what happens after exiting this
-		 * 'master' critical section */
-		if (prcmu_set_power_state(PRCMU_AP_IDLE, true, true))
-			goto out;
-
-		/* When we switch to retention, the prcmu is in charge
-		 * of recoupling the gic automatically */
-		recouple = false;
-
-		spin_unlock(&master_lock);
-	}
-wfi:
-	cpu_do_idle();
-out:
-	atomic_dec(&master);
-
-	if (recouple) {
-		prcmu_gic_recouple();
-		spin_unlock(&master_lock);
-	}
-
-	return index;
-}
-
-static struct cpuidle_driver ux500_idle_driver = {
-	.name = "ux500_idle",
-	.owner = THIS_MODULE,
-	.states = {
-		ARM_CPUIDLE_WFI_STATE,
-		{
-			.enter		  = ux500_enter_idle,
-			.exit_latency	  = 70,
-			.target_residency = 260,
-			.flags		  = CPUIDLE_FLAG_TIME_VALID |
-			                    CPUIDLE_FLAG_TIMER_STOP,
-			.name		  = "ApIdle",
-			.desc		  = "ARM Retention",
-		},
-	},
-	.safe_state_index = 0,
-	.state_count = 2,
-};
-
-int __init ux500_idle_init(void)
-{
-	if (!(cpu_is_u8500_family() || cpu_is_ux540_family()))
-		return -ENODEV;
-
-	/* Configure wake up reasons */
-	prcmu_enable_wakeups(PRCMU_WAKEUP(ARM) | PRCMU_WAKEUP(RTC) |
-			     PRCMU_WAKEUP(ABB));
-
-	return cpuidle_register(&ux500_idle_driver, NULL);
-}
-
-device_initcall(ux500_idle_init);
diff --git a/drivers/cpuidle/Makefile b/drivers/cpuidle/Makefile
index 953771f..941ed0b 100644
--- a/drivers/cpuidle/Makefile
+++ b/drivers/cpuidle/Makefile
@@ -46,4 +46,7 @@ endif
 ifeq ($(CONFIG_ARCH_TEGRA_114_SOC),y)
 	obj-y += cpuidle-tegra114.o
 endif
+ifeq ($(CONFIG_ARCH_U8500),y)
+	obj-y += cpuidle-ux500.o
+endif
 obj-$(CONFIG_CPU_IDLE_ZYNQ) += cpuidle-zynq.o
diff --git a/drivers/cpuidle/cpuidle-ux500.c b/drivers/cpuidle/cpuidle-ux500.c
new file mode 100644
index 0000000..078ad70
--- /dev/null
+++ b/drivers/cpuidle/cpuidle-ux500.c
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2012 Linaro : Daniel Lezcano <daniel.lezcano@linaro.org> (IBM)
+ *
+ * Based on the work of Rickard Andersson <rickard.andersson@stericsson.com>
+ * and Jonas Aaberg <jonas.aberg@stericsson.com>.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/module.h>
+#include <linux/cpuidle.h>
+#include <linux/spinlock.h>
+#include <linux/atomic.h>
+#include <linux/smp.h>
+#include <linux/mfd/dbx500-prcmu.h>
+#include <linux/platform_data/arm-ux500-pm.h>
+
+#include <asm/cpuidle.h>
+#include <asm/proc-fns.h>
+
+#include "../../arch/arm/mach-ux500/db8500-regs.h"
+#include "../../arch/arm/mach-ux500/id.h"
+
+static atomic_t master = ATOMIC_INIT(0);
+static DEFINE_SPINLOCK(master_lock);
+
+static inline int ux500_enter_idle(struct cpuidle_device *dev,
+				   struct cpuidle_driver *drv, int index)
+{
+	int this_cpu = smp_processor_id();
+	bool recouple = false;
+
+	if (atomic_inc_return(&master) == num_online_cpus()) {
+
+		/* With this lock, we prevent the other cpu to exit and enter
+		 * this function again and become the master */
+		if (!spin_trylock(&master_lock))
+			goto wfi;
+
+		/* decouple the gic from the A9 cores */
+		if (prcmu_gic_decouple()) {
+			spin_unlock(&master_lock);
+			goto out;
+		}
+
+		/* If an error occur, we will have to recouple the gic
+		 * manually */
+		recouple = true;
+
+		/* At this state, as the gic is decoupled, if the other
+		 * cpu is in WFI, we have the guarantee it won't be wake
+		 * up, so we can safely go to retention */
+		if (!prcmu_is_cpu_in_wfi(this_cpu ? 0 : 1))
+			goto out;
+
+		/* The prcmu will be in charge of watching the interrupts
+		 * and wake up the cpus */
+		if (prcmu_copy_gic_settings())
+			goto out;
+
+		/* Check in the meantime an interrupt did
+		 * not occur on the gic ... */
+		if (prcmu_gic_pending_irq())
+			goto out;
+
+		/* ... and the prcmu */
+		if (prcmu_pending_irq())
+			goto out;
+
+		/* Go to the retention state, the prcmu will wait for the
+		 * cpu to go WFI and this is what happens after exiting this
+		 * 'master' critical section */
+		if (prcmu_set_power_state(PRCMU_AP_IDLE, true, true))
+			goto out;
+
+		/* When we switch to retention, the prcmu is in charge
+		 * of recoupling the gic automatically */
+		recouple = false;
+
+		spin_unlock(&master_lock);
+	}
+wfi:
+	cpu_do_idle();
+out:
+	atomic_dec(&master);
+
+	if (recouple) {
+		prcmu_gic_recouple();
+		spin_unlock(&master_lock);
+	}
+
+	return index;
+}
+
+static struct cpuidle_driver ux500_idle_driver = {
+	.name = "ux500_idle",
+	.owner = THIS_MODULE,
+	.states = {
+		ARM_CPUIDLE_WFI_STATE,
+		{
+			.enter		  = ux500_enter_idle,
+			.exit_latency	  = 70,
+			.target_residency = 260,
+			.flags		  = CPUIDLE_FLAG_TIME_VALID |
+			                    CPUIDLE_FLAG_TIMER_STOP,
+			.name		  = "ApIdle",
+			.desc		  = "ARM Retention",
+		},
+	},
+	.safe_state_index = 0,
+	.state_count = 2,
+};
+
+int __init ux500_idle_init(void)
+{
+	if (!(cpu_is_u8500_family() || cpu_is_ux540_family()))
+		return -ENODEV;
+
+	/* Configure wake up reasons */
+	prcmu_enable_wakeups(PRCMU_WAKEUP(ARM) | PRCMU_WAKEUP(RTC) |
+			     PRCMU_WAKEUP(ABB));
+
+	return cpuidle_register(&ux500_idle_driver, NULL);
+}
+
+device_initcall(ux500_idle_init);
-- 
1.8.2.3


^ permalink raw reply related	[flat|nested] 42+ messages in thread

* [PATCH 8/8] ARM: ux500: move cpuidle drivers to drivers/cpuidle/
@ 2013-06-26 10:15   ` Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 42+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2013-06-26 10:15 UTC (permalink / raw)
  To: linux-arm-kernel

Compile tested only.

Cc: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
 arch/arm/mach-ux500/Makefile    |   1 -
 arch/arm/mach-ux500/cpuidle.c   | 128 ----------------------------------------
 drivers/cpuidle/Makefile        |   3 +
 drivers/cpuidle/cpuidle-ux500.c | 128 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 131 insertions(+), 129 deletions(-)
 delete mode 100644 arch/arm/mach-ux500/cpuidle.c
 create mode 100644 drivers/cpuidle/cpuidle-ux500.c

diff --git a/arch/arm/mach-ux500/Makefile b/arch/arm/mach-ux500/Makefile
index bf9b6be..fe1f3e2 100644
--- a/arch/arm/mach-ux500/Makefile
+++ b/arch/arm/mach-ux500/Makefile
@@ -4,7 +4,6 @@
 
 obj-y				:= cpu.o devices.o devices-common.o \
 				   id.o usb.o timer.o pm.o
-obj-$(CONFIG_CPU_IDLE)          += cpuidle.o
 obj-$(CONFIG_CACHE_L2X0)	+= cache-l2x0.o
 obj-$(CONFIG_UX500_SOC_DB8500)	+= cpu-db8500.o devices-db8500.o
 obj-$(CONFIG_MACH_MOP500)	+= board-mop500.o board-mop500-sdi.o \
diff --git a/arch/arm/mach-ux500/cpuidle.c b/arch/arm/mach-ux500/cpuidle.c
deleted file mode 100644
index a45dd09..0000000
--- a/arch/arm/mach-ux500/cpuidle.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (c) 2012 Linaro : Daniel Lezcano <daniel.lezcano@linaro.org> (IBM)
- *
- * Based on the work of Rickard Andersson <rickard.andersson@stericsson.com>
- * and Jonas Aaberg <jonas.aberg@stericsson.com>.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <linux/module.h>
-#include <linux/cpuidle.h>
-#include <linux/spinlock.h>
-#include <linux/atomic.h>
-#include <linux/smp.h>
-#include <linux/mfd/dbx500-prcmu.h>
-#include <linux/platform_data/arm-ux500-pm.h>
-
-#include <asm/cpuidle.h>
-#include <asm/proc-fns.h>
-
-#include "db8500-regs.h"
-#include "id.h"
-
-static atomic_t master = ATOMIC_INIT(0);
-static DEFINE_SPINLOCK(master_lock);
-
-static inline int ux500_enter_idle(struct cpuidle_device *dev,
-				   struct cpuidle_driver *drv, int index)
-{
-	int this_cpu = smp_processor_id();
-	bool recouple = false;
-
-	if (atomic_inc_return(&master) == num_online_cpus()) {
-
-		/* With this lock, we prevent the other cpu to exit and enter
-		 * this function again and become the master */
-		if (!spin_trylock(&master_lock))
-			goto wfi;
-
-		/* decouple the gic from the A9 cores */
-		if (prcmu_gic_decouple()) {
-			spin_unlock(&master_lock);
-			goto out;
-		}
-
-		/* If an error occur, we will have to recouple the gic
-		 * manually */
-		recouple = true;
-
-		/* At this state, as the gic is decoupled, if the other
-		 * cpu is in WFI, we have the guarantee it won't be wake
-		 * up, so we can safely go to retention */
-		if (!prcmu_is_cpu_in_wfi(this_cpu ? 0 : 1))
-			goto out;
-
-		/* The prcmu will be in charge of watching the interrupts
-		 * and wake up the cpus */
-		if (prcmu_copy_gic_settings())
-			goto out;
-
-		/* Check in the meantime an interrupt did
-		 * not occur on the gic ... */
-		if (prcmu_gic_pending_irq())
-			goto out;
-
-		/* ... and the prcmu */
-		if (prcmu_pending_irq())
-			goto out;
-
-		/* Go to the retention state, the prcmu will wait for the
-		 * cpu to go WFI and this is what happens after exiting this
-		 * 'master' critical section */
-		if (prcmu_set_power_state(PRCMU_AP_IDLE, true, true))
-			goto out;
-
-		/* When we switch to retention, the prcmu is in charge
-		 * of recoupling the gic automatically */
-		recouple = false;
-
-		spin_unlock(&master_lock);
-	}
-wfi:
-	cpu_do_idle();
-out:
-	atomic_dec(&master);
-
-	if (recouple) {
-		prcmu_gic_recouple();
-		spin_unlock(&master_lock);
-	}
-
-	return index;
-}
-
-static struct cpuidle_driver ux500_idle_driver = {
-	.name = "ux500_idle",
-	.owner = THIS_MODULE,
-	.states = {
-		ARM_CPUIDLE_WFI_STATE,
-		{
-			.enter		  = ux500_enter_idle,
-			.exit_latency	  = 70,
-			.target_residency = 260,
-			.flags		  = CPUIDLE_FLAG_TIME_VALID |
-			                    CPUIDLE_FLAG_TIMER_STOP,
-			.name		  = "ApIdle",
-			.desc		  = "ARM Retention",
-		},
-	},
-	.safe_state_index = 0,
-	.state_count = 2,
-};
-
-int __init ux500_idle_init(void)
-{
-	if (!(cpu_is_u8500_family() || cpu_is_ux540_family()))
-		return -ENODEV;
-
-	/* Configure wake up reasons */
-	prcmu_enable_wakeups(PRCMU_WAKEUP(ARM) | PRCMU_WAKEUP(RTC) |
-			     PRCMU_WAKEUP(ABB));
-
-	return cpuidle_register(&ux500_idle_driver, NULL);
-}
-
-device_initcall(ux500_idle_init);
diff --git a/drivers/cpuidle/Makefile b/drivers/cpuidle/Makefile
index 953771f..941ed0b 100644
--- a/drivers/cpuidle/Makefile
+++ b/drivers/cpuidle/Makefile
@@ -46,4 +46,7 @@ endif
 ifeq ($(CONFIG_ARCH_TEGRA_114_SOC),y)
 	obj-y += cpuidle-tegra114.o
 endif
+ifeq ($(CONFIG_ARCH_U8500),y)
+	obj-y += cpuidle-ux500.o
+endif
 obj-$(CONFIG_CPU_IDLE_ZYNQ) += cpuidle-zynq.o
diff --git a/drivers/cpuidle/cpuidle-ux500.c b/drivers/cpuidle/cpuidle-ux500.c
new file mode 100644
index 0000000..078ad70
--- /dev/null
+++ b/drivers/cpuidle/cpuidle-ux500.c
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2012 Linaro : Daniel Lezcano <daniel.lezcano@linaro.org> (IBM)
+ *
+ * Based on the work of Rickard Andersson <rickard.andersson@stericsson.com>
+ * and Jonas Aaberg <jonas.aberg@stericsson.com>.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/module.h>
+#include <linux/cpuidle.h>
+#include <linux/spinlock.h>
+#include <linux/atomic.h>
+#include <linux/smp.h>
+#include <linux/mfd/dbx500-prcmu.h>
+#include <linux/platform_data/arm-ux500-pm.h>
+
+#include <asm/cpuidle.h>
+#include <asm/proc-fns.h>
+
+#include "../../arch/arm/mach-ux500/db8500-regs.h"
+#include "../../arch/arm/mach-ux500/id.h"
+
+static atomic_t master = ATOMIC_INIT(0);
+static DEFINE_SPINLOCK(master_lock);
+
+static inline int ux500_enter_idle(struct cpuidle_device *dev,
+				   struct cpuidle_driver *drv, int index)
+{
+	int this_cpu = smp_processor_id();
+	bool recouple = false;
+
+	if (atomic_inc_return(&master) == num_online_cpus()) {
+
+		/* With this lock, we prevent the other cpu to exit and enter
+		 * this function again and become the master */
+		if (!spin_trylock(&master_lock))
+			goto wfi;
+
+		/* decouple the gic from the A9 cores */
+		if (prcmu_gic_decouple()) {
+			spin_unlock(&master_lock);
+			goto out;
+		}
+
+		/* If an error occur, we will have to recouple the gic
+		 * manually */
+		recouple = true;
+
+		/* At this state, as the gic is decoupled, if the other
+		 * cpu is in WFI, we have the guarantee it won't be wake
+		 * up, so we can safely go to retention */
+		if (!prcmu_is_cpu_in_wfi(this_cpu ? 0 : 1))
+			goto out;
+
+		/* The prcmu will be in charge of watching the interrupts
+		 * and wake up the cpus */
+		if (prcmu_copy_gic_settings())
+			goto out;
+
+		/* Check in the meantime an interrupt did
+		 * not occur on the gic ... */
+		if (prcmu_gic_pending_irq())
+			goto out;
+
+		/* ... and the prcmu */
+		if (prcmu_pending_irq())
+			goto out;
+
+		/* Go to the retention state, the prcmu will wait for the
+		 * cpu to go WFI and this is what happens after exiting this
+		 * 'master' critical section */
+		if (prcmu_set_power_state(PRCMU_AP_IDLE, true, true))
+			goto out;
+
+		/* When we switch to retention, the prcmu is in charge
+		 * of recoupling the gic automatically */
+		recouple = false;
+
+		spin_unlock(&master_lock);
+	}
+wfi:
+	cpu_do_idle();
+out:
+	atomic_dec(&master);
+
+	if (recouple) {
+		prcmu_gic_recouple();
+		spin_unlock(&master_lock);
+	}
+
+	return index;
+}
+
+static struct cpuidle_driver ux500_idle_driver = {
+	.name = "ux500_idle",
+	.owner = THIS_MODULE,
+	.states = {
+		ARM_CPUIDLE_WFI_STATE,
+		{
+			.enter		  = ux500_enter_idle,
+			.exit_latency	  = 70,
+			.target_residency = 260,
+			.flags		  = CPUIDLE_FLAG_TIME_VALID |
+			                    CPUIDLE_FLAG_TIMER_STOP,
+			.name		  = "ApIdle",
+			.desc		  = "ARM Retention",
+		},
+	},
+	.safe_state_index = 0,
+	.state_count = 2,
+};
+
+int __init ux500_idle_init(void)
+{
+	if (!(cpu_is_u8500_family() || cpu_is_ux540_family()))
+		return -ENODEV;
+
+	/* Configure wake up reasons */
+	prcmu_enable_wakeups(PRCMU_WAKEUP(ARM) | PRCMU_WAKEUP(RTC) |
+			     PRCMU_WAKEUP(ABB));
+
+	return cpuidle_register(&ux500_idle_driver, NULL);
+}
+
+device_initcall(ux500_idle_init);
-- 
1.8.2.3

^ permalink raw reply related	[flat|nested] 42+ messages in thread

* Re: [PATCH 0/8] ARM: move cpuidle drivers to drivers/cpuidle/
  2013-06-26 10:15 ` Bartlomiej Zolnierkiewicz
@ 2013-06-26 10:59   ` Daniel Lezcano
  -1 siblings, 0 replies; 42+ messages in thread
From: Daniel Lezcano @ 2013-06-26 10:59 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz
  Cc: linux-arm-kernel, linux-pm, linux, nicolas.ferre, plagnioj,
	nsekhar, khilman, kernel, shawn.guo, tony, ben-linux, kgene.kim,
	horms, magnus.damm, swarren, srinidhi.kasagar, linus.walleij,
	rjw, kyungmin.park

On 06/26/2013 12:15 PM, Bartlomiej Zolnierkiewicz wrote:
> Hi,
> 
> This patchset moves ARM cpuidle drivers to drivers/cpuidle/ to make
> code match new driver placement rules (per commit a8e39c3 "cpuidle: add
> maintainer entry").

I second this initiative but as stated in a previous email, a bit of
code cleanup, consolidation and encapsulation should be done before.

Again, from my POV, it is worth to do that but we have to split the pm
code from the driver.

Please review some patches I sent recently to split this code and
comment them. Otherwise, we will collide on this work.

All the patches sent [1] was to unify the code to make the drivers as
unified as possible to converge to the same code pattern and to
facilitate the factoring out.

Thanks
  -- Daniel

[1]
https://git.kernel.org/cgit/linux/kernel/git/rafael/linux-pm.git/log/?h=linux-next&qt=author&q=daniel.lezcano%40linaro.org

> [ Please note that movement of Samsung EXYNOS cpuidle driver is handled
>   in separate patchset since it needs some other changes applied first. ]
> 
> Patches are based on linux-next (next-20130624) and are compile tested
> only.  If agreed they all should probably go together through one tree
> (linux-pm or arm-soc) since they all modify drivers/cpuidle/Makefile.
> 
> PS It seems that majority of cpuidle drivers is not used by default
> (CONFIG_CPU_IDLE is not turned on in corresponding defconfigs). The only
> exceptions are shmobile (kota2_defconfig) and tegra (tegra_defconfig).
> This is probably also something that needs updating.
> 
> Best regards,
> --
> Bartlomiej Zolnierkiewicz
> Samsung R&D Institute Poland
> Samsung Electronics
> 
> 
> Bartlomiej Zolnierkiewicz (8):
>   ARM: at91: move cpuidle driver to drivers/cpuidle/
>   ARM: davinci: move cpuidle driver to drivers/cpuidle/
>   ARM: imx: move cpuidle drivers to drivers/cpuidle/
>   ARM: OMAP: move cpuidle drivers to drivers/cpuidle/
>   ARM: S3C64XX: move cpuidle driver to drivers/cpuidle/
>   ARM: shmobile: move cpuidle driver to drivers/cpuidle/
>   ARM: tegra: move cpuidle drivers to drivers/cpuidle/
>   ARM: ux500: move cpuidle drivers to drivers/cpuidle/
> 
>  arch/arm/mach-at91/Makefile            |   1 -
>  arch/arm/mach-at91/cpuidle.c           |  68 -------
>  arch/arm/mach-davinci/Makefile         |   1 -
>  arch/arm/mach-davinci/cpuidle.c        | 105 ----------
>  arch/arm/mach-imx/Makefile             |   5 -
>  arch/arm/mach-imx/cpuidle-imx5.c       |  37 ----
>  arch/arm/mach-imx/cpuidle-imx6q.c      |  75 -------
>  arch/arm/mach-omap2/Makefile           |   5 -
>  arch/arm/mach-omap2/cpuidle34xx.c      | 344 ---------------------------------
>  arch/arm/mach-omap2/cpuidle44xx.c      | 217 ---------------------
>  arch/arm/mach-s3c64xx/Makefile         |   1 -
>  arch/arm/mach-s3c64xx/cpuidle.c        |  63 ------
>  arch/arm/mach-shmobile/Makefile        |   1 -
>  arch/arm/mach-shmobile/cpuidle.c       |  37 ----
>  arch/arm/mach-tegra/Makefile           |   9 -
>  arch/arm/mach-tegra/cpuidle-tegra114.c |  35 ----
>  arch/arm/mach-tegra/cpuidle-tegra20.c  | 217 ---------------------
>  arch/arm/mach-tegra/cpuidle-tegra30.c  | 149 --------------
>  arch/arm/mach-ux500/Makefile           |   1 -
>  arch/arm/mach-ux500/cpuidle.c          | 128 ------------
>  drivers/cpuidle/Makefile               |  42 ++++
>  drivers/cpuidle/cpuidle-at91.c         |  68 +++++++
>  drivers/cpuidle/cpuidle-davinci.c      | 104 ++++++++++
>  drivers/cpuidle/cpuidle-imx5.c         |  37 ++++
>  drivers/cpuidle/cpuidle-imx6q.c        |  74 +++++++
>  drivers/cpuidle/cpuidle-omap34xx.c     | 342 ++++++++++++++++++++++++++++++++
>  drivers/cpuidle/cpuidle-omap44xx.c     | 216 +++++++++++++++++++++
>  drivers/cpuidle/cpuidle-s3c64xx.c      |  62 ++++++
>  drivers/cpuidle/cpuidle-shmobile.c     |  37 ++++
>  drivers/cpuidle/cpuidle-tegra114.c     |  35 ++++
>  drivers/cpuidle/cpuidle-tegra20.c      | 217 +++++++++++++++++++++
>  drivers/cpuidle/cpuidle-tegra30.c      | 149 ++++++++++++++
>  drivers/cpuidle/cpuidle-ux500.c        | 128 ++++++++++++
>  33 files changed, 1511 insertions(+), 1499 deletions(-)
>  delete mode 100644 arch/arm/mach-at91/cpuidle.c
>  delete mode 100644 arch/arm/mach-davinci/cpuidle.c
>  delete mode 100644 arch/arm/mach-imx/cpuidle-imx5.c
>  delete mode 100644 arch/arm/mach-imx/cpuidle-imx6q.c
>  delete mode 100644 arch/arm/mach-omap2/cpuidle34xx.c
>  delete mode 100644 arch/arm/mach-omap2/cpuidle44xx.c
>  delete mode 100644 arch/arm/mach-s3c64xx/cpuidle.c
>  delete mode 100644 arch/arm/mach-shmobile/cpuidle.c
>  delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra114.c
>  delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra20.c
>  delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra30.c
>  delete mode 100644 arch/arm/mach-ux500/cpuidle.c
>  create mode 100644 drivers/cpuidle/cpuidle-at91.c
>  create mode 100644 drivers/cpuidle/cpuidle-davinci.c
>  create mode 100644 drivers/cpuidle/cpuidle-imx5.c
>  create mode 100644 drivers/cpuidle/cpuidle-imx6q.c
>  create mode 100644 drivers/cpuidle/cpuidle-omap34xx.c
>  create mode 100644 drivers/cpuidle/cpuidle-omap44xx.c
>  create mode 100644 drivers/cpuidle/cpuidle-s3c64xx.c
>  create mode 100644 drivers/cpuidle/cpuidle-shmobile.c
>  create mode 100644 drivers/cpuidle/cpuidle-tegra114.c
>  create mode 100644 drivers/cpuidle/cpuidle-tegra20.c
>  create mode 100644 drivers/cpuidle/cpuidle-tegra30.c
>  create mode 100644 drivers/cpuidle/cpuidle-ux500.c
> 


-- 
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


^ permalink raw reply	[flat|nested] 42+ messages in thread

* [PATCH 0/8] ARM: move cpuidle drivers to drivers/cpuidle/
@ 2013-06-26 10:59   ` Daniel Lezcano
  0 siblings, 0 replies; 42+ messages in thread
From: Daniel Lezcano @ 2013-06-26 10:59 UTC (permalink / raw)
  To: linux-arm-kernel

On 06/26/2013 12:15 PM, Bartlomiej Zolnierkiewicz wrote:
> Hi,
> 
> This patchset moves ARM cpuidle drivers to drivers/cpuidle/ to make
> code match new driver placement rules (per commit a8e39c3 "cpuidle: add
> maintainer entry").

I second this initiative but as stated in a previous email, a bit of
code cleanup, consolidation and encapsulation should be done before.

Again, from my POV, it is worth to do that but we have to split the pm
code from the driver.

Please review some patches I sent recently to split this code and
comment them. Otherwise, we will collide on this work.

All the patches sent [1] was to unify the code to make the drivers as
unified as possible to converge to the same code pattern and to
facilitate the factoring out.

Thanks
  -- Daniel

[1]
https://git.kernel.org/cgit/linux/kernel/git/rafael/linux-pm.git/log/?h=linux-next&qt=author&q=daniel.lezcano%40linaro.org

> [ Please note that movement of Samsung EXYNOS cpuidle driver is handled
>   in separate patchset since it needs some other changes applied first. ]
> 
> Patches are based on linux-next (next-20130624) and are compile tested
> only.  If agreed they all should probably go together through one tree
> (linux-pm or arm-soc) since they all modify drivers/cpuidle/Makefile.
> 
> PS It seems that majority of cpuidle drivers is not used by default
> (CONFIG_CPU_IDLE is not turned on in corresponding defconfigs). The only
> exceptions are shmobile (kota2_defconfig) and tegra (tegra_defconfig).
> This is probably also something that needs updating.
> 
> Best regards,
> --
> Bartlomiej Zolnierkiewicz
> Samsung R&D Institute Poland
> Samsung Electronics
> 
> 
> Bartlomiej Zolnierkiewicz (8):
>   ARM: at91: move cpuidle driver to drivers/cpuidle/
>   ARM: davinci: move cpuidle driver to drivers/cpuidle/
>   ARM: imx: move cpuidle drivers to drivers/cpuidle/
>   ARM: OMAP: move cpuidle drivers to drivers/cpuidle/
>   ARM: S3C64XX: move cpuidle driver to drivers/cpuidle/
>   ARM: shmobile: move cpuidle driver to drivers/cpuidle/
>   ARM: tegra: move cpuidle drivers to drivers/cpuidle/
>   ARM: ux500: move cpuidle drivers to drivers/cpuidle/
> 
>  arch/arm/mach-at91/Makefile            |   1 -
>  arch/arm/mach-at91/cpuidle.c           |  68 -------
>  arch/arm/mach-davinci/Makefile         |   1 -
>  arch/arm/mach-davinci/cpuidle.c        | 105 ----------
>  arch/arm/mach-imx/Makefile             |   5 -
>  arch/arm/mach-imx/cpuidle-imx5.c       |  37 ----
>  arch/arm/mach-imx/cpuidle-imx6q.c      |  75 -------
>  arch/arm/mach-omap2/Makefile           |   5 -
>  arch/arm/mach-omap2/cpuidle34xx.c      | 344 ---------------------------------
>  arch/arm/mach-omap2/cpuidle44xx.c      | 217 ---------------------
>  arch/arm/mach-s3c64xx/Makefile         |   1 -
>  arch/arm/mach-s3c64xx/cpuidle.c        |  63 ------
>  arch/arm/mach-shmobile/Makefile        |   1 -
>  arch/arm/mach-shmobile/cpuidle.c       |  37 ----
>  arch/arm/mach-tegra/Makefile           |   9 -
>  arch/arm/mach-tegra/cpuidle-tegra114.c |  35 ----
>  arch/arm/mach-tegra/cpuidle-tegra20.c  | 217 ---------------------
>  arch/arm/mach-tegra/cpuidle-tegra30.c  | 149 --------------
>  arch/arm/mach-ux500/Makefile           |   1 -
>  arch/arm/mach-ux500/cpuidle.c          | 128 ------------
>  drivers/cpuidle/Makefile               |  42 ++++
>  drivers/cpuidle/cpuidle-at91.c         |  68 +++++++
>  drivers/cpuidle/cpuidle-davinci.c      | 104 ++++++++++
>  drivers/cpuidle/cpuidle-imx5.c         |  37 ++++
>  drivers/cpuidle/cpuidle-imx6q.c        |  74 +++++++
>  drivers/cpuidle/cpuidle-omap34xx.c     | 342 ++++++++++++++++++++++++++++++++
>  drivers/cpuidle/cpuidle-omap44xx.c     | 216 +++++++++++++++++++++
>  drivers/cpuidle/cpuidle-s3c64xx.c      |  62 ++++++
>  drivers/cpuidle/cpuidle-shmobile.c     |  37 ++++
>  drivers/cpuidle/cpuidle-tegra114.c     |  35 ++++
>  drivers/cpuidle/cpuidle-tegra20.c      | 217 +++++++++++++++++++++
>  drivers/cpuidle/cpuidle-tegra30.c      | 149 ++++++++++++++
>  drivers/cpuidle/cpuidle-ux500.c        | 128 ++++++++++++
>  33 files changed, 1511 insertions(+), 1499 deletions(-)
>  delete mode 100644 arch/arm/mach-at91/cpuidle.c
>  delete mode 100644 arch/arm/mach-davinci/cpuidle.c
>  delete mode 100644 arch/arm/mach-imx/cpuidle-imx5.c
>  delete mode 100644 arch/arm/mach-imx/cpuidle-imx6q.c
>  delete mode 100644 arch/arm/mach-omap2/cpuidle34xx.c
>  delete mode 100644 arch/arm/mach-omap2/cpuidle44xx.c
>  delete mode 100644 arch/arm/mach-s3c64xx/cpuidle.c
>  delete mode 100644 arch/arm/mach-shmobile/cpuidle.c
>  delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra114.c
>  delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra20.c
>  delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra30.c
>  delete mode 100644 arch/arm/mach-ux500/cpuidle.c
>  create mode 100644 drivers/cpuidle/cpuidle-at91.c
>  create mode 100644 drivers/cpuidle/cpuidle-davinci.c
>  create mode 100644 drivers/cpuidle/cpuidle-imx5.c
>  create mode 100644 drivers/cpuidle/cpuidle-imx6q.c
>  create mode 100644 drivers/cpuidle/cpuidle-omap34xx.c
>  create mode 100644 drivers/cpuidle/cpuidle-omap44xx.c
>  create mode 100644 drivers/cpuidle/cpuidle-s3c64xx.c
>  create mode 100644 drivers/cpuidle/cpuidle-shmobile.c
>  create mode 100644 drivers/cpuidle/cpuidle-tegra114.c
>  create mode 100644 drivers/cpuidle/cpuidle-tegra20.c
>  create mode 100644 drivers/cpuidle/cpuidle-tegra30.c
>  create mode 100644 drivers/cpuidle/cpuidle-ux500.c
> 


-- 
 <http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH 0/8] ARM: move cpuidle drivers to drivers/cpuidle/
  2013-06-26 10:59   ` Daniel Lezcano
@ 2013-06-26 12:22     ` Bartlomiej Zolnierkiewicz
  -1 siblings, 0 replies; 42+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2013-06-26 12:22 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: linux-arm-kernel, linux-pm, linux, nicolas.ferre, plagnioj,
	nsekhar, khilman, kernel, shawn.guo, tony, ben-linux, kgene.kim,
	horms, magnus.damm, swarren, srinidhi.kasagar, linus.walleij,
	rjw, kyungmin.park


Hi,

On Wednesday, June 26, 2013 12:59:53 PM Daniel Lezcano wrote:
> On 06/26/2013 12:15 PM, Bartlomiej Zolnierkiewicz wrote:
> > Hi,
> > 
> > This patchset moves ARM cpuidle drivers to drivers/cpuidle/ to make
> > code match new driver placement rules (per commit a8e39c3 "cpuidle: add
> > maintainer entry").
> 
> I second this initiative but as stated in a previous email, a bit of
> code cleanup, consolidation and encapsulation should be done before.
> 
> Again, from my POV, it is worth to do that but we have to split the pm
> code from the driver.

OK, I'll look into separating the pm code from the drivers.  However it
seems that patch #2 (for davinci) can be applied as it is.

> Please review some patches I sent recently to split this code and
> comment them. Otherwise, we will collide on this work.
> 
> All the patches sent [1] was to unify the code to make the drivers as
> unified as possible to converge to the same code pattern and to
> facilitate the factoring out.

I've looked at the patches ([1] and at91 ones) and they look fine to me.

I don't think that there is currently a risk of colliding on this work
(except at91 case) as your patches (except at91 ones) are already merged
in upstream or linux-next branch of linux-pm tree (which is included in
linux-next tree which I based my patches on). I'm subscribed to linux-pm
mailing list now but please cc: me on your future ARM cpuidle changes
(thanks!).

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

> Thanks
>   -- Daniel
> 
> [1]
> https://git.kernel.org/cgit/linux/kernel/git/rafael/linux-pm.git/log/?h=linux-next&qt=author&q=daniel.lezcano%40linaro.org
> 
> > [ Please note that movement of Samsung EXYNOS cpuidle driver is handled
> >   in separate patchset since it needs some other changes applied first. ]
> > 
> > Patches are based on linux-next (next-20130624) and are compile tested
> > only.  If agreed they all should probably go together through one tree
> > (linux-pm or arm-soc) since they all modify drivers/cpuidle/Makefile.
> > 
> > PS It seems that majority of cpuidle drivers is not used by default
> > (CONFIG_CPU_IDLE is not turned on in corresponding defconfigs). The only
> > exceptions are shmobile (kota2_defconfig) and tegra (tegra_defconfig).
> > This is probably also something that needs updating.
> > 
> > Best regards,
> > --
> > Bartlomiej Zolnierkiewicz
> > Samsung R&D Institute Poland
> > Samsung Electronics
> > 
> > 
> > Bartlomiej Zolnierkiewicz (8):
> >   ARM: at91: move cpuidle driver to drivers/cpuidle/
> >   ARM: davinci: move cpuidle driver to drivers/cpuidle/
> >   ARM: imx: move cpuidle drivers to drivers/cpuidle/
> >   ARM: OMAP: move cpuidle drivers to drivers/cpuidle/
> >   ARM: S3C64XX: move cpuidle driver to drivers/cpuidle/
> >   ARM: shmobile: move cpuidle driver to drivers/cpuidle/
> >   ARM: tegra: move cpuidle drivers to drivers/cpuidle/
> >   ARM: ux500: move cpuidle drivers to drivers/cpuidle/
> > 
> >  arch/arm/mach-at91/Makefile            |   1 -
> >  arch/arm/mach-at91/cpuidle.c           |  68 -------
> >  arch/arm/mach-davinci/Makefile         |   1 -
> >  arch/arm/mach-davinci/cpuidle.c        | 105 ----------
> >  arch/arm/mach-imx/Makefile             |   5 -
> >  arch/arm/mach-imx/cpuidle-imx5.c       |  37 ----
> >  arch/arm/mach-imx/cpuidle-imx6q.c      |  75 -------
> >  arch/arm/mach-omap2/Makefile           |   5 -
> >  arch/arm/mach-omap2/cpuidle34xx.c      | 344 ---------------------------------
> >  arch/arm/mach-omap2/cpuidle44xx.c      | 217 ---------------------
> >  arch/arm/mach-s3c64xx/Makefile         |   1 -
> >  arch/arm/mach-s3c64xx/cpuidle.c        |  63 ------
> >  arch/arm/mach-shmobile/Makefile        |   1 -
> >  arch/arm/mach-shmobile/cpuidle.c       |  37 ----
> >  arch/arm/mach-tegra/Makefile           |   9 -
> >  arch/arm/mach-tegra/cpuidle-tegra114.c |  35 ----
> >  arch/arm/mach-tegra/cpuidle-tegra20.c  | 217 ---------------------
> >  arch/arm/mach-tegra/cpuidle-tegra30.c  | 149 --------------
> >  arch/arm/mach-ux500/Makefile           |   1 -
> >  arch/arm/mach-ux500/cpuidle.c          | 128 ------------
> >  drivers/cpuidle/Makefile               |  42 ++++
> >  drivers/cpuidle/cpuidle-at91.c         |  68 +++++++
> >  drivers/cpuidle/cpuidle-davinci.c      | 104 ++++++++++
> >  drivers/cpuidle/cpuidle-imx5.c         |  37 ++++
> >  drivers/cpuidle/cpuidle-imx6q.c        |  74 +++++++
> >  drivers/cpuidle/cpuidle-omap34xx.c     | 342 ++++++++++++++++++++++++++++++++
> >  drivers/cpuidle/cpuidle-omap44xx.c     | 216 +++++++++++++++++++++
> >  drivers/cpuidle/cpuidle-s3c64xx.c      |  62 ++++++
> >  drivers/cpuidle/cpuidle-shmobile.c     |  37 ++++
> >  drivers/cpuidle/cpuidle-tegra114.c     |  35 ++++
> >  drivers/cpuidle/cpuidle-tegra20.c      | 217 +++++++++++++++++++++
> >  drivers/cpuidle/cpuidle-tegra30.c      | 149 ++++++++++++++
> >  drivers/cpuidle/cpuidle-ux500.c        | 128 ++++++++++++
> >  33 files changed, 1511 insertions(+), 1499 deletions(-)
> >  delete mode 100644 arch/arm/mach-at91/cpuidle.c
> >  delete mode 100644 arch/arm/mach-davinci/cpuidle.c
> >  delete mode 100644 arch/arm/mach-imx/cpuidle-imx5.c
> >  delete mode 100644 arch/arm/mach-imx/cpuidle-imx6q.c
> >  delete mode 100644 arch/arm/mach-omap2/cpuidle34xx.c
> >  delete mode 100644 arch/arm/mach-omap2/cpuidle44xx.c
> >  delete mode 100644 arch/arm/mach-s3c64xx/cpuidle.c
> >  delete mode 100644 arch/arm/mach-shmobile/cpuidle.c
> >  delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra114.c
> >  delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra20.c
> >  delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra30.c
> >  delete mode 100644 arch/arm/mach-ux500/cpuidle.c
> >  create mode 100644 drivers/cpuidle/cpuidle-at91.c
> >  create mode 100644 drivers/cpuidle/cpuidle-davinci.c
> >  create mode 100644 drivers/cpuidle/cpuidle-imx5.c
> >  create mode 100644 drivers/cpuidle/cpuidle-imx6q.c
> >  create mode 100644 drivers/cpuidle/cpuidle-omap34xx.c
> >  create mode 100644 drivers/cpuidle/cpuidle-omap44xx.c
> >  create mode 100644 drivers/cpuidle/cpuidle-s3c64xx.c
> >  create mode 100644 drivers/cpuidle/cpuidle-shmobile.c
> >  create mode 100644 drivers/cpuidle/cpuidle-tegra114.c
> >  create mode 100644 drivers/cpuidle/cpuidle-tegra20.c
> >  create mode 100644 drivers/cpuidle/cpuidle-tegra30.c
> >  create mode 100644 drivers/cpuidle/cpuidle-ux500.c


^ permalink raw reply	[flat|nested] 42+ messages in thread

* [PATCH 0/8] ARM: move cpuidle drivers to drivers/cpuidle/
@ 2013-06-26 12:22     ` Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 42+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2013-06-26 12:22 UTC (permalink / raw)
  To: linux-arm-kernel


Hi,

On Wednesday, June 26, 2013 12:59:53 PM Daniel Lezcano wrote:
> On 06/26/2013 12:15 PM, Bartlomiej Zolnierkiewicz wrote:
> > Hi,
> > 
> > This patchset moves ARM cpuidle drivers to drivers/cpuidle/ to make
> > code match new driver placement rules (per commit a8e39c3 "cpuidle: add
> > maintainer entry").
> 
> I second this initiative but as stated in a previous email, a bit of
> code cleanup, consolidation and encapsulation should be done before.
> 
> Again, from my POV, it is worth to do that but we have to split the pm
> code from the driver.

OK, I'll look into separating the pm code from the drivers.  However it
seems that patch #2 (for davinci) can be applied as it is.

> Please review some patches I sent recently to split this code and
> comment them. Otherwise, we will collide on this work.
> 
> All the patches sent [1] was to unify the code to make the drivers as
> unified as possible to converge to the same code pattern and to
> facilitate the factoring out.

I've looked at the patches ([1] and at91 ones) and they look fine to me.

I don't think that there is currently a risk of colliding on this work
(except at91 case) as your patches (except at91 ones) are already merged
in upstream or linux-next branch of linux-pm tree (which is included in
linux-next tree which I based my patches on). I'm subscribed to linux-pm
mailing list now but please cc: me on your future ARM cpuidle changes
(thanks!).

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

> Thanks
>   -- Daniel
> 
> [1]
> https://git.kernel.org/cgit/linux/kernel/git/rafael/linux-pm.git/log/?h=linux-next&qt=author&q=daniel.lezcano%40linaro.org
> 
> > [ Please note that movement of Samsung EXYNOS cpuidle driver is handled
> >   in separate patchset since it needs some other changes applied first. ]
> > 
> > Patches are based on linux-next (next-20130624) and are compile tested
> > only.  If agreed they all should probably go together through one tree
> > (linux-pm or arm-soc) since they all modify drivers/cpuidle/Makefile.
> > 
> > PS It seems that majority of cpuidle drivers is not used by default
> > (CONFIG_CPU_IDLE is not turned on in corresponding defconfigs). The only
> > exceptions are shmobile (kota2_defconfig) and tegra (tegra_defconfig).
> > This is probably also something that needs updating.
> > 
> > Best regards,
> > --
> > Bartlomiej Zolnierkiewicz
> > Samsung R&D Institute Poland
> > Samsung Electronics
> > 
> > 
> > Bartlomiej Zolnierkiewicz (8):
> >   ARM: at91: move cpuidle driver to drivers/cpuidle/
> >   ARM: davinci: move cpuidle driver to drivers/cpuidle/
> >   ARM: imx: move cpuidle drivers to drivers/cpuidle/
> >   ARM: OMAP: move cpuidle drivers to drivers/cpuidle/
> >   ARM: S3C64XX: move cpuidle driver to drivers/cpuidle/
> >   ARM: shmobile: move cpuidle driver to drivers/cpuidle/
> >   ARM: tegra: move cpuidle drivers to drivers/cpuidle/
> >   ARM: ux500: move cpuidle drivers to drivers/cpuidle/
> > 
> >  arch/arm/mach-at91/Makefile            |   1 -
> >  arch/arm/mach-at91/cpuidle.c           |  68 -------
> >  arch/arm/mach-davinci/Makefile         |   1 -
> >  arch/arm/mach-davinci/cpuidle.c        | 105 ----------
> >  arch/arm/mach-imx/Makefile             |   5 -
> >  arch/arm/mach-imx/cpuidle-imx5.c       |  37 ----
> >  arch/arm/mach-imx/cpuidle-imx6q.c      |  75 -------
> >  arch/arm/mach-omap2/Makefile           |   5 -
> >  arch/arm/mach-omap2/cpuidle34xx.c      | 344 ---------------------------------
> >  arch/arm/mach-omap2/cpuidle44xx.c      | 217 ---------------------
> >  arch/arm/mach-s3c64xx/Makefile         |   1 -
> >  arch/arm/mach-s3c64xx/cpuidle.c        |  63 ------
> >  arch/arm/mach-shmobile/Makefile        |   1 -
> >  arch/arm/mach-shmobile/cpuidle.c       |  37 ----
> >  arch/arm/mach-tegra/Makefile           |   9 -
> >  arch/arm/mach-tegra/cpuidle-tegra114.c |  35 ----
> >  arch/arm/mach-tegra/cpuidle-tegra20.c  | 217 ---------------------
> >  arch/arm/mach-tegra/cpuidle-tegra30.c  | 149 --------------
> >  arch/arm/mach-ux500/Makefile           |   1 -
> >  arch/arm/mach-ux500/cpuidle.c          | 128 ------------
> >  drivers/cpuidle/Makefile               |  42 ++++
> >  drivers/cpuidle/cpuidle-at91.c         |  68 +++++++
> >  drivers/cpuidle/cpuidle-davinci.c      | 104 ++++++++++
> >  drivers/cpuidle/cpuidle-imx5.c         |  37 ++++
> >  drivers/cpuidle/cpuidle-imx6q.c        |  74 +++++++
> >  drivers/cpuidle/cpuidle-omap34xx.c     | 342 ++++++++++++++++++++++++++++++++
> >  drivers/cpuidle/cpuidle-omap44xx.c     | 216 +++++++++++++++++++++
> >  drivers/cpuidle/cpuidle-s3c64xx.c      |  62 ++++++
> >  drivers/cpuidle/cpuidle-shmobile.c     |  37 ++++
> >  drivers/cpuidle/cpuidle-tegra114.c     |  35 ++++
> >  drivers/cpuidle/cpuidle-tegra20.c      | 217 +++++++++++++++++++++
> >  drivers/cpuidle/cpuidle-tegra30.c      | 149 ++++++++++++++
> >  drivers/cpuidle/cpuidle-ux500.c        | 128 ++++++++++++
> >  33 files changed, 1511 insertions(+), 1499 deletions(-)
> >  delete mode 100644 arch/arm/mach-at91/cpuidle.c
> >  delete mode 100644 arch/arm/mach-davinci/cpuidle.c
> >  delete mode 100644 arch/arm/mach-imx/cpuidle-imx5.c
> >  delete mode 100644 arch/arm/mach-imx/cpuidle-imx6q.c
> >  delete mode 100644 arch/arm/mach-omap2/cpuidle34xx.c
> >  delete mode 100644 arch/arm/mach-omap2/cpuidle44xx.c
> >  delete mode 100644 arch/arm/mach-s3c64xx/cpuidle.c
> >  delete mode 100644 arch/arm/mach-shmobile/cpuidle.c
> >  delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra114.c
> >  delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra20.c
> >  delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra30.c
> >  delete mode 100644 arch/arm/mach-ux500/cpuidle.c
> >  create mode 100644 drivers/cpuidle/cpuidle-at91.c
> >  create mode 100644 drivers/cpuidle/cpuidle-davinci.c
> >  create mode 100644 drivers/cpuidle/cpuidle-imx5.c
> >  create mode 100644 drivers/cpuidle/cpuidle-imx6q.c
> >  create mode 100644 drivers/cpuidle/cpuidle-omap34xx.c
> >  create mode 100644 drivers/cpuidle/cpuidle-omap44xx.c
> >  create mode 100644 drivers/cpuidle/cpuidle-s3c64xx.c
> >  create mode 100644 drivers/cpuidle/cpuidle-shmobile.c
> >  create mode 100644 drivers/cpuidle/cpuidle-tegra114.c
> >  create mode 100644 drivers/cpuidle/cpuidle-tegra20.c
> >  create mode 100644 drivers/cpuidle/cpuidle-tegra30.c
> >  create mode 100644 drivers/cpuidle/cpuidle-ux500.c

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH 0/8] ARM: move cpuidle drivers to drivers/cpuidle/
  2013-06-26 12:22     ` Bartlomiej Zolnierkiewicz
@ 2013-06-26 13:05       ` Daniel Lezcano
  -1 siblings, 0 replies; 42+ messages in thread
From: Daniel Lezcano @ 2013-06-26 13:05 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz
  Cc: linux-arm-kernel, linux-pm, linux, nicolas.ferre, plagnioj,
	nsekhar, khilman, kernel, shawn.guo, tony, ben-linux, kgene.kim,
	horms, magnus.damm, swarren, srinidhi.kasagar, linus.walleij,
	rjw, kyungmin.park

On 06/26/2013 02:22 PM, Bartlomiej Zolnierkiewicz wrote:
> 
> Hi,
> 
> On Wednesday, June 26, 2013 12:59:53 PM Daniel Lezcano wrote:
>> On 06/26/2013 12:15 PM, Bartlomiej Zolnierkiewicz wrote:
>>> Hi,
>>>
>>> This patchset moves ARM cpuidle drivers to drivers/cpuidle/ to make
>>> code match new driver placement rules (per commit a8e39c3 "cpuidle: add
>>> maintainer entry").
>>
>> I second this initiative but as stated in a previous email, a bit of
>> code cleanup, consolidation and encapsulation should be done before.
>>
>> Again, from my POV, it is worth to do that but we have to split the pm
>> code from the driver.
> 
> OK, I'll look into separating the pm code from the drivers.  However it
> seems that patch #2 (for davinci) can be applied as it is.

No it can't. It still has #include <mach/...>

Please have a look at the thread:

http://comments.gmane.org/gmane.linux.ports.arm.kernel/146651

>> Please review some patches I sent recently to split this code and
>> comment them. Otherwise, we will collide on this work.
>>
>> All the patches sent [1] was to unify the code to make the drivers as
>> unified as possible to converge to the same code pattern and to
>> facilitate the factoring out.
> 
> I've looked at the patches ([1] and at91 ones) and they look fine to me.
> I don't think that there is currently a risk of colliding on this work
> (except at91 case) as your patches (except at91 ones) are already merged
> in upstream or linux-next branch of linux-pm tree (which is included in
> linux-next tree which I based my patches on). I'm subscribed to linux-pm
> mailing list now but please cc: me on your future ARM cpuidle changes
> (thanks!).

We are working on cleaning up the different drivers to have a *common
code pattern* in order to factor it out, split the code into pm code and
driver code, move the drivers to the drivers/cpuidle directory and
finally create a single arm driver [1][2][3].

You are sending patches to move the drivers directly to the
drivers/cpuidle directory. I did that 1,5 years ago and I was told it is
not the way to go [4].

As you can see this is a WIP.

So I am insisting: that would be better if you sync up with us and check
what is the WIP and, if you are willing to, give us a hand instead of
doing your way.

May I suggest you fix up the exynos cpuidle driver first ? :)

Thanks
  -- Daniel

[1]
https://blueprints.launchpad.net/linaro-power-kernel/+spec/cpuidle-consolidate-arm-drivers

[2]
http://summit.linuxplumbersconf.org/lpc-2012/meeting/31/lpc2012-ref-cpu-idle-cluster-management/

[3] https://e.lca-13.zerista.com/event/member/72362

[4] http://comments.gmane.org/gmane.linux.ports.arm.kernel/146651


> Best regards,
> --
> Bartlomiej Zolnierkiewicz
> Samsung R&D Institute Poland
> Samsung Electronics
> 
>> Thanks
>>   -- Daniel
>>
>> [1]
>> https://git.kernel.org/cgit/linux/kernel/git/rafael/linux-pm.git/log/?h=linux-next&qt=author&q=daniel.lezcano%40linaro.org
>>
>>> [ Please note that movement of Samsung EXYNOS cpuidle driver is handled
>>>   in separate patchset since it needs some other changes applied first. ]
>>>
>>> Patches are based on linux-next (next-20130624) and are compile tested
>>> only.  If agreed they all should probably go together through one tree
>>> (linux-pm or arm-soc) since they all modify drivers/cpuidle/Makefile.
>>>
>>> PS It seems that majority of cpuidle drivers is not used by default
>>> (CONFIG_CPU_IDLE is not turned on in corresponding defconfigs). The only
>>> exceptions are shmobile (kota2_defconfig) and tegra (tegra_defconfig).
>>> This is probably also something that needs updating.
>>>
>>> Best regards,
>>> --
>>> Bartlomiej Zolnierkiewicz
>>> Samsung R&D Institute Poland
>>> Samsung Electronics
>>>
>>>
>>> Bartlomiej Zolnierkiewicz (8):
>>>   ARM: at91: move cpuidle driver to drivers/cpuidle/
>>>   ARM: davinci: move cpuidle driver to drivers/cpuidle/
>>>   ARM: imx: move cpuidle drivers to drivers/cpuidle/
>>>   ARM: OMAP: move cpuidle drivers to drivers/cpuidle/
>>>   ARM: S3C64XX: move cpuidle driver to drivers/cpuidle/
>>>   ARM: shmobile: move cpuidle driver to drivers/cpuidle/
>>>   ARM: tegra: move cpuidle drivers to drivers/cpuidle/
>>>   ARM: ux500: move cpuidle drivers to drivers/cpuidle/
>>>
>>>  arch/arm/mach-at91/Makefile            |   1 -
>>>  arch/arm/mach-at91/cpuidle.c           |  68 -------
>>>  arch/arm/mach-davinci/Makefile         |   1 -
>>>  arch/arm/mach-davinci/cpuidle.c        | 105 ----------
>>>  arch/arm/mach-imx/Makefile             |   5 -
>>>  arch/arm/mach-imx/cpuidle-imx5.c       |  37 ----
>>>  arch/arm/mach-imx/cpuidle-imx6q.c      |  75 -------
>>>  arch/arm/mach-omap2/Makefile           |   5 -
>>>  arch/arm/mach-omap2/cpuidle34xx.c      | 344 ---------------------------------
>>>  arch/arm/mach-omap2/cpuidle44xx.c      | 217 ---------------------
>>>  arch/arm/mach-s3c64xx/Makefile         |   1 -
>>>  arch/arm/mach-s3c64xx/cpuidle.c        |  63 ------
>>>  arch/arm/mach-shmobile/Makefile        |   1 -
>>>  arch/arm/mach-shmobile/cpuidle.c       |  37 ----
>>>  arch/arm/mach-tegra/Makefile           |   9 -
>>>  arch/arm/mach-tegra/cpuidle-tegra114.c |  35 ----
>>>  arch/arm/mach-tegra/cpuidle-tegra20.c  | 217 ---------------------
>>>  arch/arm/mach-tegra/cpuidle-tegra30.c  | 149 --------------
>>>  arch/arm/mach-ux500/Makefile           |   1 -
>>>  arch/arm/mach-ux500/cpuidle.c          | 128 ------------
>>>  drivers/cpuidle/Makefile               |  42 ++++
>>>  drivers/cpuidle/cpuidle-at91.c         |  68 +++++++
>>>  drivers/cpuidle/cpuidle-davinci.c      | 104 ++++++++++
>>>  drivers/cpuidle/cpuidle-imx5.c         |  37 ++++
>>>  drivers/cpuidle/cpuidle-imx6q.c        |  74 +++++++
>>>  drivers/cpuidle/cpuidle-omap34xx.c     | 342 ++++++++++++++++++++++++++++++++
>>>  drivers/cpuidle/cpuidle-omap44xx.c     | 216 +++++++++++++++++++++
>>>  drivers/cpuidle/cpuidle-s3c64xx.c      |  62 ++++++
>>>  drivers/cpuidle/cpuidle-shmobile.c     |  37 ++++
>>>  drivers/cpuidle/cpuidle-tegra114.c     |  35 ++++
>>>  drivers/cpuidle/cpuidle-tegra20.c      | 217 +++++++++++++++++++++
>>>  drivers/cpuidle/cpuidle-tegra30.c      | 149 ++++++++++++++
>>>  drivers/cpuidle/cpuidle-ux500.c        | 128 ++++++++++++
>>>  33 files changed, 1511 insertions(+), 1499 deletions(-)
>>>  delete mode 100644 arch/arm/mach-at91/cpuidle.c
>>>  delete mode 100644 arch/arm/mach-davinci/cpuidle.c
>>>  delete mode 100644 arch/arm/mach-imx/cpuidle-imx5.c
>>>  delete mode 100644 arch/arm/mach-imx/cpuidle-imx6q.c
>>>  delete mode 100644 arch/arm/mach-omap2/cpuidle34xx.c
>>>  delete mode 100644 arch/arm/mach-omap2/cpuidle44xx.c
>>>  delete mode 100644 arch/arm/mach-s3c64xx/cpuidle.c
>>>  delete mode 100644 arch/arm/mach-shmobile/cpuidle.c
>>>  delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra114.c
>>>  delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra20.c
>>>  delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra30.c
>>>  delete mode 100644 arch/arm/mach-ux500/cpuidle.c
>>>  create mode 100644 drivers/cpuidle/cpuidle-at91.c
>>>  create mode 100644 drivers/cpuidle/cpuidle-davinci.c
>>>  create mode 100644 drivers/cpuidle/cpuidle-imx5.c
>>>  create mode 100644 drivers/cpuidle/cpuidle-imx6q.c
>>>  create mode 100644 drivers/cpuidle/cpuidle-omap34xx.c
>>>  create mode 100644 drivers/cpuidle/cpuidle-omap44xx.c
>>>  create mode 100644 drivers/cpuidle/cpuidle-s3c64xx.c
>>>  create mode 100644 drivers/cpuidle/cpuidle-shmobile.c
>>>  create mode 100644 drivers/cpuidle/cpuidle-tegra114.c
>>>  create mode 100644 drivers/cpuidle/cpuidle-tegra20.c
>>>  create mode 100644 drivers/cpuidle/cpuidle-tegra30.c
>>>  create mode 100644 drivers/cpuidle/cpuidle-ux500.c
> 


-- 
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


^ permalink raw reply	[flat|nested] 42+ messages in thread

* [PATCH 0/8] ARM: move cpuidle drivers to drivers/cpuidle/
@ 2013-06-26 13:05       ` Daniel Lezcano
  0 siblings, 0 replies; 42+ messages in thread
From: Daniel Lezcano @ 2013-06-26 13:05 UTC (permalink / raw)
  To: linux-arm-kernel

On 06/26/2013 02:22 PM, Bartlomiej Zolnierkiewicz wrote:
> 
> Hi,
> 
> On Wednesday, June 26, 2013 12:59:53 PM Daniel Lezcano wrote:
>> On 06/26/2013 12:15 PM, Bartlomiej Zolnierkiewicz wrote:
>>> Hi,
>>>
>>> This patchset moves ARM cpuidle drivers to drivers/cpuidle/ to make
>>> code match new driver placement rules (per commit a8e39c3 "cpuidle: add
>>> maintainer entry").
>>
>> I second this initiative but as stated in a previous email, a bit of
>> code cleanup, consolidation and encapsulation should be done before.
>>
>> Again, from my POV, it is worth to do that but we have to split the pm
>> code from the driver.
> 
> OK, I'll look into separating the pm code from the drivers.  However it
> seems that patch #2 (for davinci) can be applied as it is.

No it can't. It still has #include <mach/...>

Please have a look at the thread:

http://comments.gmane.org/gmane.linux.ports.arm.kernel/146651

>> Please review some patches I sent recently to split this code and
>> comment them. Otherwise, we will collide on this work.
>>
>> All the patches sent [1] was to unify the code to make the drivers as
>> unified as possible to converge to the same code pattern and to
>> facilitate the factoring out.
> 
> I've looked at the patches ([1] and at91 ones) and they look fine to me.
> I don't think that there is currently a risk of colliding on this work
> (except at91 case) as your patches (except at91 ones) are already merged
> in upstream or linux-next branch of linux-pm tree (which is included in
> linux-next tree which I based my patches on). I'm subscribed to linux-pm
> mailing list now but please cc: me on your future ARM cpuidle changes
> (thanks!).

We are working on cleaning up the different drivers to have a *common
code pattern* in order to factor it out, split the code into pm code and
driver code, move the drivers to the drivers/cpuidle directory and
finally create a single arm driver [1][2][3].

You are sending patches to move the drivers directly to the
drivers/cpuidle directory. I did that 1,5 years ago and I was told it is
not the way to go [4].

As you can see this is a WIP.

So I am insisting: that would be better if you sync up with us and check
what is the WIP and, if you are willing to, give us a hand instead of
doing your way.

May I suggest you fix up the exynos cpuidle driver first ? :)

Thanks
  -- Daniel

[1]
https://blueprints.launchpad.net/linaro-power-kernel/+spec/cpuidle-consolidate-arm-drivers

[2]
http://summit.linuxplumbersconf.org/lpc-2012/meeting/31/lpc2012-ref-cpu-idle-cluster-management/

[3] https://e.lca-13.zerista.com/event/member/72362

[4] http://comments.gmane.org/gmane.linux.ports.arm.kernel/146651


> Best regards,
> --
> Bartlomiej Zolnierkiewicz
> Samsung R&D Institute Poland
> Samsung Electronics
> 
>> Thanks
>>   -- Daniel
>>
>> [1]
>> https://git.kernel.org/cgit/linux/kernel/git/rafael/linux-pm.git/log/?h=linux-next&qt=author&q=daniel.lezcano%40linaro.org
>>
>>> [ Please note that movement of Samsung EXYNOS cpuidle driver is handled
>>>   in separate patchset since it needs some other changes applied first. ]
>>>
>>> Patches are based on linux-next (next-20130624) and are compile tested
>>> only.  If agreed they all should probably go together through one tree
>>> (linux-pm or arm-soc) since they all modify drivers/cpuidle/Makefile.
>>>
>>> PS It seems that majority of cpuidle drivers is not used by default
>>> (CONFIG_CPU_IDLE is not turned on in corresponding defconfigs). The only
>>> exceptions are shmobile (kota2_defconfig) and tegra (tegra_defconfig).
>>> This is probably also something that needs updating.
>>>
>>> Best regards,
>>> --
>>> Bartlomiej Zolnierkiewicz
>>> Samsung R&D Institute Poland
>>> Samsung Electronics
>>>
>>>
>>> Bartlomiej Zolnierkiewicz (8):
>>>   ARM: at91: move cpuidle driver to drivers/cpuidle/
>>>   ARM: davinci: move cpuidle driver to drivers/cpuidle/
>>>   ARM: imx: move cpuidle drivers to drivers/cpuidle/
>>>   ARM: OMAP: move cpuidle drivers to drivers/cpuidle/
>>>   ARM: S3C64XX: move cpuidle driver to drivers/cpuidle/
>>>   ARM: shmobile: move cpuidle driver to drivers/cpuidle/
>>>   ARM: tegra: move cpuidle drivers to drivers/cpuidle/
>>>   ARM: ux500: move cpuidle drivers to drivers/cpuidle/
>>>
>>>  arch/arm/mach-at91/Makefile            |   1 -
>>>  arch/arm/mach-at91/cpuidle.c           |  68 -------
>>>  arch/arm/mach-davinci/Makefile         |   1 -
>>>  arch/arm/mach-davinci/cpuidle.c        | 105 ----------
>>>  arch/arm/mach-imx/Makefile             |   5 -
>>>  arch/arm/mach-imx/cpuidle-imx5.c       |  37 ----
>>>  arch/arm/mach-imx/cpuidle-imx6q.c      |  75 -------
>>>  arch/arm/mach-omap2/Makefile           |   5 -
>>>  arch/arm/mach-omap2/cpuidle34xx.c      | 344 ---------------------------------
>>>  arch/arm/mach-omap2/cpuidle44xx.c      | 217 ---------------------
>>>  arch/arm/mach-s3c64xx/Makefile         |   1 -
>>>  arch/arm/mach-s3c64xx/cpuidle.c        |  63 ------
>>>  arch/arm/mach-shmobile/Makefile        |   1 -
>>>  arch/arm/mach-shmobile/cpuidle.c       |  37 ----
>>>  arch/arm/mach-tegra/Makefile           |   9 -
>>>  arch/arm/mach-tegra/cpuidle-tegra114.c |  35 ----
>>>  arch/arm/mach-tegra/cpuidle-tegra20.c  | 217 ---------------------
>>>  arch/arm/mach-tegra/cpuidle-tegra30.c  | 149 --------------
>>>  arch/arm/mach-ux500/Makefile           |   1 -
>>>  arch/arm/mach-ux500/cpuidle.c          | 128 ------------
>>>  drivers/cpuidle/Makefile               |  42 ++++
>>>  drivers/cpuidle/cpuidle-at91.c         |  68 +++++++
>>>  drivers/cpuidle/cpuidle-davinci.c      | 104 ++++++++++
>>>  drivers/cpuidle/cpuidle-imx5.c         |  37 ++++
>>>  drivers/cpuidle/cpuidle-imx6q.c        |  74 +++++++
>>>  drivers/cpuidle/cpuidle-omap34xx.c     | 342 ++++++++++++++++++++++++++++++++
>>>  drivers/cpuidle/cpuidle-omap44xx.c     | 216 +++++++++++++++++++++
>>>  drivers/cpuidle/cpuidle-s3c64xx.c      |  62 ++++++
>>>  drivers/cpuidle/cpuidle-shmobile.c     |  37 ++++
>>>  drivers/cpuidle/cpuidle-tegra114.c     |  35 ++++
>>>  drivers/cpuidle/cpuidle-tegra20.c      | 217 +++++++++++++++++++++
>>>  drivers/cpuidle/cpuidle-tegra30.c      | 149 ++++++++++++++
>>>  drivers/cpuidle/cpuidle-ux500.c        | 128 ++++++++++++
>>>  33 files changed, 1511 insertions(+), 1499 deletions(-)
>>>  delete mode 100644 arch/arm/mach-at91/cpuidle.c
>>>  delete mode 100644 arch/arm/mach-davinci/cpuidle.c
>>>  delete mode 100644 arch/arm/mach-imx/cpuidle-imx5.c
>>>  delete mode 100644 arch/arm/mach-imx/cpuidle-imx6q.c
>>>  delete mode 100644 arch/arm/mach-omap2/cpuidle34xx.c
>>>  delete mode 100644 arch/arm/mach-omap2/cpuidle44xx.c
>>>  delete mode 100644 arch/arm/mach-s3c64xx/cpuidle.c
>>>  delete mode 100644 arch/arm/mach-shmobile/cpuidle.c
>>>  delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra114.c
>>>  delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra20.c
>>>  delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra30.c
>>>  delete mode 100644 arch/arm/mach-ux500/cpuidle.c
>>>  create mode 100644 drivers/cpuidle/cpuidle-at91.c
>>>  create mode 100644 drivers/cpuidle/cpuidle-davinci.c
>>>  create mode 100644 drivers/cpuidle/cpuidle-imx5.c
>>>  create mode 100644 drivers/cpuidle/cpuidle-imx6q.c
>>>  create mode 100644 drivers/cpuidle/cpuidle-omap34xx.c
>>>  create mode 100644 drivers/cpuidle/cpuidle-omap44xx.c
>>>  create mode 100644 drivers/cpuidle/cpuidle-s3c64xx.c
>>>  create mode 100644 drivers/cpuidle/cpuidle-shmobile.c
>>>  create mode 100644 drivers/cpuidle/cpuidle-tegra114.c
>>>  create mode 100644 drivers/cpuidle/cpuidle-tegra20.c
>>>  create mode 100644 drivers/cpuidle/cpuidle-tegra30.c
>>>  create mode 100644 drivers/cpuidle/cpuidle-ux500.c
> 


-- 
 <http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH 0/8] ARM: move cpuidle drivers to drivers/cpuidle/
  2013-06-26 13:05       ` Daniel Lezcano
@ 2013-06-26 14:40         ` Bartlomiej Zolnierkiewicz
  -1 siblings, 0 replies; 42+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2013-06-26 14:40 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: linux-arm-kernel, linux-pm, linux, nicolas.ferre, plagnioj,
	nsekhar, khilman, kernel, shawn.guo, tony, ben-linux, kgene.kim,
	horms, magnus.damm, swarren, srinidhi.kasagar, linus.walleij,
	rjw, kyungmin.park

On Wednesday, June 26, 2013 03:05:23 PM Daniel Lezcano wrote:
> On 06/26/2013 02:22 PM, Bartlomiej Zolnierkiewicz wrote:
> > 
> > Hi,
> > 
> > On Wednesday, June 26, 2013 12:59:53 PM Daniel Lezcano wrote:
> >> On 06/26/2013 12:15 PM, Bartlomiej Zolnierkiewicz wrote:
> >>> Hi,
> >>>
> >>> This patchset moves ARM cpuidle drivers to drivers/cpuidle/ to make
> >>> code match new driver placement rules (per commit a8e39c3 "cpuidle: add
> >>> maintainer entry").
> >>
> >> I second this initiative but as stated in a previous email, a bit of
> >> code cleanup, consolidation and encapsulation should be done before.
> >>
> >> Again, from my POV, it is worth to do that but we have to split the pm
> >> code from the driver.
> > 
> > OK, I'll look into separating the pm code from the drivers.  However it
> > seems that patch #2 (for davinci) can be applied as it is.
> 
> No it can't. It still has #include <mach/...>
> 
> Please have a look at the thread:
> 
> http://comments.gmane.org/gmane.linux.ports.arm.kernel/146651

OK, I see.

On davinci:

* <mach/cpuidle.h> contains only struct davinci_cpuidle_config
  declaration (pointer to this structure instance is passed as
  platform data to davinci cpuidle driver) so it seems that
  moving it to <linux/platform_data/cpuidle-davinci.h> would be
  sufficient?

* <mach/ddr2.h> contains only few definitions used by davinci
  cpuidle driver and arch/arm/mach-davinci/sleep.S so wouldn't
  it be OK to just move the header to <linux/davinci_ddr2.h>?

If agreed I'll prepare appropriate patches later.

> >> Please review some patches I sent recently to split this code and
> >> comment them. Otherwise, we will collide on this work.
> >>
> >> All the patches sent [1] was to unify the code to make the drivers as
> >> unified as possible to converge to the same code pattern and to
> >> facilitate the factoring out.
> > 
> > I've looked at the patches ([1] and at91 ones) and they look fine to me.
> > I don't think that there is currently a risk of colliding on this work
> > (except at91 case) as your patches (except at91 ones) are already merged
> > in upstream or linux-next branch of linux-pm tree (which is included in
> > linux-next tree which I based my patches on). I'm subscribed to linux-pm
> > mailing list now but please cc: me on your future ARM cpuidle changes
> > (thanks!).
> 
> We are working on cleaning up the different drivers to have a *common
> code pattern* in order to factor it out, split the code into pm code and
> driver code, move the drivers to the drivers/cpuidle directory and
> finally create a single arm driver [1][2][3].

Interesting, I wasn't aware of the single arm driver goal..

> You are sending patches to move the drivers directly to the
> drivers/cpuidle directory. I did that 1,5 years ago and I was told it is
> not the way to go [4].
> 
> As you can see this is a WIP.
> 
> So I am insisting: that would be better if you sync up with us and check
> what is the WIP and, if you are willing to, give us a hand instead of
> doing your way.

OK.

> May I suggest you fix up the exynos cpuidle driver first ? :)

Sure.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

> Thanks
>   -- Daniel
> 
> [1]
> https://blueprints.launchpad.net/linaro-power-kernel/+spec/cpuidle-consolidate-arm-drivers
> 
> [2]
> http://summit.linuxplumbersconf.org/lpc-2012/meeting/31/lpc2012-ref-cpu-idle-cluster-management/
> 
> [3] https://e.lca-13.zerista.com/event/member/72362
> 
> [4] http://comments.gmane.org/gmane.linux.ports.arm.kernel/146651
> 
> 
> > Best regards,
> > --
> > Bartlomiej Zolnierkiewicz
> > Samsung R&D Institute Poland
> > Samsung Electronics
> > 
> >> Thanks
> >>   -- Daniel
> >>
> >> [1]
> >> https://git.kernel.org/cgit/linux/kernel/git/rafael/linux-pm.git/log/?h=linux-next&qt=author&q=daniel.lezcano%40linaro.org
> >>
> >>> [ Please note that movement of Samsung EXYNOS cpuidle driver is handled
> >>>   in separate patchset since it needs some other changes applied first. ]
> >>>
> >>> Patches are based on linux-next (next-20130624) and are compile tested
> >>> only.  If agreed they all should probably go together through one tree
> >>> (linux-pm or arm-soc) since they all modify drivers/cpuidle/Makefile.
> >>>
> >>> PS It seems that majority of cpuidle drivers is not used by default
> >>> (CONFIG_CPU_IDLE is not turned on in corresponding defconfigs). The only
> >>> exceptions are shmobile (kota2_defconfig) and tegra (tegra_defconfig).
> >>> This is probably also something that needs updating.
> >>>
> >>> Best regards,
> >>> --
> >>> Bartlomiej Zolnierkiewicz
> >>> Samsung R&D Institute Poland
> >>> Samsung Electronics
> >>>
> >>>
> >>> Bartlomiej Zolnierkiewicz (8):
> >>>   ARM: at91: move cpuidle driver to drivers/cpuidle/
> >>>   ARM: davinci: move cpuidle driver to drivers/cpuidle/
> >>>   ARM: imx: move cpuidle drivers to drivers/cpuidle/
> >>>   ARM: OMAP: move cpuidle drivers to drivers/cpuidle/
> >>>   ARM: S3C64XX: move cpuidle driver to drivers/cpuidle/
> >>>   ARM: shmobile: move cpuidle driver to drivers/cpuidle/
> >>>   ARM: tegra: move cpuidle drivers to drivers/cpuidle/
> >>>   ARM: ux500: move cpuidle drivers to drivers/cpuidle/
> >>>
> >>>  arch/arm/mach-at91/Makefile            |   1 -
> >>>  arch/arm/mach-at91/cpuidle.c           |  68 -------
> >>>  arch/arm/mach-davinci/Makefile         |   1 -
> >>>  arch/arm/mach-davinci/cpuidle.c        | 105 ----------
> >>>  arch/arm/mach-imx/Makefile             |   5 -
> >>>  arch/arm/mach-imx/cpuidle-imx5.c       |  37 ----
> >>>  arch/arm/mach-imx/cpuidle-imx6q.c      |  75 -------
> >>>  arch/arm/mach-omap2/Makefile           |   5 -
> >>>  arch/arm/mach-omap2/cpuidle34xx.c      | 344 ---------------------------------
> >>>  arch/arm/mach-omap2/cpuidle44xx.c      | 217 ---------------------
> >>>  arch/arm/mach-s3c64xx/Makefile         |   1 -
> >>>  arch/arm/mach-s3c64xx/cpuidle.c        |  63 ------
> >>>  arch/arm/mach-shmobile/Makefile        |   1 -
> >>>  arch/arm/mach-shmobile/cpuidle.c       |  37 ----
> >>>  arch/arm/mach-tegra/Makefile           |   9 -
> >>>  arch/arm/mach-tegra/cpuidle-tegra114.c |  35 ----
> >>>  arch/arm/mach-tegra/cpuidle-tegra20.c  | 217 ---------------------
> >>>  arch/arm/mach-tegra/cpuidle-tegra30.c  | 149 --------------
> >>>  arch/arm/mach-ux500/Makefile           |   1 -
> >>>  arch/arm/mach-ux500/cpuidle.c          | 128 ------------
> >>>  drivers/cpuidle/Makefile               |  42 ++++
> >>>  drivers/cpuidle/cpuidle-at91.c         |  68 +++++++
> >>>  drivers/cpuidle/cpuidle-davinci.c      | 104 ++++++++++
> >>>  drivers/cpuidle/cpuidle-imx5.c         |  37 ++++
> >>>  drivers/cpuidle/cpuidle-imx6q.c        |  74 +++++++
> >>>  drivers/cpuidle/cpuidle-omap34xx.c     | 342 ++++++++++++++++++++++++++++++++
> >>>  drivers/cpuidle/cpuidle-omap44xx.c     | 216 +++++++++++++++++++++
> >>>  drivers/cpuidle/cpuidle-s3c64xx.c      |  62 ++++++
> >>>  drivers/cpuidle/cpuidle-shmobile.c     |  37 ++++
> >>>  drivers/cpuidle/cpuidle-tegra114.c     |  35 ++++
> >>>  drivers/cpuidle/cpuidle-tegra20.c      | 217 +++++++++++++++++++++
> >>>  drivers/cpuidle/cpuidle-tegra30.c      | 149 ++++++++++++++
> >>>  drivers/cpuidle/cpuidle-ux500.c        | 128 ++++++++++++
> >>>  33 files changed, 1511 insertions(+), 1499 deletions(-)
> >>>  delete mode 100644 arch/arm/mach-at91/cpuidle.c
> >>>  delete mode 100644 arch/arm/mach-davinci/cpuidle.c
> >>>  delete mode 100644 arch/arm/mach-imx/cpuidle-imx5.c
> >>>  delete mode 100644 arch/arm/mach-imx/cpuidle-imx6q.c
> >>>  delete mode 100644 arch/arm/mach-omap2/cpuidle34xx.c
> >>>  delete mode 100644 arch/arm/mach-omap2/cpuidle44xx.c
> >>>  delete mode 100644 arch/arm/mach-s3c64xx/cpuidle.c
> >>>  delete mode 100644 arch/arm/mach-shmobile/cpuidle.c
> >>>  delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra114.c
> >>>  delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra20.c
> >>>  delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra30.c
> >>>  delete mode 100644 arch/arm/mach-ux500/cpuidle.c
> >>>  create mode 100644 drivers/cpuidle/cpuidle-at91.c
> >>>  create mode 100644 drivers/cpuidle/cpuidle-davinci.c
> >>>  create mode 100644 drivers/cpuidle/cpuidle-imx5.c
> >>>  create mode 100644 drivers/cpuidle/cpuidle-imx6q.c
> >>>  create mode 100644 drivers/cpuidle/cpuidle-omap34xx.c
> >>>  create mode 100644 drivers/cpuidle/cpuidle-omap44xx.c
> >>>  create mode 100644 drivers/cpuidle/cpuidle-s3c64xx.c
> >>>  create mode 100644 drivers/cpuidle/cpuidle-shmobile.c
> >>>  create mode 100644 drivers/cpuidle/cpuidle-tegra114.c
> >>>  create mode 100644 drivers/cpuidle/cpuidle-tegra20.c
> >>>  create mode 100644 drivers/cpuidle/cpuidle-tegra30.c
> >>>  create mode 100644 drivers/cpuidle/cpuidle-ux500.c


^ permalink raw reply	[flat|nested] 42+ messages in thread

* [PATCH 0/8] ARM: move cpuidle drivers to drivers/cpuidle/
@ 2013-06-26 14:40         ` Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 42+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2013-06-26 14:40 UTC (permalink / raw)
  To: linux-arm-kernel

On Wednesday, June 26, 2013 03:05:23 PM Daniel Lezcano wrote:
> On 06/26/2013 02:22 PM, Bartlomiej Zolnierkiewicz wrote:
> > 
> > Hi,
> > 
> > On Wednesday, June 26, 2013 12:59:53 PM Daniel Lezcano wrote:
> >> On 06/26/2013 12:15 PM, Bartlomiej Zolnierkiewicz wrote:
> >>> Hi,
> >>>
> >>> This patchset moves ARM cpuidle drivers to drivers/cpuidle/ to make
> >>> code match new driver placement rules (per commit a8e39c3 "cpuidle: add
> >>> maintainer entry").
> >>
> >> I second this initiative but as stated in a previous email, a bit of
> >> code cleanup, consolidation and encapsulation should be done before.
> >>
> >> Again, from my POV, it is worth to do that but we have to split the pm
> >> code from the driver.
> > 
> > OK, I'll look into separating the pm code from the drivers.  However it
> > seems that patch #2 (for davinci) can be applied as it is.
> 
> No it can't. It still has #include <mach/...>
> 
> Please have a look at the thread:
> 
> http://comments.gmane.org/gmane.linux.ports.arm.kernel/146651

OK, I see.

On davinci:

* <mach/cpuidle.h> contains only struct davinci_cpuidle_config
  declaration (pointer to this structure instance is passed as
  platform data to davinci cpuidle driver) so it seems that
  moving it to <linux/platform_data/cpuidle-davinci.h> would be
  sufficient?

* <mach/ddr2.h> contains only few definitions used by davinci
  cpuidle driver and arch/arm/mach-davinci/sleep.S so wouldn't
  it be OK to just move the header to <linux/davinci_ddr2.h>?

If agreed I'll prepare appropriate patches later.

> >> Please review some patches I sent recently to split this code and
> >> comment them. Otherwise, we will collide on this work.
> >>
> >> All the patches sent [1] was to unify the code to make the drivers as
> >> unified as possible to converge to the same code pattern and to
> >> facilitate the factoring out.
> > 
> > I've looked at the patches ([1] and at91 ones) and they look fine to me.
> > I don't think that there is currently a risk of colliding on this work
> > (except at91 case) as your patches (except at91 ones) are already merged
> > in upstream or linux-next branch of linux-pm tree (which is included in
> > linux-next tree which I based my patches on). I'm subscribed to linux-pm
> > mailing list now but please cc: me on your future ARM cpuidle changes
> > (thanks!).
> 
> We are working on cleaning up the different drivers to have a *common
> code pattern* in order to factor it out, split the code into pm code and
> driver code, move the drivers to the drivers/cpuidle directory and
> finally create a single arm driver [1][2][3].

Interesting, I wasn't aware of the single arm driver goal..

> You are sending patches to move the drivers directly to the
> drivers/cpuidle directory. I did that 1,5 years ago and I was told it is
> not the way to go [4].
> 
> As you can see this is a WIP.
> 
> So I am insisting: that would be better if you sync up with us and check
> what is the WIP and, if you are willing to, give us a hand instead of
> doing your way.

OK.

> May I suggest you fix up the exynos cpuidle driver first ? :)

Sure.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

> Thanks
>   -- Daniel
> 
> [1]
> https://blueprints.launchpad.net/linaro-power-kernel/+spec/cpuidle-consolidate-arm-drivers
> 
> [2]
> http://summit.linuxplumbersconf.org/lpc-2012/meeting/31/lpc2012-ref-cpu-idle-cluster-management/
> 
> [3] https://e.lca-13.zerista.com/event/member/72362
> 
> [4] http://comments.gmane.org/gmane.linux.ports.arm.kernel/146651
> 
> 
> > Best regards,
> > --
> > Bartlomiej Zolnierkiewicz
> > Samsung R&D Institute Poland
> > Samsung Electronics
> > 
> >> Thanks
> >>   -- Daniel
> >>
> >> [1]
> >> https://git.kernel.org/cgit/linux/kernel/git/rafael/linux-pm.git/log/?h=linux-next&qt=author&q=daniel.lezcano%40linaro.org
> >>
> >>> [ Please note that movement of Samsung EXYNOS cpuidle driver is handled
> >>>   in separate patchset since it needs some other changes applied first. ]
> >>>
> >>> Patches are based on linux-next (next-20130624) and are compile tested
> >>> only.  If agreed they all should probably go together through one tree
> >>> (linux-pm or arm-soc) since they all modify drivers/cpuidle/Makefile.
> >>>
> >>> PS It seems that majority of cpuidle drivers is not used by default
> >>> (CONFIG_CPU_IDLE is not turned on in corresponding defconfigs). The only
> >>> exceptions are shmobile (kota2_defconfig) and tegra (tegra_defconfig).
> >>> This is probably also something that needs updating.
> >>>
> >>> Best regards,
> >>> --
> >>> Bartlomiej Zolnierkiewicz
> >>> Samsung R&D Institute Poland
> >>> Samsung Electronics
> >>>
> >>>
> >>> Bartlomiej Zolnierkiewicz (8):
> >>>   ARM: at91: move cpuidle driver to drivers/cpuidle/
> >>>   ARM: davinci: move cpuidle driver to drivers/cpuidle/
> >>>   ARM: imx: move cpuidle drivers to drivers/cpuidle/
> >>>   ARM: OMAP: move cpuidle drivers to drivers/cpuidle/
> >>>   ARM: S3C64XX: move cpuidle driver to drivers/cpuidle/
> >>>   ARM: shmobile: move cpuidle driver to drivers/cpuidle/
> >>>   ARM: tegra: move cpuidle drivers to drivers/cpuidle/
> >>>   ARM: ux500: move cpuidle drivers to drivers/cpuidle/
> >>>
> >>>  arch/arm/mach-at91/Makefile            |   1 -
> >>>  arch/arm/mach-at91/cpuidle.c           |  68 -------
> >>>  arch/arm/mach-davinci/Makefile         |   1 -
> >>>  arch/arm/mach-davinci/cpuidle.c        | 105 ----------
> >>>  arch/arm/mach-imx/Makefile             |   5 -
> >>>  arch/arm/mach-imx/cpuidle-imx5.c       |  37 ----
> >>>  arch/arm/mach-imx/cpuidle-imx6q.c      |  75 -------
> >>>  arch/arm/mach-omap2/Makefile           |   5 -
> >>>  arch/arm/mach-omap2/cpuidle34xx.c      | 344 ---------------------------------
> >>>  arch/arm/mach-omap2/cpuidle44xx.c      | 217 ---------------------
> >>>  arch/arm/mach-s3c64xx/Makefile         |   1 -
> >>>  arch/arm/mach-s3c64xx/cpuidle.c        |  63 ------
> >>>  arch/arm/mach-shmobile/Makefile        |   1 -
> >>>  arch/arm/mach-shmobile/cpuidle.c       |  37 ----
> >>>  arch/arm/mach-tegra/Makefile           |   9 -
> >>>  arch/arm/mach-tegra/cpuidle-tegra114.c |  35 ----
> >>>  arch/arm/mach-tegra/cpuidle-tegra20.c  | 217 ---------------------
> >>>  arch/arm/mach-tegra/cpuidle-tegra30.c  | 149 --------------
> >>>  arch/arm/mach-ux500/Makefile           |   1 -
> >>>  arch/arm/mach-ux500/cpuidle.c          | 128 ------------
> >>>  drivers/cpuidle/Makefile               |  42 ++++
> >>>  drivers/cpuidle/cpuidle-at91.c         |  68 +++++++
> >>>  drivers/cpuidle/cpuidle-davinci.c      | 104 ++++++++++
> >>>  drivers/cpuidle/cpuidle-imx5.c         |  37 ++++
> >>>  drivers/cpuidle/cpuidle-imx6q.c        |  74 +++++++
> >>>  drivers/cpuidle/cpuidle-omap34xx.c     | 342 ++++++++++++++++++++++++++++++++
> >>>  drivers/cpuidle/cpuidle-omap44xx.c     | 216 +++++++++++++++++++++
> >>>  drivers/cpuidle/cpuidle-s3c64xx.c      |  62 ++++++
> >>>  drivers/cpuidle/cpuidle-shmobile.c     |  37 ++++
> >>>  drivers/cpuidle/cpuidle-tegra114.c     |  35 ++++
> >>>  drivers/cpuidle/cpuidle-tegra20.c      | 217 +++++++++++++++++++++
> >>>  drivers/cpuidle/cpuidle-tegra30.c      | 149 ++++++++++++++
> >>>  drivers/cpuidle/cpuidle-ux500.c        | 128 ++++++++++++
> >>>  33 files changed, 1511 insertions(+), 1499 deletions(-)
> >>>  delete mode 100644 arch/arm/mach-at91/cpuidle.c
> >>>  delete mode 100644 arch/arm/mach-davinci/cpuidle.c
> >>>  delete mode 100644 arch/arm/mach-imx/cpuidle-imx5.c
> >>>  delete mode 100644 arch/arm/mach-imx/cpuidle-imx6q.c
> >>>  delete mode 100644 arch/arm/mach-omap2/cpuidle34xx.c
> >>>  delete mode 100644 arch/arm/mach-omap2/cpuidle44xx.c
> >>>  delete mode 100644 arch/arm/mach-s3c64xx/cpuidle.c
> >>>  delete mode 100644 arch/arm/mach-shmobile/cpuidle.c
> >>>  delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra114.c
> >>>  delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra20.c
> >>>  delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra30.c
> >>>  delete mode 100644 arch/arm/mach-ux500/cpuidle.c
> >>>  create mode 100644 drivers/cpuidle/cpuidle-at91.c
> >>>  create mode 100644 drivers/cpuidle/cpuidle-davinci.c
> >>>  create mode 100644 drivers/cpuidle/cpuidle-imx5.c
> >>>  create mode 100644 drivers/cpuidle/cpuidle-imx6q.c
> >>>  create mode 100644 drivers/cpuidle/cpuidle-omap34xx.c
> >>>  create mode 100644 drivers/cpuidle/cpuidle-omap44xx.c
> >>>  create mode 100644 drivers/cpuidle/cpuidle-s3c64xx.c
> >>>  create mode 100644 drivers/cpuidle/cpuidle-shmobile.c
> >>>  create mode 100644 drivers/cpuidle/cpuidle-tegra114.c
> >>>  create mode 100644 drivers/cpuidle/cpuidle-tegra20.c
> >>>  create mode 100644 drivers/cpuidle/cpuidle-tegra30.c
> >>>  create mode 100644 drivers/cpuidle/cpuidle-ux500.c

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH 0/8] ARM: move cpuidle drivers to drivers/cpuidle/
  2013-06-26 14:40         ` Bartlomiej Zolnierkiewicz
@ 2013-06-26 16:57           ` Daniel Lezcano
  -1 siblings, 0 replies; 42+ messages in thread
From: Daniel Lezcano @ 2013-06-26 16:57 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz
  Cc: linux-arm-kernel, linux-pm, linux, nicolas.ferre, plagnioj,
	nsekhar, khilman, kernel, shawn.guo, tony, ben-linux, kgene.kim,
	horms, magnus.damm, swarren, srinidhi.kasagar, linus.walleij,
	rjw, kyungmin.park

On 06/26/2013 04:40 PM, Bartlomiej Zolnierkiewicz wrote:
> On Wednesday, June 26, 2013 03:05:23 PM Daniel Lezcano wrote:
>> On 06/26/2013 02:22 PM, Bartlomiej Zolnierkiewicz wrote:
>>>
>>> Hi,
>>>
>>> On Wednesday, June 26, 2013 12:59:53 PM Daniel Lezcano wrote:
>>>> On 06/26/2013 12:15 PM, Bartlomiej Zolnierkiewicz wrote:
>>>>> Hi,
>>>>>
>>>>> This patchset moves ARM cpuidle drivers to drivers/cpuidle/ to make
>>>>> code match new driver placement rules (per commit a8e39c3 "cpuidle: add
>>>>> maintainer entry").
>>>>
>>>> I second this initiative but as stated in a previous email, a bit of
>>>> code cleanup, consolidation and encapsulation should be done before.
>>>>
>>>> Again, from my POV, it is worth to do that but we have to split the pm
>>>> code from the driver.
>>>
>>> OK, I'll look into separating the pm code from the drivers.  However it
>>> seems that patch #2 (for davinci) can be applied as it is.
>>
>> No it can't. It still has #include <mach/...>
>>
>> Please have a look at the thread:
>>
>> http://comments.gmane.org/gmane.linux.ports.arm.kernel/146651
> 
> OK, I see.
> 
> On davinci:
> 
> * <mach/cpuidle.h> contains only struct davinci_cpuidle_config
>   declaration (pointer to this structure instance is passed as
>   platform data to davinci cpuidle driver) so it seems that
>   moving it to <linux/platform_data/cpuidle-davinci.h> would be
>   sufficient?
> 
> * <mach/ddr2.h> contains only few definitions used by davinci
>   cpuidle driver and arch/arm/mach-davinci/sleep.S so wouldn't
>   it be OK to just move the header to <linux/davinci_ddr2.h>?
> 
> If agreed I'll prepare appropriate patches later.

Let me handle this driver with at91. I am consolidating the code around
the RAM self refresh.

>>>> Please review some patches I sent recently to split this code and
>>>> comment them. Otherwise, we will collide on this work.
>>>>
>>>> All the patches sent [1] was to unify the code to make the drivers as
>>>> unified as possible to converge to the same code pattern and to
>>>> facilitate the factoring out.
>>>
>>> I've looked at the patches ([1] and at91 ones) and they look fine to me.
>>> I don't think that there is currently a risk of colliding on this work
>>> (except at91 case) as your patches (except at91 ones) are already merged
>>> in upstream or linux-next branch of linux-pm tree (which is included in
>>> linux-next tree which I based my patches on). I'm subscribed to linux-pm
>>> mailing list now but please cc: me on your future ARM cpuidle changes
>>> (thanks!).
>>
>> We are working on cleaning up the different drivers to have a *common
>> code pattern* in order to factor it out, split the code into pm code and
>> driver code, move the drivers to the drivers/cpuidle directory and
>> finally create a single arm driver [1][2][3].
> 
> Interesting, I wasn't aware of the single arm driver goal..
> 
>> You are sending patches to move the drivers directly to the
>> drivers/cpuidle directory. I did that 1,5 years ago and I was told it is
>> not the way to go [4].
>>
>> As you can see this is a WIP.
>>
>> So I am insisting: that would be better if you sync up with us and check
>> what is the WIP and, if you are willing to, give us a hand instead of
>> doing your way.
> 
> OK.
> 
>> May I suggest you fix up the exynos cpuidle driver first ? :)
> 
> Sure.
> 
> Best regards,
> --
> Bartlomiej Zolnierkiewicz
> Samsung R&D Institute Poland
> Samsung Electronics
> 
>> Thanks
>>   -- Daniel
>>
>> [1]
>> https://blueprints.launchpad.net/linaro-power-kernel/+spec/cpuidle-consolidate-arm-drivers
>>
>> [2]
>> http://summit.linuxplumbersconf.org/lpc-2012/meeting/31/lpc2012-ref-cpu-idle-cluster-management/
>>
>> [3] https://e.lca-13.zerista.com/event/member/72362
>>
>> [4] http://comments.gmane.org/gmane.linux.ports.arm.kernel/146651
>>
>>
>>> Best regards,
>>> --
>>> Bartlomiej Zolnierkiewicz
>>> Samsung R&D Institute Poland
>>> Samsung Electronics
>>>
>>>> Thanks
>>>>   -- Daniel
>>>>
>>>> [1]
>>>> https://git.kernel.org/cgit/linux/kernel/git/rafael/linux-pm.git/log/?h=linux-next&qt=author&q=daniel.lezcano%40linaro.org
>>>>
>>>>> [ Please note that movement of Samsung EXYNOS cpuidle driver is handled
>>>>>   in separate patchset since it needs some other changes applied first. ]
>>>>>
>>>>> Patches are based on linux-next (next-20130624) and are compile tested
>>>>> only.  If agreed they all should probably go together through one tree
>>>>> (linux-pm or arm-soc) since they all modify drivers/cpuidle/Makefile.
>>>>>
>>>>> PS It seems that majority of cpuidle drivers is not used by default
>>>>> (CONFIG_CPU_IDLE is not turned on in corresponding defconfigs). The only
>>>>> exceptions are shmobile (kota2_defconfig) and tegra (tegra_defconfig).
>>>>> This is probably also something that needs updating.
>>>>>
>>>>> Best regards,
>>>>> --
>>>>> Bartlomiej Zolnierkiewicz
>>>>> Samsung R&D Institute Poland
>>>>> Samsung Electronics
>>>>>
>>>>>
>>>>> Bartlomiej Zolnierkiewicz (8):
>>>>>   ARM: at91: move cpuidle driver to drivers/cpuidle/
>>>>>   ARM: davinci: move cpuidle driver to drivers/cpuidle/
>>>>>   ARM: imx: move cpuidle drivers to drivers/cpuidle/
>>>>>   ARM: OMAP: move cpuidle drivers to drivers/cpuidle/
>>>>>   ARM: S3C64XX: move cpuidle driver to drivers/cpuidle/
>>>>>   ARM: shmobile: move cpuidle driver to drivers/cpuidle/
>>>>>   ARM: tegra: move cpuidle drivers to drivers/cpuidle/
>>>>>   ARM: ux500: move cpuidle drivers to drivers/cpuidle/
>>>>>
>>>>>  arch/arm/mach-at91/Makefile            |   1 -
>>>>>  arch/arm/mach-at91/cpuidle.c           |  68 -------
>>>>>  arch/arm/mach-davinci/Makefile         |   1 -
>>>>>  arch/arm/mach-davinci/cpuidle.c        | 105 ----------
>>>>>  arch/arm/mach-imx/Makefile             |   5 -
>>>>>  arch/arm/mach-imx/cpuidle-imx5.c       |  37 ----
>>>>>  arch/arm/mach-imx/cpuidle-imx6q.c      |  75 -------
>>>>>  arch/arm/mach-omap2/Makefile           |   5 -
>>>>>  arch/arm/mach-omap2/cpuidle34xx.c      | 344 ---------------------------------
>>>>>  arch/arm/mach-omap2/cpuidle44xx.c      | 217 ---------------------
>>>>>  arch/arm/mach-s3c64xx/Makefile         |   1 -
>>>>>  arch/arm/mach-s3c64xx/cpuidle.c        |  63 ------
>>>>>  arch/arm/mach-shmobile/Makefile        |   1 -
>>>>>  arch/arm/mach-shmobile/cpuidle.c       |  37 ----
>>>>>  arch/arm/mach-tegra/Makefile           |   9 -
>>>>>  arch/arm/mach-tegra/cpuidle-tegra114.c |  35 ----
>>>>>  arch/arm/mach-tegra/cpuidle-tegra20.c  | 217 ---------------------
>>>>>  arch/arm/mach-tegra/cpuidle-tegra30.c  | 149 --------------
>>>>>  arch/arm/mach-ux500/Makefile           |   1 -
>>>>>  arch/arm/mach-ux500/cpuidle.c          | 128 ------------
>>>>>  drivers/cpuidle/Makefile               |  42 ++++
>>>>>  drivers/cpuidle/cpuidle-at91.c         |  68 +++++++
>>>>>  drivers/cpuidle/cpuidle-davinci.c      | 104 ++++++++++
>>>>>  drivers/cpuidle/cpuidle-imx5.c         |  37 ++++
>>>>>  drivers/cpuidle/cpuidle-imx6q.c        |  74 +++++++
>>>>>  drivers/cpuidle/cpuidle-omap34xx.c     | 342 ++++++++++++++++++++++++++++++++
>>>>>  drivers/cpuidle/cpuidle-omap44xx.c     | 216 +++++++++++++++++++++
>>>>>  drivers/cpuidle/cpuidle-s3c64xx.c      |  62 ++++++
>>>>>  drivers/cpuidle/cpuidle-shmobile.c     |  37 ++++
>>>>>  drivers/cpuidle/cpuidle-tegra114.c     |  35 ++++
>>>>>  drivers/cpuidle/cpuidle-tegra20.c      | 217 +++++++++++++++++++++
>>>>>  drivers/cpuidle/cpuidle-tegra30.c      | 149 ++++++++++++++
>>>>>  drivers/cpuidle/cpuidle-ux500.c        | 128 ++++++++++++
>>>>>  33 files changed, 1511 insertions(+), 1499 deletions(-)
>>>>>  delete mode 100644 arch/arm/mach-at91/cpuidle.c
>>>>>  delete mode 100644 arch/arm/mach-davinci/cpuidle.c
>>>>>  delete mode 100644 arch/arm/mach-imx/cpuidle-imx5.c
>>>>>  delete mode 100644 arch/arm/mach-imx/cpuidle-imx6q.c
>>>>>  delete mode 100644 arch/arm/mach-omap2/cpuidle34xx.c
>>>>>  delete mode 100644 arch/arm/mach-omap2/cpuidle44xx.c
>>>>>  delete mode 100644 arch/arm/mach-s3c64xx/cpuidle.c
>>>>>  delete mode 100644 arch/arm/mach-shmobile/cpuidle.c
>>>>>  delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra114.c
>>>>>  delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra20.c
>>>>>  delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra30.c
>>>>>  delete mode 100644 arch/arm/mach-ux500/cpuidle.c
>>>>>  create mode 100644 drivers/cpuidle/cpuidle-at91.c
>>>>>  create mode 100644 drivers/cpuidle/cpuidle-davinci.c
>>>>>  create mode 100644 drivers/cpuidle/cpuidle-imx5.c
>>>>>  create mode 100644 drivers/cpuidle/cpuidle-imx6q.c
>>>>>  create mode 100644 drivers/cpuidle/cpuidle-omap34xx.c
>>>>>  create mode 100644 drivers/cpuidle/cpuidle-omap44xx.c
>>>>>  create mode 100644 drivers/cpuidle/cpuidle-s3c64xx.c
>>>>>  create mode 100644 drivers/cpuidle/cpuidle-shmobile.c
>>>>>  create mode 100644 drivers/cpuidle/cpuidle-tegra114.c
>>>>>  create mode 100644 drivers/cpuidle/cpuidle-tegra20.c
>>>>>  create mode 100644 drivers/cpuidle/cpuidle-tegra30.c
>>>>>  create mode 100644 drivers/cpuidle/cpuidle-ux500.c
> 


-- 
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


^ permalink raw reply	[flat|nested] 42+ messages in thread

* [PATCH 0/8] ARM: move cpuidle drivers to drivers/cpuidle/
@ 2013-06-26 16:57           ` Daniel Lezcano
  0 siblings, 0 replies; 42+ messages in thread
From: Daniel Lezcano @ 2013-06-26 16:57 UTC (permalink / raw)
  To: linux-arm-kernel

On 06/26/2013 04:40 PM, Bartlomiej Zolnierkiewicz wrote:
> On Wednesday, June 26, 2013 03:05:23 PM Daniel Lezcano wrote:
>> On 06/26/2013 02:22 PM, Bartlomiej Zolnierkiewicz wrote:
>>>
>>> Hi,
>>>
>>> On Wednesday, June 26, 2013 12:59:53 PM Daniel Lezcano wrote:
>>>> On 06/26/2013 12:15 PM, Bartlomiej Zolnierkiewicz wrote:
>>>>> Hi,
>>>>>
>>>>> This patchset moves ARM cpuidle drivers to drivers/cpuidle/ to make
>>>>> code match new driver placement rules (per commit a8e39c3 "cpuidle: add
>>>>> maintainer entry").
>>>>
>>>> I second this initiative but as stated in a previous email, a bit of
>>>> code cleanup, consolidation and encapsulation should be done before.
>>>>
>>>> Again, from my POV, it is worth to do that but we have to split the pm
>>>> code from the driver.
>>>
>>> OK, I'll look into separating the pm code from the drivers.  However it
>>> seems that patch #2 (for davinci) can be applied as it is.
>>
>> No it can't. It still has #include <mach/...>
>>
>> Please have a look at the thread:
>>
>> http://comments.gmane.org/gmane.linux.ports.arm.kernel/146651
> 
> OK, I see.
> 
> On davinci:
> 
> * <mach/cpuidle.h> contains only struct davinci_cpuidle_config
>   declaration (pointer to this structure instance is passed as
>   platform data to davinci cpuidle driver) so it seems that
>   moving it to <linux/platform_data/cpuidle-davinci.h> would be
>   sufficient?
> 
> * <mach/ddr2.h> contains only few definitions used by davinci
>   cpuidle driver and arch/arm/mach-davinci/sleep.S so wouldn't
>   it be OK to just move the header to <linux/davinci_ddr2.h>?
> 
> If agreed I'll prepare appropriate patches later.

Let me handle this driver with at91. I am consolidating the code around
the RAM self refresh.

>>>> Please review some patches I sent recently to split this code and
>>>> comment them. Otherwise, we will collide on this work.
>>>>
>>>> All the patches sent [1] was to unify the code to make the drivers as
>>>> unified as possible to converge to the same code pattern and to
>>>> facilitate the factoring out.
>>>
>>> I've looked at the patches ([1] and at91 ones) and they look fine to me.
>>> I don't think that there is currently a risk of colliding on this work
>>> (except at91 case) as your patches (except at91 ones) are already merged
>>> in upstream or linux-next branch of linux-pm tree (which is included in
>>> linux-next tree which I based my patches on). I'm subscribed to linux-pm
>>> mailing list now but please cc: me on your future ARM cpuidle changes
>>> (thanks!).
>>
>> We are working on cleaning up the different drivers to have a *common
>> code pattern* in order to factor it out, split the code into pm code and
>> driver code, move the drivers to the drivers/cpuidle directory and
>> finally create a single arm driver [1][2][3].
> 
> Interesting, I wasn't aware of the single arm driver goal..
> 
>> You are sending patches to move the drivers directly to the
>> drivers/cpuidle directory. I did that 1,5 years ago and I was told it is
>> not the way to go [4].
>>
>> As you can see this is a WIP.
>>
>> So I am insisting: that would be better if you sync up with us and check
>> what is the WIP and, if you are willing to, give us a hand instead of
>> doing your way.
> 
> OK.
> 
>> May I suggest you fix up the exynos cpuidle driver first ? :)
> 
> Sure.
> 
> Best regards,
> --
> Bartlomiej Zolnierkiewicz
> Samsung R&D Institute Poland
> Samsung Electronics
> 
>> Thanks
>>   -- Daniel
>>
>> [1]
>> https://blueprints.launchpad.net/linaro-power-kernel/+spec/cpuidle-consolidate-arm-drivers
>>
>> [2]
>> http://summit.linuxplumbersconf.org/lpc-2012/meeting/31/lpc2012-ref-cpu-idle-cluster-management/
>>
>> [3] https://e.lca-13.zerista.com/event/member/72362
>>
>> [4] http://comments.gmane.org/gmane.linux.ports.arm.kernel/146651
>>
>>
>>> Best regards,
>>> --
>>> Bartlomiej Zolnierkiewicz
>>> Samsung R&D Institute Poland
>>> Samsung Electronics
>>>
>>>> Thanks
>>>>   -- Daniel
>>>>
>>>> [1]
>>>> https://git.kernel.org/cgit/linux/kernel/git/rafael/linux-pm.git/log/?h=linux-next&qt=author&q=daniel.lezcano%40linaro.org
>>>>
>>>>> [ Please note that movement of Samsung EXYNOS cpuidle driver is handled
>>>>>   in separate patchset since it needs some other changes applied first. ]
>>>>>
>>>>> Patches are based on linux-next (next-20130624) and are compile tested
>>>>> only.  If agreed they all should probably go together through one tree
>>>>> (linux-pm or arm-soc) since they all modify drivers/cpuidle/Makefile.
>>>>>
>>>>> PS It seems that majority of cpuidle drivers is not used by default
>>>>> (CONFIG_CPU_IDLE is not turned on in corresponding defconfigs). The only
>>>>> exceptions are shmobile (kota2_defconfig) and tegra (tegra_defconfig).
>>>>> This is probably also something that needs updating.
>>>>>
>>>>> Best regards,
>>>>> --
>>>>> Bartlomiej Zolnierkiewicz
>>>>> Samsung R&D Institute Poland
>>>>> Samsung Electronics
>>>>>
>>>>>
>>>>> Bartlomiej Zolnierkiewicz (8):
>>>>>   ARM: at91: move cpuidle driver to drivers/cpuidle/
>>>>>   ARM: davinci: move cpuidle driver to drivers/cpuidle/
>>>>>   ARM: imx: move cpuidle drivers to drivers/cpuidle/
>>>>>   ARM: OMAP: move cpuidle drivers to drivers/cpuidle/
>>>>>   ARM: S3C64XX: move cpuidle driver to drivers/cpuidle/
>>>>>   ARM: shmobile: move cpuidle driver to drivers/cpuidle/
>>>>>   ARM: tegra: move cpuidle drivers to drivers/cpuidle/
>>>>>   ARM: ux500: move cpuidle drivers to drivers/cpuidle/
>>>>>
>>>>>  arch/arm/mach-at91/Makefile            |   1 -
>>>>>  arch/arm/mach-at91/cpuidle.c           |  68 -------
>>>>>  arch/arm/mach-davinci/Makefile         |   1 -
>>>>>  arch/arm/mach-davinci/cpuidle.c        | 105 ----------
>>>>>  arch/arm/mach-imx/Makefile             |   5 -
>>>>>  arch/arm/mach-imx/cpuidle-imx5.c       |  37 ----
>>>>>  arch/arm/mach-imx/cpuidle-imx6q.c      |  75 -------
>>>>>  arch/arm/mach-omap2/Makefile           |   5 -
>>>>>  arch/arm/mach-omap2/cpuidle34xx.c      | 344 ---------------------------------
>>>>>  arch/arm/mach-omap2/cpuidle44xx.c      | 217 ---------------------
>>>>>  arch/arm/mach-s3c64xx/Makefile         |   1 -
>>>>>  arch/arm/mach-s3c64xx/cpuidle.c        |  63 ------
>>>>>  arch/arm/mach-shmobile/Makefile        |   1 -
>>>>>  arch/arm/mach-shmobile/cpuidle.c       |  37 ----
>>>>>  arch/arm/mach-tegra/Makefile           |   9 -
>>>>>  arch/arm/mach-tegra/cpuidle-tegra114.c |  35 ----
>>>>>  arch/arm/mach-tegra/cpuidle-tegra20.c  | 217 ---------------------
>>>>>  arch/arm/mach-tegra/cpuidle-tegra30.c  | 149 --------------
>>>>>  arch/arm/mach-ux500/Makefile           |   1 -
>>>>>  arch/arm/mach-ux500/cpuidle.c          | 128 ------------
>>>>>  drivers/cpuidle/Makefile               |  42 ++++
>>>>>  drivers/cpuidle/cpuidle-at91.c         |  68 +++++++
>>>>>  drivers/cpuidle/cpuidle-davinci.c      | 104 ++++++++++
>>>>>  drivers/cpuidle/cpuidle-imx5.c         |  37 ++++
>>>>>  drivers/cpuidle/cpuidle-imx6q.c        |  74 +++++++
>>>>>  drivers/cpuidle/cpuidle-omap34xx.c     | 342 ++++++++++++++++++++++++++++++++
>>>>>  drivers/cpuidle/cpuidle-omap44xx.c     | 216 +++++++++++++++++++++
>>>>>  drivers/cpuidle/cpuidle-s3c64xx.c      |  62 ++++++
>>>>>  drivers/cpuidle/cpuidle-shmobile.c     |  37 ++++
>>>>>  drivers/cpuidle/cpuidle-tegra114.c     |  35 ++++
>>>>>  drivers/cpuidle/cpuidle-tegra20.c      | 217 +++++++++++++++++++++
>>>>>  drivers/cpuidle/cpuidle-tegra30.c      | 149 ++++++++++++++
>>>>>  drivers/cpuidle/cpuidle-ux500.c        | 128 ++++++++++++
>>>>>  33 files changed, 1511 insertions(+), 1499 deletions(-)
>>>>>  delete mode 100644 arch/arm/mach-at91/cpuidle.c
>>>>>  delete mode 100644 arch/arm/mach-davinci/cpuidle.c
>>>>>  delete mode 100644 arch/arm/mach-imx/cpuidle-imx5.c
>>>>>  delete mode 100644 arch/arm/mach-imx/cpuidle-imx6q.c
>>>>>  delete mode 100644 arch/arm/mach-omap2/cpuidle34xx.c
>>>>>  delete mode 100644 arch/arm/mach-omap2/cpuidle44xx.c
>>>>>  delete mode 100644 arch/arm/mach-s3c64xx/cpuidle.c
>>>>>  delete mode 100644 arch/arm/mach-shmobile/cpuidle.c
>>>>>  delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra114.c
>>>>>  delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra20.c
>>>>>  delete mode 100644 arch/arm/mach-tegra/cpuidle-tegra30.c
>>>>>  delete mode 100644 arch/arm/mach-ux500/cpuidle.c
>>>>>  create mode 100644 drivers/cpuidle/cpuidle-at91.c
>>>>>  create mode 100644 drivers/cpuidle/cpuidle-davinci.c
>>>>>  create mode 100644 drivers/cpuidle/cpuidle-imx5.c
>>>>>  create mode 100644 drivers/cpuidle/cpuidle-imx6q.c
>>>>>  create mode 100644 drivers/cpuidle/cpuidle-omap34xx.c
>>>>>  create mode 100644 drivers/cpuidle/cpuidle-omap44xx.c
>>>>>  create mode 100644 drivers/cpuidle/cpuidle-s3c64xx.c
>>>>>  create mode 100644 drivers/cpuidle/cpuidle-shmobile.c
>>>>>  create mode 100644 drivers/cpuidle/cpuidle-tegra114.c
>>>>>  create mode 100644 drivers/cpuidle/cpuidle-tegra20.c
>>>>>  create mode 100644 drivers/cpuidle/cpuidle-tegra30.c
>>>>>  create mode 100644 drivers/cpuidle/cpuidle-ux500.c
> 


-- 
 <http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH 7/8] ARM: tegra: move cpuidle drivers to drivers/cpuidle/
  2013-06-26 10:15   ` Bartlomiej Zolnierkiewicz
@ 2013-06-26 18:24     ` Stephen Warren
  -1 siblings, 0 replies; 42+ messages in thread
From: Stephen Warren @ 2013-06-26 18:24 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz
  Cc: linux-arm-kernel, linux-pm, linux, nicolas.ferre, plagnioj,
	nsekhar, khilman, kernel, shawn.guo, tony, ben-linux, kgene.kim,
	horms, magnus.damm, srinidhi.kasagar, linus.walleij,
	daniel.lezcano, rjw, kyungmin.park

On 06/26/2013 04:15 AM, Bartlomiej Zolnierkiewicz wrote:
> Compile tested only.

That's not a good patch description; it's more something that should be
below the --- line.

This would be a lot easier to review if "-M" had been passed to "git
format-patch" so that the move was actually represented as a move in the
patch.

This patch would need to move at least part of
arch/arm/mach-tegra/cpuidle.h to some common location, since core code
that's left in arch/arm/mach-tegra ends up calling functions in the
moved files to initialize the cpuidle driver.

You should probably move arch/arm/mach-tegra/cpuidle.c too.

Does it make sense to introduce a new Kconfig option into
drivers/cpuidle/Kconfig, so that cpuidle-tegra*.c isn't compiled if
ARCH_TEGRA is enabled, but rather if something more like CPU_IDLE_TEGRA
is enabled?

^ permalink raw reply	[flat|nested] 42+ messages in thread

* [PATCH 7/8] ARM: tegra: move cpuidle drivers to drivers/cpuidle/
@ 2013-06-26 18:24     ` Stephen Warren
  0 siblings, 0 replies; 42+ messages in thread
From: Stephen Warren @ 2013-06-26 18:24 UTC (permalink / raw)
  To: linux-arm-kernel

On 06/26/2013 04:15 AM, Bartlomiej Zolnierkiewicz wrote:
> Compile tested only.

That's not a good patch description; it's more something that should be
below the --- line.

This would be a lot easier to review if "-M" had been passed to "git
format-patch" so that the move was actually represented as a move in the
patch.

This patch would need to move at least part of
arch/arm/mach-tegra/cpuidle.h to some common location, since core code
that's left in arch/arm/mach-tegra ends up calling functions in the
moved files to initialize the cpuidle driver.

You should probably move arch/arm/mach-tegra/cpuidle.c too.

Does it make sense to introduce a new Kconfig option into
drivers/cpuidle/Kconfig, so that cpuidle-tegra*.c isn't compiled if
ARCH_TEGRA is enabled, but rather if something more like CPU_IDLE_TEGRA
is enabled?

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH 8/8] ARM: ux500: move cpuidle drivers to drivers/cpuidle/
  2013-06-26 10:15   ` Bartlomiej Zolnierkiewicz
@ 2013-06-26 20:42     ` Linus Walleij
  -1 siblings, 0 replies; 42+ messages in thread
From: Linus Walleij @ 2013-06-26 20:42 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz, Rickard ANDERSSON, Arnd Bergmann,
	Olof Johansson
  Cc: linux-arm-kernel, linux-pm, Andrew Victor, Nicolas Ferre,
	Jean-Christophe PLAGNIOL-VILLARD, Nori, Sekhar, ext Kevin Hilman,
	Sascha Hauer, Shawn Guo, ext Tony Lindgren, Ben Dooks,
	Kukjin Kim, Simon Horman, Magnus Damm, Stephen Warren,
	Srinidhi KASAGAR, Daniel Lezcano, Rafael J. Wysocki,
	Kyungmin Park

On Wed, Jun 26, 2013 at 12:15 PM, Bartlomiej Zolnierkiewicz
<b.zolnierkie@samsung.com> wrote:

--- a/arch/arm/mach-ux500/cpuidle
-#include "db8500-regs.h"
-#include "id.h"
> +++ b/drivers/cpuidle/cpuidle-ux500.c
(...)
> +#include "../../arch/arm/mach-ux500/db8500-regs.h"
> +#include "../../arch/arm/mach-ux500/id.h"

Well that was creative. NACK.

If you want to move the driver you need to come up with
proper interfaces making the move clean, not just move the files
and make them compile somewhere else I think.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 42+ messages in thread

* [PATCH 8/8] ARM: ux500: move cpuidle drivers to drivers/cpuidle/
@ 2013-06-26 20:42     ` Linus Walleij
  0 siblings, 0 replies; 42+ messages in thread
From: Linus Walleij @ 2013-06-26 20:42 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jun 26, 2013 at 12:15 PM, Bartlomiej Zolnierkiewicz
<b.zolnierkie@samsung.com> wrote:

--- a/arch/arm/mach-ux500/cpuidle
-#include "db8500-regs.h"
-#include "id.h"
> +++ b/drivers/cpuidle/cpuidle-ux500.c
(...)
> +#include "../../arch/arm/mach-ux500/db8500-regs.h"
> +#include "../../arch/arm/mach-ux500/id.h"

Well that was creative. NACK.

If you want to move the driver you need to come up with
proper interfaces making the move clean, not just move the files
and make them compile somewhere else I think.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH 8/8] ARM: ux500: move cpuidle drivers to drivers/cpuidle/
  2013-06-26 20:42     ` Linus Walleij
@ 2013-06-26 21:28       ` Arnd Bergmann
  -1 siblings, 0 replies; 42+ messages in thread
From: Arnd Bergmann @ 2013-06-26 21:28 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Bartlomiej Zolnierkiewicz, Rickard ANDERSSON, Olof Johansson,
	linux-arm-kernel, linux-pm, Andrew Victor, Nicolas Ferre,
	Jean-Christophe PLAGNIOL-VILLARD, Nori, Sekhar, ext Kevin Hilman,
	Sascha Hauer, Shawn Guo, ext Tony Lindgren, Ben Dooks,
	Kukjin Kim, Simon Horman, Magnus Damm, Stephen Warren,
	Srinidhi KASAGAR, Daniel Lezcano

On Wednesday 26 June 2013, Linus Walleij wrote:
> On Wed, Jun 26, 2013 at 12:15 PM, Bartlomiej Zolnierkiewicz
> <b.zolnierkie@samsung.com> wrote:
> 
> --- a/arch/arm/mach-ux500/cpuidle
> -#include "db8500-regs.h"
> -#include "id.h"
> > +++ b/drivers/cpuidle/cpuidle-ux500.c
> (...)
> > +#include "../../arch/arm/mach-ux500/db8500-regs.h"
> > +#include "../../arch/arm/mach-ux500/id.h"
> 
> Well that was creative. NACK.
> 
> If you want to move the driver you need to come up with
> proper interfaces making the move clean, not just move the files
> and make them compile somewhere else I think.

Seconded. Moving the code into drivers/cpuidle/ doesn't actually
turn it into a proper driver. If we cannot find a way to make these
look like drivers, we shouldn't move them.

	Arnd

^ permalink raw reply	[flat|nested] 42+ messages in thread

* [PATCH 8/8] ARM: ux500: move cpuidle drivers to drivers/cpuidle/
@ 2013-06-26 21:28       ` Arnd Bergmann
  0 siblings, 0 replies; 42+ messages in thread
From: Arnd Bergmann @ 2013-06-26 21:28 UTC (permalink / raw)
  To: linux-arm-kernel

On Wednesday 26 June 2013, Linus Walleij wrote:
> On Wed, Jun 26, 2013 at 12:15 PM, Bartlomiej Zolnierkiewicz
> <b.zolnierkie@samsung.com> wrote:
> 
> --- a/arch/arm/mach-ux500/cpuidle
> -#include "db8500-regs.h"
> -#include "id.h"
> > +++ b/drivers/cpuidle/cpuidle-ux500.c
> (...)
> > +#include "../../arch/arm/mach-ux500/db8500-regs.h"
> > +#include "../../arch/arm/mach-ux500/id.h"
> 
> Well that was creative. NACK.
> 
> If you want to move the driver you need to come up with
> proper interfaces making the move clean, not just move the files
> and make them compile somewhere else I think.

Seconded. Moving the code into drivers/cpuidle/ doesn't actually
turn it into a proper driver. If we cannot find a way to make these
look like drivers, we shouldn't move them.

	Arnd

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH 4/8] ARM: OMAP: move cpuidle drivers to drivers/cpuidle/
  2013-06-26 10:15   ` Bartlomiej Zolnierkiewicz
@ 2013-06-27  8:06     ` Tony Lindgren
  -1 siblings, 0 replies; 42+ messages in thread
From: Tony Lindgren @ 2013-06-27  8:06 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz, Kevin Hilman
  Cc: kgene.kim, daniel.lezcano, linux-pm, khilman, nsekhar,
	linus.walleij, swarren, magnus.damm, nicolas.ferre, linux, rjw,
	kyungmin.park, horms, srinidhi.kasagar, ben-linux, shawn.guo,
	plagnioj, kernel, linux-arm-kernel

* Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> [130626 12:25]:
> While at it:
> - remove file path from comment
> - fix whitespace issues
> 
> Compile tested only.
...

> --- /dev/null
> +++ b/drivers/cpuidle/cpuidle-omap34xx.c
> @@ -0,0 +1,342 @@
> +/*
> + * OMAP3 CPU IDLE Routines
> + *
> + * Copyright (C) 2008 Texas Instruments, Inc.
> + * Rajendra Nayak <rnayak@ti.com>
> + *
> + * Copyright (C) 2007 Texas Instruments, Inc.
> + * Karthik Dasu <karthik-dp@ti.com>
> + *
> + * Copyright (C) 2006 Nokia Corporation
> + * Tony Lindgren <tony@atomide.com>
> + *
> + * Copyright (C) 2005 Texas Instruments, Inc.
> + * Richard Woodruff <r-woodruff2@ti.com>
> + *
> + * Based on pm.c for omap2
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
> +#include <linux/sched.h>
> +#include <linux/cpuidle.h>
> +#include <linux/export.h>
> +#include <linux/cpu_pm.h>
> +#include <asm/cpuidle.h>
> +
> +#include "../../arch/arm/mach-omap2/powerdomain.h"
> +#include "../../arch/arm/mach-omap2/clockdomain.h"
> +
> +#include "../../arch/arm/mach-omap2/pm.h"
> +#include "../../arch/arm/mach-omap2/control.h"
> +#include "../../arch/arm/mach-omap2/common.h"

Do we really want to do includes like this from drivers?
Presumably these will go away with DT, but still.

Kevin, any comments?

Regards,

Tony

^ permalink raw reply	[flat|nested] 42+ messages in thread

* [PATCH 4/8] ARM: OMAP: move cpuidle drivers to drivers/cpuidle/
@ 2013-06-27  8:06     ` Tony Lindgren
  0 siblings, 0 replies; 42+ messages in thread
From: Tony Lindgren @ 2013-06-27  8:06 UTC (permalink / raw)
  To: linux-arm-kernel

* Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> [130626 12:25]:
> While at it:
> - remove file path from comment
> - fix whitespace issues
> 
> Compile tested only.
...

> --- /dev/null
> +++ b/drivers/cpuidle/cpuidle-omap34xx.c
> @@ -0,0 +1,342 @@
> +/*
> + * OMAP3 CPU IDLE Routines
> + *
> + * Copyright (C) 2008 Texas Instruments, Inc.
> + * Rajendra Nayak <rnayak@ti.com>
> + *
> + * Copyright (C) 2007 Texas Instruments, Inc.
> + * Karthik Dasu <karthik-dp@ti.com>
> + *
> + * Copyright (C) 2006 Nokia Corporation
> + * Tony Lindgren <tony@atomide.com>
> + *
> + * Copyright (C) 2005 Texas Instruments, Inc.
> + * Richard Woodruff <r-woodruff2@ti.com>
> + *
> + * Based on pm.c for omap2
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
> +#include <linux/sched.h>
> +#include <linux/cpuidle.h>
> +#include <linux/export.h>
> +#include <linux/cpu_pm.h>
> +#include <asm/cpuidle.h>
> +
> +#include "../../arch/arm/mach-omap2/powerdomain.h"
> +#include "../../arch/arm/mach-omap2/clockdomain.h"
> +
> +#include "../../arch/arm/mach-omap2/pm.h"
> +#include "../../arch/arm/mach-omap2/control.h"
> +#include "../../arch/arm/mach-omap2/common.h"

Do we really want to do includes like this from drivers?
Presumably these will go away with DT, but still.

Kevin, any comments?

Regards,

Tony

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH 4/8] ARM: OMAP: move cpuidle drivers to drivers/cpuidle/
  2013-06-26 10:15   ` Bartlomiej Zolnierkiewicz
@ 2013-06-27 15:36     ` Santosh Shilimkar
  -1 siblings, 0 replies; 42+ messages in thread
From: Santosh Shilimkar @ 2013-06-27 15:36 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz
  Cc: swarren, srinidhi.kasagar, khilman, linus.walleij, nsekhar,
	kgene.kim, daniel.lezcano, magnus.damm, tony, plagnioj,
	Kevin Hilman, linux-pm, nicolas.ferre, Rajendra Nayak, rjw,
	horms, ben-linux, linux, linux-arm-kernel, Kristo, Tero,
	kyungmin.park, kernel, shawn.guo

(You have missed few CC's)

+Kevin, Tero, Rajendra

On Wednesday 26 June 2013 06:15 AM, Bartlomiej Zolnierkiewicz wrote:
> While at it:
> - remove file path from comment
> - fix whitespace issues
> 
> Compile tested only.
> 
> Cc: Tony Lindgren <tony@atomide.com>
> Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
> Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
> ---
>  arch/arm/mach-omap2/Makefile       |   5 -
>  arch/arm/mach-omap2/cpuidle34xx.c  | 344 -------------------------------------
>  arch/arm/mach-omap2/cpuidle44xx.c  | 217 -----------------------
>  drivers/cpuidle/Makefile           |  10 ++
>  drivers/cpuidle/cpuidle-omap34xx.c | 342 ++++++++++++++++++++++++++++++++++++
>  drivers/cpuidle/cpuidle-omap44xx.c | 216 +++++++++++++++++++++++
>  6 files changed, 568 insertions(+), 566 deletions(-)
>  delete mode 100644 arch/arm/mach-omap2/cpuidle34xx.c
>  delete mode 100644 arch/arm/mach-omap2/cpuidle44xx.c
>  create mode 100644 drivers/cpuidle/cpuidle-omap34xx.c
>  create mode 100644 drivers/cpuidle/cpuidle-omap44xx.c
> 

[..]

> diff --git a/drivers/cpuidle/cpuidle-omap44xx.c b/drivers/cpuidle/cpuidle-omap44xx.c
> new file mode 100644
> index 0000000..86b8a51
> --- /dev/null
> +++ b/drivers/cpuidle/cpuidle-omap44xx.c
> @@ -0,0 +1,216 @@
> +/*
> + * OMAP4+ CPU idle Routines
> + *
> + * Copyright (C) 2011-2013 Texas Instruments, Inc.
> + * Santosh Shilimkar <santosh.shilimkar@ti.com>
> + * Rajendra Nayak <rnayak@ti.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
> +#include <linux/sched.h>
> +#include <linux/cpuidle.h>
> +#include <linux/cpu_pm.h>
> +#include <linux/export.h>
> +
> +#include <asm/cpuidle.h>
> +#include <asm/proc-fns.h>
> +
> +#include "../../arch/arm/mach-omap2/common.h"
> +#include "../../arch/arm/mach-omap2/pm.h"
> +#include "../../arch/arm/mach-omap2/prm.h"
> +#include "../../arch/arm/mach-omap2/clockdomain.h"
> +
We have discussed it already on the list in past. The
movement was pending exactly for above dependencies.

I let Kevin take a call but moving drivers with
such dependency with platform code is just not
right.

Regards,
Santosh

^ permalink raw reply	[flat|nested] 42+ messages in thread

* [PATCH 4/8] ARM: OMAP: move cpuidle drivers to drivers/cpuidle/
@ 2013-06-27 15:36     ` Santosh Shilimkar
  0 siblings, 0 replies; 42+ messages in thread
From: Santosh Shilimkar @ 2013-06-27 15:36 UTC (permalink / raw)
  To: linux-arm-kernel

(You have missed few CC's)

+Kevin, Tero, Rajendra

On Wednesday 26 June 2013 06:15 AM, Bartlomiej Zolnierkiewicz wrote:
> While at it:
> - remove file path from comment
> - fix whitespace issues
> 
> Compile tested only.
> 
> Cc: Tony Lindgren <tony@atomide.com>
> Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
> Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
> ---
>  arch/arm/mach-omap2/Makefile       |   5 -
>  arch/arm/mach-omap2/cpuidle34xx.c  | 344 -------------------------------------
>  arch/arm/mach-omap2/cpuidle44xx.c  | 217 -----------------------
>  drivers/cpuidle/Makefile           |  10 ++
>  drivers/cpuidle/cpuidle-omap34xx.c | 342 ++++++++++++++++++++++++++++++++++++
>  drivers/cpuidle/cpuidle-omap44xx.c | 216 +++++++++++++++++++++++
>  6 files changed, 568 insertions(+), 566 deletions(-)
>  delete mode 100644 arch/arm/mach-omap2/cpuidle34xx.c
>  delete mode 100644 arch/arm/mach-omap2/cpuidle44xx.c
>  create mode 100644 drivers/cpuidle/cpuidle-omap34xx.c
>  create mode 100644 drivers/cpuidle/cpuidle-omap44xx.c
> 

[..]

> diff --git a/drivers/cpuidle/cpuidle-omap44xx.c b/drivers/cpuidle/cpuidle-omap44xx.c
> new file mode 100644
> index 0000000..86b8a51
> --- /dev/null
> +++ b/drivers/cpuidle/cpuidle-omap44xx.c
> @@ -0,0 +1,216 @@
> +/*
> + * OMAP4+ CPU idle Routines
> + *
> + * Copyright (C) 2011-2013 Texas Instruments, Inc.
> + * Santosh Shilimkar <santosh.shilimkar@ti.com>
> + * Rajendra Nayak <rnayak@ti.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
> +#include <linux/sched.h>
> +#include <linux/cpuidle.h>
> +#include <linux/cpu_pm.h>
> +#include <linux/export.h>
> +
> +#include <asm/cpuidle.h>
> +#include <asm/proc-fns.h>
> +
> +#include "../../arch/arm/mach-omap2/common.h"
> +#include "../../arch/arm/mach-omap2/pm.h"
> +#include "../../arch/arm/mach-omap2/prm.h"
> +#include "../../arch/arm/mach-omap2/clockdomain.h"
> +
We have discussed it already on the list in past. The
movement was pending exactly for above dependencies.

I let Kevin take a call but moving drivers with
such dependency with platform code is just not
right.

Regards,
Santosh

^ permalink raw reply	[flat|nested] 42+ messages in thread

* Re: [PATCH 4/8] ARM: OMAP: move cpuidle drivers to drivers/cpuidle/
  2013-06-27  8:06     ` Tony Lindgren
@ 2013-06-27 17:25       ` Kevin Hilman
  -1 siblings, 0 replies; 42+ messages in thread
From: Kevin Hilman @ 2013-06-27 17:25 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Bartlomiej Zolnierkiewicz, linux-arm-kernel, rjw, kgene.kim,
	magnus.damm, ben-linux, linux-pm, nsekhar, linus.walleij,
	swarren, nicolas.ferre, daniel.lezcano, kyungmin.park, horms,
	srinidhi.kasagar, kernel, shawn.guo, plagnioj, linux

Tony Lindgren <tony@atomide.com> writes:

> * Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> [130626 12:25]:
>> While at it:
>> - remove file path from comment
>> - fix whitespace issues
>> 
>> Compile tested only.
> ...
>
>> --- /dev/null
>> +++ b/drivers/cpuidle/cpuidle-omap34xx.c
>> @@ -0,0 +1,342 @@
>> +/*
>> + * OMAP3 CPU IDLE Routines
>> + *
>> + * Copyright (C) 2008 Texas Instruments, Inc.
>> + * Rajendra Nayak <rnayak@ti.com>
>> + *
>> + * Copyright (C) 2007 Texas Instruments, Inc.
>> + * Karthik Dasu <karthik-dp@ti.com>
>> + *
>> + * Copyright (C) 2006 Nokia Corporation
>> + * Tony Lindgren <tony@atomide.com>
>> + *
>> + * Copyright (C) 2005 Texas Instruments, Inc.
>> + * Richard Woodruff <r-woodruff2@ti.com>
>> + *
>> + * Based on pm.c for omap2
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License version 2 as
>> + * published by the Free Software Foundation.
>> + */
>> +
>> +#include <linux/sched.h>
>> +#include <linux/cpuidle.h>
>> +#include <linux/export.h>
>> +#include <linux/cpu_pm.h>
>> +#include <asm/cpuidle.h>
>> +
>> +#include "../../arch/arm/mach-omap2/powerdomain.h"
>> +#include "../../arch/arm/mach-omap2/clockdomain.h"
>> +
>> +#include "../../arch/arm/mach-omap2/pm.h"
>> +#include "../../arch/arm/mach-omap2/control.h"
>> +#include "../../arch/arm/mach-omap2/common.h"
>
> Do we really want to do includes like this from drivers?
> Presumably these will go away with DT, but still.
>
> Kevin, any comments?

NACK

We need proper interfaces to platform-specific code before moving.

Kevin

^ permalink raw reply	[flat|nested] 42+ messages in thread

* [PATCH 4/8] ARM: OMAP: move cpuidle drivers to drivers/cpuidle/
@ 2013-06-27 17:25       ` Kevin Hilman
  0 siblings, 0 replies; 42+ messages in thread
From: Kevin Hilman @ 2013-06-27 17:25 UTC (permalink / raw)
  To: linux-arm-kernel

Tony Lindgren <tony@atomide.com> writes:

> * Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> [130626 12:25]:
>> While at it:
>> - remove file path from comment
>> - fix whitespace issues
>> 
>> Compile tested only.
> ...
>
>> --- /dev/null
>> +++ b/drivers/cpuidle/cpuidle-omap34xx.c
>> @@ -0,0 +1,342 @@
>> +/*
>> + * OMAP3 CPU IDLE Routines
>> + *
>> + * Copyright (C) 2008 Texas Instruments, Inc.
>> + * Rajendra Nayak <rnayak@ti.com>
>> + *
>> + * Copyright (C) 2007 Texas Instruments, Inc.
>> + * Karthik Dasu <karthik-dp@ti.com>
>> + *
>> + * Copyright (C) 2006 Nokia Corporation
>> + * Tony Lindgren <tony@atomide.com>
>> + *
>> + * Copyright (C) 2005 Texas Instruments, Inc.
>> + * Richard Woodruff <r-woodruff2@ti.com>
>> + *
>> + * Based on pm.c for omap2
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License version 2 as
>> + * published by the Free Software Foundation.
>> + */
>> +
>> +#include <linux/sched.h>
>> +#include <linux/cpuidle.h>
>> +#include <linux/export.h>
>> +#include <linux/cpu_pm.h>
>> +#include <asm/cpuidle.h>
>> +
>> +#include "../../arch/arm/mach-omap2/powerdomain.h"
>> +#include "../../arch/arm/mach-omap2/clockdomain.h"
>> +
>> +#include "../../arch/arm/mach-omap2/pm.h"
>> +#include "../../arch/arm/mach-omap2/control.h"
>> +#include "../../arch/arm/mach-omap2/common.h"
>
> Do we really want to do includes like this from drivers?
> Presumably these will go away with DT, but still.
>
> Kevin, any comments?

NACK

We need proper interfaces to platform-specific code before moving.

Kevin

^ permalink raw reply	[flat|nested] 42+ messages in thread

* RE: [PATCH 5/8] ARM: S3C64XX: move cpuidle driver to drivers/cpuidle/
  2013-06-26 10:15   ` Bartlomiej Zolnierkiewicz
@ 2013-07-22  3:33     ` Kukjin Kim
  -1 siblings, 0 replies; 42+ messages in thread
From: Kukjin Kim @ 2013-07-22  3:33 UTC (permalink / raw)
  To: 'Kukjin Kim', 'Bartlomiej Zolnierkiewicz',
	linux-arm-kernel
  Cc: linux-pm, linux, nicolas.ferre, plagnioj, nsekhar, khilman,
	kernel, shawn.guo, tony, ben-linux, horms, magnus.damm, swarren,
	srinidhi.kasagar, linus.walleij, daniel.lezcano, rjw,
	kyungmin.park

Kukjin Kim wrote:
> 
Re-sending due to e-mail client problem :-(

> Bartlomiej Zolnierkiewicz wrote:
> >
> > While at it:
> > - remove file path from comment
> >
> > Compile tested only.
> >
> > Cc: Ben Dooks <ben-linux@fluff.org>
> > Cc: Kukjin Kim <kgene.kim@samsung.com>
> > Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
> > Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
> > Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> > Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
> > ---
> >  arch/arm/mach-s3c64xx/Makefile    |  1 -
> >  arch/arm/mach-s3c64xx/cpuidle.c   | 63
---------------------------------
> --
> > ----
> >  drivers/cpuidle/Makefile          |  3 ++
> >  drivers/cpuidle/cpuidle-s3c64xx.c | 62
> > ++++++++++++++++++++++++++++++++++++++
> >  4 files changed, 65 insertions(+), 64 deletions(-)
> >  delete mode 100644 arch/arm/mach-s3c64xx/cpuidle.c
> >  create mode 100644 drivers/cpuidle/cpuidle-s3c64xx.c
> >
> Please see below with using '-M'.
> 
> --------8<-------------------------------8<--------
> obj-$(CONFIG_PM)		+= pm.o irq-pm.o sleep.o
> -obj-$(CONFIG_CPU_IDLE)		+= cpuidle.o
> 
>  # DMA support
> 
> diff --git a/arch/arm/mach-s3c64xx/cpuidle.c b/drivers/cpuidle/cpuidle-
> s3c64xx.c
> similarity index 92%
> rename from arch/arm/mach-s3c64xx/cpuidle.c
> rename to drivers/cpuidle/cpuidle-s3c64xx.c
> index 3c8ab07..c18d075 100644
> --- a/arch/arm/mach-s3c64xx/cpuidle.c
> +++ b/drivers/cpuidle/cpuidle-s3c64xx.c
> @@ -1,5 +1,4 @@
> -/* linux/arch/arm/mach-s3c64xx/cpuidle.c
> - *
> +/*
>   * Copyright (c) 2011 Wolfson Microelectronics, plc
>   * Copyright (c) 2011 Samsung Electronics Co., Ltd.
>   *		http://www.samsung.com
> @@ -20,8 +19,8 @@
> 
>  #include <mach/map.h>
> 
> -#include "regs-sys.h"
> -#include "regs-syscon-power.h"
> +#include "../../arch/arm/mach-s3c64xx/regs-sys.h"
> +#include "../../arch/arm/mach-s3c64xx/regs-syscon-power.h"
> 
>  static int s3c64xx_enter_idle(struct cpuidle_device *dev,
>  			      struct cpuidle_driver *drv,
> --------8<-------------------------------8<--------
> 
> Would be helpful to check which codes have been changed...
> 
> Need to sort out above inclusions...
> 
> > diff --git a/arch/arm/mach-s3c64xx/Makefile b/arch/arm/mach-
> > s3c64xx/Makefile
> > index 31d0c91..e7a3ee7 100644
> > --- a/arch/arm/mach-s3c64xx/Makefile
> > +++ b/arch/arm/mach-s3c64xx/Makefile
> > @@ -22,7 +22,6 @@ obj-$(CONFIG_CPU_S3C6410)	+= s3c6410.o
> >  # PM
> >
> >  obj-$(CONFIG_PM)		+= pm.o irq-pm.o sleep.o
> > -obj-$(CONFIG_CPU_IDLE)		+= cpuidle.o
> >
> >  # DMA support
> >
> > diff --git a/arch/arm/mach-s3c64xx/cpuidle.c b/arch/arm/mach-
> > s3c64xx/cpuidle.c
> > deleted file mode 100644
> > index 3c8ab07..0000000
> > --- a/arch/arm/mach-s3c64xx/cpuidle.c
> > +++ /dev/null
> 
> [...]
> 
> > diff --git a/drivers/cpuidle/Makefile b/drivers/cpuidle/Makefile
> > index 6436c67..eed221e 100644
> > --- a/drivers/cpuidle/Makefile
> > +++ b/drivers/cpuidle/Makefile
> > @@ -31,4 +31,7 @@ ifeq ($(CONFIG_ARCH_OMAP4),y)
> >  	ccflags-y += -I$(srctree)/arch/arm/mach-omap2/include
> >  	obj-y += cpuidle-omap44xx.o
> >  endif
> > +ifeq ($(CONFIG_ARCH_S3C64XX),y)
> > +	obj-y += cpuidle-s3c64xx.o
> > +endif
> 
> I think, adding CONFIG_CPU_IDLE_S3C64XX like others, Calexeda, Zynq is
> better...?
> 
> >  obj-$(CONFIG_CPU_IDLE_ZYNQ) += cpuidle-zynq.o
> > diff --git a/drivers/cpuidle/cpuidle-s3c64xx.c
> b/drivers/cpuidle/cpuidle-
> > s3c64xx.c
> > new file mode 100644
> > index 0000000..c18d075
> > --- /dev/null
> > +++ b/drivers/cpuidle/cpuidle-s3c64xx.c
> 
> [...]
> 
> > --
> > 1.8.2.3
> 
> Thanks,
> Kukjin


^ permalink raw reply	[flat|nested] 42+ messages in thread

* [PATCH 5/8] ARM: S3C64XX: move cpuidle driver to drivers/cpuidle/
@ 2013-07-22  3:33     ` Kukjin Kim
  0 siblings, 0 replies; 42+ messages in thread
From: Kukjin Kim @ 2013-07-22  3:33 UTC (permalink / raw)
  To: linux-arm-kernel

Kukjin Kim wrote:
> 
Re-sending due to e-mail client problem :-(

> Bartlomiej Zolnierkiewicz wrote:
> >
> > While at it:
> > - remove file path from comment
> >
> > Compile tested only.
> >
> > Cc: Ben Dooks <ben-linux@fluff.org>
> > Cc: Kukjin Kim <kgene.kim@samsung.com>
> > Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
> > Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
> > Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> > Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
> > ---
> >  arch/arm/mach-s3c64xx/Makefile    |  1 -
> >  arch/arm/mach-s3c64xx/cpuidle.c   | 63
---------------------------------
> --
> > ----
> >  drivers/cpuidle/Makefile          |  3 ++
> >  drivers/cpuidle/cpuidle-s3c64xx.c | 62
> > ++++++++++++++++++++++++++++++++++++++
> >  4 files changed, 65 insertions(+), 64 deletions(-)
> >  delete mode 100644 arch/arm/mach-s3c64xx/cpuidle.c
> >  create mode 100644 drivers/cpuidle/cpuidle-s3c64xx.c
> >
> Please see below with using '-M'.
> 
> --------8<-------------------------------8<--------
> obj-$(CONFIG_PM)		+= pm.o irq-pm.o sleep.o
> -obj-$(CONFIG_CPU_IDLE)		+= cpuidle.o
> 
>  # DMA support
> 
> diff --git a/arch/arm/mach-s3c64xx/cpuidle.c b/drivers/cpuidle/cpuidle-
> s3c64xx.c
> similarity index 92%
> rename from arch/arm/mach-s3c64xx/cpuidle.c
> rename to drivers/cpuidle/cpuidle-s3c64xx.c
> index 3c8ab07..c18d075 100644
> --- a/arch/arm/mach-s3c64xx/cpuidle.c
> +++ b/drivers/cpuidle/cpuidle-s3c64xx.c
> @@ -1,5 +1,4 @@
> -/* linux/arch/arm/mach-s3c64xx/cpuidle.c
> - *
> +/*
>   * Copyright (c) 2011 Wolfson Microelectronics, plc
>   * Copyright (c) 2011 Samsung Electronics Co., Ltd.
>   *		http://www.samsung.com
> @@ -20,8 +19,8 @@
> 
>  #include <mach/map.h>
> 
> -#include "regs-sys.h"
> -#include "regs-syscon-power.h"
> +#include "../../arch/arm/mach-s3c64xx/regs-sys.h"
> +#include "../../arch/arm/mach-s3c64xx/regs-syscon-power.h"
> 
>  static int s3c64xx_enter_idle(struct cpuidle_device *dev,
>  			      struct cpuidle_driver *drv,
> --------8<-------------------------------8<--------
> 
> Would be helpful to check which codes have been changed...
> 
> Need to sort out above inclusions...
> 
> > diff --git a/arch/arm/mach-s3c64xx/Makefile b/arch/arm/mach-
> > s3c64xx/Makefile
> > index 31d0c91..e7a3ee7 100644
> > --- a/arch/arm/mach-s3c64xx/Makefile
> > +++ b/arch/arm/mach-s3c64xx/Makefile
> > @@ -22,7 +22,6 @@ obj-$(CONFIG_CPU_S3C6410)	+= s3c6410.o
> >  # PM
> >
> >  obj-$(CONFIG_PM)		+= pm.o irq-pm.o sleep.o
> > -obj-$(CONFIG_CPU_IDLE)		+= cpuidle.o
> >
> >  # DMA support
> >
> > diff --git a/arch/arm/mach-s3c64xx/cpuidle.c b/arch/arm/mach-
> > s3c64xx/cpuidle.c
> > deleted file mode 100644
> > index 3c8ab07..0000000
> > --- a/arch/arm/mach-s3c64xx/cpuidle.c
> > +++ /dev/null
> 
> [...]
> 
> > diff --git a/drivers/cpuidle/Makefile b/drivers/cpuidle/Makefile
> > index 6436c67..eed221e 100644
> > --- a/drivers/cpuidle/Makefile
> > +++ b/drivers/cpuidle/Makefile
> > @@ -31,4 +31,7 @@ ifeq ($(CONFIG_ARCH_OMAP4),y)
> >  	ccflags-y += -I$(srctree)/arch/arm/mach-omap2/include
> >  	obj-y += cpuidle-omap44xx.o
> >  endif
> > +ifeq ($(CONFIG_ARCH_S3C64XX),y)
> > +	obj-y += cpuidle-s3c64xx.o
> > +endif
> 
> I think, adding CONFIG_CPU_IDLE_S3C64XX like others, Calexeda, Zynq is
> better...?
> 
> >  obj-$(CONFIG_CPU_IDLE_ZYNQ) += cpuidle-zynq.o
> > diff --git a/drivers/cpuidle/cpuidle-s3c64xx.c
> b/drivers/cpuidle/cpuidle-
> > s3c64xx.c
> > new file mode 100644
> > index 0000000..c18d075
> > --- /dev/null
> > +++ b/drivers/cpuidle/cpuidle-s3c64xx.c
> 
> [...]
> 
> > --
> > 1.8.2.3
> 
> Thanks,
> Kukjin

^ permalink raw reply	[flat|nested] 42+ messages in thread

end of thread, other threads:[~2013-07-22  3:33 UTC | newest]

Thread overview: 42+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-26 10:15 [PATCH 0/8] ARM: move cpuidle drivers to drivers/cpuidle/ Bartlomiej Zolnierkiewicz
2013-06-26 10:15 ` Bartlomiej Zolnierkiewicz
2013-06-26 10:15 ` [PATCH 1/8] ARM: at91: move cpuidle driver " Bartlomiej Zolnierkiewicz
2013-06-26 10:15   ` Bartlomiej Zolnierkiewicz
2013-06-26 10:15 ` [PATCH 2/8] ARM: davinci: " Bartlomiej Zolnierkiewicz
2013-06-26 10:15   ` Bartlomiej Zolnierkiewicz
2013-06-26 10:15 ` [PATCH 3/8] ARM: imx: move cpuidle drivers " Bartlomiej Zolnierkiewicz
2013-06-26 10:15   ` Bartlomiej Zolnierkiewicz
2013-06-26 10:15 ` [PATCH 4/8] ARM: OMAP: " Bartlomiej Zolnierkiewicz
2013-06-26 10:15   ` Bartlomiej Zolnierkiewicz
2013-06-27  8:06   ` Tony Lindgren
2013-06-27  8:06     ` Tony Lindgren
2013-06-27 17:25     ` Kevin Hilman
2013-06-27 17:25       ` Kevin Hilman
2013-06-27 15:36   ` Santosh Shilimkar
2013-06-27 15:36     ` Santosh Shilimkar
2013-06-26 10:15 ` [PATCH 5/8] ARM: S3C64XX: move cpuidle driver " Bartlomiej Zolnierkiewicz
2013-06-26 10:15   ` Bartlomiej Zolnierkiewicz
2013-07-22  3:33   ` Kukjin Kim
2013-07-22  3:33     ` Kukjin Kim
2013-06-26 10:15 ` [PATCH 6/8] ARM: shmobile: " Bartlomiej Zolnierkiewicz
2013-06-26 10:15   ` Bartlomiej Zolnierkiewicz
2013-06-26 10:15 ` [PATCH 7/8] ARM: tegra: move cpuidle drivers " Bartlomiej Zolnierkiewicz
2013-06-26 10:15   ` Bartlomiej Zolnierkiewicz
2013-06-26 18:24   ` Stephen Warren
2013-06-26 18:24     ` Stephen Warren
2013-06-26 10:15 ` [PATCH 8/8] ARM: ux500: " Bartlomiej Zolnierkiewicz
2013-06-26 10:15   ` Bartlomiej Zolnierkiewicz
2013-06-26 20:42   ` Linus Walleij
2013-06-26 20:42     ` Linus Walleij
2013-06-26 21:28     ` Arnd Bergmann
2013-06-26 21:28       ` Arnd Bergmann
2013-06-26 10:59 ` [PATCH 0/8] ARM: " Daniel Lezcano
2013-06-26 10:59   ` Daniel Lezcano
2013-06-26 12:22   ` Bartlomiej Zolnierkiewicz
2013-06-26 12:22     ` Bartlomiej Zolnierkiewicz
2013-06-26 13:05     ` Daniel Lezcano
2013-06-26 13:05       ` Daniel Lezcano
2013-06-26 14:40       ` Bartlomiej Zolnierkiewicz
2013-06-26 14:40         ` Bartlomiej Zolnierkiewicz
2013-06-26 16:57         ` Daniel Lezcano
2013-06-26 16:57           ` Daniel Lezcano

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.