summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/drivers/power.c10
-rw-r--r--firmware/export/power.h1
-rw-r--r--firmware/export/powermgmt.h2
-rw-r--r--firmware/powermgmt.c4
4 files changed, 14 insertions, 3 deletions
diff --git a/firmware/drivers/power.c b/firmware/drivers/power.c
index 7f6284d3b7..a76021a5bf 100644
--- a/firmware/drivers/power.c
+++ b/firmware/drivers/power.c
@@ -24,11 +24,19 @@
24#include "power.h" 24#include "power.h"
25 25
26#ifdef HAVE_CHARGE_CTRL 26#ifdef HAVE_CHARGE_CTRL
27bool charger_enabled = 0; 27bool charger_enabled;
28#endif 28#endif
29 29
30#ifndef SIMULATOR 30#ifndef SIMULATOR
31 31
32void power_init(void)
33{
34#ifdef HAVE_CHARGE_CTRL
35 PBIOR |= 0x20; /* Set charging control bit to output */
36 charger_enable(false); /* Default to charger OFF */
37#endif
38}
39
32bool charger_inserted(void) 40bool charger_inserted(void)
33{ 41{
34#ifdef HAVE_CHARGE_CTRL 42#ifdef HAVE_CHARGE_CTRL
diff --git a/firmware/export/power.h b/firmware/export/power.h
index f4e7a0b990..678260ac58 100644
--- a/firmware/export/power.h
+++ b/firmware/export/power.h
@@ -23,6 +23,7 @@
23extern bool charger_enabled; 23extern bool charger_enabled;
24#endif 24#endif
25 25
26void power_init(void);
26bool charger_inserted(void); 27bool charger_inserted(void);
27void charger_enable(bool on); 28void charger_enable(bool on);
28void ide_power_enable(bool on); 29void ide_power_enable(bool on);
diff --git a/firmware/export/powermgmt.h b/firmware/export/powermgmt.h
index 407866741b..4b4d040dcd 100644
--- a/firmware/export/powermgmt.h
+++ b/firmware/export/powermgmt.h
@@ -80,7 +80,7 @@ extern int charge_state; /* tells what the charger is doing (for info di
80extern unsigned short power_history[POWER_HISTORY_LEN]; 80extern unsigned short power_history[POWER_HISTORY_LEN];
81 81
82/* Start up power management thread */ 82/* Start up power management thread */
83void power_init(void); 83void powermgmt_init(void);
84 84
85#endif /* SIMULATOR */ 85#endif /* SIMULATOR */
86 86
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c
index 13043cb88f..78f4a5a3cb 100644
--- a/firmware/powermgmt.c
+++ b/firmware/powermgmt.c
@@ -685,8 +685,10 @@ static void power_thread(void)
685 } 685 }
686} 686}
687 687
688void power_init(void) 688void powermgmt_init(void)
689{ 689{
690 power_init();
691
690 /* init history to 0 */ 692 /* init history to 0 */
691 memset(power_history, 0x00, sizeof(power_history)); 693 memset(power_history, 0x00, sizeof(power_history));
692 /* initialize the history with a single sample to prevent level 694 /* initialize the history with a single sample to prevent level