From patchwork Tue Jun 20 11:08:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sergei A. Trusov" X-Patchwork-Id: 9799245 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 54A50600C5 for ; Tue, 20 Jun 2017 11:16:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4586D1FFD6 for ; Tue, 20 Jun 2017 11:16:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 383172015F; Tue, 20 Jun 2017 11:16:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AC6521FFD6 for ; Tue, 20 Jun 2017 11:16:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750979AbdFTLQB (ORCPT ); Tue, 20 Jun 2017 07:16:01 -0400 Received: from forward14m.cmail.yandex.net ([5.255.216.145]:49556 "EHLO forward14m.cmail.yandex.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750916AbdFTLQB (ORCPT ); Tue, 20 Jun 2017 07:16:01 -0400 X-Greylist: delayed 456 seconds by postgrey-1.27 at vger.kernel.org; Tue, 20 Jun 2017 07:16:01 EDT Received: from smtp2j.mail.yandex.net (smtp2j.mail.yandex.net [IPv6:2a02:6b8:0:801::ac]) by forward14m.cmail.yandex.net (Yandex) with ESMTP id 954AF21F3C; Tue, 20 Jun 2017 14:08:22 +0300 (MSK) Received: from smtp2j.mail.yandex.net (localhost.localdomain [127.0.0.1]) by smtp2j.mail.yandex.net (Yandex) with ESMTP id 0E04D3EC0EA8; Tue, 20 Jun 2017 14:08:19 +0300 (MSK) Received: by smtp2j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 2NhLIKzB5T-8I6iAxWs; Tue, 20 Jun 2017 14:08:18 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ya.ru; s=mail; t=1497956899; bh=0XvlrO1CGhzqdxe7G5SKL2O18LwMdplkc4gxBIzIuWw=; h=From:To:Cc:Subject:Date:Message-ID; b=V3jHqFdRvBvfe4dqGao7QaE/MWQM012d15j0P56h8DLI3R6YIJHzXkdihSkFJjCWm Si477wzlgt9lzwIMtTXPEA8f9SlmTf3th1l8w4vKTfyrLkzwO1FQg3R6XHheyhKSXF VZ3hQwzrdM1yfEI0p6pBkANcf4++w7+dxDgLbD9I= Authentication-Results: smtp2j.mail.yandex.net; dkim=pass header.i=@ya.ru X-Yandex-ForeignMX: FR X-Yandex-Suid-Status: 1 0,1 0,1 0,1 85683232,1 1027208208,1 0 From: "Sergei A. Trusov" To: Bastien Nocera , Dmitry Torokhov Cc: Hans de Goede , russianneuromancer@ya.ru, "Sergei A. Trusov" , linux-input@vger.kernel.org Subject: [PATCH v2] Input: goodix: Add support for capacitive home button found on some x86 tablets Date: Tue, 20 Jun 2017 21:08:50 +1000 Message-ID: <1749277.ynzOHhpSB9@z12> MIME-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 normally only the lower 4 bits are used to indicate the number of touches. Detect this and report a KEY_LEFTMETA press when this happens. Note the hardware might support more than one button, the number of a button is reported by the 'id' byte of coor_data. Now we ignore button id. Signed-off-by: Sergei A. Trusov Acked-by: Bastien Nocera --- drivers/input/touchscreen/goodix.c | 9 +++++++++ 1 file changed, 9 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c index 240b16f3ee97..c1bb59c96dbd 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] & 0x10)); + 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,