UserGuidePmic PSP 03.00.00.04

From Texas Instruments Embedded Processors Wiki

Jump to: navigation, search
Translate this page to   

Contents

Introduction

A Power Management IC (PMIC) is a device that contains one or more regulators (voltage or current) and often contains other susbsystems like audio codec, keypad etc. From the power management perspective, its main function is to regulate the output power from input power or simply enable/disable the output as and when required.

A PMIC can have two different types of regulators: voltage regulator or current regulator. Voltage regulators are used to enable/disable the output voltage and/ or regulate the output voltage. Current regulators preform the same functions with the output current. PMICs from TI contain two different types of voltage regulators:

The PMIC is controlled by internal registers that can be accessed by the I2C control interface.

This manual defines and describes the usage of user level and platform level interfaces of the PMIC consumer driver.

References

Acronyms & Definitions

Acronym Definition
PMIC Power Management IC
VRF Voltage Regulator Framework
LDO Low Drop-Out

Features

This section describes the supported features and constraints of the PMIC drivers.

Features Supported

Constraints

None

Configuration

To enable/disable VRF support, start the Linux Kernel Configuration tool.

$ make menuconfig

Check whether I2C support is enabled or not; it is required for the voltage regulator. Select Device Drivers from the main menu:

...
...
Power management options  --->
[*] Networking support  --->
Device Drivers  --->
File systems  --->
Kernel hacking  --->
...
...

Then select I2C support as shown here:

...
...
Input device support  --->
Character devices  --->
<*> I2C support  --->
[ ] SPI support  --->
-*- GPIO Support  --->
...
...

Select I2C Hardware Bus support after selecting "I2C device interface" from the menu, as shown here:

...
...
<*>   I2C device interface
<*>   Autoselect pertinent helper modules (NEW)
      I2C Hardware Bus support  --->
Miscellaneous I2C Chip support  --->
[ ]   I2C Core debugging messages (NEW)
...
...

Select OMAP I2C adapter as shown here:

...
...
< > GPIO-based bitbanging I2C (NEW)
< > OpenCores I2C Controller (NEW)
<*> OMAP I2C adapter
< > Simtec Generic I2C interface (NEW)
*** External I2C/SMBus adapter drivers ***
...
...

Now select System Type from the main menu.

...
...
[*] Enable loadable module support  --->
[*] Enable the block layer  --->
System Type  --->
Bus support  --->
Kernel Features  --->
...
...

Make sure that the PMIC present on the OMAP3530 EVM is selected here:

...
...
[ ] Gumstix Overo board
[*] OMAP3530 EVM board   --->
[*]   TWL4030/TPS65950 Power Module
[ ] OMAP3517/ AM3517 EVM board  --->
[ ] OMAP3 Pandora  --->
[ ] OMAP 3430 SDP board  --->
...
...

Come back to the main menu now and select Device Drivers as shown here:

...
...
Power management options  --->
[*] Networking support  --->
Device Drivers  --->
File systems  --->
Kernel hacking  --->
...
...

Select Voltage and Current Regulator Support as shown here:

[ ] DMA Engine support  --->
[ ] Auxiliary Display support  --->
[*] Voltage and Current Regulator Support  --->
< > Userspace I/O drivers  --->
[ ] Staging drivers  --->

Driver for the PMIC selected earlier should have been automatically selected, as shown here:

< >   Maxim 1586/1587 voltage regulator
-*-   TI TWL4030/TWL5030/TPS695x0 PMIC
< >   National Semiconductors LP3971 PMIC regulator driver
< >   TI TPS65023 Power regulators

Application Interface

This section provides the details of the application interface for the PMIC regulator driver. Client device drivers are the ones which use PMIC regulator drivers to enable/ disable and/or regulate output voltage/current. Specifically, a client driver uses:

Consumer driver interface

As mentioned above, this interface provides complete control to the consumer driver over their supply voltage and/or current limit. Some of the commonly used APIs to achieve this are:

regulator_get
Get handle to a regulator
regulator_put
Release a regulator
regulator_enable
Enable a regulator
regulator_disable
Disable a regulator
regulator_is_enabled
Check status of the regulator
regulator_set_voltage
Change the output voltage
regulator_get_voltage
Fetch the current voltage
regulator_set_current_limit
Change the current limit
regulator_get_current_limit
Fetch the existing current limit

Sysfs interface

The voltage regulator interface exports following information via sysfs.

Here is a list of entries available under /sys/class/regulator:

name
string identifying the regulator (may be empty)
type
regulator type (voltage, current)
state
regulator enable status (enabled, disabled)
microvolts
regulator output voltage (in microvolts)
microamps
regulator output current limit (in microamps)
min_microvolts
minimum safe working output voltage setting
max_microvolts
maximum safe working output voltage setting
min_microamps
minimum safe working output current setting
max_microamps
maximum safe working output current setting

Writing a Consumer Driver

This section describes the steps required in writing a consumer driver to regulate the output voltage and to enable/disable the regulator. User should refer to "include/linux/regulator/consumer.h" for the complete list of supported APIs.

Writing a consumer driver involves the following steps:

int ret;
struct regulator *reg;
const char *supply = "vdd1";
int min_uV, max_uV;
reg = regulator_get(NULL, supply);
ret = regulator_enable(reg);
printk (KERN_INFO "Regulator Enabled = %d\n", regulator_is_enabled(reg));
ret = regulator_set_voltage(reg, min_uV, max_uV);
printk (KERN_INFO "Regulator Voltage = %d\n", regulator_get_voltage(reg));
ret = regulator_disable(reg);
regulator_put(reg);

After that, the handle becomes invalid and should not be used for any further operations.

Leave a Comment
Personal tools
Namespaces
Variants
Actions
Navigation
Print/export
Toolbox