GTA02 Kernel sysfs highlights
sysfs is a filesystem that is mounted on /sys which contains various fake "files" that are actually filled by a variety of drivers and other kernel subsystems. You can often also write stuff into these "files" using
echo 1 > /sys/blah...
to change settings and behaviours of the kernel and drivers dynamically. (When doing this, take care you have a space before the redirection operator > or the shell will do something completely different with your command.)
USB Host / Device
- Defaults to 0, GTA02 USB hardware is configured to be a device, no power is generated for USB, charging is enabled and host 15K pulldowns are removed from D+ and D-
- Set to 1 to put the GTA02 USB hardware into host mode, so it starts to generate 5V power, disables charging from USB, and applies 15K pulldowns to USB D+ and D-
- Defaults to "device", it means the USB peripheral in the CPU is logically configured for device mode
- Set to "host" to logically configure the peripheral to act like a host for other USB devices to be plugged into it
Normally you set these two guys at the same time for the same mode, but there is a trick possible to select logical host mode but leave the power arrangements as if it was in device mode and apply external power. You need to externally add 15K pulldowns on D+ and D- if you do this, because we did not enable them the normal way. With this, you can have a USB device attached to GTA02, and use external power and charge the battery at the same time.
- Defaults to "0", GSM power OFF
- Set to "1" to enable power to GSM logic
- Defaults to "0", no reset
- Set to "1" briefly after power applied to reset GSM logic
- Defaults to "0", no insane clicking sound
- Set to "1" to drive yourself crazy and enable serial access to GSM chips down headphone socket / once a second loud clicks / chirps
If you cat this you get a list of possible resume sources in text with one or more * at the left of the active source that woke us. You need a recent U-Boot to get the * set.
/sys/devices/platform/neo1973-memconfig.0/BANKCON0 .. 7
For extreme meddlers (I salute you), these let you control the wait states and other characteristics of the memory regions of the Freerunner. Information and warnings about how to use these are here:
FIQ and HDQ
FIQ is used to provide precision interrupt service in order to implement the HDQ protocol used to the battery couloumb counter. This shows how many FIQ interrupts have been run since the kernel started. It's turned off unless it is required.
If you cat this, you will see the raw contents of HDQ device register space. This is the bq27000 couloumb counter in our case.
This allows you to write to raw HDQ registers, using "<decimal register index> <decimal value>"
power_supply battery information
Most of these are coming from the coulomb counter over HDQ dynamically, but the bq27000 does not update a lot of its registers any more often than once per 4 seconds. Therefore a lot of this info can be a bit stale or averaged over that period.
Just says "Battery"
This will summarize what goes on generally with the battery
- "Not Charging" - there's a charger in, but right now it isn't charging us. Normal if you are fully charged and still powered.
- "Charging" - there's a charger in and it is charging the battery
- "Discharging" - we are running on battery
- "Full" - not normally given as a result (Not Charging used instead)
Battery voltage in uV, averaged. Obviously this depends on load and place on discharge curve, etc.
Current being drawn from battery (+ve) or pushed into battery during charging (-ve) in uA
Coulomb Counter's estimate of the capacity of the battery measured in uA/h. It roughly means that if full, for one hour it could supply current at this rate. I saw 1197913 reported on mine, so it estimates it can provide 1.2A for an hour.
This is the battery temperature reported by the Coulomb Counter chip that is part of the physical battery. It is in Celcius * 10, so 251 means 25.1 degrees.
- "0" the battery is absent, or not one with a Coulomb Counter
- "1" the smart battery is present
At current rate of discharge, estimate of how long we can run for. If battery is not discharging, it won't make an estimate and will return a magic value "3932100" meaning "no estimate". The coulomb counter averages the load and adjusts this value slowly to be its estimate of when we will blow chunks.
This estimates how long until we are fully charged, at current rate of charging, in seconds. If we are not charging, it gives the magic value "3932100" meaning "no estimate".
This is the remaining capacity of charge in the battery in percent. This is probably the most useful figure here.
- "0" no charger is present
- "1" A powered charger is present
- "enabled" means the charger is powered and willing to charge, although if you're full it might not be right now
- "disabled" means there was no power or not enough power supplied to charge
Shows the detected charger type followed by the mode it is running in. So "charger 500mA mode 100mA" would be the case for non-enumerated USB connection, "charger 500mA mode 500mA" for after enumeration.
This is added to allow the PMU to be told to take more current than the default rules allow. Use it only if you know your charger source can handle it. For example
echo 500 > /sys/devices/platform/s3c2440-i2c/i2c-adapter/i2c-0/0-0073/force_usb_limit_dangerous
will allow PMU to draw 500mA even though you are connected to a dumb charger where the limit is normally held at 100mA, since it didn't enumerate the GTA02. You can give 0, 100, 500 or 1000 here, but make sure your charger source can handle what you give here, otherwise it can exceed what is safe for your charging source to provide.
cat this to get a dump of the I2C registers for the PMU, useful for debugging power problems.
- Default "0" no power to Bluetooth device
- set to "1" to enable power to Bluetooth
- Default to "0", no reset
- set to "1" to reset BT (needed after powerup)
- Default "0" GPS unpowered
- set to "1" to power GPS section
cat this to get a dump of codec registers. Note they are 9-bit wide.
You can write to any codec register by echoing "<codec reg index in hex> <value in hex>" to here
cat this to get a dump of selected Glamo regs. You can write the regs by echoing "<glamo reg index in decimal> <value in decimal>" here.