From: Hans de Goede <hdegoede@redhat.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Bastien Nocera <hadess@hadess.net>, linux-input@vger.kernel.org
Subject: Re: [PATCH 2/4] Input: touchscreen - Extend touchscreen_parse_properties() to allow overriding settings with a module option
Date: Mon, 28 Nov 2022 10:43:38 +0100 [thread overview]
Message-ID: <e985c885-6b2a-c4c6-d926-0e36fc1cd10c@redhat.com> (raw)
In-Reply-To: <Y2QWbMFzBvc2JzwD@google.com>
Hi Dmitry,
On 11/3/22 20:28, Dmitry Torokhov wrote:
> Hi Hans,
>
> On Tue, Oct 25, 2022 at 02:29:28PM +0200, Hans de Goede wrote:
>> On x86/ACPI platforms touchscreens mostly just work without needing any
>> device/model specific configuration. But in some cases (mostly with Silead
>> and Goodix touchscreens) it is still necessary to manually specify various
>> touchscreen-properties on a per model basis.
>>
>> This is handled by drivers/platform/x86/touchscreen_dmi.c which contains
>> a large list of per-model touchscreen properties which it attaches to the
>> (i2c)device before the touchscreen driver's probe() method gets called.
>> This means that ATM changing these settings requires recompiling the
>> kernel. This makes figuring out what settings/properties a specific
>> touchscreen needs very hard for normal users to do.
>>
>> Add a new, optional, settings_override string argument to
>> touchscreen_parse_properties(), which takes a list of ; separated
>> property-name=value pairs, e.g. :
>> "touchscreen-size-x=1665;touchscreen-size-y=1140;touchscreen-swapped-x-y".
>>
>> This new argument can be used by drivers to implement a module option which
>> allows users to easily specify alternative settings for testing.
>>
>> The 2 new touchscreen_property_read_u32() and
>> touchscreen_property_read_bool() helpers are also exported so that
>> drivers can use these to add settings-override support to the code
>> for driver-specific properties.
>
> I totally understand the motivation for this, but I do not think that
> having special handling for only touchscreen properties is the right
> thing to do. I would very much prefer is we had a more generic approach
> of adding/overriding properties (via an swnode?).
I understand where you are coming from, but I suspect the devicetree
folks are going to not like any generic solution for 2 reasons:
1. Allowing overriding devicetree properties like regulator voltage is a bad idea,
granted users can already do this with a custom DTB, but that is a higher
threshold to pass for a user then just adding something on the kernel cmdline
2. Devicetree supports devicetree-overlays and I expect the devicetree folks
to steer people who want to override random devicetree properties in that
direction (or in the direction of using a custom DTB)
So the ACPI/x86 case really is somewhat special here and especially the
silead touchscreens are special here. Normally all the settings we are
talking here come from ACPI tables (or can directly be read from the
touchscreen controller) and then messing with these settings would be
a case of using an initrd with a custom ACPI DSDT, just like how
on devicetree I think we would expect people to use a custom DTB and
or a devicetree overlay.
but because of this info lacking from the ACPI tables we have it
hardcoded per 2-in-1/tablet model in:
drivers/platform/x86/touchscreen_dmi.c
The downside of this hardcoding is that testing new settings requires
building a custom kernel, which is both not helpful for having
a quick change settings -> test -> adjust settings cycle when trying
to find the right settings for a new model as well as quite a steep
hill to climb for novice users who want to get things to work on
a new model.
So I do believe that because of this the touchscreen properties
or special in this case and a somewhat custom solution to allow
setting just the touchscreen properties from the cmdline thus
is justified.
Also:
1. Having a mechanism specific to touchscreen properties is
simpler (more KISS) then having to come up with some more
complicated generic property override mechanism.
2. A touchscreen property specific mechanism is much less
susceptible to being misused. Setting the touchscreen properties
wrong cannot really result in any harm. OTOH setting the
max / end-of charging voltage of a lipo cell to 4.6 volt
(this is a real world example) is very much harmful.
The lipo-cell max charge voltage is something which we
in the sysfs interface deliberately disallow to be set any higher
then the boot-time value (lower is allowed). Adding a generic
cmdline mechanism for setting properties would allow
overriding this.
Regards,
Hans
next prev parent reply other threads:[~2022-11-28 9:44 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-25 12:29 [PATCH 0/4] Input: touchscreen - Goodix bugfix + settings mod-param support Hans de Goede
2022-10-25 12:29 ` [PATCH 1/4] Input: goodix - Try resetting the controller when no config is set Hans de Goede
2022-10-31 14:42 ` Bastien Nocera
2022-10-31 18:18 ` Hans de Goede
2022-11-03 18:32 ` Dmitry Torokhov
2022-10-25 12:29 ` [PATCH 2/4] Input: touchscreen - Extend touchscreen_parse_properties() to allow overriding settings with a module option Hans de Goede
2022-11-03 19:28 ` Dmitry Torokhov
2022-11-28 9:43 ` Hans de Goede [this message]
2022-10-25 12:29 ` [PATCH 3/4] Input: silead - Add a settings module-parameter Hans de Goede
2022-10-25 12:29 ` [PATCH 4/4] Input: goodix " 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=e985c885-6b2a-c4c6-d926-0e36fc1cd10c@redhat.com \
--to=hdegoede@redhat.com \
--cc=dmitry.torokhov@gmail.com \
--cc=hadess@hadess.net \
--cc=linux-input@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).