From d2587800598c119664b22fef55ffa51aeb1da802 Mon Sep 17 00:00:00 2001 From: "George G. Davis" Date: Fri, 28 Sep 2018 17:19:34 -0700 Subject: Input: atmel_mxt_ts - fix multiple includes Both v4.16-rc7 commit 93afb1d6e72a ("Input: atmel_mxt_ts - switch from OF to generic device properties") and v4.16-rc7 commit 96a938aa214e ("Input: atmel_mxt_ts - remove platform data support") added includes of "". Remove one of the duplicate includes to fix this. Signed-off-by: George G. Davis Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/atmel_mxt_ts.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/input/touchscreen') diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 3232af5dcf89..bbc122f35515 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include -- cgit v1.2.3 From 20bbb312079494a406c10c90932e3c80837c9d94 Mon Sep 17 00:00:00 2001 From: Martin Kepplinger Date: Fri, 5 Oct 2018 11:44:45 -0700 Subject: Input: st1232 - set INPUT_PROP_DIRECT property This is how userspace checks for touchscreen devices most reliably. Signed-off-by: Martin Kepplinger Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/st1232.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/input/touchscreen') diff --git a/drivers/input/touchscreen/st1232.c b/drivers/input/touchscreen/st1232.c index d5dfa4053bbf..b71673911aac 100644 --- a/drivers/input/touchscreen/st1232.c +++ b/drivers/input/touchscreen/st1232.c @@ -195,6 +195,7 @@ static int st1232_ts_probe(struct i2c_client *client, input_dev->id.bustype = BUS_I2C; input_dev->dev.parent = &client->dev; + __set_bit(INPUT_PROP_DIRECT, input_dev->propbit); __set_bit(EV_SYN, input_dev->evbit); __set_bit(EV_KEY, input_dev->evbit); __set_bit(EV_ABS, input_dev->evbit); -- cgit v1.2.3 From dde27443211062e841806feaf690674b7c3a599f Mon Sep 17 00:00:00 2001 From: Julian Sax Date: Fri, 5 Oct 2018 11:48:31 -0700 Subject: Input: silead - try firmware reload after unsuccessful resume A certain silead controller (Chip ID: 0x56810000) loses its firmware after suspend, causing the resume to fail. This patch tries to load the firmware, should a resume error occur and retries the resuming. Signed-off-by: Julian Sax Acked-by: Hans de Goede Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/silead.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'drivers/input/touchscreen') diff --git a/drivers/input/touchscreen/silead.c b/drivers/input/touchscreen/silead.c index ff7043f74a3d..da1fdd16855e 100644 --- a/drivers/input/touchscreen/silead.c +++ b/drivers/input/touchscreen/silead.c @@ -558,20 +558,33 @@ static int __maybe_unused silead_ts_suspend(struct device *dev) static int __maybe_unused silead_ts_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); + bool second_try = false; int error, status; silead_ts_set_power(client, SILEAD_POWER_ON); + retry: error = silead_ts_reset(client); if (error) return error; + if (second_try) { + error = silead_ts_load_fw(client); + if (error) + return error; + } + error = silead_ts_startup(client); if (error) return error; status = silead_ts_get_status(client); if (status != SILEAD_STATUS_OK) { + if (!second_try) { + second_try = true; + dev_dbg(dev, "Reloading firmware after unsuccessful resume\n"); + goto retry; + } dev_err(dev, "Resume error, status: 0x%02x\n", status); return -ENODEV; } -- cgit v1.2.3 From 00f73f97527f6ea8b4bc2bc63c44299bcc2f5cab Mon Sep 17 00:00:00 2001 From: Stephen Boyd Date: Wed, 10 Oct 2018 15:50:50 -0700 Subject: Input: elants_i2c - use DMA safe i2c when possible To avoid bounce buffer when an i2c controller decides to use DMA for a transaction, let's make out buffer that we use for reads DMA-safe and let the master know that DMAing into it is safe. Signed-off-by: Stephen Boyd Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/elants_i2c.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'drivers/input/touchscreen') diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c index d21ca39b0fdb..f2cb23121833 100644 --- a/drivers/input/touchscreen/elants_i2c.c +++ b/drivers/input/touchscreen/elants_i2c.c @@ -147,10 +147,11 @@ struct elants_data { u8 cmd_resp[HEADER_SIZE]; struct completion cmd_done; - u8 buf[MAX_PACKET_SIZE]; - bool wake_irq_enabled; bool keep_power_in_suspend; + + /* Must be last to be used for DMA operations */ + u8 buf[MAX_PACKET_SIZE] ____cacheline_aligned; }; static int elants_i2c_send(struct i2c_client *client, @@ -863,7 +864,7 @@ static irqreturn_t elants_i2c_irq(int irq, void *_dev) int i; int len; - len = i2c_master_recv(client, ts->buf, sizeof(ts->buf)); + len = i2c_master_recv_dmasafe(client, ts->buf, sizeof(ts->buf)); if (len < 0) { dev_err(&client->dev, "%s: failed to read data: %d\n", __func__, len); -- cgit v1.2.3 From d9265e8a878aa19898667ab32f6b8936170cf1f9 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Thu, 11 Oct 2018 17:04:13 -0700 Subject: Input: of_touchscreen - add support for touchscreen-min-x|y Some touchscreens, depending on the firmware and/or the digitizer, report coordinates which never reach 0 along one or both of their axis. This has been seen for example on the Silead touchscreens on a Onda V891w and a Point of View mobii TAB-P800w(v2.0). This commit adds support for touchscreen-min-x and touchscreen-min-y device-properties which can be set to communicate the actual start coordinates (rather then 0,0) to userspace. This commit also drop the "(in pixels)" comment from the documentation of the touchscreen-size-x and touchscreen-size-y properties. The comment suggested that there is a relation between the range of reported coordinates and the display resolution, which is only true for some devices. The "(in pixels)" comment is replaced with "(maximum x coordinate reported + 1)" to mirror the language describing the new touchscreen-min-x and -min-y properties. When set this fixes e.g. not being able to click things in the GNOME3 top-bar on the 2 example tablets. Signed-off-by: Hans de Goede Reviewed-by: Rob Herring Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/of_touchscreen.c | 36 +++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 8 deletions(-) (limited to 'drivers/input/touchscreen') diff --git a/drivers/input/touchscreen/of_touchscreen.c b/drivers/input/touchscreen/of_touchscreen.c index 9642f103b726..6d241d45e312 100644 --- a/drivers/input/touchscreen/of_touchscreen.c +++ b/drivers/input/touchscreen/of_touchscreen.c @@ -35,7 +35,7 @@ static bool touchscreen_get_prop_u32(struct device *dev, static void touchscreen_set_params(struct input_dev *dev, unsigned long axis, - int max, int fuzz) + int min, int max, int fuzz) { struct input_absinfo *absinfo; @@ -47,6 +47,7 @@ static void touchscreen_set_params(struct input_dev *dev, } absinfo = &dev->absinfo[axis]; + absinfo->minimum = min; absinfo->maximum = max; absinfo->fuzz = fuzz; } @@ -68,8 +69,9 @@ void touchscreen_parse_properties(struct input_dev *input, bool multitouch, struct touchscreen_properties *prop) { struct device *dev = input->dev.parent; + struct input_absinfo *absinfo; unsigned int axis; - unsigned int maximum, fuzz; + unsigned int minimum, maximum, fuzz; bool data_present; input_alloc_absinfo(input); @@ -77,7 +79,10 @@ void touchscreen_parse_properties(struct input_dev *input, bool multitouch, return; axis = multitouch ? ABS_MT_POSITION_X : ABS_X; - data_present = touchscreen_get_prop_u32(dev, "touchscreen-size-x", + data_present = touchscreen_get_prop_u32(dev, "touchscreen-min-x", + input_abs_get_min(input, axis), + &minimum) | + touchscreen_get_prop_u32(dev, "touchscreen-size-x", input_abs_get_max(input, axis) + 1, &maximum) | @@ -85,10 +90,13 @@ void touchscreen_parse_properties(struct input_dev *input, bool multitouch, input_abs_get_fuzz(input, axis), &fuzz); if (data_present) - touchscreen_set_params(input, axis, maximum - 1, fuzz); + touchscreen_set_params(input, axis, minimum, maximum - 1, fuzz); axis = multitouch ? ABS_MT_POSITION_Y : ABS_Y; - data_present = touchscreen_get_prop_u32(dev, "touchscreen-size-y", + data_present = touchscreen_get_prop_u32(dev, "touchscreen-min-y", + input_abs_get_min(input, axis), + &minimum) | + touchscreen_get_prop_u32(dev, "touchscreen-size-y", input_abs_get_max(input, axis) + 1, &maximum) | @@ -96,7 +104,7 @@ void touchscreen_parse_properties(struct input_dev *input, bool multitouch, input_abs_get_fuzz(input, axis), &fuzz); if (data_present) - touchscreen_set_params(input, axis, maximum - 1, fuzz); + touchscreen_set_params(input, axis, minimum, maximum - 1, fuzz); axis = multitouch ? ABS_MT_PRESSURE : ABS_PRESSURE; data_present = touchscreen_get_prop_u32(dev, @@ -108,7 +116,7 @@ void touchscreen_parse_properties(struct input_dev *input, bool multitouch, input_abs_get_fuzz(input, axis), &fuzz); if (data_present) - touchscreen_set_params(input, axis, maximum, fuzz); + touchscreen_set_params(input, axis, 0, maximum, fuzz); if (!prop) return; @@ -117,13 +125,25 @@ void touchscreen_parse_properties(struct input_dev *input, bool multitouch, prop->max_x = input_abs_get_max(input, axis); prop->max_y = input_abs_get_max(input, axis + 1); + prop->invert_x = device_property_read_bool(dev, "touchscreen-inverted-x"); + if (prop->invert_x) { + absinfo = &input->absinfo[axis]; + absinfo->maximum -= absinfo->minimum; + absinfo->minimum = 0; + } + prop->invert_y = device_property_read_bool(dev, "touchscreen-inverted-y"); + if (prop->invert_y) { + absinfo = &input->absinfo[axis + 1]; + absinfo->maximum -= absinfo->minimum; + absinfo->minimum = 0; + } + prop->swap_x_y = device_property_read_bool(dev, "touchscreen-swapped-x-y"); - if (prop->swap_x_y) swap(input->absinfo[axis], input->absinfo[axis + 1]); } -- cgit v1.2.3 From a3f7c3fcf60868c1e90671df5d0cf9be5900a09b Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Mon, 15 Oct 2018 11:16:58 -0700 Subject: Input: wm97xx-ts - fix exit path Loading then unloading wm97xx-ts.ko when CONFIG_AC97_BUS=m causes a WARNING: from drivers/base/driver.c: Unexpected driver unregister! WARNING: CPU: 0 PID: 1709 at ../drivers/base/driver.c:193 driver_unregister+0x30/0x40 Fix this by only calling driver_unregister() with the same condition that driver_register() is called. Fixes: ae9d1b5fbd7b ("Input: wm97xx: add new AC97 bus support") Signed-off-by: Randy Dunlap Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/wm97xx-core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/input/touchscreen') diff --git a/drivers/input/touchscreen/wm97xx-core.c b/drivers/input/touchscreen/wm97xx-core.c index fd714ee881f7..5eb2a33111ec 100644 --- a/drivers/input/touchscreen/wm97xx-core.c +++ b/drivers/input/touchscreen/wm97xx-core.c @@ -929,7 +929,8 @@ static int __init wm97xx_init(void) static void __exit wm97xx_exit(void) { - driver_unregister(&wm97xx_driver); + if (IS_BUILTIN(CONFIG_AC97_BUS)) + driver_unregister(&wm97xx_driver); platform_driver_unregister(&wm97xx_mfd_driver); } -- cgit v1.2.3 From 03bf67817ec1b8eb3017d2884486ef1bac128764 Mon Sep 17 00:00:00 2001 From: "Gustavo A. R. Silva" Date: Mon, 15 Oct 2018 11:21:47 -0700 Subject: Input: atmel_mxt_ts - mark expected switch fall-through In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. Signed-off-by: Gustavo A. R. Silva Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/atmel_mxt_ts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/input/touchscreen') diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index bbc122f35515..d3aacd534e9c 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -488,7 +488,7 @@ static int mxt_lookup_bootloader_address(struct mxt_data *data, bool retry) bootloader = appmode - 0x24; break; } - /* Fall through for normal case */ + /* Fall through - for normal case */ case 0x4c: case 0x4d: case 0x5a: -- cgit v1.2.3