Preface 1. What is regulator? regulator translated as "regulator", is divided into voltage regulator (voltage regulator) and current regulator. The General power management chip (Power Management IC) contains one or more regulator. 2. What is the role of regulator? The usual function is to power electronic devices. Most regulator can enable (enable) and disable (disable) their outputs, as well as control their output voltage (voltage) and currents (current). As you can see, the input power will be converted to output by regulator Power,regulator the following constraints:- voltage control: input 5V output 1.8v- Current limiting: The output of the is 20ma- power switch: can control voltage enable/disable problem 1. If a system has only one regulator, and only one device is controlled, there is absolutely no need to use the Linux regulator framework mechanism. However, if a system has a few or even more than 10 regulator, and there is a cascade relationship between each regulator, the Linux regulator framework is required. 2. How will the Linux regulator framework manage the devices if one regulator controls multiple devices and the voltage or current requirements for each device are different? 3. Some devices only need enable/disable power supply, and some devices in the process of operation need to change dynamically voltage or Current,linux regulator framework how to deal with these problems? 4. regulator error configuration may also have very serious consequences for the hardware, so you need to design regulaor carefully, but also to standardize the use of regulator. Linux regulator FRAMEWORK1. The linux regulator Framework is designed primarily to provide a standard core interface to control voltage and current regulators. Purpose isAllows the system to dynamically control the regulator power output to conserve energy and prolong battery life. This applies to the voltage regulator and the current regulator (where both voltages and currents are controllable). 2. The linux regulator framework is divided into four sections, namely Machine,regulator,consumer,sys-class-regulator. Machinemachine can be understood as regulator hardware configuration at the board level, using the REGULATOR_INIT_DATA structure to represent the regulator board-level configuration.
structRegulator_init_data {Const Char*supply_regulator;/*or NULL for system supply*/ structregulation_constraints constraints; intnum_consumer_supplies; structRegulator_consumer_supply *consumer_supplies; /*optional regulator Machine specific init*/ int(*regulator_init) (void*driver_data); void*driver_data;/*core does not touch this*/ };
. Supply_regulator:regulator's parent. For cascading regulator use: Constraints for this regulator, such as output voltage range, output current range, etc.. Num_consumer_supplies: The number of regulator provided by this consumer, That is, the number of peripherals to be controlled. Consumer_supplies: Use this structure to determine the connection between regulator and consumer. Callback function for Regulator_init:regulator registration: Driver_data Regulator_init the parameters of the callback function. The regulator board level configuration can also be called constraints, defined in the regulation_constraints structure.
structregulation_constraints {Const Char*name; /*Voltage Output Range (inclusive)-For voltage control*/ intMin_uv; intMax_uv; intUv_offset; /*Current Output Range (inclusive)- for current control*/ intMin_ua; intMax_ua; /*valid regulator operating modes for the*/unsignedintValid_modes_mask; /*valid operations for regulator on the This machine*/unsignedintValid_ops_mask; /*regulator Input Voltage-only If supply is another regulator*/ intInput_uv; /*regulator suspend states for global PMIC standby/hibernate*/ structregulator_state State_disk; structregulator_state State_mem; structregulator_state State_standby; suspend_state_t initial_state; /*suspend state-to-set at Init*/ /*mode to set on startup*/unsignedintInitial_mode; unsignedintRamp_delay; unsignedintEnable_time; /*Constraint Flags*/unsigned always_on:1;/*regulator never off when system was on*/unsigned boot_on:1;/*Bootloader/firmware enabled Regulator*/unsigned apply_uv:1;/*Apply UV constraint if min = = Max*/unsigned ramp_disable:1;/*Disable Ramp delay*/ };
. Name: Describes the name of the constraint. MIN_UV/MAX_UV: minimum/maximum output voltage. Uv_offset:consumer See the offset between the power supply and the actual power supply for power compensation: min_ua/max_ua min/MAX output current. Valid_modes_mask: The operating mode supported by this regulator. #define REGULATOR_MODE_FAST 0x1//fast Change Mode
#define REGULATOR_MODE_NORMAL 0x2//Normal mode, most drivers use this mode
#define REGULATOR_MODE_IDLE 0x4//device is idle, regulator provides service to the device
#define REGULATOR_MODE_STANDBY 0x8//device is in STANDBY State, regulator provides services to the device. Valid_ops_mask: The operation supported by the regulator. #define Regulator_change_voltage 0x1//The regulator can change the voltage
#define Regulator_change_current 0x2//The regulator can change the current
#define Regulator_change_mode 0x4//The regulator can change MODE
#define REGULATOR_CHANGE_STATUS 0x8//The regulator can change state, i.e. enable/disable power
#define REGULATOR_CHANGE_DRMS 0x10//The regulator can be dynamically changed mode
#define REGULATOR_CHANGE_BYPASS 0x20//The regulator supports BYPASS mode
. INPUT_UV: Indicates that the regulator input is another regulator. State_disk/state_mem/state_standby: A variety of regulator states that represent the suspend. Always _ON: Whether it is enabled after the system is booted. BOOT_ON: Whether it is enabled in the boot phase.
. APPLY_UV: When MIN_UV=MAX_UV is used, Ramp_delay: Change the voltage to the power to stabilize the time. Due to hardware reasons, changes in power can not be immediately successful, which requires a certain delay: the enable_time:regulator time.
.... Not finishedReference Address: 53129378
Linux Power Management-linux Regulator Framework Overview