All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Rob Herring <robh@kernel.org>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>,
	Chen-Yu Tsai <wens@csie.org>,
	linux-input@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	devicetree <devicetree@vger.kernel.org>
Subject: Re: [PATCH 1/4] input: touchscreen: Add generic touchscreen softbutton handling code
Date: Thu, 11 Aug 2016 11:21:44 +0200	[thread overview]
Message-ID: <d95d5b9a-51c2-d45d-62dc-a9e52177a97c@redhat.com> (raw)
In-Reply-To: <58cfd727-bb46-3ea8-85b9-8c17fbed72c5@redhat.com>



On 02-08-16 10:33, Hans de Goede wrote:
> Hi,
>
> On 01-08-16 19:41, Dmitry Torokhov wrote:
>> On Mon, Aug 01, 2016 at 11:54:30AM -0500, Rob Herring wrote:
>>> On Sun, Jul 31, 2016 at 05:23:07PM +0200, Hans de Goede wrote:
>>>> Some touchscreens extend over the display they cover and have a number
>>>> of capacative softbuttons outside of the display the cover.
>>>>
>>>> With some hardware these softbuttons simply report touches with
>>>> coordinates outside of the normal coordinate space for touches on the
>>>> display.
>>>>
>>>> This commit adds a devicetree binding for describing such buttons in
>>>> devicetree and a bunch of helper functions to easily add support for
>>>> these to existing touchscreen drivers.
>>>>
>>>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>>>> ---
>>>>  .../bindings/input/touchscreen/softbuttons.txt     |  58 +++++++++
>>>>  drivers/input/touchscreen/Makefile                 |   2 +-
>>>>  drivers/input/touchscreen/softbuttons.c            | 145 +++++++++++++++++++++
>>>>  include/linux/input/touchscreen.h                  |   9 ++
>>>>  4 files changed, 213 insertions(+), 1 deletion(-)
>>>>  create mode 100644 Documentation/devicetree/bindings/input/touchscreen/softbuttons.txt
>>>>  create mode 100644 drivers/input/touchscreen/softbuttons.c
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/input/touchscreen/softbuttons.txt b/Documentation/devicetree/bindings/input/touchscreen/softbuttons.txt
>>>> new file mode 100644
>>>> index 0000000..3eb6f4c
>>>> --- /dev/null
>>>> +++ b/Documentation/devicetree/bindings/input/touchscreen/softbuttons.txt
>>>> @@ -0,0 +1,58 @@
>>>> +General Touchscreen Softbutton Properties:
>>>> +
>>>> +Some touchscreens extend over the display they cover and have a number
>>>> +of capacative softbuttons outside of the display the cover.
>>>> +
>>>> +Some of these softbuttons simply report touches with coordinates outside of
>>>> +the normal coordinate space for touches on the display. This binding is for
>>>> +describing such buttons in devicetree.
>>>> +
>>>> +Each softkey is represented as a sub-node of the touchscreen node.
>>>> +
>>>> +Required subnode-properties:
>>>> + - label            : Descriptive name of the key.
>>>> + - linux,code            : Keycode to emit.
>>>> + - softbutton-min-x        : X start of the area the softbutton area covers
>>>> + - softbutton-max-x        : X end of the area the softbutton area covers
>>>> + - softbutton-min-y        : Y start of the area the softbutton area covers
>>>> + - softbutton-max-y        : Y end of the area the softbutton area covers
>>>
>>> This generally looks fine to me, but I am wondering one thing. If the
>>> buttons are located at the origin of an axis, can we handle that case? I
>>> don't think you can unless you assume softbutton-max-? is 0 for the
>>> touchscreen. To put it another way, you have a gap from 1024 to 1084
>>> which you can't express for buttons at the origin unless you do negative
>>> numbers.
>>
>> I do not this this should be done in kernel: I do not see nay difference
>> in softbuttons or sliders or circular controls or... They are not
>> controller-specific and I think are better handled in userspace. We do
>> that for Synaptics touchpads with softbuttons, we can do that for other
>> controllers.
>>
>> Also, what is or stance when there is no bezel and we sill want to have
>> the softbutons (i.e. all Nexus phones and tablets)?
>
> Maybe softbuttons is not the best name (I googled and it seemed to match),
> so first lets make clear what I'm talking about here, I wrote this patch-set
> for this tablet:
>
> https://content.hwigroup.net/images/products_xl/157078/dserve-dsrv-9703c.jpg
>
> I decided to make it generic, since it seemed to me that there will likely
> be other hardware which is similar (but uses a different touch screen
> controller) out there, so keeping this generic seemed best.
>
> Now back to the kernelspace vs userspace solution question, if you look at
> the picture you will see 3 clearly marked buttons on the front of the tablet,
> outside of the display: menu, home and back. These are not buttons which get
> generated / drawn on the display when you touch the bottom of the screen, these
> are separate single-purpose buttons which happen to report presses via the
> touchscreen controller then via a separate hw mechanism.
>
> If these buttons used a separate capacative button controller as used in
> e.g. capacitive numpads, say something like this:
>
> http://www.ebay.com/itm/2PCS-TTP223-Capacitive-Touch-Switch-Button-Self-Lock-Module-for-Arduino-/131662428748
>
> Then there would be no question that this belongs in the kernel. I do not
> see how these are any different really. These cannot be runtime re-configured,
> they are separate dedicated buttons which happens to report presses via
> the touchscreen controllers.
>
> There also is the question of hardware description, no matter where we
> put support for this, we need some place were we describe the presence
> of these buttons to the software bits which end up dealing with them.
>
> And we already have a mechanism for describing "fixed" hardware for a
> certain model machine / board in the form of devicetree. To me putting
> the hardware description for this anywhere but in devicetree makes
> no sense because then we start scattering the description of a single
> device-type over multiple places which seems like a bad idea.
>
> And once we decided to put the description in devicetree, then dealing
> with this in the kernel becomes the logical thing to do.
>
> Regards,
>
> Hans
>
>
> p.s.
>
> One other example of buttons like these are those on the nexus one:
>
> http://www.informatica.com.do/7BZ-PortalImageUpload/image/2010151059110.google-nexus-one-01.jpg
>
> Note I'm not saying this binding will work for those, I've no idea how
> they are hooked up, but they are the same in that they are really
> 4 dedicated separate buttons which happen to be part of the main digitizer.

Dmitry, ping? Any reaction to the above ?

Regards,

Hans


p.s.

I've been thinking a bit more about this, trying to envision a reasonable
user-space solution and I do not really see any. IMHO this really belongs
in the kernel, and it is not a lot of code, the basic softbutton core is
quite small, and the actually needed touchscreen driver changer are
only a couple of line, so it is not like doing this in the kernel is
a hassle, where as doing this in userspace will be a hassle.

WARNING: multiple messages have this Message-ID (diff)
From: hdegoede@redhat.com (Hans de Goede)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/4] input: touchscreen: Add generic touchscreen softbutton handling code
Date: Thu, 11 Aug 2016 11:21:44 +0200	[thread overview]
Message-ID: <d95d5b9a-51c2-d45d-62dc-a9e52177a97c@redhat.com> (raw)
In-Reply-To: <58cfd727-bb46-3ea8-85b9-8c17fbed72c5@redhat.com>



On 02-08-16 10:33, Hans de Goede wrote:
> Hi,
>
> On 01-08-16 19:41, Dmitry Torokhov wrote:
>> On Mon, Aug 01, 2016 at 11:54:30AM -0500, Rob Herring wrote:
>>> On Sun, Jul 31, 2016 at 05:23:07PM +0200, Hans de Goede wrote:
>>>> Some touchscreens extend over the display they cover and have a number
>>>> of capacative softbuttons outside of the display the cover.
>>>>
>>>> With some hardware these softbuttons simply report touches with
>>>> coordinates outside of the normal coordinate space for touches on the
>>>> display.
>>>>
>>>> This commit adds a devicetree binding for describing such buttons in
>>>> devicetree and a bunch of helper functions to easily add support for
>>>> these to existing touchscreen drivers.
>>>>
>>>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>>>> ---
>>>>  .../bindings/input/touchscreen/softbuttons.txt     |  58 +++++++++
>>>>  drivers/input/touchscreen/Makefile                 |   2 +-
>>>>  drivers/input/touchscreen/softbuttons.c            | 145 +++++++++++++++++++++
>>>>  include/linux/input/touchscreen.h                  |   9 ++
>>>>  4 files changed, 213 insertions(+), 1 deletion(-)
>>>>  create mode 100644 Documentation/devicetree/bindings/input/touchscreen/softbuttons.txt
>>>>  create mode 100644 drivers/input/touchscreen/softbuttons.c
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/input/touchscreen/softbuttons.txt b/Documentation/devicetree/bindings/input/touchscreen/softbuttons.txt
>>>> new file mode 100644
>>>> index 0000000..3eb6f4c
>>>> --- /dev/null
>>>> +++ b/Documentation/devicetree/bindings/input/touchscreen/softbuttons.txt
>>>> @@ -0,0 +1,58 @@
>>>> +General Touchscreen Softbutton Properties:
>>>> +
>>>> +Some touchscreens extend over the display they cover and have a number
>>>> +of capacative softbuttons outside of the display the cover.
>>>> +
>>>> +Some of these softbuttons simply report touches with coordinates outside of
>>>> +the normal coordinate space for touches on the display. This binding is for
>>>> +describing such buttons in devicetree.
>>>> +
>>>> +Each softkey is represented as a sub-node of the touchscreen node.
>>>> +
>>>> +Required subnode-properties:
>>>> + - label            : Descriptive name of the key.
>>>> + - linux,code            : Keycode to emit.
>>>> + - softbutton-min-x        : X start of the area the softbutton area covers
>>>> + - softbutton-max-x        : X end of the area the softbutton area covers
>>>> + - softbutton-min-y        : Y start of the area the softbutton area covers
>>>> + - softbutton-max-y        : Y end of the area the softbutton area covers
>>>
>>> This generally looks fine to me, but I am wondering one thing. If the
>>> buttons are located at the origin of an axis, can we handle that case? I
>>> don't think you can unless you assume softbutton-max-? is 0 for the
>>> touchscreen. To put it another way, you have a gap from 1024 to 1084
>>> which you can't express for buttons at the origin unless you do negative
>>> numbers.
>>
>> I do not this this should be done in kernel: I do not see nay difference
>> in softbuttons or sliders or circular controls or... They are not
>> controller-specific and I think are better handled in userspace. We do
>> that for Synaptics touchpads with softbuttons, we can do that for other
>> controllers.
>>
>> Also, what is or stance when there is no bezel and we sill want to have
>> the softbutons (i.e. all Nexus phones and tablets)?
>
> Maybe softbuttons is not the best name (I googled and it seemed to match),
> so first lets make clear what I'm talking about here, I wrote this patch-set
> for this tablet:
>
> https://content.hwigroup.net/images/products_xl/157078/dserve-dsrv-9703c.jpg
>
> I decided to make it generic, since it seemed to me that there will likely
> be other hardware which is similar (but uses a different touch screen
> controller) out there, so keeping this generic seemed best.
>
> Now back to the kernelspace vs userspace solution question, if you look at
> the picture you will see 3 clearly marked buttons on the front of the tablet,
> outside of the display: menu, home and back. These are not buttons which get
> generated / drawn on the display when you touch the bottom of the screen, these
> are separate single-purpose buttons which happen to report presses via the
> touchscreen controller then via a separate hw mechanism.
>
> If these buttons used a separate capacative button controller as used in
> e.g. capacitive numpads, say something like this:
>
> http://www.ebay.com/itm/2PCS-TTP223-Capacitive-Touch-Switch-Button-Self-Lock-Module-for-Arduino-/131662428748
>
> Then there would be no question that this belongs in the kernel. I do not
> see how these are any different really. These cannot be runtime re-configured,
> they are separate dedicated buttons which happens to report presses via
> the touchscreen controllers.
>
> There also is the question of hardware description, no matter where we
> put support for this, we need some place were we describe the presence
> of these buttons to the software bits which end up dealing with them.
>
> And we already have a mechanism for describing "fixed" hardware for a
> certain model machine / board in the form of devicetree. To me putting
> the hardware description for this anywhere but in devicetree makes
> no sense because then we start scattering the description of a single
> device-type over multiple places which seems like a bad idea.
>
> And once we decided to put the description in devicetree, then dealing
> with this in the kernel becomes the logical thing to do.
>
> Regards,
>
> Hans
>
>
> p.s.
>
> One other example of buttons like these are those on the nexus one:
>
> http://www.informatica.com.do/7BZ-PortalImageUpload/image/2010151059110.google-nexus-one-01.jpg
>
> Note I'm not saying this binding will work for those, I've no idea how
> they are hooked up, but they are the same in that they are really
> 4 dedicated separate buttons which happen to be part of the main digitizer.

Dmitry, ping? Any reaction to the above ?

Regards,

Hans


p.s.

I've been thinking a bit more about this, trying to envision a reasonable
user-space solution and I do not really see any. IMHO this really belongs
in the kernel, and it is not a lot of code, the basic softbutton core is
quite small, and the actually needed touchscreen driver changer are
only a couple of line, so it is not like doing this in the kernel is
a hassle, where as doing this in userspace will be a hassle.

  reply	other threads:[~2016-08-11  9:21 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-31 15:23 [PATCH 0/4] input: touchscreen: Add generic touchscreen softbutton support Hans de Goede
2016-07-31 15:23 ` Hans de Goede
2016-07-31 15:23 ` [PATCH 1/4] input: touchscreen: Add generic touchscreen softbutton handling code Hans de Goede
2016-07-31 15:23   ` Hans de Goede
2016-08-01 16:54   ` Rob Herring
2016-08-01 16:54     ` Rob Herring
2016-08-01 17:41     ` Dmitry Torokhov
2016-08-01 17:41       ` Dmitry Torokhov
2016-08-02  8:33       ` Hans de Goede
2016-08-02  8:33         ` Hans de Goede
2016-08-11  9:21         ` Hans de Goede [this message]
2016-08-11  9:21           ` Hans de Goede
2016-08-02  8:19     ` Hans de Goede
2016-08-02  8:19       ` Hans de Goede
     [not found] ` <1469978590-14081-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-07-31 15:23   ` [PATCH 2/4] input: touchscreen: Add LED trigger support to the softbutton code Hans de Goede
2016-07-31 15:23     ` Hans de Goede
2016-07-31 15:23   ` [PATCH 3/4] input: touchscreen: edt-ft5x06: Add support for softbuttons Hans de Goede
2016-07-31 15:23     ` Hans de Goede
2016-07-31 15:23 ` [PATCH 4/4] ARM: dts: sun4i: Describe softbuttons in dserve-dsrv9703c touchscreen node Hans de Goede
2016-07-31 15:23   ` Hans de Goede

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=d95d5b9a-51c2-d45d-62dc-a9e52177a97c@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-input@vger.kernel.org \
    --cc=maxime.ripard@free-electrons.com \
    --cc=robh@kernel.org \
    --cc=wens@csie.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.