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 04.02.00.07
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 ---> PPS Support ---> ... ...
Select I2C Hardware Bus support after selecting "I2C device interface" from the menu, as shown here:
... ... < > I2C bus multiplexing support <*> Autoselect pertinent helper modules I2C Hardware Bus support ---> [ ] I2C Core debugging messages ... ...
OMAP I2C adapter must have been automatically selected as shown here:
... ... < > GPIO-based bitbanging I2C < > OpenCores I2C Controller -*- OMAP I2C adapter < > PCA9564/PCA9665 as platform device < > Simtec Generic I2C interface < > Xilinx I2C Controller ... ...
Go back and select Voltage and Current Regulator Support from the Device Drivers menu.
... ... Sonics Silicon Backplane ---> -*- Multifunction device drivers ---> -*- Voltage and Current Regulator Support ---> <*> Multimedia support ---> Graphics support ---> ... ...
Make sure that the PMIC present on the EVM is selected here, which is TI TWL4030/TWL5030/TWL6030/TPS695x0 PMIC for AM/DM-37x and OMAP35x EVM
... ... < > Maxim 8649 voltage regulator < > Maxim 8660/8661 voltage regulator < > Maxim MAX8952 Power Management IC [*] TI TWL4030/TWL5030/TWL6030/TPS695x0 PMIC < > National Semiconductors LP3971 PMIC regulator driver < > National Semiconductors LP3972 PMIC regulator driver ... ...
And TI TPS65023 Power regulators for AM3517 EVM
... ... < > National Semiconductors LP3971 PMIC regulator driver < > National Semiconductors LP3972 PMIC regulator driver < > TI TPS65023 Power regulators < > TI TPS6507X Power regulators < > Intersil ISL6271A Power regulator ... ...
Only for AM/DM37x and OMAP35x EVM, come back to the Device Drivers menu and select Multifunction device drivers as shown below:
... ... [*] Watchdog Timer Support ---> Sonics Silicon Backplane ---> -*- Multifunction device drivers ---> -*- Voltage and Current Regulator Support ---> < > Multimedia support ---> Graphics support ---> ... ...
Select Texas Instruments TWL4030/TWL5030/TWL6030/TPS659x0 Support & Support power resources on TWL4030 family chips as shown here:
... ... < > TPS6501x Power Management chips < > TPS6507x Power Management / Touch Screen chips [*] Texas Instruments TWL4030/TWL5030/TWL6030/TPS659x0 Support [*] Support power resources on TWL4030 family chips < > TWL6030 PWM (Pulse Width Modulator) Support [ ] Support STMicroelectronics STMPE ... ...
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/regulator.x:
- 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
- num_users
- current number of users
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.