Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
core.c File Reference
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/debugfs.h>
#include <linux/device.h>
#include <linux/slab.h>
#include <linux/async.h>
#include <linux/err.h>
#include <linux/mutex.h>
#include <linux/suspend.h>
#include <linux/delay.h>
#include <linux/gpio.h>
#include <linux/of.h>
#include <linux/regmap.h>
#include <linux/regulator/of_regulator.h>
#include <linux/regulator/consumer.h>
#include <linux/regulator/driver.h>
#include <linux/regulator/machine.h>
#include <linux/module.h>
#include <trace/events/regulator.h>
#include "dummy.h"

Go to the source code of this file.

Data Structures

struct  regulator_map
 
struct  regulator
 

Macros

#define CREATE_TRACE_POINTS
 
#define rdev_crit(rdev, fmt,...)   pr_crit("%s: " fmt, rdev_get_name(rdev), ##__VA_ARGS__)
 
#define rdev_err(rdev, fmt,...)   pr_err("%s: " fmt, rdev_get_name(rdev), ##__VA_ARGS__)
 
#define rdev_warn(rdev, fmt,...)   pr_warn("%s: " fmt, rdev_get_name(rdev), ##__VA_ARGS__)
 
#define rdev_info(rdev, fmt,...)   pr_info("%s: " fmt, rdev_get_name(rdev), ##__VA_ARGS__)
 
#define rdev_dbg(rdev, fmt,...)   pr_debug("%s: " fmt, rdev_get_name(rdev), ##__VA_ARGS__)
 
#define REG_STR_SIZE   64
 

Functions

struct regulatorregulator_get (struct device *dev, const char *id)
 
 EXPORT_SYMBOL_GPL (regulator_get)
 
struct regulatordevm_regulator_get (struct device *dev, const char *id)
 
 EXPORT_SYMBOL_GPL (devm_regulator_get)
 
struct regulatorregulator_get_exclusive (struct device *dev, const char *id)
 
 EXPORT_SYMBOL_GPL (regulator_get_exclusive)
 
void regulator_put (struct regulator *regulator)
 
 EXPORT_SYMBOL_GPL (regulator_put)
 
void devm_regulator_put (struct regulator *regulator)
 
 EXPORT_SYMBOL_GPL (devm_regulator_put)
 
int regulator_enable (struct regulator *regulator)
 
 EXPORT_SYMBOL_GPL (regulator_enable)
 
int regulator_disable (struct regulator *regulator)
 
 EXPORT_SYMBOL_GPL (regulator_disable)
 
int regulator_force_disable (struct regulator *regulator)
 
 EXPORT_SYMBOL_GPL (regulator_force_disable)
 
int regulator_disable_deferred (struct regulator *regulator, int ms)
 
 EXPORT_SYMBOL_GPL (regulator_disable_deferred)
 
int regulator_is_enabled_regmap (struct regulator_dev *rdev)
 
 EXPORT_SYMBOL_GPL (regulator_is_enabled_regmap)
 
int regulator_enable_regmap (struct regulator_dev *rdev)
 
 EXPORT_SYMBOL_GPL (regulator_enable_regmap)
 
int regulator_disable_regmap (struct regulator_dev *rdev)
 
 EXPORT_SYMBOL_GPL (regulator_disable_regmap)
 
int regulator_is_enabled (struct regulator *regulator)
 
 EXPORT_SYMBOL_GPL (regulator_is_enabled)
 
int regulator_count_voltages (struct regulator *regulator)
 
 EXPORT_SYMBOL_GPL (regulator_count_voltages)
 
int regulator_list_voltage_linear (struct regulator_dev *rdev, unsigned int selector)
 
 EXPORT_SYMBOL_GPL (regulator_list_voltage_linear)
 
int regulator_list_voltage_table (struct regulator_dev *rdev, unsigned int selector)
 
 EXPORT_SYMBOL_GPL (regulator_list_voltage_table)
 
int regulator_list_voltage (struct regulator *regulator, unsigned selector)
 
 EXPORT_SYMBOL_GPL (regulator_list_voltage)
 
int regulator_is_supported_voltage (struct regulator *regulator, int min_uV, int max_uV)
 
 EXPORT_SYMBOL_GPL (regulator_is_supported_voltage)
 
int regulator_get_voltage_sel_regmap (struct regulator_dev *rdev)
 
 EXPORT_SYMBOL_GPL (regulator_get_voltage_sel_regmap)
 
int regulator_set_voltage_sel_regmap (struct regulator_dev *rdev, unsigned sel)
 
 EXPORT_SYMBOL_GPL (regulator_set_voltage_sel_regmap)
 
int regulator_map_voltage_iterate (struct regulator_dev *rdev, int min_uV, int max_uV)
 
 EXPORT_SYMBOL_GPL (regulator_map_voltage_iterate)
 
int regulator_map_voltage_linear (struct regulator_dev *rdev, int min_uV, int max_uV)
 
 EXPORT_SYMBOL_GPL (regulator_map_voltage_linear)
 
int regulator_set_voltage (struct regulator *regulator, int min_uV, int max_uV)
 
 EXPORT_SYMBOL_GPL (regulator_set_voltage)
 
int regulator_set_voltage_time (struct regulator *regulator, int old_uV, int new_uV)
 
 EXPORT_SYMBOL_GPL (regulator_set_voltage_time)
 
int regulator_set_voltage_time_sel (struct regulator_dev *rdev, unsigned int old_selector, unsigned int new_selector)
 
 EXPORT_SYMBOL_GPL (regulator_set_voltage_time_sel)
 
int regulator_sync_voltage (struct regulator *regulator)
 
 EXPORT_SYMBOL_GPL (regulator_sync_voltage)
 
int regulator_get_voltage (struct regulator *regulator)
 
 EXPORT_SYMBOL_GPL (regulator_get_voltage)
 
int regulator_set_current_limit (struct regulator *regulator, int min_uA, int max_uA)
 
 EXPORT_SYMBOL_GPL (regulator_set_current_limit)
 
int regulator_get_current_limit (struct regulator *regulator)
 
 EXPORT_SYMBOL_GPL (regulator_get_current_limit)
 
int regulator_set_mode (struct regulator *regulator, unsigned int mode)
 
 EXPORT_SYMBOL_GPL (regulator_set_mode)
 
unsigned int regulator_get_mode (struct regulator *regulator)
 
 EXPORT_SYMBOL_GPL (regulator_get_mode)
 
int regulator_set_optimum_mode (struct regulator *regulator, int uA_load)
 
 EXPORT_SYMBOL_GPL (regulator_set_optimum_mode)
 
int regulator_set_bypass_regmap (struct regulator_dev *rdev, bool enable)
 
 EXPORT_SYMBOL_GPL (regulator_set_bypass_regmap)
 
int regulator_get_bypass_regmap (struct regulator_dev *rdev, bool *enable)
 
 EXPORT_SYMBOL_GPL (regulator_get_bypass_regmap)
 
int regulator_allow_bypass (struct regulator *regulator, bool enable)
 
 EXPORT_SYMBOL_GPL (regulator_allow_bypass)
 
int regulator_register_notifier (struct regulator *regulator, struct notifier_block *nb)
 
 EXPORT_SYMBOL_GPL (regulator_register_notifier)
 
int regulator_unregister_notifier (struct regulator *regulator, struct notifier_block *nb)
 
 EXPORT_SYMBOL_GPL (regulator_unregister_notifier)
 
int regulator_bulk_get (struct device *dev, int num_consumers, struct regulator_bulk_data *consumers)
 
 EXPORT_SYMBOL_GPL (regulator_bulk_get)
 
int devm_regulator_bulk_get (struct device *dev, int num_consumers, struct regulator_bulk_data *consumers)
 
 EXPORT_SYMBOL_GPL (devm_regulator_bulk_get)
 
int regulator_bulk_enable (int num_consumers, struct regulator_bulk_data *consumers)
 
 EXPORT_SYMBOL_GPL (regulator_bulk_enable)
 
int regulator_bulk_disable (int num_consumers, struct regulator_bulk_data *consumers)
 
 EXPORT_SYMBOL_GPL (regulator_bulk_disable)
 
int regulator_bulk_force_disable (int num_consumers, struct regulator_bulk_data *consumers)
 
 EXPORT_SYMBOL_GPL (regulator_bulk_force_disable)
 
void regulator_bulk_free (int num_consumers, struct regulator_bulk_data *consumers)
 
 EXPORT_SYMBOL_GPL (regulator_bulk_free)
 
int regulator_notifier_call_chain (struct regulator_dev *rdev, unsigned long event, void *data)
 
 EXPORT_SYMBOL_GPL (regulator_notifier_call_chain)
 
int regulator_mode_to_status (unsigned int mode)
 
 EXPORT_SYMBOL_GPL (regulator_mode_to_status)
 
struct regulator_devregulator_register (const struct regulator_desc *regulator_desc, const struct regulator_config *config)
 
 EXPORT_SYMBOL_GPL (regulator_register)
 
void regulator_unregister (struct regulator_dev *rdev)
 
 EXPORT_SYMBOL_GPL (regulator_unregister)
 
int regulator_suspend_prepare (suspend_state_t state)
 
 EXPORT_SYMBOL_GPL (regulator_suspend_prepare)
 
int regulator_suspend_finish (void)
 
 EXPORT_SYMBOL_GPL (regulator_suspend_finish)
 
void regulator_has_full_constraints (void)
 
 EXPORT_SYMBOL_GPL (regulator_has_full_constraints)
 
void regulator_use_dummy_regulator (void)
 
 EXPORT_SYMBOL_GPL (regulator_use_dummy_regulator)
 
voidrdev_get_drvdata (struct regulator_dev *rdev)
 
 EXPORT_SYMBOL_GPL (rdev_get_drvdata)
 
voidregulator_get_drvdata (struct regulator *regulator)
 
 EXPORT_SYMBOL_GPL (regulator_get_drvdata)
 
void regulator_set_drvdata (struct regulator *regulator, void *data)
 
 EXPORT_SYMBOL_GPL (regulator_set_drvdata)
 
int rdev_get_id (struct regulator_dev *rdev)
 
 EXPORT_SYMBOL_GPL (rdev_get_id)
 
struct devicerdev_get_dev (struct regulator_dev *rdev)
 
 EXPORT_SYMBOL_GPL (rdev_get_dev)
 
voidregulator_get_init_drvdata (struct regulator_init_data *reg_init_data)
 
 EXPORT_SYMBOL_GPL (regulator_get_init_drvdata)
 
 core_initcall (regulator_init)
 
 late_initcall (regulator_init_complete)
 

Macro Definition Documentation

#define CREATE_TRACE_POINTS

Definition at line 35 of file core.c.

#define rdev_crit (   rdev,
  fmt,
  ... 
)    pr_crit("%s: " fmt, rdev_get_name(rdev), ##__VA_ARGS__)

Definition at line 40 of file core.c.

#define rdev_dbg (   rdev,
  fmt,
  ... 
)    pr_debug("%s: " fmt, rdev_get_name(rdev), ##__VA_ARGS__)

Definition at line 48 of file core.c.

#define rdev_err (   rdev,
  fmt,
  ... 
)    pr_err("%s: " fmt, rdev_get_name(rdev), ##__VA_ARGS__)

Definition at line 42 of file core.c.

#define rdev_info (   rdev,
  fmt,
  ... 
)    pr_info("%s: " fmt, rdev_get_name(rdev), ##__VA_ARGS__)

Definition at line 46 of file core.c.

#define rdev_warn (   rdev,
  fmt,
  ... 
)    pr_warn("%s: " fmt, rdev_get_name(rdev), ##__VA_ARGS__)

Definition at line 44 of file core.c.

#define REG_STR_SIZE   64

Definition at line 1088 of file core.c.

Function Documentation

core_initcall ( regulator_init  )
int devm_regulator_bulk_get ( struct device dev,
int  num_consumers,
struct regulator_bulk_data consumers 
)

devm_regulator_bulk_get - managed get multiple regulator consumers

: Device to supply : Number of consumers to register : Configuration of consumers; clients are stored here.

Returns
0 on success, an errno on failure.

This helper function allows drivers to get several regulator consumers in one operation with management, the regulators will automatically be freed when the device is unbound. If any of the regulators cannot be acquired then any regulators that were allocated will be freed before returning to the caller.

Definition at line 2913 of file core.c.

struct regulator* devm_regulator_get ( struct device dev,
const char id 
)
read

devm_regulator_get - Resource managed regulator_get() : device for regulator "consumer" : Supply name or regulator ID.

Managed regulator_get(). Regulators returned from this function are automatically regulator_put() on driver detach. See regulator_get() for more information.

Definition at line 1337 of file core.c.

void devm_regulator_put ( struct regulator regulator)

devm_regulator_put - Resource managed regulator_put() : regulator to free

Deallocate a regulator allocated with devm_regulator_get(). Normally this function will not need to be called and the resource management code will ensure that the resource is freed.

Definition at line 1443 of file core.c.

EXPORT_SYMBOL_GPL ( regulator_get  )
EXPORT_SYMBOL_GPL ( devm_regulator_get  )
EXPORT_SYMBOL_GPL ( regulator_get_exclusive  )
EXPORT_SYMBOL_GPL ( regulator_put  )
EXPORT_SYMBOL_GPL ( devm_regulator_put  )
EXPORT_SYMBOL_GPL ( regulator_enable  )
EXPORT_SYMBOL_GPL ( regulator_disable  )
EXPORT_SYMBOL_GPL ( regulator_force_disable  )
EXPORT_SYMBOL_GPL ( regulator_disable_deferred  )
EXPORT_SYMBOL_GPL ( regulator_is_enabled_regmap  )
EXPORT_SYMBOL_GPL ( regulator_enable_regmap  )
EXPORT_SYMBOL_GPL ( regulator_disable_regmap  )
EXPORT_SYMBOL_GPL ( regulator_is_enabled  )
EXPORT_SYMBOL_GPL ( regulator_count_voltages  )
EXPORT_SYMBOL_GPL ( regulator_list_voltage_linear  )
EXPORT_SYMBOL_GPL ( regulator_list_voltage_table  )
EXPORT_SYMBOL_GPL ( regulator_list_voltage  )
EXPORT_SYMBOL_GPL ( regulator_is_supported_voltage  )
EXPORT_SYMBOL_GPL ( regulator_get_voltage_sel_regmap  )
EXPORT_SYMBOL_GPL ( regulator_set_voltage_sel_regmap  )
EXPORT_SYMBOL_GPL ( regulator_map_voltage_iterate  )
EXPORT_SYMBOL_GPL ( regulator_map_voltage_linear  )
EXPORT_SYMBOL_GPL ( regulator_set_voltage  )
EXPORT_SYMBOL_GPL ( regulator_set_voltage_time  )
EXPORT_SYMBOL_GPL ( regulator_set_voltage_time_sel  )
EXPORT_SYMBOL_GPL ( regulator_sync_voltage  )
EXPORT_SYMBOL_GPL ( regulator_get_voltage  )
EXPORT_SYMBOL_GPL ( regulator_set_current_limit  )
EXPORT_SYMBOL_GPL ( regulator_get_current_limit  )
EXPORT_SYMBOL_GPL ( regulator_set_mode  )
EXPORT_SYMBOL_GPL ( regulator_get_mode  )
EXPORT_SYMBOL_GPL ( regulator_set_optimum_mode  )
EXPORT_SYMBOL_GPL ( regulator_set_bypass_regmap  )
EXPORT_SYMBOL_GPL ( regulator_get_bypass_regmap  )
EXPORT_SYMBOL_GPL ( regulator_allow_bypass  )
EXPORT_SYMBOL_GPL ( regulator_register_notifier  )
EXPORT_SYMBOL_GPL ( regulator_unregister_notifier  )
EXPORT_SYMBOL_GPL ( regulator_bulk_get  )
EXPORT_SYMBOL_GPL ( devm_regulator_bulk_get  )
EXPORT_SYMBOL_GPL ( regulator_bulk_enable  )
EXPORT_SYMBOL_GPL ( regulator_bulk_disable  )
EXPORT_SYMBOL_GPL ( regulator_bulk_force_disable  )
EXPORT_SYMBOL_GPL ( regulator_bulk_free  )
EXPORT_SYMBOL_GPL ( regulator_notifier_call_chain  )
EXPORT_SYMBOL_GPL ( regulator_mode_to_status  )
EXPORT_SYMBOL_GPL ( regulator_register  )
EXPORT_SYMBOL_GPL ( regulator_unregister  )
EXPORT_SYMBOL_GPL ( regulator_suspend_prepare  )
EXPORT_SYMBOL_GPL ( regulator_suspend_finish  )
EXPORT_SYMBOL_GPL ( regulator_has_full_constraints  )
EXPORT_SYMBOL_GPL ( regulator_use_dummy_regulator  )
EXPORT_SYMBOL_GPL ( rdev_get_drvdata  )
EXPORT_SYMBOL_GPL ( regulator_get_drvdata  )
EXPORT_SYMBOL_GPL ( regulator_set_drvdata  )
EXPORT_SYMBOL_GPL ( rdev_get_id  )
EXPORT_SYMBOL_GPL ( rdev_get_dev  )
EXPORT_SYMBOL_GPL ( regulator_get_init_drvdata  )
late_initcall ( regulator_init_complete  )
struct device* rdev_get_dev ( struct regulator_dev rdev)
read

Definition at line 3653 of file core.c.

void* rdev_get_drvdata ( struct regulator_dev rdev)

rdev_get_drvdata - get rdev regulator driver data : regulator

Get rdev regulator driver private data. This call can be used in the regulator driver context.

Definition at line 3613 of file core.c.

int rdev_get_id ( struct regulator_dev rdev)

regulator_get_id - get regulator ID : regulator

Definition at line 3647 of file core.c.

int regulator_allow_bypass ( struct regulator regulator,
bool  enable 
)

regulator_allow_bypass - allow the regulator to go into bypass mode

: Regulator to configure : enable or disable bypass mode

Allow the regulator to go into bypass mode if all other consumers for the regulator also enable bypass mode and the machine constraints allow this. Bypass mode means that the regulator is simply passing the input directly to the output with no regulation.

Definition at line 2771 of file core.c.

int regulator_bulk_disable ( int  num_consumers,
struct regulator_bulk_data consumers 
)

regulator_bulk_disable - disable multiple regulator consumers

: Number of consumers : Consumer data; clients are stored here.

Returns
0 on success, an errno on failure

This convenience API allows consumers to disable multiple regulator clients in a single API call. If any consumers cannot be disabled then any others that were disabled will be enabled again prior to return.

Definition at line 3011 of file core.c.

int regulator_bulk_enable ( int  num_consumers,
struct regulator_bulk_data consumers 
)

regulator_bulk_enable - enable multiple regulator consumers

: Number of consumers : Consumer data; clients are stored here.

Returns
0 on success, an errno on failure

This convenience API allows consumers to enable multiple regulator clients in a single API call. If any consumers cannot be enabled then any others that were enabled will be disabled again prior to return.

Definition at line 2963 of file core.c.

int regulator_bulk_force_disable ( int  num_consumers,
struct regulator_bulk_data consumers 
)

regulator_bulk_force_disable - force disable multiple regulator consumers

: Number of consumers : Consumer data; clients are stored here.

Returns
0 on success, an errno on failure

This convenience API allows consumers to forcibly disable multiple regulator clients in a single API call. NOTE: This should be used for situations when device damage will likely occur if the regulators are not disabled (e.g. over temp). Although regulator_force_disable function call for some consumers can return error numbers, the function is called for all consumers.

Definition at line 3052 of file core.c.

void regulator_bulk_free ( int  num_consumers,
struct regulator_bulk_data consumers 
)

regulator_bulk_free - free multiple regulator consumers

: Number of consumers : Consumer data; clients are stored here.

This convenience API allows consumers to free multiple regulator clients in a single API call.

Definition at line 3084 of file core.c.

int regulator_bulk_get ( struct device dev,
int  num_consumers,
struct regulator_bulk_data consumers 
)

regulator_bulk_get - get multiple regulator consumers

: Device to supply : Number of consumers to register : Configuration of consumers; clients are stored here.

Returns
0 on success, an errno on failure.

This helper function allows drivers to get several regulator consumers in one operation. If any of the regulators cannot be acquired then any regulators that were allocated will be freed before returning to the caller.

Definition at line 2867 of file core.c.

int regulator_count_voltages ( struct regulator regulator)

regulator_count_voltages - count regulator_list_voltage() selectors : regulator source

Returns number of selectors, or negative errno. Selectors are numbered starting at zero, and typically correspond to bitfields in hardware registers.

Definition at line 1877 of file core.c.

int regulator_disable ( struct regulator regulator)

regulator_disable - disable regulator output : regulator source

Disable the regulator output voltage or current. Calls to regulator_enable() must be balanced with calls to regulator_disable().

NOTE: this will only disable the regulator output if no other consumer devices have it enabled, the regulator device supports disabling and machine constraints permit this operation.

Definition at line 1639 of file core.c.

int regulator_disable_deferred ( struct regulator regulator,
int  ms 
)

regulator_disable_deferred - disable regulator output with delay : regulator source : miliseconds until the regulator is disabled

Execute regulator_disable() on the regulator after a delay. This is intended for use with devices that require some time to quiesce.

NOTE: this will only disable the regulator output if no other consumer devices have it enabled, the regulator device supports disabling and machine constraints permit this operation.

Definition at line 1750 of file core.c.

int regulator_disable_regmap ( struct regulator_dev rdev)

regulator_disable_regmap - standard disable() for regmap users

: regulator to operate on

Regulators that use regmap for their register I/O can set the enable_reg and enable_mask fields in their descriptor and then use this as their disable() operation, saving some code.

Definition at line 1822 of file core.c.

int regulator_enable ( struct regulator regulator)

regulator_enable - enable regulator output : regulator source

Request that the regulator be enabled with the regulator output at the predefined voltage or current value. Calls to regulator_enable() must be balanced with calls to regulator_disable().

NOTE: the output value can be set by other drivers, boot loader or may be hardwired in the regulator.

Definition at line 1542 of file core.c.

int regulator_enable_regmap ( struct regulator_dev rdev)

regulator_enable_regmap - standard enable() for regmap users

: regulator to operate on

Regulators that use regmap for their register I/O can set the enable_reg and enable_mask fields in their descriptor and then use this as their enable() operation, saving some code.

Definition at line 1805 of file core.c.

int regulator_force_disable ( struct regulator regulator)

regulator_force_disable - force disable regulator output : regulator source

Forcibly disable the regulator output voltage or current. NOTE: this will disable the regulator output even if other consumer devices have it enabled. This should be used for situations when device damage will likely occur if the regulator is not disabled (e.g. over temp).

Definition at line 1688 of file core.c.

struct regulator* regulator_get ( struct device dev,
const char id 
)
read

regulator_get - lookup and obtain a reference to a regulator. : device for regulator "consumer" : Supply name or regulator ID.

Returns a struct regulator corresponding to the regulator producer, or IS_ERR() condition containing errno.

Use of supply names configured via regulator_set_device_supply() is strongly encouraged. It is recommended that the supply name used should match the name used for the supply and/or the relevant device pins in the datasheet.

Definition at line 1317 of file core.c.

int regulator_get_bypass_regmap ( struct regulator_dev rdev,
bool enable 
)

regulator_get_bypass_regmap - Default get_bypass() using regmap

: device to operate on. : current state.

Definition at line 2745 of file core.c.

int regulator_get_current_limit ( struct regulator regulator)

regulator_get_current_limit - get regulator output current : regulator source

This returns the current supplied by the specified current sink in uA.

NOTE: If the regulator is disabled it will return the current value. This function should not be used to determine regulator state.

Definition at line 2535 of file core.c.

void* regulator_get_drvdata ( struct regulator regulator)

regulator_get_drvdata - get regulator driver data : regulator

Get regulator driver private data. This call can be used in the consumer driver context when non API regulator specific functions need to be called.

Definition at line 3626 of file core.c.

struct regulator* regulator_get_exclusive ( struct device dev,
const char id 
)
read

regulator_get_exclusive - obtain exclusive access to a regulator. : device for regulator "consumer" : Supply name or regulator ID.

Returns a struct regulator corresponding to the regulator producer, or IS_ERR() condition containing errno. Other consumers will be unable to obtain this reference is held and the use count for the regulator will be initialised to reflect the current state of the regulator.

This is intended for use by consumers which cannot tolerate shared use of the regulator such as those which need to force the regulator off for correct operation of the hardware they are controlling.

Use of supply names configured via regulator_set_device_supply() is strongly encouraged. It is recommended that the supply name used should match the name used for the supply and/or the relevant device pins in the datasheet.

Definition at line 1378 of file core.c.

void* regulator_get_init_drvdata ( struct regulator_init_data reg_init_data)

Definition at line 3659 of file core.c.

unsigned int regulator_get_mode ( struct regulator regulator)

regulator_get_mode - get regulator operating mode : regulator source

Get the current regulator operating mode.

Definition at line 2611 of file core.c.

int regulator_get_voltage ( struct regulator regulator)

regulator_get_voltage - get regulator output voltage : regulator source

This returns the current regulator voltage in uV.

NOTE: If the regulator is disabled it will return the voltage value. This function should not be used to determine regulator state.

Definition at line 2452 of file core.c.

int regulator_get_voltage_sel_regmap ( struct regulator_dev rdev)

regulator_get_voltage_sel_regmap - standard get_voltage_sel for regmap users

: regulator to operate on

Regulators that use regmap for their register I/O can set the vsel_reg and vsel_mask fields in their descriptor and then use this as their get_voltage_vsel operation, saving some code.

Definition at line 2013 of file core.c.

void regulator_has_full_constraints ( void  )

regulator_has_full_constraints - the system has fully specified constraints

Calling this function will cause the regulator API to disable all regulators which have a zero use count and don't have an always_on constraint in a late_initcall.

The intention is that this will become the default behaviour in a future kernel release so users are encouraged to use this facility now.

Definition at line 3584 of file core.c.

int regulator_is_enabled ( struct regulator regulator)

regulator_is_enabled - is the regulator output enabled : regulator source

Returns positive if the regulator driver backing the source/client has requested that the device be enabled, zero if it hasn't, else a negative errno code.

Note that the device backing this regulator handle can have multiple users, so it might be enabled even if regulator_enable() was never called for this particular source.

Definition at line 1854 of file core.c.

int regulator_is_enabled_regmap ( struct regulator_dev rdev)

regulator_is_enabled_regmap - standard is_enabled() for regmap users

: regulator to operate on

Regulators that use regmap for their register I/O can set the enable_reg and enable_mask fields in their descriptor and then use this as their is_enabled operation, saving some code.

Definition at line 1783 of file core.c.

int regulator_is_supported_voltage ( struct regulator regulator,
int  min_uV,
int  max_uV 
)

regulator_is_supported_voltage - check if a voltage range can be supported

: Regulator to check. : Minimum required voltage in uV. : Maximum required voltage in uV.

Returns a boolean or a negative error code.

Definition at line 1973 of file core.c.

int regulator_list_voltage ( struct regulator regulator,
unsigned  selector 
)

regulator_list_voltage - enumerate supported voltages : regulator source : identify voltage to list Context: can sleep

Returns a voltage that can be passed to (), zero if this selector code can't be used on this system, or a negative errno.

Definition at line 1940 of file core.c.

int regulator_list_voltage_linear ( struct regulator_dev rdev,
unsigned int  selector 
)

regulator_list_voltage_linear - List voltages with simple calculation

: Regulator device : Selector to convert into a voltage

Regulators with a simple linear mapping between voltages and selectors can set min_uV and uV_step in the regulator descriptor and then use this function as their list_voltage() operation,

Definition at line 1895 of file core.c.

int regulator_list_voltage_table ( struct regulator_dev rdev,
unsigned int  selector 
)

regulator_list_voltage_table - List voltages with table based mapping

: Regulator device : Selector to convert into a voltage

Regulators with table based mapping between voltages and selectors can set volt_table in the regulator descriptor and then use this function as their list_voltage() operation.

Definition at line 1915 of file core.c.

int regulator_map_voltage_iterate ( struct regulator_dev rdev,
int  min_uV,
int  max_uV 
)

regulator_map_voltage_iterate - map_voltage() based on list_voltage()

: Regulator to operate on : Lower bound for voltage : Upper bound for voltage

Drivers implementing set_voltage_sel() and list_voltage() can use this as their map_voltage() operation. It will find a suitable voltage by calling list_voltage() until it gets something in bounds for the requested voltages.

Definition at line 2060 of file core.c.

int regulator_map_voltage_linear ( struct regulator_dev rdev,
int  min_uV,
int  max_uV 
)

regulator_map_voltage_linear - map_voltage() for simple linear mappings

: Regulator to operate on : Lower bound for voltage : Upper bound for voltage

Drivers providing min_uV and uV_step in their regulator_desc can use this as their map_voltage() operation.

Definition at line 2098 of file core.c.

int regulator_mode_to_status ( unsigned int  mode)

regulator_mode_to_status - convert a regulator mode into a status

: Mode to convert

Convert a regulator mode into a status.

Definition at line 3122 of file core.c.

int regulator_notifier_call_chain ( struct regulator_dev rdev,
unsigned long  event,
void data 
)

regulator_notifier_call_chain - call regulator event notifier : regulator source : notifier block : callback-specific data.

Called by regulator drivers to notify clients a regulator event has occurred. We also notify regulator clients downstream. Note lock must be held by caller.

Definition at line 3106 of file core.c.

void regulator_put ( struct regulator regulator)

regulator_put - "free" the regulator source : regulator source

Note: drivers must ensure that all regulator_enable calls made on this regulator source are balanced by regulator_disable calls prior to calling this function.

Definition at line 1417 of file core.c.

struct regulator_dev* regulator_register ( const struct regulator_desc regulator_desc,
const struct regulator_config config 
)
read

regulator_register - register regulator : regulator to register : runtime configuration for regulator

Called by regulator drivers to register a regulator. Returns 0 on success.

Definition at line 3283 of file core.c.

int regulator_register_notifier ( struct regulator regulator,
struct notifier_block nb 
)

regulator_register_notifier - register regulator event notifier : regulator source : notifier block

Register notifier block to receive regulator events.

Definition at line 2820 of file core.c.

int regulator_set_bypass_regmap ( struct regulator_dev rdev,
bool  enable 
)

regulator_set_bypass_regmap - Default set_bypass() using regmap

: device to operate on. : state to set.

Definition at line 2725 of file core.c.

int regulator_set_current_limit ( struct regulator regulator,
int  min_uA,
int  max_uA 
)

regulator_set_current_limit - set regulator output current limit : regulator source : Minimuum supported current in uA : Maximum supported current in uA

Sets current sink to the desired output current. This can be set during any regulator state. IOW, regulator can be disabled or enabled.

If the regulator is enabled then the current will change to the new value immediately otherwise if the regulator is disabled the regulator will output at the new current when enabled.

NOTE: Regulator system constraints must be set for this regulator before calling this function otherwise this call will fail.

Definition at line 2482 of file core.c.

void regulator_set_drvdata ( struct regulator regulator,
void data 
)

regulator_set_drvdata - set regulator driver data : regulator : data

Definition at line 3637 of file core.c.

int regulator_set_mode ( struct regulator regulator,
unsigned int  mode 
)

regulator_set_mode - set regulator operating mode : regulator source : operating mode - one of the REGULATOR_MODE constants

Set regulator operating mode to increase regulator efficiency or improve regulation performance.

NOTE: Regulator system constraints must be set for this regulator before calling this function otherwise this call will fail.

Definition at line 2552 of file core.c.

int regulator_set_optimum_mode ( struct regulator regulator,
int  uA_load 
)

regulator_set_optimum_mode - set regulator optimum operating mode : regulator source : load current

Notifies the regulator core of a new device load. This is then used by DRMS (if enabled by constraints) to set the most efficient regulator operating mode for the new regulator loading.

Consumer devices notify their supply regulator of the maximum power they will require (can be taken from device datasheet in the power consumption tables) when they change operational status and hence power state. Examples of operational state changes that can affect power consumption are :-

o Device is opened / closed. o Device I/O is about to begin or has just finished. o Device is idling in between work.

This information is also exported via sysfs to userspace.

DRMS will sum the total requested load on the regulator and change to the most efficient operating mode if platform constraints allow.

Returns the new regulator mode or error.

Definition at line 2643 of file core.c.

int regulator_set_voltage ( struct regulator regulator,
int  min_uV,
int  max_uV 
)

regulator_set_voltage - set regulator output voltage : regulator source : Minimum required voltage in uV : Maximum acceptable voltage in uV

Sets a voltage regulator to the desired output voltage. This can be set during any regulator state. IOW, regulator can be disabled or enabled.

If the regulator is enabled then the voltage will change to the new value immediately otherwise if the regulator is disabled the regulator will output at the new voltage when enabled.

NOTE: If the regulator is shared between several devices then the lowest request voltage that meets the system constraints will be used. Regulator system constraints must be set for this regulator before calling this function otherwise this call will fail.

Definition at line 2249 of file core.c.

int regulator_set_voltage_sel_regmap ( struct regulator_dev rdev,
unsigned  sel 
)

regulator_set_voltage_sel_regmap - standard set_voltage_sel for regmap users

: regulator to operate on : Selector to set

Regulators that use regmap for their register I/O can set the vsel_reg and vsel_mask fields in their descriptor and then use this as their set_voltage_vsel operation, saving some code.

Definition at line 2039 of file core.c.

int regulator_set_voltage_time ( struct regulator regulator,
int  old_uV,
int  new_uV 
)

regulator_set_voltage_time - get raise/fall time : regulator source : starting voltage in microvolts : target voltage in microvolts

Provided with the starting and ending voltage, this function attempts to calculate the time in microseconds required to rise or fall to this new voltage.

Definition at line 2299 of file core.c.

int regulator_set_voltage_time_sel ( struct regulator_dev rdev,
unsigned int  old_selector,
unsigned int  new_selector 
)

regulator_set_voltage_time_sel - get raise/fall time : regulator source device : selector for starting voltage : selector for target voltage

Provided with the starting and target voltage selectors, this function returns time in microseconds required to rise or fall to this new voltage

Drivers providing ramp_delay in regulation_constraints can use this as their set_voltage_time_sel() operation.

Definition at line 2346 of file core.c.

int regulator_suspend_finish ( void  )

regulator_suspend_finish - resume regulators from system wide suspend

Turn on regulators that might be turned off by regulator_suspend_prepare and that should be turned on according to the regulators properties.

Definition at line 3538 of file core.c.

int regulator_suspend_prepare ( suspend_state_t  state)

regulator_suspend_prepare - prepare regulators for system wide suspend : system suspend state

Configure each regulator with it's suspend operating parameters for state. This will usually be called by machine suspend code prior to supending.

Definition at line 3505 of file core.c.

int regulator_sync_voltage ( struct regulator regulator)

regulator_sync_voltage - re-apply last regulator output voltage : regulator source

Re-apply the last configured voltage. This is intended to be used where some external control source the consumer is cooperating with has caused the configured voltage to change.

Definition at line 2382 of file core.c.

void regulator_unregister ( struct regulator_dev rdev)

regulator_unregister - unregister regulator : regulator to unregister

Called by regulator drivers to unregister a regulator.

Definition at line 3477 of file core.c.

int regulator_unregister_notifier ( struct regulator regulator,
struct notifier_block nb 
)

regulator_unregister_notifier - unregister regulator event notifier : regulator source : notifier block

Unregister regulator event notifier block.

Definition at line 2835 of file core.c.

void regulator_use_dummy_regulator ( void  )

regulator_use_dummy_regulator - Provide a dummy regulator when none is found

Calling this function will cause the regulator API to provide a dummy regulator to consumers if no physical regulator is found, allowing most consumers to proceed as though a regulator were configured. This allows systems such as those with software controllable regulators for the CPU core only to be brought up more readily.

Definition at line 3600 of file core.c.