First step of powermanagement rework: * Move target specific stuff into target tree, starting with battery voltage tables and voltage reading. (This revealed some incorrect percent_to_voltage_charging mappings). * Voltage reading on 1st gen ipods is now correct. * Clean up obsolete config #defines.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14375 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
12706e4b1d
commit
0fac492c3d
46 changed files with 948 additions and 289 deletions
|
@ -104,13 +104,11 @@ void shutdown(void)
|
|||
/* Print the battery voltage (and a warning message). */
|
||||
void check_battery(void)
|
||||
{
|
||||
int adc_battery, battery_voltage, batt_int, batt_frac;
|
||||
int battery_voltage, batt_int, batt_frac;
|
||||
|
||||
adc_battery = adc_read(ADC_BATTERY);
|
||||
|
||||
battery_voltage = (adc_battery * BATTERY_SCALE_FACTOR) / 10000;
|
||||
batt_int = battery_voltage / 100;
|
||||
batt_frac = battery_voltage % 100;
|
||||
battery_voltage = battery_adc_voltage();
|
||||
batt_int = battery_voltage / 1000;
|
||||
batt_frac = (battery_voltage % 1000) / 10;
|
||||
|
||||
printf("Batt: %d.%02dV", batt_int, batt_frac);
|
||||
|
||||
|
|
|
@ -109,13 +109,11 @@ void shutdown(void)
|
|||
/* Print the battery voltage (and a warning message). */
|
||||
void check_battery(void)
|
||||
{
|
||||
int adc_battery, battery_voltage, batt_int, batt_frac;
|
||||
int battery_voltage, batt_int, batt_frac;
|
||||
|
||||
adc_battery = adc_read(ADC_BATTERY);
|
||||
|
||||
battery_voltage = (adc_battery * BATTERY_SCALE_FACTOR) / 10000;
|
||||
batt_int = battery_voltage / 100;
|
||||
batt_frac = battery_voltage % 100;
|
||||
battery_voltage = battery_adc_voltage();
|
||||
batt_int = battery_voltage / 1000;
|
||||
batt_frac = (battery_voltage % 1000) / 10;
|
||||
|
||||
printf("Batt: %d.%02dV", batt_int, batt_frac);
|
||||
|
||||
|
|
|
@ -167,13 +167,11 @@ void shutdown(void)
|
|||
/* Print the battery voltage (and a warning message). */
|
||||
void check_battery(void)
|
||||
{
|
||||
int adc_battery, battery_voltage, batt_int, batt_frac;
|
||||
int battery_voltage, batt_int, batt_frac;
|
||||
|
||||
adc_battery = adc_read(ADC_BATTERY);
|
||||
|
||||
battery_voltage = (adc_battery * BATTERY_SCALE_FACTOR) / 10000;
|
||||
batt_int = battery_voltage / 100;
|
||||
batt_frac = battery_voltage % 100;
|
||||
battery_voltage = battery_adc_voltage();
|
||||
batt_int = battery_voltage / 1000;
|
||||
batt_frac = (battery_voltage % 1000) / 10;
|
||||
|
||||
printf("Batt: %d.%02dV", batt_int, batt_frac);
|
||||
|
||||
|
|
|
@ -338,6 +338,7 @@ target/sh/archos/player/hwcompat-player.c
|
|||
target/sh/archos/player/lcd-as-player.S
|
||||
target/sh/archos/player/lcd-player.c
|
||||
target/sh/archos/player/power-player.c
|
||||
target/sh/archos/player/powermgmt-player.c
|
||||
target/sh/archos/player/usb-player.c
|
||||
#endif /* SIMULATOR */
|
||||
#endif /* ARCHOS_PLAYER */
|
||||
|
@ -350,6 +351,7 @@ target/sh/archos/lcd-archos-bitmap.c
|
|||
target/sh/archos/lcd-as-archos-bitmap.S
|
||||
target/sh/archos/recorder/button-recorder.c
|
||||
target/sh/archos/recorder/power-recorder.c
|
||||
target/sh/archos/recorder/powermgmt-recorder.c
|
||||
target/sh/archos/recorder/usb-recorder.c
|
||||
#endif /* SIMULATOR */
|
||||
#endif /* ARCHOS_RECORDER */
|
||||
|
@ -362,6 +364,7 @@ target/sh/archos/lcd-archos-bitmap.c
|
|||
target/sh/archos/lcd-as-archos-bitmap.S
|
||||
target/sh/archos/fm_v2/button-fm_v2.c
|
||||
target/sh/archos/fm_v2/power-fm_v2.c
|
||||
target/sh/archos/fm_v2/powermgmt-fm_v2.c
|
||||
target/sh/archos/fm_v2/usb-fm_v2.c
|
||||
#endif /* SIMULATOR */
|
||||
#endif /* ARCHOS_FMRECORDER || ARCHOS_RECORDERV2 */
|
||||
|
@ -372,6 +375,7 @@ target/sh/archos/lcd-archos-bitmap.c
|
|||
target/sh/archos/lcd-as-archos-bitmap.S
|
||||
target/sh/archos/ondio/button-ondio.c
|
||||
target/sh/archos/ondio/power-ondio.c
|
||||
target/sh/archos/ondio/powermgmt-ondio.c
|
||||
target/sh/archos/ondio/usb-ondio.c
|
||||
#endif /* SIMULATOR */
|
||||
#endif /* ARCHOS_ONDIOFM || ARCHOS_ONDIOFM */
|
||||
|
@ -386,6 +390,7 @@ target/arm/sandisk/sansa-e200/backlight-e200.c
|
|||
target/arm/usb-fw-pp502x.c
|
||||
target/arm/sandisk/sansa-e200/button-e200.c
|
||||
target/arm/sandisk/sansa-e200/power-e200.c
|
||||
target/arm/sandisk/sansa-e200/powermgmt-e200.c
|
||||
target/arm/i2s-pp.c
|
||||
#ifndef BOOTLOADER
|
||||
target/arm/sandisk/sansa-e200/audio-e200.c
|
||||
|
@ -401,6 +406,7 @@ target/coldfire/iaudio/adc-iaudio.c
|
|||
target/coldfire/iaudio/ata-iaudio.c
|
||||
target/coldfire/iaudio/lcd-remote-iaudio.c
|
||||
target/coldfire/iaudio/pcf50606-iaudio.c
|
||||
target/coldfire/iaudio/powermgmt-iaudio.c
|
||||
target/coldfire/iaudio/system-iaudio.c
|
||||
target/coldfire/iaudio/usb-iaudio.c
|
||||
target/coldfire/iaudio/x5/backlight-x5.c
|
||||
|
@ -429,6 +435,7 @@ target/coldfire/iaudio/m5/lcd-as-m5.S
|
|||
target/coldfire/iaudio/m5/lcd-m5.c
|
||||
target/coldfire/iaudio/m5/power-m5.c
|
||||
target/coldfire/iaudio/pcf50606-iaudio.c
|
||||
target/coldfire/iaudio/powermgmt-iaudio.c
|
||||
target/coldfire/iaudio/system-iaudio.c
|
||||
target/coldfire/iaudio/usb-iaudio.c
|
||||
#ifndef BOOTLOADER
|
||||
|
@ -459,6 +466,7 @@ target/coldfire/iriver/h300/pcf50606-h300.c
|
|||
target/coldfire/iriver/h300/lcd-as-h300.S
|
||||
target/coldfire/iriver/h300/lcd-h300.c
|
||||
target/coldfire/iriver/h300/power-h300.c
|
||||
target/coldfire/iriver/h300/powermgmt-h300.c
|
||||
target/coldfire/iriver/h300/usb-h300.c
|
||||
#ifndef BOOTLOADER
|
||||
target/coldfire/iriver/audio-iriver.c
|
||||
|
@ -479,6 +487,7 @@ target/coldfire/iriver/h100/button-h100.c
|
|||
target/coldfire/iriver/h100/lcd-as-h100.S
|
||||
target/coldfire/iriver/h100/lcd-h100.c
|
||||
target/coldfire/iriver/h100/power-h100.c
|
||||
target/coldfire/iriver/h100/powermgmt-h100.c
|
||||
#ifndef BOOTLOADER
|
||||
target/coldfire/iriver/audio-iriver.c
|
||||
target/coldfire/iriver/h100/spdif-h100.c
|
||||
|
@ -498,6 +507,7 @@ target/arm/iriver/h10/backlight-h10.c
|
|||
target/arm/iriver/h10/button-h10.c
|
||||
target/arm/iriver/h10/lcd-h10_20gb.c
|
||||
target/arm/iriver/h10/power-h10.c
|
||||
target/arm/iriver/h10/powermgmt-h10.c
|
||||
target/arm/usb-fw-pp502x.c
|
||||
#endif /* SIMULATOR */
|
||||
#endif /* IRIVER_H10 */
|
||||
|
@ -513,6 +523,7 @@ target/arm/iriver/h10/backlight-h10.c
|
|||
target/arm/iriver/h10/button-h10.c
|
||||
target/arm/iriver/h10/lcd-h10_5gb.c
|
||||
target/arm/iriver/h10/power-h10.c
|
||||
target/arm/iriver/h10/powermgmt-h10.c
|
||||
target/arm/usb-fw-pp502x.c
|
||||
#endif /* SIMULATOR */
|
||||
#endif /* IRIVER_H10_5GB */
|
||||
|
@ -528,6 +539,7 @@ target/arm/s3c2440/gigabeat-fx/kernel-meg-fx.c
|
|||
target/arm/s3c2440/gigabeat-fx/lcd-as-meg-fx.S
|
||||
target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c
|
||||
target/arm/s3c2440/gigabeat-fx/power-meg-fx.c
|
||||
target/arm/s3c2440/gigabeat-fx/powermgmt-meg-fx.c
|
||||
target/arm/s3c2440/gigabeat-fx/sc606-meg-fx.c
|
||||
target/arm/s3c2440/gigabeat-fx/timer-meg-fx.c
|
||||
target/arm/s3c2440/gigabeat-fx/usb-meg-fx.c
|
||||
|
@ -552,6 +564,7 @@ target/arm/tatung/tpj1022/backlight-tpj1022.c
|
|||
target/arm/tatung/tpj1022/button-tpj1022.c
|
||||
target/arm/tatung/tpj1022/lcd-tpj1022.c
|
||||
target/arm/tatung/tpj1022/power-tpj1022.c
|
||||
target/arm/tatung/tpj1022/powermgmt-tpj1022.c
|
||||
target/arm/usb-fw-pp502x.c
|
||||
#endif /* SIMULATOR */
|
||||
#endif /* ELIO_TPJ1022 */
|
||||
|
@ -568,6 +581,7 @@ target/arm/ipod/backlight-4g_color.c
|
|||
target/arm/ipod/button-clickwheel.c
|
||||
target/arm/ipod/lcd-gray.c
|
||||
target/arm/ipod/power-ipod.c
|
||||
target/arm/ipod/powermgmt-ipod-pcf.c
|
||||
target/arm/usb-fw-pp502x.c
|
||||
#endif /* SIMULATOR */
|
||||
#endif /* IPOD_4G */
|
||||
|
@ -584,6 +598,7 @@ target/arm/ipod/backlight-4g_color.c
|
|||
target/arm/ipod/button-clickwheel.c
|
||||
target/arm/ipod/lcd-color_nano.c
|
||||
target/arm/ipod/power-ipod.c
|
||||
target/arm/ipod/powermgmt-ipod-pcf.c
|
||||
target/arm/usb-fw-pp502x.c
|
||||
#endif /* SIMULATOR */
|
||||
#endif /* IPOD_COLOR */
|
||||
|
@ -600,6 +615,7 @@ target/arm/ipod/backlight-nano_video.c
|
|||
target/arm/ipod/button-clickwheel.c
|
||||
target/arm/ipod/lcd-color_nano.c
|
||||
target/arm/ipod/power-ipod.c
|
||||
target/arm/ipod/powermgmt-ipod-pcf.c
|
||||
target/arm/usb-fw-pp502x.c
|
||||
#endif /* SIMULATOR */
|
||||
#endif /* IPOD_NANO */
|
||||
|
@ -615,6 +631,7 @@ target/arm/ipod/adc-ipod-pcf.c
|
|||
target/arm/ipod/backlight-nano_video.c
|
||||
target/arm/ipod/button-clickwheel.c
|
||||
target/arm/ipod/power-ipod.c
|
||||
target/arm/ipod/powermgmt-ipod-pcf.c
|
||||
target/arm/ipod/video/lcd-video.c
|
||||
target/arm/usb-fw-pp502x.c
|
||||
#endif /* SIMULATOR */
|
||||
|
@ -631,6 +648,7 @@ target/arm/ipod/3g/backlight-3g.c
|
|||
target/arm/ipod/button-1g-3g.c
|
||||
target/arm/ipod/lcd-gray.c
|
||||
target/arm/ipod/power-ipod.c
|
||||
target/arm/ipod/powermgmt-ipod-pcf.c
|
||||
target/arm/usb-fw-pp5002.c
|
||||
#endif /* SIMULATOR */
|
||||
#endif /* IPOD_3G */
|
||||
|
@ -642,6 +660,7 @@ target/arm/wmcodec-pp.c
|
|||
target/arm/i2s-pp.c
|
||||
target/arm/ipod/1g2g/adc-ipod-1g2g.c
|
||||
target/arm/ipod/1g2g/backlight-1g2g.c
|
||||
target/arm/ipod/1g2g/powermgmt-1g2g.c
|
||||
target/arm/ipod/button-1g-3g.c
|
||||
target/arm/ipod/lcd-gray.c
|
||||
target/arm/ipod/power-ipod.c
|
||||
|
@ -661,6 +680,7 @@ target/arm/ipod/backlight-mini1g_mini2g.c
|
|||
target/arm/ipod/button-mini1g.c
|
||||
target/arm/ipod/lcd-gray.c
|
||||
target/arm/ipod/power-ipod.c
|
||||
target/arm/ipod/powermgmt-ipod-pcf.c
|
||||
target/arm/usb-fw-pp502x.c
|
||||
#endif /* SIMULATOR */
|
||||
#endif /* IPOD_MINI */
|
||||
|
@ -677,6 +697,7 @@ target/arm/ipod/backlight-mini1g_mini2g.c
|
|||
target/arm/ipod/button-clickwheel.c
|
||||
target/arm/ipod/lcd-gray.c
|
||||
target/arm/ipod/power-ipod.c
|
||||
target/arm/ipod/powermgmt-ipod-pcf.c
|
||||
target/arm/usb-fw-pp502x.c
|
||||
#endif /* SIMULATOR */
|
||||
#endif /* IPOD_MINI2G */
|
||||
|
@ -688,6 +709,7 @@ target/arm/pnx0101/iriver-ifp7xx/backlight-ifp7xx.c
|
|||
target/arm/pnx0101/iriver-ifp7xx/button-ifp7xx.c
|
||||
target/arm/pnx0101/iriver-ifp7xx/lcd-ifp7xx.c
|
||||
target/arm/pnx0101/iriver-ifp7xx/power-ifp7xx.c
|
||||
target/arm/pnx0101/iriver-ifp7xx/powermgmt-ifp7xx.c
|
||||
target/arm/pnx0101/iriver-ifp7xx/usb-ifp7xx.c
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -106,14 +106,11 @@
|
|||
|
||||
#define HAVE_MULTIVOLUME
|
||||
|
||||
/* Type of mobile power */
|
||||
#define CONFIG_BATTERY BATT_LIION750
|
||||
#define BATTERY_CAPACITY_DEFAULT 750 /* default battery capacity */
|
||||
#define BATTERY_CAPACITY_MIN 750 /* min. capacity selectable */
|
||||
#define BATTERY_CAPACITY_MAX 750 /* max. capacity selectable */
|
||||
#define BATTERY_CAPACITY_INC 0 /* capacity increment */
|
||||
#define BATTERY_TYPES_COUNT 1 /* only one type */
|
||||
#define BATTERY_SCALE_FACTOR 5005 /* ADC should read 0x3ff=5.12V */
|
||||
|
||||
/* Hardware controlled charging? FIXME */
|
||||
#define CONFIG_CHARGING CHARGING_SIMPLE
|
||||
|
|
|
@ -60,15 +60,11 @@
|
|||
|
||||
#define CONFIG_I2C I2C_PLAYREC
|
||||
|
||||
/* Type of mobile power */
|
||||
#define CONFIG_BATTERY BATT_LIION2200
|
||||
#define BATTERY_CAPACITY_DEFAULT 2200 /* default battery capacity */
|
||||
#define BATTERY_CAPACITY_MIN 2200 /* min. capacity selectable */
|
||||
#define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable */
|
||||
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
|
||||
#define BATTERY_TYPES_COUNT 1 /* only one type */
|
||||
/* Battery scale factor (guessed, seems to be 1,25 * value from recorder) */
|
||||
#define BATTERY_SCALE_FACTOR 8081
|
||||
|
||||
/* Hardware controlled charging with monitoring */
|
||||
#define CONFIG_CHARGING CHARGING_MONITOR
|
||||
|
|
|
@ -79,15 +79,11 @@
|
|||
|
||||
#define HAVE_HEADPHONE_DETECTION
|
||||
|
||||
/* Type of mobile power - check this out */
|
||||
#define CONFIG_BATTERY BATT_LIION830 /* could change this later */
|
||||
#define BATTERY_CAPACITY_DEFAULT 2000 /* default battery capacity */
|
||||
#define BATTERY_CAPACITY_MIN 1500 /* min. capacity selectable */
|
||||
#define BATTERY_CAPACITY_MAX 2500 /* max. capacity selectable */
|
||||
#define BATTERY_CAPACITY_INC 25 /* capacity increment */
|
||||
#define BATTERY_TYPES_COUNT 1 /* only one type */
|
||||
/* ADC[0] is (530) at discharge and 625 at full charge */
|
||||
#define BATTERY_SCALE_FACTOR 6450
|
||||
|
||||
/* Hardware controlled charging with monitoring */
|
||||
#define CONFIG_CHARGING CHARGING_MONITOR
|
||||
|
|
|
@ -93,14 +93,11 @@
|
|||
|
||||
#define AB_REPEAT_ENABLE 1
|
||||
|
||||
/* Type of mobile power */
|
||||
#define CONFIG_BATTERY BATT_LPCS355385
|
||||
#define BATTERY_CAPACITY_DEFAULT 1550 /* default battery capacity */
|
||||
#define BATTERY_CAPACITY_MIN 1500 /* min. capacity selectable */
|
||||
#define BATTERY_CAPACITY_MAX 1600 /* max. capacity selectable */
|
||||
#define BATTERY_CAPACITY_INC 10 /* capacity increment */
|
||||
#define BATTERY_TYPES_COUNT 1 /* only one type */
|
||||
#define BATTERY_SCALE_FACTOR 4688
|
||||
|
||||
/* Hardware controlled charging */
|
||||
#define CONFIG_CHARGING CHARGING_SIMPLE
|
||||
|
|
|
@ -91,14 +91,11 @@
|
|||
|
||||
#define HAVE_AGC
|
||||
|
||||
/* Type of mobile power */
|
||||
#define CONFIG_BATTERY BATT_LIPOL1300
|
||||
#define BATTERY_CAPACITY_DEFAULT 1300 /* default battery capacity */
|
||||
#define BATTERY_CAPACITY_MIN 1300 /* min. capacity selectable */
|
||||
#define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable */
|
||||
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
|
||||
#define BATTERY_TYPES_COUNT 1 /* only one type */
|
||||
#define BATTERY_SCALE_FACTOR 16665 /* FIX: this value is picked at random */
|
||||
|
||||
/* Hardware controlled charging */
|
||||
//#define CONFIG_CHARGING CHARGING_SIMPLE
|
||||
|
|
|
@ -79,14 +79,11 @@
|
|||
|
||||
#define AB_REPEAT_ENABLE 1
|
||||
|
||||
/* Type of mobile power */
|
||||
#define CONFIG_BATTERY BATT_BP009
|
||||
#define BATTERY_CAPACITY_DEFAULT 820 /* default battery capacity */
|
||||
#define BATTERY_CAPACITY_MIN 700 /* min. capacity selectable */
|
||||
#define BATTERY_CAPACITY_MAX 900 /* max. capacity selectable */
|
||||
#define BATTERY_CAPACITY_INC 10 /* capacity increment */
|
||||
#define BATTERY_TYPES_COUNT 1 /* only one type */
|
||||
#define BATTERY_SCALE_FACTOR 4688
|
||||
|
||||
/* Hardware controlled charging */
|
||||
#define CONFIG_CHARGING CHARGING_SIMPLE
|
||||
|
|
|
@ -91,13 +91,11 @@
|
|||
|
||||
#define HAVE_AGC
|
||||
|
||||
#define CONFIG_BATTERY BATT_LIPOL1300
|
||||
#define BATTERY_CAPACITY_DEFAULT 1300 /* default battery capacity */
|
||||
#define BATTERY_CAPACITY_MIN 1300 /* min. capacity selectable */
|
||||
#define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable */
|
||||
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
|
||||
#define BATTERY_TYPES_COUNT 1 /* only one type */
|
||||
#define BATTERY_SCALE_FACTOR 16665 /* FIX: this value is picked at random */
|
||||
|
||||
/* Hardware controlled charging */
|
||||
//#define CONFIG_CHARGING CHARGING_SIMPLE
|
||||
|
|
|
@ -88,14 +88,11 @@
|
|||
|
||||
#define HAVE_AGC
|
||||
|
||||
/* Type of mobile power */
|
||||
#define CONFIG_BATTERY BATT_LIPOL1300
|
||||
#define BATTERY_CAPACITY_DEFAULT 1300 /* default battery capacity */
|
||||
#define BATTERY_CAPACITY_MIN 1300 /* min. capacity selectable */
|
||||
#define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable */
|
||||
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
|
||||
#define BATTERY_TYPES_COUNT 1 /* only one type */
|
||||
#define BATTERY_SCALE_FACTOR 23437 /* FIX: this value is picked at random */
|
||||
|
||||
/* Hardware controlled charging with monitoring */
|
||||
#define CONFIG_CHARGING CHARGING_MONITOR
|
||||
|
|
|
@ -84,15 +84,11 @@
|
|||
/* TLV320 has no tone controls, so we use the software ones */
|
||||
#define HAVE_SW_TONE_CONTROLS
|
||||
|
||||
/* Type of mobile power */
|
||||
#define X5_BATT_CONFIG 2
|
||||
#define CONFIG_BATTERY BATT_IAUDIO_X5M5
|
||||
#define BATTERY_CAPACITY_DEFAULT 950 /* default battery capacity */
|
||||
#define BATTERY_CAPACITY_MIN 950 /* min. capacity selectable */
|
||||
#define BATTERY_CAPACITY_MAX 2250 /* max. capacity selectable */
|
||||
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
|
||||
#define BATTERY_TYPES_COUNT 1 /* only one type */
|
||||
#define BATTERY_SCALE_FACTOR 5859 /* (420703125 + 35900) / 71800 */
|
||||
|
||||
/* Hardware controlled charging? FIXME */
|
||||
#define CONFIG_CHARGING CHARGING_SIMPLE
|
||||
|
|
|
@ -98,15 +98,11 @@
|
|||
/* TLV320 has no tone controls, so we use the software ones */
|
||||
#define HAVE_SW_TONE_CONTROLS
|
||||
|
||||
/* Type of mobile power */
|
||||
#define X5_BATT_CONFIG 2
|
||||
#define CONFIG_BATTERY BATT_IAUDIO_X5M5
|
||||
#define BATTERY_CAPACITY_DEFAULT 950 /* default battery capacity */
|
||||
#define BATTERY_CAPACITY_MIN 950 /* min. capacity selectable */
|
||||
#define BATTERY_CAPACITY_MAX 2250 /* max. capacity selectable */
|
||||
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
|
||||
#define BATTERY_TYPES_COUNT 1 /* only one type */
|
||||
#define BATTERY_SCALE_FACTOR 5859 /* (420703125 + 35900) / 71800 */
|
||||
|
||||
/* Hardware controlled charging? FIXME */
|
||||
#define CONFIG_CHARGING CHARGING_SIMPLE
|
||||
|
|
|
@ -60,14 +60,14 @@
|
|||
/* define this if you have a flash memory storage */
|
||||
#define HAVE_FLASH_STORAGE
|
||||
|
||||
/* Type of mobile power */
|
||||
#define CONFIG_BATTERY BATT_1AA
|
||||
#define BATTERY_CAPACITY_DEFAULT 1000 /* default battery capacity */
|
||||
#define BATTERY_CAPACITY_MIN 500 /* min. capacity selectable */
|
||||
#define BATTERY_CAPACITY_MAX 2800 /* max. capacity selectable */
|
||||
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
|
||||
#define BATTERY_TYPES_COUNT 2 /* Alkalines or NiMH */
|
||||
#define BATTERY_SCALE_FACTOR 3000 /* TODO: only roughly correct */
|
||||
|
||||
/* define this if the unit should not shut down on low battery. */
|
||||
#define NO_LOW_BATTERY_SHUTDOWN
|
||||
|
||||
#ifndef SIMULATOR
|
||||
|
||||
|
|
|
@ -69,14 +69,11 @@
|
|||
/* Define this if you can detect headphones */
|
||||
#define HAVE_HEADPHONE_DETECTION
|
||||
|
||||
/* Type of mobile power */
|
||||
#define CONFIG_BATTERY BATT_LIPOL1300
|
||||
#define BATTERY_CAPACITY_DEFAULT 630 /* default battery capacity */
|
||||
#define BATTERY_CAPACITY_MIN 1200 /* min. capacity selectable */
|
||||
#define BATTERY_CAPACITY_MAX 1900 /* max. capacity selectable */
|
||||
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
|
||||
#define BATTERY_TYPES_COUNT 1 /* only one type */
|
||||
#define BATTERY_SCALE_FACTOR 25882
|
||||
|
||||
/* Hardware controlled charging? FIXME */
|
||||
//#define CONFIG_CHARGING CHARGING_SIMPLE
|
||||
|
|
|
@ -72,14 +72,11 @@
|
|||
/* Define this if you can detect headphones */
|
||||
#define HAVE_HEADPHONE_DETECTION
|
||||
|
||||
/* Type of mobile power */
|
||||
#define CONFIG_BATTERY BATT_LIPOL1300
|
||||
#define BATTERY_CAPACITY_DEFAULT 630 /* default battery capacity */
|
||||
#define BATTERY_CAPACITY_MIN 630 /* min. capacity selectable */
|
||||
#define BATTERY_CAPACITY_MAX 1000 /* max. capacity selectable */
|
||||
#define BATTERY_CAPACITY_INC 10 /* capacity increment */
|
||||
#define BATTERY_TYPES_COUNT 1 /* only one type */
|
||||
#define BATTERY_SCALE_FACTOR 5865
|
||||
|
||||
/* Hardware controlled charging? FIXME */
|
||||
//#define CONFIG_CHARGING CHARGING_SIMPLE
|
||||
|
|
|
@ -82,14 +82,11 @@
|
|||
/* Define this if you can detect headphones */
|
||||
#define HAVE_HEADPHONE_DETECTION
|
||||
|
||||
/* Type of mobile power */
|
||||
#define CONFIG_BATTERY BATT_LIPOL1300
|
||||
#define BATTERY_CAPACITY_DEFAULT 630 /* default battery capacity */
|
||||
#define BATTERY_CAPACITY_MIN 630 /* min. capacity selectable */
|
||||
#define BATTERY_CAPACITY_MAX 1000 /* max. capacity selectable */
|
||||
#define BATTERY_CAPACITY_INC 10 /* capacity increment */
|
||||
#define BATTERY_TYPES_COUNT 1 /* only one type */
|
||||
#define BATTERY_SCALE_FACTOR 5865
|
||||
|
||||
/* Hardware controlled charging? FIXME */
|
||||
//#define CONFIG_CHARGING CHARGING_SIMPLE
|
||||
|
|
|
@ -73,14 +73,11 @@
|
|||
/* Define this if you can detect headphones */
|
||||
#define HAVE_HEADPHONE_DETECTION
|
||||
|
||||
/* Type of mobile power */
|
||||
#define CONFIG_BATTERY BATT_LIPOL1300
|
||||
#define BATTERY_CAPACITY_DEFAULT 700 /* default battery capacity */
|
||||
#define BATTERY_CAPACITY_MIN 700 /* min. capacity selectable */
|
||||
#define BATTERY_CAPACITY_MAX 1000 /* max. capacity selectable */
|
||||
#define BATTERY_CAPACITY_INC 10 /* capacity increment */
|
||||
#define BATTERY_TYPES_COUNT 1 /* only one type */
|
||||
#define BATTERY_SCALE_FACTOR 5865
|
||||
|
||||
/* Hardware controlled charging? FIXME */
|
||||
//#define CONFIG_CHARGING CHARGING_SIMPLE
|
||||
|
|
|
@ -78,14 +78,11 @@
|
|||
/* Define this if you can detect headphones */
|
||||
#define HAVE_HEADPHONE_DETECTION
|
||||
|
||||
/* Type of mobile power */
|
||||
#define CONFIG_BATTERY BATT_LIPOL1300
|
||||
#define BATTERY_CAPACITY_DEFAULT 400 /* default battery capacity */
|
||||
#define BATTERY_CAPACITY_MIN 400 /* min. capacity selectable */
|
||||
#define BATTERY_CAPACITY_MAX 800 /* max. capacity selectable */
|
||||
#define BATTERY_CAPACITY_INC 10 /* capacity increment */
|
||||
#define BATTERY_TYPES_COUNT 1 /* only one type */
|
||||
#define BATTERY_SCALE_FACTOR 5865
|
||||
|
||||
/* Hardware controlled charging? FIXME */
|
||||
//#define CONFIG_CHARGING CHARGING_SIMPLE
|
||||
|
|
|
@ -78,14 +78,11 @@
|
|||
/* Define this if you can detect headphones */
|
||||
#define HAVE_HEADPHONE_DETECTION
|
||||
|
||||
/* Type of mobile power */
|
||||
#define CONFIG_BATTERY BATT_LIPOL1300
|
||||
#define BATTERY_CAPACITY_DEFAULT 400 /* default battery capacity */
|
||||
#define BATTERY_CAPACITY_MIN 400 /* min. capacity selectable */
|
||||
#define BATTERY_CAPACITY_MAX 800 /* max. capacity selectable */
|
||||
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
|
||||
#define BATTERY_TYPES_COUNT 1 /* only one type */
|
||||
#define BATTERY_SCALE_FACTOR 5865
|
||||
|
||||
/* Hardware controlled charging? FIXME */
|
||||
//#define CONFIG_CHARGING CHARGING_SIMPLE
|
||||
|
|
|
@ -79,8 +79,6 @@
|
|||
/* define this if you have a flash memory storage */
|
||||
#define HAVE_FLASH_STORAGE
|
||||
|
||||
/* Type of mobile power */
|
||||
#define CONFIG_BATTERY BATT_LIION300
|
||||
#define BATTERY_CAPACITY_DEFAULT 300 /* default battery capacity */
|
||||
#define BATTERY_CAPACITY_MIN 200 /* min. capacity selectable */
|
||||
#define BATTERY_CAPACITY_MAX 600 /* max. capacity selectable */
|
||||
|
@ -101,8 +99,6 @@
|
|||
/* Define this if you want to use the PP5020 i2c interface */
|
||||
#define CONFIG_I2C I2C_PP5020
|
||||
|
||||
#define BATTERY_SCALE_FACTOR 5840
|
||||
|
||||
/* define this if the hardware can be powered off while charging */
|
||||
//#define HAVE_POWEROFF_WHILE_CHARGING
|
||||
|
||||
|
|
|
@ -8,9 +8,6 @@
|
|||
/* For Rolo and boot loader */
|
||||
#define MODEL_NUMBER 5
|
||||
|
||||
/* For battery type (30GB by default, undefine here to use 60/80GB model) */
|
||||
#define CONFIG_BATTERY_IPOD_VIDEO_30GB
|
||||
|
||||
/* define this if you have recording possibility */
|
||||
#define HAVE_RECORDING
|
||||
|
||||
|
@ -81,22 +78,16 @@
|
|||
|
||||
/* Type of mobile power */
|
||||
#if (MEM==32) /* this is the 30GB-model */
|
||||
# define CONFIG_BATTERY BATT_LIION400
|
||||
# define BATTERY_CAPACITY_DEFAULT 400 /* default battery capacity for the 30GB model */
|
||||
# define BATTERY_CAPACITY_MIN 300 /* min. capacity selectable */
|
||||
# define BATTERY_CAPACITY_MAX 800 /* max. capacity selectable */
|
||||
# define BATTERY_CAPACITY_INC 50 /* capacity increment */
|
||||
# define BATTERY_TYPES_COUNT 1 /* only one type */
|
||||
# define BATTERY_SCALE_FACTOR 5865
|
||||
# define BATTERY_CAPACITY_DEFAULT 400 /* default battery capacity for the 30GB model */
|
||||
# define BATTERY_CAPACITY_MIN 300 /* min. capacity selectable */
|
||||
# define BATTERY_CAPACITY_MAX 800 /* max. capacity selectable */
|
||||
#else /* these are the 60/80GB-models */
|
||||
# define CONFIG_BATTERY BATT_LIION400 /* FIXME: we assume to have same discharge behaviour as 30GB iPOD */
|
||||
# define BATTERY_CAPACITY_DEFAULT 600 /* default battery capacity for the 60/80GB model */
|
||||
# define BATTERY_CAPACITY_MIN 500 /* min. capacity selectable */
|
||||
# define BATTERY_CAPACITY_MAX 1000 /* max. capacity selectable */
|
||||
# define BATTERY_CAPACITY_INC 50 /* capacity increment */
|
||||
# define BATTERY_TYPES_COUNT 1 /* only one type */
|
||||
# define BATTERY_SCALE_FACTOR 5865
|
||||
# define BATTERY_CAPACITY_DEFAULT 600 /* default battery capacity for the 60/80GB model */
|
||||
# define BATTERY_CAPACITY_MIN 500 /* min. capacity selectable */
|
||||
# define BATTERY_CAPACITY_MAX 1000 /* max. capacity selectable */
|
||||
#endif
|
||||
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
|
||||
#define BATTERY_TYPES_COUNT 1 /* only one type */
|
||||
|
||||
/* Hardware controlled charging with monitoring */
|
||||
#define CONFIG_CHARGING CHARGING_MONITOR
|
||||
|
|
|
@ -52,14 +52,14 @@
|
|||
/* define this if more than one device/partition can be used */
|
||||
#define HAVE_MULTIVOLUME
|
||||
|
||||
/* Type of mobile power */
|
||||
#define CONFIG_BATTERY BATT_3AAA
|
||||
#define BATTERY_CAPACITY_DEFAULT 1000 /* default battery capacity */
|
||||
#define BATTERY_CAPACITY_MIN 500 /* min. capacity selectable */
|
||||
#define BATTERY_CAPACITY_MAX 1500 /* max. capacity selectable */
|
||||
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
|
||||
#define BATTERY_TYPES_COUNT 2 /* Alkalines or NiMH */
|
||||
#define BATTERY_SCALE_FACTOR 4735 /* average from 3 Ondios */
|
||||
|
||||
/* define this if the unit should not shut down on low battery. */
|
||||
#define NO_LOW_BATTERY_SHUTDOWN
|
||||
|
||||
/* define this if the unit can be powered or charged via USB */
|
||||
#define HAVE_USB_POWER
|
||||
|
|
|
@ -41,14 +41,14 @@
|
|||
/* define this if more than one device/partition can be used */
|
||||
#define HAVE_MULTIVOLUME
|
||||
|
||||
/* Type of mobile power */
|
||||
#define CONFIG_BATTERY BATT_3AAA
|
||||
#define BATTERY_CAPACITY_DEFAULT 1000 /* default battery capacity */
|
||||
#define BATTERY_CAPACITY_MIN 500 /* min. capacity selectable */
|
||||
#define BATTERY_CAPACITY_MAX 1500 /* max. capacity selectable */
|
||||
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
|
||||
#define BATTERY_TYPES_COUNT 2 /* Alkalines or NiMH */
|
||||
#define BATTERY_SCALE_FACTOR 4735 /* average from 3 Ondios */
|
||||
|
||||
/* define this if the unit should not shut down on low battery. */
|
||||
#define NO_LOW_BATTERY_SHUTDOWN
|
||||
|
||||
/* define this if the unit can be powered or charged via USB */
|
||||
#define HAVE_USB_POWER
|
||||
|
|
|
@ -27,14 +27,14 @@
|
|||
/* Define this for LCD backlight available */
|
||||
#define HAVE_BACKLIGHT
|
||||
|
||||
/* Type of mobile power */
|
||||
#define CONFIG_BATTERY BATT_4AA_NIMH
|
||||
#define BATTERY_CAPACITY_DEFAULT 1500 /* default battery capacity */
|
||||
#define BATTERY_CAPACITY_MIN 1500 /* min. capacity selectable */
|
||||
#define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable */
|
||||
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
|
||||
#define BATTERY_TYPES_COUNT 1 /* only one type */
|
||||
#define BATTERY_SCALE_FACTOR 6546
|
||||
|
||||
/* define this if the unit should not shut down on low battery. */
|
||||
#define NO_LOW_BATTERY_SHUTDOWN
|
||||
|
||||
/* Hardware controlled charging */
|
||||
#define CONFIG_CHARGING CHARGING_SIMPLE
|
||||
|
|
|
@ -51,14 +51,14 @@
|
|||
|
||||
#define CONFIG_I2C I2C_PLAYREC
|
||||
|
||||
/* Type of mobile power */
|
||||
#define CONFIG_BATTERY BATT_4AA_NIMH
|
||||
#define BATTERY_CAPACITY_DEFAULT 1500 /* default battery capacity */
|
||||
#define BATTERY_CAPACITY_MIN 1500 /* min. capacity selectable */
|
||||
#define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable */
|
||||
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
|
||||
#define BATTERY_TYPES_COUNT 1 /* only one type */
|
||||
#define BATTERY_SCALE_FACTOR 6465
|
||||
|
||||
/* define this if the unit should not shut down on low battery. */
|
||||
#define NO_LOW_BATTERY_SHUTDOWN
|
||||
|
||||
/* Software controlled charging */
|
||||
#define CONFIG_CHARGING CHARGING_CONTROL
|
||||
|
|
|
@ -57,15 +57,11 @@
|
|||
|
||||
#define CONFIG_I2C I2C_PLAYREC
|
||||
|
||||
/* Type of mobile power */
|
||||
#define CONFIG_BATTERY BATT_LIION2200
|
||||
#define BATTERY_CAPACITY_DEFAULT 2200 /* default battery capacity */
|
||||
#define BATTERY_CAPACITY_MIN 2200 /* min. capacity selectable */
|
||||
#define BATTERY_CAPACITY_MAX 3200 /* max. capacity selectable */
|
||||
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
|
||||
#define BATTERY_TYPES_COUNT 1 /* only one type */
|
||||
/* Battery scale factor (guessed, seems to be 1,25 * value from recorder) */
|
||||
#define BATTERY_SCALE_FACTOR 8081
|
||||
|
||||
/* Hardware controlled charging with monitoring */
|
||||
#define CONFIG_CHARGING CHARGING_MONITOR
|
||||
|
|
|
@ -57,8 +57,6 @@
|
|||
/* Define this for LCD backlight available */
|
||||
#define HAVE_BACKLIGHT
|
||||
|
||||
/* Type of mobile power */
|
||||
#define CONFIG_BATTERY BATT_LPCS355385
|
||||
#define BATTERY_CAPACITY_DEFAULT 1550 /* default battery capacity
|
||||
TODO: check this, probably different
|
||||
for different models too */
|
||||
|
@ -66,7 +64,6 @@
|
|||
#define BATTERY_CAPACITY_MAX 1600 /* max. capacity selectable */
|
||||
#define BATTERY_CAPACITY_INC 10 /* capacity increment */
|
||||
#define BATTERY_TYPES_COUNT 1 /* only one type */
|
||||
#define BATTERY_SCALE_FACTOR 5865
|
||||
|
||||
/* Hardware controlled charging? FIXME */
|
||||
//#define CONFIG_CHARGING CHARGING_SIMPLE
|
||||
|
|
|
@ -71,20 +71,6 @@
|
|||
#define H300_REMOTE 2
|
||||
#define X5_REMOTE 3
|
||||
|
||||
/* CONFIG_BATTERY */
|
||||
#define BATT_LIION2200 2200 /* FM/V2 recorder type */
|
||||
#define BATT_4AA_NIMH 1500
|
||||
#define BATT_3AAA 1000 /* Ondio */
|
||||
#define BATT_IAUDIO_X5M5 950
|
||||
#define BATT_LIPOL1300 1300 /* the type used in iRiver h1x0 models */
|
||||
#define BATT_LPCS355385 1550 /* iriver h10 20Gb - SKC LPCS355385 */
|
||||
#define BATT_BP009 820 /* iriver H10 5/6Gb - iriver BP009 */
|
||||
#define BATT_LIION830 830 /* Toshiba Gigabeat Fxx and Xxx series MK11-2740 */
|
||||
#define BATT_LIION750 750 /* Sansa e200 LiIon 3,7V */
|
||||
#define BATT_LIION400 400 /* iPOD 5G/5.5G Video 30GB LiIon 400mAh */
|
||||
#define BATT_LIION300 300 /* iPOD nano LiIon 300mAh */
|
||||
#define BATT_1AA 333 /* iRiver iFP: Alkaline, NiHM */
|
||||
|
||||
/* CONFIG_CHARGING */
|
||||
#define CHARGING_SIMPLE 1 /* Simple, hardware controlled charging */
|
||||
#define CHARGING_MONITOR 2 /* Hardware controlled charging with monitoring */
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
#ifndef _POWERMGMT_H_
|
||||
#define _POWERMGMT_H_
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#define POWER_HISTORY_LEN 2*60 /* 2 hours of samples, one per minute */
|
||||
|
||||
#define CHARGE_END_SHORTD 6 /* stop when N minutes have passed with
|
||||
|
@ -137,6 +139,12 @@ extern int trickle_sec; /* trickle charge: How many seconds per minute
|
|||
#endif /* not HAVE_MMC */
|
||||
|
||||
extern unsigned short power_history[POWER_HISTORY_LEN];
|
||||
extern const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT];
|
||||
extern const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT];
|
||||
extern const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11];
|
||||
#if CONFIG_CHARGING
|
||||
extern const unsigned short percent_to_volt_charge[11];
|
||||
#endif
|
||||
|
||||
/* Start up power management thread */
|
||||
void powermgmt_init(void);
|
||||
|
@ -146,7 +154,7 @@ void powermgmt_init(void);
|
|||
/* Returns battery statust */
|
||||
int battery_level(void); /* percent */
|
||||
int battery_time(void); /* minutes */
|
||||
int battery_adc_voltage(void); /* voltage from ADC in millivolts */
|
||||
unsigned int battery_adc_voltage(void); /* voltage from ADC in millivolts */
|
||||
unsigned int battery_voltage(void); /* filtered batt. voltage in millivolts */
|
||||
|
||||
/* read unfiltered battery info */
|
||||
|
|
|
@ -175,143 +175,6 @@ static const unsigned char poweroff_idle_timeout_value[15] =
|
|||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 30, 45, 60
|
||||
};
|
||||
|
||||
static const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
|
||||
{
|
||||
#if CONFIG_BATTERY == BATT_LIION2200 /* FM Recorder, LiIon */
|
||||
2800
|
||||
#elif CONFIG_BATTERY == BATT_3AAA /* Ondio: Alkaline, NiHM */
|
||||
3100, 3450
|
||||
#elif CONFIG_BATTERY == BATT_1AA /* iRiver iFP: Alkaline, NiHM */
|
||||
1050, 1150
|
||||
#elif CONFIG_BATTERY == BATT_LIPOL1300 /* iRiver H1x0: LiPolymer */
|
||||
3380
|
||||
#elif CONFIG_BATTERY == BATT_LIION300 /* ipod nano */
|
||||
3330
|
||||
#elif CONFIG_BATTERY == BATT_LIION400 /* iPOD Video 30GB */
|
||||
3450
|
||||
#elif CONFIG_BATTERY == BATT_LIION750 /* Sansa e200 */
|
||||
3400
|
||||
#elif CONFIG_BATTERY == BATT_LIION830 /* Gigabeat F */
|
||||
3450
|
||||
#elif CONFIG_BATTERY == BATT_IAUDIO_X5M5 /* iAudio X5 */
|
||||
3540
|
||||
#elif CONFIG_BATTERY == BATT_LPCS355385 /* iriver H10 20GB: LiPolymer*/
|
||||
3760
|
||||
#elif CONFIG_BATTERY == BATT_BP009 /* iriver H10 5/6GB: LiPolymer */
|
||||
3720
|
||||
#else /* Player/recorder: NiMH */
|
||||
4750
|
||||
#endif
|
||||
};
|
||||
|
||||
static const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
|
||||
{
|
||||
#if CONFIG_BATTERY == BATT_LIION2200 /* FM Recorder */
|
||||
2580
|
||||
#elif CONFIG_BATTERY == BATT_3AAA /* Ondio */
|
||||
2700, 2800
|
||||
#elif CONFIG_BATTERY == BATT_LIPOL1300 /* iRiver Hxxx */
|
||||
3020
|
||||
#elif CONFIG_BATTERY == BATT_LIION300 /* ipod nano */
|
||||
3230
|
||||
#elif CONFIG_BATTERY == BATT_LIION400 /* iPOD Video 30GB */
|
||||
3450
|
||||
#elif CONFIG_BATTERY == BATT_LIION750 /* Sansa e200 */
|
||||
3300
|
||||
#elif CONFIG_BATTERY == BATT_LIION830 /* Gigabeat F */
|
||||
3400
|
||||
#elif CONFIG_BATTERY == BATT_IAUDIO_X5M5 /* iAudio X5 */
|
||||
3500
|
||||
#elif CONFIG_BATTERY == BATT_LPCS355385 /* iriver H10 20GB */
|
||||
3650
|
||||
#elif CONFIG_BATTERY == BATT_BP009 /* iriver H10 5/6GB */
|
||||
3650
|
||||
#else /* Player/recorder: NiMH */
|
||||
4400
|
||||
#endif
|
||||
};
|
||||
|
||||
/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */
|
||||
static const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
|
||||
{
|
||||
#if CONFIG_BATTERY == BATT_LIION2200
|
||||
/* measured values */
|
||||
{ 2600, 2850, 2950, 3030, 3110, 3200, 3300, 3450, 3600, 3800, 4000 }
|
||||
#elif CONFIG_BATTERY == BATT_3AAA
|
||||
/* measured values */
|
||||
{ 2800, 3250, 3410, 3530, 3640, 3740, 3850, 3950, 4090, 4270, 4750 }, /* Alkaline */
|
||||
{ 3100, 3550, 3630, 3690, 3720, 3740, 3760, 3780, 3800, 3860, 4050 } /* NiMH */
|
||||
#elif CONFIG_BATTERY == BATT_LIPOL1300
|
||||
/* Below 3370 the backlight starts flickering during HD access */
|
||||
{ 3370, 3650, 3700, 3740, 3780, 3820, 3870, 3930, 4000, 4080, 4160 }
|
||||
#elif CONFIG_BATTERY == BATT_IAUDIO_X5M5
|
||||
/* average measured values from X5 and M5L */
|
||||
{ 3500, 3650, 3720, 3740, 3760, 3790, 3840, 3900, 3950, 4040, 4120 }
|
||||
#elif CONFIG_BATTERY == BATT_LPCS355385
|
||||
/* iriver H10 20GB */
|
||||
{ 3760, 3800, 3850, 3870, 3900, 3950, 4020, 4070, 4110, 4180, 4240 }
|
||||
#elif CONFIG_BATTERY == BATT_BP009
|
||||
/* iriver H10 5/6GB */
|
||||
{ 3720, 3740, 3800, 3820, 3840, 3880, 3940, 4020, 4060, 4150, 4240 }
|
||||
#elif CONFIG_BATTERY == BATT_1AA
|
||||
/* These values are the same as for 3AAA divided by 3. */
|
||||
/* May need recalibration. */
|
||||
{ 930, 1080, 1140, 1180, 1210, 1250, 1280, 1320, 1360, 1420, 1580 }, /* alkaline */
|
||||
{ 1030, 1180, 1210, 1230, 1240, 1250, 1260, 1270, 1280, 1290, 1350 } /* NiMH */
|
||||
#elif CONFIG_BATTERY == BATT_LIION830
|
||||
/* Toshiba Gigabeat Li Ion 830mAH figured from discharge curve */
|
||||
{ 3480, 3550, 3590, 3610, 3630, 3650, 3700, 3760, 3800, 3910, 3990 },
|
||||
#elif CONFIG_BATTERY == BATT_LIION750
|
||||
/* Sansa Li Ion 750mAH FIXME this is a first linear approach */
|
||||
{ 3300, 3390, 3480, 3570, 3660, 3750, 3840, 3930, 4020, 4110, 4200 },
|
||||
#elif CONFIG_BATTERY == BATT_LIION400 /* iPOD Video 30GB */
|
||||
/* iPOD Video 30GB Li-Ion 400mAh, first approach based upon measurements */
|
||||
{ 3450, 3670, 3710, 3750, 3790, 3830, 3870, 3930, 4010, 4100, 4180 },
|
||||
#elif CONFIG_BATTERY == BATT_LIION300
|
||||
/* measured values */
|
||||
{ 3230, 3620, 3700, 3730, 3750, 3780, 3830, 3890, 3950, 4030, 4160 },
|
||||
#else /* NiMH */
|
||||
/* original values were taken directly after charging, but it should show
|
||||
100% after turning off the device for some hours, too */
|
||||
{ 4500, 4810, 4910, 4970, 5030, 5070, 5120, 5140, 5170, 5250, 5400 }
|
||||
/* orig. values: ...,5280,5600 */
|
||||
#endif
|
||||
};
|
||||
|
||||
#if CONFIG_CHARGING
|
||||
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
|
||||
static const unsigned short percent_to_volt_charge[11] =
|
||||
{
|
||||
#if CONFIG_BATTERY == BATT_LIPOL1300
|
||||
/* values measured over one full charging cycle */
|
||||
3540, 3860, 3930, 3980, 4000, 4020, 4040, 4080, 4130, 4180, 4230 /* LiPo */
|
||||
#elif CONFIG_BATTERY == BATT_LIION300
|
||||
/* measured values */
|
||||
3230, 3620, 3700, 3730, 3750, 3780, 3830, 3890, 3950, 4030, 4160
|
||||
#elif CONFIG_BATTERY == BATT_LIION400
|
||||
/* iPOD Video 30GB Li-Ion 400mAh, first approach based upon measurements */
|
||||
3450, 3670, 3710, 3750, 3790, 3830, 3870, 3930, 4010, 4100, 4180
|
||||
#elif CONFIG_BATTERY == BATT_LIION750
|
||||
/* Sansa Li Ion 750mAH FIXME*/
|
||||
3300, 3390, 3480, 3570, 3660, 3750, 3840, 3930, 4020, 4110, 4200
|
||||
#elif CONFIG_BATTERY == BATT_LIION830
|
||||
/* Toshiba Gigabeat Li Ion 830mAH */
|
||||
3480, 3550, 3590, 3610, 3630, 3650, 3700, 3760, 3800, 3910, 3990
|
||||
#elif CONFIG_BATTERY == BATT_LPCS355385
|
||||
/* iriver H10 20GB */
|
||||
3990, 4030, 4060, 4080, 4100, 4120, 4150, 4180, 4220, 4260, 4310
|
||||
#elif CONFIG_BATTERY == BATT_BP009
|
||||
/* iriver H10 5/6GB: Not yet calibrated */
|
||||
3880, 3920, 3960, 4000, 4060, 4100, 4150, 4190, 4240, 4280, 4330
|
||||
#else
|
||||
/* values guessed, see
|
||||
http://www.seattlerobotics.org/encoder/200210/LiIon2.pdf until someone
|
||||
measures voltages over a charging cycle */
|
||||
4760, 5440, 5510, 5560, 5610, 5640, 5660, 5760, 5820, 5840, 5850 /* NiMH */
|
||||
#endif
|
||||
};
|
||||
#endif /* CONFIG_CHARGING */
|
||||
|
||||
#if CONFIG_CHARGING == CHARGING_CONTROL
|
||||
int long_delta; /* long term delta battery voltage */
|
||||
int short_delta; /* short term delta battery voltage */
|
||||
|
@ -340,12 +203,11 @@ int pid_i = 0; /* PID integral term */
|
|||
*/
|
||||
static unsigned int avgbat; /* average battery voltage (filtering) */
|
||||
static unsigned int battery_millivolts;/* filtered battery voltage, millivolts */
|
||||
|
||||
#ifdef HAVE_CHARGE_CTRL
|
||||
#define BATT_AVE_SAMPLES 32 /* filter constant / @ 2Hz sample rate */
|
||||
#elif CONFIG_BATTERY == BATT_LIPOL1300
|
||||
#define BATT_AVE_SAMPLES 128 /* slow filter for iriver */
|
||||
#else
|
||||
#define BATT_AVE_SAMPLES 64 /* medium filter constant for all others */
|
||||
#define BATT_AVE_SAMPLES 128 /* slw filter constant for all others */
|
||||
#endif
|
||||
|
||||
/* battery level (0-100%) of this minute, updated once per minute */
|
||||
|
@ -373,7 +235,7 @@ static int runcurrent(void);
|
|||
|
||||
void battery_read_info(int *voltage, int *level)
|
||||
{
|
||||
int millivolts = adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR / 1000;
|
||||
int millivolts = battery_adc_voltage();
|
||||
|
||||
if (voltage)
|
||||
*voltage = millivolts;
|
||||
|
@ -424,12 +286,6 @@ unsigned int battery_voltage(void)
|
|||
return battery_millivolts;
|
||||
}
|
||||
|
||||
/* Returns battery voltage from ADC [millivolts] */
|
||||
int battery_adc_voltage(void)
|
||||
{
|
||||
return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR + 500) / 1000;
|
||||
}
|
||||
|
||||
/* Tells if the battery level is safe for disk writes */
|
||||
bool battery_level_safe(void)
|
||||
{
|
||||
|
@ -487,7 +343,10 @@ static int voltage_to_battery_level(int battery_millivolts)
|
|||
{
|
||||
int level;
|
||||
|
||||
#if defined(CONFIG_CHARGER) && CONFIG_BATTERY == BATT_LIPOL1300
|
||||
#if defined(CONFIG_CHARGER) \
|
||||
&& (defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES))
|
||||
/* Checking for iriver is a temporary kludge.
|
||||
* This code needs rework/unification */
|
||||
if (charger_input_state == NO_CHARGER) {
|
||||
/* discharging. calculate new battery level and average with last */
|
||||
level = voltage_to_percent(battery_millivolts,
|
||||
|
@ -549,7 +408,10 @@ static void battery_status_update(void)
|
|||
/ 100 / (CURRENT_MAX_CHG - runcurrent());
|
||||
}
|
||||
else
|
||||
#elif CONFIG_CHARGING && CONFIG_BATTERY == BATT_LIPOL1300
|
||||
#elif CONFIG_CHARGING \
|
||||
&& (defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES))
|
||||
/* Checking for iriver is a temporary kludge.
|
||||
* This code needs rework/unification */
|
||||
if (charger_inserted()) {
|
||||
#ifdef IRIVER_H300_SERIES
|
||||
/* H300_SERIES use CURRENT_MAX_CHG for basic charge time (80%)
|
||||
|
@ -626,9 +488,8 @@ static void handle_auto_poweroff(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifndef NO_LOW_BATTERY_SHUTDOWN
|
||||
/* switch off unit if battery level is too low for reliable operation */
|
||||
#if (CONFIG_BATTERY!=BATT_4AA_NIMH) && (CONFIG_BATTERY!=BATT_3AAA)&& \
|
||||
(CONFIG_BATTERY!=BATT_1AA)
|
||||
if(battery_millivolts < battery_level_shutoff[battery_type]) {
|
||||
if(!shutdown_timeout) {
|
||||
backlight_on();
|
||||
|
@ -837,12 +698,11 @@ static void power_thread_sleep(int ticks)
|
|||
* likely always be spinning in USB mode).
|
||||
*/
|
||||
if (!ata_disk_is_active() || usb_inserted()) {
|
||||
avgbat += adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR
|
||||
- (avgbat / BATT_AVE_SAMPLES);
|
||||
avgbat += battery_adc_voltage() - (avgbat / BATT_AVE_SAMPLES);
|
||||
/*
|
||||
* battery_millivolts is the millivolt-scaled filtered battery value.
|
||||
*/
|
||||
battery_millivolts = (avgbat / BATT_AVE_SAMPLES + 500) / 1000;
|
||||
battery_millivolts = avgbat / BATT_AVE_SAMPLES;
|
||||
|
||||
/* update battery status every time an update is available */
|
||||
battery_status_update();
|
||||
|
@ -858,15 +718,13 @@ static void power_thread_sleep(int ticks)
|
|||
/* update battery status every time an update is available */
|
||||
battery_status_update();
|
||||
|
||||
#if (CONFIG_BATTERY!=BATT_4AA_NIMH) && (CONFIG_BATTERY!=BATT_3AAA)&& \
|
||||
(CONFIG_BATTERY!=BATT_1AA)
|
||||
#ifndef NO_LOW_BATTERY_SHUTDOWN
|
||||
if (!shutdown_timeout &&
|
||||
(battery_millivolts < battery_level_shutoff[battery_type]))
|
||||
sys_poweroff();
|
||||
else
|
||||
#endif
|
||||
avgbat += battery_millivolts * 1000
|
||||
- (avgbat / BATT_AVE_SAMPLES);
|
||||
avgbat += battery_millivolts - (avgbat / BATT_AVE_SAMPLES);
|
||||
}
|
||||
|
||||
#if CONFIG_CHARGING == CHARGING_CONTROL
|
||||
|
@ -912,7 +770,7 @@ static void power_thread(void)
|
|||
#endif
|
||||
|
||||
/* initialize the voltages for the exponential filter */
|
||||
avgbat = adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR + 15000;
|
||||
avgbat = battery_adc_voltage() + 15;
|
||||
|
||||
#ifndef HAVE_MMC /* this adjustment is only needed for HD based */
|
||||
/* The battery voltage is usually a little lower directly after
|
||||
|
@ -921,17 +779,18 @@ static void power_thread(void)
|
|||
if(!charger_inserted()) /* only if charger not connected */
|
||||
#endif
|
||||
avgbat += (percent_to_volt_discharge[battery_type][6] -
|
||||
percent_to_volt_discharge[battery_type][5]) * 500;
|
||||
percent_to_volt_discharge[battery_type][5]) / 2;
|
||||
#endif /* not HAVE_MMC */
|
||||
|
||||
avgbat = avgbat * BATT_AVE_SAMPLES;
|
||||
battery_millivolts = avgbat / BATT_AVE_SAMPLES / 1000;
|
||||
battery_millivolts = avgbat / BATT_AVE_SAMPLES;
|
||||
|
||||
#if CONFIG_CHARGING
|
||||
if(charger_inserted()) {
|
||||
battery_percent = voltage_to_percent(battery_millivolts,
|
||||
percent_to_volt_charge);
|
||||
#if CONFIG_BATTERY == BATT_LIPOL1300
|
||||
#if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)
|
||||
/* Checking for iriver is a temporary kludge. */
|
||||
charger_input_state = CHARGER;
|
||||
#endif
|
||||
} else
|
||||
|
|
66
firmware/target/arm/ipod/1g2g/powermgmt-1g2g.c
Normal file
66
firmware/target/arm/ipod/1g2g/powermgmt-1g2g.c
Normal file
|
@ -0,0 +1,66 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2002 by Heikki Hannikainen, Uwe Freese
|
||||
* Revisions copyright (C) 2005 by Gerald Van Baren
|
||||
*
|
||||
* All files in this archive are subject to the GNU General Public License.
|
||||
* See the file COPYING in the source tree root for full license agreement.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#include "adc.h"
|
||||
#include "powermgmt.h"
|
||||
#include "hwcompat.h"
|
||||
|
||||
/* FIXME: Properly calibrate values. Current values "inherited" from
|
||||
* iriver H100 */
|
||||
|
||||
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
|
||||
{
|
||||
3380
|
||||
};
|
||||
|
||||
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
|
||||
{
|
||||
3020
|
||||
};
|
||||
|
||||
/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */
|
||||
const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
|
||||
{
|
||||
{ 3370, 3650, 3700, 3740, 3780, 3820, 3870, 3930, 4000, 4080, 4160 }
|
||||
};
|
||||
|
||||
#if CONFIG_CHARGING
|
||||
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
|
||||
const unsigned short percent_to_volt_charge[11] =
|
||||
{
|
||||
3540, 3860, 3930, 3980, 4000, 4020, 4040, 4080, 4130, 4180, 4230
|
||||
};
|
||||
#endif /* CONFIG_CHARGING */
|
||||
|
||||
#define BATTERY_SCALE_FACTOR_1G 4200
|
||||
#define BATTERY_SCALE_FACTOR_2G 6630
|
||||
/* full-scale ADC readout (2^8) in millivolt */
|
||||
|
||||
/* Returns battery voltage from ADC [millivolts] */
|
||||
unsigned int battery_adc_voltage(void)
|
||||
{
|
||||
unsigned adcval = adc_read(ADC_UNREG_POWER);
|
||||
|
||||
if ((IPOD_HW_REVISION >> 16) == 1)
|
||||
return (adcval * BATTERY_SCALE_FACTOR_1G) >> 8;
|
||||
else
|
||||
return (adcval * BATTERY_SCALE_FACTOR_2G) >> 8;
|
||||
}
|
90
firmware/target/arm/ipod/powermgmt-ipod-pcf.c
Normal file
90
firmware/target/arm/ipod/powermgmt-ipod-pcf.c
Normal file
|
@ -0,0 +1,90 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2002 by Heikki Hannikainen, Uwe Freese
|
||||
* Revisions copyright (C) 2005 by Gerald Van Baren
|
||||
*
|
||||
* All files in this archive are subject to the GNU General Public License.
|
||||
* See the file COPYING in the source tree root for full license agreement.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#include "adc.h"
|
||||
#include "powermgmt.h"
|
||||
|
||||
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
|
||||
{
|
||||
#ifdef IPOD_NANO
|
||||
3330
|
||||
#elif defined IPOD_VIDEO
|
||||
3450
|
||||
#else
|
||||
/* FIXME: calibrate value for other 3G+ ipods */
|
||||
3380
|
||||
#endif
|
||||
};
|
||||
|
||||
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
|
||||
{
|
||||
#ifdef IPOD_NANO
|
||||
3230
|
||||
#elif defined IPOD_VIDEO
|
||||
3450
|
||||
#else
|
||||
/* FIXME: calibrate value for other 3G+ ipods */
|
||||
3020
|
||||
#endif
|
||||
};
|
||||
|
||||
/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */
|
||||
const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
|
||||
{
|
||||
#ifdef IPOD_NANO
|
||||
/* measured values */
|
||||
{ 3230, 3620, 3700, 3730, 3750, 3780, 3830, 3890, 3950, 4030, 4160 },
|
||||
#elif defined IPOD_VIDEO
|
||||
/* iPOD Video 30GB Li-Ion 400mAh, first approach based upon measurements */
|
||||
{ 3450, 3670, 3710, 3750, 3790, 3830, 3870, 3930, 4010, 4100, 4180 },
|
||||
#else
|
||||
/* FIXME: calibrate value for other 3G+ ipods */
|
||||
/* Table is "inherited" from iriver H100. */
|
||||
{ 3370, 3650, 3700, 3740, 3780, 3820, 3870, 3930, 4000, 4080, 4160 }
|
||||
#endif
|
||||
};
|
||||
|
||||
#if CONFIG_CHARGING
|
||||
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
|
||||
const unsigned short percent_to_volt_charge[11] =
|
||||
{
|
||||
#ifdef IPOD_NANO
|
||||
/* measured values */
|
||||
3230, 3620, 3700, 3730, 3750, 3780, 3830, 3890, 3950, 4030, 4160
|
||||
#elif defined IPOD_VIDEO
|
||||
/* iPOD Video 30GB Li-Ion 400mAh, first approach based upon measurements */
|
||||
3450, 3670, 3710, 3750, 3790, 3830, 3870, 3930, 4010, 4100, 4180
|
||||
#else
|
||||
/* FIXME: calibrate value for other 3G+ ipods */
|
||||
/* Table is "inherited" from iriver H100. */
|
||||
3540, 3860, 3930, 3980, 4000, 4020, 4040, 4080, 4130, 4180, 4230
|
||||
#endif
|
||||
};
|
||||
#endif /* CONFIG_CHARGING */
|
||||
|
||||
#define BATTERY_SCALE_FACTOR 6000
|
||||
/* full-scale ADC readout (2^10) in millivolt */
|
||||
|
||||
/* Returns battery voltage from ADC [millivolts] */
|
||||
unsigned int battery_adc_voltage(void)
|
||||
{
|
||||
return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10;
|
||||
}
|
71
firmware/target/arm/iriver/h10/powermgmt-h10.c
Normal file
71
firmware/target/arm/iriver/h10/powermgmt-h10.c
Normal file
|
@ -0,0 +1,71 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2002 by Heikki Hannikainen, Uwe Freese
|
||||
* Revisions copyright (C) 2005 by Gerald Van Baren
|
||||
*
|
||||
* All files in this archive are subject to the GNU General Public License.
|
||||
* See the file COPYING in the source tree root for full license agreement.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#include "adc.h"
|
||||
#include "powermgmt.h"
|
||||
|
||||
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
|
||||
{
|
||||
#ifdef IRIVER_H10
|
||||
3760
|
||||
#elif defined IRIVER_H10_5GB
|
||||
3720
|
||||
#endif
|
||||
};
|
||||
|
||||
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
|
||||
{
|
||||
#ifdef IRIVER_H10
|
||||
3650
|
||||
#elif defined IRIVER_H10_5GB
|
||||
3650
|
||||
#endif
|
||||
};
|
||||
|
||||
/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */
|
||||
const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
|
||||
{
|
||||
#ifdef IRIVER_H10
|
||||
{ 3760, 3800, 3850, 3870, 3900, 3950, 4020, 4070, 4110, 4180, 4240 }
|
||||
#elif defined IRIVER_H10_5GB
|
||||
{ 3720, 3740, 3800, 3820, 3840, 3880, 3940, 4020, 4060, 4150, 4240 }
|
||||
#endif
|
||||
};
|
||||
|
||||
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
|
||||
const unsigned short percent_to_volt_charge[11] =
|
||||
{
|
||||
#ifdef IRIVER_H10
|
||||
3990, 4030, 4060, 4080, 4100, 4120, 4150, 4180, 4220, 4260, 4310
|
||||
#elif defined IRIVER_H10_5GB
|
||||
/* TODO: Not yet calibrated */
|
||||
3880, 3920, 3960, 4000, 4060, 4100, 4150, 4190, 4240, 4280, 4330
|
||||
#endif
|
||||
};
|
||||
|
||||
#define BATTERY_SCALE_FACTOR 4800
|
||||
/* full-scale ADC readout (2^10) in millivolt */
|
||||
|
||||
/* Returns battery voltage from ADC [millivolts] */
|
||||
unsigned int battery_adc_voltage(void)
|
||||
{
|
||||
return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10;
|
||||
}
|
53
firmware/target/arm/pnx0101/iriver-ifp7xx/powermgmt-ifp7xx.c
Normal file
53
firmware/target/arm/pnx0101/iriver-ifp7xx/powermgmt-ifp7xx.c
Normal file
|
@ -0,0 +1,53 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2002 by Heikki Hannikainen, Uwe Freese
|
||||
* Revisions copyright (C) 2005 by Gerald Van Baren
|
||||
*
|
||||
* All files in this archive are subject to the GNU General Public License.
|
||||
* See the file COPYING in the source tree root for full license agreement.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#include "adc.h"
|
||||
#include "powermgmt.h"
|
||||
|
||||
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
|
||||
{
|
||||
1050, 1150
|
||||
};
|
||||
|
||||
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
|
||||
{
|
||||
1050, 1150 /* FIXME: just copied from above, was missing in powermgmt.c */
|
||||
};
|
||||
|
||||
/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */
|
||||
const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
|
||||
{
|
||||
/* These values are the same as for Ondio divided by 3. */
|
||||
/* May need recalibration. */
|
||||
{ 930, 1080, 1140, 1180, 1210, 1250, 1280, 1320, 1360, 1420, 1580 }, /* alkaline */
|
||||
{ 1030, 1180, 1210, 1230, 1240, 1250, 1260, 1270, 1280, 1290, 1350 } /* NiMH */
|
||||
};
|
||||
|
||||
/* TODO: only roughly correct */
|
||||
#define BATTERY_SCALE_FACTOR 3072
|
||||
/* full-scale ADC readout (2^10) in millivolt */
|
||||
|
||||
/* Returns battery voltage from ADC [millivolts] */
|
||||
unsigned int battery_adc_voltage(void)
|
||||
{
|
||||
return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10;
|
||||
}
|
||||
|
58
firmware/target/arm/s3c2440/gigabeat-fx/powermgmt-meg-fx.c
Normal file
58
firmware/target/arm/s3c2440/gigabeat-fx/powermgmt-meg-fx.c
Normal file
|
@ -0,0 +1,58 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2002 by Heikki Hannikainen, Uwe Freese
|
||||
* Revisions copyright (C) 2005 by Gerald Van Baren
|
||||
*
|
||||
* All files in this archive are subject to the GNU General Public License.
|
||||
* See the file COPYING in the source tree root for full license agreement.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#include "adc.h"
|
||||
#include "powermgmt.h"
|
||||
|
||||
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
|
||||
{
|
||||
3450
|
||||
};
|
||||
|
||||
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
|
||||
{
|
||||
3400
|
||||
};
|
||||
|
||||
/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */
|
||||
const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
|
||||
{
|
||||
/* Toshiba Gigabeat Li Ion 830mAH figured from discharge curve */
|
||||
{ 3480, 3550, 3590, 3610, 3630, 3650, 3700, 3760, 3800, 3910, 3990 },
|
||||
};
|
||||
|
||||
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
|
||||
const unsigned short percent_to_volt_charge[11] =
|
||||
{
|
||||
/* Toshiba Gigabeat Li Ion 830mAH */
|
||||
3480, 3550, 3590, 3610, 3630, 3650, 3700, 3760, 3800, 3910, 3990
|
||||
};
|
||||
|
||||
/* ADC[0] is (530) at discharge and 625 at full charge */
|
||||
#define BATTERY_SCALE_FACTOR 6605
|
||||
/* full-scale ADC readout (2^10) in millivolt */
|
||||
|
||||
/* Returns battery voltage from ADC [millivolts] */
|
||||
unsigned int battery_adc_voltage(void)
|
||||
{
|
||||
return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10;
|
||||
}
|
||||
|
58
firmware/target/arm/sandisk/sansa-e200/powermgmt-e200.c
Normal file
58
firmware/target/arm/sandisk/sansa-e200/powermgmt-e200.c
Normal file
|
@ -0,0 +1,58 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2002 by Heikki Hannikainen, Uwe Freese
|
||||
* Revisions copyright (C) 2005 by Gerald Van Baren
|
||||
*
|
||||
* All files in this archive are subject to the GNU General Public License.
|
||||
* See the file COPYING in the source tree root for full license agreement.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#include "adc.h"
|
||||
#include "powermgmt.h"
|
||||
|
||||
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
|
||||
{
|
||||
3400
|
||||
};
|
||||
|
||||
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
|
||||
{
|
||||
3300
|
||||
};
|
||||
|
||||
/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */
|
||||
const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
|
||||
{
|
||||
/* Sansa Li Ion 750mAH FIXME this is a first linear approach */
|
||||
{ 3300, 3390, 3480, 3570, 3660, 3750, 3840, 3930, 4020, 4110, 4200 },
|
||||
};
|
||||
|
||||
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
|
||||
const unsigned short percent_to_volt_charge[11] =
|
||||
{
|
||||
/* Sansa Li Ion 750mAH FIXME*/
|
||||
3300, 3390, 3480, 3570, 3660, 3750, 3840, 3930, 4020, 4110, 4200
|
||||
};
|
||||
|
||||
/* ADC should read 0x3ff=5.12V */
|
||||
#define BATTERY_SCALE_FACTOR 5125
|
||||
/* full-scale ADC readout (2^10) in millivolt */
|
||||
|
||||
/* Returns battery voltage from ADC [millivolts] */
|
||||
unsigned int battery_adc_voltage(void)
|
||||
{
|
||||
return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10;
|
||||
}
|
||||
|
60
firmware/target/arm/tatung/tpj1022/powermgmt-tpj1022.c
Normal file
60
firmware/target/arm/tatung/tpj1022/powermgmt-tpj1022.c
Normal file
|
@ -0,0 +1,60 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2002 by Heikki Hannikainen, Uwe Freese
|
||||
* Revisions copyright (C) 2005 by Gerald Van Baren
|
||||
*
|
||||
* All files in this archive are subject to the GNU General Public License.
|
||||
* See the file COPYING in the source tree root for full license agreement.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#include "adc.h"
|
||||
#include "powermgmt.h"
|
||||
|
||||
/* FIXME: All voltages copied from H10 according to the battery type given
|
||||
* in config-tpj1022.h at the time of splitting. This probably needs changing
|
||||
* if that port ever gets up to speed. */
|
||||
|
||||
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
|
||||
{
|
||||
3760
|
||||
};
|
||||
|
||||
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
|
||||
{
|
||||
3650
|
||||
};
|
||||
|
||||
/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */
|
||||
const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
|
||||
{
|
||||
{ 3760, 3800, 3850, 3870, 3900, 3950, 4020, 4070, 4110, 4180, 4240 }
|
||||
};
|
||||
|
||||
#if CONFIG_CHARGING
|
||||
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
|
||||
const unsigned short percent_to_volt_charge[11] =
|
||||
{
|
||||
3990, 4030, 4060, 4080, 4100, 4120, 4150, 4180, 4220, 4260, 4310
|
||||
};
|
||||
#endif /* CONFIG_CHARGING */
|
||||
|
||||
#define BATTERY_SCALE_FACTOR 6000
|
||||
/* full-scale ADC readout (2^10) in millivolt */
|
||||
|
||||
/* Returns battery voltage from ADC [millivolts] */
|
||||
unsigned int battery_adc_voltage(void)
|
||||
{
|
||||
return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10;
|
||||
}
|
58
firmware/target/coldfire/iaudio/powermgmt-iaudio.c
Normal file
58
firmware/target/coldfire/iaudio/powermgmt-iaudio.c
Normal file
|
@ -0,0 +1,58 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2002 by Heikki Hannikainen, Uwe Freese
|
||||
* Revisions copyright (C) 2005 by Gerald Van Baren
|
||||
*
|
||||
* All files in this archive are subject to the GNU General Public License.
|
||||
* See the file COPYING in the source tree root for full license agreement.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#include "adc.h"
|
||||
#include "powermgmt.h"
|
||||
|
||||
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
|
||||
{
|
||||
3540
|
||||
};
|
||||
|
||||
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
|
||||
{
|
||||
3500
|
||||
};
|
||||
|
||||
/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */
|
||||
const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
|
||||
{
|
||||
/* average measured values from X5 and M5L */
|
||||
{ 3500, 3650, 3720, 3740, 3760, 3790, 3840, 3900, 3950, 4040, 4120 }
|
||||
};
|
||||
|
||||
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
|
||||
const unsigned short percent_to_volt_charge[11] =
|
||||
{
|
||||
/* TODO: This is identical to the discharge curve.
|
||||
* Calibrate charging curve using a battery_bench log. */
|
||||
3500, 3650, 3720, 3740, 3760, 3790, 3840, 3900, 3950, 4040, 4120
|
||||
};
|
||||
|
||||
#define BATTERY_SCALE_FACTOR 6000
|
||||
/* full-scale ADC readout (2^10) in millivolt */
|
||||
|
||||
/* Returns battery voltage from ADC [millivolts] */
|
||||
unsigned int battery_adc_voltage(void)
|
||||
{
|
||||
return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10;
|
||||
}
|
||||
|
58
firmware/target/coldfire/iriver/h100/powermgmt-h100.c
Normal file
58
firmware/target/coldfire/iriver/h100/powermgmt-h100.c
Normal file
|
@ -0,0 +1,58 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2002 by Heikki Hannikainen, Uwe Freese
|
||||
* Revisions copyright (C) 2005 by Gerald Van Baren
|
||||
*
|
||||
* All files in this archive are subject to the GNU General Public License.
|
||||
* See the file COPYING in the source tree root for full license agreement.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#include "adc.h"
|
||||
#include "powermgmt.h"
|
||||
|
||||
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
|
||||
{
|
||||
3380
|
||||
};
|
||||
|
||||
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
|
||||
{
|
||||
3020
|
||||
};
|
||||
|
||||
/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */
|
||||
const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
|
||||
{
|
||||
/* Below 3370 the backlight starts flickering during HD access */
|
||||
{ 3370, 3650, 3700, 3740, 3780, 3820, 3870, 3930, 4000, 4080, 4160 }
|
||||
};
|
||||
|
||||
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
|
||||
const unsigned short percent_to_volt_charge[11] =
|
||||
{
|
||||
/* values measured over one full charging cycle */
|
||||
3540, 3860, 3930, 3980, 4000, 4020, 4040, 4080, 4130, 4180, 4230 /* LiPo */
|
||||
};
|
||||
|
||||
/* FIX: this value is picked at random */
|
||||
#define BATTERY_SCALE_FACTOR 4266
|
||||
/* full-scale ADC readout (2^8) in millivolt */
|
||||
|
||||
/* Returns battery voltage from ADC [millivolts] */
|
||||
unsigned int battery_adc_voltage(void)
|
||||
{
|
||||
return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 8;
|
||||
}
|
||||
|
58
firmware/target/coldfire/iriver/h300/powermgmt-h300.c
Normal file
58
firmware/target/coldfire/iriver/h300/powermgmt-h300.c
Normal file
|
@ -0,0 +1,58 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2002 by Heikki Hannikainen, Uwe Freese
|
||||
* Revisions copyright (C) 2005 by Gerald Van Baren
|
||||
*
|
||||
* All files in this archive are subject to the GNU General Public License.
|
||||
* See the file COPYING in the source tree root for full license agreement.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#include "adc.h"
|
||||
#include "powermgmt.h"
|
||||
|
||||
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
|
||||
{
|
||||
3380
|
||||
};
|
||||
|
||||
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
|
||||
{
|
||||
3020
|
||||
};
|
||||
|
||||
/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */
|
||||
const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
|
||||
{
|
||||
/* Below 3370 the backlight starts flickering during HD access */
|
||||
{ 3370, 3650, 3700, 3740, 3780, 3820, 3870, 3930, 4000, 4080, 4160 }
|
||||
};
|
||||
|
||||
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
|
||||
const unsigned short percent_to_volt_charge[11] =
|
||||
{
|
||||
/* values measured over one full charging cycle */
|
||||
3540, 3860, 3930, 3980, 4000, 4020, 4040, 4080, 4130, 4180, 4230 /* LiPo */
|
||||
};
|
||||
|
||||
/* FIX: this value is picked at random */
|
||||
#define BATTERY_SCALE_FACTOR 6000
|
||||
/* full-scale ADC readout (2^8) in millivolt */
|
||||
|
||||
/* Returns battery voltage from ADC [millivolts] */
|
||||
unsigned int battery_adc_voltage(void)
|
||||
{
|
||||
return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 8;
|
||||
}
|
||||
|
58
firmware/target/sh/archos/fm_v2/powermgmt-fm_v2.c
Normal file
58
firmware/target/sh/archos/fm_v2/powermgmt-fm_v2.c
Normal file
|
@ -0,0 +1,58 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2002 by Heikki Hannikainen, Uwe Freese
|
||||
* Revisions copyright (C) 2005 by Gerald Van Baren
|
||||
*
|
||||
* All files in this archive are subject to the GNU General Public License.
|
||||
* See the file COPYING in the source tree root for full license agreement.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#include "adc.h"
|
||||
#include "powermgmt.h"
|
||||
|
||||
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
|
||||
{
|
||||
2800
|
||||
};
|
||||
|
||||
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
|
||||
{
|
||||
2580
|
||||
};
|
||||
|
||||
/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */
|
||||
const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
|
||||
{
|
||||
/* measured values */
|
||||
{ 2600, 2850, 2950, 3030, 3110, 3200, 3300, 3450, 3600, 3800, 4000 }
|
||||
};
|
||||
|
||||
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
|
||||
const unsigned short percent_to_volt_charge[11] =
|
||||
{
|
||||
/* TODO: This is identical to the discharge curve.
|
||||
* Calibrate charging curve using a battery_bench log. */
|
||||
2600, 2850, 2950, 3030, 3110, 3200, 3300, 3450, 3600, 3800, 4000
|
||||
};
|
||||
|
||||
/* Battery scale factor (guessed, seems to be 1,25 * value from recorder) */
|
||||
#define BATTERY_SCALE_FACTOR 8275
|
||||
/* full-scale ADC readout (2^10) in millivolt */
|
||||
|
||||
/* Returns battery voltage from ADC [millivolts] */
|
||||
unsigned int battery_adc_voltage(void)
|
||||
{
|
||||
return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10;
|
||||
}
|
51
firmware/target/sh/archos/ondio/powermgmt-ondio.c
Normal file
51
firmware/target/sh/archos/ondio/powermgmt-ondio.c
Normal file
|
@ -0,0 +1,51 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2002 by Heikki Hannikainen, Uwe Freese
|
||||
* Revisions copyright (C) 2005 by Gerald Van Baren
|
||||
*
|
||||
* All files in this archive are subject to the GNU General Public License.
|
||||
* See the file COPYING in the source tree root for full license agreement.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#include "adc.h"
|
||||
#include "powermgmt.h"
|
||||
|
||||
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
|
||||
{
|
||||
3100, 3450
|
||||
};
|
||||
|
||||
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
|
||||
{
|
||||
2700, 2800
|
||||
};
|
||||
|
||||
/* voltages (millivolt) of 0%, 10%, ... 100% */
|
||||
const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
|
||||
{
|
||||
/* measured values */
|
||||
{ 2800, 3250, 3410, 3530, 3640, 3740, 3850, 3950, 4090, 4270, 4750 }, /* Alkaline */
|
||||
{ 3100, 3550, 3630, 3690, 3720, 3740, 3760, 3780, 3800, 3860, 4050 } /* NiMH */
|
||||
};
|
||||
|
||||
#define BATTERY_SCALE_FACTOR 4849 /* average from 3 Ondios */
|
||||
/* full-scale ADC readout (2^10) in millivolt */
|
||||
|
||||
/* Returns battery voltage from ADC [millivolts] */
|
||||
unsigned int battery_adc_voltage(void)
|
||||
{
|
||||
return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10;
|
||||
}
|
||||
|
62
firmware/target/sh/archos/player/powermgmt-player.c
Normal file
62
firmware/target/sh/archos/player/powermgmt-player.c
Normal file
|
@ -0,0 +1,62 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2002 by Heikki Hannikainen, Uwe Freese
|
||||
* Revisions copyright (C) 2005 by Gerald Van Baren
|
||||
*
|
||||
* All files in this archive are subject to the GNU General Public License.
|
||||
* See the file COPYING in the source tree root for full license agreement.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#include "adc.h"
|
||||
#include "powermgmt.h"
|
||||
|
||||
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
|
||||
{
|
||||
4750
|
||||
};
|
||||
|
||||
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
|
||||
{
|
||||
4400
|
||||
};
|
||||
|
||||
/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */
|
||||
const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
|
||||
{
|
||||
/* original values were taken directly after charging, but it should show
|
||||
100% after turning off the device for some hours, too */
|
||||
{ 4500, 4810, 4910, 4970, 5030, 5070, 5120, 5140, 5170, 5250, 5400 }
|
||||
/* orig. values: ...,5280,5600 */
|
||||
};
|
||||
|
||||
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
|
||||
const unsigned short percent_to_volt_charge[11] =
|
||||
{
|
||||
/* values guessed, see
|
||||
http://www.seattlerobotics.org/encoder/200210/LiIon2.pdf until someone
|
||||
measures voltages over a charging cycle */
|
||||
4760, 5440, 5510, 5560, 5610, 5640, 5660, 5760, 5820, 5840, 5850 /* NiMH */
|
||||
};
|
||||
|
||||
#define BATTERY_SCALE_FACTOR 6703
|
||||
/* full-scale ADC readout (2^10) in millivolt */
|
||||
|
||||
/* Returns battery voltage from ADC [millivolts] */
|
||||
unsigned int battery_adc_voltage(void)
|
||||
{
|
||||
return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10;
|
||||
}
|
||||
|
||||
|
60
firmware/target/sh/archos/recorder/powermgmt-recorder.c
Normal file
60
firmware/target/sh/archos/recorder/powermgmt-recorder.c
Normal file
|
@ -0,0 +1,60 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2002 by Heikki Hannikainen, Uwe Freese
|
||||
* Revisions copyright (C) 2005 by Gerald Van Baren
|
||||
*
|
||||
* All files in this archive are subject to the GNU General Public License.
|
||||
* See the file COPYING in the source tree root for full license agreement.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#include "adc.h"
|
||||
#include "powermgmt.h"
|
||||
|
||||
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
|
||||
{
|
||||
4750
|
||||
};
|
||||
|
||||
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
|
||||
{
|
||||
4400
|
||||
};
|
||||
|
||||
/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */
|
||||
const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
|
||||
{
|
||||
/* original values were taken directly after charging, but it should show
|
||||
100% after turning off the device for some hours, too */
|
||||
{ 4500, 4810, 4910, 4970, 5030, 5070, 5120, 5140, 5170, 5250, 5400 }
|
||||
/* orig. values: ...,5280,5600 */
|
||||
};
|
||||
|
||||
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
|
||||
const unsigned short percent_to_volt_charge[11] =
|
||||
{
|
||||
/* values guessed, see
|
||||
http://www.seattlerobotics.org/encoder/200210/LiIon2.pdf until someone
|
||||
measures voltages over a charging cycle */
|
||||
4760, 5440, 5510, 5560, 5610, 5640, 5660, 5760, 5820, 5840, 5850 /* NiMH */
|
||||
};
|
||||
|
||||
#define BATTERY_SCALE_FACTOR 6620
|
||||
/* full-scale ADC readout (2^10) in millivolt */
|
||||
|
||||
/* Returns battery voltage from ADC [millivolts] */
|
||||
unsigned int battery_adc_voltage(void)
|
||||
{
|
||||
return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10;
|
||||
}
|
Loading…
Reference in a new issue