Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 18edbc60 authored by Gaurav Singhal's avatar Gaurav Singhal
Browse files

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: default avatarGaurav Singhal <gsinghal@codeaurora.org>
parent 72be67e7
Loading
Loading
Loading
Loading
+22 −1
Original line number Diff line number Diff line
/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2015-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;
@@ -465,6 +485,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);