This article transferred from: http://www.topeetboard.com
The power management chip used by the ITOP-4412 core board is a Samsung specific 9-way Buck and 28-channel Ldo output for the 4412 development of the s5m8767,8767, and the size of each voltage can be set by software. The s5m8767 driver is located in the kernel drivers/regulator/s5m8767.c,cpu which is controlled by the I²c bus. s5m8767 register the regulator module inside the kernel. The regulator module is a voltage/current supply in the kernel for controlling certain devices in the system, and in embedded systems (especially handheld devices), it is important to control the power consumption, which directly affects the battery life. So. If a module in the system is temporarily unused, it can be powered off by regulator, or the voltage and current size supplied to the module is reduced.
The main function of the s5m8767 driver is to call the Regulator_register function to register the REGULATOR_DEV device with the kernel, each regulator_dev represents a regulator device,
The kernel can control each regulator separately.
In order to implement the s5m8767 drive we also need to define the REGULATOR_INIT_DATA structure in the platform-related code, regulator_init_data to establish the parent-child regulator,
The tree structure between the flashlight modules, as well as some regulator basic information, such as the voltage size, below we look at the regulator_init_data structure, the code in
Arch/arm/mach-exynos/mach-itop4412.c inside, in this file use macro Regulator_init to define the regulator_init_data structure of 28 LDOs,
#define REGULATOR_INIT (_ldo, _name, _min_uv, _max_uv, _always_on, _ops_mask,\
_disabled) \
static struct Regulator_init_data s5m8767_# #_ldo # #_init_data = {\
. constraints = {\
. name= _name,\
. Min_uv = _min_uv,\
. Max_uv = _max_uv,\
. always_on= _always_on,\
. boot_on= _always_on,\
. apply_uv= 1,\
. Valid_ops_mask = _ops_mask,\
. state_mem= {\
. Disabled= _disabled,\
. Enabled=! (_disabled),\
}\
},\
. num_consumer_supplies = Array_size (s5m8767_# #_ldo # #_supply),\
. consumer_supplies = &s5m8767_# #_ldo # #_supply [0],\
}
In the above macro definition, the third and fourth parameters specify the voltage minimum and maximum value of the Ldo, and the fifth parameter sets whether the Ldo is output or closed when the system is running (1 is the output, 0 is off),
The sixth parameter is the function of the Ldo, such as can modify the voltage, current, change the state and so on through the bitmask settings, the seventh parameter is set in hibernation when the Pwren pin control its switch (1 is controlled by Pwren, 0 is not controlled by Pwren), When hibernating, the Pwren is low, the Ldo shuts down, and the system
Wake up, the Pwren is high, and the Ldo outputs.
For example, the definition of LDO2 is as follows:
Regulator_init (Ldo2, "Vddq_m12", 1500000, 1500000, 1,
Regulator_change_status, 1)
According to the definition, you can know that the voltage of the LDO2 output is 1.5v, the system starts by default, and the system shuts down when it sleeps. The other ldos have the same set-up principle as the LDO2.
The definition of buck in the system, such as BUCK1, is as follows:
static struct Regulator_init_data S5m8767_buck1_data = {
. constraints= {
. name= "vdd_mif range",
. min_uv= 900000,
. max_uv= 1100000,
. valid_ops_mask= Regulator_change_voltage |
Regulator_change_status,
. state_mem= {
. Disabled= 1,
},
},
. num_consumer_supplies= 1,
. consumer_supplies= &s5m8767_buck1_consumer,
};
According to the definition above, it is known that the BUCK1 voltage range is 0.9v to 1.1v, and he has the ability to modify the voltage and modify the state (variable valid_ops_mask). You can use functions
Regulator_set_voltage Modify the voltage of the BUCK1. Several other buck definitions are the same as the BUCK1.
If we want to modify the output voltage of an ldo of 8767, it can be achieved by modifying the voltage value in the regulator_init_data structure of the corresponding Ldo to modify the buck's power
The pressure can be achieved using the function Regulator_set_voltage. Note: When modifying the output voltage, be sure to refer to the datasheet of 8767 to ensure that the modified voltage is in the datasheet gauge
Within a fixed range
Fast voltage adjustment for iTOP-4412 Core board