diff mbox series

[3/3] Input: goodix - add a settings module-parameter

Message ID 20210613102158.16886-4-hdegoede@redhat.com
State Superseded
Headers show
Series Input: touchscreen - Allow setting touchscreen properties with module options | expand

Commit Message

Hans de Goede June 13, 2021, 10:21 a.m. UTC
Add a settings module-parameter which can be allowed to specify/override
various device-properties.

Usuually Goodix touchscreens on x86 devices (where there is no devicetree
to specify the properties) just work. But in some cases the touchscreen is
mounted 90 or 180 degrees rotated vs the display, requiring setting the
touchscreen-x/y-inverted or touchscreen-swapped-x-y properties.

Being able to specify the necessary properties through a module parameter,
allows users of new device-models to help us with bringing up support for
new devices without them needing to do a local kernel-build just to modify
these settings.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/input/touchscreen/goodix.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Bastien Nocera June 14, 2021, 8:48 a.m. UTC | #1
On Sun, 2021-06-13 at 12:21 +0200, Hans de Goede wrote:
> Add a settings module-parameter which can be allowed to

> specify/override

> various device-properties.

> 

> Usuually Goodix touchscreens on x86 devices (where there is no

> devicetree

> to specify the properties) just work. But in some cases the

> touchscreen is

> mounted 90 or 180 degrees rotated vs the display, requiring setting

> the

> touchscreen-x/y-inverted or touchscreen-swapped-x-y properties.

> 

> Being able to specify the necessary properties through a module

> parameter,

> allows users of new device-models to help us with bringing up support

> for

> new devices without them needing to do a local kernel-build just to

> modify

> these settings.

> 

> Signed-off-by: Hans de Goede <hdegoede@redhat.com>


Reviewed-by: Bastien Nocera <hadess@hadess.net>


> ---

>  drivers/input/touchscreen/goodix.c | 6 +++++-

>  1 file changed, 5 insertions(+), 1 deletion(-)

> 

> diff --git a/drivers/input/touchscreen/goodix.c

> b/drivers/input/touchscreen/goodix.c

> index 2efb82977115..1bc94c5597ca 100644

> --- a/drivers/input/touchscreen/goodix.c

> +++ b/drivers/input/touchscreen/goodix.c

> @@ -52,6 +52,10 @@

>  #define ACPI_GPIO_SUPPORT

>  #endif

>  

> +static char *settings;

> +module_param(settings, charp, 0444);

> +MODULE_PARM_DESC(settings, "Override touchscreen settings using a ;

> separated key=value list, e.g. \"touchscreen-fuzz-x=5;touchscreen-

> fuzz-y=5;touchscreen-swapped-x-y\"");

> +

>  struct goodix_chip_id {

>         const char *id;

>         const struct goodix_chip_data *data;

> @@ -1026,7 +1030,7 @@ static int goodix_configure_dev(struct

> goodix_ts_data *ts)

>         goodix_read_config(ts);

>  

>         /* Try overriding touchscreen parameters via device

> properties */

> -       touchscreen_parse_properties(ts->input_dev, true, &ts->prop,

> NULL);

> +       touchscreen_parse_properties(ts->input_dev, true, &ts->prop,

> settings);

>  

>         if (!ts->prop.max_x || !ts->prop.max_y || !ts->max_touch_num)

> {

>                 dev_err(&ts->client->dev,
diff mbox series

Patch

diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c
index 2efb82977115..1bc94c5597ca 100644
--- a/drivers/input/touchscreen/goodix.c
+++ b/drivers/input/touchscreen/goodix.c
@@ -52,6 +52,10 @@ 
 #define ACPI_GPIO_SUPPORT
 #endif
 
+static char *settings;
+module_param(settings, charp, 0444);
+MODULE_PARM_DESC(settings, "Override touchscreen settings using a ; separated key=value list, e.g. \"touchscreen-fuzz-x=5;touchscreen-fuzz-y=5;touchscreen-swapped-x-y\"");
+
 struct goodix_chip_id {
 	const char *id;
 	const struct goodix_chip_data *data;
@@ -1026,7 +1030,7 @@  static int goodix_configure_dev(struct goodix_ts_data *ts)
 	goodix_read_config(ts);
 
 	/* Try overriding touchscreen parameters via device properties */
-	touchscreen_parse_properties(ts->input_dev, true, &ts->prop, NULL);
+	touchscreen_parse_properties(ts->input_dev, true, &ts->prop, settings);
 
 	if (!ts->prop.max_x || !ts->prop.max_y || !ts->max_touch_num) {
 		dev_err(&ts->client->dev,