NFC: Fix interrupt state in recovery

If read function is waiting for interrupt and after that
NFCC goes to recovery, MW will call ioctl (0) and ioctl (1),
In ioctl (0) call we are disabling interrupt so read function
was waiting for interrupt and ioctl call has disabled interrupt,
now there is no possibility interrupt will be enabled again
because only read function enables the interrupt.

Enabled interrupt in ioctl (1) so that we can receive data
after reset/recovery.

Change-Id: I1677a50129534b1eaa4b8c20820a15db299cd9c1
Signed-off-by: Gaurav Singhal <gsinghal@codeaurora.org>
This commit is contained in:
Gaurav Singhal 2017-01-05 17:49:59 +05:30
parent 0a8e939a4e
commit 94594358b9

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@ -111,6 +111,26 @@ static void nqx_disable_irq(struct nqx_dev *nqx_dev)
spin_unlock_irqrestore(&nqx_dev->irq_enabled_lock, flags);
}
/**
* nqx_enable_irq()
*
* Check if interrupt is enabled or not
* and enable interrupt
*
* Return: void
*/
static void nqx_enable_irq(struct nqx_dev *nqx_dev)
{
unsigned long flags;
spin_lock_irqsave(&nqx_dev->irq_enabled_lock, flags);
if (!nqx_dev->irq_enabled) {
nqx_dev->irq_enabled = true;
enable_irq(nqx_dev->client->irq);
}
spin_unlock_irqrestore(&nqx_dev->irq_enabled_lock, flags);
}
static irqreturn_t nqx_dev_irq_handler(int irq, void *dev_id)
{
struct nqx_dev *nqx_dev = dev_id;
@ -467,6 +487,7 @@ int nfc_ioctl_power_states(struct file *filp, unsigned long arg)
/* hardware dependent delay */
msleep(100);
} else if (arg == 1) {
nqx_enable_irq(nqx_dev);
dev_dbg(&nqx_dev->client->dev,
"gpio_set_value enable: %s: info: %p\n",
__func__, nqx_dev);