From patchwork Sat Jun 17 10:58:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 9794053 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 78FAE600F6 for ; Sat, 17 Jun 2017 10:58:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6AF38284D2 for ; Sat, 17 Jun 2017 10:58:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5FD9E284DC; Sat, 17 Jun 2017 10:58:44 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 0B97D284D2 for ; Sat, 17 Jun 2017 10:58:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752799AbdFQK6n (ORCPT ); Sat, 17 Jun 2017 06:58:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58224 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752720AbdFQK6m (ORCPT ); Sat, 17 Jun 2017 06:58:42 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7F1203680F; Sat, 17 Jun 2017 10:58:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 7F1203680F Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=hdegoede@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 7F1203680F Received: from shalem.localdomain.com (ovpn-116-82.ams2.redhat.com [10.36.116.82]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3FF7658840; Sat, 17 Jun 2017 10:58:41 +0000 (UTC) From: Hans de Goede To: Dmitry Torokhov Cc: Hans de Goede , Jiri Kosina , Benjamin Tissoires , linux-input@vger.kernel.org Subject: [PATCH 4/4] Input: icn8318 - Add support for capacative home button Date: Sat, 17 Jun 2017 12:58:34 +0200 Message-Id: <20170617105834.16255-4-hdegoede@redhat.com> In-Reply-To: <20170617105834.16255-1-hdegoede@redhat.com> References: <20170617105834.16255-1-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Sat, 17 Jun 2017 10:58:42 +0000 (UTC) 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 Some x86 tablets with an icn8505 touchscreen have a capacative home button, add support for this. Note that it turns out the removed comment turns out to be inaccurate, yes when the capacative home button is pressed the touch info contains invalid data, but touch_count is set to 0 so this is not a problem and if both the button is used and a finger is touching the normal touchscreen area then there is valid touch data. Signed-off-by: Hans de Goede --- drivers/input/touchscreen/chipone_icn8318.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/input/touchscreen/chipone_icn8318.c b/drivers/input/touchscreen/chipone_icn8318.c index b209872954f7..2209ccf596f3 100644 --- a/drivers/input/touchscreen/chipone_icn8318.c +++ b/drivers/input/touchscreen/chipone_icn8318.c @@ -64,6 +64,7 @@ struct icn8318_data { struct gpio_desc *wake_gpio; struct touchscreen_properties prop; enum icn8318_model model; + int softbutton; }; static int icn8318_read_touch_data(struct icn8318_data *data, @@ -122,15 +123,9 @@ static irqreturn_t icn8318_irq(int irq, void *dev_id) return IRQ_HANDLED; } - if (touch_data.softbutton) { - /* - * Other data is invalid when a softbutton is pressed. - * This needs some extra devicetree bindings to map the icn8318 - * softbutton codes to evdev codes. Currently no known devices - * use this. - */ - return IRQ_HANDLED; - } + if (data->softbutton) + input_report_key(data->input, data->softbutton, + touch_data.softbutton == 0x01); if (touch_data.touch_count > ICN8318_MAX_TOUCHES) { dev_warn(dev, "Too much touches %d > %d\n", @@ -268,6 +263,7 @@ static int icn8318_probe_acpi(struct icn8318_data *data, struct device *dev) if (strcmp(sub, "HAMP0002") == 0) { input_set_abs_params(input, ABS_MT_POSITION_X, 0, 1199, 0, 0); input_set_abs_params(input, ABS_MT_POSITION_Y, 0, 1919, 0, 0); + data->softbutton = KEY_LEFTMETA; } else { dev_err(dev, "Unknown model _SUB: %s\n", sub); kfree(buf.pointer); @@ -339,6 +335,9 @@ static int icn8318_probe(struct i2c_client *client) return -EINVAL; } + if (data->softbutton) + input_set_capability(data->input, EV_KEY, data->softbutton); + error = input_mt_init_slots(input, ICN8318_MAX_TOUCHES, INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED); if (error)