diff options
Diffstat (limited to 'firmware/target/arm/imx31/gigabeat-s/powermgmt-target.h')
-rw-r--r-- | firmware/target/arm/imx31/gigabeat-s/powermgmt-target.h | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/firmware/target/arm/imx31/gigabeat-s/powermgmt-target.h b/firmware/target/arm/imx31/gigabeat-s/powermgmt-target.h new file mode 100644 index 0000000000..8ad4af8d18 --- /dev/null +++ b/firmware/target/arm/imx31/gigabeat-s/powermgmt-target.h | |||
@@ -0,0 +1,114 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 by Michael Sevakis | ||
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 | #ifndef POWERMGMT_TARGET_H | ||
22 | #define POWERMGMT_TARGET_H | ||
23 | |||
24 | /* Can't just run this code willy-nilly. Do not allow charger engagement | ||
25 | * without carefully verifying compatibility. | ||
26 | * | ||
27 | * Things to check: | ||
28 | * 1) Charge path configuration for the PMIC. | ||
29 | * 2) Correct thermistor reading | ||
30 | * 3) Accurate voltage readings | ||
31 | * 4) Accurate current sense for the charge path as the sense resistor may | ||
32 | * deviate from the 0.1 ohms assumed by the charge path regulator. | ||
33 | */ | ||
34 | #ifdef TOSHIBA_GIGABEAT_S | ||
35 | /* | ||
36 | * Gigabeat S qualifications: | ||
37 | * 1) Setup for dual-supply mode with separate inputs and providing USB | ||
38 | * charging capability through external components. | ||
39 | * 2) Curve obtained experimentally - extreme deviation from "optimized" | ||
40 | * characteristics. | ||
41 | * 3) Verified at battery terminals - no deviation from datasheet formula. | ||
42 | * 4) 0.316 ohms <=?? - verified by comparitive current readings on device | ||
43 | * with ammeter readings and measurement of on-board components. | ||
44 | */ | ||
45 | #ifndef BOOTLOADER | ||
46 | #define IMX31_ALLOW_CHARGING | ||
47 | #endif | ||
48 | |||
49 | #else | ||
50 | #warning This iMX31 target requires validation of charging algorithm - charging disabled | ||
51 | #endif | ||
52 | |||
53 | #define BATT_VTRICKLE_CHARGE 2900 /* Must charge slowly */ | ||
54 | #define BATT_VSLOW_CHARGE 3500 /* Lower-current charge mode below | ||
55 | * this level */ | ||
56 | #define BATT_VAUTO_RECHARGE 4100 /* When to begin another cycle */ | ||
57 | #define BATT_USB_VAUTO_RECHARGE 4000 /* When to cycle with USB only */ | ||
58 | #define BATT_USB_VSTOP 4140 /* When to "stop" when USB only */ | ||
59 | #define BATT_TOO_LOW 2400 /* No battery? Short? Can't | ||
60 | read below 2400mV. */ | ||
61 | #define CHARGER_TOTAL_TIMER 300 /* minutes */ | ||
62 | |||
63 | /* .316 ohms is closest standard value as measured in 1% tolerance - adjust | ||
64 | * relative to .100 ohm which is what the PMIC is "tuned" for. */ | ||
65 | #define ILEVEL_ADJUST_IN(I) (100*(I) / 316) | ||
66 | #define ILEVEL_ADJUST_OUT(I) (316*(I) / 100) | ||
67 | |||
68 | /* Relative draw to battery capacity - adjusted for sense resistor */ | ||
69 | #define BATTERY_ICHARGE_COMPLETE (505*9/100) /* 9% of nominal max output */ | ||
70 | /* All charging modes use 4.200V for regulator */ | ||
71 | #define BATTERY_VCHARGING MC13783_VCHRG_4_200V | ||
72 | /* Slow charging - MAIN - Still below 3.5V (avoid excessive reg. dissipation) */ | ||
73 | /* #define BATTERY_ISLOW */ | ||
74 | /* Fast charging - MAIN */ | ||
75 | #define BATTERY_IFAST MC13783_ICHRG_1596MA /* 505mA */ | ||
76 | /* Trickle charging low battery - MAIN (~10% Imax) */ | ||
77 | #define BATTERY_ITRICKLE MC13783_ICHRG_177MA /* 56mA */ | ||
78 | /* Slow charging - USB - Still below 3.5V (avoid excessive reg. dissipation) */ | ||
79 | /* #define BATTERY_ISLOW_USB */ | ||
80 | /* Fast charging - USB */ | ||
81 | #define BATTERY_IFAST_USB MC13783_ICHRG_1152MA /* 365mA */ | ||
82 | /* Trickle charging low battery - USB (Ibat = Icccv - Idevice) */ | ||
83 | #define BATTERY_ITRICKLE_USB MC13783_ICHRG_532MA /* 168mA */ | ||
84 | /* Maintain charge - USB 500mA */ | ||
85 | #define BATTERY_IFLOAT_USB MC13783_ICHRG_1152MA /* 365mA */ | ||
86 | #define BATTERY_VFLOAT_USB MC13783_VCHRG_4_150V | ||
87 | /* Maintain charge - USB 100mA */ | ||
88 | #define BATTERY_IMAINTAIN_USB MC13783_ICHRG_266MA /* 84mA */ | ||
89 | #define BATTERY_VMAINTAIN_USB MC13783_VCHRG_4_150V | ||
90 | |||
91 | /* Battery filter lengths in samples */ | ||
92 | #define BATT_AVE_SAMPLES 32 | ||
93 | #define ICHARGER_AVE_SAMPLES 32 | ||
94 | |||
95 | /* Provide filtered charge current */ | ||
96 | int battery_charge_current(void); | ||
97 | |||
98 | #ifndef SIMULATOR | ||
99 | /* Indicate various functions that require implementation at the target level. | ||
100 | * This is because the battery could be low or the battery switch is off but | ||
101 | * with the main charger attached which implies safe power for anything. The | ||
102 | * true battery reading is always reported for voltage readings and not the | ||
103 | * value at the application supply. */ | ||
104 | #define TARGET_QUERY_FORCE_SHUTDOWN | ||
105 | |||
106 | /* For this the application supply is read out if the charger is attached or | ||
107 | * the battery read if not (completely hardware selected at BP). */ | ||
108 | #define TARGET_BATTERY_LEVEL_SAFE | ||
109 | |||
110 | /* The state should be adjusted to CHARGING or DISCHARGING */ | ||
111 | #define TARGET_POWERMGMT_FILTER_CHARGE_STATE | ||
112 | #endif /* SIMULATOR */ | ||
113 | |||
114 | #endif /* POWERMGMT_TARGET_H */ | ||