in in file : drivers/gpio/gpiolib-acpi.c, line 927 (as a function)
and it's comment say:
```
/**
* acpi_dev_gpio_irq_get() - Find GpioInt and translate it to Linux IRQ number
* @adev: pointer to a ACPI device to get IRQ from
* @index: index of GpioInt resource (starting from %0)
*
* If the device has one or more GpioInt resources, this function can be
* used to translate from the GPIO offset in the resource to the Linux IRQ
* number.
*
* The function is idempotent, though each time it runs it will configure GPIO
* pin direction according to the flags in GpioInt resource.
*
* Return: Linux IRQ number (> %0) on success, negative errno on failure.
*/
int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index)
{
```
each time it runs it will configure GPIO pin direction according to the flags in GpioInt resource.
in it's body ,by call function gpiod_configure_flags (in /drivers/gpio/gpiolib.c)
it call the function gpiod_direction_input.
so the direction become to :input or in
the problem may be in two places:
1. lenovo 's default value in bios or dsdt is : input or in,or missing . but on windows ,it's ok,so ,may be not here.
2. in linux kernel,the default value of the type for gpio pin 's direction ,is :input or in
according to the above analysis, error is happen with the direction is : in
i found the function to set the direction of gpio pin to in: amd_gpio_ direction_ input,
and add some pr_err and dump_stack() to the function ,
then dmesg out put like :
[ 1.545190] amd_gpio_set_config gpio_chip- >label: AMDI0030: 00,offset: 130,config: 278 direction_ input gpio_chip- >label: AMDI0030: 00,offset: 130
[ 1.545191] amd_gpio_
======= ======= ======= ======= =amd_gpio_ direction_ input dump_stack()===== 303.fc33. x86_64 #1 probe_work_ func 0x6b/0x88 direction_ input+0x57/ 0x60 [pinctrl_amd] _input+ 0x5b/0x170 gpio_irq_ get+0x111/ 0x1b6 find_adapter_ by_handle+ 0x30/0x30 get_irq+ 0x81/0x90 probe+0x24a/ 0x280 probe+0x160/ 0x400 probe_device+ 0xe1/0x150 allows_ async_probing+ 0x50/0x50 each_drv+ 0x6a/0xa0 attach+ 0xb4/0x1b0 device+ 0x8e/0xa0 probe_work_ func+0x77/ 0xc0 one_work+ 0x1b4/0x370 thread+ 0x53/0x3e0 one_work+ 0x370/0x370 bind_mask+ 0x60/0x60 fork+0x22/ 0x30 ======= ======= ======= ======= ======= ======= ======= ======= ======= ======
[ 1.545194] CPU: 12 PID: 264 Comm: kworker/12:4 Not tainted 5.8.13-
[ 1.545194] Hardware name: LENOVO 82B6/LNVNB161216, BIOS EUCN26WW 08/19/2020
[ 1.545197] Workqueue: events deferred_
[ 1.545198] Call Trace:
[ 1.545203] dump_stack+
[ 1.545205] amd_gpio_
[ 1.545206] gpiod_direction
[ 1.545208] acpi_dev_
[ 1.545209] ? i2c_acpi_
[ 1.545210] i2c_acpi_
[ 1.545212] i2c_device_
[ 1.545213] really_
[ 1.545214] driver_
[ 1.545215] ? driver_
[ 1.545216] bus_for_
[ 1.545217] __device_
[ 1.545218] bus_probe_
[ 1.545219] deferred_
[ 1.545220] process_
[ 1.545221] worker_
[ 1.545222] ? process_
[ 1.545223] kthread+0x11b/0x140
[ 1.545224] ? __kthread_
[ 1.545226] ret_from_
=======
then i found the functions
acpi_dev_ gpio_irq_ get
in in file : drivers/ gpio/gpiolib- acpi.c, line 927 (as a function)
and it's comment say: gpio_irq_ get() - Find GpioInt and translate it to Linux IRQ number gpio_irq_ get(struct acpi_device *adev, int index)
```
/**
* acpi_dev_
* @adev: pointer to a ACPI device to get IRQ from
* @index: index of GpioInt resource (starting from %0)
*
* If the device has one or more GpioInt resources, this function can be
* used to translate from the GPIO offset in the resource to the Linux IRQ
* number.
*
* The function is idempotent, though each time it runs it will configure GPIO
* pin direction according to the flags in GpioInt resource.
*
* Return: Linux IRQ number (> %0) on success, negative errno on failure.
*/
int acpi_dev_
{
```
each time it runs it will configure GPIO pin direction according to the flags in GpioInt resource.
in it's body ,by call function gpiod_configure _flags (in /drivers/ gpio/gpiolib. c) _input.
it call the function gpiod_direction
so the direction become to :input or in
the problem may be in two places:
1. lenovo 's default value in bios or dsdt is : input or in,or missing . but on windows ,it's ok,so ,may be not here.
2. in linux kernel,the default value of the type for gpio pin 's direction ,is :input or in