linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: William Breathitt Gray <vilhelm.gray@gmail.com>
To: Gwendal Grignou <gwendal@chromium.org>
Cc: Jonathan Cameron <jic23@kernel.org>,
	linux-iio <linux-iio@vger.kernel.org>,
	Enric Balletbo i Serra <enric.balletbo@collabora.com>,
	Benson Leung <bleung@chromium.org>
Subject: Re: RFC: Present Screen rotation as counter
Date: Wed, 8 Apr 2020 14:02:56 -0400	[thread overview]
Message-ID: <20200408180256.GB25871@icarus> (raw)
In-Reply-To: <CAPUE2uuL8AU8ps=aLGgkqDR3FVxeWCOoMhj+OruZ6YT5Jn+m0Q@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2455 bytes --]

On Wed, Apr 08, 2020 at 12:22:10AM -0700, Gwendal Grignou wrote:
> Today, on chromebook, to detect screen orientation (portrait,
> landscape, inverted portrait, inverted landscape), chrome is polling
> lid accelerometer data and calculating the orientation.
> To save power, I want the embedded controller (EC) to forward an event
> when the lid acceleration detects an orientation change.
> To convey that information, I would like to define a rotary encoder
> with 4 regions, the counter increases when the screen is rotated
> clockwise, (decreases when rotated counter-clockwise) and would
> increment by 4 on a full rotation.
> The EC knows the accelerometer placement relative to the screen, so we
> can define landscape as count % 4 equals to 0.
> Would such a counter fit into the counter subsystem?
> 
> Regards,
> Gwendal.

The Counter subsystem is capable of representing this using a design
that looks something like this:

        Count                Synapse        Signal
        -----                -------        ------
+---------------------+
| Data: Orientation   |     EC Event       _______________
| Function: Rotate    |  <-------------   / Accelerometer \
|                     |                  ___________________
+---------------------+

Note: I'm calling the function "Rotate" here just to represent the
increase/decrease behavior of a rotary device, but perhaps a more
generic name for this function would be better here for other devices as
well.

Essentially, within the Generic Counter paradigm, the Signal in this
case is the accelerometer data. The Synapse is the EC event
(clockwise/counter-clockwise movement detected) that fires when the EC
notices the accelerometer placement changed relative to the screen.
Finally, the Count is the orientation of the screen.

We can have the Count value be an unsigned integer (0-4) to represent
each orientation, or an angle (90 degrees, 180 degrees, etc.) if you
want it to be more abstract -- it's up to you.

By the way, although I'm labeling the Signal and Synapses here as
Accelerometer and EC Event respectively, the counter driver you write
does not need to actually present these raw data values to the user --
I'm just including it here in the drawing to exemplify the paradigm; the
user of this counter driver will likely only care about the Count: the
current orientation value of the screen.

William Breathitt Gray

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2020-04-08 18:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-08  7:22 RFC: Present Screen rotation as counter Gwendal Grignou
2020-04-08 18:02 ` William Breathitt Gray [this message]
2020-04-13 15:28   ` Jonathan Cameron

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=20200408180256.GB25871@icarus \
    --to=vilhelm.gray@gmail.com \
    --cc=bleung@chromium.org \
    --cc=enric.balletbo@collabora.com \
    --cc=gwendal@chromium.org \
    --cc=jic23@kernel.org \
    --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).