I spent some time over the weekend adding a couple of features to the Balloon 3 kernel. It can now switch itself off, and programs can detect the state of the power supply. This is essential in battery-powered applications. The first is the ability to switch off the Balloon. This is implemented so that the standard 'shutdown -p' or 'poweroff' commands Just Work. It has a couple of caveats: - it's not really 'off' but deep-sleep mode. The board can be woken up again by a signal on GPIO0 or, I think, GPIO1, as well as the obvious hardware reset. - the audio codec doesn't get shut down properly so its analogue entrails are still consuming power. On my test board, a 3v32 build, the current consumption was 1.5mA. On a new 3v33 board it's 7mA. I'm not sure what's going on there yet. Poweroff required a kernel change (in balloon3.patch) and a minor tweak to the CPLD, so that GPIO0 is held low rather than high by default. The second feature is the ability for userland to see the state of the power failure signals connected to the processor. There's now a kernel module, balloon3_powerfail. It's not big and it's not clever, but it creates a device /dev/powerfail which returns on each open and read a hex number. Bit 0 is nPWR_OK and Bit 1 is BATT_FAULT. nPWR_OK indicates whether the power supply rails are in regulation or not. As the power supply drops, the 3.3V rail is the first to falter, though the board carries on running down to well below 3V. 3.3V is actually quite a convenient voltage to stop the discharge of Li-Ion batteries. BATT_FAULT goes high when the battery voltage drops to 3.15V. At this point a LiIon cell really doesn't have much left. I've used a combination of these two features in a battery-powered application so that it can do an orderly shutdown, save state, and then switch itself off as the battery runs down, without the need for any external power management or battery monitoring. The kernel changes are in 2.6.29.1 trunk. In the usual fashion, it's as well to keep bootldr and cpld in step. Chris -- Chris Jones - chris@martin-jones.com Martin-Jones Technology Ltd, makers of Solidlights 148 Catharine Street, Cambridge, CB1 3AR, UK Phone +44 (0) 1223 655611 Fax +44 (0) 870 112 3908 http://www.solidlights.co.uk/