Tasklist
FS#12502 - Rework powermgmnt for RaaA/Sim
| Task Type |
Patches |
| Category |
Operating System/Drivers |
| Status |
Closed |
| Assigned To |
Thomas Martitz (kugel.)
|
| Player Type |
All players |
| Severity |
Low |
| Priority |
Normal |
| Reported Version |
Release 3.10 |
| Due in Version |
Undecided |
| Due Date |
Undecided |
| Percent Complete |
|
| Private |
No
|
|
Details
This patch reworks powermgmt.c and related files to allow it to compile for hosted targets.
Since it assumed the ability to read voltage, I made it aware of other concepts in order to make it useful on RaaA. Some targets can only read battery level (android), some can read level & estimated time (Maemo, making our own estimation superflous). And some can read nothing (SDL app).
This patch introduces new defines CONFIG_BATTERY_MEASURE and compiles powermgmt.c for all of them, including the simulator. This makes hosted/powermgnt.c unneeded. Runtime estimation works with voltage and level reading, provided a battery capacity is given. power_history[] tracks battery level if voltage can't be measured.
Furthermore, the behavior of the sim is changed to implement a targets API (i.e. _battery_voltage()) instead of re-implementing powermgmt.c so it's much closer to real targets now.
Rename battery_adc_voltage() to _battery_voltage() for consistency.
So, I would like some tests, and naturally comments are welcome as well.
pm-rework.patch
(103.9 KiB)
b/apps/debug_menu.c | 66 +-
b/apps/gui/skin_engine/skin_tokens.c | 10
b/apps/menus/main_menu.c | 6
b/apps/menus/theme_menu.c | 6
b/apps/misc.c | 4
b/apps/plugin.c | 2
b/apps/plugin.h | 4
b/apps/plugins/SOURCES | 2
b/apps/settings.h | 2
b/apps/settings_list.c | 2
b/firmware/SOURCES | 5
b/firmware/drivers/audio/android.c | 2
b/firmware/drivers/audio/sdl.c | 3
b/firmware/export/config.h | 18
b/firmware/export/config/android.h | 6
b/firmware/export/config/archosfmrecorder.h | 2
b/firmware/export/config/archosondiofm.h | 2
b/firmware/export/config/archosondiosp.h | 2
b/firmware/export/config/archosplayer.h | 2
b/firmware/export/config/archosrecorder.h | 2
b/firmware/export/config/archosrecorderv2.h | 2
b/firmware/export/config/cowond2.h | 2
b/firmware/export/config/creativezv.h | 2
b/firmware/export/config/gigabeatfx.h | 2
b/firmware/export/config/gigabeats.h | 2
b/firmware/export/config/gogearhdd1630.h | 2
b/firmware/export/config/gogearhdd6330.h | 2
b/firmware/export/config/gogearsa9200.h | 2
b/firmware/export/config/hifimanhm60x.h | 2
b/firmware/export/config/hifimanhm801.h | 2
b/firmware/export/config/iaudio7.h | 2
b/firmware/export/config/iaudiom3.h | 2
b/firmware/export/config/iaudiom5.h | 2
b/firmware/export/config/iaudiox5.h | 2
b/firmware/export/config/ipod1g2g.h | 2
b/firmware/export/config/ipod3g.h | 2
b/firmware/export/config/ipod4g.h | 2
b/firmware/export/config/ipod6g.h | 2
b/firmware/export/config/ipodcolor.h | 2
b/firmware/export/config/ipodmini1g.h | 2
b/firmware/export/config/ipodmini2g.h | 2
b/firmware/export/config/ipodnano1g.h | 2
b/firmware/export/config/ipodnano2g.h | 2
b/firmware/export/config/ipodvideo.h | 2
b/firmware/export/config/iriverh10.h | 2
b/firmware/export/config/iriverh100.h | 2
b/firmware/export/config/iriverh10_5gb.h | 2
b/firmware/export/config/iriverh120.h | 2
b/firmware/export/config/iriverh300.h | 2
b/firmware/export/config/iriverifp7xx.h | 2
b/firmware/export/config/logikdax.h | 2
b/firmware/export/config/lyreproto1.h | 2
b/firmware/export/config/meizum3.h | 2
b/firmware/export/config/meizum6sl.h | 2
b/firmware/export/config/meizum6sp.h | 2
b/firmware/export/config/mini2440.h | 2
b/firmware/export/config/mpiohd200.h | 2
b/firmware/export/config/mpiohd300.h | 2
b/firmware/export/config/mrobe100.h | 2
b/firmware/export/config/mrobe500.h | 2
b/firmware/export/config/nokian8xx.h | 3
b/firmware/export/config/nokian900.h | 2
b/firmware/export/config/ondavx747.h | 2
b/firmware/export/config/ondavx767.h | 2
b/firmware/export/config/ondavx777.h | 2
b/firmware/export/config/rk27generic.h | 2
b/firmware/export/config/samsungyh820.h | 2
b/firmware/export/config/samsungyh920.h | 2
b/firmware/export/config/samsungyh925.h | 2
b/firmware/export/config/samsungypr0.h | 2
b/firmware/export/config/samsungyps3.h | 2
b/firmware/export/config/sansac100.h | 2
b/firmware/export/config/sansac200.h | 2
b/firmware/export/config/sansac200v2.h | 2
b/firmware/export/config/sansaclip.h | 2
b/firmware/export/config/sansaclipplus.h | 2
b/firmware/export/config/sansaclipv2.h | 2
b/firmware/export/config/sansaclipzip.h | 2
b/firmware/export/config/sansaconnect.h | 2
b/firmware/export/config/sansae200.h | 2
b/firmware/export/config/sansae200v2.h | 2
b/firmware/export/config/sansafuze.h | 2
b/firmware/export/config/sansafuzeplus.h | 2
b/firmware/export/config/sansafuzev2.h | 2
b/firmware/export/config/sansam200.h | 2
b/firmware/export/config/sansam200v4.h | 2
b/firmware/export/config/sansaview.h | 2
b/firmware/export/config/sim.h | 5
b/firmware/export/config/tatungtpj1022.h | 2
b/firmware/export/config/vibe500.h | 2
b/firmware/export/config/zenvisionm30gb.h | 2
b/firmware/export/config/zenvisionm60gb.h | 2
b/firmware/export/power.h | 3
b/firmware/export/powermgmt.h | 17
b/firmware/powermgmt.c | 243 ++++++----
b/firmware/target/arm/as3525/sansa-m200v4/powermgmt-m200v4.c | 2
b/firmware/target/arm/imx233/debug-imx233.c | 2
b/firmware/target/arm/imx233/powermgmt-imx233.c | 2
b/firmware/target/arm/imx31/gigabeat-s/powermgmt-gigabeat-s.c | 6
b/firmware/target/arm/ipod/1g2g/powermgmt-1g2g.c | 2
b/firmware/target/arm/ipod/powermgmt-ipod-pcf.c | 2
b/firmware/target/arm/iriver/h10/powermgmt-h10.c | 2
b/firmware/target/arm/olympus/mrobe-100/powermgmt-mr100.c | 2
b/firmware/target/arm/pbell/vibe500/powermgmt-vibe500.c | 2
b/firmware/target/arm/philips/hdd1630/powermgmt-hdd1630.c | 2
b/firmware/target/arm/philips/hdd6330/powermgmt-hdd6330.c | 2
b/firmware/target/arm/pnx0101/iriver-ifp7xx/powermgmt-ifp7xx.c | 2
b/firmware/target/arm/powermgmt-ascodec.c | 4
b/firmware/target/arm/rk27xx/hm60x/powermgmt-hm60x.c | 2
b/firmware/target/arm/rk27xx/hm801/powermgmt-hm801.c | 2
b/firmware/target/arm/rk27xx/rk27generic/powermgmt-rk27generic.c | 2
b/firmware/target/arm/s3c2440/gigabeat-fx/powermgmt-meg-fx.c | 2
b/firmware/target/arm/s3c2440/mini2440/powermgmt-mini2440.c | 2
b/firmware/target/arm/s5l8700/ipodnano2g/powermgmt-nano2g.c | 2
b/firmware/target/arm/s5l8700/meizu-m3/powermgmt-m3.c | 2
b/firmware/target/arm/s5l8700/meizu-m6sp/powermgmt-m6sp.c | 2
b/firmware/target/arm/s5l8702/ipod6g/powermgmt-ipod6g.c | 2
b/firmware/target/arm/samsung/yh820/powermgmt-yh820.c | 2
b/firmware/target/arm/samsung/yh920/powermgmt-yh920.c | 2
b/firmware/target/arm/samsung/yh925/powermgmt-yh925.c | 2
b/firmware/target/arm/sandisk/sansa-view/powermgmt-view.c | 2
b/firmware/target/arm/tatung/tpj1022/powermgmt-tpj1022.c | 2
b/firmware/target/arm/tcc77x/iaudio7/powermgmt-iaudio7.c | 2
b/firmware/target/arm/tcc77x/powermgmt-tcc77x.c | 2
b/firmware/target/arm/tcc780x/cowond2/powermgmt-cowond2.c | 2
b/firmware/target/arm/tms320dm320/creative-zvm/powermgmt-creativezvm.c | 2
b/firmware/target/arm/tms320dm320/mrobe-500/powermgmt-mr500.c | 2
b/firmware/target/arm/tms320dm320/sansa-connect/powermgmt-sansaconnect.c | 2
b/firmware/target/coldfire/iaudio/m3/powermgmt-m3.c | 2
b/firmware/target/coldfire/iaudio/powermgmt-iaudio.c | 2
b/firmware/target/coldfire/iriver/h100/powermgmt-h100.c | 2
b/firmware/target/coldfire/iriver/h300/powermgmt-h300.c | 2
b/firmware/target/coldfire/mpio/hd200/powermgmt-hd200.c | 2
b/firmware/target/coldfire/mpio/hd300/powermgmt-hd300.c | 2
b/firmware/target/hosted/android/powermgmt-android.c | 31 -
b/firmware/target/hosted/android/system-android.c | 2
b/firmware/target/hosted/maemo/maemo-thread.c | 28 -
a/firmware/target/hosted/powermgmt.c | 56 --
b/firmware/target/hosted/sdl/system-sdl.c | 2
b/firmware/target/hosted/ypr0/powermgmt-ypr0.c | 4
b/firmware/target/mips/ingenic_jz47xx/onda_vx747/sadc-onda_vx747.c | 2
b/firmware/target/mips/ingenic_jz47xx/onda_vx767/sadc-onda_vx767.c | 2
b/firmware/target/sh/archos/fm_v2/powermgmt-fm_v2.c | 2
b/firmware/target/sh/archos/ondio/powermgmt-ondio.c | 2
b/firmware/target/sh/archos/player/powermgmt-player.c | 2
b/firmware/target/sh/archos/recorder/powermgmt-recorder.c | 2
b/uisimulator/common/SOURCES | 5
b/uisimulator/common/powermgmt-sim.c | 74 ---
b/uisimulator/common/stubs.c | 26 -
149 files changed, 511 insertions(+), 372 deletions(-)
|
Closed by
Thomas Martitz (kugel.)
Wednesday, 04 January 2012, 00:45 GMT+2
Reason for closing: Accepted
Additional comments about closing: r31548
Loading...
What's the reason the battery voltage is stored as "int" instead of "unsigned int"?
Why are target API functions (eg. _battery_voltage()) and data (eg. percent_to_volt_discharge[BATTERY_TYPES_COUNT][11]) needed in powermgmt.c when the target doesn't have that capability? Wouldn't it be better to instead have preprocessor conditionals so those aren't used?
I can't compile a 5G iPod sim due to:
- powermgmt-sim.c: accessory_supply_set() and lineout_set() removed
- powermgmt-sim.c: battery_voltage() should be _battery_voltage()
- undefined reference to lcd_shutdown(). Apparently, shutdown_hw() is not needed in the sim.
mkdir clipsim && cd clipsim && ../tools/configure --target=62 --type=S && make
/home/nick/rockbox-temp/clipsim2/firmware/libfirmware.a(powermgmt.o): In function `battery_read_info':
/home/nick/rockbox-temp/firmware/powermgmt.c:147: undefined reference to `_battery_voltage'
[etc..]
EDIT: Updated again, for maemo