From patchwork Sun Nov 12 19:41:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Duje_Mihanovi=C4=87?= X-Patchwork-Id: 164276 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp839758vqg; Sun, 12 Nov 2023 11:43:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IGk0FAWe1u8GL2ykCnYOSCao5vvbsHViYHxDL4XixuccAJcT9FeI3ITHZyZMjnl4X+rTetH X-Received: by 2002:a17:903:1ca:b0:1cc:47d5:b761 with SMTP id e10-20020a17090301ca00b001cc47d5b761mr3506540plh.35.1699818237435; Sun, 12 Nov 2023 11:43:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699818237; cv=none; d=google.com; s=arc-20160816; b=z5/ZWHPrpEL3LjLvC6R3pjb/aeFAlE3PYt/2yHftI1hB+YfFU0wH7WkldmZHdxGK0v kqgVRF2MYQYV7OF3FC0dsvgMpul+xCkugbrs6o0DTZujXq+QBfejX2MaBbV0kV/YpzHb rqczf6cWMCSCVFiXCidMtafmmfll2oNUjzRLHcqnMEv+5BDAKJO0nqztkq9fcs+Z+pH6 krWl1YIhK5qosUfK30YqqpooyUXSL+8ym14F8Dh8/IiHzq9jsYx66xuI+4o2r4ucn1/r gx2v2zMOxNvEUw7YFk87eyjXVyE8gzFCPCbleKjGlb3elphEpMrxOEA3ugVn4qbLOyEo IDGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=xoZM1sA5c7oqzgFKXjkBcfv1oUrG4LNI4aDuE3dgT/8=; fh=McECpeuGceZZLxOydWI9EfvhmQcG6AUs0ylHYyv2J0E=; b=OcevY//TGPT9YIgqjArFnU+zmnpany5tR43vxv/Z5qIeKJEiApeAss0y+XTkgC3oRJ YsR+o04P8MsEJv/vEUl523eBINHuiHmnlNiQ01bhRt1HRCufqfk4Blgqo7v17xTFktCh tsDHv533NIkH9alm0QDG6xqLQsWkOLU+5+oGWtISKEBbNSmrcy2BlbV4FtNChxvXm8pj 9hrw+ZPnKGpwH2LmpJuwi0jINj07UQ4l0Lq8LnJ6zcYLVlPOehvJTNe5lR8B9b/7zqzf bXUBUqqMI8z7yQBW6DMDeHeS/hGKHVdhRuwULEBhs5F4fRmgkoWXT+NdXi546HzdO2Ej NMHw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id j6-20020a170902c3c600b001c3e13018ffsi4169752plj.51.2023.11.12.11.43.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Nov 2023 11:43:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 66DEC80A7E54; Sun, 12 Nov 2023 11:43:56 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232134AbjKLTns (ORCPT + 30 others); Sun, 12 Nov 2023 14:43:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229886AbjKLTnr (ORCPT ); Sun, 12 Nov 2023 14:43:47 -0500 Received: from mx.skole.hr (mx1.hosting.skole.hr [161.53.165.185]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 611791BFF; Sun, 12 Nov 2023 11:43:42 -0800 (PST) Received: from mx1.hosting.skole.hr (localhost.localdomain [127.0.0.1]) by mx.skole.hr (mx.skole.hr) with ESMTP id A225B86A13; Sun, 12 Nov 2023 20:43:39 +0100 (CET) From: =?utf-8?q?Duje_Mihanovi=C4=87?= To: Markuss Broks , Dmitry Torokhov Cc: ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, Karel Balej , =?utf-8?q?Duje_Mihanovi=C4=87?= , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] input: touchscreen: imagis: Add touch key support Date: Sun, 12 Nov 2023 20:41:24 +0100 Message-ID: <20231112194124.24916-1-duje.mihanovic@skole.hr> X-Mailer: git-send-email 2.42.1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sun, 12 Nov 2023 11:43:56 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782388607648390080 X-GMAIL-MSGID: 1782388607648390080 IST3032C (and possibly some other models) has touch keys. Add support for them to the imagis driver. Signed-off-by: Duje Mihanović --- This patch depends on the series generalizing the driver and adding IST3032C support: https://lore.kernel.org/all/20231003133440.4696-1-karelb@gimli.ms.mff.cuni.cz/ --- drivers/input/touchscreen/imagis.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/input/touchscreen/imagis.c b/drivers/input/touchscreen/imagis.c index 41f28e6e9cb1..5a54ce291655 100644 --- a/drivers/input/touchscreen/imagis.c +++ b/drivers/input/touchscreen/imagis.c @@ -30,6 +30,7 @@ #define IST3038C_FINGER_COUNT_MASK GENMASK(15, 12) #define IST3038C_FINGER_COUNT_SHIFT 12 #define IST3038C_FINGER_STATUS_MASK GENMASK(9, 0) +#define IST3032C_KEY_STATUS_MASK GENMASK(20, 16) #define IST3038B_REG_STATUS 0x20 #define IST3038B_REG_CHIPID 0x30 @@ -43,6 +44,7 @@ struct imagis_properties { unsigned int whoami_cmd; unsigned int whoami_val; bool protocol_b; + bool touch_keys_supported; }; struct imagis_ts { @@ -95,7 +97,7 @@ static irqreturn_t imagis_interrupt(int irq, void *dev_id) { struct imagis_ts *ts = dev_id; u32 intr_message, finger_status; - unsigned int finger_count, finger_pressed; + unsigned int finger_count, finger_pressed, key_pressed; int i; int error; @@ -144,6 +146,11 @@ static irqreturn_t imagis_interrupt(int irq, void *dev_id) IST3038C_AREA_SHIFT); } + key_pressed = FIELD_GET(IST3032C_KEY_STATUS_MASK, intr_message); + + input_report_key(ts->input_dev, KEY_APPSELECT, (key_pressed & BIT(0))); + input_report_key(ts->input_dev, KEY_BACK, (key_pressed & BIT(1))); + input_mt_sync_frame(ts->input_dev); input_sync(ts->input_dev); @@ -229,6 +236,10 @@ static int imagis_init_input_dev(struct imagis_ts *ts) input_set_capability(input_dev, EV_ABS, ABS_MT_POSITION_X); input_set_capability(input_dev, EV_ABS, ABS_MT_POSITION_Y); input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, 16, 0, 0); + if (ts->tdata->touch_keys_supported) { + input_set_capability(input_dev, EV_KEY, KEY_BACK); + input_set_capability(input_dev, EV_KEY, KEY_APPSELECT); + } touchscreen_parse_properties(input_dev, true, &ts->prop); if (!ts->prop.max_x || !ts->prop.max_y) { @@ -370,6 +381,7 @@ static const struct imagis_properties imagis_3032c_data = { .touch_coord_cmd = IST3038C_REG_TOUCH_COORD, .whoami_cmd = IST3038C_REG_CHIPID, .whoami_val = IST3032C_WHOAMI, + .touch_keys_supported = true, }; static const struct imagis_properties imagis_3038b_data = {