lkml.org 
[lkml]   [2021]   [Aug]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC PATCH v1 12/20] gpio: Add event count to Intel(R) PMC Timed I/O driver
Date
From: Lakshmi Sowjanya D <lakshmi.sowjanya.d@intel.com>

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@intel.com>
Signed-off-by: Christopher Hall <christopher.s.hall@intel.com>
Signed-off-by: Tamal Saha <tamal.saha@intel.com>
Signed-off-by: Lakshmi Sowjanya D <lakshmi.sowjanya.d@intel.com>
Reviewed-by: Mark Gross <mgross@linux.intel.com>
---
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
\
 
 \ /
  Last update: 2021-08-24 18:49    [W:0.167 / U:0.164 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site