嵌入式爱好者

查看: 12960|回复: 9

OK6410 想释放GPIO-KEYS 占有的中断号

[复制链接]

10

主题

38

帖子

44

积分

扫一扫,手机访问本帖
发表于 2011-8-7 16:13:45 | 显示全部楼层 |阅读模式
Linux 2.6.36.2
Ubuntu 10.04
我想编写GPIO-KEYS的中断驱动程序,由于板子上的系统已经使用了相关中断号
所以只有释放周才能使用
使用 free_irq(IRQ_EINT(0),NULL) 来释放中断
但是cat /proc/kmsg 有如下提示
  1. <4>------------[ cut here ]------------
  2. <4>WARNING: at kernel/irq/manage.c:899 __free_irq+0x9c/0x1ac()
  3. <4>[b]Trying to free already-free IRQ 101[/b]
  4. <4>Modules linked in: button2(+) [last unloaded: button2]
  5. <4>[<c0037a8c>] (unwind_backtrace+0x0/0xfc) from [<c04ac5f8>] (dump_stack+0x18/0x1c)
  6. <4>[<c04ac5f8>] (dump_stack+0x18/0x1c) from [<c004c54c>] (warn_slowpath_common+0x54/0x6c)
  7. <4>[<c004c54c>] (warn_slowpath_common+0x54/0x6c) from [<c004c608>] (warn_slowpath_fmt+0x38/0x40)
  8. <4>[<c004c608>] (warn_slowpath_fmt+0x38/0x40) from [<c0082dbc>] (__free_irq+0x9c/0x1ac)
  9. <4>[<c0082dbc>] (__free_irq+0x9c/0x1ac) from [<c0082f10>] (free_irq+0x44/0x64)
  10. <4>[<c0082f10>] (free_irq+0x44/0x64) from [<bf006054>] (button2_init+0x34/0x58 [button2])
  11. <4>[<bf006054>] (button2_init+0x34/0x58 [button2]) from [<c0031378>] (do_one_initcall+0x38/0x1ac)
  12. <4>[<c0031378>] (do_one_initcall+0x38/0x1ac) from [<c007e894>] (sys_init_module+0xb8/0x1cc)
  13. <4>[<c007e894>] (sys_init_module+0xb8/0x1cc) from [<c0031a20>] (ret_fast_syscall+0x0/0x30)
  14. <4>---[ end trace 69130b5f71451ee3 ]---
  15. <4>------------[ cut here ]------------
  16. <4>WARNING: at kernel/irq/manage.c:899 __free_irq+0x9c/0x1ac()
  17. <4>[b]Trying to free already-free IRQ 102[/b]
  18. <4>Modules linked in: button2(+) [last unloaded: button2]
  19. <4>[<c0037a8c>] (unwind_backtrace+0x0/0xfc) from [<c04ac5f8>] (dump_stack+0x18/0x1c)
  20. <4>[<c04ac5f8>] (dump_stack+0x18/0x1c) from [<c004c54c>] (warn_slowpath_common+0x54/0x6c)
  21. <4>[<c004c54c>] (warn_slowpath_common+0x54/0x6c) from [<c004c608>] (warn_slowpath_fmt+0x38/0x40)
  22. <4>[<c004c608>] (warn_slowpath_fmt+0x38/0x40) from [<c0082dbc>] (__free_irq+0x9c/0x1ac)
  23. <4>[<c0082dbc>] (__free_irq+0x9c/0x1ac) from [<c0082f10>] (free_irq+0x44/0x64)
  24. <4>[<c0082f10>] (free_irq+0x44/0x64) from [<bf006054>] (button2_init+0x34/0x58 [button2])
  25. <4>[<bf006054>] (button2_init+0x34/0x58 [button2]) from [<c0031378>] (do_one_initcall+0x38/0x1ac)
  26. <4>[<c0031378>] (do_one_initcall+0x38/0x1ac) from [<c007e894>] (sys_init_module+0xb8/0x1cc)
  27. <4>[<c007e894>] (sys_init_module+0xb8/0x1cc) from [<c0031a20>] (ret_fast_syscall+0x0/0x30)
  28. <4>---[ end trace 69130b5f71451ee4 ]---
  29. <4>------------[ cut here ]------------
  30. <4>WARNING: at kernel/irq/manage.c:899 __free_irq+0x9c/0x1ac()
  31. <4>[b]Trying to free already-free IRQ 103[/b]
  32. <4>Modules linked in: button2(+) [last unloaded: button2]
  33. <4>[<c0037a8c>] (unwind_backtrace+0x0/0xfc) from [<c04ac5f8>] (dump_stack+0x18/0x1c)
  34. <4>[<c04ac5f8>] (dump_stack+0x18/0x1c) from [<c004c54c>] (warn_slowpath_common+0x54/0x6c)
  35. <4>[<c004c54c>] (warn_slowpath_common+0x54/0x6c) from [<c004c608>] (warn_slowpath_fmt+0x38/0x40)
  36. <4>[<c004c608>] (warn_slowpath_fmt+0x38/0x40) from [<c0082dbc>] (__free_irq+0x9c/0x1ac)
  37. <4>[<c0082dbc>] (__free_irq+0x9c/0x1ac) from [<c0082f10>] (free_irq+0x44/0x64)
  38. <4>[<c0082f10>] (free_irq+0x44/0x64) from [<bf006054>] (button2_init+0x34/0x58 [button2])
  39. <4>[<bf006054>] (button2_init+0x34/0x58 [button2]) from [<c0031378>] (do_one_initcall+0x38/0x1ac)
  40. <4>[<c0031378>] (do_one_initcall+0x38/0x1ac) from [<c007e894>] (sys_init_module+0xb8/0x1cc)
  41. <4>[<c007e894>] (sys_init_module+0xb8/0x1cc) from [<c0031a20>] (ret_fast_syscall+0x0/0x30)
  42. <4>---[ end trace 69130b5f71451ee5 ]---
  43. <4>------------[ cut here ]------------
  44. <4>WARNING: at kernel/irq/manage.c:899 __free_irq+0x9c/0x1ac()
  45. <4>[b]Trying to free already-free IRQ 104[/b]
  46. <4>Modules linked in: button2(+) [last unloaded: button2]
  47. <4>[<c0037a8c>] (unwind_backtrace+0x0/0xfc) from [<c04ac5f8>] (dump_stack+0x18/0x1c)
  48. <4>[<c04ac5f8>] (dump_stack+0x18/0x1c) from [<c004c54c>] (warn_slowpath_common+0x54/0x6c)
  49. <4>[<c004c54c>] (warn_slowpath_common+0x54/0x6c) from [<c004c608>] (warn_slowpath_fmt+0x38/0x40)
  50. <4>[<c004c608>] (warn_slowpath_fmt+0x38/0x40) from [<c0082dbc>] (__free_irq+0x9c/0x1ac)
  51. <4>[<c0082dbc>] (__free_irq+0x9c/0x1ac) from [<c0082f10>] (free_irq+0x44/0x64)
  52. <4>[<c0082f10>] (free_irq+0x44/0x64) from [<bf006054>] (button2_init+0x34/0x58 [button2])
  53. <4>[<bf006054>] (button2_init+0x34/0x58 [button2]) from [<c0031378>] (do_one_initcall+0x38/0x1ac)
  54. <4>[<c0031378>] (do_one_initcall+0x38/0x1ac) from [<c007e894>] (sys_init_module+0xb8/0x1cc)
  55. <4>[<c007e894>] (sys_init_module+0xb8/0x1cc) from [<c0031a20>] (ret_fast_syscall+0x0/0x30)
  56. <4>---[ end trace 69130b5f71451ee6 ]---
  57. <4>------------[ cut here ]------------
  58. <4>WARNING: at kernel/irq/manage.c:899 __free_irq+0x9c/0x1ac()
  59. <4>[b]Trying to free already-free IRQ 105[/b]
  60. <4>Modules linked in: button2(+) [last unloaded: button2]
  61. <4>[<c0037a8c>] (unwind_backtrace+0x0/0xfc) from [<c04ac5f8>] (dump_stack+0x18/0x1c)
  62. <4>[<c04ac5f8>] (dump_stack+0x18/0x1c) from [<c004c54c>] (warn_slowpath_common+0x54/0x6c)
  63. <4>[<c004c54c>] (warn_slowpath_common+0x54/0x6c) from [<c004c608>] (warn_slowpath_fmt+0x38/0x40)
  64. <4>[<c004c608>] (warn_slowpath_fmt+0x38/0x40) from [<c0082dbc>] (__free_irq+0x9c/0x1ac)
  65. <4>[<c0082dbc>] (__free_irq+0x9c/0x1ac) from [<c0082f10>] (free_irq+0x44/0x64)
  66. <4>[<c0082f10>] (free_irq+0x44/0x64) from [<bf006054>] (button2_init+0x34/0x58 [button2])
  67. <4>[<bf006054>] (button2_init+0x34/0x58 [button2]) from [<c0031378>] (do_one_initcall+0x38/0x1ac)
  68. <4>[<c0031378>] (do_one_initcall+0x38/0x1ac) from [<c007e894>] (sys_init_module+0xb8/0x1cc)
  69. <4>[<c007e894>] (sys_init_module+0xb8/0x1cc) from [<c0031a20>] (ret_fast_syscall+0x0/0x30)
  70. <4>---[ end trace 69130b5f71451ee7 ]---
  71. <4>------------[ cut here ]------------
  72. <4>WARNING: at kernel/irq/manage.c:899 __free_irq+0x9c/0x1ac()
  73. <4>[b]Trying to free already-free IRQ 106[/b]
  74. <4>Modules linked in: button2(+) [last unloaded: button2]
  75. <4>[<c0037a8c>] (unwind_backtrace+0x0/0xfc) from [<c04ac5f8>] (dump_stack+0x18/0x1c)
  76. <4>[<c04ac5f8>] (dump_stack+0x18/0x1c) from [<c004c54c>] (warn_slowpath_common+0x54/0x6c)
  77. <4>[<c004c54c>] (warn_slowpath_common+0x54/0x6c) from [<c004c608>] (warn_slowpath_fmt+0x38/0x40)
  78. <4>[<c004c608>] (warn_slowpath_fmt+0x38/0x40) from [<c0082dbc>] (__free_irq+0x9c/0x1ac)
  79. <4>[<c0082dbc>] (__free_irq+0x9c/0x1ac) from [<c0082f10>] (free_irq+0x44/0x64)
  80. <4>[<c0082f10>] (free_irq+0x44/0x64) from [<bf006054>] (button2_init+0x34/0x58 [button2])
  81. <4>[<bf006054>] (button2_init+0x34/0x58 [button2]) from [<c0031378>] (do_one_initcall+0x38/0x1ac)
  82. <4>[<c0031378>] (do_one_initcall+0x38/0x1ac) from [<c007e894>] (sys_init_module+0xb8/0x1cc)
  83. <4>[<c007e894>] (sys_init_module+0xb8/0x1cc) from [<c0031a20>] (ret_fast_syscall+0x0/0x30)
  84. <4>---[ end trace 69130b5f71451ee8 ]---
复制代码
查看 cat/proc/interrupts 原来的中断BUTTON依旧在,请教解决方法,或者求教系统自带的GPIO-KEYS的驱动的调用方法
顺便告诉一下 GPIO-KEYS驱动的示例程序和驱动程序的位置,懒得找的话说个文件名也行....
回复

使用道具 举报

xiaoling 该用户已被删除
发表于 2011-8-7 21:00:03 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

1

主题

5

帖子

14

积分

i.MX6Q通行证

发表于 2012-6-27 16:11:58 | 显示全部楼层
我也是这个问题啊。。。在考虑用disable_irq和enable_irq来解决,不知道可不可以
回复 支持 反对

使用道具 举报

1

主题

5

帖子

14

积分

i.MX6Q通行证

发表于 2012-6-27 21:55:19 | 显示全部楼层
这个问题有人能回答吗?飞凌的工作人员呢
回复 支持 反对

使用道具 举报

1

主题

5

帖子

14

积分

i.MX6Q通行证

发表于 2012-6-28 01:31:54 | 显示全部楼层
经过不懈的努力,总算是被我找出解决方法了,这里无法注册中断的原因,当然是中断线已被占用,而去查看free_irq的代码(在kernel/irq/manage.c中),可以发现,出现这个Trying to free already-free IRQ 101 告警的原因是  存在该中断号对应的中断描述符desc ,而相印的中断服务程序却不存在。  说明有驱动程序占用了该中断号。 因而,我们要去掉这个驱动程序,方法:make menuconfig->Device Drivers->input device support->Key Boards->GPIO Buttons 去掉前面的*,即不选该项即可。
重新编译内核,ok
回复 支持 反对

使用道具 举报

0

主题

1836

帖子

1028

积分

发表于 2012-6-28 08:42:47 | 显示全部楼层
楼上朋友的方法是配置Linux内核时去掉中断,也可以采用中断共享的方式来使用相同的中断源。
回复 支持 反对

使用道具 举报

0

主题

1836

帖子

1028

积分

发表于 2012-6-28 08:47:24 | 显示全部楼层
楼上朋友的方法是配置Linux内核时去掉设备占用的中断,也可以采用中断共享的方式来使用相同的中断源,比如ADC驱动和触摸屏驱动都使用了相同的ADC中断号,楼主可以参考一下这两个设备的驱动程序。
回复 支持 反对

使用道具 举报

1

主题

5

帖子

14

积分

i.MX6Q通行证

发表于 2012-6-28 16:10:38 | 显示全部楼层
回复 7# 飞凌-develop


    我试过共享的方式,没有成功,一直返回-EBUSY,不知道应该是怎么样一个形式来注册中断号,我采用的是request_irq,然后flags是IRQF_SHARED,第五个参数也设置了,教我一下
回复 支持 反对

使用道具 举报

caoshunxin 该用户已被删除
发表于 2012-8-22 15:18:23 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

Hang_hang 该用户已被删除
发表于 2012-11-19 14:22:48 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋| 飞凌嵌入式 ( 冀ICP备12004394号-1 )

GMT+8, 2024-12-27 16:04

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表