Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f69e44b2 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files

Merge branch 'pm-cpuidle-next' into linux-next

* pm-cpuidle-next:
  cpuidle: imx6: remove timer broadcast initialization
  cpuidle: OMAP4: remove timer broadcast initialization
  cpuidle: ux500: remove timer broadcast initialization
  cpuidle: initialize the broadcast timer framework
  timer: move enum definition out of ifdef section
  cpuidle: kirkwood: fix coccicheck warnings
  cpuidle / kirkwood: remove redundant Kconfig option
  cpuidle / ux500 : use CPUIDLE_FLAG_TIMER_STOP flag
  cpuidle / imx6 : use CPUIDLE_FLAG_TIMER_STOP flag
  cpuidle / omap4 : use CPUIDLE_FLAG_TIMER_STOP flag
  cpuidle : handle clockevent notify from the cpuidle framework
parents 0f0c8aa0 b6269efb
Loading
Loading
Loading
Loading
+0 −1
Original line number Original line Diff line number Diff line
@@ -56,7 +56,6 @@ CONFIG_AEABI=y
CONFIG_ZBOOT_ROM_TEXT=0x0
CONFIG_ZBOOT_ROM_TEXT=0x0
CONFIG_ZBOOT_ROM_BSS=0x0
CONFIG_ZBOOT_ROM_BSS=0x0
CONFIG_CPU_IDLE=y
CONFIG_CPU_IDLE=y
CONFIG_CPU_IDLE_KIRKWOOD=y
CONFIG_NET=y
CONFIG_NET=y
CONFIG_PACKET=y
CONFIG_PACKET=y
CONFIG_UNIX=y
CONFIG_UNIX=y
+2 −21
Original line number Original line Diff line number Diff line
@@ -6,7 +6,6 @@
 * published by the Free Software Foundation.
 * published by the Free Software Foundation.
 */
 */


#include <linux/clockchips.h>
#include <linux/cpuidle.h>
#include <linux/cpuidle.h>
#include <linux/module.h>
#include <linux/module.h>
#include <asm/cpuidle.h>
#include <asm/cpuidle.h>
@@ -21,10 +20,6 @@ static DEFINE_SPINLOCK(master_lock);
static int imx6q_enter_wait(struct cpuidle_device *dev,
static int imx6q_enter_wait(struct cpuidle_device *dev,
			    struct cpuidle_driver *drv, int index)
			    struct cpuidle_driver *drv, int index)
{
{
	int cpu = dev->cpu;

	clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &cpu);

	if (atomic_inc_return(&master) == num_online_cpus()) {
	if (atomic_inc_return(&master) == num_online_cpus()) {
		/*
		/*
		 * With this lock, we prevent other cpu to exit and enter
		 * With this lock, we prevent other cpu to exit and enter
@@ -43,22 +38,10 @@ static int imx6q_enter_wait(struct cpuidle_device *dev,
	cpu_do_idle();
	cpu_do_idle();
done:
done:
	atomic_dec(&master);
	atomic_dec(&master);
	clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &cpu);


	return index;
	return index;
}
}


/*
 * For each cpu, setup the broadcast timer because local timer
 * stops for the states other than WFI.
 */
static void imx6q_setup_broadcast_timer(void *arg)
{
	int cpu = smp_processor_id();

	clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ON, &cpu);
}

static struct cpuidle_driver imx6q_cpuidle_driver = {
static struct cpuidle_driver imx6q_cpuidle_driver = {
	.name = "imx6q_cpuidle",
	.name = "imx6q_cpuidle",
	.owner = THIS_MODULE,
	.owner = THIS_MODULE,
@@ -70,7 +53,8 @@ static struct cpuidle_driver imx6q_cpuidle_driver = {
		{
		{
			.exit_latency = 50,
			.exit_latency = 50,
			.target_residency = 75,
			.target_residency = 75,
			.flags = CPUIDLE_FLAG_TIME_VALID,
			.flags = CPUIDLE_FLAG_TIME_VALID |
			         CPUIDLE_FLAG_TIMER_STOP,
			.enter = imx6q_enter_wait,
			.enter = imx6q_enter_wait,
			.name = "WAIT",
			.name = "WAIT",
			.desc = "Clock off",
			.desc = "Clock off",
@@ -88,8 +72,5 @@ int __init imx6q_cpuidle_init(void)
	/* Set chicken bit to get a reliable WAIT mode support */
	/* Set chicken bit to get a reliable WAIT mode support */
	imx6q_set_chicken_bit();
	imx6q_set_chicken_bit();


	/* Configure the broadcast timer on each cpu */
	on_each_cpu(imx6q_setup_broadcast_timer, NULL, 1);

	return imx_cpuidle_init(&imx6q_cpuidle_driver);
	return imx_cpuidle_init(&imx6q_cpuidle_driver);
}
}
+4 −21
Original line number Original line Diff line number Diff line
@@ -14,7 +14,6 @@
#include <linux/cpuidle.h>
#include <linux/cpuidle.h>
#include <linux/cpu_pm.h>
#include <linux/cpu_pm.h>
#include <linux/export.h>
#include <linux/export.h>
#include <linux/clockchips.h>


#include <asm/proc-fns.h>
#include <asm/proc-fns.h>


@@ -82,7 +81,6 @@ static int omap4_enter_idle_coupled(struct cpuidle_device *dev,
			int index)
			int index)
{
{
	struct omap4_idle_statedata *cx = &omap4_idle_data[index];
	struct omap4_idle_statedata *cx = &omap4_idle_data[index];
	int cpu_id = smp_processor_id();


	local_fiq_disable();
	local_fiq_disable();


@@ -109,8 +107,6 @@ static int omap4_enter_idle_coupled(struct cpuidle_device *dev,
		}
		}
	}
	}


	clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &cpu_id);

	/*
	/*
	 * Call idle CPU PM enter notifier chain so that
	 * Call idle CPU PM enter notifier chain so that
	 * VFP and per CPU interrupt context is saved.
	 * VFP and per CPU interrupt context is saved.
@@ -152,8 +148,6 @@ static int omap4_enter_idle_coupled(struct cpuidle_device *dev,
	if (omap4_mpuss_read_prev_context_state())
	if (omap4_mpuss_read_prev_context_state())
		cpu_cluster_pm_exit();
		cpu_cluster_pm_exit();


	clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &cpu_id);

fail:
fail:
	cpuidle_coupled_parallel_barrier(dev, &abort_barrier);
	cpuidle_coupled_parallel_barrier(dev, &abort_barrier);
	cpu_done[dev->cpu] = false;
	cpu_done[dev->cpu] = false;
@@ -163,16 +157,6 @@ static int omap4_enter_idle_coupled(struct cpuidle_device *dev,
	return index;
	return index;
}
}


/*
 * For each cpu, setup the broadcast timer because local timers
 * stops for the states above C1.
 */
static void omap_setup_broadcast_timer(void *arg)
{
	int cpu = smp_processor_id();
	clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ON, &cpu);
}

static DEFINE_PER_CPU(struct cpuidle_device, omap4_idle_dev);
static DEFINE_PER_CPU(struct cpuidle_device, omap4_idle_dev);


static struct cpuidle_driver omap4_idle_driver = {
static struct cpuidle_driver omap4_idle_driver = {
@@ -193,7 +177,8 @@ static struct cpuidle_driver omap4_idle_driver = {
			/* C2 - CPU0 OFF + CPU1 OFF + MPU CSWR */
			/* C2 - CPU0 OFF + CPU1 OFF + MPU CSWR */
			.exit_latency = 328 + 440,
			.exit_latency = 328 + 440,
			.target_residency = 960,
			.target_residency = 960,
			.flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_COUPLED,
			.flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_COUPLED |
			         CPUIDLE_FLAG_TIMER_STOP,
			.enter = omap4_enter_idle_coupled,
			.enter = omap4_enter_idle_coupled,
			.name = "C2",
			.name = "C2",
			.desc = "MPUSS CSWR",
			.desc = "MPUSS CSWR",
@@ -202,7 +187,8 @@ static struct cpuidle_driver omap4_idle_driver = {
			/* C3 - CPU0 OFF + CPU1 OFF + MPU OSWR */
			/* C3 - CPU0 OFF + CPU1 OFF + MPU OSWR */
			.exit_latency = 460 + 518,
			.exit_latency = 460 + 518,
			.target_residency = 1100,
			.target_residency = 1100,
			.flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_COUPLED,
			.flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_COUPLED |
			         CPUIDLE_FLAG_TIMER_STOP,
			.enter = omap4_enter_idle_coupled,
			.enter = omap4_enter_idle_coupled,
			.name = "C3",
			.name = "C3",
			.desc = "MPUSS OSWR",
			.desc = "MPUSS OSWR",
@@ -236,9 +222,6 @@ int __init omap4_idle_init(void)
	if (!cpu_clkdm[0] || !cpu_clkdm[1])
	if (!cpu_clkdm[0] || !cpu_clkdm[1])
		return -ENODEV;
		return -ENODEV;


	/* Configure the broadcast timer on each cpu */
	on_each_cpu(omap_setup_broadcast_timer, NULL, 1);

	for_each_cpu(cpu_id, cpu_online_mask) {
	for_each_cpu(cpu_id, cpu_online_mask) {
		dev = &per_cpu(omap4_idle_dev, cpu_id);
		dev = &per_cpu(omap4_idle_dev, cpu_id);
		dev->cpu = cpu_id;
		dev->cpu = cpu_id;
+2 −23
Original line number Original line Diff line number Diff line
@@ -11,7 +11,6 @@


#include <linux/module.h>
#include <linux/module.h>
#include <linux/cpuidle.h>
#include <linux/cpuidle.h>
#include <linux/clockchips.h>
#include <linux/spinlock.h>
#include <linux/spinlock.h>
#include <linux/atomic.h>
#include <linux/atomic.h>
#include <linux/smp.h>
#include <linux/smp.h>
@@ -30,8 +29,6 @@ static inline int ux500_enter_idle(struct cpuidle_device *dev,
	int this_cpu = smp_processor_id();
	int this_cpu = smp_processor_id();
	bool recouple = false;
	bool recouple = false;


	clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &this_cpu);

	if (atomic_inc_return(&master) == num_online_cpus()) {
	if (atomic_inc_return(&master) == num_online_cpus()) {


		/* With this lock, we prevent the other cpu to exit and enter
		/* With this lock, we prevent the other cpu to exit and enter
@@ -91,8 +88,6 @@ static inline int ux500_enter_idle(struct cpuidle_device *dev,
		spin_unlock(&master_lock);
		spin_unlock(&master_lock);
	}
	}


	clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &this_cpu);

	return index;
	return index;
}
}


@@ -106,7 +101,8 @@ static struct cpuidle_driver ux500_idle_driver = {
			.enter		  = ux500_enter_idle,
			.enter		  = ux500_enter_idle,
			.exit_latency	  = 70,
			.exit_latency	  = 70,
			.target_residency = 260,
			.target_residency = 260,
			.flags		  = CPUIDLE_FLAG_TIME_VALID,
			.flags		  = CPUIDLE_FLAG_TIME_VALID |
			                    CPUIDLE_FLAG_TIMER_STOP,
			.name		  = "ApIdle",
			.name		  = "ApIdle",
			.desc		  = "ARM Retention",
			.desc		  = "ARM Retention",
		},
		},
@@ -115,16 +111,6 @@ static struct cpuidle_driver ux500_idle_driver = {
	.state_count = 2,
	.state_count = 2,
};
};


/*
 * For each cpu, setup the broadcast timer because we will
 * need to migrate the timers for the states >= ApIdle.
 */
static void ux500_setup_broadcast_timer(void *arg)
{
	int cpu = smp_processor_id();
	clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ON, &cpu);
}

int __init ux500_idle_init(void)
int __init ux500_idle_init(void)
{
{
	int ret, cpu;
	int ret, cpu;
@@ -134,13 +120,6 @@ int __init ux500_idle_init(void)
	prcmu_enable_wakeups(PRCMU_WAKEUP(ARM) | PRCMU_WAKEUP(RTC) |
	prcmu_enable_wakeups(PRCMU_WAKEUP(ARM) | PRCMU_WAKEUP(RTC) |
			     PRCMU_WAKEUP(ABB));
			     PRCMU_WAKEUP(ABB));


	/*
	 * Configure the timer broadcast for each cpu, that must
	 * be done from the cpu context, so we use a smp cross
	 * call with 'on_each_cpu'.
	 */
	on_each_cpu(ux500_setup_broadcast_timer, NULL, 1);

	ret = cpuidle_register_driver(&ux500_idle_driver);
	ret = cpuidle_register_driver(&ux500_idle_driver);
	if (ret) {
	if (ret) {
		printk(KERN_ERR "failed to register ux500 idle driver\n");
		printk(KERN_ERR "failed to register ux500 idle driver\n");
+0 −6
Original line number Original line Diff line number Diff line
@@ -39,10 +39,4 @@ config CPU_IDLE_CALXEDA
	help
	help
	  Select this to enable cpuidle on Calxeda processors.
	  Select this to enable cpuidle on Calxeda processors.


config CPU_IDLE_KIRKWOOD
	bool "CPU Idle Driver for Kirkwood processors"
	depends on ARCH_KIRKWOOD
	help
	  Select this to enable cpuidle on Kirkwood processors.

endif
endif
Loading