summaryrefslogtreecommitdiff
path: root/firmware/powermgmt.c (follow)
Commit message (Collapse)AuthorAge
* iBasso DX50/DX90: Major code cleanup and reorganization.Udo Schläpfer2015-02-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Make a few local variables staticThomas Jarosch2015-01-11
| | | | Change-Id: Ieb77a7f2cdf765afa3121320d03c0478cd97eb0f
* Clarify usb_powered() and fix some code.Amaury Pouly2015-01-08
| | | | | | | | | | 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>
* Introducing Targets iBasso DX50 & iBasso DX90Simon Rothen2014-09-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* 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>
* imx233: enable charging in bootloader USB mode by including powermgmtAmaury Pouly2012-03-15
| | | | Change-Id: I8b91b3ab60cb9ffaa127333e9bcef8c33be742fa
* Fix FS#12555: Use smoothed battery voltage for level and runtime calculationBoris Gjenero2012-01-21
| | | | | | | | 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
* lcd-remote-target.h: Use only in firmware/target/Rafaël Carré2012-01-07
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31614 a1c6a512-1295-4272-9138-f99709370657
* powermgmt.c : include lcd-remote.h only when neededRafaël Carré2012-01-07
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31612 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: Fix power off at low battery.Thomas Martitz2012-01-02
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31520 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
* FS:12299 Font glyph cache is no longer saved. Each font will now have its ↵Fred Bauer2011-10-16
| | | | | | 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
* Fix premature idle shutdown on RaaA after last track finished playingThomas Jarosch2011-04-16
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29721 a1c6a512-1295-4272-9138-f99709370657
* Don't compile handle_sleep_timer() code for the bootloaderThomas Jarosch2011-03-10
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29556 a1c6a512-1295-4272-9138-f99709370657
* Don't call apps/ code from firmware/Thomas Jarosch2011-03-10
| | | | | | | | | | | | | | 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
* 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
* Move handle_auto_poweroff() down so RaaA can call it.Thomas Jarosch2011-03-08
| | | | | | Add two ifdefs needed for APPLICATION builds git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29542 a1c6a512-1295-4272-9138-f99709370657
* Fix red in bootloaderThomas Jarosch2011-03-03
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29508 a1c6a512-1295-4272-9138-f99709370657
* Fix bookmark creation on sleep timer. Fixes FS#11493Thomas Jarosch2011-03-03
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29507 a1c6a512-1295-4272-9138-f99709370657
* Fix red - 2nd try. Use same ifdef style as in firmware/drivers/pcf50606.cThomas Jarosch2011-03-01
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29487 a1c6a512-1295-4272-9138-f99709370657
* Fix redThomas Jarosch2011-03-01
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29486 a1c6a512-1295-4272-9138-f99709370657
* Expose sys_poweroff() and cancel_shutdown() to RaaA. Hopefully fixes android ↵Thomas Jarosch2011-03-01
| | | | | | build git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29485 a1c6a512-1295-4272-9138-f99709370657
* Fix redThomas Jarosch2011-02-28
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29468 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
* Remove code that was unintentionally kept in a resynchronized patch in ↵Andree Buschmann2011-01-23
| | | | | | FS#3001. This closes FS#11873. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29119 a1c6a512-1295-4272-9138-f99709370657
* Few whitespace fixes by Michael Hohmuth FS#11885Mustapha Senhaji2011-01-18
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29082 a1c6a512-1295-4272-9138-f99709370657
* Do not return negative sleeptimer valuesMichael Chicoine2010-08-11
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27774 a1c6a512-1295-4272-9138-f99709370657
* Add optional CURRENT_ATA in runcurrent(). On MPIO HD200 powering ata takes ↵Marcin Bukat2010-07-27
| | | | | | ~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
* 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
* Revert r26055 since it breaks certain Archos targets.Michael Sevakis2010-05-15
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26067 a1c6a512-1295-4272-9138-f99709370657
* If HAVE_POWEROFF_WHILE_CHARGING is not defined and the charging ↵Michael Sevakis2010-05-15
| | | | | | 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
* 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
* Remove some old archos code that caused runtime estimation to be off on AMS ↵Michael Giacomelli2010-03-16
| | | | | | players while not actually working on Archos. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25220 a1c6a512-1295-4272-9138-f99709370657
* Statically init array to 0 instead of runtime memsetNils Wallménius2010-03-09
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25085 a1c6a512-1295-4272-9138-f99709370657
* FS#10984 - multifont! 2 major additions:Jonathan Gordon2010-02-14
| | | | | | | | | | 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
* Submit FS#10718. Small fix to calculation of estimated runtime to avoid ↵Andree Buschmann2010-01-02
| | | | | | negative results. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24146 a1c6a512-1295-4272-9138-f99709370657
* Fix another bunch of iPod Nano 2G FTL bugs. It seems to work fine for me ↵Michael Sparmann2009-10-21
| | | | | | 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
* Core changes to allow storage drivers to do cleanup on shutdown, and iPod ↵Michael Sparmann2009-10-09
| | | | | | Nano 2G shutdown code rework (FS#10668) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23057 a1c6a512-1295-4272-9138-f99709370657
* Re-work D2 power off behaviour.Rob Purchase2009-07-26
| | | | | | | | * 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
* Jz4732: add hack to fix stack overflow in the power thread (fixes USB on ↵Maurus Cuelenaere2009-05-07
| | | | | | non-bootloader) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20867 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
* Oops. Fix precompiler condition to be for all CONFIG_CHARGING != 0 (as it ↵Michael Sevakis2008-12-24
| | | | | | should be). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19581 a1c6a512-1295-4272-9138-f99709370657
* Fix red and yellow.Michael Sevakis2008-12-24
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19580 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
* Fix red. Remove stale comment.Michael Sevakis2008-12-21
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19548 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
* Color LCDs shouldn't have to have contrast set to 0 before shutdown. If ↵Michael Sevakis2008-12-09
| | | | | | 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
* Hopefully mop-up remaining red.Michael Sevakis2008-12-03
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19317 a1c6a512-1295-4272-9138-f99709370657