0f635d7d1e
The events managed by pmu_lib are dynamically allocated by clients via qcom_pmu_create/delete. This offers runtime flexibility but requires additional synchronization with pmu event reads and runs the risk of one client configuring all pmu events. Instead, define the events in device tree and provide an API for checking if a particular event is supported in pmu_lib. Change-Id: Ia9aad96e5f0e5900e7f863be97c79839da766f5c Signed-off-by: Amir Vajid <avajid@codeaurora.org>
67 lines
1.6 KiB
C
67 lines
1.6 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
|
|
*/
|
|
|
|
#ifndef _QCOM_PMU_H
|
|
#define _QCOM_PMU_H
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
/* (1) ccntr + (6) evcntr + (1) llcc */
|
|
#define QCOM_PMU_MAX_EVS 8
|
|
|
|
struct qcom_pmu_data {
|
|
u32 event_ids[QCOM_PMU_MAX_EVS];
|
|
u64 ev_data[QCOM_PMU_MAX_EVS];
|
|
u32 num_evs;
|
|
};
|
|
|
|
typedef void (*idle_fn_t)(struct qcom_pmu_data *data, int cpu, int state);
|
|
struct qcom_pmu_notif_node {
|
|
idle_fn_t idle_cb;
|
|
struct list_head node;
|
|
};
|
|
|
|
#if IS_ENABLED(CONFIG_QCOM_PMU_LIB)
|
|
int qcom_pmu_event_supported(u32 event_id, int cpu);
|
|
int qcom_pmu_read(int cpu, u32 event_id, u64 *pmu_data);
|
|
int qcom_pmu_read_local(u32 event_id, u64 *pmu_data);
|
|
int qcom_pmu_read_all(int cpu, struct qcom_pmu_data *data);
|
|
int qcom_pmu_read_all_local(struct qcom_pmu_data *data);
|
|
int qcom_pmu_idle_register(struct qcom_pmu_notif_node *idle_node);
|
|
int qcom_pmu_idle_unregister(struct qcom_pmu_notif_node *idle_node);
|
|
#else
|
|
static inline int qcom_pmu_event_supported(u32 event_id, int cpu)
|
|
{
|
|
return -ENODEV;
|
|
}
|
|
static inline int qcom_pmu_read(int cpu, u32 event_id, u64 *pmu_data)
|
|
{
|
|
return -ENODEV;
|
|
}
|
|
static inline int qcom_pmu_read_local(u32 event_id, u64 *pmu_data)
|
|
{
|
|
return -ENODEV;
|
|
}
|
|
static inline int qcom_pmu_read_all(int cpu, struct qcom_pmu_data *data)
|
|
{
|
|
return -ENODEV;
|
|
}
|
|
static inline int qcom_pmu_read_all_local(struct qcom_pmu_data *data)
|
|
{
|
|
return -ENODEV;
|
|
}
|
|
static inline int qcom_pmu_idle_register(struct qcom_pmu_notif_node *idle_node)
|
|
{
|
|
return -ENODEV;
|
|
}
|
|
static inline int qcom_pmu_idle_unregister(
|
|
struct qcom_pmu_notif_node *idle_node)
|
|
{
|
|
return -ENODEV;
|
|
}
|
|
#endif
|
|
|
|
#endif /* _QCOM_PMU_H */
|