Novena progress: RTC, Headphone, Suspend
When designing your own laptop, the most mundane of things become exceptional. When you get something working, life becomes that little bit sweeter. Like cracking your knuckles, or getting that bit of food from between your teeth, getting even the smallest part of the system working well is such a great relief.
We got the audio codec upstreamed, as I mentioned before. In earlier versions, we hardcoded the two outputs to be named "Headphones" and "Speaker". This was a bit of a hack, because the reference manual actually refers to them as "Output 1" and "Output 2", and they are in fact interchangeable. So when we pushed the driver upstream, we had to rename them, which meant we lost headphone detection.
Yesterday I took it upon myself to remedy the situation, and I've come up with a Debian configuration package that can be installed on an Novena that fixes pulseaudio and enables headphone detection. It uses profiles and paths, and has a udev rule to enable the configuration on Novena. A terse example can be seen on the Freedesktop Profiles page, but it took me a while to figure out how it should all work. Packaging it up as a Debian package took a while too, but I learned a lot about it in the process.
Much of the confusion comes from the fact that audio devices have a seemingly infinite number of control names. You might have a speaker named Out, Master, PCM, Front, Center, Centre, Side, Bass, Output, or even Output 1. The default configurations support many of these names, but they didn't know that Output 2 is the speaker, and Output 1 is the headphone. They also didn't take into account the name of the headphone jack. Using the PulseAudio profiles support, I told Pulse which devices are the headphones and which are speakers, and now it actually mutes the speakers on headphone insertion.
We also have the clock working better now. Before, we were relying on the i.MX6 Secure NonVolatile Storage (SNVS) block to keep track of time. It's supposed to hold time for up to four hours, but the current drain was a little bit more than promised, and it ended up keeping track of time while powered off for about four milliseconds. This seems to be a common problem among i.MX6 boards, so we took a page from other teams and put down an I2C RTC device. This chip keeps track of time very well, so that now when we start up without a network present, we can't party like it's 1970. One more little nicety.
Finally, suspend support is more reliable now. We reworked powerup on the eDP display chip, worked around a clock bug in the Ethernet driver, and put PCI Express into reset when the board gets suspended. All of this means that our laptop can actually be put to sleep. Awesome.
We still have a lot more to do. We still have to come up with a root filesystem image to put on the board, finish rewriting Senoko, and come up with a cut-down Senoko firmware image to go in the laptop model. We also have to come up with a Senoko driver for Linux, so it will actually power down when you shut down the board, and so that Linux can know when AC is plugged in. All of this has to happen in the next two months, but I'm confident we can do it. Stay tuned.