Skip to content

Commit c73a685

Browse files
stephan-ghandersson
authored andcommitted
soc: qcom: smsm: Implement support for get_irqchip_state
At the moment there is no way for drivers to get the current state of the interrupt signal reported by a remote processor. The irqchip API has generic functionality for this, using irq_get_irqchip_state(). Implement support for getting the IRQCHIP_STATE_LINE_LEVEL by reading the remote state and checking the bit for the specified IRQ. Signed-off-by: Stephan Gerhold <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bjorn Andersson <[email protected]>
1 parent ad68c62 commit c73a685

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

drivers/soc/qcom/smsm.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,11 +299,28 @@ static int smsm_set_irq_type(struct irq_data *irqd, unsigned int type)
299299
return 0;
300300
}
301301

302+
static int smsm_get_irqchip_state(struct irq_data *irqd,
303+
enum irqchip_irq_state which, bool *state)
304+
{
305+
struct smsm_entry *entry = irq_data_get_irq_chip_data(irqd);
306+
irq_hw_number_t irq = irqd_to_hwirq(irqd);
307+
u32 val;
308+
309+
if (which != IRQCHIP_STATE_LINE_LEVEL)
310+
return -EINVAL;
311+
312+
val = readl(entry->remote_state);
313+
*state = !!(val & BIT(irq));
314+
315+
return 0;
316+
}
317+
302318
static struct irq_chip smsm_irq_chip = {
303319
.name = "smsm",
304320
.irq_mask = smsm_mask_irq,
305321
.irq_unmask = smsm_unmask_irq,
306322
.irq_set_type = smsm_set_irq_type,
323+
.irq_get_irqchip_state = smsm_get_irqchip_state,
307324
};
308325

309326
/**

0 commit comments

Comments
 (0)