From: Javier Carrasco <javier.carrasco@wolfvision.net>
To: Jeff LaBundy <jeff@labundy.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Conor Dooley <conor+dt@kernel.org>,
Henrik Rydberg <rydberg@bitmath.org>,
Bastian Hecht <hechtb@gmail.com>,
Michael Riesch <michael.riesch@wolfvision.net>,
linux-kernel@vger.kernel.org, linux-input@vger.kernel.org,
devicetree@vger.kernel.org
Subject: Re: [PATCH v3 1/4] Input: ts-overlay - Add touchscreen overlay object handling
Date: Sat, 1 Jul 2023 22:58:54 +0200 [thread overview]
Message-ID: <ed1f627b-1713-b273-c083-c98d88f885d2@wolfvision.net> (raw)
In-Reply-To: <ZJj5VcHvfMMWMRx8@nixie71>
Hi Jeff,
On 26.06.23 04:35, Jeff LaBundy wrote:
>> +
>> + dev_info(dev, "Added button at (%u, %u), size %ux%u, code=%u\n",
>> + btn[j].shape.x_origin, btn[j].shape.y_origin,
>> + btn[j].shape.x_size, btn[j].shape.y_size, btn[j].key);
>
> This seems like a dev_dbg() to me.
>
>> + j++;
>> + }
>> +
>> + return 0;
>> +
>> +button_prop_cleanup:
>> + fwnode_handle_put(child_btn);
>> + return rc;
>> +}
>> +
>> +void ts_overlay_set_button_caps(struct ts_overlay_map *map,
>> + struct input_dev *dev)
>> +{
>> + int i;
>> +
>> + for (i = 0; i < map->button_count; i++)
>> + input_set_capability(dev, EV_KEY, map->buttons[i].key);
>> +}
>> +EXPORT_SYMBOL(ts_overlay_set_button_caps);
>
> I don't see a need to expose this function and require participating drivers
> to call it; we should just have one over-arching function for processing the
> overlay(s), akin to touchscreen_parse_properties but for the button input
> device in case the driver separates the button and touchscreen input devices.
>
> That one function would then be responsible for parsing the overlay(s) and
> calling input_set_capability() on each button.
>
I just realized that I did not reply anything about this, even though
there is a reason why I exposed this function and now that I am working
on the v4, some clarification might be required.
After it was decided that this feature should work with two different
devices (a touchscreen and a keypad), I registered a keypad in the
st1232.c probe function if overlay buttons were defined. I did not
register the device inside the new functions because I thought that I
would be hiding too much magic from the driver.
Instead I provided a function to check if a keypad was defined and
another one to set the capabilities (the one we are discussing). The
driver could just set any parameters it wants before registering the
device and use this function within that process. The parsing is not
missing, it is carried out before and the programmer does not need to
know the key capabilities to call this function.
So the process is as follows:
1.- Map overlay objects if they are defined.
2.- If there is a keypad, set the device properties you want it to have
(name, etc). The event keys were already parsed and can be set with
touch_overlay_set_button_caps()
3.- Register the device whenever and under the circumstances you like.
That is the current implementation, not necessarily the best one or the
one the community would prefer.
If that is preferred, the mapping function could for example register
the keypad and return a pointer to the keyboard, inferring the device
properties from the "main" device that will be registered anyways (e.g.
using its name + "-keypad") or passing them as parameters, which might
look a bit artificial. In that case the key capabilities would be
automatically set and this function would not be exposed any more.
The question is if we would be missing flexibility when setting the
device properties prior its registration and if the participating
drivers want this to be done under the hood. My solution is the one I
found less intrusive for the driver (at the cost of doing the
registration itself), but if there are good reasons for a different
implementation, I will be alright with it. If not, the driver will
control the keypad registration and will use this function to set the
key caps.
Sorry for the late reply to this particular point and especially for the
long text. But a clarification here might save us from another
discussion later on :)
Best regards,
Javier Carrasco
next prev parent reply other threads:[~2023-07-01 20:59 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-16 7:28 [PATCH v3 0/4] Input: support overlay objects on touchscreens Javier Carrasco
2023-06-16 7:28 ` [PATCH v3 1/4] Input: ts-overlay - Add touchscreen overlay object handling Javier Carrasco
2023-06-26 2:35 ` Jeff LaBundy
2023-06-26 10:31 ` Javier Carrasco
2023-06-26 13:47 ` Jeff LaBundy
2023-06-28 6:44 ` Javier Carrasco
2023-06-29 3:29 ` Jeff LaBundy
2023-06-29 7:53 ` Javier Carrasco
2023-06-30 17:30 ` Jeff LaBundy
2023-07-01 20:58 ` Javier Carrasco [this message]
2023-07-06 2:26 ` Jeff LaBundy
2023-06-16 7:28 ` [PATCH v3 2/4] dt-bindings: touchscreen: add overlay-touchscreen and overlay-buttons properties Javier Carrasco
2023-06-16 7:28 ` [PATCH v3 3/4] Input: st1232 - add overlay touchscreen and buttons handling Javier Carrasco
2023-06-27 9:25 ` kernel test robot
2023-06-16 7:28 ` [PATCH v3 4/4] dt-bindings: input: touchscreen: st1232: add example with ts-overlay Javier Carrasco
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=ed1f627b-1713-b273-c083-c98d88f885d2@wolfvision.net \
--to=javier.carrasco@wolfvision.net \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=hechtb@gmail.com \
--cc=jeff@labundy.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.riesch@wolfvision.net \
--cc=robh+dt@kernel.org \
--cc=rydberg@bitmath.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
all inboxes | Powered by JetHome®