summaryrefslogtreecommitdiff
path: root/firmware/target/sh/archos/fm_v2/power-fm_v2.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/sh/archos/fm_v2/power-fm_v2.c')
-rw-r--r--firmware/target/sh/archos/fm_v2/power-fm_v2.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/firmware/target/sh/archos/fm_v2/power-fm_v2.c b/firmware/target/sh/archos/fm_v2/power-fm_v2.c
index 32b5c95da9..24bccf6eb2 100644
--- a/firmware/target/sh/archos/fm_v2/power-fm_v2.c
+++ b/firmware/target/sh/archos/fm_v2/power-fm_v2.c
@@ -28,7 +28,6 @@
28#include "usb.h" 28#include "usb.h"
29 29
30#if CONFIG_TUNER 30#if CONFIG_TUNER
31
32bool tuner_power(bool status) 31bool tuner_power(bool status)
33{ 32{
34 (void)status; 33 (void)status;
@@ -44,10 +43,20 @@ void power_init(void)
44 or_b(0x20, &PBDRL); /* hold power */ 43 or_b(0x20, &PBDRL); /* hold power */
45} 44}
46 45
47bool charger_inserted(void) 46unsigned int power_input_status(void)
48{ 47{
48 unsigned int status = POWER_INPUT_NONE;
49
49 /* FM or V2 can also charge from the USB port */ 50 /* FM or V2 can also charge from the USB port */
50 return (adc_read(ADC_CHARGE_REGULATOR) < 0x1FF); 51 if (adc_read(ADC_CHARGE_REGULATOR) < 0x1FF)
52 status = POWER_INPUT_MAIN_CHARGER;
53
54#ifdef HAVE_USB_POWER
55 if (usb_detect() == USB_INSERTED)
56 status |= POWER_INPUT_USB_CHARGER;
57#endif
58
59 return status;
51} 60}
52 61
53/* Returns true if the unit is charging the batteries. */ 62/* Returns true if the unit is charging the batteries. */