OSDN Git Service

drivers: leds: Import Xiaomi changes
[sagit-ice-cold/kernel_xiaomi_msm8998.git] / include / linux / qcom_tspp.h
1 /* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
2  *
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.
6  *
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.
11  */
12
13 #ifndef _MSM_TSPP_H_
14 #define _MSM_TSPP_H_
15
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 */
22 };
23
24 enum tspp_key_parity {
25         TSPP_KEY_PARITY_EVEN,
26         TSPP_KEY_PARITY_ODD
27 };
28
29 struct tspp_key {
30         enum tspp_key_parity parity;
31         int lsb;
32         int msb;
33 };
34
35 enum tspp_source {
36         TSPP_SOURCE_TSIF0,
37         TSPP_SOURCE_TSIF1,
38         TSPP_SOURCE_MEM,
39         TSPP_SOURCE_NONE = -1
40 };
41
42 enum tspp_mode {
43         TSPP_MODE_DISABLED,
44         TSPP_MODE_PES,
45         TSPP_MODE_RAW,
46         TSPP_MODE_RAW_NO_SUFFIX
47 };
48
49 enum tspp_tsif_mode {
50         TSPP_TSIF_MODE_LOOPBACK, /* loopback mode */
51         TSPP_TSIF_MODE_1,        /* without sync */
52         TSPP_TSIF_MODE_2         /* with sync signal */
53 };
54
55 struct tspp_filter {
56         int pid;
57         int mask;
58         enum tspp_mode mode;
59         unsigned int priority;  /* 0 - 15 */
60         int decrypt;
61         enum tspp_source source;
62 };
63
64 struct tspp_select_source {
65         enum tspp_source source;
66         enum tspp_tsif_mode mode;
67         int clk_inverse;
68         int data_inverse;
69         int sync_inverse;
70         int enable_inverse;
71 };
72
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  */
76 };
77
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);
83
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);
103
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);
107
108 #endif /* _MSM_TSPP_H_ */