path: root/firmware/powermgmt.c
AgeCommit message (Collapse)AuthorFilesLines
2020-09-28fix x20 and yp-r1 builds.Solomon Peachy1-1/+1
Change-Id: Ifc6638c2ed6bc862ded389f1b81f30c7a0419ec0
2020-09-28xduoox20: UI Simulator supportSolomon Peachy1-4/+9
Change-Id: I2a03cea07fbad9fb5862ca69e4cfca2e8ca6b17f
2020-07-24[4/4] Remove HAVE_LCD_BITMAP, as it's now the only choice.Solomon Peachy1-4/+0
Note: I left behind lcd_bitmap in features.txt, because removing it would require considerable work in the manual and the translations. Change-Id: Ia8ca7761f610d9332a0d22a7d189775fb15ec88a
2020-07-24[3/4] Completely remove HWCODEC supportSolomon Peachy1-5/+0
'swcodec' is now always set (and recording_swcodec for recording-capable units) in feature.txt so the manual and language strings don't need to all be fixed up. Change-Id: Ib2c9d5d157af8d33653e2d4b4a12881b9aa6ddb0
2020-05-24Comment details, typosSylvain Saubier1-1/+1
Change-Id: I71a283b8e705ad8b9274858bc3cde19d25fc7253
2018-07-28Add cleaned-up xDuoo X3 supportSolomon Peachy1-1/+1
Cleaned up, rebased, and forward-ported from the xvortex fork. (original credit to Change-Id: Ibcc023a0271ea81e901450a88317708c2683236d Signed-off-by: Solomon Peachy <>
2015-02-02iBasso DX50/DX90: Major code cleanup and reorganization.Udo Schläpfer1-0/+2
Reorganization - Separated iBasso devices from PLATFORM_ANDROID. These are now standlone hosted targets. Most device specific code is in the firmware/target/hosted/ibasso directory. - No dependency on Android SDK, only the Android NDK is needed. 32 bit Android NDK and Android API Level 16. - Separate implementation for each device where feasible. Code cleanup - Rewrite of existing code, from simple reformat to complete reimplementation. - New backlight interface, seperating backlight from touchscreen. - Rewrite of device button handler, removing unneeded code and fixing memory leaks. - New Debug messages interface logging to Android adb logcat (DEBUGF, panicf, logf). - Rewrite of lcd device handler, removing unneeded code and fixing memory leaks. - Rewrite of audiohw device handler/pcm interface, removing unneeded code and fixing memory leaks, enabling 44.1/48kHz pthreaded playback. - Rewrite of power and powermng, proper shutdown, using batterylog results (see - Rewrite of configure (Android NDK) and device specific config. - Rewrite of the Android NDK specific Makefile. Misc - All plugins/games/demos activated. - Update tinyalsa to latest from Includes - - - Does not include due to new backlight interface and new option for hold switch, touchscreen, physical button interaction. Rockbox needs the iBasso DX50/DX90 loader for startup, see The loader expects Rockbox to be installed in /mnt/sdcard/.rockbox/. If /mnt/sdcard/ is accessed as USB mass storage device, Rockbox will exit gracefully and the loader will restart Rockbox on USB disconnect. Tested on iBasso DX50. Compiled (not tested) for iBasso DX90. Compiled (not tested) for PLATFORM_ANDROID. Change-Id: I5f5e22e68f5b4cf29c28e2b40b2c265f2beb7ab7
2015-01-11Make a few local variables staticThomas Jarosch1-1/+1
Change-Id: Ieb77a7f2cdf765afa3121320d03c0478cd97eb0f
2015-01-08Clarify usb_powered() and fix some code.Amaury Pouly1-2/+2
Either by mistake or because its meaning changed, usb_powered() doesn't mean what the name suggest, so clarify its meaning by renaming it to usb_powered_only. So use of usb_powered() are replaced by usb_inserted() when it makes more sense. Change-Id: I112887e2d8560e84587bee5f55c826dde8c806d8 Reviewed-on: Reviewed-by: Amaury Pouly <>
2014-09-18Introducing Targets iBasso DX50 & iBasso DX90Simon Rothen1-0/+2
The port to for this two targets has been entirely developped by Ilia Sergachev (alias Il or xzcc). His source can be found at . The few necesary modifications for the DX90 port was done by headwhacker form Unfortunately i could not try out the final state of the DX90 port. The port is hosted on android (without java) as standalone app. The official Firmware is required to run this port. Ilia did modify the source files for the "android" target in the rockbox source to make the DX port work. The work I did was to separate the code for DX50 (&DX90) from the android target. On this Target Ilia used source from tinyalsa from AOSP. I did not touch that part of the code because I do not understand it. What else I changed from Ilias sources besides the separation from the target "android": * removed a dirty hack to keep backlight off * changed value battery meter to voltage battery meter * made all plugins compile (named target as "standalone") and added keymaps * i added the graphics for the manual but did not do anything else for the manual yet * minor optimizations known bugs: * timers are slowed donw when playback is active (tinyalsa related?) * some minor bugs Things to do: * The main prolem will be how to install the app correctly. A guy called DOC2008 added a CWM (by to the official firmware and Ilia made a CWM installation script and a dualboot selector (rbutils/ibassoboot, build with ndk-build). We will have to find a way to install rockbox in a proper way without breaking any copyrights. Maybe ADB is an option but it is not enable with OF by default. Patching the OF is probably the way to go. * All the wiki and manual to build: needed: android ndk installed, android sdk installed with additional build-tools 19.1.0 installed ./tools/configure select iBasso DX50 or iBasso DX90 make -j apk the content of needs to be copied to /system/rockbox/app_rockbox/rockbox/ (rockbox app not needed) the content of libs/armeabi to /system/rockbox/lib/ (rockbox app needed) The boot selector is needed as /system/bin/MangoPlayer and the iBasso app as /system/bin/MangoPlayer_original. There is also the "vold" file. The one from OF does not work with DX50 rockbox (DX90 works!?), the one from Ilia is necessary. Until we have found a proper way to install it, it can only be installed following the instructions of Ilia on his bitbucket page, using the CWM-OF and his installation script package. Change-Id: Ic4faaf84824c162aabcc08e492cee6e0068719d0 Reviewed-on: Tested: Chiwen Chang <> Reviewed-by: Michael Giacomelli <>
2012-10-06Add set_sleeptimer_duration function in minutesRichard Quirk1-1/+7
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: Reviewed-by: Jonathan Gordon <>
2012-03-15imx233: enable charging in bootloader USB mode by including powermgmtAmaury Pouly1-2/+4
Change-Id: I8b91b3ab60cb9ffaa127333e9bcef8c33be742fa
2012-01-21Fix FS#12555: Use smoothed battery voltage for level and runtime calculationBoris Gjenero1-2/+5
The debug screen gets un-smoothed battery status via battery_read_info(). The level and runtime that is normally presented to the user needs to be based on smoothed voltage. Change-Id: Icb448853973aa1d5832e9094176938cfa12b2e48
2012-01-07lcd-remote-target.h: Use only in firmware/target/Rafaël Carré1-3/+0
git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2012-01-07powermgmt.c : include lcd-remote.h only when neededRafaël Carré1-0/+2
git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2012-01-03Rework powermgmt to enable code re-use on appliation and sims.Thomas Martitz1-83/+169
* 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:// a1c6a512-1295-4272-9138-f99709370657
2012-01-02ypr0: Fix power off at low battery.Thomas Martitz1-1/+1
git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-12-31ypr0: Enable battery voltage read-out, charging monitoring and charger ↵Thomas Martitz1-2/+2
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:// a1c6a512-1295-4272-9138-f99709370657
2011-12-26Option to restart running sleep timer on keypress.Nick Peskett1-0/+12
git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-10-16FS:12299 Font glyph cache is no longer saved. Each font will now have its ↵Fred Bauer1-1/+1
own glyph cache file with the extension '.gc' Includes a temporary fix that delays saving the file to prevent the creation of multiple gc files with same name. Mostly JD Gordon's code. git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-04-16Fix premature idle shutdown on RaaA after last track finished playingThomas Jarosch1-3/+5
git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-03-10Don't compile handle_sleep_timer() code for the bootloaderThomas Jarosch1-0/+2
git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-03-10Don't call apps/ code from firmware/Thomas Jarosch1-7/+1
Replace audio_stop() with audio_pause() in the sleep timer handler for the connected charger case and remove recently added bookmarking code. We don't power down anyway and a paused playback state is still eligible for automatic bookmark creation if the user later on removes the charger and waits for idle poweroff. Hopefully other devs can sleep at night now. Or maybe I should leave that change in there so they stay awake and hack on rockbox... git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-03-08Bring idle poweroff to RaaA and the simThomas Jarosch1-17/+16
git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-03-08Move handle_auto_poweroff() down so RaaA can call it.Thomas Jarosch1-53/+60
Add two ifdefs needed for APPLICATION builds git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-03-03Fix red in bootloaderThomas Jarosch1-1/+5
git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-03-03Fix bookmark creation on sleep timer. Fixes FS#11493Thomas Jarosch1-2/+3
git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-03-01Fix red - 2nd try. Use same ifdef style as in firmware/drivers/pcf50606.cThomas Jarosch1-4/+2
git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-03-01Fix redThomas Jarosch1-0/+2
git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-03-01Expose sys_poweroff() and cancel_shutdown() to RaaA. Hopefully fixes android ↵Thomas Jarosch1-2/+3
build git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-02-28Fix redThomas Jarosch1-3/+3
git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-02-28Move sleep timer code outside of PLATFORM_NATIVE ifdef so RaaA can access itThomas Jarosch1-44/+50
Also remove redundant RaaA stubs for it. git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-01-23Remove code that was unintentionally kept in a resynchronized patch in ↵Andree Buschmann1-3/+0
FS#3001. This closes FS#11873. git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-01-18Few whitespace fixes by Michael Hohmuth FS#11885Mustapha Senhaji1-1/+1
git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2010-08-11Do not return negative sleeptimer valuesMichael Chicoine1-1/+1
git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2010-07-27Add optional CURRENT_ATA in runcurrent(). On MPIO HD200 powering ata takes ↵Marcin Bukat1-0/+6
~100mA which is sagnificant contribution to the total power consumption. git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2010-06-21Rockbox as an application: Replace many occurences of #ifdef SIMULATOR with ↵Thomas Martitz1-3/+3
#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:// a1c6a512-1295-4272-9138-f99709370657
2010-05-15Revert r26055 since it breaks certain Archos targets.Michael Sevakis1-4/+0
git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2010-05-15If HAVE_POWEROFF_WHILE_CHARGING is not defined and the charging ↵Michael Sevakis1-0/+4
configuration specifies CHARGING_MONITOR or greater, allow poweroff while plugged but not actually charging the battery. git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2010-03-16Disable runtime estimation altogether when there is no runtime current ↵Michael Giacomelli1-4/+14
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:// a1c6a512-1295-4272-9138-f99709370657
2010-03-16Remove some old archos code that caused runtime estimation to be off on AMS ↵Michael Giacomelli1-5/+0
players while not actually working on Archos. git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2010-03-09Statically init array to 0 instead of runtime memsetNils Wallménius1-3/+1
git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2010-02-14FS#10984 - multifont! 2 major additions:Jonathan Gordon1-1/+1
1) seperate UI font for the remote and main displays 2) allow individual skins to load additional fonts for use in the skin (Uo to 7 extra in this first version) see CustomWPS for info on how to load a font in the skins. Code should always use FONT_UI+screen_number to get the correct user font git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2010-01-02Submit FS#10718. Small fix to calculation of estimated runtime to avoid ↵Andree Buschmann1-6/+3
negative results. git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2009-10-21Fix another bunch of iPod Nano 2G FTL bugs. It seems to work fine for me ↵Michael Sparmann1-0/+5
now, but this doesn't necessarily mean that it's bug-free. git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2009-10-09Core changes to allow storage drivers to do cleanup on shutdown, and iPod ↵Michael Sparmann1-0/+8
Nano 2G shutdown code rework (FS#10668) git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2009-07-26Re-work D2 power off behaviour.Rob Purchase1-3/+6
* Inhibit PCF timeout during shutdown and while charging * Power off the player using the same mechanism as the OF (GPIO) git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2009-05-07Jz4732: add hack to fix stack overflow in the power thread (fixes USB on ↵Maurus Cuelenaere1-0/+4
non-bootloader) git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2009-01-11c200v1/e200v1: Add battery charging. This should be usable on v2 players but ↵Michael Sevakis1-1/+1
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:// a1c6a512-1295-4272-9138-f99709370657
2008-12-24Oops. Fix precompiler condition to be for all CONFIG_CHARGING != 0 (as it ↵Michael Sevakis1-1/+1
should be). git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657