From 4a54feea1765a79ac8446bd6f5ce163fc94a8a95 Mon Sep 17 00:00:00 2001 From: "Sergei A. Trusov" Date: Wed, 6 Sep 2017 17:29:24 -0700 Subject: Input: goodix - add support for capacitive home button On some x86 tablets with a Goodix touchscreen, the Windows logo on the front is a capacitive home button. Touching this button results in a touch with bit 4 of the first byte set, while only the lower 4 bits (0-3) are used to indicate the number of touches. Report a KEY_LEFTMETA press when this happens. Note that the hardware might support more than one button, in which case the "id" byte of coor_data would identify the button in question. This is not implemented as we don't have access to hardware with multiple buttons. Signed-off-by: Sergei A. Trusov Acked-by: Bastien Nocera Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/goodix.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'drivers/input/touchscreen') diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c index 240b16f3ee97..32d2762448aa 100644 --- a/drivers/input/touchscreen/goodix.c +++ b/drivers/input/touchscreen/goodix.c @@ -267,6 +267,12 @@ static void goodix_process_events(struct goodix_ts_data *ts) if (touch_num < 0) return; + /* + * Bit 4 of the first byte reports the status of the capacitive + * Windows/Home button. + */ + input_report_key(ts->input_dev, KEY_LEFTMETA, point_data[0] & BIT(4)); + for (i = 0; i < touch_num; i++) goodix_ts_report_touch(ts, &point_data[1 + GOODIX_CONTACT_SIZE * i]); @@ -612,6 +618,9 @@ static int goodix_request_input_dev(struct goodix_ts_data *ts) ts->input_dev->id.product = ts->id; ts->input_dev->id.version = ts->version; + /* Capacitive Windows/Home button on some devices */ + input_set_capability(ts->input_dev, EV_KEY, KEY_LEFTMETA); + error = input_register_device(ts->input_dev); if (error) { dev_err(&ts->client->dev, -- cgit From 023c437a7a032320cd881b6d1c477a56d95582fe Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Thu, 7 Sep 2017 14:27:12 -0700 Subject: Input: surface3_spi - make const array header static, reduces object code size Don't populate the const array header on the stack, instead make it static. Makes the object code smaller by over 180 bytes: Before: text data bss dec hex filename 6003 1536 0 7539 1d73 surface3_spi.o After: text data bss dec hex filename 5726 1632 0 7358 1cbe surface3_spi.o Signed-off-by: Colin Ian King Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/surface3_spi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/input/touchscreen') diff --git a/drivers/input/touchscreen/surface3_spi.c b/drivers/input/touchscreen/surface3_spi.c index e12fb9b63f31..5db0f1c4ef38 100644 --- a/drivers/input/touchscreen/surface3_spi.c +++ b/drivers/input/touchscreen/surface3_spi.c @@ -173,7 +173,7 @@ static void surface3_spi_process_pen(struct surface3_ts_data *ts_data, u8 *data) static void surface3_spi_process(struct surface3_ts_data *ts_data) { - const char header[] = { + static const char header[] = { 0xff, 0xff, 0xff, 0xff, 0xa5, 0x5a, 0xe7, 0x7e, 0x01 }; u8 *data = ts_data->rd_buf; -- cgit From 47014752829ed1b52fa6f876b381774ae530503c Mon Sep 17 00:00:00 2001 From: Luca Ceresoli Date: Thu, 7 Sep 2017 14:28:28 -0700 Subject: Input: edt-ft5x06 - fix access to non-existing register reg_addr->reg_report_rate is supposed to exist in M06, not M09. The driver is written to skip avoids access to non-existing registers when the register address is NO_REGISTER (0xff). But reg_addr->reg_report_rate is initialized to 0x00 by devm_kzalloc() (in edt_ft5x06_ts_probe()) and not changed thereafter. So the checks do not work and an access to register 0x00 is done. Fix by setting reg_addr->reg_report_rate to NO_REGISTER. Also fix the only place where reg_report_rate is checked against zero instead of NO_REGISTER. Signed-off-by: Luca Ceresoli Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/edt-ft5x06.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/input/touchscreen') diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c index f872817e81e4..5bf63f76ddda 100644 --- a/drivers/input/touchscreen/edt-ft5x06.c +++ b/drivers/input/touchscreen/edt-ft5x06.c @@ -593,7 +593,7 @@ static int edt_ft5x06_work_mode(struct edt_ft5x06_ts_data *tsdata) tsdata->gain); edt_ft5x06_register_write(tsdata, reg_addr->reg_offset, tsdata->offset); - if (reg_addr->reg_report_rate) + if (reg_addr->reg_report_rate != NO_REGISTER) edt_ft5x06_register_write(tsdata, reg_addr->reg_report_rate, tsdata->report_rate); @@ -874,6 +874,7 @@ edt_ft5x06_ts_set_regs(struct edt_ft5x06_ts_data *tsdata) case M09: reg_addr->reg_threshold = M09_REGISTER_THRESHOLD; + reg_addr->reg_report_rate = NO_REGISTER; reg_addr->reg_gain = M09_REGISTER_GAIN; reg_addr->reg_offset = M09_REGISTER_OFFSET; reg_addr->reg_num_x = M09_REGISTER_NUM_X; -- cgit From 39467fc1054a91efa697162a94e5b0e1a4b7b580 Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Thu, 31 Aug 2017 18:23:11 -0700 Subject: Input: ucb1400_ts - fix suspend and resume handling Instead of stopping the touchscreen we were starting it in suspend, and disabling it in resume. Fixes: c899afedf168 ("Input: ucb1400_ts - convert to threaded IRQ") Reported-by: Anton Volkov Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/ucb1400_ts.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/input/touchscreen') diff --git a/drivers/input/touchscreen/ucb1400_ts.c b/drivers/input/touchscreen/ucb1400_ts.c index c1e23cfc6155..1a86cbd9326f 100644 --- a/drivers/input/touchscreen/ucb1400_ts.c +++ b/drivers/input/touchscreen/ucb1400_ts.c @@ -414,7 +414,7 @@ static int __maybe_unused ucb1400_ts_suspend(struct device *dev) mutex_lock(&idev->mutex); if (idev->users) - ucb1400_ts_start(ucb); + ucb1400_ts_stop(ucb); mutex_unlock(&idev->mutex); return 0; @@ -428,7 +428,7 @@ static int __maybe_unused ucb1400_ts_resume(struct device *dev) mutex_lock(&idev->mutex); if (idev->users) - ucb1400_ts_stop(ucb); + ucb1400_ts_start(ucb); mutex_unlock(&idev->mutex); return 0; -- cgit