From patchwork Tue Jun 20 10:11:22 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: 9799193 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 6C88B600C5 for ; Tue, 20 Jun 2017 10:11:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 42275223B3 for ; Tue, 20 Jun 2017 10:11:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 368D125E13; Tue, 20 Jun 2017 10:11:02 +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 A821F223B3 for ; Tue, 20 Jun 2017 10:11:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751109AbdFTKK7 (ORCPT ); Tue, 20 Jun 2017 06:10:59 -0400 Received: from forward9o.cmail.yandex.net ([37.9.109.56]:49239 "EHLO forward9o.cmail.yandex.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750993AbdFTKK5 (ORCPT ); Tue, 20 Jun 2017 06:10:57 -0400 Received: from smtp2j.mail.yandex.net (smtp2j.mail.yandex.net [IPv6:2a02:6b8:0:801::ac]) by forward9o.cmail.yandex.net (Yandex) with ESMTP id 5368D22342; Tue, 20 Jun 2017 13:10:55 +0300 (MSK) Received: from smtp2j.mail.yandex.net (localhost.localdomain [127.0.0.1]) by smtp2j.mail.yandex.net (Yandex) with ESMTP id 60EFB3EC1334; Tue, 20 Jun 2017 13:10:50 +0300 (MSK) Received: by smtp2j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id fM0qPMeX8Y-Ao64HLRS; Tue, 20 Jun 2017 13:10:50 +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=1497953450; bh=ztMW0316vqBPftzfM47ScH7wWJznSiu+vFKQvlJB+Jg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References; b=sanh/4Y3WC6sMLJakPmkYvVLkFtXkqpJb/ZhOw1td22pDXa9vs4eJwWENsYaAIe6C h8zNe8ebJ7HSs+y4wqdCQb49JjC+Q+MettVFgWccSZWGifsjU7rutCIyYCLX52ycAg H2npi26BhYPPulLd+GjhwcUQeuhqyO1rY7Y8hEXc= 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 0 From: "Sergei A. Trusov" To: Bastien Nocera , Dmitry Torokhov Cc: Hans de Goede , russianneuromancer@ya.ru, linux-input@vger.kernel.org Subject: Re: [PATCH] Input: goodix: Add support for capacitive home button found on some x86 tablets Date: Tue, 20 Jun 2017 20:11:22 +1000 Message-ID: <3319693.GoGvQJigqa@z12> In-Reply-To: <1497950941.2559.13.camel@hadess.net> References: <1725443.Vzhj3lzWjD@z12> <1567005.gF9xgO7RRS@z12> <1497950941.2559.13.camel@hadess.net> 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 Tuesday, 20 June 2017 19:29:01 +10 Bastien Nocera wrote: > On Tue, 2017-06-20 at 19:26 +1000, Sergei A. Trusov wrote: > > > > > Thank you for this point. Now I see all the changes above are > > redundant: > > we can use a value returned in the *data buffer. It is enough to add > > only two lines of code to achieve the behaviour of this entire patch. > > A bit more with a comment explaining the reason behind those 2 lines, > but shorter patches get my vote ;) Current goodix_ts_read_input_report() function puts data from hardware into point_data buffer. Then in masks high niblle of the first byte and returns it as touch_num. We need this masked nibble to check, so I was trying to remove mask operation. After your comment I just realized that proposed patch should be much shorter. I have included more context lines to make cleaner my attempts to explain (as I am affraid my English is not so good): --- -- 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..0c3825c39288 100644 --- a/drivers/input/touchscreen/goodix.c +++ b/drivers/input/touchscreen/goodix.c @@ -262,16 +262,18 @@ static void goodix_process_events(struct goodix_ts_data *ts) u8 point_data[1 + GOODIX_CONTACT_SIZE * GOODIX_MAX_CONTACTS]; int touch_num; int i; touch_num = goodix_ts_read_input_report(ts, point_data); if (touch_num < 0) return; + 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]); input_mt_sync_frame(ts->input_dev); input_sync(ts->input_dev); } @@ -607,16 +609,18 @@ static int goodix_request_input_dev(struct goodix_ts_data *ts) ts->input_dev->name = "Goodix Capacitive TouchScreen"; ts->input_dev->phys = "input/ts"; ts->input_dev->id.bustype = BUS_I2C; ts->input_dev->id.vendor = 0x0416; ts->input_dev->id.product = ts->id; ts->input_dev->id.version = ts->version; + input_set_capability(ts->input_dev, EV_KEY, KEY_LEFTMETA); + error = input_register_device(ts->input_dev); if (error) { dev_err(&ts->client->dev, "Failed to register input device: %d", error); return error; } return 0;