diff options
-rw-r--r-- | firmware/SOURCES | 9 | ||||
-rwxr-xr-x | firmware/export/config-sa9200.h | 10 | ||||
-rw-r--r-- | firmware/target/arm/philips/sa9200/powermgmt-sa9200.c | 11 | ||||
-rw-r--r-- | firmware/target/arm/philips/sa9200/powermgmt-target.h | 48 |
4 files changed, 61 insertions, 17 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES index 0b6bb155b0..1ee2979f22 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES | |||
@@ -534,16 +534,17 @@ target/arm/sandisk/audio-c200_e200.c | |||
534 | 534 | ||
535 | #ifdef PHILIPS_SA9200 | 535 | #ifdef PHILIPS_SA9200 |
536 | #ifndef SIMULATOR | 536 | #ifndef SIMULATOR |
537 | target/arm/ata-sd-pp.c | ||
538 | target/arm/philips/sa9200/lcd-sa9200.c | ||
539 | target/arm/adc-as3514.c | 537 | target/arm/adc-as3514.c |
540 | target/arm/ascodec-pp.c | 538 | target/arm/ascodec-pp.c |
541 | target/arm/philips/sa9200/backlight-sa9200.c | 539 | target/arm/ata-sd-pp.c |
540 | target/arm/i2s-pp.c | ||
541 | target/arm/powermgmt-ascodec.c | ||
542 | target/arm/usb-fw-pp502x.c | 542 | target/arm/usb-fw-pp502x.c |
543 | target/arm/philips/sa9200/backlight-sa9200.c | ||
543 | target/arm/philips/sa9200/button-sa9200.c | 544 | target/arm/philips/sa9200/button-sa9200.c |
545 | target/arm/philips/sa9200/lcd-sa9200.c | ||
544 | target/arm/philips/sa9200/power-sa9200.c | 546 | target/arm/philips/sa9200/power-sa9200.c |
545 | target/arm/philips/sa9200/powermgmt-sa9200.c | 547 | target/arm/philips/sa9200/powermgmt-sa9200.c |
546 | target/arm/i2s-pp.c | ||
547 | #endif /* SIMULATOR */ | 548 | #endif /* SIMULATOR */ |
548 | #endif /* PHILIPS_SA9200 */ | 549 | #endif /* PHILIPS_SA9200 */ |
549 | 550 | ||
diff --git a/firmware/export/config-sa9200.h b/firmware/export/config-sa9200.h index 3008360414..cbe92bb99c 100755 --- a/firmware/export/config-sa9200.h +++ b/firmware/export/config-sa9200.h | |||
@@ -105,8 +105,14 @@ | |||
105 | #define BATTERY_CAPACITY_INC 0 /* capacity increment */ | 105 | #define BATTERY_CAPACITY_INC 0 /* capacity increment */ |
106 | #define BATTERY_TYPES_COUNT 1 /* only one type */ | 106 | #define BATTERY_TYPES_COUNT 1 /* only one type */ |
107 | 107 | ||
108 | /* Hardware controlled charging? FIXME */ | 108 | /* Charging implemented in a target-specific algorithm */ |
109 | #define CONFIG_CHARGING CHARGING_SIMPLE | 109 | #define CONFIG_CHARGING CHARGING_TARGET |
110 | #define HAVE_POWEROFF_WHILE_CHARGING | ||
111 | |||
112 | /* define current usage levels (copied from the e200v1 )*/ | ||
113 | #define CURRENT_NORMAL 30 /* Toni's measurements in Nov 2008 */ | ||
114 | #define CURRENT_BACKLIGHT 40 /* Screen is about 20, blue LEDs are another 20, so 40 if both */ | ||
115 | #define CURRENT_RECORD 30 /* flash player, so this is just unboosted current*/ | ||
110 | 116 | ||
111 | /* define this if the unit can be powered or charged via USB */ | 117 | /* define this if the unit can be powered or charged via USB */ |
112 | #define HAVE_USB_POWER | 118 | #define HAVE_USB_POWER |
diff --git a/firmware/target/arm/philips/sa9200/powermgmt-sa9200.c b/firmware/target/arm/philips/sa9200/powermgmt-sa9200.c index 43f37463f8..144ca37ebf 100644 --- a/firmware/target/arm/philips/sa9200/powermgmt-sa9200.c +++ b/firmware/target/arm/philips/sa9200/powermgmt-sa9200.c | |||
@@ -47,14 +47,3 @@ const unsigned short percent_to_volt_charge[11] = | |||
47 | /* Sansa Li Ion 750mAH FIXME */ | 47 | /* Sansa Li Ion 750mAH FIXME */ |
48 | 3300, 3680, 3740, 3760, 3780, 3810, 3870, 3930, 3970, 4070, 4160 | 48 | 3300, 3680, 3740, 3760, 3780, 3810, 3870, 3930, 3970, 4070, 4160 |
49 | }; | 49 | }; |
50 | |||
51 | /* ADC should read 0x3ff=5.12V */ | ||
52 | #define BATTERY_SCALE_FACTOR 5125 | ||
53 | /* full-scale ADC readout (2^10) in millivolt */ | ||
54 | |||
55 | /* Returns battery voltage from ADC [millivolts] */ | ||
56 | unsigned int battery_adc_voltage(void) | ||
57 | { | ||
58 | return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10; | ||
59 | } | ||
60 | |||
diff --git a/firmware/target/arm/philips/sa9200/powermgmt-target.h b/firmware/target/arm/philips/sa9200/powermgmt-target.h new file mode 100644 index 0000000000..4400cda5d1 --- /dev/null +++ b/firmware/target/arm/philips/sa9200/powermgmt-target.h | |||
@@ -0,0 +1,48 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2009 by Michael Sevakis | ||
11 | * Copyright (C) 2008 by Bertrik Sikken | ||
12 | * | ||
13 | * This program is free software; you can redistribute it and/or | ||
14 | * modify it under the terms of the GNU General Public License | ||
15 | * as published by the Free Software Foundation; either version 2 | ||
16 | * of the License, or (at your option) any later version. | ||
17 | * | ||
18 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
19 | * KIND, either express or implied. | ||
20 | * | ||
21 | ****************************************************************************/ | ||
22 | #ifndef POWERMGMT_TARGET_H | ||
23 | #define POWERMGMT_TARGET_H | ||
24 | |||
25 | /* NOTE: these values are copied from the Sansa e200v1 */ | ||
26 | |||
27 | /* PREFERRED - Check if topped-off and monitor voltage while plugged. */ | ||
28 | #define BATT_FULL_VOLTAGE 4160 | ||
29 | #define BATT_VAUTO_RECHARGE 4100 | ||
30 | #define BATT_CHG_V CHG_V_4_20V | ||
31 | #define BATT_CHG_I CHG_I_300MA | ||
32 | #define CHARGER_TOTAL_TIMER (4*3600*2) /* 4 hours enough? */ | ||
33 | /* On e200 ADC_RTCSUP seems to represent battery voltage better than | ||
34 | * ADC_BVDD during charging (ADC_BVDD is way too high) and appears the | ||
35 | * same in normal use. | ||
36 | */ | ||
37 | #define ADC_BATTERY ADC_RTCSUP | ||
38 | |||
39 | void powermgmt_init_target(void); | ||
40 | void charging_algorithm_step(void); | ||
41 | void charging_algorithm_close(void); | ||
42 | |||
43 | /* We want to be able to reset the averaging filter */ | ||
44 | #define HAVE_RESET_BATTERY_FILTER | ||
45 | |||
46 | #define BATT_AVE_SAMPLES 32 | ||
47 | |||
48 | #endif /* POWERMGMT_TARGET_H */ | ||