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

Commit 90551fd1 authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "drivers: irqchip: mpm: Add support to set irq type"

parents 67ddc9c3 dd72a35f
Loading
Loading
Loading
Loading
+30 −15
Original line number Diff line number Diff line
@@ -162,13 +162,26 @@ static inline void msm_mpm_enable_irq(struct irq_data *d, bool on)
	}
}

static inline void msm_mpm_set_type(struct irq_data *d,
static void msm_mpm_program_set_type(bool set, unsigned int reg,
					unsigned int index, unsigned int mask)
{
	u32 type;

	type = msm_mpm_read(reg, index);
	if (set)
		type = ENABLE_TYPE(type, mask);
	else
		type = CLEAR_TYPE(type, mask);

	msm_mpm_write(reg, index, type);
}

static void msm_mpm_set_type(struct irq_data *d,
					unsigned int flowtype)
{
	int mpm_pin[MAX_MPM_PIN_PER_IRQ] = {-1, -1};
	unsigned long flags;
	int i = 0;
	u32 type;
	unsigned int index, mask;
	unsigned int reg = 0;

@@ -180,24 +193,24 @@ static inline void msm_mpm_set_type(struct irq_data *d,
		index = mpm_pin[i]/32;
		mask = mpm_pin[i]%32;

		if (flowtype & IRQ_TYPE_LEVEL_HIGH)
			reg = MPM_REG_FALLING_EDGE;

		if (flowtype & IRQ_TYPE_EDGE_RISING)
		spin_lock_irqsave(&mpm_lock, flags);
		reg = MPM_REG_RISING_EDGE;
		if (flowtype & IRQ_TYPE_EDGE_RISING)
			msm_mpm_program_set_type(1, reg, index, mask);
		else
			msm_mpm_program_set_type(0, reg, index, mask);

		reg = MPM_REG_FALLING_EDGE;
		if (flowtype & IRQ_TYPE_EDGE_FALLING)
			reg = MPM_REG_POLARITY;

		spin_lock_irqsave(&mpm_lock, flags);
		type = msm_mpm_read(reg, index);

		if (flowtype)
			type = ENABLE_TYPE(type, mask);
			msm_mpm_program_set_type(1, reg, index, mask);
		else
			type = CLEAR_TYPE(type, mask);
			msm_mpm_program_set_type(0, reg, index, mask);

		msm_mpm_write(reg, index, type);
		reg = MPM_REG_POLARITY;
		if (flowtype & IRQ_TYPE_LEVEL_HIGH)
			msm_mpm_program_set_type(1, reg, index, mask);
		else
			msm_mpm_program_set_type(0, reg, index, mask);
		spin_unlock_irqrestore(&mpm_lock, flags);
	}
}
@@ -453,6 +466,8 @@ static int system_pm_update_wakeup(bool from_idle)
	}

	msm_mpm_timer_write((uint32_t *)&wakeup);
	trace_mpm_wakeup_time(from_idle, wakeup, arch_counter_get_cntvct());

	return 0;
}

+22 −0
Original line number Diff line number Diff line
@@ -57,6 +57,28 @@ TRACE_EVENT(mpm_wakeup_pending_irqs,
	TP_printk("index:%u wakeup_irqs:0x%x", __entry->index, __entry->irqs)
);

TRACE_EVENT(mpm_wakeup_time,

	TP_PROTO(bool from_idle, u64 wakeup, u64 current_ticks),

	TP_ARGS(from_idle, wakeup, current_ticks),

	TP_STRUCT__entry(
		__field(bool, from_idle)
		__field(u64, wakeup)
		__field(u64, current_ticks)
	),

	TP_fast_assign(
		__entry->from_idle = from_idle;
		__entry->wakeup = wakeup;
		__entry->current_ticks = current_ticks;
	),

	TP_printk("idle:%d wakeup:0x%llx current:0x%llx", __entry->from_idle,
				__entry->wakeup, __entry->current_ticks)
);

#endif
#define TRACE_INCLUDE_FILE mpm
#include <trace/define_trace.h>