Linux 4.19.133
[linux/fpc-iii.git] / drivers / hwtracing / stm / stm.h
blob923571adc6f408f44da82cb06d631d46498a4032
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * System Trace Module (STM) infrastructure
4 * Copyright (c) 2014, Intel Corporation.
6 * STM class implements generic infrastructure for System Trace Module devices
7 * as defined in MIPI STPv2 specification.
8 */
10 #ifndef _STM_STM_H_
11 #define _STM_STM_H_
13 struct stp_policy;
14 struct stp_policy_node;
16 struct stp_policy_node *
17 stp_policy_node_lookup(struct stm_device *stm, char *s);
18 void stp_policy_node_put(struct stp_policy_node *policy_node);
19 void stp_policy_unbind(struct stp_policy *policy);
21 void stp_policy_node_get_ranges(struct stp_policy_node *policy_node,
22 unsigned int *mstart, unsigned int *mend,
23 unsigned int *cstart, unsigned int *cend);
24 int stp_configfs_init(void);
25 void stp_configfs_exit(void);
27 struct stp_master {
28 unsigned int nr_free;
29 unsigned long chan_map[0];
32 struct stm_device {
33 struct device dev;
34 struct module *owner;
35 struct stp_policy *policy;
36 struct mutex policy_mutex;
37 int major;
38 unsigned int sw_nmasters;
39 struct stm_data *data;
40 struct mutex link_mutex;
41 spinlock_t link_lock;
42 struct list_head link_list;
43 /* master allocation */
44 spinlock_t mc_lock;
45 struct stp_master *masters[0];
48 #define to_stm_device(_d) \
49 container_of((_d), struct stm_device, dev)
51 struct stm_output {
52 spinlock_t lock;
53 unsigned int master;
54 unsigned int channel;
55 unsigned int nr_chans;
58 struct stm_file {
59 struct stm_device *stm;
60 struct stp_policy_node *policy_node;
61 struct stm_output output;
64 struct stm_device *stm_find_device(const char *name);
65 void stm_put_device(struct stm_device *stm);
67 struct stm_source_device {
68 struct device dev;
69 struct stm_source_data *data;
70 spinlock_t link_lock;
71 struct stm_device __rcu *link;
72 struct list_head link_entry;
73 /* one output per stm_source device */
74 struct stp_policy_node *policy_node;
75 struct stm_output output;
78 #define to_stm_source_device(_d) \
79 container_of((_d), struct stm_source_device, dev)
81 #endif /* _STM_STM_H_ */