linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: William Breathitt Gray <vilhelm.gray@gmail.com>
To: Felipe Balbi <felipe.balbi@linux.intel.com>
Cc: linux-iio@vger.kernel.org
Subject: Re: [RFC/PATCH] counter: introduce support for Intel QEP Encoder
Date: Tue, 17 Sep 2019 20:46:15 +0900	[thread overview]
Message-ID: <20190917114403.GA8368@icarus> (raw)
In-Reply-To: <20190916093431.264504-1-felipe.balbi@linux.intel.com>

On Mon, Sep 16, 2019 at 12:34:31PM +0300, Felipe Balbi wrote:
> Add support for Intel PSE Quadrature Encoder
> 
> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
> ---
> 
> Hi William,
> 
> Here's a first cut of the ported driver. Note that this is really an RFC as
> there's still quite a bit I don't fully understand. I've left some of my old
> sysfs files in there just to keep track of which features I'm still missing.

Hi Felipe,

That is understandable since this is an RFC; I expect in your final
version those sysfs files will be Counter subsystem extension
attributes.

For reference, the existing Counter subsystem attributes are documented
in the Documentation/ABI/testing/sysfs-bus-counter file. If you have any
new attributes specific to the Intel QEP driver, add them as a new
Documentation/ABI/testing/sysfs-bus-counter-intel-qep file.

> If understood this correctly, I should add noise filtering as a signal
> extension, right? Same for Input Swap.

Determining the type of extension to create is a matter of scope.

* Signal extensions are attributes which expose information/control
  specific to a Signal. These types of attributes will exist under a
  Signal's directory in sysfs.

  For example, if have an invert feature for a Signal, you can have a
  Signal extension called "invert" that toggles that feature:
  /sys/bus/counter/devices/counterX/signalY/invert

* Count extensions are attributes which expose information/control
  specific to a Count. These type of attributes will exist under a
  Count's directory in sysfs.

  For example, if you want to pause/unpause a Count from updating, you
  could have a Count extension called "enable" that toggles such:
  /sys/bus/counter/devices/counterX/countY/enable

* Device extensions are attributes which expose information/control
  non-specific to a particular Count or Signal. This is where you would
  put your global features or other miscellanous functionality.

  For example, if your device has an overtemp sensor, you could report
  the chip overheated via a device extension called "error_overtemp":
  /sys/bus/counter/devices/counterX/error_overtemp

I'm not very familiar with the Intel QEP features, so I'll need your
help clarifying some of it for me. I'm assuming "noise filtering" is
a feature you can enable per individual Signal (is this correct?). If
so, then it would be implemented as a Signal extension, maybe as a
/sys/bus/counter/devices/counterX/signalY/noise_filter_enable file.
Otherwise, it would be a device attribute if it enables noise filtering
over all Signals.

Is "Input Swap" swapping the Phase A and Phase B signal lines for each
Count? If so, this would be a Count extension if you can configure it
per Count; otherwise a device extension if it's globally enabled for all
Counts.

If you're still having trouble figuring out which type of extension to
use, give me a simple breakdown of the features you are trying to
support with these attributes and I should be able to specify which type
works best for each.
 
> How should we handle the reset mode of the device? And mode of operation?

Is "reset mode" specifying the condition that causes a Count's count to
be reset back to a value of 0? If so, I assume "index" means an active
level on the index line will reset the count; does "maximum" mean the
index line is ignored and the reset operation is simply activated once
the ceiling is reached? As well, I'm assuming this is a global
configuration for all counts.

If my assumptions are correct here, then this behavior can be exposed
by creating two device extensions: "preset" and "preset_enable"; these
should be based on the existing two same-named Count attributes (see the
Documentation/ABI/testing/sysfs-bus-counter file).

* /sys/bus/counter/devices/counterX/preset
  For the Intel QEP, this will be a read-only that always report "0".

* /sys/bus/counter/devices/counterX/preset_enable
  Assuming "maximum" is just equivalent to ignoring index, preset_enable
  can toggle between the two modes as a simple boolean: "1" = "index"
  and "0" = "maximum".

  If I assumed incorrectly, please let me know and we can discuss the
  possibility of a new attribute (perhaps "preset_mode").

Take a look inside 104-quad-8.c to see how it handles index lines and
reseting the counts; "preset" and "preset_enable" extensions are
specified in the quad8_count_ext array.

> If you have any ideas, let me know.
> 
> cheers

Since I expect a good amount of this code to change once the extensions
are added, I'll hold off on a more in-depth code review until we get it
closer to what it'll actually look like. From skimming the code in this
RFC, it seems like you have the core Counter subsystem functions and
structures use correct, so I think it'll be the implementations of the
extensions that we'll be focusing on.

William Breathitt Gray

  reply	other threads:[~2019-09-17 11:46 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-16  9:34 [RFC/PATCH] counter: introduce support for Intel QEP Encoder Felipe Balbi
2019-09-17 11:46 ` William Breathitt Gray [this message]
2019-09-17 12:07   ` Felipe Balbi
2019-09-17 13:02     ` William Breathitt Gray
2019-09-19  8:03   ` [RFC/PATCH 1/2] counter: add support for Quadrature x4 with swapped inputs Felipe Balbi
2019-09-19  8:03     ` [RFC/PATCHv2 2/2] counter: introduce support for Intel QEP Encoder Felipe Balbi
2019-09-22 23:35       ` William Breathitt Gray
2019-09-24  9:46         ` Felipe Balbi
2019-09-24 11:32           ` William Breathitt Gray
2019-09-24 11:35             ` Felipe Balbi
2019-10-01  9:32               ` [PATCH v3 1/2] counter: add support for Quadrature x4 with swapped inputs Felipe Balbi
2019-10-01  9:32                 ` [PATCH v3 2/2] counter: introduce support for Intel QEP Encoder Felipe Balbi
2019-10-02 18:11                   ` William Breathitt Gray
2019-10-02 16:37                 ` [PATCH v3 1/2] counter: add support for Quadrature x4 with swapped inputs William Breathitt Gray
2019-10-03 12:38             ` [RFC/PATCHv2 2/2] counter: introduce support for Intel QEP Encoder Jonathan Cameron
2019-09-24 21:46         ` David Lechner
2019-09-28 21:33           ` William Breathitt Gray
2019-09-30  5:22             ` Felipe Balbi
2019-10-02  0:34               ` William Breathitt Gray
2019-10-03 13:14                 ` Jonathan Cameron
2019-10-16 20:20                   ` William Breathitt Gray
2019-10-17 12:29                     ` Jonathan Cameron
2019-09-24 11:37     ` [RFC/PATCH 1/2] counter: add support for Quadrature x4 with swapped inputs 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=20190917114403.GA8368@icarus \
    --to=vilhelm.gray@gmail.com \
    --cc=felipe.balbi@linux.intel.com \
    --cc=linux-iio@vger.kernel.org \
    /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).