我开发板采用12v供电,有连接直流电机和HDMI显示屏,再使用过程中出现开发板死机的情况。
你好我再使用过程出现了,开发板两个USB突然无法使用的情况我接鼠标测,鼠标没有反应鼠标底下红灯也没有亮。这种一般是什么情况。
Hello @shuaigezeng
提供下lsusb
输出和内核log看看。
我这边发现一个我们这边写的驱动的问题,这是bug日志
[ 176.901004] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:293
[ 180.659105] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:293
[ 191.008805] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:293
[ 199.461974] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:293
[ 200.464494] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:293
[ 201.463063] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:293
[ 202.477420] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:293
[ 203.475605] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:293
[ 204.482867] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:293
[ 205.500748] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:293
[ 206.499013] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:293
[ 207.506363] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:293
[ 208.504580] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:293
[ 209.511870] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:293
[ 210.529804] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:293
[ 211.528082] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:293
Hello @shuaigezeng
那需要你们根据log信息检查下你们的驱动了。
我们这边是在定时器回调中去设置gpio的电平,我问gpt他给出的结论是这个但是我将gpio的设置函数从gpiod_direction_output修改为gpio_set_value,但是目前还是出现这个情况。
这个一般是因为什么导致的这边可以帮忙分析一下吗
[ 513.261221@6] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:293
[ 513.261641@6] in_atomic(): 1, irqs_disabled(): 128, non_block: 0, pid: 0, name: swapper/6
[ 513.262672@6] CPU: 6 PID: 0 Comm: swapper/6 Tainted: P W O 5.4.125-android11-2-g49d9c5d567e5-dirty #1
[ 513.263963@6] Hardware name: Khadas (DT)
[ 513.264461@6] Call trace:
[ 513.264814@6] [ffffff821eb33be0+ 64][<ffffffc0100c80c0>] dump_backtrace+0x0/0x1b0
[ 513.265757@6] [ffffff821eb33c20+ 32][<ffffffc0100c8294>] show_stack+0x24/0x34
[ 513.266672@6] [ffffff821eb33c40+ 64][<ffffffc010e38a28>] dump_stack+0xbc/0x108
[ 513.267592@6] [ffffff821eb33c80+ 48][<ffffffc010131a04>] ___might_sleep+0x100/0x110
[ 513.268563@6] [ffffff821eb33cb0+ 48][<ffffffc0101318c0>] __might_sleep+0x54/0x98
[ 513.269509@6] [ffffff821eb33ce0+ 32][<ffffffc010e56264>] mutex_lock+0x2c/0x68
[ 513.270420@6] [ffffff821eb33d00+ 112][<ffffffc010635fa0>] pinctrl_get_device_gpio_range+0x38/0xe8
[ 513.271533@6] [ffffff821eb33d70+ 48][<ffffffc0106364a0>] pinctrl_gpio_set_config+0x48/0xd4
[ 513.272583@6] [ffffff821eb33da0+ 48][<ffffffc01063e914>] gpiochip_generic_config+0x38/0x4c
[ 513.273634@6] [ffffff821eb33dd0+ 32][<ffffffc01063fa20>] gpiod_direction_output+0x90/0x1e0
[ 513.274686@6] [ffffff821eb33df0+ 32][<ffffffc010649030>] hrtimer_handler+0xd4/0x130
[ 513.275663@6] [ffffff821eb33e10+ 128][<ffffffc010192994>] __run_hrtimer+0x1b0/0x2ec
[ 513.276624@6] [ffffff821eb33e90+ 96][<ffffffc0101914e4>] hrtimer_interrupt+0x178/0x408
[ 513.277635@6] [ffffff821eb33ef0+ 48][<ffffffc010a40ce4>] arch_timer_handler_phys+0x44/0x58
[ 513.278683@6] [ffffff821eb33f20+ 80][<ffffffc01016f2c0>] handle_percpu_devid_irq+0x140/0x2e8
[ 513.279755@6] [ffffff821eb33f70+ 64][<ffffffc010166b28>] __handle_domain_irq+0x88/0xcc
[ 513.280762@6] [ffffff821eb33fb0+ 0][<ffffffc010081044>] gic_handle_irq+0x70/0xe8
[ 513.281714@6] [ffffffc020047eb0+ 16][<ffffffc01008305c>] el1_irq+0x15c/0x240
[ 513.282615@6] [ffffffc020047ec0+ 64][<ffffffc010a1158c>] cpuidle_enter_state+0x174/0x314
[ 513.283642@6] [ffffffc020047f00+ 64][<ffffffc010a117bc>] cpuidle_enter+0x3c/0x54
[ 513.284589@6] [ffffffc020047f40+ 96][<ffffffc010136ae8>] do_idle.llvm.129378936271790647+0x1d4/0x31c
[ 513.285746@6] [ffffffc020047fa0+ 32][<ffffffc010136c58>] cpu_startup_entry+0x28/0x2c
[ 513.286733@6] [ffffffc020047fc0+ 0][<ffffffc0100d1fc8>] __cpu_disable+0x0/0x104
Hello @shuaigezeng ,
试试使用gpiod_set_value_cansleep
看看。