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

Commit 350c73ee authored by Yimin Peng's avatar Yimin Peng Committed by David Collins
Browse files

spmi: pmic-arb: support updating interrupt type flags



Have the qpnpint_irq_set_type function clear unwanted high/low
trigger bits when updating the interrupt flags.

Change-Id: Ie55d6178ea94350ecf8c79714cb863ea63d76ea6
Signed-off-by: default avatarYimin Peng <yiminp@codeaurora.org>
Signed-off-by: default avatarSubbaraman Narayanamurthy <subbaram@codeaurora.org>
parent 268cfeff
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -636,8 +636,12 @@ static int qpnpint_irq_set_type(struct irq_data *d, unsigned int flow_type)
		type.type |= BIT(irq);
		if (flow_type & IRQF_TRIGGER_RISING)
			type.polarity_high |= BIT(irq);
		else
			type.polarity_high &= ~BIT(irq);
		if (flow_type & IRQF_TRIGGER_FALLING)
			type.polarity_low  |= BIT(irq);
		else
			type.polarity_low  &= ~BIT(irq);

		flow_handler = handle_edge_irq;
	} else {
@@ -646,10 +650,13 @@ static int qpnpint_irq_set_type(struct irq_data *d, unsigned int flow_type)
			return -EINVAL;

		type.type &= ~BIT(irq); /* level trig */
		if (flow_type & IRQF_TRIGGER_HIGH)
		if (flow_type & IRQF_TRIGGER_HIGH) {
			type.polarity_high |= BIT(irq);
		else
			type.polarity_low  &= ~BIT(irq);
		} else {
			type.polarity_low  |= BIT(irq);
			type.polarity_high &= ~BIT(irq);
		}

		flow_handler = handle_level_irq;
	}