From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76132C433E0 for ; Sat, 27 Jun 2020 18:21:10 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4FED320760 for ; Sat, 27 Jun 2020 18:21:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="j2uCjxuU"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="qu6vSC1j" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4FED320760 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: In-Reply-To:MIME-Version:References:Message-ID:Subject:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=M6+xFuvlnyo1+k7kpXwAuj6JGLzDjlgRaXveeUu2bKs=; b=j2uCjxuUpI9vw9EFyD4LTtSsw 368s41PhQVBMvvpZjetqNWo/FiUj2uzOiWB0pfrjnPBcfIcJdSzFINdYQWpWLzZB5WK4FAldfvBck XoMtmdquidsxKiQIdQkukYhqwYcv10nPEp35X7xG+8pkLtt8GJAuglWEdiu2gMnP6Fvc8D2VWPr0z sps3NzkZpD5pmVLmWKhP6eWbljcId2iOw6Sk0+QLKie8+k7w4KN6gV6haawBNZDADmkYgXkuXzhnx ePj7VyuT7kMiw7GRleyei7+hxKETf1AXgVXGj4Rqei4KqEMy9luReOfTsDZ3pD+I3DIlD5qIpn+un gI7xMCeDw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpFP1-0003w9-Sp; Sat, 27 Jun 2020 18:18:12 +0000 Received: from mail-qv1-xf42.google.com ([2607:f8b0:4864:20::f42]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jpFOx-0003vD-AB for linux-arm-kernel@lists.infradead.org; Sat, 27 Jun 2020 18:18:09 +0000 Received: by mail-qv1-xf42.google.com with SMTP id di5so1019765qvb.11 for ; Sat, 27 Jun 2020 11:18:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=ZfS1zQEXxVr5pDKOKLlkhLbHYnS+buWmBwUy/Xrx/Oc=; b=qu6vSC1jPfgHL/kV3nJFd5+olf7eZKNmjbYU0fJa1IPH8AxS/ZUX/2wraYWI9Kb2ms 9Z4+5PDUboqbXOUl4wIJFt2wIEw0lAKftDi58QttIO7NhJb9VvpG36vh2DpAb17mLCen oSWct2KXoEYkp7FODSeUDpNfg42A01s37GDHJmkCPyXHnVVCM4ftSqFala09wf1llGrG 1sglbZr7hbHa4jayiLzxcCan3DdTmZdBUbI3knR3Xs4AmJg+x4qR9KNQqqnEiV7+cK89 b0IRVHbDtZ0mGk0OfGYi4VS/kvdp15b+dsGQDVdbKd9MO3aqZt9d0GQk58BLaeG5oMNX H0Lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ZfS1zQEXxVr5pDKOKLlkhLbHYnS+buWmBwUy/Xrx/Oc=; b=U8anzcSJjc1fA+OXqHAYMVx2Dvcfo1YypG14x6UrePUBeefSKl6Zdt573RAo9Lb8iM aK77Al4MQgeurTsHwX+ChrMJ98vE8salx/jJr0LCF9rQR7YrI2xFOVAUQFs/H0HGJyWZ fH5TEvCsSszfqgm68YTRAhGx2pJTxgGPlvElgrAI89Ysa5c+4LL9HydWWKo9zPY0R/kB s5w3WMh+2U1C4vQjpeNaQ/vmmtooKu/kkKMOrIsBB1ukjpPLuhgXE9fs0EzyQCuKHBQD aLaels3yHZvnQpHHWlaMl10mtuvkFgRl6ezAtrPd/Pky53AYAaiLqg+ZE9rrXn6jl4as Ehcg== X-Gm-Message-State: AOAM53068YAiXo7HZvlpSkNlF4jJ9vAn9+xUCZaI/2eBKBf4QwigTfMp WYM1iSS1JrnmyAYC1PKMFj0= X-Google-Smtp-Source: ABdhPJx01oRpIQIb8KuN+kaIF5K7gUAF7wqHvbJFPlNJV6vCemc2pGIggoC1p7UfEgH0kZZlDSFKkg== X-Received: by 2002:ad4:57b2:: with SMTP id g18mr8452730qvx.207.1593281883789; Sat, 27 Jun 2020 11:18:03 -0700 (PDT) Received: from shinobu (072-189-064-225.res.spectrum.com. [72.189.64.225]) by smtp.gmail.com with ESMTPSA id q47sm13053073qta.16.2020.06.27.11.18.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Jun 2020 11:18:02 -0700 (PDT) Date: Sat, 27 Jun 2020 14:17:48 -0400 From: William Breathitt Gray To: David Lechner Subject: Re: [PATCH v3 3/4] counter: Add character device interface Message-ID: <20200627181748.GA8254@shinobu> References: <8fae0659-56df-c0b5-7c0d-220feefed2b4@lechnology.com> <20200621195347.GA59797@shinobu> <47ad15e7-05ce-d463-b6af-406365b3c3b4@lechnology.com> MIME-Version: 1.0 In-Reply-To: <47ad15e7-05ce-d463-b6af-406365b3c3b4@lechnology.com> X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kamel.bouhara@bootlin.com, gwendal@chromium.org, alexandre.torgue@st.com, linux-iio@vger.kernel.org, patrick.havelange@essensium.com, alexandre.belloni@bootlin.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, mcoquelin.stm32@gmail.com, fabrice.gasnier@st.com, syednwaris@gmail.com, linux-stm32@st-md-mailman.stormreply.com, jic23@kernel.org Content-Type: multipart/mixed; boundary="===============5129216762966754174==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============5129216762966754174== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="G4iJoqBmSsgzjUCe" Content-Disposition: inline --G4iJoqBmSsgzjUCe Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jun 22, 2020 at 09:08:48AM -0500, David Lechner wrote: > On 6/21/20 2:53 PM, William Breathitt Gray wrote: > > For example, in the dual-axes positioning table scenario, a user > > application would likely want to know the exact X and Y position at the > > time of a given event -- that means an event should provide two Count > > values (and possibly associated device flags) when it occurs. I'm not > > sure yet how the struct counter_event should be defined in order to > > support this; we will need to indicate the format of data as well as > > provide the data itself. Perhaps, we can handle this by providing an > > unique id field so that only a single datum (e.g. a single count value) > > is provided via the value field, but subsequent struct counter_event > > items share the same id so that the user knows that a particular datum > > is part of a larger group of data for a specific event. >=20 > The timestamp could act as the "id" to correlate multiple values of a > single event. Okay, I see how that can work. So the /dev/counterX character nodes would return a stream of data structures that look something like this: struct counter_event { /** * Best approximation of when event occurred in nanoseconds. * Same timestamp value indicates data is part of same event. */ struct timeval time; /** * Type of event that triggered. This would correlate with the * IRQ set up for the device. */ __u16 type; /** * Type of data represented by the value member. This enables * the user to extract the right datatype from the value field. */ __u16 code; /** The value recorded when the event fired. */ __u64 value; }; In fact, this data structure looks a lot like struct input_event; would it make sense to use that for this? I suppose we can't because we need to support 64-bit value for our use cases. Userspace also requires a way to enable the events and configure them to report the data it wants. So perhaps the following sysfs attributes would accomplish such: * /sys/bus/devices/counterX/eventY_enable: Users can enable/disable event Y. * /sys/bus/devices/counterX/eventY_config: Data to get when event Y is triggered (e.g. Counts, extensions, etc.). Here's another concern for latency-sensitive applications: should we handle writing data to the devices? While we have real-life examples of latency-sensitive read operations, I'm not sure if a user will ever need to write to a counter device within some realtime critical deadline -- I think write operations are primarily done for the purpose of configuring the device for operation rather than during it. So perhaps we don't need to worry about this use case because users can write data via the existing sysfs interface. William Breathitt Gray --G4iJoqBmSsgzjUCe Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEk5I4PDJ2w1cDf/bghvpINdm7VJIFAl73jUQACgkQhvpINdm7 VJI+5Q/9F+iiZdKk+/Rbp7+DBs4MIahPcIfm80GiTAS9+CB5A6gewetdkCiG9NtJ kFdOjw9wRUSdB+ah+o0t0zGLC1v4q069zwrbns6giE6KsbMHItihk/pEZ1A8mel2 +Mo56yo+7n5EkkQkmnYZLRwTm0P+bRpSHGN4p0JrTaiGfsZQYnZuJuyYDwFV3EoJ QQQwlx+OmvpNXISugKy/t/BRJzcjWNKIIuxQC3ejk1y0LUqEkU5yh8g3z3foktWw 2vQJJtTVBQNpMncSbjCysK51oF9QE3W6merHqj8nzeMKBW336cqzySFD3pOagPe8 AolVMd7YnUQ1uylD5t1/ysYPiihGkvWNO+YED2JuU12Y8oldYjI7ELpjSNUBzvie FeHu8v7w4fcQ1SY0xm1Y5XWdKJx0WOPjfqxmcSN2t9zb1Cc4Z4/7bpM4CvErusjR PQEukMibjwj/T5BsfdutwhIX5GHT5SVYVUKoLhe0gI4n+y3lxn4jfS638lnDBhGg NPwhHUVksRHEh/RXyleNz2Mopt/f3cUg48O1vQA8tLcZ7nxTU1GKDOvaZ8AevVa3 H+K8URgeKInEyhkt0px9H2x83aqEk921Czcxm15qE7RY4bfIU86lZEITRE4INnmy Qd3Nf8tIjV6Pk5F7ZKjiFAUbhrcdFsCiXM5doYGkKcfLrZuVh1I= =sQ+8 -----END PGP SIGNATURE----- --G4iJoqBmSsgzjUCe-- --===============5129216762966754174== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============5129216762966754174==--