Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2885213pxb; Tue, 24 Aug 2021 09:50:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9SiYtvgrgWwp+RGGHCggUcmB/guFrxqAlCC/VDImrgK7ywaAOhwROkpH4psfu9Iz/Cfx5 X-Received: by 2002:a02:908a:: with SMTP id x10mr34371514jaf.30.1629823856508; Tue, 24 Aug 2021 09:50:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629823856; cv=none; d=google.com; s=arc-20160816; b=F8bMQL2qPX6jGQGO17cCyBzrRk51e6mdOsyBt8zYklT/2xz8EJl7e32zGZOjS34mC/ mRtDJFut0WFDsdFdEcsEwd0DIZxP5zAraJeL0jhNE6KkkYJWm124vHigK4TXN6aJSsGl N0cXHO8gTQZ5tO3hgFG6GzCAgcXIr6s+IUlHxslJr5CWasyq7uojkOLPCUNVPjMtV+Bb By6cDkuSCzhGuPSyuRrWd+6ePKeqlrHIqsg4b9DhVzlJ7NotW0jSFCEEwKRQUvJ24OrB JISx4KPMmfpUNWplEQ9+468R0Yfv0Fxupw84lMtRPLM3XG9m1x960dpoUu9RpKxJcrxy OIUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=Yk9fc0i0o6Ungm8H2pb+aB9gHxPSh88pn2IQ6S/DuGc=; b=BNXZ8OinzzMgXAoWf3GG3EClGIFCyVmEMgnjCtXw5Q0QurwOM3HwixzqORWfdwO4wB 2yFYESSdfuPmhfQXkswijjkNwzX8Bv6uwFRElcBh1MTdhog4dTeFnSPDPwpsCTCzlrvv 10AsuN+aLrG5HnsE2rQPJF77Ljh/PQvxYklyB9cDUmU0xK9bZdAGV1mdGBegUU9o4+Lk 4fqpSvJtF5kPWrfypV02GI0UBqlBlBZs3QmnW+HKS9NXhLY6c5mso13fdFmqALoVWOBP sl3T9gzTE28CBmaZgq2pV8QHZmkhCtxNmqCUj+zH7hXVWi+i4+pIw1JVCowO7Ld2XWDA ddYQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 10si15733487ilz.71.2021.08.24.09.50.44; Tue, 24 Aug 2021 09:50:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233519AbhHXQt4 (ORCPT + 99 others); Tue, 24 Aug 2021 12:49:56 -0400 Received: from mga02.intel.com ([134.134.136.20]:10241 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233322AbhHXQt0 (ORCPT ); Tue, 24 Aug 2021 12:49:26 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10086"; a="204550761" X-IronPort-AV: E=Sophos;i="5.84,347,1620716400"; d="scan'208";a="204550761" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Aug 2021 09:48:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,347,1620716400"; d="scan'208";a="684036874" Received: from inlubt0177.iind.intel.com ([10.223.67.91]) by fmsmga006.fm.intel.com with ESMTP; 24 Aug 2021 09:48:38 -0700 From: lakshmi.sowjanya.d@intel.com To: linus.walleij@linaro.org Cc: linux-gpio@vger.kernel.org, bgolaszewski@baylibre.com, linux-kernel@vger.kernel.org, mgross@linux.intel.com, andriy.shevchenko@linux.intel.com, tamal.saha@intel.com, bala.senthil@intel.com, lakshmi.sowjanya.d@intel.com Subject: [RFC PATCH v1 12/20] gpio: Add event count to Intel(R) PMC Timed I/O driver Date: Tue, 24 Aug 2021 22:17:53 +0530 Message-Id: <20210824164801.28896-13-lakshmi.sowjanya.d@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210824164801.28896-1-lakshmi.sowjanya.d@intel.com> References: <20210824164801.28896-1-lakshmi.sowjanya.d@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lakshmi Sowjanya D 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 Signed-off-by: Christopher Hall Signed-off-by: Tamal Saha Signed-off-by: Lakshmi Sowjanya D Reviewed-by: Mark Gross --- 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