電源管理接口
設備樹配置
i2c@78b7000 { /* BLSP1 QUP3 */
status = "okay";
synaptics@4b {
compatible = "synaptics,dsx-i2c";
vcc_i2c-supply = <&pm8953_l6>;
驅動代碼
static struct regulator *vcc_i2c;
//申請
vcc_i2c = regulator_get(dev, "vcc_i2c"); //名字和設備樹中-supply前面名字保持一致
if (IS_ERR(vcc_i2c)) {
GTP_ERROR("regulator get of vcc_i2c failed");
ret = PTR_ERR(vcc_i2c);
vcc_i2c = NULL;
goto ERR_GET_VCC;
}
//使能LDO
ret = regulator_enable(vcc_i2c);
//關閉LDO
ret = regulator_disable(vcc_i2c);
//釋放
regulator_put(vcc_i2c);
節點查看:
msm8953_64:/ # cat sys/kernel/debug/regulator/pm8953_l6/consumers
Device-Supply EN Min_uV Max_uV load_uA
3-005d-vcc_i2c Y 1800000 1800000 10000
1a94000.qcom,mdss_dsi_ctrl0-vddio N 1800000 1800000 100
pm8953_l6 N 0 0 0