blob: 8a5fdb32e45f253dcca4a46b624225362ab2249e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
/* SPDX-License-Identifier: GPL-2.0 */
/*
* DSP usage stats header
*
* Copyright (C) 2022 Google LLC
*/
#ifndef __GXP_USAGE_STATS_H__
#define __GXP_USAGE_STATS_H__
#include <linux/types.h>
#include "gxp-internal.h"
/* Header struct in the metric buffer. */
/* Must be kept in sync with firmware struct UsageTrackerHeader */
struct gxp_usage_header {
uint32_t num_metrics; /* Number of metrics being reported */
uint32_t metric_size; /* Size of each metric struct */
};
/* TODO(b/237967242): Add data structures after the interfaces of each metrics are decided. */
/*
* Must be kept in sync with firmware enum class UsageTrackerMetric::Type
* TODO(b/237967242): Add metric types after they are decided.
*/
enum gxp_usage_metric_type {
GXP_METRIC_TYPE_RESERVED = 0,
};
/*
* Encapsulates a single metric reported to the kernel.
* Must be kept in sync with firmware struct UsageTrackerMetric.
*/
struct gxp_usage_metric {
uint32_t type;
uint8_t reserved[4];
union {
};
};
/*
* Stores the usage of DSP which is collected from the get_usage KCI metrics.
* TODO(b/237967242): Add variables storing the usage if needed after the metrics are decided.
*/
struct gxp_usage_stats {
struct mutex usage_stats_lock;
};
/* Parses the buffer from the get_usage KCI and updates the usage_stats of @gxp. */
void gxp_usage_stats_process_buffer(struct gxp_dev *gxp, void *buf);
/* Initializes the usage_stats of gxp to process the get_usage KCI. */
void gxp_usage_stats_init(struct gxp_dev *gxp);
/* Cleans up the usage_stats of gxp which is initialized by `gxp_usage_stats_init`. */
void gxp_usage_stats_exit(struct gxp_dev *gxp);
#endif /* __GXP_USAGE_STATS_H__ */
|