summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Diedrich <ranma+coreboot@tdiedrich.de>2010-04-08 19:31:03 +0000
committerTobias Diedrich <ranma+coreboot@tdiedrich.de>2010-04-08 19:31:03 +0000
commitf7b0224a9c9db8a4b37afe1d16a7f6f7bb5fb0cc (patch)
treeb9235a10f6a8e0302c9a1d6b332e4f0aea8e00df
parent12a6ef5c18a003c3bd066d8c00dd34544b038114 (diff)
downloadrockbox-f7b0224a9c9db8a4b37afe1d16a7f6f7bb5fb0cc.tar.gz
rockbox-f7b0224a9c9db8a4b37afe1d16a7f6f7bb5fb0cc.zip
Added battery profile change to correct file, removed unused powermgmt-as3525.c
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25541 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/target/arm/as3525/powermgmt-as3525.c81
-rw-r--r--firmware/target/arm/as3525/sansa-c200v2/powermgmt-c200v2.c14
2 files changed, 11 insertions, 84 deletions
diff --git a/firmware/target/arm/as3525/powermgmt-as3525.c b/firmware/target/arm/as3525/powermgmt-as3525.c
deleted file mode 100644
index ae65eb5678..0000000000
--- a/firmware/target/arm/as3525/powermgmt-as3525.c
+++ /dev/null
@@ -1,81 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright © 2008 Rafaël Carré
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22#include "config.h"
23#include "adc.h"
24#include "adc-target.h"
25#include "powermgmt.h"
26
27/* TODO
28 Each as3525 target should probably define its own battery properties
29 (dangerous/shutoff battery level, discharge/charge curves) in a file
30 called powermgmt-<target>.c in its own sub-directory.
31
32 For now, this file provides simple uncalibrated settings to get at least
33 a basic reading for all as3525 targets with a lithium battery.
34 */
35
36const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
37{
38 /*
39 * about 10%, calibrated with C240v2 battery profile at
40 * http://www.rockbox.org/wiki/bin/viewfile/Main/SansaRuntime?filename=c240v2_battery_bench_percent.png;rev=1
41 */
42 3600
43};
44
45const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
46{
47 3300
48};
49
50/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */
51const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
52{
53 /*
54 * TODO:
55 * Below table is calibrated for C240v2 according to
56 * http://www.rockbox.org/wiki/bin/viewfile/Main/SansaRuntime?filename=c240v2_battery_bench_percent.png;rev=1
57 * Batteries for other models may have different discharging curves.
58 * OF seems to stop charging at 4150mV, so that's 100% here.
59 */
60 { 3300, 3597, 3674, 3719, 3745, 3776, 3825, 3890, 3954, 4035, 4150 }
61};
62
63#if CONFIG_CHARGING
64/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
65const unsigned short percent_to_volt_charge[11] =
66{
67 /* TODO: simple uncalibrated curve, linear except for first 10% */
68 3300, 3390, 3480, 3570, 3660, 3750, 3840, 3930, 4020, 4110, 4200
69};
70#endif /* CONFIG_CHARGING */
71
72/* ADC should read 0x3ff=5.12V */
73#define BATTERY_SCALE_FACTOR 5125
74/* full-scale ADC readout (2^10) in millivolt */
75
76/* Returns battery voltage from ADC [millivolts] */
77unsigned int battery_adc_voltage(void)
78{
79 return (adc_read(ADC_RTCSUP) * BATTERY_SCALE_FACTOR) >> 10;
80}
81
diff --git a/firmware/target/arm/as3525/sansa-c200v2/powermgmt-c200v2.c b/firmware/target/arm/as3525/sansa-c200v2/powermgmt-c200v2.c
index 395e2a472c..1b661aa555 100644
--- a/firmware/target/arm/as3525/sansa-c200v2/powermgmt-c200v2.c
+++ b/firmware/target/arm/as3525/sansa-c200v2/powermgmt-c200v2.c
@@ -25,7 +25,11 @@
25 25
26const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = 26const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
27{ 27{
28 3400 28 /*
29 * about 10%, calibrated with C240v2 battery profile at
30 * http://www.rockbox.org/wiki/bin/viewfile/Main/SansaRuntime?filename=c240v2_battery_bench_percent.png;rev=3
31 */
32 3600
29}; 33};
30 34
31const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = 35const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
@@ -36,8 +40,12 @@ const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
36/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */ 40/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */
37const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = 41const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
38{ 42{
39 /* TODO: calibrate, copied from powermgmt-c200.c svn r22636 */ 43 /*
40 { 3400, 3689, 3744, 3773, 3798, 3831, 3886, 3947, 4005, 4102, 4220 }, 44 * Below table is calibrated according to
45 * http://www.rockbox.org/wiki/bin/viewfile/Main/SansaRuntime?filename=c240v2_battery_bench_percent.png;rev=3
46 * OF seems to stop charging at 4150mV, so that's 100% here.
47 */
48 { 3300, 3597, 3674, 3719, 3745, 3776, 3825, 3890, 3954, 4035, 4150 }
41}; 49};
42 50
43/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ 51/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */