Bug 114161

Summary: pinctrl-baytrail: Potential Error: Setting GPIO with direct_irq_en to output
Product: Drivers Reporter: dan.g.tob
Component: Platform_x86Assignee: drivers_platform_x86 (drivers_platform_x86)
Status: REOPENED ---    
Severity: normal CC: braiamp, dan.g.tob, heikki.krogerus, mika.westerberg
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 4.12 Tree: Mainline
Regression: No
Bug Depends on:    
Bug Blocks: 113151    
Attachments: complete dmesg
dmesg from 4.7
dmesg from 4.11-rc1
dmesg from 4.12.4
acpidump from lenovo 100S 11IBY, latest dated bios

Description dan.g.tob 2016-03-09 14:36:52 UTC
Created attachment 208401 [details]
complete dmesg

[    3.830402] ------------[ cut here ]------------
[    3.830420] WARNING: CPU: 3 PID: 137 at /build/linux-xT7CCq/linux-4.4.4/drivers/pinctrl/intel/pinctrl-baytrail.c:342 byt_gpio_direction_output+0x9e/0xb0()
[    3.830423] Potential Error: Setting GPIO with direct_irq_en to output
[    3.830426] Modules linked in:
[    3.830430]  int3403_thermal(+) i915(+) int3402_thermal processor_thermal_device(+) int3400_thermal(+) intel_soc_dts_iosf int340x_thermal_zone acpi_thermal_rel video button acpi_pad ac drm_kms_helper drm i2c_designware_platform(+) tpm_tis lpc_ich mfd_core iosf_mbi i2c_algo_bit tpm i2c_designware_core snd_soc_sst_acpi processor fuse autofs4 ext4 crc16 mbcache jbd2 mmc_block crc32c_intel xhci_pci xhci_hcd usbcore usb_common thermal fjes i2c_hid hid sdhci_acpi sdhci mmc_core
[    3.830485] CPU: 3 PID: 137 Comm: kworker/3:2 Not tainted 4.4.0-1-amd64 #1 Debian 4.4.4-1
[    3.830488] Hardware name: LENOVO 80R2/Aristotle 11.6, BIOS E2CN13WW 12/22/2015
[    3.830496] Workqueue: pm pm_runtime_work
[    3.830501]  0000000000000086 00000000232c577b ffffffff812ea6b5 ffff880036fe78a8
[    3.830507]  ffffffff8184f130 ffffffff8107751d ffff88007baef308 ffff880036fe7900
[    3.830513]  ffffc900003701f8 ffffc900003701f0 0000000000000000 ffffffff810775ac
[    3.830519] Call Trace:
[    3.830528]  [<ffffffff812ea6b5>] ? dump_stack+0x5c/0x77
[    3.830535]  [<ffffffff8107751d>] ? warn_slowpath_common+0x7d/0xb0
[    3.830540]  [<ffffffff810775ac>] ? warn_slowpath_fmt+0x5c/0x80
[    3.830546]  [<ffffffff8141b474>] ? __pm_runtime_resume+0x54/0x70
[    3.830552]  [<ffffffff8131cbce>] ? byt_gpio_direction_output+0x9e/0xb0
[    3.830557]  [<ffffffff813226cc>] ? _gpiod_direction_output_raw+0x5c/0x1f0
[    3.830563]  [<ffffffff813257be>] ? acpi_gpio_adr_space_handler+0x1ee/0x310
[    3.830568]  [<ffffffff813255d0>] ? acpi_gpiochip_request_interrupt+0x2b0/0x2b0
[    3.830575]  [<ffffffff813828f1>] ? acpi_ev_address_space_dispatch+0x1ef/0x24d
[    3.830580]  [<ffffffff8138632e>] ? acpi_ex_access_region+0x1d6/0x262
[    3.830585]  [<ffffffff813860b5>] ? acpi_ex_write_data_to_field+0x191/0x1f0
[    3.830591]  [<ffffffff8138a1b0>] ? acpi_ex_store_object_to_node+0x14d/0x17c
[    3.830596]  [<ffffffff8138a2a7>] ? acpi_ex_store+0xc8/0x250
[    3.830601]  [<ffffffff81387733>] ? acpi_ex_opcode_1A_1T_1R+0x405/0x543
[    3.830606]  [<ffffffff8137f78d>] ? acpi_ds_exec_end_op+0xc8/0x3cb
[    3.830613]  [<ffffffff81391aed>] ? acpi_ps_parse_loop+0x512/0x578
[    3.830619]  [<ffffffff811bf5dd>] ? kmem_cache_alloc+0x1ad/0x1c0
[    3.830624]  [<ffffffff8139259b>] ? acpi_ps_parse_aml+0x91/0x273
[    3.830629]  [<ffffffff81392d72>] ? acpi_ps_execute_method+0x140/0x175
[    3.830635]  [<ffffffff8138d5ca>] ? acpi_ns_evaluate+0x1b4/0x232
[    3.830640]  [<ffffffff8138ffa7>] ? acpi_evaluate_object+0x13e/0x247
[    3.830647]  [<ffffffff8136e83b>] ? acpi_dev_pm_explicit_set+0x59/0x7d
[    3.830652]  [<ffffffff8136e9a3>] ? acpi_device_set_power+0x144/0x1c3
[    3.830658]  [<ffffffff8136ec0a>] ? acpi_dev_pm_low_power.part.6+0x39/0x54
[    3.830664]  [<ffffffff8136ee58>] ? acpi_dev_runtime_suspend+0x68/0x83
[    3.830670]  [<ffffffff8141a21e>] ? __rpm_callback+0x2e/0x70
[    3.830675]  [<ffffffff8141a27f>] ? rpm_callback+0x1f/0x70
[    3.830680]  [<ffffffff8136ee73>] ? acpi_dev_runtime_suspend+0x83/0x83
[    3.830685]  [<ffffffff8141ad44>] ? rpm_suspend+0x124/0x640
[    3.830691]  [<ffffffff810b5f84>] ? __wake_up+0x34/0x50
[    3.830697]  [<ffffffff8141b9ce>] ? pm_runtime_work+0x8e/0x90
[    3.830703]  [<ffffffff8108ed67>] ? process_one_work+0x157/0x410
[    3.830708]  [<ffffffff8108f06d>] ? worker_thread+0x4d/0x450
[    3.830713]  [<ffffffff8108f020>] ? process_one_work+0x410/0x410
[    3.830719]  [<ffffffff81094dfd>] ? kthread+0xcd/0xf0
[    3.830724]  [<ffffffff81094d30>] ? kthread_create_on_node+0x190/0x190
[    3.830731]  [<ffffffff8158ed8f>] ? ret_from_fork+0x3f/0x70
[    3.830736]  [<ffffffff81094d30>] ? kthread_create_on_node+0x190/0x190
[    3.830740] ---[ end trace c6a578a942c4cff1 ]---
Comment 1 dan.g.tob 2016-07-26 01:40:10 UTC
Created attachment 226431 [details]
dmesg from 4.7
Comment 2 dan.g.tob 2017-01-13 08:51:01 UTC
No longer see this with 4.9 and above
Comment 3 dan.g.tob 2017-03-06 00:25:22 UTC
Created attachment 255093 [details]
dmesg from 4.11-rc1

This does still exist, I must have missed it before

[    2.583348] ------------[ cut here ]------------
[    2.583359] WARNING: CPU: 3 PID: 54 at /home/kernel/COD/linux/drivers/pinctrl/intel/pinctrl-baytrail.c:1035 byt_gpio_set_direction+0xaf/0xc0
[    2.583361] Potential Error: Setting GPIO with direct_irq_en to output
[    2.583362] Modules linked in: i2c_hid hid mmc_block fjes i2c_designware_platform i2c_designware_core sdhci_acpi sdhci
[    2.583378] CPU: 3 PID: 54 Comm: kworker/3:1 Not tainted 4.11.0-041100rc1-generic #201703051731
[    2.583380] Hardware name: LENOVO 80R2/Aristotle 11.6, BIOS E2CN14WW 09/23/2016
[    2.583386] Workqueue: pm pm_runtime_work
[    2.583389] Call Trace:
[    2.583397]  dump_stack+0x63/0x81
[    2.583401]  __warn+0xcb/0xf0
[    2.583404]  warn_slowpath_fmt+0x5f/0x80
[    2.583409]  ? byt_get_groups_count+0x20/0x20
[    2.583413]  byt_gpio_set_direction+0xaf/0xc0
[    2.583417]  pinmux_gpio_direction+0x20/0x30
[    2.583420]  pinctrl_gpio_direction+0x7d/0xa0
[    2.583424]  pinctrl_gpio_direction_output+0x10/0x20
[    2.583428]  byt_gpio_direction_output+0x25/0x50
[    2.583431]  ? byt_gpio_get_direction+0x4d/0x70
[    2.583436]  _gpiod_direction_output_raw+0xa8/0x290
[    2.583439]  gpiod_direction_output+0x47/0xb0
[    2.583444]  acpi_gpio_adr_space_handler+0x193/0x310
[    2.583448]  ? acpi_can_fallback_to_crs.part.8+0x100/0x100
[    2.583453]  acpi_ev_address_space_dispatch+0x1fb/0x25a
[    2.583457]  acpi_ex_access_region+0x1ea/0x265
[    2.583461]  acpi_ex_write_data_to_field+0x1a9/0x213
[    2.583466]  ? acpi_ds_init_object_from_op+0x33/0x262
[    2.583470]  acpi_ex_store_object_to_node+0x153/0x183
[    2.583474]  acpi_ex_store+0xca/0x266
[    2.583478]  ? acpi_ds_create_operands+0x87/0xee
[    2.583481]  acpi_ex_opcode_1A_1T_1R+0x3ee/0x522
[    2.583485]  ? acpi_ex_resolve_operands+0x20e/0x4d4
[    2.583489]  acpi_ds_exec_end_op+0xcb/0x3e6
[    2.583493]  acpi_ps_parse_loop+0x52d/0x5a3
[    2.583496]  ? acpi_ut_create_generic_state+0x39/0x44
[    2.583500]  acpi_ps_parse_aml+0x98/0x27b
[    2.583504]  acpi_ps_execute_method+0x14d/0x184
[    2.583507]  acpi_ns_evaluate+0x1c6/0x252
[    2.583511]  acpi_evaluate_object+0x148/0x258
[    2.583516]  ? acpi_dev_runtime_suspend+0x8e/0x8e
[    2.583519]  acpi_dev_pm_explicit_set+0x56/0x76
[    2.583522]  acpi_device_set_power+0x14d/0x1cd
[    2.583526]  acpi_dev_pm_low_power.part.7+0x3a/0x53
[    2.583529]  acpi_dev_runtime_suspend+0x6f/0x8e
[    2.583533]  acpi_subsys_runtime_suspend+0x1e/0x21
[    2.583537]  __rpm_callback+0xc4/0x200
[    2.583542]  ? update_load_avg+0x79/0x520
[    2.583546]  rpm_callback+0x24/0x80
[    2.583549]  ? acpi_dev_runtime_suspend+0x8e/0x8e
[    2.583552]  rpm_suspend+0x132/0x650
[    2.583557]  rpm_idle+0x58/0x250
[    2.583560]  pm_runtime_work+0x92/0xa0
[    2.583564]  process_one_work+0x1fc/0x4b0
[    2.583567]  worker_thread+0x4b/0x500
[    2.583572]  kthread+0x101/0x140
[    2.583575]  ? process_one_work+0x4b0/0x4b0
[    2.583578]  ? kthread_create_on_node+0x60/0x60
[    2.583582]  ret_from_fork+0x2c/0x40
[    2.583586] ---[ end trace 452bf8ae09f701e5 ]---
Comment 4 dan.g.tob 2017-08-06 18:59:25 UTC
still around with 4.12.4

[    3.350655] Potential Error: Setting GPIO with direct_irq_en to output
[    3.350677] ------------[ cut here ]------------
[    3.350686] WARNING: CPU: 0 PID: 159 at /home/kernel/COD/linux/drivers/pinctrl/intel/pinctrl-baytrail.c:1035 byt_gpio_set_direction+0xa2/0xb0
[    3.350687] Modules linked in: i2c_hid(+) hid i915 mmc_block i2c_algo_bit drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops drm video i2c_designware_platform i2c_designware_core sdhci_acpi sdhci
[    3.350706] CPU: 0 PID: 159 Comm: systemd-udevd Not tainted 4.12.4-041204-generic #201707271932
[    3.350708] Hardware name: LENOVO 80R2/Aristotle 11.6, BIOS E2CN14WW 09/23/2016
[    3.350710] task: ffff97307b953fc0 task.stack: ffffaebb405d4000
[    3.350714] RIP: 0010:byt_gpio_set_direction+0xa2/0xb0
[    3.350716] RSP: 0018:ffffaebb405d75d0 EFLAGS: 00010086
[    3.350718] RAX: 000000000000003a RBX: ffff97307b920598 RCX: 0000000000000000
[    3.350720] RDX: 0000000000000000 RSI: 0000000000000002 RDI: 0000000000000046
[    3.350721] RBP: ffffaebb405d7600 R08: 000000000000003a R09: ffffffff8cb3aa40
[    3.350723] R10: 0000000000000001 R11: 000000000000003a R12: 0000000000000000
[    3.350724] R13: ffffaebb404251f0 R14: ffffaebb404251f8 R15: 0000000000000000
[    3.350727] FS:  00007fef81f1b8c0(0000) GS:ffff97307ae00000(0000) knlGS:0000000000000000
[    3.350729] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[    3.350730] CR2: 00007fef81f0b245 CR3: 000000006ed59000 CR4: 00000000001006f0
[    3.350732] Call Trace:
[    3.350740]  pinmux_gpio_direction+0x20/0x30
[    3.350744]  pinctrl_gpio_direction+0x7d/0xa0
[    3.350748]  pinctrl_gpio_direction_output+0x10/0x20
[    3.350751]  byt_gpio_direction_output+0x25/0x50
[    3.350755]  ? byt_gpio_get_direction+0x4d/0x70
[    3.350759]  _gpiod_direction_output_raw+0xa8/0x290
[    3.350763]  gpiod_direction_output+0x47/0xb0
[    3.350766]  acpi_gpio_adr_space_handler+0x1ee/0x300
[    3.350770]  ? acpi_can_fallback_to_crs.part.10+0x100/0x100
[    3.350775]  acpi_ev_address_space_dispatch+0x1fb/0x25a
[    3.350779]  acpi_ex_access_region+0x1ea/0x265
[    3.350782]  acpi_ex_write_data_to_field+0x1a9/0x213
[    3.350786]  ? acpi_ds_init_object_from_op+0x33/0x262
[    3.350789]  acpi_ex_store_object_to_node+0x153/0x183
[    3.350793]  acpi_ex_store+0xca/0x266
[    3.350796]  ? acpi_ds_create_operands+0x87/0xee
[    3.350799]  acpi_ex_opcode_1A_1T_1R+0x3ee/0x522
[    3.350802]  ? acpi_ex_resolve_operands+0x20e/0x4d4
[    3.350805]  acpi_ds_exec_end_op+0xcb/0x3e6
[    3.350809]  acpi_ps_parse_loop+0x52d/0x5a3
[    3.350812]  ? acpi_ut_create_generic_state+0x39/0x44
[    3.350815]  acpi_ps_parse_aml+0x98/0x27b
[    3.350819]  acpi_ps_execute_method+0x14d/0x184
[    3.350823]  acpi_ns_evaluate+0x1c6/0x252
[    3.350825]  acpi_evaluate_object+0x148/0x258
[    3.350829]  ? acpi_ut_release_mutex+0x5d/0x61
[    3.350834]  acpi_dev_pm_explicit_set.part.2+0x44/0x70
[    3.350837]  acpi_device_fix_up_power+0x30/0x40
[    3.350844]  i2c_hid_probe+0x493/0x6b1 [i2c_hid]
[    3.350849]  ? i2c_hid_start+0x140/0x140 [i2c_hid]
[    3.350854]  i2c_device_probe+0x184/0x230
[    3.350858]  driver_probe_device+0x29c/0x450
[    3.350862]  __driver_attach+0xdf/0xf0
[    3.350865]  ? driver_probe_device+0x450/0x450
[    3.350868]  bus_for_each_dev+0x6c/0xc0
[    3.350871]  driver_attach+0x1e/0x20
[    3.350874]  bus_add_driver+0x170/0x270
[    3.350878]  driver_register+0x60/0xe0
[    3.350881]  i2c_register_driver+0x42/0x90
[    3.350884]  ? 0xffffffffc02ae000
[    3.350889]  i2c_hid_driver_init+0x17/0x1000 [i2c_hid]
[    3.350893]  do_one_initcall+0x52/0x1a0
[    3.350897]  ? __vunmap+0x81/0xb0
[    3.350901]  ? kfree+0x14a/0x160
[    3.350904]  ? kmem_cache_alloc_trace+0x142/0x190
[    3.350908]  do_init_module+0x5f/0x200
[    3.350912]  load_module+0x1a14/0x1d90
[    3.350918]  ? ima_post_read_file+0x7e/0xa0
[    3.350922]  ? security_kernel_post_read_file+0x6b/0x80
[    3.350926]  SYSC_finit_module+0xdf/0x110
[    3.350929]  ? SYSC_finit_module+0xdf/0x110
[    3.350933]  SyS_finit_module+0xe/0x10
[    3.350937]  entry_SYSCALL_64_fastpath+0x1e/0xa9
[    3.350939] RIP: 0033:0x7fef80d96259
[    3.350941] RSP: 002b:00007ffcd56365e8 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
[    3.350944] RAX: ffffffffffffffda RBX: 0000006744968be0 RCX: 00007fef80d96259
[    3.350945] RDX: 0000000000000000 RSI: 00007fef816af265 RDI: 000000000000000b
[    3.350947] RBP: 00007fef81048440 R08: 0000000000000000 R09: 00007ffcd5636b60
[    3.350948] R10: 000000000000000b R11: 0000000000000246 R12: 0000000000000000
[    3.350950] R13: 0000006744968be0 R14: 000000674496e5ec R15: 000000674495a730
[    3.350952] Code: 15 b4 45 00 48 83 c4 08 31 c0 5b 41 5c 41 5d 41 5e 41 5f 5d c3 41 83 cc 02 eb de 48 c7 c7 b8 76 51 8c 48 89 75 d0 e8 b5 b0 d2 ff <0f> ff 48 8b 75 d0 eb c6 66 0f 1f 44 00 00 0f 1f 44 00 00 55 48 
[    3.351001] ---[ end trace 3c6ab2ccdd41001c ]---
Comment 5 dan.g.tob 2017-08-06 19:13:21 UTC
Created attachment 257833 [details]
dmesg from 4.12.4
Comment 6 Mika Westerberg 2017-08-07 09:33:05 UTC
This is just a warning that your BIOS has misconfigured the pin. It has direct_irq flag set which means it is supposed to trigger interrupts toward IO-APIC when the line is active. For some reason the BIOS seems to want to use the same pin as output as well which does not work well.

Can you attach acpidump of the machine to the bug?
Comment 7 dan.g.tob 2017-08-07 12:25:40 UTC
Created attachment 257847 [details]
acpidump from lenovo 100S 11IBY, latest dated bios
Comment 8 Mika Westerberg 2017-08-07 12:35:47 UTC
OK, thanks.

So it is one of the i2c-hid devices that controls power in _PSx methods using a GPIO that is misconfigured. While the kernel warns about it, it still re-configures the pin so things should work.

This is BIOS issue which should be fixed there.