在系统中增加一个可唤醒中断--简单实例
2013-07-09 17:51
295 查看
在系统休眠的时候3G来电或者短信需要唤醒系统,使系统resume。从3G模块手册看到有WAKE#脚,当收到来电或者SMS时这个脚会有0.5S的拉低,就是cp_wakeup_ap,用这个脚做唤醒脚。查看AP的datasheet,挑选一个带有EINT功能的GPIO脚做接收此中断的脚,这里选GPX3(1)。开始写驱动来处理这个事件。
kernel\arch\arm\mach-exynos\setup-mu609.c
kernel\arch\arm\mach-exynos\Makefile
kernel\arch\arm\mach-exynos\Kconfig
cat /proc/interrupt可以查看中断有没有开始工作
kernel\arch\arm\mach-exynos\setup-mu609.c
#include <linux/kernel.h> #include <linux/init.h> #include <linux/platform_device.h> #include <linux/delay.h> #include <linux/err.h> #include <linux/skbuff.h> #include <plat/devs.h> #include <plat/sdhci.h> #include <plat/gpio-cfg.h> #include <mach/regs-gpio.h> #include <mach/gpio.h> #include <linux/irq.h> #include <linux/interrupt.h> #include <linux/module.h> static irqreturn_t host_wake_isr(int irq, void *dev) { /* do something when interrupt happen */ return IRQ_HANDLED; } static int mu609_probe(struct platform_device *pdev) { int irq; int ret; printk("%s: start\n", __FUNCTION__); s3c_gpio_cfgpin(EXYNOS5410_GPX3(1), S3C_GPIO_INPUT); //stone++ for mu609 s3c_gpio_setpull(EXYNOS5410_GPX3(1), S3C_GPIO_PULL_UP); //stone++ for mu609 irq = IRQ_EINT(25); ret = request_irq(irq, host_wake_isr, IRQF_TRIGGER_FALLING, "3g mu609_wake", NULL); if (ret) { pr_err("[3G] Request_host wake irq failed.\n"); return ret; } ret = irq_set_irq_wake(irq, 1); if (ret) { pr_err("[3G] Set_irq_wake failed.\n"); return ret; } return ret; } static int mu609_remove(struct platform_device *pdev) { return 0; } static struct platform_driver mu609_driver = { .probe = mu609_probe, .remove = mu609_remove, .driver = { .name = "mu609_3g", .owner = THIS_MODULE, }, }; static struct platform_device mu609_device = { .name = "mu609_3g", .id = -1, }; static int __init mu609_init(void) { int ret; ret = platform_driver_register(&mu609_driver); if(!ret){ ret = platform_device_register(&mu609_device); if (ret) platform_driver_unregister(&mu609_driver); } return ret; } late_initcall(mu609_init);
kernel\arch\arm\mach-exynos\Makefile
obj-$(CONFIG_EXYNOS_DEV_MU609) += setup-mu609.o
kernel\arch\arm\mach-exynos\Kconfig
config EXYNOS_DEV_MU609 bool "3G module MU609" default y help HuaWei mu609.
cat /proc/interrupt可以查看中断有没有开始工作
相关文章推荐
- 在系统中增加一个可唤醒中断--简单实例
- 在系统中增加一个可唤醒中断--同时说明platform_device &platform_driver
- 温故而知新---浅析三层架构(一个超简单的系统登录三层架构实例)
- EasyUI - 一个简单的后台管理系统入门实例
- PureMVC和Unity3D的UGUI制作一个简单的员工管理系统实例
- 程序员简单打造一个灵活智能的自动化运维系统C#实例程序
- 使用MongoDB和JSP实现一个简单的购物车系统实例
- 一个简单http集群keepalived实例配置,系统参数优化及解释
- 使用MongoDB和JSP实现一个简单的购物车系统实例
- imx6系列--将一个gpio设置为可唤醒系统的外部中断流程
- 基于Qt5.9Creator的一个简单socket通信实例(C++语言,win7 64系统)
- imx6系列--将一个gpio设置为可唤醒系统的外部中断流程
- 使用Node.js实现一个简单的FastCGI服务器实例
- 给人也装一个中断系统
- 使用Node.js实现一个简单的FastCGI服务器实例
- 一个Struts2的简单的使用实例
- AWVS漏洞测试-02节-添加一个简单的新闻系统
- 用 Matlab GUI搭建一个简单的CBIR图像检索系统(一)
- 一个简单涂鸦板的Android开发实例
- 过滤器、监听器、拦截器的区别和一个简单的实例