Older blog entries for broonie (starting at number 113)

regulator updates in 3.3

Linux 3.3 was released today. This was the biggest release for the regulator API for quite some time thanks to the contribution of device tree bindings for the API by Rajendra Nayak, the first substantial framework update for a long time, but otherwise was fairly quiet:

  • OpenFirmware bindings for the core and for the fixed regulator driver, contributed by Rajendra Nayak. Device tree bindings for the Freescale MC13892 PMIC were also added.
  • A new regulator_bulk_force_disable() operation contributed by Donggeun Kim.
  • A new driver for the Dialog DA9052 PMIC.

Syndicated 2012-03-19 19:01:19 from Technicalities

regmap updates in 3.3

After the rush of new features in version 3.2 this has been a fairly quiet cycle for the regmap API, the main change being the wider usage by drivers. In terms of development of the subsystem itself this release sees:

  • Introduction of a generic interrupt controller for regmap based devices, this is already used by a few drivers with more coming.
  • Support for 10 bit register 14 bit value devices.
  • Removal of the indexed cache type – devices which would have used it should use rbtree instead. If anything the rbtree cache is expected to be faster for small devices as where registers are grouped together into blocks it will usually be cheaper to search the rbtree.
  • Some improvements to the coverage of the tracepoints..
  • Diagnostics showing the number and size of nodes in an rbtree cache.

Syndicated 2012-03-19 11:41:24 from Technicalities

Yahoo! Groups spam

Yahoo! Groups have for a long time had big problems with allowing people to create obvious spam groups (randomly generated names, no meaningful description and so on) and then add people without any confirmation. This was annoying but at least they have an obvious abuse reporting link in the subscription mails. Sadly rather than improve the situation they appear to have just changed the link to not be a direct link to the reporting form but instead to be a generic help page. The link didn’t change, the content just got even less useful.

I’m strongly tempted to just block all of Yahoo! from the mail systems I control.

Syndicated 2012-02-27 13:39:06 from Technicalities

TinyHAL

Earlier today I gave a talk at Android Builders Summit about TinyHAL, a generic audio HAL for Android aimed providing a better basis for system integrators to work from. More details on TinyHAL and slides from the talk can be found over at the Wolfson Open Source web site.

Syndicated 2012-02-14 21:50:19 from Technicalities

regmap updates in 3.2

Version 3.1 of the Linux kernel was the first release to include regmap support and only included a bare minimum of features in order to ease review so version 3.2 has been a pretty big one for regmap development with some pretty major features being built on top of the core code.

  • Support for register caches – Dimitris Papastamos ported his code for rbtree and LZO caches from ASoC over to regmap. This makes it easy for drivers to cache the current values of the device registers, improving performance by eliminating reads when doing read/modify/write cycles and providing functions to restore the register cache when resuming from power down. An indexed cache type was also added but this will be removed in 3.3 as it offers no real advantage over rbtree.
  • Support for a wider range of SPI register transfer formats contributed by Lars-Peter Clausen.
  • Tracepoints supporting both register access logging and monitoring of the time spent on register I/O operations.
  • Register map dumps via debugfs to help provide diagnostic information during development.

Syndicated 2012-01-06 23:59:19 from Technicalities

ASoC updates in 3.2

Linux 3.2 was released yesterday. It’s been a fairly busy release for ASoC in terms of the subsystem, including the first piece of work at moving the register I/O code over to regmap to eliminate the duplication there, but a pretty quiet one on the drivers front.

  • Substantial optimization of the DAPM algorithm, substantially reducing the CPU usage when power states change. This is especially beneficial with larger modern devices.
  • Support for CODEC drivers using the regmap API.
  • Some smaller API updates – support for larger register maps, support for specifying a source when setting a sysclk.
  • New CPU for Alchemy and Freescale MXS.
  • New CODEC drivers for Analog ADAU1373, Realtek RT5631 and Wolfson MicroelectronicsWM1811 and WM5100.

Syndicated 2012-01-06 19:07:48 from Technicalities

What’s wrong with switch statements?

Recently I’ve been noticing a surprising pattern in code I’m reviewing for the kernel. A lot of people seem to have taken to writing code that I’d expect to look like this:

switch (thing) {
case VALUE:
        /* Stuff */
        break;
case BAR:
        /* Nonsense */
        break;
default:
        /* Whatever */
        break;
}

with if statements instead:

if (thing == VALUE) {
        /* Stuff */
} else if (thing == BAR) {
        /* Nonsense */
} else {
        /* Whatever */
}

(where stuff, nonsense and whatever are usually a bit larger). I really don’t understand where this has come from – the if based form isn’t nearly so idiomatic for selecting between a range of values and this seems to have come from nowhere pretty much. Is there some code base out there where this is common practice or something?

Syndicated 2011-12-20 13:24:55 from Technicalities

ASoC updates in 3.1

Linus released version 3.1 of the kernel at Kernel Summit this morning. This has been another fairly quiet release for the framework with a few nice power optimizations, a range of driver enhancements and a fairly small set of new drivers.

  • Lots of cleanups to the register cache code in preparation for moving the code to the regmap API.
  • Support for maintaining lower power when in mostly idle states like microphone detection.
  • Support for weak DAPM routes, enabling better pop/click performance for paths like sidetones.
  • New CODEC drivers for Analog Devices ADAV80x, Sigmatel STA32x and Wolfson WM8728 and WM8983.



Posted from Prague, Prague, Czech Republic.

Syndicated 2011-10-24 09:36:56 from Technicalities

regmap – a register map abstraction for the Linux kernel

A good proportion of I2C and SPI device drivers in the kernel contain some very similar code for accessing the register maps of hardware connected to those buses – most hardware designers have solved the problem of providing very similar ways. Linux 3.1 introduces a new kernel API called regmap which factors out this code from the drivers, saving code and making it much easier to share infrastructure. There’s been an implementation of this in ASoC for some time now, the regmap API makes it available to all drivers.

The version of this API in version 3.1 is very simple, just factoring out the simplest level of physical I/O from the devices. Devices register with the regmap API by providing a struct regmap_config (which currently only allows the sizes of the register addresses and values to be specified) and the bus-specific structure to it. They can then use simple read and write operations on the device:

int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val);
int regmap_write(struct regmap *map, unsigned int reg, unsigned int val);

The API handles everything to do with formatting the data for transmission and parsing data coming back from the device. Block functions are also provided to allow multiple registers to be read or written simultaneously. Even with this basic level of support we end up saving quite a bit of code as drivers are converted to use the API.

The changes sitting in -next for version 3.2 take this a step further, adding support for more variations on SPI registers, a debugfs interface for dumping the device registers, register cache support courtesy of my colleague Dimitris Papastamos and trace points for dynamic instrumentation of the system.

Posted from Santa Rosa, California, United States.

Syndicated 2011-09-30 12:46:54 from Technicalities

Making patches easy to review

One of the big things that seems to cause a learning curve for many new contributors for Linux and other projects that make a big effort with code review is the process of putting patches together in a way that makes the code review process more smoothly. This is a fairly straightforward thing but it takes a bit of getting used to for people who aren’t used to the idea of patches and commits as a means of communication rather than just a mechanical thing you do to get changes into the codebase. In cases I’ve seen the difficulty . I’m mostly going to talk about this in the Linux context where patches are reviewed by e-mail but the same ideas apply if you’re using a tool like gerrit to do the reviews; it’s also mostly focused on detailed review rather than design level review.

The basic idea is fairly simple – the goal is to make it as easy as possible for someone to read and understand the change that’s being made.

  • Make sure the code matches the coding style of the code being modified.
  • Make patches as small and self contained as possible – having many patches is much easier than having complicated patches.
  • Provide a changelog clearly describing everything that’s going on in the patch.

The result here should be something that’s easy for people to review. Keeping in line with the coding style is just a generally good idea for code legibility which is obviously a key thing for people reading the code to review it. Having a clear description of the change means that the reviewer knows what the patch is supposed to do and can verify that the patch does that rather than having to spend effort figuring out if whatever the code is doing is intentional. Making changes small and simple makes them much easier to think about – the idea itself is easier to keep in your head and there’s fewer things to check so the process of validating things is easier.

It’s not just about making life easier for reviewers. The process of making simple changes and describing them clearly can be really helpful for spotting issues when writing code; it forces you to think through what’s being done much more clearly than might happen otherwise. There’s also an ongoing benefit to anyone working with the code in the future. Since each change ends up including at least some explanation of what the code is supposed to do and since revision control systems generally have some equivalent of git annotate it’s usually reasonably straightforward to find the changes that introduced the code that you’re looking at. Small changes with good changelog entries mean it’s much more likely that the changelog will provide a useful explanation as to what the author was thinking and explain why the code is the way that it is. It’s much harder for documentation to go missing from the SCM than it is for it to go missing elsewhere, and it’s much more likely that documentation in the commit is going to be up to date than external documentation, especially prewritten design documentation.

In the context of large scale reviews the usual technique is to combine reviews of individual changes with a read through of the final code after all the individual changes have been applied. Often the build up of the code through incremental changes is a enough to show the overall design but a read through of the final code can be helpful in allowing people to understand where things are going.

Posted from Santa Rosa, California, United States.

Syndicated 2011-09-09 10:44:33 from Technicalities

104 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!