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

Commit e96f27c2 authored by Yimin Peng's avatar Yimin Peng Committed by Subbaraman Narayanamurthy
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>
parent 63605309
Loading
Loading
Loading
Loading
+13 −6
Original line number Diff line number Diff line
@@ -686,18 +686,25 @@ static int qpnpint_irq_set_type(struct irq_data *d, unsigned int flow_type)
		type.type |= bit_mask_irq;
		if (flow_type & IRQF_TRIGGER_RISING)
			type.polarity_high |=  bit_mask_irq;
		else
			type.polarity_high &= ~bit_mask_irq;
		if (flow_type & IRQF_TRIGGER_FALLING)
			type.polarity_low  |=  bit_mask_irq;
		else
			type.polarity_low  &= ~bit_mask_irq;
	} else {
		if ((flow_type & (IRQF_TRIGGER_HIGH)) &&
		    (flow_type & (IRQF_TRIGGER_LOW)))
			return -EINVAL;

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

	qpnpint_spmi_write(d, QPNPINT_REG_SET_TYPE, &type, sizeof(type));