From: Lakshmi Sowjanya D <lakshmi.sowjanya.d@xxxxxxxxx> Implement event count interface added to GPIOlib in Intel PMC Timed I/O device The Intel(R) PMC Timed I/O device has an event count register counting the number of missed input edges. The register interface captures the event count and timestamp of the last event. For an event rate exceeding the rate that software can read events, the software can use the missed event count to calculate average event rates. Co-developed-by: Christopher Hall <christopher.s.hall@xxxxxxxxx> Signed-off-by: Christopher Hall <christopher.s.hall@xxxxxxxxx> Signed-off-by: Tamal Saha <tamal.saha@xxxxxxxxx> Signed-off-by: Lakshmi Sowjanya D <lakshmi.sowjanya.d@xxxxxxxxx> Reviewed-by: Mark Gross <mgross@xxxxxxxxxxxxxxx> --- drivers/gpio/gpio-intel-tio-pmc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpio/gpio-intel-tio-pmc.c b/drivers/gpio/gpio-intel-tio-pmc.c index f57f521edc40..7c4dd5c2661c 100644 --- a/drivers/gpio/gpio-intel-tio-pmc.c +++ b/drivers/gpio/gpio-intel-tio-pmc.c @@ -60,6 +60,7 @@ struct intel_pmc_tio_get_time_arg { struct intel_pmc_tio_chip *tio; u32 eflags; u32 event_id; + u32 event_count; u64 abs_event_count; }; @@ -276,6 +277,7 @@ static int intel_pmc_tio_get_time(ktime_t *device_time, *system_counterval = convert_art_to_tsc(art_timestamp); arg->abs_event_count = abs_event_count; + arg->event_count = rel_event_count; arg->event_id = 0; arg->event_id |= (flags & GPIO_V2_LINE_FLAG_EDGE_RISING) ? GPIO_V2_LINE_EVENT_RISING_EDGE : 0; @@ -310,6 +312,7 @@ static int intel_pmc_tio_do_poll(struct gpio_chip *chip, unsigned int offset, data->timestamp = ktime_to_ns(xtstamp.sys_realtime); data->id = arg.event_id; tio->last_event_count = arg.abs_event_count; + data->event_count = arg.event_count; } if (!err || err == -EAGAIN) break; -- 2.17.1