linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jonathan.cameron@huawei.com>
To: William Breathitt Gray <vilhelm.gray@gmail.com>
Cc: David Lechner <david@lechnology.com>,
	<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
Date: Fri, 6 Jul 2018 18:21:54 +0100	[thread overview]
Message-ID: <20180706182154.0000002d@huawei.com> (raw)
In-Reply-To: <20180703024835.GA9493@sophia>

On Mon, 2 Jul 2018 22:48:35 -0400
William Breathitt Gray <vilhelm.gray@gmail.com> 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



  reply	other threads:[~2018-07-06 17:22 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-21 21:06 [PATCH v7 00/10] Introduce the Counter subsystem William Breathitt Gray
2018-06-21 21:07 ` [PATCH v7 01/10] counter: Introduce the Generic Counter interface William Breathitt Gray
2018-07-07 15:16   ` Greg KH
2018-07-09 17:40     ` William Breathitt Gray
2018-07-09 18:54       ` Greg KH
2018-07-09 18:56         ` William Breathitt Gray
2018-07-18  3:49   ` Andrew Morton
2018-07-21 16:26     ` William Breathitt Gray
2018-07-22  5:41       ` Andrew Morton
2018-06-21 21:07 ` [PATCH v7 02/10] counter: Documentation: Add Generic Counter sysfs documentation William Breathitt Gray
2018-07-02 19:11   ` [v7, " David Lechner
2018-07-03 14:04     ` William Breathitt Gray
2018-06-21 21:07 ` [PATCH v7 03/10] docs: Add Generic Counter interface documentation William Breathitt Gray
2018-06-22 16:51   ` Jonathan Cameron
2018-07-02 19:37   ` [v7,03/10] " David Lechner
2018-07-03 14:16     ` William Breathitt Gray
2018-07-04 17:23       ` Linus Walleij
2018-07-06 17:15         ` Jonathan Cameron
2018-07-06 18:25           ` David Lechner
2018-07-02 19:42   ` David Lechner
2018-07-03 14:21     ` William Breathitt Gray
2018-06-21 21:07 ` [PATCH v7 04/10] counter: 104-quad-8: Add Generic Counter interface support William Breathitt Gray
2018-06-22 16:57   ` Jonathan Cameron
2018-06-21 21:08 ` [PATCH v7 05/10] counter: 104-quad-8: Documentation: Add Generic Counter sysfs documentation William Breathitt Gray
2018-06-22 16:59   ` Jonathan Cameron
2018-06-21 21:08 ` [PATCH v7 06/10] counter: Add STM32 Timer quadrature encoder William Breathitt Gray
2018-06-22 17:03   ` Jonathan Cameron
2018-06-21 21:08 ` [PATCH v7 07/10] dt-bindings: counter: Document stm32 " William Breathitt Gray
2018-07-02 19:56   ` [v7,07/10] " David Lechner
2018-07-05 21:13   ` [PATCH v7 07/10] " Rob Herring
2018-06-21 21:08 ` [PATCH v7 08/10] counter: stm32-lptimer: add counter device William Breathitt Gray
2018-06-22 17:06   ` Jonathan Cameron
2018-06-21 21:08 ` [PATCH v7 09/10] dt-bindings: counter: Adjust dt-bindings for STM32 lptimer move William Breathitt Gray
2018-07-05 21:13   ` Rob Herring
2018-06-21 21:09 ` [PATCH v7 10/10] iio: counter: Add deprecation markings for IIO Counter attributes William Breathitt Gray
2018-06-22 17:10 ` [PATCH v7 00/10] Introduce the Counter subsystem Jonathan Cameron
2018-07-02 18:13 ` David Lechner
2018-07-03  2:48   ` William Breathitt Gray
2018-07-06 17:21     ` Jonathan Cameron [this message]
2018-07-06 18:22       ` David Lechner
2018-07-06 19:20         ` William Breathitt Gray

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180706182154.0000002d@huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=benjamin.gaignard@st.com \
    --cc=david@lechnology.com \
    --cc=devicetree@vger.kernel.org \
    --cc=fabrice.gasnier@st.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=pmeerw@pmeerw.net \
    --cc=robh+dt@kernel.org \
    --cc=vilhelm.gray@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).