summaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorDipen Patel <dipenp@nvidia.com>2020-01-30 01:19:27 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2020-02-24 10:24:48 -0500
commit6ff9cac2cad40cf6fd054410f1f965feb61f5f92 (patch)
tree0f8b0b0e489787c37bd6d4eb5d7250c223170caa /include/linux
parentfc91da385da7b7bbb7a25f7ad8d3897eec6e1ff5 (diff)
drivers: staging: Add Generic timestamping support
Adds generic hardware timestamping (GTE) support for the T194 SoC. There are certain applications like robotics which may require more accurate recording of the occurance of the certain events. GTE driver will help monitor AON GPIOs and LIC interrupts. GTE driver also implements char driver for userspace to monitor GPIO through IOCTL. Other kernel APIs are exported and defined in the tegra-gte.h file for kernel client drivers to use. APIs are not stable and subject to change in the future. It is for this reason GTE driver is provided in the staging directory. Since its APIs are not stable, it should not break existing nvpps driver code from the stage-main which also uses GTE but in limited way. It is for this reason this driver will not be selected if nvpps is enabled. Bug 2757864 Change-Id: I0947f2b90232eb6c2a31163e33ec5ad45b7bd415 Signed-off-by: Dipen Patel <dipenp@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2287452 Reviewed-by: Bibek Basu <bbasu@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> GVS: Gerrit_Virtual_Submit
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/tegra-gte.h105
1 files changed, 105 insertions, 0 deletions
diff --git a/include/linux/tegra-gte.h b/include/linux/tegra-gte.h
new file mode 100644
index 000000000..4862db05d
--- /dev/null
+++ b/include/linux/tegra-gte.h
@@ -0,0 +1,105 @@
1/*
2 * Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License version 2
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 */
13
14#ifndef _LINUX_TEGRA_GTE_ENGINE_H
15#define _LINUX_TEGRA_GTE_ENGINE_H
16
17#include <linux/device.h>
18
19struct tegra_gte_ev_desc {
20 int id;
21 int gid;
22 u32 ev_bit;
23 u32 slice;
24};
25
26/* GTE hardware timestamping event details */
27struct tegra_gte_ev_detail {
28 u64 ts_raw; /* raw counter value */
29 u64 ts_ns; /* counter value converted into nano seconds */
30 int dir; /* direction of the event */
31};
32
33#ifdef CONFIG_TEGRA_HTS_GTE
34/*
35 * GTE event registration function
36 *
37 * Parameters:
38 *
39 * Input:
40 * @np: device node of the interested GTE device
41 * @ev_id: event id
42 *
43 * Returns:
44 * Returns ERR_PTR in case of failure or valid
45 * struct tegra_gte_ev_desc for success.
46 *
47 * Note: API is not stable and subject to change.
48 */
49struct tegra_gte_ev_desc *tegra_gte_register_event(struct device_node *np,
50 u32 ev_id);
51
52/*
53 * GTE event un-registration function
54 *
55 * Parameters:
56 *
57 * Input:
58 * @desc: This parameter should be the same as returned from register
59 *
60 * Returns:
61 * Returns 0 for success and any other value for the failure
62 *
63 * Note: API is not stable and subject to change.
64 */
65int tegra_gte_unregister_event(struct tegra_gte_ev_desc *desc);
66
67/*
68 * GTE event retrieval function
69 *
70 * Parameters:
71 *
72 * Input:
73 * @desc: This parameter should be the same as returned from register
74 *
75 * Output:
76 * @hts: hts event details
77 *
78 * Returns:
79 * Returns 0 for success and any other value for the failure
80 *
81 * Note: API is not stable and subject to change.
82 */
83int tegra_gte_retrieve_event(const struct tegra_gte_ev_desc *desc,
84 struct tegra_gte_ev_detail *hts);
85
86#else /* ! CONFIG_TEGRA_HTS_GTE */
87static inline struct tegra_gte_ev_desc *tegra_gte_register_event(
88 struct device_node *np, u32 ev_id)
89{
90 return ERR_PTR(-ENOSYS);
91}
92
93static inline int tegra_gte_unregister_event(struct tegra_gte_ev_desc *desc)
94{
95 return -ENOSYS;
96}
97
98static inline int tegra_gte_retrieve_event(const struct tegra_gte_ev_desc *desc,
99 struct tegra_gte_ev_detail *hts)
100{
101 return -ENOSYS;
102}
103
104#endif /* ! CONFIG_TEGRA_HTS_GTE */
105#endif