From: 张晴 Date: Wed, 16 Apr 2014 06:02:06 +0000 (+0800) Subject: rk3288:pmic:rk808&ricoh619:support low level type irq and high level type irq X-Git-Tag: firefly_0821_release~5547 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=95ead8899f532b4ef0ab3f7ad7ae935677d4bd85;p=firefly-linux-kernel-4.4.55.git rk3288:pmic:rk808&ricoh619:support low level type irq and high level type irq --- diff --git a/drivers/mfd/ricoh619-irq.c b/drivers/mfd/ricoh619-irq.c index e35604e58043..dd7af659dff2 100755 --- a/drivers/mfd/ricoh619-irq.c +++ b/drivers/mfd/ricoh619-irq.c @@ -467,7 +467,7 @@ static struct irq_domain_ops ricoh619_irq_domain_ops = { int ricoh619_irq_init(struct ricoh619 *ricoh619, int irq, struct ricoh619_platform_data *pdata) { - int i, ret,val; + int i, ret,val,irq_type,flags; u8 reg_data = 0; struct irq_domain *domain; @@ -572,6 +572,14 @@ int ricoh619_irq_init(struct ricoh619 *ricoh619, int irq, } gpio_direction_input(pdata->irq_gpio); val = gpio_get_value(pdata->irq_gpio); + if (val){ + irq_type = IRQ_TYPE_LEVEL_LOW; + flags = IRQF_TRIGGER_LOW; + } + else{ + irq_type = IRQ_TYPE_LEVEL_HIGH; + flags = IRQF_TRIGGER_HIGH; + } gpio_free(pdata->irq_gpio); pr_info("%s: ricoh619_pmic_irq=%x\n", __func__, val); } @@ -584,10 +592,10 @@ int ricoh619_irq_init(struct ricoh619 *ricoh619, int irq, return -ENODEV; } ricoh619->irq_domain = domain; - ret = devm_request_threaded_irq(ricoh619->dev,ricoh619->chip_irq, NULL, ricoh619_irq, IRQF_TRIGGER_FALLING |IRQF_ONESHOT, "ricoh619", ricoh619); + ret = devm_request_threaded_irq(ricoh619->dev,ricoh619->chip_irq, NULL, ricoh619_irq, flags |IRQF_ONESHOT, "ricoh619", ricoh619); // ret = devm_request_threaded_irq(ricoh619->dev,ricoh619->chip_irq, NULL, ricoh619_irq, IRQF_TRIGGER_FALLING | IRQF_ONESHOT , "ricoh619", ricoh619); - irq_set_irq_type(ricoh619->chip_irq, IRQ_TYPE_LEVEL_LOW); + irq_set_irq_type(ricoh619->chip_irq, irq_type); enable_irq_wake(ricoh619->chip_irq); return ret; } diff --git a/drivers/mfd/rk808-irq.c b/drivers/mfd/rk808-irq.c index cfaf297b15ae..1b3d5338e566 100755 --- a/drivers/mfd/rk808-irq.c +++ b/drivers/mfd/rk808-irq.c @@ -169,7 +169,7 @@ static struct irq_domain_ops rk808_irq_domain_ops = { int rk808_irq_init(struct rk808 *rk808, int irq,struct rk808_board *pdata) { struct irq_domain *domain; - int ret,val; + int ret,val,irq_type,flags; u8 reg; // printk("%s,line=%d\n", __func__,__LINE__); @@ -205,6 +205,14 @@ int rk808_irq_init(struct rk808 *rk808, int irq,struct rk808_board *pdata) } gpio_direction_input(rk808->irq_gpio); val = gpio_get_value(rk808->irq_gpio); + if (val){ + irq_type = IRQ_TYPE_LEVEL_LOW; + flags = IRQF_TRIGGER_FALLING; + } + else{ + irq_type = IRQ_TYPE_LEVEL_HIGH; + flags = IRQF_TRIGGER_RISING; + } gpio_free(rk808->irq_gpio); pr_info("%s: rk808_pmic_irq=%x\n", __func__, val); } @@ -218,9 +226,9 @@ int rk808_irq_init(struct rk808 *rk808, int irq,struct rk808_board *pdata) } rk808->irq_domain = domain; - ret = request_threaded_irq(rk808->chip_irq, NULL, rk808_irq, IRQF_TRIGGER_FALLING | IRQF_ONESHOT, "rk808", rk808); + ret = request_threaded_irq(rk808->chip_irq, NULL, rk808_irq, flags | IRQF_ONESHOT, "rk808", rk808); - irq_set_irq_type(rk808->chip_irq, IRQ_TYPE_LEVEL_LOW); + irq_set_irq_type(rk808->chip_irq, irq_type); enable_irq_wake(rk808->chip_irq); if (ret != 0)