summaryrefslogtreecommitdiffstats
path: root/firmware/export/powermgmt.h
AgeCommit message (Collapse)AuthorFilesLines
2020-09-28xduoox20: UI Simulator supportSolomon Peachy1-1/+1
Change-Id: I2a03cea07fbad9fb5862ca69e4cfca2e8ca6b17f
2016-04-04Fix checking for CONFIG_CHARGINGMihail Zenkov1-1/+1
Change-Id: I53b9a129679fd7b322770025106ef92033226d2a
2012-10-06Add set_sleeptimer_duration function in minutesRichard Quirk1-1/+1
Make set_sleep_timer a static function and only call set_sleeptimer_duration externally, which is always called with minutes values. Change-Id: I985308bf014e354f91c47a0b2bf62f4f5a591919 Reviewed-on: http://gerrit.rockbox.org/327 Reviewed-by: Jonathan Gordon <rockbox@jdgordon.info>
2012-01-07powermgmt-target.h: move prototypes to powermgmt.hRafaël Carré1-0/+2
Implement empty stubs if needed instead of empty static inline git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31617 a1c6a512-1295-4272-9138-f99709370657
2012-01-03Rework powermgmt to enable code re-use on appliation and sims.Thomas Martitz1-7/+10
* Introduce CONFIG_BATTERY_MEASURE define, to allow targets (application) to break powermgmt.c's assumption about the ability to read battery voltage. There's now additionally percentage (android) and remaining time measure (maemo). No measure at all also works (sdl app). If voltage can't be measured, then battery_level() is king and it'll be used for power_history and runtime estimation. * Implement target's API in the simulator, i.e. _battery_voltage(), so it doesn't need to implement it's own powermgmt.c and other stubs. Now the sim behaves much more like a native target, although it still changes the simulated battery voltage quickly, * Other changes include include renaming battery_adc_voltage() to _battery_voltage(), for consistency with the new target functions and making some of the apps code aware that voltage and runtime estimation is not always available. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31548 a1c6a512-1295-4272-9138-f99709370657
2011-12-31ypr0: Enable battery voltage read-out, charging monitoring and charger ↵Thomas Martitz1-1/+1
detection. Voltage can be read using as3543 adc (i.e. ascodec api, on this target implemented via ioctl()). TODO: Look into possibly controlling charging more by re-using powermgmt-ascodec.c. However, charging seems to be controlled by the kernel, so may not be needed. Charger state can be read using /dev/minivet. It allows to differentiate between wall charger and usb charging, but that's not implemented (is it even worthwhile?) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31470 a1c6a512-1295-4272-9138-f99709370657
2011-12-26Option to restart running sleep timer on keypress.Nick Peskett1-0/+1
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31437 a1c6a512-1295-4272-9138-f99709370657
2011-03-08Bring idle poweroff to RaaA and the simThomas Jarosch1-1/+1
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29543 a1c6a512-1295-4272-9138-f99709370657
2011-03-02Introduce "power" thread for RaaAThomas Jarosch1-3/+3
I tried to move the #ifdefs and the code in firmware/powermgmt.c around and it was still a big mess for hosted applications (RaaA/sim builds). Create our own "power" thread as recently discussed on IRC. Fixes the sleep timer for RaaA. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29501 a1c6a512-1295-4272-9138-f99709370657
2011-02-28Move sleep timer code outside of PLATFORM_NATIVE ifdef so RaaA can access itThomas Jarosch1-0/+1
Also remove redundant RaaA stubs for it. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29467 a1c6a512-1295-4272-9138-f99709370657
2010-09-03powermgmt.h: include config.hRafaël Carré1-0/+1
AMS*: define CURRENT_MAX_CHG to give more correct estimation of recharge time The amount of current each target draws from the charger is defined in powermgmt-target.h git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27994 a1c6a512-1295-4272-9138-f99709370657
2010-06-21Rockbox as an application: Replace many occurences of #ifdef SIMULATOR with ↵Thomas Martitz1-2/+2
#if (CONFIG_PLATFORM & PLATFORM_HOSTED) (or equivalently). The simulator defines PLATFORM_HOSTED, as RaaA will do (RaaA will not define SIMULATOR). The new define is to (de-)select code to compile on hosted platforms generally. Should be no functional change to targets or the simulator. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27019 a1c6a512-1295-4272-9138-f99709370657
2010-03-20Submit FS#11065. Introduce a new system setting for en-/disabling the ↵Andree Buschmann1-0/+3
Line-out. For now only implemented on iPod Video. This allows to save power if the user does not use the player's Line-out. On iPod 5G the saving is ~0.5 mA. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25257 a1c6a512-1295-4272-9138-f99709370657
2010-03-16Disable runtime estimation altogether when there is no runtime current ↵Michael Giacomelli1-5/+1
defined. It doens't work and people somehow got confused by seeing obviously wrong values. Now it will just return -1 if you try to estimate runtime without having the current defined. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25222 a1c6a512-1295-4272-9138-f99709370657
2010-03-03FS#10756 - Free unused init codeThomas Martitz1-1/+1
Introduce a new .init section for initialisation code, so that it can be copied to an area which is later overwritten before calling. The stack/bss can then overwrite that code, effectively freeing the code size that the initialisation routines need. Gives a few kB ram usage back. Only implemented for PP and as3525 so far. More targets could be added, as well as more functions. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25013 a1c6a512-1295-4272-9138-f99709370657
2009-06-291 mA gets rounded to 0 during computation, so use 2 mA as the default.Michael Giacomelli1-5/+5
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21572 a1c6a512-1295-4272-9138-f99709370657
2009-06-29Clean up nested defines in powermngt.h while I'm at it.Michael Giacomelli1-8/+4
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21568 a1c6a512-1295-4272-9138-f99709370657
2009-06-29Protect CURRENT_REMOTE define with an ifndef.Michael Giacomelli1-0/+2
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21567 a1c6a512-1295-4272-9138-f99709370657
2009-06-29Move Archos battery runtime estimation defines into config files instead of ↵Michael Giacomelli1-7/+9
powermgmt.h. Replace old default values (which were actually the Archos Player currents) with a new default (1mA). This should give nonsense runtime estimates (instead of semi-reasonable but completely wrong estimates) on all players that do not have a battery current defined. Hopefully this will remind people that they should define the battery current when they start a new port. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21565 a1c6a512-1295-4272-9138-f99709370657
2009-01-11c200v1/e200v1: Add battery charging. This should be usable on v2 players but ↵Michael Sevakis1-2/+5
those should be evaluated for current, endpoint voltage and whether or not accurate battery readings may always be obtained (which determines algorithm setup and behavior). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19748 a1c6a512-1295-4272-9138-f99709370657
2008-12-24Simplify powermgmt thread loops so it calls functions turn (no more ↵Michael Sevakis1-122/+73
power_thread_sleep). Do other target-friendly simplifications, generic battery switch handling and split sim-specific code. Whoever can, please verify charging on the Archos Recorder (due to change in the charger duty cycle code). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19579 a1c6a512-1295-4272-9138-f99709370657
2008-12-21Gigabeat S: Implement charging and power control to charge from AC or USB. ↵Michael Sevakis1-8/+40
Hold MENU while plugging USB cable to charge from USB without connecting. Under Windows, plugging USB for charging only but not connecting still needs to be properly handled (driver popup issue) but it will charge when connected normally-- no issue under Linux. Some accomodating changes made to powermgmt.c will soon be made nicer. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19547 a1c6a512-1295-4272-9138-f99709370657
2008-10-31cleanup storage definesFrank Gevaerts1-2/+2
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18950 a1c6a512-1295-4272-9138-f99709370657
2008-10-29use ARCHOS_ONDIO* defines when checking for ondioFrank Gevaerts1-1/+1
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18925 a1c6a512-1295-4272-9138-f99709370657
2008-08-21Add rough estimate for iPod 4G power consumption. Probably a little off, ↵Michael Giacomelli1-1/+7
but better then using the Archos numbers. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18330 a1c6a512-1295-4272-9138-f99709370657
2008-06-28Updated our source code header to explicitly mention that we are GPL v2 orDaniel Stenberg1-2/+4
later. We still need to hunt down snippets used that are not. 1324 modified files... http://www.rockbox.org/mail/archive/rockbox-dev-archive-2008-06/0060.shtml git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17847 a1c6a512-1295-4272-9138-f99709370657
2008-04-20Adding new setting to System Settings <Accessory Power Supply -- off by ↵Andree Buschmann1-1/+3
default). This setting can be used to enable/disable the power supply for accessories. With this commit implemented for iPods with PCF50605 power controller. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17193 a1c6a512-1295-4272-9138-f99709370657
2008-02-10Commit FS#8379 by Andree Buschmann. Disables much of the remaining unneeded ↵Michael Giacomelli1-7/+11
hardware on PP50xx targets (Ipods, Sansa, H10s, etc) resulting in a large savings in power and consequent increase in battery life. Results vary from target to target and from codec to codec, but we now approach the OF runtime on several PP devices. For now, leave base CPU clock at 30MHz, although further savings is possible with some codecs if clock is reduced. Additionally, fix battery capacity on c200 and use my measurements to improve runtime estimation for Sandisk targets. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16259 a1c6a512-1295-4272-9138-f99709370657
2007-11-14Accept FS#8139 - Correct assumed current consumption for iPod VideoJonathan Gordon1-5/+5
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15614 a1c6a512-1295-4272-9138-f99709370657
2007-11-01Lets use the measurements Toni took months ago for the Sansa battery, ↵Michael Giacomelli1-1/+5
instead of the using the Archos ones. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15389 a1c6a512-1295-4272-9138-f99709370657
2007-08-17First step of powermanagement rework: * Move target specific stuff into ↵Jens Arnold1-1/+9
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
2007-08-15Switch to using millivolt for battery voltage and other internal voltages. * ↵Jens Arnold1-7/+6
Fix debug voltage history display. * Some code cleanup. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14364 a1c6a512-1295-4272-9138-f99709370657
2007-08-12Enable a lot more features for simulators and add stubs where necessary, ↵Nils Wallménius1-28/+28
simulators should now work with identical lng and voice files as the respective target git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14299 a1c6a512-1295-4272-9138-f99709370657
2007-07-14Correction for ipod video and nano battery type. FS #7216 by Andree BuschmannPeter D'Hoye1-1/+13
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13885 a1c6a512-1295-4272-9138-f99709370657
2007-06-29Shutdown and powermanagement cleanup: * Use the proper function for ↵Jens Arnold1-3/+0
determining whether the battery level is safe, and get rid of the extra one. Low battery warning now appears at 10% or less. * Don't delay shutdown artificially by 3 seconds due to low/critical battery warning. * Shutdown at critical battery level: Skip all disk-hitting housekeeping, make sure dircache stops, and don't mark disk as clean in eeprom. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13734 a1c6a512-1295-4272-9138-f99709370657
2007-05-15Make it possible to select the correct battery capacity on ipod video, ↵Nils Wallménius1-9/+10
default is the 30GB models 400mAh, discharge curve and runtime estimation is still no calibrated. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13395 a1c6a512-1295-4272-9138-f99709370657
2006-11-11Improved power management (FS#3001). Shutdown rockbox when the battery gets ↵Barry Wardell1-10/+24
to a level where the device doesn't function properly. Calculate remaining charging time while charging (rather than remaining running time). Show "Low Battery" and "Battery Empty" warnings. Also fixes FS#4786. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11507 a1c6a512-1295-4272-9138-f99709370657
2006-10-30General: changed local adc to voltage conversions in several places to use ↵Michael Sevakis1-1/+4
battery_voltage. Added battery_read_info function for unfiltered battery information. x5: removed adc_read as a distinct function. Removed adc tick task. adc_init is empty inline. Adjusted battery scale, voltage to level array and read 10 bits from the ADC for battery since 255 levels is not enough for true centivolt resolution. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11396 a1c6a512-1295-4272-9138-f99709370657
2006-06-06Work-in-progress rework of charging status reading & display: * Changed ↵Jens Arnold1-12/+10
several charging related HAVE_* macros into one multi-value CONFIG_CHARGING. * Always use proper macros for charging states. * Battery symbol charging animation now starts from current level on all targets with charging. Two-colour animation kept for non-b&w targets. Round down fill level while charging as before, but round to nearest pixel value for discharging on all targets. * Charging anim fixed on player. * Some code cleanup. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10080 a1c6a512-1295-4272-9138-f99709370657
2006-04-16Commit tagcache in background when possible (at least dircache enabled).Miika Pekkarinen1-0/+1
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9686 a1c6a512-1295-4272-9138-f99709370657
2006-04-15Move the battery min/max capacity to player config files and add an ↵Zakk Roberts1-18/+0
increment setting (amount of mAh to increase/decrease by in the settings menu) for more precise battery value tweaking/limiting per-model. This allows the proper range for iAudio X5 - 950mAh, or 2250mAh for the X5L. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9678 a1c6a512-1295-4272-9138-f99709370657
2006-03-04Archos V1 recorder charging path #2927 by Alun ThomasJörg Hohensohn1-3/+3
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8898 a1c6a512-1295-4272-9138-f99709370657
2006-01-25New "battery benchmark" plugin by Alexander Spyridakis, modified a bit by meHristo Kovachev1-0/+2
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8451 a1c6a512-1295-4272-9138-f99709370657
2006-01-19Make sure that no targets lose charging related features from those red ↵Brandon Low1-2/+0
builds yesterday. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8389 a1c6a512-1295-4272-9138-f99709370657
2006-01-19Attempt fix to broken builds pt. 2Hristo Kovachev1-1/+1
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8385 a1c6a512-1295-4272-9138-f99709370657
2006-01-19Charging state reporting on H3x0Brandon Low1-3/+27
Don't read the GPIO every refresh of statusbar or gwps for plugged state, use a variable exported from powermgmt instead. Allow Custom WPS to access %bc for battery charge state on targets that support this. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8383 a1c6a512-1295-4272-9138-f99709370657
2005-09-14The power thread now monitors the shutdown process and forces a poweroff if ↵Linus Nielsen Feltzing1-1/+1
it takes more than 8 seconds. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7517 a1c6a512-1295-4272-9138-f99709370657
2005-07-09Wrong iriver model checkLinus Nielsen Feltzing1-2/+2
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7083 a1c6a512-1295-4272-9138-f99709370657
2005-07-05More accurate runtime estimate calculation for iriver (still not veryMiika Pekkarinen1-11/+15
accurate with other than 128k mp3 files). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7021 a1c6a512-1295-4272-9138-f99709370657
2005-07-05New poweroff handling, using the SYS_POWEROFF event, allowing plugins to ↵Linus Nielsen Feltzing1-0/+1
save their settings before powering off. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7019 a1c6a512-1295-4272-9138-f99709370657