summaryrefslogtreecommitdiff
path: root/firmware/export/powermgmt.h (follow)
Commit message (Collapse)AuthorAge
* Fix checking for CONFIG_CHARGINGMihail Zenkov2016-04-04
| | | | Change-Id: I53b9a129679fd7b322770025106ef92033226d2a
* Add set_sleeptimer_duration function in minutesRichard Quirk2012-10-06
| | | | | | | | | | 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>
* powermgmt-target.h: move prototypes to powermgmt.hRafaël Carré2012-01-07
| | | | | | 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
* Rework powermgmt to enable code re-use on appliation and sims.Thomas Martitz2012-01-03
| | | | | | | | | | | | | | | | | | | | | * 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
* ypr0: Enable battery voltage read-out, charging monitoring and charger ↵Thomas Martitz2011-12-31
| | | | | | | | | | | | | | 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
* Option to restart running sleep timer on keypress.Nick Peskett2011-12-26
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31437 a1c6a512-1295-4272-9138-f99709370657
* Bring idle poweroff to RaaA and the simThomas Jarosch2011-03-08
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29543 a1c6a512-1295-4272-9138-f99709370657
* Introduce "power" thread for RaaAThomas Jarosch2011-03-02
| | | | | | | | | | | | 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
* Move sleep timer code outside of PLATFORM_NATIVE ifdef so RaaA can access itThomas Jarosch2011-02-28
| | | | | | Also remove redundant RaaA stubs for it. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29467 a1c6a512-1295-4272-9138-f99709370657
* powermgmt.h: include config.hRafaël Carré2010-09-03
| | | | | | | | 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
* Rockbox as an application: Replace many occurences of #ifdef SIMULATOR with ↵Thomas Martitz2010-06-21
| | | | | | | | | | | #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
* Submit FS#11065. Introduce a new system setting for en-/disabling the ↵Andree Buschmann2010-03-20
| | | | | | 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
* Disable runtime estimation altogether when there is no runtime current ↵Michael Giacomelli2010-03-16
| | | | | | 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
* FS#10756 - Free unused init codeThomas Martitz2010-03-03
| | | | | | | 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
* 1 mA gets rounded to 0 during computation, so use 2 mA as the default.Michael Giacomelli2009-06-29
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21572 a1c6a512-1295-4272-9138-f99709370657
* Clean up nested defines in powermngt.h while I'm at it.Michael Giacomelli2009-06-29
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21568 a1c6a512-1295-4272-9138-f99709370657
* Protect CURRENT_REMOTE define with an ifndef.Michael Giacomelli2009-06-29
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21567 a1c6a512-1295-4272-9138-f99709370657
* Move Archos battery runtime estimation defines into config files instead of ↵Michael Giacomelli2009-06-29
| | | | | | 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
* c200v1/e200v1: Add battery charging. This should be usable on v2 players but ↵Michael Sevakis2009-01-11
| | | | | | 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
* Simplify powermgmt thread loops so it calls functions turn (no more ↵Michael Sevakis2008-12-24
| | | | | | 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
* Gigabeat S: Implement charging and power control to charge from AC or USB. ↵Michael Sevakis2008-12-21
| | | | | | 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
* cleanup storage definesFrank Gevaerts2008-10-31
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18950 a1c6a512-1295-4272-9138-f99709370657
* use ARCHOS_ONDIO* defines when checking for ondioFrank Gevaerts2008-10-29
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18925 a1c6a512-1295-4272-9138-f99709370657
* Add rough estimate for iPod 4G power consumption. Probably a little off, ↵Michael Giacomelli2008-08-21
| | | | | | but better then using the Archos numbers. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18330 a1c6a512-1295-4272-9138-f99709370657
* Updated our source code header to explicitly mention that we are GPL v2 orDaniel Stenberg2008-06-28
| | | | | | | | | 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
* Adding new setting to System Settings <Accessory Power Supply -- off by ↵Andree Buschmann2008-04-20
| | | | | | 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
* Commit FS#8379 by Andree Buschmann. Disables much of the remaining unneeded ↵Michael Giacomelli2008-02-10
| | | | | | 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
* Accept FS#8139 - Correct assumed current consumption for iPod VideoJonathan Gordon2007-11-14
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15614 a1c6a512-1295-4272-9138-f99709370657
* Lets use the measurements Toni took months ago for the Sansa battery, ↵Michael Giacomelli2007-11-01
| | | | | | instead of the using the Archos ones. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15389 a1c6a512-1295-4272-9138-f99709370657
* First step of powermanagement rework: * Move target specific stuff into ↵Jens Arnold2007-08-17
| | | | | | 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
* Switch to using millivolt for battery voltage and other internal voltages. * ↵Jens Arnold2007-08-15
| | | | | | Fix debug voltage history display. * Some code cleanup. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14364 a1c6a512-1295-4272-9138-f99709370657
* Enable a lot more features for simulators and add stubs where necessary, ↵Nils Wallménius2007-08-12
| | | | | | 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
* Correction for ipod video and nano battery type. FS #7216 by Andree BuschmannPeter D'Hoye2007-07-14
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13885 a1c6a512-1295-4272-9138-f99709370657
* Shutdown and powermanagement cleanup: * Use the proper function for ↵Jens Arnold2007-06-29
| | | | | | 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
* Make it possible to select the correct battery capacity on ipod video, ↵Nils Wallménius2007-05-15
| | | | | | 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
* Improved power management (FS#3001). Shutdown rockbox when the battery gets ↵Barry Wardell2006-11-11
| | | | | | 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
* General: changed local adc to voltage conversions in several places to use ↵Michael Sevakis2006-10-30
| | | | | | 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
* Work-in-progress rework of charging status reading & display: * Changed ↵Jens Arnold2006-06-06
| | | | | | 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
* Commit tagcache in background when possible (at least dircache enabled).Miika Pekkarinen2006-04-16
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9686 a1c6a512-1295-4272-9138-f99709370657
* Move the battery min/max capacity to player config files and add an ↵Zakk Roberts2006-04-15
| | | | | | 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
* Archos V1 recorder charging path #2927 by Alun ThomasJörg Hohensohn2006-03-04
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8898 a1c6a512-1295-4272-9138-f99709370657
* New "battery benchmark" plugin by Alexander Spyridakis, modified a bit by meHristo Kovachev2006-01-25
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8451 a1c6a512-1295-4272-9138-f99709370657
* Make sure that no targets lose charging related features from those red ↵Brandon Low2006-01-19
| | | | | | builds yesterday. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8389 a1c6a512-1295-4272-9138-f99709370657
* Attempt fix to broken builds pt. 2Hristo Kovachev2006-01-19
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8385 a1c6a512-1295-4272-9138-f99709370657
* Charging state reporting on H3x0Brandon Low2006-01-19
| | | | | | | | | | 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
* The power thread now monitors the shutdown process and forces a poweroff if ↵Linus Nielsen Feltzing2005-09-14
| | | | | | it takes more than 8 seconds. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7517 a1c6a512-1295-4272-9138-f99709370657
* Wrong iriver model checkLinus Nielsen Feltzing2005-07-09
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7083 a1c6a512-1295-4272-9138-f99709370657
* More accurate runtime estimate calculation for iriver (still not veryMiika Pekkarinen2005-07-05
| | | | | | | accurate with other than 128k mp3 files). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7021 a1c6a512-1295-4272-9138-f99709370657
* New poweroff handling, using the SYS_POWEROFF event, allowing plugins to ↵Linus Nielsen Feltzing2005-07-05
| | | | | | save their settings before powering off. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7019 a1c6a512-1295-4272-9138-f99709370657
* Proper 'battery level dangerous' handling for Ondio. Moved this info into an ↵Jens Arnold2005-05-04
| | | | | | array, and removed unused #defines. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6403 a1c6a512-1295-4272-9138-f99709370657