在linux devicetree(arm)中定义由同一GPIO引脚控制的3个稳压器

时间:2016-10-14 08:01:26

标签: linux linux-kernel device-tree

我有一个基于rk3288(rockchip)为我修复/编写设备树的电路板。在该文件中,目前有三个单独的监管机构的以下定义:

    dovdd_1v8: dovdd-1v8-regulator {
            compatible = "regulator-fixed";
            enable-active-high;
            gpio = <&gpio0 11 GPIO_ACTIVE_HIGH>;
            pinctrl-names = "default";
            pinctrl-0 = <&dvp_pwr>;
            regulator-name = "dovdd_1v8";
            regulator-min-microvolt = <1800000>;
            regulator-max-microvolt = <1800000>;
            vin-supply = <&vcc_io>;
    };

    vcc28_dvp: vcc28-dvp-regulator {
            compatible = "regulator-fixed";
            enable-active-high;
            gpio = <&gpio0 11 GPIO_ACTIVE_HIGH>;
            pinctrl-names = "default";
            pinctrl-0 = <&dvp_pwr>;
            regulator-name = "vcc28_dvp";
            regulator-min-microvolt = <2800000>;
            regulator-max-microvolt = <2800000>;
            vin-supply = <&vcc_io>;
    };

    af_28: af_28-regulator {
            compatible = "regulator-fixed";
            enable-active-high;
            gpio = <&gpio0 11 GPIO_ACTIVE_HIGH>;
            pinctrl-names = "default";
            pinctrl-0 = <&dvp_pwr>;
            regulator-name = "af_28";
            regulator-min-microvolt = <2800000>;
            regulator-max-microvolt = <2800000>;
            vin-supply = <&vcc_io>;
    };

问题是内核抱怨说它不能为这3个稳压器分配相同的GPIO引脚。在电路板原理图中,稳压器由同一个GPIO引脚控制。

这样做的正确方法是什么?

谢谢! 乙

编辑:这是我在串行控制台上看到的错误消息:

[    0.270507] rockchip-pinctrl pinctrl: pin gpio0-11 already requested 
by dovdd-1v8-regulator; cannot claim for vcc28-dvp-regulator
[    0.270570] rockchip-pinctrl pinctrl: pin-11 (vcc28-dvp-regulator) status -22
[    0.270611] rockchip-pinctrl pinctrl: could not request pin 11 (gpio0-11) from group dvp-pwr  on device rockchip-pinctrl
[    0.270663] reg-fixed-voltage vcc28-dvp-regulator: Error applying setting, reverse things back

cif power regulators

1 个答案:

答案 0 :(得分:1)

调节器子系统允许单个GPIO启用多个调节器 我在fixed.ccore.c中找不到会阻止多个监管机构共享一个启用GPIO的代码。

现在您已添加了显着的错误消息,问题更加清晰 您获得的错误消息不是来自GPIO资源管理,而是来自pinctrl子系统 可能的原因是每个调节器的pinctrl组的声明不正确。 (您尚未发布设备树的那部分。)
因此,您会收到pinctrl分配错误,这与GPIO分配错误不同 (pinctrl子系统的级别低于GPIO管理,可以为外设功能,也就是引脚多路复用以及GPIO分配引脚。)

我不确定DT的正确解决方案是什么。
假设只为启用GPIO声明了一个pinctrl组,您可以尝试在一个调节器节点中仅使用一次。 IOW删除其他两个调节器中的pinctrl属性。