How to request IRQ


#1

1.Add irq information to DTS file
1.1 Add the follow information to mt6797.dts
emphasized texttest_irq:test_irq{
compatible = “test,irq”;//irq test node name
};
1.2 add the follow information to amt6797_64_oam.dts
&test_irq{
pinctrl-names = “test_eint_as_int”;
pinctrl-0 = <&test_pins_eint_as_int>;//make the gpio to irq mode
interrupt-parent = <&eintc>;
interrupts = <63 IRQ_TYPE_LEVEL_LOW>;//63 is gpio number,
//IRQ_TYPE_LEVEL_LOW is low level trigger.
debounce = <63 0>;
status = “okay”;
};
&pio{
Test_pins_eint_as_int: test_eint@0 {
pins_cmd_dat {
pins = <PINMUX_GPIO63__FUNC_EINT2>;//mode setting
slew-rate = <0>;
bias-disable;
};
};
};
of course, we can setting the irq number information by using DCT tool. If so, please delete the interrupt-parent, interrupts,debounce label.
2.Request the irq
2.1.Finding the pointer of the dts node by using of_find_matching_node();
2.2.Setting the gpio debounce by using of_property_read_u32_array() and gpio_set_debounce();
2.3.Obtaining the irq number by using irq_of_parse_and_map();
2.4.request the irq by using request_irq();


Mediatek X20 irq setting?
How to set interrupt at X20?
#2

supplement
2.5.Setting the gpio mode by using pinctrl function.
Using the devm_pinctrl_get() to obtain the pinctrl node pointer;
Using the pinctrl_lookup_state() to obtain the pinctrl state pointer;
Using the pinctrl_select_state() to select the gpio state;