LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Jeff LaBundy <jeff@labundy.com>
Cc: linux-input@vger.kernel.org, Geert Uytterhoeven <geert@glider.be>,
	linux-renesas-soc@vger.kernel.org,
	Max Gurtovoy <mgurtovoy@nvidia.com>,
	Hans de Goede <hdegoede@redhat.com>, Wu Hao <hao.wu@intel.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Dan Williams <dan.j.williams@intel.com>,
	Dave Ertman <david.m.ertman@intel.com>,
	Maximilian Luz <luzmaximilian@gmail.com>,
	Stephan Gerhold <stephan@gerhold.net>,
	Xu Yilun <yilun.xu@intel.com>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] Input: add 'safe' user switch codes
Date: Sat, 06 Nov 2021 10:13:15 +0000	[thread overview]
Message-ID: <163619359511.3601475.3667763097540792609@Monstersaurus> (raw)
In-Reply-To: <YYW4d/YK1MkIfGT/@google.com>

Hi Dmitry, Jeff,

Thanks for looking into this,

Quoting Dmitry Torokhov (2021-11-05 23:04:23)
> Hi Jeff, Kieran,
> 
> On Fri, Nov 05, 2021 at 12:00:37PM -0500, Jeff LaBundy wrote:
> > Hi Kieran,
> > 
> > On Fri, Nov 05, 2021 at 10:35:07AM +0000, Kieran Bingham wrote:
> > > All existing SW input codes define an action which can be interpreted by
> > > a user environment to adapt to the condition of the switch.
> > > 
> > > For example, switches to define the audio mute, will prevent audio
> > > playback, and switches to indicate lid and covers being closed may
> > > disable displays.
> > > 
> > > Many evaluation platforms provide switches which can be connected to the
> > > input system but associating these to an action incorrectly could
> > > provide inconsistent end user experiences due to unmarked switch
> > > positions.
> > > 
> > > Define two custom user defined switches allowing hardware descriptions
> > > to be created whereby the position of the switch is not interpreted as
> > > any standard condition that will affect a user experience.
> > > 
> > > This allows wiring up custom generic switches in a way that will allow
> > > them to be read and processed, without incurring undesired or otherwise
> > > undocumented (by the hardware) 'default' behaviours.
> > > 
> > > Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
> > > ---
> > > 
> > > Sigh, a compile test might have at least saved the buildbots the trouble
> > > of notifying me I also need to update the INPUT_DEVICE_ID_SW_MAX. But
> > > even so - I'm really looking for a discussion on the best ways to
> > > describe a non-defined switch in device tree.
> > > 
> > > Here's a compiling v2 ;-) But the real questions are :
> > > 
> > >  - Should an existing feature switch be used for generic switches?
> > >  - Should we even have a 'user' defined switch?
> > >  - If we add user switches, how many?
> > > 
> > 
> > This is merely my opinion, but if a hardware switch does not have a defined
> > purpose, it does not seem necessary to represent it with an input device.
> 
> Yes, exactly. For input core we are trying to avoid generic events with
> no defined meaning.

That's understandable, particularly as I could then ponder - how do we
even define generic switches, and how many ;-) I wanted to discuss it
because otherwise these switches will be defined in DT as buttons. And
they are not buttons...


> What are these switches? GPIOs? Maybe it would be better to use GPIO
> layer to test the state for them?

They are physical slide switches on the board. But they have no defined
purpose by the hardware designer. The purpose would be defined by the
end user, as otherwise they are generic test switches.

These have been previously handled as gpio-key buttons, for instance
key-1 to key-4 at [0] are actually four slides switches. 

[0] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e3414b8c45afa5cdfb1ffd10f5334da3458c4aa5

What I'm trying to determine/promote is that they are not push buttons,
and shouldn't be described as such. I have posted [1] to add support for
these switches, but I am limited to chosing 'functions' which will have
an impact on the system...

[1] https://lore.kernel.org/all/20211025130457.935122-1-kieran.bingham+renesas@ideasonboard.com/

Presently in [1] I have chosen SW_LID and SW_DOCK as very arbitrary
functions for the switches. But my concern is that in doing so, the
SW_LID position could for instance suggest to a window environment or
power management system that the lid is closed, and the system should
be suspended (of course depending upon configurations). That would mean
that the board would now be potentially always heading into a suspend
after power up which would not be at all clear from the switch.

I believe a 'switch' is the correct way to define this hardware, so that
both positions can be determined, and read, and events generated on
state change - but that there shouldn't be any artificially imposed side
effects from the description.

If the answer is "no we can't have generic switches" then so be it, but
it feels wrong to further propogate the definition of these test
switches as keys.

--
Regards

Kieran

  reply	other threads:[~2021-11-06 10:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-05 10:35 [PATCH v2] Input: add 'safe' user switch codes Kieran Bingham
2021-11-05 17:00 ` Jeff LaBundy
2021-11-05 23:04   ` Dmitry Torokhov
2021-11-06 10:13     ` Kieran Bingham [this message]
2021-11-07  6:17       ` Jeff LaBundy
2021-11-08 11:00         ` Geert Uytterhoeven
2021-11-08 12:35           ` Kieran Bingham
2021-11-08 12:41             ` Geert Uytterhoeven

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=163619359511.3601475.3667763097540792609@Monstersaurus \
    --to=kieran.bingham+renesas@ideasonboard.com \
    --cc=bhelgaas@google.com \
    --cc=dan.j.williams@intel.com \
    --cc=david.m.ertman@intel.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=geert@glider.be \
    --cc=hao.wu@intel.com \
    --cc=hdegoede@redhat.com \
    --cc=jeff@labundy.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=luzmaximilian@gmail.com \
    --cc=mgurtovoy@nvidia.com \
    --cc=stephan@gerhold.net \
    --cc=yilun.xu@intel.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).