gpio-sim as a GPIO Interrupt for PMIC driver

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

gpio-sim as a GPIO Interrupt for PMIC driver

跳至解决方案
1,220 次查看
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 解答
1,124 次查看
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 回复
1,125 次查看
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 项奖励
回复