Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp540857ybm; Fri, 29 May 2020 06:28:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxIvYf3jyvelJJ99S1a1wWG8yZIdGepHtowIt6DKRp0w6ZHt6oj8/yn06J+uW5J+45slXkw X-Received: by 2002:aa7:d042:: with SMTP id n2mr8448500edo.226.1590758918149; Fri, 29 May 2020 06:28:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590758918; cv=none; d=google.com; s=arc-20160816; b=m5fOlpfoD47T4ZcXDC5uMjU7LBnGEsMCUBLU3etE+QzHH6ZL5OzkfOsmLMF0vHGX0S 9tMI6+pJAcYeCIWvFTnh+Kr+Uu3iD6fHaJmWOyn5GnkcY8OAEavr/mMvrd50beKHqy9Q zHGKIpeC0sXRCYyphBoipIL9+BObefIbf6lJpuNNYSs19uzndbtlGBLSa8z+6QNPQ6PK yH4araihZbNc0r5EFGHI0rG38cJvlGGxRhMpUsoUIBt4K3mgbUb/utyxXCWHiBzy4SN4 IK182raQYLm6dML/6PZpH30rTHRuhBXKt/So8yGYPAI43eqtRk3CFAgrAue4U7UsNjlE Lw8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=ZiMj99zWqYx+RVOxSgIO1J0zodMGeZc4tyPnAlOvL0s=; b=N0GiNlQCYO4zAJc8ZOc2aYEDOUi/HGcr1iJtt0XVMTE3yWMTeyrFbZDFeXwnvoYNJ5 koAshkCLJSUTam9jgyHWigy2APvwqTlQ733NWWKbc4fNVjYcnQmGTcMWPsCtynQ7xzNs ahkJNKsqla7Yb1OFggTDmccEaQrQca9qLpJowMGW09LdKMtiKL4/U7XHw0fWQ9WTUcfe cDxBJBlgTiCjVBZ0DSHX/b8rlwCNM+nXNA4O4xmjq824RefykeN98ZO8OYPCUK71iLB4 wPSlLxy8I64+6OLzq+af8NaHGQsD91ulF/xmZg6+GpSZdyeWv6eSBM/JhL3t8fZy6E/t Iq5w== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d22si5483774ejj.389.2020.05.29.06.28.13; Fri, 29 May 2020 06:28:38 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726857AbgE2N0Q (ORCPT + 99 others); Fri, 29 May 2020 09:26:16 -0400 Received: from jabberwock.ucw.cz ([46.255.230.98]:45702 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726792AbgE2N0P (ORCPT ); Fri, 29 May 2020 09:26:15 -0400 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 904CF1C0389; Fri, 29 May 2020 15:26:14 +0200 (CEST) Date: Fri, 29 May 2020 15:26:04 +0200 From: Pavel Machek To: William Breathitt Gray Cc: jic23@kernel.org, kamel.bouhara@bootlin.com, gwendal@chromium.org, alexandre.belloni@bootlin.com, david@lechnology.com, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, syednwaris@gmail.com, patrick.havelange@essensium.com, fabrice.gasnier@st.com, mcoquelin.stm32@gmail.com, alexandre.torgue@st.com Subject: Re: [PATCH v2 4/4] docs: counter: Document character device interface Message-ID: <20200529132604.GB1339@bug> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat 2020-05-16 15:20:02, William Breathitt Gray wrote: > This patch adds high-level documentation about the Counter subsystem > character device interface. > > Signed-off-by: William Breathitt Gray > --- > Documentation/driver-api/generic-counter.rst | 112 +++++++++++++------ > 1 file changed, 76 insertions(+), 36 deletions(-) > > diff --git a/Documentation/driver-api/generic-counter.rst b/Documentation/driver-api/generic-counter.rst > index 8f85c30dea0b..58045b33b576 100644 > --- a/Documentation/driver-api/generic-counter.rst > +++ b/Documentation/driver-api/generic-counter.rst > + > +Counter chrdev > +-------------- > +Translates counter data to the standard Counter character device; data > +is transferred via standard character device read/write calls. > + > +Sysfs Interface > +=============== > + > +Several sysfs attributes are generated by the Generic Counter interface, > +and reside under the `/sys/bus/counter/devices/counterX` directory, > +where `X` is to the respective counter device id. Please see > +Documentation/ABI/testing/sysfs-bus-counter for detailed information on > +each Generic Counter interface sysfs attribute. > + > +Through these sysfs attributes, programs and scripts may interact with > +the Generic Counter paradigm Counts, Signals, and Synapses of respective > +counter devices. > + > +Counter Character Device > +======================== > + > +Counter character device nodes are created under the `/dev` directory as > +`counterX`, where `X` is the respective counter device id. Defines for > +the standard Counter data types are exposed via the userspace > +`include/uapi/linux/counter-types.h` file. > + > +The first 196095 bytes of the character device serve as a control > +selection area where control exposure of desired Counter components and > +extensions may be selected. Each byte serves as a boolean selection > +indicator for a respective Counter component or extension. The format of > +this area is as follows: > + > +* For each device extension, a byte is required. > +* For each Signal, a byte is reserved for the Signal component, and a > + byte is reserved for each Signal extension. > +* For each Count, a byte is reserved for the Count component, a byte is > + reserved for the count function, a byte is reserved for each Synapse > + action, and byte is reserved for each Count extension. > + > +The selected Counter components and extensions may then be interfaced > +after the first 196095 bytes via standard character device read/write > +operations. The number of bytes available for each component or > +extension is dependent on their respective data type: u8 will have 1 > +byte available, u64 will have 8 bytes available, strings will have 64 > +bytes available, etc. This looks like very, very strange interface, and not described in detail required to understand it. Could you take a look at input subsystem, /dev/input/event0? Perhaps it is directly usable, and if not something similar should probably be acceptable. Best regards, Pavel