Set GPIO input for interrupt on custom board

Hi all

I'm working on custom board build with an nrf9161. Right now I'd like to use a gpio as input with interrupt for i2c captor icm20948. So for I've searched and I think I have 2 solutions but which one is better

First solution : in my common dtsi file add section like gpio-keys like a button. Is there a another solution because use button is not fine I think...

Second solution: I see in nrf9161dk board file something like this

arduino_i2c: &i2c2 {
	compatible = "nordic,nrf-twim";
	status = "okay";
	pinctrl-0 = <&i2c2_default>;
	pinctrl-1 = <&i2c2_sleep>;
	pinctrl-names = "default", "sleep";
	clock-frequency = <I2C_BITRATE_FAST>;

	pcal6408a: pcal6408a@21 {
		compatible = "nxp,pcal6408a";
		status = "disabled";
		reg = <0x21>;
		gpio-controller;
		#gpio-cells = <2>;
		ngpios = <8>;
		int-gpios = <&gpio0 19 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
	};
};

It's look like there is an i2c captor on i2c2 and use interupt on gpio 19, so for me icm20948 I have to develop the library to comunicate with it so this is a better solution or not ?

Related