Skip to content

Commit

Permalink
[RPi/RPi2] linux: Reduce power consumption after shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
warped-rudi committed Apr 24, 2016
1 parent 7ce5523 commit 5016b90
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 2 deletions.
2 changes: 1 addition & 1 deletion config/platforms/arm/bcm2708/packages/linux/meta
Expand Up @@ -3,4 +3,4 @@ PKG_URL="https://github.com/raspberrypi/linux.git"
PKG_URL_REV="1~16c5341"
PKG_URL_BRANCH="rpi-4.1.y"
PKG_VERSION="raspberrypi-4.1.20+${PKG_URL_REV}"
PKG_REV=1
PKG_REV=2
@@ -0,0 +1,47 @@
--- a/arch/arm/kernel/reboot.c 2016-03-24 11:11:55.000000000 +0100
+++ b/arch/arm/kernel/reboot.c 2016-04-24 12:54:02.860639634 +0200
@@ -18,6 +18,17 @@
typedef void (*phys_reset_t)(unsigned long);

/*
+ * Enter non-interruptable CPU halt state
+ */
+static void cpu_halt(void)
+{
+ local_irq_disable();
+
+ while (1)
+ cpu_do_idle();
+}
+
+/*
* Function pointers to optional machine specific functions
*/
void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd);
@@ -105,8 +116,7 @@
local_irq_disable();
smp_send_stop();

- local_irq_disable();
- while (1);
+ cpu_halt();
}

/*
@@ -122,6 +132,8 @@

if (pm_power_off)
pm_power_off();
+
+ cpu_halt();
}

/*
@@ -150,6 +162,5 @@

/* Whoops - the platform was unable to reboot. Tell the user! */
printk("Reboot failed -- System halted\n");
- local_irq_disable();
- while (1);
+ cpu_halt();
}
2 changes: 1 addition & 1 deletion config/platforms/arm/bcm2709/packages/linux/meta
Expand Up @@ -3,4 +3,4 @@ PKG_URL="https://github.com/raspberrypi/linux.git"
PKG_URL_REV="1~16c5341"
PKG_URL_BRANCH="rpi-4.1.y"
PKG_VERSION="raspberrypi-4.1.20+${PKG_URL_REV}"
PKG_REV=1
PKG_REV=2
@@ -0,0 +1,47 @@
--- a/arch/arm/kernel/reboot.c 2016-03-24 11:11:55.000000000 +0100
+++ b/arch/arm/kernel/reboot.c 2016-04-24 12:54:02.860639634 +0200
@@ -18,6 +18,17 @@
typedef void (*phys_reset_t)(unsigned long);

/*
+ * Enter non-interruptable CPU halt state
+ */
+static void cpu_halt(void)
+{
+ local_irq_disable();
+
+ while (1)
+ cpu_do_idle();
+}
+
+/*
* Function pointers to optional machine specific functions
*/
void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd);
@@ -105,8 +116,7 @@
local_irq_disable();
smp_send_stop();

- local_irq_disable();
- while (1);
+ cpu_halt();
}

/*
@@ -122,6 +132,8 @@

if (pm_power_off)
pm_power_off();
+
+ cpu_halt();
}

/*
@@ -150,6 +162,5 @@

/* Whoops - the platform was unable to reboot. Tell the user! */
printk("Reboot failed -- System halted\n");
- local_irq_disable();
- while (1);
+ cpu_halt();
}

0 comments on commit 5016b90

Please sign in to comment.