简体   繁体   English

在 linux 设备树(arm)中定义由相同 GPIO 引脚控制的 3 个调节器

[英]defining 3 regulators controlled by same GPIO pin in linux devicetree (arm)

I have a board for which I'm fixing/writing the device tree for, based on the rk3288 (rockchip).我有一个基于 rk3288(rockchip)的板,我正在为其修复/编写设备树。 In the file there are currently the following definitions for three seperate regulators:在该文件中,目前对三个单独的监管机构有以下定义:

    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>;
    };

The problem is that the kernel complains that it can't assign the same GPIO pin to these 3 regulators.问题是内核抱怨它不能为这 3 个调节器分配相同的 GPIO 引脚。 In the schematic for the board the regulators are controlled by the same GPIO pin.在电路板的原理图中,稳压器由相同的 GPIO 引脚控制。

What is the right way to do this?这样做的正确方法是什么?

Thanks!谢谢! B

EDIT: here is the error message I see on the serial console:编辑:这是我在串行控制台上看到的错误消息:

[    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 电源调节器

The regulator subsystem allows a single GPIO to enable more than one regulator.调节器子系统允许单个 GPIO 启用多个调节器。
I can find no code in fixed.c or core.c that would inhibit several regulators to share one enabling GPIO.我在fixed.ccore.c中找不到任何代码会禁止多个调节器共享一个启用 GPIO 的代码。

Now that you have added the salient error message, the issue is clearer.现在您已经添加了显着的错误消息,问题就更清楚了。
The error messages that you are getting are not from the GPIO resource management, but rather from the pinctrl subsystem.您收到的错误消息不是来自 GPIO 资源管理,而是来自 pinctrl 子系统。
The likely cause of this is improper declarations of the pinctrl group for each regulator.造成这种情况的可能原因是每个调节器的 pinctrl 组声明不正确。 (You have not posted that portion of your Device Tree.) (您尚未发布设备树的该部分。)
Hence you get a pinctrl allocation error, which is not the same as a GPIO allocation error.因此,您会收到 pinctrl 分配错误,这与 GPIO 分配错误不同。
(The pinctrl subsystem is at a lower level than GPIO management, and can allocate pins for peripheral functions, aka pin multiplexing, as well as for GPIO.) (pinctrl 子系统处于比 GPIO 管理更低的级别,并且可以为外围功能分配引脚,即引脚复用,以及 GPIO。)

I'm not sure what the proper fix in the DT should be.我不确定 DT 中的正确修复应该是什么。
Assuming that there is just one pinctrl group declared for the enabling GPIO, you can try using it only once in one regulator node.假设只为使能 GPIO 声明了一个 pinctrl 组,您可以尝试在一个调节器节点中仅使用一次。 IOW remove the pinctrl attributes in the other two regulators. IOW 删除了其他两个监管机构中的 pinctrl 属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM