zoukankan      html  css  js  c++  java
  • qcom 系列的i2c设备的power 在dtsi里定义的时候需要注意的

    最近在driver里发现一个有点值得注意的地方:


    在dtsi里定义了power

    vdd-supply = <&pm8937_l10>;
    vcc_i2c-supply = <&pm8937_l5>;


    但是在i2c device的driver里看到的却是

    pdata->vcc = devm_regulator_get(dev, "vcc_i2c");

    也就是说这边的vcc_i2c和dtis里的vcc_i2c-supply的差距是多了个-supply

    这个supply在哪里加的呢,追踪 devm_regulator_get


    struct regulator *devm_regulator_get(struct device *dev, const char *id)
    {
    regulator = regulator_get(dev, id);//只要追踪id就好

    }

    static struct regulator *_regulator_get(struct device *dev, const char *id,
    int exclusive)
    {

    rdev = regulator_dev_lookup(dev, id, &ret);

    }

    static struct regulator_dev *regulator_dev_lookup(struct device *dev,
     const char *supply,
     int *ret)
    {

    node = of_get_regulator(dev, supply);

    }

    static struct device_node *of_get_regulator(struct device *dev, const char *supply)
    {
    struct device_node *regnode = NULL;
    char prop_name[32]; /* 32 is max size of property name */


    dev_dbg(dev, "Looking up %s-supply from device tree ", supply);


    snprintf(prop_name, 32, "%s-supply", supply);  //最终看到了这个加-supply的地方了
    regnode = of_parse_phandle(dev->of_node, prop_name, 0);


    if (!regnode) {
    dev_dbg(dev, "Looking up %s property in node %s failed",
    prop_name, dev->of_node->full_name);
    return NULL;
    }
    return regnode;
    }
  • 相关阅读:
    单个 js 文件禁用 ESLint 语法校验
    meta标签整合
    安装es6编译babel
    JSON.parse()和JSON.stringify()的区别
    preventDefault()、stopPropagation()、return false 的区别
    excel 表格内容读取
    redis 小例
    多文件打包下载
    随笔
    js数组删除元素
  • 原文地址:https://www.cnblogs.com/liulaolaiu/p/11744453.html
Copyright © 2011-2022 走看看