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

Commit 91d5cde7 authored by Yeleswarapu Nagaradhesh's avatar Yeleswarapu Nagaradhesh
Browse files

ASoC: wcd: add IRQF_NO_SUSPEND flag



If headset is inserted during suspend process,
pm will try to dispatch all the pending interrupts
before going to complete suspend. IRQ driver
waits for resume to get called which can lead to
a deadlock. So while registering for insertion/removal
interrupts add IRQF_NO_SUSPEND flag to avoid race condition
which can lead to deadlock.

CRs-Fixed: 787873
Change-Id: I140652b9200a29da2d35260f186806f1b65e0f36
Signed-off-by: default avatarYeleswarapu Nagaradhesh <nagaradh@codeaurora.org>
parent 975e2eb5
Loading
Loading
Loading
Loading
+14 −4
Original line number Diff line number Diff line
/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
/* Copyright (c) 2014-2015, 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
@@ -30,7 +30,7 @@

#define MAX_NUM_IRQS 14
#define NUM_IRQ_REGS 2
#define WCD9XXX_SYSTEM_RESUME_TIMEOUT_MS 300
#define WCD9XXX_SYSTEM_RESUME_TIMEOUT_MS 700

#define BYTE_BIT_MASK(nr) (1UL << ((nr) % BITS_PER_BYTE))
#define BIT_BYTE(nr) ((nr) / BITS_PER_BYTE)
@@ -158,14 +158,24 @@ int wcd9xxx_spmi_request_irq(int irq, irq_handler_t handler,
			const char *name, void *priv)
{
	int rc;
	unsigned long irq_flags;

	map.linuxirq[irq] =
		spmi_get_irq_byname(map.spmi[BIT_BYTE(irq)], NULL,
				    irq_names[irq]);

	if (strcmp(name, "mbhc sw intr"))
		irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING |
			IRQF_ONESHOT;
	else
		irq_flags = IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING |
			IRQF_ONESHOT | IRQF_NO_SUSPEND;
	pr_debug("%s: name:%s irq_flags = %lx\n", __func__, name, irq_flags);

	rc = devm_request_threaded_irq(&map.spmi[BIT_BYTE(irq)]->dev,
				map.linuxirq[irq], NULL,
				wcd9xxx_spmi_irq_handler,
				IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING
				| IRQF_ONESHOT,
				irq_flags,
				name, priv);
		if (rc < 0) {
			dev_err(&map.spmi[BIT_BYTE(irq)]->dev,