History

gpiolib: cdev: allow edge event timestamps to be configured as REALTIME

Using CLOCK_REALTIME as the source for event timestamps is crucial for some specific applications, particularly those requiring timetamps relative to a PTP clock, so provide an option to switch the event timestamp source from the default CLOCK_MONOTONIC to CLOCK_REALTIME. Note that CLOCK_REALTIME was the default source clock for GPIO until Linux 5.7 when it was changed to CLOCK_MONOTONIC due to issues with the shifting of the realtime clock. Providing this option maintains the CLOCK_MONOTONIC as the default, while also providing a path forward for those dependent on the pre-5.7 behaviour.

Kent Gibson committed 6 years ago

Commit 26d060e1 parent 93224ed3 files · +28 −6Browse files

Showing the changes to include/uapi/linux (1 of 3 files). Show all

Unified · Split

include/uapi/linux/gpio.h+9−3
@@ -65,6 +65,7 @@ struct gpiochip_info { · 64 unmodified lines
65 * @GPIO_V2_LINE_FLAG_BIAS_PULL_UP: line has pull-up bias enabled65 * @GPIO_V2_LINE_FLAG_BIAS_PULL_UP: line has pull-up bias enabled
66 * @GPIO_V2_LINE_FLAG_BIAS_PULL_DOWN: line has pull-down bias enabled66 * @GPIO_V2_LINE_FLAG_BIAS_PULL_DOWN: line has pull-down bias enabled
67 * @GPIO_V2_LINE_FLAG_BIAS_DISABLED: line has bias disabled67 * @GPIO_V2_LINE_FLAG_BIAS_DISABLED: line has bias disabled
68 * @GPIO_V2_LINE_FLAG_EVENT_CLOCK_REALTIME: line events contain REALTIME timestamps
68 */69 */
69enum gpio_v2_line_flag {70enum gpio_v2_line_flag {
70 GPIO_V2_LINE_FLAG_USED = _BITULL(0),71 GPIO_V2_LINE_FLAG_USED = _BITULL(0),
@@ -78,6 +79,7 @@ enum gpio_v2_line_flag { · 7 unmodified lines
78 GPIO_V2_LINE_FLAG_BIAS_PULL_UP = _BITULL(8),79 GPIO_V2_LINE_FLAG_BIAS_PULL_UP = _BITULL(8),
79 GPIO_V2_LINE_FLAG_BIAS_PULL_DOWN = _BITULL(9),80 GPIO_V2_LINE_FLAG_BIAS_PULL_DOWN = _BITULL(9),
80 GPIO_V2_LINE_FLAG_BIAS_DISABLED = _BITULL(10),81 GPIO_V2_LINE_FLAG_BIAS_DISABLED = _BITULL(10),
82 GPIO_V2_LINE_FLAG_EVENT_CLOCK_REALTIME = _BITULL(11),
81};83};
82 84
83/**85/**
@@ -270,9 +272,6 @@ enum gpio_v2_line_event_id { · 186 unmodified lines
270/**272/**
271 * struct gpio_v2_line_event - The actual event being pushed to userspace273 * struct gpio_v2_line_event - The actual event being pushed to userspace
272 * @timestamp_ns: best estimate of time of event occurrence, in nanoseconds.274 * @timestamp_ns: best estimate of time of event occurrence, in nanoseconds.
273 * The @timestamp_ns is read from %CLOCK_MONOTONIC and is intended to allow
274 * the accurate measurement of the time between events. It does not provide
275 * the wall-clock time.
276 * @id: event identifier with value from &enum gpio_v2_line_event_id275 * @id: event identifier with value from &enum gpio_v2_line_event_id
277 * @offset: the offset of the line that triggered the event276 * @offset: the offset of the line that triggered the event
278 * @seqno: the sequence number for this event in the sequence of events for277 * @seqno: the sequence number for this event in the sequence of events for
@@ -280,6 +279,13 @@ enum gpio_v2_line_event_id { · 1 unmodified line
280 * @line_seqno: the sequence number for this event in the sequence of279 * @line_seqno: the sequence number for this event in the sequence of
281 * events on this particular line280 * events on this particular line
282 * @padding: reserved for future use281 * @padding: reserved for future use
282 *
283 * By default the @timestamp_ns is read from %CLOCK_MONOTONIC and is
284 * intended to allow the accurate measurement of the time between events.
285 * It does not provide the wall-clock time.
286 *
287 * If the %GPIO_V2_LINE_FLAG_EVENT_CLOCK_REALTIME flag is set then the
288 * @timestamp_ns is read from %CLOCK_REALTIME.
283 */289 */
284struct gpio_v2_line_event {290struct gpio_v2_line_event {
285 __aligned_u64 timestamp_ns;291 __aligned_u64 timestamp_ns;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t