|
|
4693f0 |
commit 117ed5c2d0f865894dd930d877f0ec28bc23d951
|
|
|
4693f0 |
Author: Miroslav Lichvar <mlichvar@redhat.com>
|
|
|
4693f0 |
Date: Tue Jan 17 14:17:41 2017 +0100
|
|
|
4693f0 |
|
|
|
4693f0 |
timemaster: check support for SW time stamping.
|
|
|
4693f0 |
|
|
|
4693f0 |
When an interface doesn't support HW time stamping, before falling back
|
|
|
4693f0 |
to SW time stamping, check if it's actually supported and exit with an
|
|
|
4693f0 |
error message if not.
|
|
|
4693f0 |
|
|
|
4693f0 |
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
|
|
|
4693f0 |
|
|
|
4693f0 |
diff --git a/timemaster.c b/timemaster.c
|
|
|
4693f0 |
index 880b2ab..cda2d90 100644
|
|
|
4693f0 |
--- a/timemaster.c
|
|
|
4693f0 |
+++ b/timemaster.c
|
|
|
4693f0 |
@@ -674,13 +674,15 @@ static int add_ptp_source(struct ptp_domain *source,
|
|
|
4693f0 |
{
|
|
|
4693f0 |
struct config_file *config_file;
|
|
|
4693f0 |
char **command, *uds_path, **interfaces, *message_tag;
|
|
|
4693f0 |
- int i, j, num_interfaces, *phc, *phcs, hw_ts;
|
|
|
4693f0 |
+ int i, j, num_interfaces, *phc, *phcs, hw_ts, sw_ts;
|
|
|
4693f0 |
struct sk_ts_info ts_info;
|
|
|
4693f0 |
|
|
|
4693f0 |
pr_debug("adding PTP domain %d", source->domain);
|
|
|
4693f0 |
|
|
|
4693f0 |
hw_ts = SOF_TIMESTAMPING_TX_HARDWARE | SOF_TIMESTAMPING_RX_HARDWARE |
|
|
|
4693f0 |
SOF_TIMESTAMPING_RAW_HARDWARE;
|
|
|
4693f0 |
+ sw_ts = SOF_TIMESTAMPING_TX_SOFTWARE | SOF_TIMESTAMPING_RX_SOFTWARE |
|
|
|
4693f0 |
+ SOF_TIMESTAMPING_SOFTWARE;
|
|
|
4693f0 |
|
|
|
4693f0 |
for (num_interfaces = 0;
|
|
|
4693f0 |
source->interfaces[num_interfaces]; num_interfaces++)
|
|
|
4693f0 |
@@ -702,9 +704,14 @@ static int add_ptp_source(struct ptp_domain *source,
|
|
|
4693f0 |
return 1;
|
|
|
4693f0 |
}
|
|
|
4693f0 |
|
|
|
4693f0 |
- if (!ts_info.valid ||
|
|
|
4693f0 |
- ((ts_info.so_timestamping & hw_ts) != hw_ts)) {
|
|
|
4693f0 |
+ if (((ts_info.so_timestamping & hw_ts) != hw_ts)) {
|
|
|
4693f0 |
pr_debug("interface %s: no PHC", source->interfaces[i]);
|
|
|
4693f0 |
+ if ((ts_info.so_timestamping & sw_ts) != sw_ts) {
|
|
|
4693f0 |
+ pr_err("time stamping not supported on %s",
|
|
|
4693f0 |
+ source->interfaces[i]);
|
|
|
4693f0 |
+ free(phcs);
|
|
|
4693f0 |
+ return 1;
|
|
|
4693f0 |
+ }
|
|
|
4693f0 |
continue;
|
|
|
4693f0 |
}
|
|
|
4693f0 |
|