path: root/firmware/target/arm/imx233/powermgmt-imx233.c
AgeCommit message (Collapse)AuthorFilesLines
2016-05-28imx233: fix redAmaury Pouly1-0/+7
stop pretending that stmp3600 and stmp3700 have a 4.2V power rail Change-Id: If2506ed3e7c5db96dedc668f0931d59a5197dd88
2016-05-28imx233: speedup charging trickle phaseAmaury Pouly1-18/+27
Per Freescale recommandation, we need to ramp up the 4.2V rail before enabling charging. Ramping should be done at 1 step/10ms, but the old code did 1 step/1s because the powermgmt_step() function is called once every second. Use a tick task to ramp up much faster. Change-Id: I9a52bdd0c2ba5426d83ed42db8db7ecce2fea1f7
2016-05-28imx233: make sure not to discharge battery when charge is completeAmaury Pouly1-8/+8
The power management code was erroneously shuting down the 4.2V rail when charging is complete. This resulted in the DCDC draining the battery and thus the battery discharging with USB plugged... The new code keeps the 4.2V rail active so that battery remains untouched once charge is complete. Change-Id: I36e8d31e8115c12ce813c939c5d7bbf2c3490157
2016-05-28imx233: generate register headers using headergen_v2 and update code for itAmaury Pouly1-13/+14
NOTE: this commit does not introduce any change, ideally even the binary should be almost the same. I checked the disassembly by hand and there are only a few differences here and there, mostly the compiler decides to compile very close expressions slightly differently. I tried to run the new code on several targets to make sure and saw no difference. The major syntax changes of the new headers are as follows: - BF_{WR,SET,CLR} are now superpowerful and allows to set several fileds at once: BF_WR(reg, field1(value1), field2(value2), ...) - BF_CS (use like BF_WR) does a write to reg_CLR and then reg_SET instead of RMW - there is no more need for macros like BF_{WR_,SET,CLR}_V, since one can simply BF_WR with field_V(name) - the old BF_SETV macro has no trivial equivalent and is replaced with its its equivalent for BF_WR(reg_SET, ...) I also rename the register headers: "regs/regs-x.h" -> "regs/x.h" to avoid the redundant "regs". Final note: the registers were generated using the following command: ./headergen_v2 -g imx -o ../../firmware/target/arm/imx233/regs/ desc/regs-stmp3{600,700,780}.xml Change-Id: I7485e8b4315a0929a8edb63e7fa1edcaa54b1edc
2014-02-10imx233: rework early time power initAmaury Pouly1-26/+15
The current code does hazardous tweaks to the power subsystem: indeed if one boots with USB plugged and some stub powers on the DCDC switch, it will fail. Indeed, a hardware bug prevents from going back to linear regulators (see errata) so we cannot expect to reach a known state (linreg on, dcdc off) on each configuration and in particular, powering down the 4p2 rail in such a configuration will result in a power brownout. This commit works around this issue by not touching the initial power configuration until USB is (un)plugged, which are the best spots to get known states. Change-Id: I8741a3995df8ae61ca1c887a3ecb7903d0ac5136
2013-12-02imx233: fix red on stmp3600Amaury Pouly1-0/+2
Change-Id: I56527f2d643cb3c453e08cd1f759b80ce10ceb66
2013-12-01imx233: rework power management for work on stmp3700Amaury Pouly1-6/+22
Change-Id: Ia1f7e8b633dfe6ef8dc840b3eb22eaf79c53ce6b
2013-11-19Fix sim redAmaury Pouly1-0/+2
Change-Id: Icbdf47c5c508516892b1ce75558b878dc512e780
2013-11-18Initial commit for the Creative ZEN VAmaury Pouly1-1/+1
Change-Id: I3408cfdf742ea5995d5c87bf76653f436e1ec2b0
2013-07-07imx233: rework power managementAmaury Pouly1-5/+29
The current code was spreaded over power and powermgmt which made it behave strangely, especially since there are relationships between power management and frequency scaling. The new code makes sure power management is initialised before frequency scaling starts. It also makes sure to start from a known state, thus fixing potential issue when the bootloader stops in a trickle state where DCDC is improperly configured. Change-Id: Ibded2e590e108f6c98daa52d2cf1bd28763c8923
2013-06-17imx233: only do power management on imx233Amaury Pouly1-0/+4
Power management is somewhat different on stmp3700 which doesn't have the 4.2V rail and completely different on stmp3600 which has several DCDC. Currently only handle imx233. Change-Id: Ic7815141286117b74022ffc53cfa48664fd7faac
2013-06-16imx233: rewrite power using new registersAmaury Pouly1-25/+25
Change-Id: Ifbee91161220419f4d1750672b5c4ae3537cefca
2012-02-29imx233: correctly stop charging on topoff (fix battery discharging)Amaury Pouly1-1/+1
Change-Id: Ied7ea0a882e532bcf673a96d224dd55fdaae05d4
2012-01-03Rework powermgmt to enable code re-use on appliation and sims.Thomas Martitz1-1/+1
* 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
2011-12-31usb_plugged() is PP onlyRafaël Carré1-2/+2
git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-12-24imx233/fuze+: implement power management(battery charger), add powermgmt ↵Amaury Pouly1-22/+116
debug info, add power debug info, move target specific powermgmt code to its own files, remove auto-slow setup which was forgotten for debugging git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-11-14imx233: implement battery reading using power register (automatically ↵Amaury Pouly1-2/+3
updated & scaled by lradc delay) git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-11-14imx233: add include for future use of adc to read batteryAmaury Pouly1-0/+1
git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-09-13imx233/fuze+: implement power management stubsAmaury Pouly1-0/+30
git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
2011-07-23imx233/fuze+: huge reworkAmaury Pouly1-0/+34
- enable MMU -rework lcd frame buffer - add rtc/adc/power stubs (or not) - fix a few MMC related defines (hopefully) - implement cache handling for DMA - more SD work - add keymap (based on clip) - add virtual buttons - update linker scripts - big step toward apps actually compiling git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657