NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.
UserGuidePmic PSP 03.00.00.04
Contents
Introduction[edit]
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:
- DCDC: Highly efficient and self-regulating step down DC to DC converter.
- LDO (low-dropout): DC linear voltage regulator which can operate with a very small input-output differential voltage.
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[edit]
- Linux Voltage and Current Regulator Framework
- Linux kernel documentation: Documentation/power/regulator and Documentation/ABI/testing/sysfs-class-regulator
- TPS65950: Integrated Power Management IC with 3 DC/DC's, 11 LDO's, Audio Codec, USB HS Transceiver, Charger
- TPS65023: 6-channel Power Mgmt IC with 3DC/DCs, 3 LDOs, I2C Interface and DVS, Optimized for DaVinci DSPs Literature Number: SLVS670G
- TPS65073: 5-Channel Power Management IC with 3 DC/DCs, 2 LDOs in 6x6mm QFN
Acronyms & Definitions[edit]
Acronym | Definition |
---|---|
PMIC | Power Management IC |
VRF | Voltage Regulator Framework |
LDO | Low Drop-Out |
Features[edit]
This section describes the supported features and constraints of the PMIC drivers.
Features Supported[edit]
- Support for TPS65950, TPS65023 and TPS65073 PMICs in Linux Voltage Regulator Framework.
- Enabling / disabling of voltage regulators.
- Changing the output voltage, if permitted by the voltage regulator.
- Reading the status (enabled/disabled) of the voltage regulator.
- Reading other useful information about the regulator via sysfs interface.
Constraints[edit]
None
Configuration[edit]
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[edit]
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: This uses a similar API to the kernel clock interface in that consumer drivers can get and put a regulator (like they can with clocks) and get/set voltage, current limit, enable and disable. This allows consumer complete control over their supply voltage and current limit.
- Sysfs interface: The linux voltage regulator 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.
Consumer driver interface[edit]
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[edit]
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[edit]
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:
- Getting the required regulator handle: Consumer driver has to first obtain a handle to the desired regulator, by passing the correct supply.
int ret; struct regulator *reg; const char *supply = "vdd1"; int min_uV, max_uV; reg = regulator_get(NULL, supply);
- Enabling it, if not already enabled: A regulator needs to be enabled before it can be used to change the output voltage. Regulator handle, obtained in the previous step, should be used now to enable it:
ret = regulator_enable(reg);
- After enabling it, user can check the status of the regulator by:
printk (KERN_INFO "Regulator Enabled = %d\n", regulator_is_enabled(reg));
- Changing the existing voltage: Consumer driver has to pass the appropriate minimum and maximum voltage levels, as desired by the use-case, to change the output voltage.
ret = regulator_set_voltage(reg, min_uV, max_uV);
- Reading the existing voltage: Consumer driver can read back the existing voltage to check if the voltage was set properly or not.
printk (KERN_INFO "Regulator Voltage = %d\n", regulator_get_voltage(reg));
- Disabling the regulator: Consumer driver can disable the regulator, if required. The framework ensures that the regulator is not disabled if other consumers are still using the same regulator.
ret = regulator_disable(reg);
- Releasing the regulator handle: Consumer driver can release the regulator if it is no more required.
regulator_put(reg);
After that, the handle becomes invalid and should not be used for any further operations.