Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp653084imm; Mon, 2 Jul 2018 19:49:41 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc2nyazLVCciGASsy3g4T1h429Y+77O93HUJOWMOkRdJYdFezJy8GRVFqiwh+i/KY4juwbF X-Received: by 2002:a62:4255:: with SMTP id p82-v6mr27961502pfa.227.1530586181532; Mon, 02 Jul 2018 19:49:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530586181; cv=none; d=google.com; s=arc-20160816; b=Dh3PCSMXBRfTrK+FRYf/jFfZsPEdiNOcy19fpPlu6IEPJs/W2H3LQm6akSLhTDfHh5 V3q3Bm3Q1/Go99E/qmsMRS5h+S3qGA6J870iXz5egOWku/jmmRidpCNRouZLaN/UVHmP lew6UVKkSH5W3Gf7oqwwF3dk+r5yRDZkeqv92561Z36CzZYJKFMNXYGk0EsY5jIamAKN NQGYNpSPaPO2RZFzm6LouY8LKqo950ccEOW10OlX3Tc32j6XMfIk0CoqWwzHJHADAALx B77d7qQ5kNq+OTIk3ymD3gAP847dvAv7TNp4ivEDtznjLlQm35hPVAiyDhUR2zY9bTCn fe8A== 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:dkim-signature:arc-authentication-results; bh=jzOgsFx75bprPfF/GiE/pCF372lX9XtG0R81km2L3zM=; b=fg//BQM705gddawBeIuiuzoHJZNs0a29Q3YQD3WRFectgMz5KOKkW4InMfu2QDrH/u TVAiGnRbYgR1B3W31XNzqhqyc/zNG5SiIckgwlAiie3Wyq9F68Y8oWdDjvOt15UyQokm bx6ib9xaK3E3jwfDqNw4q+HLAiv19rXfn1VkPCAFCjYhztvgClGPtgQRuQOVotm0Vc72 isVc1dgSUHVk7vtiSdrBkxtccIUk3T4UkfzVMRc6FXdQGWgBl4ZkURLX3puhVAs4kWp7 H1nR4lsG9s10uDbg8cjvLJtCGB5rYsLiLbTErr9mmzLcFcKuZU61QluEYDHcRZGJi5O1 91VA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="EZaz/dn0"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j69-v6si56176pgd.118.2018.07.02.19.49.26; Mon, 02 Jul 2018 19:49:41 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b="EZaz/dn0"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932573AbeGCCst (ORCPT + 99 others); Mon, 2 Jul 2018 22:48:49 -0400 Received: from mail-yb0-f193.google.com ([209.85.213.193]:41073 "EHLO mail-yb0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932120AbeGCCsr (ORCPT ); Mon, 2 Jul 2018 22:48:47 -0400 Received: by mail-yb0-f193.google.com with SMTP id s8-v6so162405ybe.8; Mon, 02 Jul 2018 19:48:46 -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:user-agent; bh=jzOgsFx75bprPfF/GiE/pCF372lX9XtG0R81km2L3zM=; b=EZaz/dn0qZsg2vf54pqKdB0hFbzDbrk29x/QkRqQbZWlBa0e7BHXbIBroPuOHiANBI AQWQIsWUQnmc7C6ChPXWyO0ErThCl49g2WEqVnUKPnvKO2I1+HTva9b+Xfxi4KR9O44V J4iEk6rR7vBYZQQAIt0iXGVTrHNnjlvO9Qo1LQygjEkgkqNJUl6aXoC/ibx/Pvs8mB51 QE+ocsU3uv1Z7KHYPh4FPzDG+TI1GMmtXThYCJWkoJ/kRX3A2y8uMY77+M7rjPRMmcKz t+217hyZc8HLQiOqamy4cCwLQSLibk0WDuLPA0sANLScBzCSZcpWRh6WUH1t9/rCnvQq lkEA== 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:user-agent; bh=jzOgsFx75bprPfF/GiE/pCF372lX9XtG0R81km2L3zM=; b=TzAYlJLpQQTkMYFvaTHsBwAe1zzdG/mSUEQznuvfXKR3i53WhXjqttfCON45VpFUc8 imic7vei0xTaWoJRW+qNPgBNQpGgDSVGBweGTgwT2hazuRuNr4z9GF26SCdBv+33vnSG Aaq+he6f+8bAt7mlSySf7DQp9zLV5hxjfwzvlUK8yQzc+MmRfaIz8AKYdEm6KtQgbeFn AwOvq1Qmlxq2zw79sOxis+F4sOpPlFBzVLHo0b+5J6O8g5+eIZnwZtkLxqm9GjOBfpcX O4u8DuFBhO2+b4CJYAJCbMeurmtal7sWRyaXj/Krjn72uZnA1Wt32R5ZIBLMeOPTgoNl 916w== X-Gm-Message-State: APt69E1nOqUuFO6nH1X5F8uueGqHBehVO2E2T+ERLWPvpbnhs52zTqQ2 B3kpF3Jb3aGfBBrQWbHekGQ= X-Received: by 2002:a25:bf90:: with SMTP id l16-v6mr15074076ybk.390.1530586126397; Mon, 02 Jul 2018 19:48:46 -0700 (PDT) Received: from sophia ([72.188.97.40]) by smtp.gmail.com with ESMTPSA id b68-v6sm24480ywh.68.2018.07.02.19.48.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Jul 2018 19:48:45 -0700 (PDT) Date: Mon, 2 Jul 2018 22:48:35 -0400 From: William Breathitt Gray To: David Lechner Cc: gregkh@linuxfoundation.org, jic23@kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, fabrice.gasnier@st.com, benjamin.gaignard@st.com, robh+dt@kernel.org, knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, mark.rutland@arm.com Subject: Re: [PATCH v7 00/10] Introduce the Counter subsystem Message-ID: <20180703024835.GA9493@sophia> References: <603b0373-f1e1-5938-fa53-8328c9a5964f@lechnology.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <603b0373-f1e1-5938-fa53-8328c9a5964f@lechnology.com> User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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. William Breathitt Gray