Merge "drivers: coresight: Add interrupt service routine for apss tgu"
This commit is contained in:
commit
7e4d83fc02
@ -25,5 +25,5 @@ obj-$(CONFIG_CORESIGHT_HWEVENT) += coresight-hwevent.o
|
||||
obj-$(CONFIG_CORESIGHT_DUMMY) += coresight-dummy.o
|
||||
obj-$(CONFIG_CORESIGHT_REMOTE_ETM) += coresight-remote-etm.o
|
||||
obj-$(CONFIG_CORESIGHT_CSR) += coresight-csr.o
|
||||
obj-$(CONFIG_CORESIGHT_TGU) += coresight-tgu.o
|
||||
obj-$(CONFIG_CORESIGHT_TGU) += coresight-tgu.o apss_tgu.o
|
||||
obj-$(CONFIG_CORESIGHT_OST) += coresight-ost.o
|
||||
|
77
drivers/hwtracing/coresight/apss_tgu.c
Normal file
77
drivers/hwtracing/coresight/apss_tgu.c
Normal file
@ -0,0 +1,77 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/irq.h>
|
||||
#include <linux/of_irq.h>
|
||||
#include <soc/qcom/tgu.h>
|
||||
#define CREATE_TRACE_POINTS
|
||||
#include "trace/events/tgu.h"
|
||||
#include "apss_tgu.h"
|
||||
|
||||
static struct tgu_test_notifier tgu_notify;
|
||||
int register_tgu_notifier(struct tgu_test_notifier *tgu_test)
|
||||
{
|
||||
tgu_notify.cb = tgu_test->cb;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(register_tgu_notifier);
|
||||
|
||||
int unregister_tgu_notifier(struct tgu_test_notifier *tgu_test)
|
||||
{
|
||||
if (tgu_test->cb == tgu_notify.cb)
|
||||
tgu_notify.cb = NULL;
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(unregister_tgu_notifier);
|
||||
|
||||
static irqreturn_t tgu_irq_thread_handler(int irq, void *dev_id)
|
||||
{
|
||||
if (tgu_notify.cb)
|
||||
tgu_notify.cb();
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static irqreturn_t tgu_irq_handler(int irq, void *data)
|
||||
{
|
||||
trace_tgu_interrupt(irq);
|
||||
return IRQ_WAKE_THREAD;
|
||||
}
|
||||
|
||||
int register_interrupt_handler(struct device_node *node)
|
||||
{
|
||||
int irq, ret, i, n;
|
||||
|
||||
n = of_irq_count(node);
|
||||
pr_debug("number of irqs == %d\n", n);
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
irq = of_irq_get(node, i);
|
||||
if (irq < 0) {
|
||||
pr_err("Invalid IRQ for error fatal %u\n", irq);
|
||||
return irq;
|
||||
}
|
||||
|
||||
ret = request_threaded_irq(irq, tgu_irq_handler,
|
||||
tgu_irq_thread_handler,
|
||||
IRQF_TRIGGER_RISING, "apps-tgu", NULL);
|
||||
if (ret < 0) {
|
||||
pr_err("Unable to register IRQ handler %d\n", irq);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = irq_set_irq_wake(irq, true);
|
||||
if (ret < 0) {
|
||||
pr_err("Unable to set as wakeup irq %d\n", irq);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
10
drivers/hwtracing/coresight/apss_tgu.h
Normal file
10
drivers/hwtracing/coresight/apss_tgu.h
Normal file
@ -0,0 +1,10 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef __QCOM_APSS_TGU_H__
|
||||
#define __QCOM_APSS_TGU_H__
|
||||
|
||||
int register_interrupt_handler(struct device_node *node);
|
||||
#endif /* __QCOM_APSS_TGU_H__ */
|
@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2017, 2019 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2017, 2019-2020 The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
@ -15,9 +15,11 @@
|
||||
#include <linux/amba/bus.h>
|
||||
#include <linux/topology.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/coresight.h>
|
||||
|
||||
#include "coresight-priv.h"
|
||||
#include "apss_tgu.h"
|
||||
|
||||
#define tgu_writel(drvdata, val, off) __raw_writel((val), drvdata->base + off)
|
||||
#define tgu_readl(drvdata, off) __raw_readl(drvdata->base + off)
|
||||
@ -409,6 +411,7 @@ static int tgu_probe(struct amba_device *adev, const struct amba_id *id)
|
||||
struct coresight_platform_data *pdata;
|
||||
struct tgu_drvdata *drvdata;
|
||||
struct coresight_desc desc = { 0 };
|
||||
const char *name;
|
||||
|
||||
desc.name = coresight_alloc_device_name(&tgu_devs, dev);
|
||||
if (!desc.name)
|
||||
@ -496,6 +499,13 @@ static int tgu_probe(struct amba_device *adev, const struct amba_id *id)
|
||||
goto err;
|
||||
}
|
||||
|
||||
of_property_read_string(adev->dev.of_node, "coresight-name", &name);
|
||||
if (!strcmp(name, "coresight-tgu-apss")) {
|
||||
ret = register_interrupt_handler(adev->dev.of_node);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
pm_runtime_put(&adev->dev);
|
||||
dev_dbg(dev, "TGU initialized\n");
|
||||
return 0;
|
||||
|
15
include/soc/qcom/tgu.h
Normal file
15
include/soc/qcom/tgu.h
Normal file
@ -0,0 +1,15 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef __QCOM_TGU_H__
|
||||
#define __QCOM_TGU_H__
|
||||
|
||||
struct tgu_test_notifier {
|
||||
void (*cb)(void);
|
||||
};
|
||||
|
||||
extern int register_tgu_notifier(struct tgu_test_notifier *tgu_test);
|
||||
extern int unregister_tgu_notifier(struct tgu_test_notifier *tgu_test);
|
||||
#endif /* __QCOM_MPM_H__ */
|
33
include/trace/events/tgu.h
Normal file
33
include/trace/events/tgu.h
Normal file
@ -0,0 +1,33 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2019-2020, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#undef TRACE_SYSTEM
|
||||
#define TRACE_SYSTEM tgu
|
||||
|
||||
#if !defined(_TRACE_TGU_) || defined(TRACE_HEADER_MULTI_READ)
|
||||
#define _TRACE_TGU_H_
|
||||
|
||||
#include <linux/tracepoint.h>
|
||||
|
||||
TRACE_EVENT(tgu_interrupt,
|
||||
|
||||
TP_PROTO(uint32_t irqs),
|
||||
|
||||
TP_ARGS(irqs),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__field(uint32_t, irqs)
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__entry->irqs = irqs;
|
||||
),
|
||||
|
||||
TP_printk("irq:%u ", __entry->irqs)
|
||||
);
|
||||
|
||||
#endif
|
||||
#define TRACE_INCLUDE_FILE tgu
|
||||
#include <trace/define_trace.h>
|
Loading…
Reference in New Issue
Block a user