summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@quicinc.com>2017-10-24 20:02:48 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2017-10-24 20:02:47 -0700
commit682b7f4ae810a5a8a4082116791d4df01e9a71b3 (patch)
tree4061325a5327b82bb997701b8ac18163f9a86cbb
parent0fd0ad8913724abb612832396c01d6273feee12c (diff)
parent215533f02a53fb753e3b93f7a335175f74ee2475 (diff)
Merge "pps-gpio: Add new property to use system time timestamp for PPS GPIO"
-rw-r--r--Documentation/devicetree/bindings/pps/pps-gpio.txt3
-rw-r--r--drivers/pps/clients/pps-gpio.c13
2 files changed, 13 insertions, 3 deletions
diff --git a/Documentation/devicetree/bindings/pps/pps-gpio.txt b/Documentation/devicetree/bindings/pps/pps-gpio.txt
index 40bf9c3564a5..a834868ba6a2 100644
--- a/Documentation/devicetree/bindings/pps/pps-gpio.txt
+++ b/Documentation/devicetree/bindings/pps/pps-gpio.txt
@@ -10,6 +10,9 @@ Required properties:
Optional properties:
- assert-falling-edge: when present, assert is indicated by a falling edge
(instead of by a rising edge)
+- use-system-time-ts: use the system time via pps_get_ts as the timestamp
+ if this is not defined then the timestamp will come
+ from the monotonic boot time
Example:
pps {
diff --git a/drivers/pps/clients/pps-gpio.c b/drivers/pps/clients/pps-gpio.c
index da72b0b59c3a..6dd425abc5a5 100644
--- a/drivers/pps/clients/pps-gpio.c
+++ b/drivers/pps/clients/pps-gpio.c
@@ -44,6 +44,7 @@ struct pps_gpio_device_data {
bool assert_falling_edge;
bool capture_clear;
unsigned int gpio_pin;
+ bool use_system_time_ts;
};
/*
@@ -56,11 +57,14 @@ static irqreturn_t pps_gpio_irq_handler(int irq, void *data)
struct pps_event_time ts;
int rising_edge;
- /* Get the time stamp first */
- get_monotonic_boottime(&ts.ts_real);
-
info = data;
+ /* Get the time stamp first */
+ if (!info->use_system_time_ts)
+ get_monotonic_boottime(&ts.ts_real);
+ else
+ pps_get_ts(&ts);
+
rising_edge = gpio_get_value(info->gpio_pin);
if ((rising_edge && !info->assert_falling_edge) ||
(!rising_edge && info->assert_falling_edge))
@@ -119,6 +123,9 @@ static int pps_gpio_probe(struct platform_device *pdev)
if (of_get_property(np, "assert-falling-edge", NULL))
data->assert_falling_edge = true;
+
+ if (of_get_property(np, "use-system-time-ts", NULL))
+ data->use_system_time_ts = true;
}
/* GPIO setup */