Commit 0e25a5c9 authored by Rabin Vincent's avatar Rabin Vincent Committed by Linus Walleij

ARM: perf_event: allow platform-specific interrupt handler

Allow a platform-specific IRQ handler to be specified via platform data.
This will be used to implement the single-irq workaround for the DB8500.
Signed-off-by: default avatarRabin Vincent <rabin.vincent@stericsson.com>
Acked-by: default avatarLee Jones <lee.jones@linaro.org>
Acked-by: default avatarWill Deacon <will.deacon@arm.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 100b33c8
...@@ -12,11 +12,25 @@ ...@@ -12,11 +12,25 @@
#ifndef __ARM_PMU_H__ #ifndef __ARM_PMU_H__
#define __ARM_PMU_H__ #define __ARM_PMU_H__
#include <linux/interrupt.h>
enum arm_pmu_type { enum arm_pmu_type {
ARM_PMU_DEVICE_CPU = 0, ARM_PMU_DEVICE_CPU = 0,
ARM_NUM_PMU_DEVICES, ARM_NUM_PMU_DEVICES,
}; };
/*
* struct arm_pmu_platdata - ARM PMU platform data
*
* @handle_irq: an optional handler which will be called from the interrupt and
* passed the address of the low level handler, and can be used to implement
* any platform specific handling before or after calling it.
*/
struct arm_pmu_platdata {
irqreturn_t (*handle_irq)(int irq, void *dev,
irq_handler_t pmu_handler);
};
#ifdef CONFIG_CPU_HAS_PMU #ifdef CONFIG_CPU_HAS_PMU
/** /**
......
...@@ -377,9 +377,18 @@ validate_group(struct perf_event *event) ...@@ -377,9 +377,18 @@ validate_group(struct perf_event *event)
return 0; return 0;
} }
static irqreturn_t armpmu_platform_irq(int irq, void *dev)
{
struct arm_pmu_platdata *plat = dev_get_platdata(&pmu_device->dev);
return plat->handle_irq(irq, dev, armpmu->handle_irq);
}
static int static int
armpmu_reserve_hardware(void) armpmu_reserve_hardware(void)
{ {
struct arm_pmu_platdata *plat;
irq_handler_t handle_irq;
int i, err = -ENODEV, irq; int i, err = -ENODEV, irq;
pmu_device = reserve_pmu(ARM_PMU_DEVICE_CPU); pmu_device = reserve_pmu(ARM_PMU_DEVICE_CPU);
...@@ -390,6 +399,12 @@ armpmu_reserve_hardware(void) ...@@ -390,6 +399,12 @@ armpmu_reserve_hardware(void)
init_pmu(ARM_PMU_DEVICE_CPU); init_pmu(ARM_PMU_DEVICE_CPU);
plat = dev_get_platdata(&pmu_device->dev);
if (plat && plat->handle_irq)
handle_irq = armpmu_platform_irq;
else
handle_irq = armpmu->handle_irq;
if (pmu_device->num_resources < 1) { if (pmu_device->num_resources < 1) {
pr_err("no irqs for PMUs defined\n"); pr_err("no irqs for PMUs defined\n");
return -ENODEV; return -ENODEV;
...@@ -400,7 +415,7 @@ armpmu_reserve_hardware(void) ...@@ -400,7 +415,7 @@ armpmu_reserve_hardware(void)
if (irq < 0) if (irq < 0)
continue; continue;
err = request_irq(irq, armpmu->handle_irq, err = request_irq(irq, handle_irq,
IRQF_DISABLED | IRQF_NOBALANCING, IRQF_DISABLED | IRQF_NOBALANCING,
"armpmu", NULL); "armpmu", NULL);
if (err) { if (err) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment