[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210824164801.28896-13-lakshmi.sowjanya.d@intel.com>
Date: Tue, 24 Aug 2021 22:17:53 +0530
From: lakshmi.sowjanya.d@...el.com
To: linus.walleij@...aro.org
Cc: linux-gpio@...r.kernel.org, bgolaszewski@...libre.com,
linux-kernel@...r.kernel.org, mgross@...ux.intel.com,
andriy.shevchenko@...ux.intel.com, tamal.saha@...el.com,
bala.senthil@...el.com, lakshmi.sowjanya.d@...el.com
Subject: [RFC PATCH v1 12/20] gpio: Add event count to Intel(R) PMC Timed I/O driver
From: Lakshmi Sowjanya D <lakshmi.sowjanya.d@...el.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@...el.com>
Signed-off-by: Christopher Hall <christopher.s.hall@...el.com>
Signed-off-by: Tamal Saha <tamal.saha@...el.com>
Signed-off-by: Lakshmi Sowjanya D <lakshmi.sowjanya.d@...el.com>
Reviewed-by: Mark Gross <mgross@...ux.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
Powered by blists - more mailing lists