在系統中增加一個可喚醒中斷--同時說明platform_device &platform_driver
阿新 • • 發佈:2019-01-04
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 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;
- }
- staticint mu609_remove(struct platform_device *pdev)
- {
- return 0;
- }
- staticstruct platform_driver mu609_driver = {
- .probe = mu609_probe,
- .remove = mu609_remove,
- .driver = {
- .name = "mu609_3g",
- .owner = THIS_MODULE,
- },
- };
- staticstruct platform_device mu609_device = {
- .name = "mu609_3g",
- .id = -1,
- };
- staticint __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.