1 /* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
16 struct tspp_data_descriptor {
17 void *virt_base; /* logical address of the actual data */
18 phys_addr_t phys_base; /* physical address of the actual data */
19 u32 size; /* size of buffer in bytes */
20 int id; /* unique identifier */
21 void *user; /* user-defined data */
24 enum tspp_key_parity {
30 enum tspp_key_parity parity;
46 TSPP_MODE_RAW_NO_SUFFIX
50 TSPP_TSIF_MODE_LOOPBACK, /* loopback mode */
51 TSPP_TSIF_MODE_1, /* without sync */
52 TSPP_TSIF_MODE_2 /* with sync signal */
59 unsigned int priority; /* 0 - 15 */
61 enum tspp_source source;
64 struct tspp_select_source {
65 enum tspp_source source;
66 enum tspp_tsif_mode mode;
73 enum tsif_tts_source {
74 TSIF_TTS_TCR = 0, /* Time stamps from TCR counter */
75 TSIF_TTS_LPASS_TIMER /* Time stamps from AV/Qtimer Timer */
78 typedef void (tspp_notifier)(int channel_id, void *user);
79 typedef void* (tspp_allocator)(int channel_id, u32 size,
80 phys_addr_t *phys_base, void *user);
81 typedef void (tspp_memfree)(int channel_id, u32 size,
82 void *virt_base, phys_addr_t phys_base, void *user);
84 /* Kernel API functions */
85 int tspp_open_stream(u32 dev, u32 channel_id,
86 struct tspp_select_source *source);
87 int tspp_close_stream(u32 dev, u32 channel_id);
88 int tspp_open_channel(u32 dev, u32 channel_id);
89 int tspp_close_channel(u32 dev, u32 channel_id);
90 int tspp_get_ref_clk_counter(u32 dev,
91 enum tspp_source source, u32 *tcr_counter);
92 int tspp_add_filter(u32 dev, u32 channel_id, struct tspp_filter *filter);
93 int tspp_remove_filter(u32 dev, u32 channel_id, struct tspp_filter *filter);
94 int tspp_set_key(u32 dev, u32 channel_id, struct tspp_key *key);
95 int tspp_register_notification(u32 dev, u32 channel_id, tspp_notifier *notify,
96 void *data, u32 timer_ms);
97 int tspp_unregister_notification(u32 dev, u32 channel_id);
98 const struct tspp_data_descriptor *tspp_get_buffer(u32 dev, u32 channel_id);
99 int tspp_release_buffer(u32 dev, u32 channel_id, u32 descriptor_id);
100 int tspp_allocate_buffers(u32 dev, u32 channel_id, u32 count,
101 u32 size, u32 int_freq, tspp_allocator *alloc,
102 tspp_memfree *memfree, void *user);
104 int tspp_get_tts_source(u32 dev, int *tts_source);
105 int tspp_get_lpass_time_counter(u32 dev, enum tspp_source source,
106 u64 *lpass_time_counter);
108 #endif /* _MSM_TSPP_H_ */