summaryrefslogtreecommitdiff
path: root/firmware/powermgmt.c
AgeCommit message (Collapse)Author
2015-02-02iBasso DX50/DX90: Major code cleanup and reorganization.Udo Schläpfer
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 http://gerrit.rockbox.org/r/#/c/1047/). - 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 https://github.com/tinyalsa/tinyalsa. Includes - http://gerrit.rockbox.org/r/#/c/993/ - http://gerrit.rockbox.org/r/#/c/1010/ - http://gerrit.rockbox.org/r/#/c/1035/ Does not include http://gerrit.rockbox.org/r/#/c/1007/ 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 http://gerrit.rockbox.org/r/#/c/1099/ 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 Jarosch
Change-Id: Ieb77a7f2cdf765afa3121320d03c0478cd97eb0f
2015-01-08Clarify usb_powered() and fix some code.Amaury Pouly
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: http://gerrit.rockbox.org/1097 Reviewed-by: Amaury Pouly <amaury.pouly@gmail.com>
2014-09-18Introducing Targets iBasso DX50 & iBasso DX90Simon Rothen
The port to for this two targets has been entirely developped by Ilia Sergachev (alias Il or xzcc). His source can be found at https://bitbucket.org/isergachev/rockbox . The few necesary modifications for the DX90 port was done by headwhacker form head-fi.org. 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 androtab.info) 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 rockbox.zip/.rockbox 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: http://gerrit.rockbox.org/941 Tested: Chiwen Chang <rock1104.tw@yahoo.com.tw> Reviewed-by: Michael Giacomelli <giac2000@hotmail.com>
2012-10-06Add set_sleeptimer_duration function in minutesRichard Quirk
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-03-15imx233: enable charging in bootloader USB mode by including powermgmtAmaury Pouly
Change-Id: I8b91b3ab60cb9ffaa127333e9bcef8c33be742fa
2012-01-21Fix FS#12555: Use smoothed battery voltage for level and runtime calculationBoris Gjenero
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é
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31614 a1c6a512-1295-4272-9138-f99709370657
2012-01-07powermgmt.c : include lcd-remote.h only when neededRafaël Carré
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31612 a1c6a512-1295-4272-9138-f99709370657
2012-01-03Rework powermgmt to enable code re-use on appliation and sims.Thomas Martitz
* 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
2012-01-02ypr0: Fix power off at low battery.Thomas Martitz
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31520 a1c6a512-1295-4272-9138-f99709370657
2011-12-31ypr0: Enable battery voltage read-out, charging monitoring and charger ↵Thomas Martitz
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 Peskett
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31437 a1c6a512-1295-4272-9138-f99709370657
2011-10-16FS:12299 Font glyph cache is no longer saved. Each font will now have its ↵Fred Bauer
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://svn.rockbox.org/rockbox/trunk@30760 a1c6a512-1295-4272-9138-f99709370657
2011-04-16Fix premature idle shutdown on RaaA after last track finished playingThomas Jarosch
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29721 a1c6a512-1295-4272-9138-f99709370657
2011-03-10Don't compile handle_sleep_timer() code for the bootloaderThomas Jarosch
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29556 a1c6a512-1295-4272-9138-f99709370657
2011-03-10Don't call apps/ code from firmware/Thomas Jarosch
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://svn.rockbox.org/rockbox/trunk@29555 a1c6a512-1295-4272-9138-f99709370657
2011-03-08Bring idle poweroff to RaaA and the simThomas Jarosch
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29543 a1c6a512-1295-4272-9138-f99709370657
2011-03-08Move handle_auto_poweroff() down so RaaA can call it.Thomas Jarosch
Add two ifdefs needed for APPLICATION builds git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29542 a1c6a512-1295-4272-9138-f99709370657
2011-03-03Fix red in bootloaderThomas Jarosch
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29508 a1c6a512-1295-4272-9138-f99709370657
2011-03-03Fix bookmark creation on sleep timer. Fixes FS#11493Thomas Jarosch
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29507 a1c6a512-1295-4272-9138-f99709370657
2011-03-01Fix red - 2nd try. Use same ifdef style as in firmware/drivers/pcf50606.cThomas Jarosch
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29487 a1c6a512-1295-4272-9138-f99709370657
2011-03-01Fix redThomas Jarosch
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29486 a1c6a512-1295-4272-9138-f99709370657
2011-03-01Expose sys_poweroff() and cancel_shutdown() to RaaA. Hopefully fixes android ↵Thomas Jarosch
build git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29485 a1c6a512-1295-4272-9138-f99709370657
2011-02-28Fix redThomas Jarosch
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29468 a1c6a512-1295-4272-9138-f99709370657
2011-02-28Move sleep timer code outside of PLATFORM_NATIVE ifdef so RaaA can access itThomas Jarosch
Also remove redundant RaaA stubs for it. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29467 a1c6a512-1295-4272-9138-f99709370657
2011-01-23Remove code that was unintentionally kept in a resynchronized patch in ↵Andree Buschmann
FS#3001. This closes FS#11873. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29119 a1c6a512-1295-4272-9138-f99709370657
2011-01-18Few whitespace fixes by Michael Hohmuth FS#11885Mustapha Senhaji
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29082 a1c6a512-1295-4272-9138-f99709370657
2010-08-11Do not return negative sleeptimer valuesMichael Chicoine
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27774 a1c6a512-1295-4272-9138-f99709370657
2010-07-27Add optional CURRENT_ATA in runcurrent(). On MPIO HD200 powering ata takes ↵Marcin Bukat
~100mA which is sagnificant contribution to the total power consumption. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27589 a1c6a512-1295-4272-9138-f99709370657
2010-06-21Rockbox as an application: Replace many occurences of #ifdef SIMULATOR with ↵Thomas Martitz
#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-05-15Revert r26055 since it breaks certain Archos targets.Michael Sevakis
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26067 a1c6a512-1295-4272-9138-f99709370657
2010-05-15If HAVE_POWEROFF_WHILE_CHARGING is not defined and the charging ↵Michael Sevakis
configuration specifies CHARGING_MONITOR or greater, allow poweroff while plugged but not actually charging the battery. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26055 a1c6a512-1295-4272-9138-f99709370657
2010-03-16Disable runtime estimation altogether when there is no runtime current ↵Michael Giacomelli
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-16Remove some old archos code that caused runtime estimation to be off on AMS ↵Michael Giacomelli
players while not actually working on Archos. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25220 a1c6a512-1295-4272-9138-f99709370657
2010-03-09Statically init array to 0 instead of runtime memsetNils Wallménius
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25085 a1c6a512-1295-4272-9138-f99709370657
2010-02-14FS#10984 - multifont! 2 major additions:Jonathan Gordon
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://svn.rockbox.org/rockbox/trunk@24644 a1c6a512-1295-4272-9138-f99709370657
2010-01-02Submit FS#10718. Small fix to calculation of estimated runtime to avoid ↵Andree Buschmann
negative results. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24146 a1c6a512-1295-4272-9138-f99709370657
2009-10-21Fix another bunch of iPod Nano 2G FTL bugs. It seems to work fine for me ↵Michael Sparmann
now, but this doesn't necessarily mean that it's bug-free. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23307 a1c6a512-1295-4272-9138-f99709370657
2009-10-09Core changes to allow storage drivers to do cleanup on shutdown, and iPod ↵Michael Sparmann
Nano 2G shutdown code rework (FS#10668) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23057 a1c6a512-1295-4272-9138-f99709370657
2009-07-26Re-work D2 power off behaviour.Rob Purchase
* Inhibit PCF timeout during shutdown and while charging * Power off the player using the same mechanism as the OF (GPIO) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22056 a1c6a512-1295-4272-9138-f99709370657
2009-05-07Jz4732: add hack to fix stack overflow in the power thread (fixes USB on ↵Maurus Cuelenaere
non-bootloader) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20867 a1c6a512-1295-4272-9138-f99709370657
2009-01-11c200v1/e200v1: Add battery charging. This should be usable on v2 players but ↵Michael Sevakis
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-24Oops. Fix precompiler condition to be for all CONFIG_CHARGING != 0 (as it ↵Michael Sevakis
should be). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19581 a1c6a512-1295-4272-9138-f99709370657
2008-12-24Fix red and yellow.Michael Sevakis
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19580 a1c6a512-1295-4272-9138-f99709370657
2008-12-24Simplify powermgmt thread loops so it calls functions turn (no more ↵Michael Sevakis
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-21Fix red. Remove stale comment.Michael Sevakis
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19548 a1c6a512-1295-4272-9138-f99709370657
2008-12-21Gigabeat S: Implement charging and power control to charge from AC or USB. ↵Michael Sevakis
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-12-09Color LCDs shouldn't have to have contrast set to 0 before shutdown. If ↵Michael Sevakis
contrast is implemented, then it can cause it to flash a bit before poweroff. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19369 a1c6a512-1295-4272-9138-f99709370657
2008-12-03Hopefully mop-up remaining red.Michael Sevakis
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19317 a1c6a512-1295-4272-9138-f99709370657