1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2009 by Michael Sevakis
11 * Copyright (C) 2008 by Bertrik Sikken
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.
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
21 ****************************************************************************/
22 #ifndef POWERMGMT_TARGET_H
23 #define POWERMGMT_TARGET_H
27 #if defined(SANSA_CLIP)
29 /* Check if topped-off and monitor voltage while plugged. */
30 #define BATT_FULL_VOLTAGE 4190
31 #define BATT_VAUTO_RECHARGE 4100
32 #define BATT_CHG_V CHG_V_4_20V
33 #define BATT_CHG_I CHG_I_100MA
34 #define CHARGER_TOTAL_TIMER (6*3600*2) /* about 1.5 * capacity / current */
36 #elif defined(SANSA_CLIPPLUS)
38 /* Check if topped-off and monitor voltage while plugged. */
39 #define BATT_FULL_VOLTAGE 4160
40 #define BATT_VAUTO_RECHARGE 4100
41 #define BATT_CHG_V CHG_V_4_20V
42 #define BATT_CHG_I CHG_I_150MA
43 #define CHARGER_TOTAL_TIMER (4*3600*2) /* about 1.5 * capacity / current */
45 #elif defined(SANSA_CLIPV2)
47 /* Check if topped-off and monitor voltage while plugged. */
48 #define BATT_FULL_VOLTAGE 4200
49 #define BATT_VAUTO_RECHARGE 4100
50 #define BATT_CHG_V CHG_V_4_20V
51 #define BATT_CHG_I CHG_I_150MA
52 #define CHARGER_TOTAL_TIMER (4*3600*2) /* about 1.5 * capacity / current */
54 #elif defined(SANSA_E200V2)
56 /* Check if topped-off and monitor voltage while plugged. */
57 #define BATT_FULL_VOLTAGE 4160
58 #define BATT_VAUTO_RECHARGE 4100
59 #define BATT_CHG_V CHG_V_4_20V
60 #define BATT_CHG_I CHG_I_300MA
61 #define CHARGER_TOTAL_TIMER (4*3600*2)
63 #elif defined(SANSA_FUZE)
65 /* Check if topped-off and monitor voltage while plugged. */
66 #define BATT_FULL_VOLTAGE 4160
67 #define BATT_VAUTO_RECHARGE 4100
68 #define BATT_CHG_V CHG_V_4_20V
69 #define BATT_CHG_I CHG_I_200MA
70 #define CHARGER_TOTAL_TIMER (4*3600*2)
72 #elif defined(SANSA_FUZEV2)
74 /* Check if topped-off and monitor voltage while plugged. */
75 #define BATT_FULL_VOLTAGE 4200
76 #define BATT_VAUTO_RECHARGE 4100
77 #define BATT_CHG_V CHG_V_4_20V
78 #define BATT_CHG_I CHG_I_200MA
79 #define CHARGER_TOTAL_TIMER (4*3600*2)
81 #elif defined(SANSA_C200V2)
83 /* Check if topped-off and monitor voltage while plugged. */
84 #define BATT_FULL_VOLTAGE 4160
85 #define BATT_VAUTO_RECHARGE 4100
86 #define BATT_CHG_V CHG_V_4_20V
87 #define BATT_CHG_I CHG_I_200MA
88 #define CHARGER_TOTAL_TIMER (4*3600*2)
91 #error "Charger settings not defined!"
94 void powermgmt_init_target(void);
95 void charging_algorithm_step(void);
96 void charging_algorithm_close(void);
98 /* We want to be able to reset the averaging filter */
99 #define HAVE_RESET_BATTERY_FILTER
101 #define BATT_AVE_SAMPLES 32
103 #if CONFIG_CPU == AS3525
104 #define ADC_BATTERY ADC_BVDD
106 /* ADC_CHG_IN seems to represent battery voltage better than ADC_BVDD during
107 * charging (ADC_BVDD is way too high) and appears the same in normal use.
108 * Note that when charging some models do not give an accurate reading but jump
109 * between 2 values. */
110 #define ADC_BATTERY ADC_CHG_IN
111 #endif /* CONFIG_CPU */
113 #endif /* POWERMGMT_TARGET_H */