summaryrefslogtreecommitdiff
path: root/firmware/powermgmt.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/powermgmt.c')
-rw-r--r--firmware/powermgmt.c22
1 files changed, 5 insertions, 17 deletions
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c
index d30a31897e..42366b0b24 100644
--- a/firmware/powermgmt.c
+++ b/firmware/powermgmt.c
@@ -66,6 +66,7 @@
66 66
67#if defined(IAUDIO_X5) && !defined (SIMULATOR) 67#if defined(IAUDIO_X5) && !defined (SIMULATOR)
68#include "pcf50606.h" 68#include "pcf50606.h"
69#include "lcd-remote-target.h"
69#endif 70#endif
70 71
71/* 72/*
@@ -317,7 +318,7 @@ int pid_i = 0; /* PID integral term */
317static unsigned int avgbat; /* average battery voltage (filtering) */ 318static unsigned int avgbat; /* average battery voltage (filtering) */
318static unsigned int battery_centivolts;/* filtered battery voltage, centvolts */ 319static unsigned int battery_centivolts;/* filtered battery voltage, centvolts */
319#ifdef HAVE_CHARGE_CTRL 320#ifdef HAVE_CHARGE_CTRL
320#define BATT_AVE_SAMPLES 32 /* filter constant / @ 2Hz sample rate */ 321#define BATT_AVE_SAMPLES 32 /* filter constant / @ 2Hz sample rate */
321#elif CONFIG_BATTERY == BATT_LIPOL1300 322#elif CONFIG_BATTERY == BATT_LIPOL1300
322#define BATT_AVE_SAMPLES 128 /* slow filter for iriver */ 323#define BATT_AVE_SAMPLES 128 /* slow filter for iriver */
323#else 324#else
@@ -723,26 +724,17 @@ static int runcurrent(void)
723#endif 724#endif
724 725
725#if defined(HAVE_RECORDING) && defined(CURRENT_RECORD) 726#if defined(HAVE_RECORDING) && defined(CURRENT_RECORD)
726#if CONFIG_CODEC == SWCODEC 727 if (audio_status() & AUDIO_STATUS_RECORD)
727 unsigned int audio_stat = pcm_rec_status();
728#else
729 int audio_stat = audio_status();
730#endif
731 if (audio_stat & AUDIO_STATUS_RECORD)
732 current += CURRENT_RECORD; 728 current += CURRENT_RECORD;
733#endif 729#endif
734 730
735#ifdef HAVE_SPDIF_POWER 731#ifdef HAVE_SPDIF_POWER
736#ifdef SPDIF_POWER_INVERTED 732 if (spdif_powered())
737 if (GPIO1_OUT & 0x01000000)
738#else
739 if (!(GPIO1_OUT & 0x01000000))
740#endif
741 current += CURRENT_SPDIF_OUT; 733 current += CURRENT_SPDIF_OUT;
742#endif 734#endif
743 735
744#ifdef HAVE_REMOTE_LCD 736#ifdef HAVE_REMOTE_LCD
745 if ((GPIO_READ & 0x40000000) == 0) 737 if (remote_detect())
746 current += CURRENT_REMOTE; 738 current += CURRENT_REMOTE;
747#endif 739#endif
748 740
@@ -1271,11 +1263,7 @@ void sys_poweroff(void)
1271 power off after an 20 second timeout */ 1263 power off after an 20 second timeout */
1272 shutdown_timeout = HZ*20; 1264 shutdown_timeout = HZ*20;
1273#if defined(HAVE_RECORDING) 1265#if defined(HAVE_RECORDING)
1274#if CONFIG_CODEC == SWCODEC
1275 unsigned int audio_stat = pcm_rec_status();
1276#else
1277 int audio_stat = audio_status(); 1266 int audio_stat = audio_status();
1278#endif
1279 if (audio_stat & AUDIO_STATUS_RECORD) { 1267 if (audio_stat & AUDIO_STATUS_RECORD) {
1280 audio_stop_recording(); 1268 audio_stop_recording();
1281 shutdown_timeout += 8*HZ; 1269 shutdown_timeout += 8*HZ;