Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp2021688imm; Fri, 6 Jul 2018 10:23:11 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdp7vnlrCZ/OlzRSxq5T0cVYRv6E0jNaO3I5FL8bdLo+T7eu5e5XIVRSM0hHQq/PyLK3VV4 X-Received: by 2002:a65:520d:: with SMTP id o13-v6mr10059114pgp.282.1530897790966; Fri, 06 Jul 2018 10:23:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530897790; cv=none; d=google.com; s=arc-20160816; b=Jz48voKCSBpg+p555LqiFcwFDFiu8sKTvG0zuiv+Q7XtryPVZFOYCbxfMwV3R8TPWe BYD+d72yGEW/VRDHwMDDMwQ65KAyx3DPNddO0le3DD2ESeTV630MtJ8cLW1/mHKoC63M 914TKBF4pF816mt9PTC05zkdMHobnaQjEBAvwZSj9OsFkN4P4VPP39Ck45Bx+YuHZ3RR JQMdjLEKAM9/yVUD2bPsVJzvk0OSLDnEcY3kMnzd0nhXSEN0yw+kJWvlY3ImyieghwBD QfPVAGDRHE5jVSvSq71pKClndYxTeJCI0MMFZ02CWswFNR2hnYJnY6PmkfLEXVOBOiBN y7EA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:arc-authentication-results; bh=SHhvpTsktkbitsv1NFn0N7gssh2uKuKc2TPrjqlZJNU=; b=Nmny/IN93PpsXNXTQ3hHoL17fn8V8j9l4/ikaejgaDojCkxzOckckWea26WfbQ1lxe gLz4S46eez0jUgMbmImfpNe5G8iHdpB73U5wn0nN+klnnEac4mu+NEJ3x9m7yGxYNY4j 9NiGTU3hUQJdSBYpZFv7IcvG/eini4fdLxpGRSPMsS8omxKFi7jKNDJTd3wM7xFJRvxO Ld9ExHO9hIeCMctzMHgBdl15fFJOM65M5LaE/fznrqOpRPHU2w7Y8VGzXKqKWsFNGEUA rPsjwxxtXxEkpvDajix4HWFz2Nne15tMN4NoYU2ELf36l+DiQTGoTRjog+Eqgo+PStcY jOdw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g14-v6si8495619plo.95.2018.07.06.10.22.56; Fri, 06 Jul 2018 10:23:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933568AbeGFRWR (ORCPT + 99 others); Fri, 6 Jul 2018 13:22:17 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:58665 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932776AbeGFRWP (ORCPT ); Fri, 6 Jul 2018 13:22:15 -0400 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 7B1D692182E7F; Sat, 7 Jul 2018 01:22:08 +0800 (CST) Received: from localhost (10.202.226.43) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.382.0; Sat, 7 Jul 2018 01:22:07 +0800 Date: Fri, 6 Jul 2018 18:21:54 +0100 From: Jonathan Cameron To: William Breathitt Gray CC: David Lechner , , , , , , , , , , , , , Subject: Re: [PATCH v7 00/10] Introduce the Counter subsystem Message-ID: <20180706182154.0000002d@huawei.com> In-Reply-To: <20180703024835.GA9493@sophia> References: <603b0373-f1e1-5938-fa53-8328c9a5964f@lechnology.com> <20180703024835.GA9493@sophia> Organization: Huawei X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; i686-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.202.226.43] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2 Jul 2018 22:48:35 -0400 William Breathitt Gray wrote: > On Mon, Jul 02, 2018 at 01:13:40PM -0500, David Lechner wrote: > >On 06/21/2018 04:06 PM, William Breathitt Gray wrote: > >> I decided to strip down these devices to arrive at the core essence of > >> what constitutes a "counter device" and therefore design a "generic > >> counter" abstraction to better represent these devices and prevent the > >> ambiguity we discovered with the existing IIO Counter interface. This > >> abstraction became the Generic Counter paradigm, which is explained in > >> detail within the Documentation/driver-api/generic-counter.rst file > >> introduced by this patchset. > > > >I'm curious if you have given any thought to the time aspect of counters. > >I am interested in the rate at which the counters are counting (e.g. how > >many counts per second). I realize that you can calculate this in > >userspace or in the kernel using the system timer, but it is not very > >accurate since Linux is not a realtime OS. So, I would like to get the > >rate directly from the hardware. For example, the TI eQEP[1], like the > >one found in BeagleBones, has a couple ways of measuring time (see link > >for details). > > > >[1]: http://www.ti.com/lit/ug/sprug05a/sprug05a.pdf Cool in eQEP if that is what you are targetting - been wanting to see nice kernel support implemented for that for a long time, but never got the spare cycles to do it myself! > > Ah yes, I see you initially attempted adding a frequency channel type to > the IIO code. I agree with you that this calculation is best kept away > from the operating system, not just because of the realtime requirement > considerations, but also because the hardware likely knows best its own > data, so let's expose it! > > Regarding the Generic Counter interface, a frequency attribute can be > added quite easily in a technical sense, so this discussion should be > focused more on the warrant for exposing this data. I understand from > the discussion thread on your initial patch submission that you're > working with hot-swappable encoder wheels and would like to expose a > counting rate since you have trouble otherwise knowing the number of > counts equal to one revolution due to the various possible encoder > wheels that could be installed -- do I understand this correctly? > > Luckily the Generic Counter interface is a more abstract paradigm, so > the hot-swappable encoder wheels should not be a problem for us as long > as we nail down a consistent and thorough definition for this attribute. > To that end, since the Generic Counter paradigm is designed to abstract > away specifics of counter devices in order to present the final data of > interest to users (e.g. the count value, the mode of operation, etc.), > let's make sure frequency is actually what we want to expose and not > just a middle-step datum on the path to the final result. > > What is the real life use-case for this information (are you tracking > position)? Does the relevant hardware report the number of counts equal > to one revolution, or are you calculating this from frequency? Are you > using this frequency to simply track the number of revolutions? Should > revolution count also be exposed? Is frequency useful for other > applications on its own (perhaps velocity of an automobile device > equipped with an encoder wheel for some reason or other)? > > Once we figure out how this data is used, we can determine the best > design and place to introduce it into the Generic Counter interface, > then move on to integration from there. Great - as long as this fits reasonably well in ABI wise (whatever the details) sounds like we don't need to solve it today. I'm anxious not to delay merging this counter subsystem for another cycle. Jonathan > > William Breathitt Gray > -- > To unsubscribe from this list: send the line "unsubscribe linux-iio" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html