From patchwork Sat Jan 20 21:16:12 2024 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: 189770 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp1806642dyb; Sat, 20 Jan 2024 13:18:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IHipsygWNQfsBnC0rffTAzqgXJx5gERqRIM9QB/3EovA38thCG2O21tRZdY12oy7RoUkSty X-Received: by 2002:a05:6870:d88b:b0:210:a7f7:90a0 with SMTP id oe11-20020a056870d88b00b00210a7f790a0mr1013491oac.72.1705785515904; Sat, 20 Jan 2024 13:18:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705785515; cv=pass; d=google.com; s=arc-20160816; b=NVl7NxgrPLNMIuCC2nbDb3it/QbxnJpdSP35ISL1hwQdMZ4UTh+InrxJM92By2Kk2+ jlP8uon3MYnBC23kfr2eMgscCiKPp4t0oMHyyhTruCPfZ6suh9q6GocMZy4uHZcS0nmP TAUBPPGvuEYy5lY2g7+e6OpHfzKp9SaY/8vdg/MZ3+aDgb3FbkeiQ4HGcHhNWSR+T2Ae R9SQYQh9FkiboUko/qfllmVuRyPQg7tfSRK9yvBLE2nW45ZAEkBi4n+hRIDLzaP0Ke/K ZE1UAXXnrGTL3PxgHAauxEosN41flo/4aAi1U4lvihtXzoY4PTQPyYw/7i4JosUp3/34 Ibig== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from; bh=1xc4nHCTlV36fL0Oh2R3XSejNEy0OWfOc8VKL8jv+5Q=; fh=7y/BXAL2WjmcLpZpUt5CHSwguDUHgUmXGD5OvX4L6LI=; b=V9kPGmmJMMS18f+BaS/O0rW0OMVeRqrf7x/1lbl+w2DA62OJtBnJDwxGrIbFFGs7WJ 0JwuQQAwd+9fGy8MlhuiQHeCQle8qLNX1MnDoexV9YEUHitmSbqcAMSpp6O3IrIRiZNw oAF3qh5HuWahn/IdIrCXuUdiVG8JglzAHKEQkLK3RnqtLFgeCFGbPiEOl6CiXC8mJboz xNAuBDZyT9mweFWJApydClhCEkG/VAngPKZlYT8lHTzpWAf7YOEZQUsGxAH7taCNNLe3 f7EOd+u+Iw/iyuzAXz4uyMNno7EyiLSPTDl3kfXse+BH0HJpNZ/ZdAGM1v1p9BCjTXxv 98rQ== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=skole.hr); spf=pass (google.com: domain of linux-kernel+bounces-31921-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-31921-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id m5-20020a0cac45000000b0068198fab266si2332988qvb.495.2024.01.20.13.18.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 20 Jan 2024 13:18:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-31921-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=skole.hr); spf=pass (google.com: domain of linux-kernel+bounces-31921-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-31921-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id AD2EA1C20A8C for ; Sat, 20 Jan 2024 21:18:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7AEDD156DA; Sat, 20 Jan 2024 21:17:32 +0000 (UTC) Received: from mx.skole.hr (mx1.hosting.skole.hr [161.53.165.185]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9C1B512E69; Sat, 20 Jan 2024 21:17:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=161.53.165.185 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705785450; cv=none; b=PEe0V6bymT4H6jJ56NfWdt0vdDWzQ4j42mbjFRbbTXfAed4GrlQ2czpEdjKP25ii3XrVwrxd+xVjC0IHuB7QWJvGoCP3tqPMpnqdU/Axi/uMuvGW+roTLdwnn39/qIrwjA8lIkQkvp/pCduv+yUkUS0xLR1nysbBUAIuJbLFLdU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705785450; c=relaxed/simple; bh=HkH+vQVtnzp58TbYVvbF+AErNiS1VapFH1SJiTr4Ntc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HJmPaUfcczQHKgKcCwsUHKeWLGy6EQlEO690+1BI37DRGA910mWgNPoxRZEDzhjUK85xluafPF0s5Xs8zPw/EXF0bNc9wQ/y6uiT4VodcYUbM7RYdwLaiLRq/8t6ltIDQkZPryfuUVwdA7nfzM3VYB+5sWM8sUqM0KGSSdvQ0LQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=skole.hr; spf=pass smtp.mailfrom=skole.hr; arc=none smtp.client-ip=161.53.165.185 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=skole.hr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=skole.hr Received: from mx1.hosting.skole.hr (localhost.localdomain [127.0.0.1]) by mx.skole.hr (mx.skole.hr) with ESMTP id DB471858ED; Sat, 20 Jan 2024 22:17:18 +0100 (CET) From: =?utf-8?q?Duje_Mihanovi=C4=87?= Date: Sat, 20 Jan 2024 22:16:12 +0100 Subject: [PATCH v2 1/3] input: touchscreen: imagis: use FIELD_GET where applicable Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240120-b4-imagis-keys-v2-1-d7fc16f2e106@skole.hr> References: <20240120-b4-imagis-keys-v2-0-d7fc16f2e106@skole.hr> In-Reply-To: <20240120-b4-imagis-keys-v2-0-d7fc16f2e106@skole.hr> To: Markuss Broks , Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Karel Balej , ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, devicetree@vger.kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Duje_M?= =?utf-8?q?ihanovi=C4=87?= X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=2661; i=duje.mihanovic@skole.hr; h=from:subject:message-id; bh=HkH+vQVtnzp58TbYVvbF+AErNiS1VapFH1SJiTr4Ntc=; b=owEBbQKS/ZANAwAIAZoRnrBCLZbhAcsmYgBlrDg6E9hQFx+YWa5pOqRF78NBCoveP29c0sQXz AD+pSsBfHiJAjMEAAEIAB0WIQRT351NnD/hEPs2LXiaEZ6wQi2W4QUCZaw4OgAKCRCaEZ6wQi2W 4SXAD/9cfdf0mVQstfUebgEAeyh511rtJcGRK0O/bVvRpVy1POWrgwRo0eh4JfGY0OpPY6yoTAG EA59O9DsMoSdO65Lxx8GIMkBsfrVn5Ra+1Eqm3FD9EBs1Ox9PwEBCzMyENRzBdf0QuftotFIUCs Qs7bXsQNx/lk/tG8rDVhI3JRrXZri5hpuFSrCPAdCj6e32Bs5aBqHWIbDE3TOzPGJTjQN2q+iiX J145ao0eGXhnqoQW/vWiazqU3G25vkuHOFVt2TFmnl1xQRknlZHvdyKRmp8HJJ+eLMBbvMmp1rB I9htluIZf2SNa9yBO4c43KUy4b2IC1TEjB/W2SSiqcmxTvJ/qs85oD3g8fER4byoqSENUNJjUCH 6Chmj3jkHwA3lgyVN7Iw4Srcsxbb1ZbCP6no8jsVePJ1Iw042DfJ/NTsYx0AlvSd3rGTDt6w4zj E3TN7+W707BEsWvonMjALY5ZZFL9Q5CFW7z5Abbp4pBE7XA/Vq+M29wRgfp/xL68ZBvweUnqZIZ YOELf+ZZOgsOiGDTHzmXlz+LMxLoeSgARFG/ad77AHI3O/yLl+wRl7GoguUv++o8KgI6ukY6rgy bnrLJ/7Y4K2k7GFQGAgT1ri6Pge/8GiDR+nbIDHrO3HWwqE3yBfexd8s5VEWUffkwr3zpvX41q0 kwEeI8PE7eB0Skw== X-Developer-Key: i=duje.mihanovic@skole.hr; a=openpgp; fpr=53DF9D4D9C3FE110FB362D789A119EB0422D96E1 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788645753172162871 X-GMAIL-MSGID: 1788645753172162871 Instead of manually extracting certain bits from registers with binary ANDs and shifts, the FIELD_GET macro can be used. With this in mind, the *_SHIFT macros can be dropped. Signed-off-by: Duje Mihanović --- drivers/input/touchscreen/imagis.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/input/touchscreen/imagis.c b/drivers/input/touchscreen/imagis.c index e1fafa561ee3..4eae98771bd2 100644 --- a/drivers/input/touchscreen/imagis.c +++ b/drivers/input/touchscreen/imagis.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only +#include #include #include #include @@ -29,12 +30,9 @@ #define IST3038C_I2C_RETRY_COUNT 3 #define IST3038C_MAX_FINGER_NUM 10 #define IST3038C_X_MASK GENMASK(23, 12) -#define IST3038C_X_SHIFT 12 #define IST3038C_Y_MASK GENMASK(11, 0) #define IST3038C_AREA_MASK GENMASK(27, 24) -#define IST3038C_AREA_SHIFT 24 #define IST3038C_FINGER_COUNT_MASK GENMASK(15, 12) -#define IST3038C_FINGER_COUNT_SHIFT 12 #define IST3038C_FINGER_STATUS_MASK GENMASK(9, 0) struct imagis_properties { @@ -106,8 +104,7 @@ static irqreturn_t imagis_interrupt(int irq, void *dev_id) goto out; } - finger_count = (intr_message & IST3038C_FINGER_COUNT_MASK) >> - IST3038C_FINGER_COUNT_SHIFT; + finger_count = FIELD_GET(IST3038C_FINGER_COUNT_MASK, intr_message); if (finger_count > IST3038C_MAX_FINGER_NUM) { dev_err(&ts->client->dev, "finger count %d is more than maximum supported\n", @@ -115,7 +112,7 @@ static irqreturn_t imagis_interrupt(int irq, void *dev_id) goto out; } - finger_pressed = intr_message & IST3038C_FINGER_STATUS_MASK; + finger_pressed = FIELD_GET(IST3038C_FINGER_STATUS_MASK, intr_message); for (i = 0; i < finger_count; i++) { if (ts->tdata->protocol_b) @@ -136,12 +133,10 @@ static irqreturn_t imagis_interrupt(int irq, void *dev_id) input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, finger_pressed & BIT(i)); touchscreen_report_pos(ts->input_dev, &ts->prop, - (finger_status & IST3038C_X_MASK) >> - IST3038C_X_SHIFT, - finger_status & IST3038C_Y_MASK, 1); + FIELD_GET(IST3038C_X_MASK, finger_status), + FIELD_GET(IST3038C_Y_MASK, finger_status), 1); input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, - (finger_status & IST3038C_AREA_MASK) >> - IST3038C_AREA_SHIFT); + FIELD_GET(IST3038C_AREA_MASK, finger_status)); } input_mt_sync_frame(ts->input_dev); From patchwork Sat Jan 20 21:16:13 2024 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: 189768 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp1806533dyb; Sat, 20 Jan 2024 13:18:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IGgl0jFyL9jSaX8AMxyAj18iCH1f0aK2PtBAmZXXIFzF9H+bUMCUe28AnJeVjP7kF1mH9OR X-Received: by 2002:a05:6830:6994:b0:6db:a0e9:f248 with SMTP id cy20-20020a056830699400b006dba0e9f248mr2747744otb.37.1705785496743; Sat, 20 Jan 2024 13:18:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705785496; cv=pass; d=google.com; s=arc-20160816; b=W0F/PcNkhU5wGn/DfzcFO99ccnmLzueEpK8RQkYrKBOC1TSPW1ALsyTVo/JJi0k1Iv p1pf8HoiwrrkpdMzkJeJ6nCnaqBnLC76ulBkad0Hvfb6HG7Hkzs/enbwcl/zaLW0/wa7 Tb4ZRXgZ5iwDVqOYquJ+m7gOOM0Zq9WUX4eQSu/7aP0KPUY9s++E0jNiLLGPbFEm6TbR 06hJl8+8UnziWU0zu2Yp1i3OU74EtiDiGFLhzz+7UaiAaqsRP1VzjUPlQsLkw55TMdi8 4cz9CjUWiu4myqVNvEeC2sNcWCf+DG7CXp9tCA53N1f+YVZruGh275OYmelVZbcKfrr1 jfWg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from; bh=HPxn29KwGaeSox5HYn5YFQJOXOHv10M7jgn40XfFve0=; fh=7y/BXAL2WjmcLpZpUt5CHSwguDUHgUmXGD5OvX4L6LI=; b=tyIf2/rXzQO3iQ5IUjkN4c6owwzlcdYmkLUxtbaRuYBqfKbNQI128R27H3hQhze+KY 8eVhca7zMlALLUP86DReaoATvNW+Orqkk6AvOyk6RQ2QSGLnKdN9AGAMYcng3sMV6qlY mkmvIJCbZl7QQgKMW1hp2PfdapRxspvturpbgYU8tPn8oqDCvCKj1iv8CWBtzNr7T/61 nA8RGLTqqdREQTDGDauyMF6v/YZInddeisddd2Rva1mY1pYzHI3mfgzS8uzKdDksuqvL kOyXKBirOQcJxJoM/vcoqJuvOt9j0iAIxSHJQzDPDxRNcqBAfPuE2s6IcZDMSw8Jncrw BpfQ== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=skole.hr); spf=pass (google.com: domain of linux-kernel+bounces-31918-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-31918-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id s13-20020a65644d000000b005ca5b61ca6asi5547154pgv.81.2024.01.20.13.18.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 20 Jan 2024 13:18:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-31918-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=skole.hr); spf=pass (google.com: domain of linux-kernel+bounces-31918-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-31918-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7D24C2829C6 for ; Sat, 20 Jan 2024 21:18:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A71D1154A1; Sat, 20 Jan 2024 21:17:31 +0000 (UTC) Received: from mx.skole.hr (mx2.hosting.skole.hr [161.53.165.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 51F2CEC9; Sat, 20 Jan 2024 21:17:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=161.53.165.186 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705785450; cv=none; b=HX8DpIrQ+I2o1hzxDbINID27/R/J+et1sQ/PQA4Jxdl62zstg6EXvuGunazXOM0NDjv+dmAMwJuiuS6HgQsjD5VN8oBUnoZKjQjA+3zuFTdR3qwEUhtJzCjJ2HSrTTdtjEMrmfPlrJpCcm2N+aSTpGXSK1IiIfm/vxaZJAMVJLc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705785450; c=relaxed/simple; bh=TQbvdedocH+ZVWb2kPtn6fq1z3XkIwKlGuuer4LHqsM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jTLFbx8orpwX/w2jsPdFSysoK6/61NF4U7nNVfJUX4CI64YNKarNmvLIvd4LlbdRuFfAobmaDoyj0ktZTHvUsiqLWky0c3mwH98R/eOnukAZ2lDrWnxeK/Aj6xAEHhry7a67wR4rZcnZNLlMaMDd3R5f6hbHPUw44Xgwo5+vTi8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=skole.hr; spf=pass smtp.mailfrom=skole.hr; arc=none smtp.client-ip=161.53.165.186 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=skole.hr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=skole.hr Received: from mx2.hosting.skole.hr (localhost.localdomain [127.0.0.1]) by mx.skole.hr (mx.skole.hr) with ESMTP id 620FA86C66; Sat, 20 Jan 2024 22:17:19 +0100 (CET) From: =?utf-8?q?Duje_Mihanovi=C4=87?= Date: Sat, 20 Jan 2024 22:16:13 +0100 Subject: [PATCH v2 2/3] dt-bindings: input: imagis: Document touch keys Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240120-b4-imagis-keys-v2-2-d7fc16f2e106@skole.hr> References: <20240120-b4-imagis-keys-v2-0-d7fc16f2e106@skole.hr> In-Reply-To: <20240120-b4-imagis-keys-v2-0-d7fc16f2e106@skole.hr> To: Markuss Broks , Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Karel Balej , ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, devicetree@vger.kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Duje_M?= =?utf-8?q?ihanovi=C4=87?= X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=991; i=duje.mihanovic@skole.hr; h=from:subject:message-id; bh=TQbvdedocH+ZVWb2kPtn6fq1z3XkIwKlGuuer4LHqsM=; b=owEBbQKS/ZANAwAIAZoRnrBCLZbhAcsmYgBlrDg698+s1stUHo6E4hlj8Bs2/NjFik9nJaD4F TZyGdtFaWSJAjMEAAEIAB0WIQRT351NnD/hEPs2LXiaEZ6wQi2W4QUCZaw4OgAKCRCaEZ6wQi2W 4Q2VD/9fBmq7wp16hYjZFFEYFLh4ZSsLjHfJOQZihoNJ4t6awI+4cdp9OdagsufIiEHoUGasHeo sXibTy/3xflg0npikVBiuwUdGP8kuO/ZJfPML2DcZNpA0TCnueBD2+/Obd1B8RmPTsTKGeX1cX8 VnpsTzYISm7+JPOY/q2TrmkAi28cgMFPYfQlgpAtQw4rT3v2ouhGbCtw9PqfFdJ4geEpBkxx5eA DYRtLJgg2ZyOzpu679VJWxB5DTUd44rnAMChwO3Q63LYrjW7hlXywNVaNX5qxwQ7jzIIicIudtv mEWBcMs3997tJyE1KGuAYFOPfrdqRRPCD370YYa4TQyqCjHPNw56dBl9nfFE5Td8SUT5afpIvzk mDef9BCtlq+PK5ktnnPtQqsrC7VeDl4GFfXPfxOjaa3kGHB70CiWFQiSTWd7hOEnxhSMgWesS6T GHOx25VdTkNG5y160x7DHvRo/bATOTovsWjJDgZadIb2Z57/Nkg5R4OZszMFte03eKw6efu594s u6mZqDuN1/hZBhhdsxPv52kTxG60/vPblkZj8s57mu65gLEHvV3jtg9aZsGDqS+AZVbSd+T53GP mK97pxt8SbNOgp74BYJVmLR3ER8RE2xAZ4QzElDyXJivbDi9Xr7VVN57J/TOfjyq25Xv9gJ3/Bo +z+czi7YqJrAusw== X-Developer-Key: i=duje.mihanovic@skole.hr; a=openpgp; fpr=53DF9D4D9C3FE110FB362D789A119EB0422D96E1 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788645732975524100 X-GMAIL-MSGID: 1788645732975524100 IST3032C (and possibly some other models) has touch keys. Document this. Signed-off-by: Duje Mihanović --- .../bindings/input/touchscreen/imagis,ist3038c.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Documentation/devicetree/bindings/input/touchscreen/imagis,ist3038c.yaml b/Documentation/devicetree/bindings/input/touchscreen/imagis,ist3038c.yaml index 2af71cbcc97d..960e5436642f 100644 --- a/Documentation/devicetree/bindings/input/touchscreen/imagis,ist3038c.yaml +++ b/Documentation/devicetree/bindings/input/touchscreen/imagis,ist3038c.yaml @@ -42,6 +42,17 @@ properties: touchscreen-inverted-y: true touchscreen-swapped-x-y: true +if: + properties: + compatible: + contains: + const: imagis,ist3032c +then: + properties: + linux,keycodes: + description: Keycodes for the touch keys + maxItems: 2 + additionalProperties: false required: From patchwork Sat Jan 20 21:16:14 2024 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: 189769 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp1806578dyb; Sat, 20 Jan 2024 13:18:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IE8QEnt5MC/crx8J86iYFRf2u5MGE1jheqQHUUR9uEhHlkbcd8gG63vPYqTb0Mt9z08MMfa X-Received: by 2002:a1c:7c0a:0:b0:40e:437c:7db2 with SMTP id x10-20020a1c7c0a000000b0040e437c7db2mr692193wmc.211.1705785505006; Sat, 20 Jan 2024 13:18:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705785504; cv=pass; d=google.com; s=arc-20160816; b=pSO6Gt84oYXtRHvld7C/QxJuqHKl9g+ZyY256GpXlcxtvtcPGy6ci0kFeKNON14le1 dzCjicwMMjjsSQ+Potepkxc4KpeqYZ4MlBmhzCZS4RroC9qfYggiPBgjf0t/hMhc7uN0 ZRzfZzTtRS37UA5VncHkUhH5XWdXpnrp4m9xDVMzCTdbDZoxOQdZbvjJmjji6U6IaJ21 W5zL02Q5nn/uTjMT0Hqvwc+WmTcnWwpFP+2rxe5mDtcQsXIvqZDu4pCNjIRrKs0grqlu W2C5tVkTiKak3rdT4f4K2oMTZnOKKBKKgV6G+kNWV60BConRC8UGiZXFqDjYMXwEtcEI GF+Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from; bh=AF1t6qn4CsWK7v6FbG/8JCqeUGf+vGe6cISb7xHtytY=; fh=7y/BXAL2WjmcLpZpUt5CHSwguDUHgUmXGD5OvX4L6LI=; b=MmNxf/rlPHcGyAYvmbE/emcOeepdBFmKehAou1xbEBiFCPp2Gfd2mm7Ti/GhmyzGb8 lZF9tJkvsdaTOZzA63XQTKrkEAZmbqZw0YfaDBBlzgA1I8gOXpFNu2oRUygixEz/NAs4 /WT9Klp2dwoZdUe7EqGSh3dWqvALoh/yO1c2jC5Letr8VTN/ah7M9bkR4BpVXMNRp5lY md1+63Jkd+IF1uE0wVXidAd1evWFVCHepQL9i7yJeVRW7d+fq/JaPlCnhNY5lMKrhyBG Cu6aTPMEg//ZWqfSJCSha7sYXPiRBEU6TVV0fdAHCeg5vWNzi76S6LsHUbZ5oumdN314 r40Q== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=skole.hr); spf=pass (google.com: domain of linux-kernel+bounces-31919-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-31919-ouuuleilei=gmail.com@vger.kernel.org" Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id f16-20020a0564021e9000b0055872d17150si9411396edf.257.2024.01.20.13.18.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 20 Jan 2024 13:18:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-31919-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=skole.hr); spf=pass (google.com: domain of linux-kernel+bounces-31919-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-31919-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 9F5BB1F21A37 for ; Sat, 20 Jan 2024 21:18:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E21C4154B2; Sat, 20 Jan 2024 21:17:31 +0000 (UTC) Received: from mx.skole.hr (mx1.hosting.skole.hr [161.53.165.185]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CE0E612E74; Sat, 20 Jan 2024 21:17:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=161.53.165.185 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705785450; cv=none; b=NGf6b62eVBV13e/UY25lOJ7mITj2udyDqRrifUQGHZXrtrrSjKVxvkyZAOelJRA2t91J4gKz6vAHCQ0NlVfemQitEvRAdltkCLUOh0iuxkZr3CxAJDpKx2CrztiDyhwhJyDdb62ZBYlH2x9HS9EmYAjGBgswvDf945Chlqbc8J4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705785450; c=relaxed/simple; bh=LH6ZLfgoff66ZwAlyeYtpywp7yWss44d2lazAs30kCc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Cc9xHfvjOCPeqiMLSPrtUMhSc9ZuL2abGcvoR6TygOrj7sunfmPlug+PsynevG9CQpsGCDGi09Af1uDKnvywvVxvnD3zf074+IdfPVpNrfaCaCVyjLZMivxWsvWzOBquxHLPZnsZ3nRK8arrgrI69F/lvQmc9hMEAUP70aRSzSY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=skole.hr; spf=pass smtp.mailfrom=skole.hr; arc=none smtp.client-ip=161.53.165.185 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=skole.hr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=skole.hr Received: from mx1.hosting.skole.hr (localhost.localdomain [127.0.0.1]) by mx.skole.hr (mx.skole.hr) with ESMTP id EC665858EE; Sat, 20 Jan 2024 22:17:19 +0100 (CET) From: =?utf-8?q?Duje_Mihanovi=C4=87?= Date: Sat, 20 Jan 2024 22:16:14 +0100 Subject: [PATCH v2 3/3] input: touchscreen: imagis: Add touch key support Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240120-b4-imagis-keys-v2-3-d7fc16f2e106@skole.hr> References: <20240120-b4-imagis-keys-v2-0-d7fc16f2e106@skole.hr> In-Reply-To: <20240120-b4-imagis-keys-v2-0-d7fc16f2e106@skole.hr> To: Markuss Broks , Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Karel Balej , ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, devicetree@vger.kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Duje_M?= =?utf-8?q?ihanovi=C4=87?= X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=openpgp-sha256; l=3081; i=duje.mihanovic@skole.hr; h=from:subject:message-id; bh=LH6ZLfgoff66ZwAlyeYtpywp7yWss44d2lazAs30kCc=; b=owEBbQKS/ZANAwAIAZoRnrBCLZbhAcsmYgBlrDg6qi6DWG3TGF42j2WG9tpTnc8py/AIyrOUR aiwjYe7UGyJAjMEAAEIAB0WIQRT351NnD/hEPs2LXiaEZ6wQi2W4QUCZaw4OgAKCRCaEZ6wQi2W 4aV2D/9hp7+munQtbVCtFWxV/mJAmTdshNy21+k3SfhPbxFQt7/NQDu4rMBm0c5juAS0U1D2Fhi fZjQDl91vFJcvnj0V1U7evYCExv6tfqewE+ZOC4PkbyuyNEwsERh3AMITU1zAsqTcHjdTpP3bLh 6v/8Q9YxGWNzOrBSLaAEYhcsmTsSAVQP3sNhrV/NZGf78pVYIt2ylefXspv6wjcj/9H7oerozVA ewUyv1fZwL5Ecs6uAbyuIrh4rsRp0p2auRd0U3GzknQ+UkqeMNDFGfjFD/4VP+paTxYCLJi4a96 kcuoKLFICecpgE7MMciKY+OZ64YRjk40tw9HoIzcv1CBrBZbpchAd1xJ7OCvFNlFWSK/Cc8MJiO yeX8tOsZwwFUiseJtaP3mGkLIZzuX6O6xXlYJyuWDY99Xt09b+Yl3CIphImJ9J8Jlqi5RDdtd8q OTIsgmNuEKcYTfXU0yxTW/w/ma7rPeP14IGTxd9THMh5JV89S4QpnIdxe3a9385tHL+Axj7VNn9 0uRUSQPnl01/n8fov4fXy69piJAezC46lyzCqneFcU9HnWfhwR3j0tRJ4RgQvmTXTnAq/1hpWBx 5y9WMoCyJvskiJqIAfII8fsWUHPY8jIVzWEnDtUlN7zi8frSmYrQBuaxzGFuzlCUsz/V5FjVfLi R7BhC/PXFOQPcGw== X-Developer-Key: i=duje.mihanovic@skole.hr; a=openpgp; fpr=53DF9D4D9C3FE110FB362D789A119EB0422D96E1 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788645741482473919 X-GMAIL-MSGID: 1788645741482473919 IST3032C (and possibly some other models) has touch keys. Add support for them to the imagis driver. Signed-off-by: Duje Mihanović --- drivers/input/touchscreen/imagis.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/drivers/input/touchscreen/imagis.c b/drivers/input/touchscreen/imagis.c index 4eae98771bd2..6dcb82313c32 100644 --- a/drivers/input/touchscreen/imagis.c +++ b/drivers/input/touchscreen/imagis.c @@ -34,6 +34,7 @@ #define IST3038C_AREA_MASK GENMASK(27, 24) #define IST3038C_FINGER_COUNT_MASK GENMASK(15, 12) #define IST3038C_FINGER_STATUS_MASK GENMASK(9, 0) +#define IST3032C_KEY_STATUS_MASK GENMASK(20, 16) struct imagis_properties { unsigned int interrupt_msg_cmd; @@ -41,6 +42,7 @@ struct imagis_properties { unsigned int whoami_cmd; unsigned int whoami_val; bool protocol_b; + bool touch_keys_supported; }; struct imagis_ts { @@ -49,6 +51,8 @@ struct imagis_ts { struct input_dev *input_dev; struct touchscreen_properties prop; struct regulator_bulk_data supplies[2]; + u32 keycodes[2]; + int num_keycodes; }; static int imagis_i2c_read_reg(struct imagis_ts *ts, @@ -93,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; @@ -139,6 +143,11 @@ static irqreturn_t imagis_interrupt(int irq, void *dev_id) FIELD_GET(IST3038C_AREA_MASK, finger_status)); } + key_pressed = FIELD_GET(IST3032C_KEY_STATUS_MASK, intr_message); + + for (int i = 0; i < ts->num_keycodes; i++) + input_report_key(ts->input_dev, ts->keycodes[i], (key_pressed & BIT(i))); + input_mt_sync_frame(ts->input_dev); input_sync(ts->input_dev); @@ -224,6 +233,19 @@ 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) { + ts->num_keycodes = of_property_read_variable_u32_array( + ts->client->dev.of_node, "linux,keycodes", + ts->keycodes, 0, ARRAY_SIZE(ts->keycodes)); + if (ts->num_keycodes <= 0) { + ts->keycodes[0] = KEY_APPSELECT; + ts->keycodes[1] = KEY_BACK; + ts->num_keycodes = 2; + } + } + + for (int i = 0; i < ts->num_keycodes; i++) + input_set_capability(input_dev, EV_KEY, ts->keycodes[i]); touchscreen_parse_properties(input_dev, true, &ts->prop); if (!ts->prop.max_x || !ts->prop.max_y) { @@ -365,6 +387,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 = {