电源管理接口

电源管理接口

设备树配置

    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
 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值