Wolfson Open Source eNews

Linux Voltage and Current Regulator Framework

About
This framework is designed to provide a generic interface to voltage and current regulators within the Linux 2.6 kernel. It's intended to provide voltage and current control to client or consumer drivers and also provide status information to user space applications through a sysfs interface.

The intention is to allow systems to dynamically control regulator output in order to save power and prolong battery life. This applies to both voltage regulators (where voltage output is controllable) and current sinks (where current output is controllable).

Design
The framework is designed around SoC based devices but may also be relevant to non SoC devices. It's also been designed against two Power Management ICs (PMICs) currently on the market - namely the Freescale MC13783 and the Wolfson WM8350. However it is quite generic and should apply to all PMICs.

The framework provides several interfaces :-

  1. Client or Consumer driver API.
  2. This uses a similar API to the kernel clock interface in that client or consumer drivers can get and put a regulator (like they can with clocks atm) and get/set voltage, current, mode, enable and disable. This should allow clients complete control over their supply voltage and current. This API also compiles out if not in use so drivers can be reused in systems with no PMIC power control.

  3. Regulator driver API.
  4. This allows regulator drivers to register their regulators and provide operations to the core. It also has a notifier call chain for propagating regulator events to clients.

  5. Platform API.
  6. This API is for platform/device specific code and allows the creation of voltage/current domains (with constraints) for each regulator. It can provide regulator constraints that will prevent device damage through over voltage or over current caused by buggy client drivers. It also allows the creation of a regulator tree whereby some regulators are supplied by others (similar to a clock tree).

  7. Userspace API.
  8. The framework also exports a lot of useful voltage/current/opmode data to userspace via sysfs. This could be used to help monitor device power consumption and status.

Main Features

  • Voltage control and status.
  • Current control and status.
  • Regulator operating mode control and status.
  • Dynamic Regulator operating Mode Switching (DRMS) - switches regulators to most efficient operating mode dependeing on total client current requests.
  • Dynamic Regulator Voltage Selection - switches regulators to the lowest voltage required for all clients to operate normally.

Source Code
The source code is available from the AudioPlus git tree and in patch format here.

Copyright Wolfson Microelectronics 2006-8