gpio-sim as a GPIO Interrupt for PMIC driver

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

gpio-sim as a GPIO Interrupt for PMIC driver

ソリューションへジャンプ
1,014件の閲覧回数
elFunko
Contributor III

Hi everyone,

I'm currently working on getting a custom i.MX93 board up and running, and I'm facing an issue with the PMIC (the NXP PCA9451A). The problem is that the PMIC requires a GPIO interrupt to load its driver, but our board does not have any free GPIOs available.

To solve this, we came up with the idea of using a "fake" GPIO through gpio-sim or gpio-mockup, so that we can get the PMIC up and running for now. In a future revision of the board, we plan to replace this mockup GPIO with a real one. However, I'm struggling to get the PMIC driver to load, regardless of how I configure the gpio-sim node.

I've seen a linux patch from 2022 "[PATCH v2 0/3] allow gpio simulator be used as interrupt controller ", which seems to be attempting the same thing I'm trying to do. We're currently using Linux version 6.6.28-lf-6.6.y-lf-6.6.y-g81ea508ca4b7-dirty.

I've also made sure to add the necessary kernel configuration options, including:

  • CONFIG_GPIO_SIM=y

  • CONFIG_GPIOLIB=y

  • CONFIG_IRQ_SIM=y

Despite this, the PMIC driver does not load. Below is how I'd like the PMIC node to look in the device tree, using gpio-sim as the interrupt parent:

&lpi2c1 {
    #address-cells = <1>;
    #size-cells = <0>;
    clock-frequency = <400000>;
    pinctrl-names = "default", "sleep";
    pinctrl-0 = <&pinctrl_lpi2c1>;
    pinctrl-1 = <&pinctrl_lpi2c1>;
    status = "okay";

    pmic@25 {
        compatible = "nxp,pca9451a";
        reg = <0x25>;
        interrupt-parent = <&gpio_sim>;
        interrupts = <0 IRQ_TYPE_EDGE_FALLING>;

Has anyone successfully used gpio-sim in a similar scenario, or can anyone suggest how the gpio-sim node should be configured to make this work?

Any help would be greatly appreciated!

Best regards,
Elia

 

タグ(2)
0 件の賞賛
返信
1 解決策
918件の閲覧回数
elFunko
Contributor III

To anyone having the same question I got it to work:

/ {
	gpio_sim {
		compatible = "gpio-simulator";

		bank0: bank0 {
			gpio-controller;
			#gpio-cells = <1>;
			ngpios = <1>;

			interrupt-controller;
			#interrupt-cells = <1>;
		};
	};
};

 

元の投稿で解決策を見る

0 件の賞賛
返信
1 返信
919件の閲覧回数
elFunko
Contributor III

To anyone having the same question I got it to work:

/ {
	gpio_sim {
		compatible = "gpio-simulator";

		bank0: bank0 {
			gpio-controller;
			#gpio-cells = <1>;
			ngpios = <1>;

			interrupt-controller;
			#interrupt-cells = <1>;
		};
	};
};

 

0 件の賞賛
返信