From nobody Tue Oct 7 18:24:30 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 8F758221FBC; Mon, 7 Jul 2025 19:54:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751918099; cv=none; b=C7hNePsiXw3e9cTIx3oGIHLmrRnzxVKZo58LQhI5lRfyb2rANxx4luTjxeTUGzct87Jyrlvw3TIdPJGKFQTMifec8oEmJAo+/v63Wwc4n0a8l1SKsDwQorbQ5vLkwHCbEdDOq7qDr/aHhZnQdoHmM7vkTO78g4ZGZBFVundW9jQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751918099; c=relaxed/simple; bh=LVwbzxqQObC8WvjPEmgI7RLdvYu34KieafRmiDJ9gsM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WWx3K6Emo1tE5TkD/5yvwcsPYX4ZbirubYIfJWj3m4FYwqiKVnFOCMXr7L3fA8qCM7CCs9LOWt/XL+Zq2MOzh+l1Lml+3OwocyC4OIDwhObGgSM/Wcqlh5lNOcSbQcPCSJCBodpch120+Ni2wQ3mnQyngPzMJdiVMsu9jJg2qXE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PFJyM5s2; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PFJyM5s2" Received: by smtp.kernel.org (Postfix) with ESMTPS id 336A8C4CEF1; Mon, 7 Jul 2025 19:54:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1751918099; bh=LVwbzxqQObC8WvjPEmgI7RLdvYu34KieafRmiDJ9gsM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=PFJyM5s2Y1Zr+yyautWbM8vR19NSIaYM/6Ek4++YNl4jb8TNUNNu6H1aLH0KKvoMm HmUXWgCy7Qpncah0NknGtP9arSlnpRIV6IfLgbkCKzHW8ZD6dJRz3GmttC9p/0qzEo 9sxrTgwokTdSkXorFJSUlwL8CV1mOQYylonhAOS7qnKPK6OmJCYoU6B/MDebCRLwjh KX/XCG2MUGB0g0mtgVJ0HoR6tL9d+cYmQz73pNQNwheOBNErTWkGMJlbb0irfpRS4w jBXgFQlxrNr0ez6OYpouwpCc4W6okDNty12IRlXpyn8Kf+lLqp/yA3EImJAbjTLrxS agIHKLmMF0zQA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21A5BC71130; Mon, 7 Jul 2025 19:54:59 +0000 (UTC) From: =?utf-8?q?Andr=C3=A9_Apitzsch_via_B4_Relay?= Date: Mon, 07 Jul 2025 21:54:25 +0200 Subject: [PATCH 1/2] dt-bindings: input: syna,rmi4: Document F1A function Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250707-rmi4_f1a-v1-1-838d83c72e7f@apitzsch.eu> References: <20250707-rmi4_f1a-v1-0-838d83c72e7f@apitzsch.eu> In-Reply-To: <20250707-rmi4_f1a-v1-0-838d83c72e7f@apitzsch.eu> To: Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Conor Dooley , "Jason A. Donenfeld" , Matthias Schiffer , Vincent Huang Cc: ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Apitzsch?= X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1751918097; l=1574; i=git@apitzsch.eu; s=20240325; h=from:subject:message-id; bh=x6gb2zqcsU2SCeUMlPPeDX08TtoXkuo2DiW8v+WxDNM=; b=CP3W0/DjntK/rKWetcgQ7kkDFo2qbGZljiIiBTGWeZs6roaKxqIEsiOw0qI2H3ULgZCApRqJ1 W4xtD1mVcNqCBzE8XhyR2lfOh4p0Ku2QKd2BHySjtrCmLb5s4Z55ctU X-Developer-Key: i=git@apitzsch.eu; a=ed25519; pk=wxovcZRfvNYBMcTw4QFFtNEP4qv39gnBfnfyImXZxiU= X-Endpoint-Received: by B4 Relay for git@apitzsch.eu/20240325 with auth_id=142 X-Original-From: =?utf-8?q?Andr=C3=A9_Apitzsch?= Reply-To: git@apitzsch.eu From: Andr=C3=A9 Apitzsch In some configurations the touch controller can support touch keys. Document the linux,keycodes property that enables those keys and specifies the keycodes that should be used to report the key events. Signed-off-by: Andr=C3=A9 Apitzsch Reviewed-by: Rob Herring (Arm) --- .../devicetree/bindings/input/syna,rmi4.yaml | 20 ++++++++++++++++= ++++ 1 file changed, 20 insertions(+) diff --git a/Documentation/devicetree/bindings/input/syna,rmi4.yaml b/Docum= entation/devicetree/bindings/input/syna,rmi4.yaml index b522c8d3ce0db719ff379f2fefbdca79e73d027c..f369385ffaf0227412b908242de= 84cd7dbeb08f7 100644 --- a/Documentation/devicetree/bindings/input/syna,rmi4.yaml +++ b/Documentation/devicetree/bindings/input/syna,rmi4.yaml @@ -89,6 +89,24 @@ properties: required: - reg =20 + rmi4-f1a@1a: + type: object + additionalProperties: false + $ref: input.yaml# + description: + RMI4 Function 1A is for capacitive keys. + + properties: + reg: + maxItems: 1 + + linux,keycodes: + minItems: 1 + maxItems: 4 + + required: + - reg + patternProperties: "^rmi4-f1[12]@1[12]$": type: object @@ -201,6 +219,7 @@ allOf: =20 examples: - | + #include #include =20 i2c { @@ -234,6 +253,7 @@ examples: =20 rmi4-f1a@1a { reg =3D <0x1a>; + linux,keycodes =3D ; }; }; }; --=20 2.50.0 From nobody Tue Oct 7 18:24:30 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 8F6F514A62B; Mon, 7 Jul 2025 19:54:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751918099; cv=none; b=uDo2FXzmFWZGikO6ceAV1HheYRMaTNz5N4hcfHyS3zE9sn8TvrOHCiejW2j1sFbZmX3OcLmuZ/Q+USNW854dN7kNIPyBrJlTzM+FxM4wJdj+/VhlZnz7nzEDe4pBK7UTmnXfaaBBDTOH23o0Q37d7cV2IQFC3WpqJcKX2fpS5Dc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751918099; c=relaxed/simple; bh=bVFepWKjqJUGQp3Hbl6LiTadytvGMPtrFiUhO8aCs10=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=i/xKm0DpENEVj8hTpIxbLqLe2VcF5hgPPrcbe6NUqKGM7b9XpbIlelgYPLmDDfOZaghoATu9H2DvhJgiXSj7qLBWioCWmeQkqIIv6Qzlri9Pe6BbZ4pM2n0YpsZLgc9Bazq1an3GgBNM8+y8E8/48KbuZzBjuncfgSNwgQTzWMc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uWO0QkEt; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="uWO0QkEt" Received: by smtp.kernel.org (Postfix) with ESMTPS id 3EE2BC4CEEF; Mon, 7 Jul 2025 19:54:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1751918099; bh=bVFepWKjqJUGQp3Hbl6LiTadytvGMPtrFiUhO8aCs10=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=uWO0QkEtalAsY+arDDxY5tzdibLyrPkNcwhIP52WPkn9ghZdMZGXoKKva9/3Y6a0a Rck6XlBFXD04Te/rARFGMfXRd3x5ij23qNsUdRnZf0RCU3KX+0f1zK7+DIhOQYHPqz v2u8KO3exzC7X7xzDkhXaFSyEAxj1vIBgGYFmtbkqr8oq78EXEeQkNeXVXlNXglIWE zMKPdWzcOXq/0DarZetwABK077I32kB2kpRt1nzS5ZvSxTm9nReIseGLYCqFnaI+Hq DqDOWFzEB1yw66UWlUQsN7Hqxbi4rXZnpAxrzHYXOvZc9b4FTl1A584TNurOwRayO7 Y7aoDhfqD5AGQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3096FC8303C; Mon, 7 Jul 2025 19:54:59 +0000 (UTC) From: =?utf-8?q?Andr=C3=A9_Apitzsch_via_B4_Relay?= Date: Mon, 07 Jul 2025 21:54:26 +0200 Subject: [PATCH 2/2] Input: synaptics-rmi4 - add support for F1A Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250707-rmi4_f1a-v1-2-838d83c72e7f@apitzsch.eu> References: <20250707-rmi4_f1a-v1-0-838d83c72e7f@apitzsch.eu> In-Reply-To: <20250707-rmi4_f1a-v1-0-838d83c72e7f@apitzsch.eu> To: Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Conor Dooley , "Jason A. Donenfeld" , Matthias Schiffer , Vincent Huang Cc: ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Andr=C3=A9_Apitzsch?= X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1751918097; l=6632; i=git@apitzsch.eu; s=20240325; h=from:subject:message-id; bh=chU/vciUONShO2xp5FvxasPrlXeuFhwRzlTtqjnbeJY=; b=GyQWyIWwGSSKaOtjQ5lJQVkwHBGY0BBQ7joSKqZE6M+ROcV0M6j/jrSW1Xh6RRRxNBOsoUaai idbDBcZZUT4BwOMp/nbq6WLmO4XZK9yyQt/3R7jQ7AG8h/vtpX6NjX0 X-Developer-Key: i=git@apitzsch.eu; a=ed25519; pk=wxovcZRfvNYBMcTw4QFFtNEP4qv39gnBfnfyImXZxiU= X-Endpoint-Received: by B4 Relay for git@apitzsch.eu/20240325 with auth_id=142 X-Original-From: =?utf-8?q?Andr=C3=A9_Apitzsch?= Reply-To: git@apitzsch.eu From: Andr=C3=A9 Apitzsch RMI4 F1A implements capacitive keys. Add support for touch keys found in some Synaptics touch controller configurations. Signed-off-by: Andr=C3=A9 Apitzsch --- drivers/input/rmi4/Kconfig | 7 ++ drivers/input/rmi4/Makefile | 1 + drivers/input/rmi4/rmi_bus.c | 3 + drivers/input/rmi4/rmi_driver.h | 1 + drivers/input/rmi4/rmi_f1a.c | 145 ++++++++++++++++++++++++++++++++++++= ++++ 5 files changed, 157 insertions(+) diff --git a/drivers/input/rmi4/Kconfig b/drivers/input/rmi4/Kconfig index c0163b983ce698ff241eeb6303d0e29989e0fcb8..c5d18abd28c7c26a9491656608d= 65fae50e818a8 100644 --- a/drivers/input/rmi4/Kconfig +++ b/drivers/input/rmi4/Kconfig @@ -82,6 +82,13 @@ config RMI4_F12 touchpads. For sensors that support relative pointing, F12 also provides mouse input. =20 +config RMI4_F1A + bool "RMI4 Function 1A (0D pointing)" + help + Say Y here if you want to add support for RMI4 function 1A. + + Function 1A provides capacitive keys support for RMI4 devices. + config RMI4_F30 bool "RMI4 Function 30 (GPIO LED)" help diff --git a/drivers/input/rmi4/Makefile b/drivers/input/rmi4/Makefile index 02f14c84686189b45d6adbbc06e266f64efaa036..70f942196aa2efeeaa7bfd292bc= c1b8445761011 100644 --- a/drivers/input/rmi4/Makefile +++ b/drivers/input/rmi4/Makefile @@ -8,6 +8,7 @@ rmi_core-$(CONFIG_RMI4_2D_SENSOR) +=3D rmi_2d_sensor.o rmi_core-$(CONFIG_RMI4_F03) +=3D rmi_f03.o rmi_core-$(CONFIG_RMI4_F11) +=3D rmi_f11.o rmi_core-$(CONFIG_RMI4_F12) +=3D rmi_f12.o +rmi_core-$(CONFIG_RMI4_F1A) +=3D rmi_f1a.o rmi_core-$(CONFIG_RMI4_F30) +=3D rmi_f30.o rmi_core-$(CONFIG_RMI4_F34) +=3D rmi_f34.o rmi_f34v7.o rmi_core-$(CONFIG_RMI4_F3A) +=3D rmi_f3a.o diff --git a/drivers/input/rmi4/rmi_bus.c b/drivers/input/rmi4/rmi_bus.c index 3aee0483720533050c60014d843418740cf04a2d..e04fd6e525dcf474d948380d493= 249251f83a864 100644 --- a/drivers/input/rmi4/rmi_bus.c +++ b/drivers/input/rmi4/rmi_bus.c @@ -360,6 +360,9 @@ static struct rmi_function_handler *fn_handlers[] =3D { #ifdef CONFIG_RMI4_F12 &rmi_f12_handler, #endif +#ifdef CONFIG_RMI4_F1A + &rmi_f1a_handler, +#endif #ifdef CONFIG_RMI4_F30 &rmi_f30_handler, #endif diff --git a/drivers/input/rmi4/rmi_driver.h b/drivers/input/rmi4/rmi_drive= r.h index 3bfe9013043ef3dff46249095a5b3116c8f7d9a6..aefe04008509b4363aa1aaf59d9= 119d95383e942 100644 --- a/drivers/input/rmi4/rmi_driver.h +++ b/drivers/input/rmi4/rmi_driver.h @@ -133,6 +133,7 @@ extern struct rmi_function_handler rmi_f01_handler; extern struct rmi_function_handler rmi_f03_handler; extern struct rmi_function_handler rmi_f11_handler; extern struct rmi_function_handler rmi_f12_handler; +extern struct rmi_function_handler rmi_f1a_handler; extern struct rmi_function_handler rmi_f30_handler; extern struct rmi_function_handler rmi_f34_handler; extern struct rmi_function_handler rmi_f3a_handler; diff --git a/drivers/input/rmi4/rmi_f1a.c b/drivers/input/rmi4/rmi_f1a.c new file mode 100644 index 0000000000000000000000000000000000000000..107f52dd9e1468c2b7c0400bb24= f5b0cf2928714 --- /dev/null +++ b/drivers/input/rmi4/rmi_f1a.c @@ -0,0 +1,145 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (c) 2025 Andr=C3=A9 Apitzsch + */ + +#include +#include +#include "rmi_driver.h" + +#define RMI_F1A_BUTTON_BITMASK_SIZE 1 + +struct f1a_data { + u32 *keymap; + unsigned int num_keys; + + struct input_dev *input; +}; + +static int rmi_f1a_parse_device_properties(struct rmi_function *fn, struct= f1a_data *f1a) +{ + static const char buttons_property[] =3D "linux,keycodes"; + struct device *dev =3D &fn->dev; + u32 *buttonmap; + int n_keys; + int ret; + + if (!device_property_present(dev, buttons_property)) + return 0; + + n_keys =3D device_property_count_u32(dev, buttons_property); + if (n_keys <=3D 0) { + ret =3D n_keys < 0 ? n_keys : -EINVAL; + dev_err(dev, "Invalid/malformed '%s' property: %d\n", + buttons_property, ret); + return ret; + } + + buttonmap =3D devm_kmalloc_array(dev, n_keys, sizeof(*buttonmap), + GFP_KERNEL); + if (!buttonmap) + return -ENOMEM; + + ret =3D device_property_read_u32_array(dev, buttons_property, buttonmap, + n_keys); + if (ret) { + dev_err(dev, "Failed to parse '%s' property: %d\n", + buttons_property, ret); + return ret; + } + + f1a->keymap =3D buttonmap; + f1a->num_keys =3D n_keys; + + return 0; +} + +static irqreturn_t rmi_f1a_attention(int irq, void *ctx) +{ + struct rmi_function *fn =3D ctx; + struct f1a_data *f1a =3D dev_get_drvdata(&fn->dev); + char button_bitmask; + int key; + int ret; + + ret =3D rmi_read_block(fn->rmi_dev, fn->fd.data_base_addr, + &button_bitmask, RMI_F1A_BUTTON_BITMASK_SIZE); + if (ret < 0) { + dev_err(&fn->dev, "Failed to read object data. Code: %d.\n", + ret); + return IRQ_RETVAL(ret); + } + + for (key =3D 0; key < f1a->num_keys; key++) + input_report_key(f1a->input, f1a->keymap[key], + button_bitmask & BIT(key)); + + return IRQ_HANDLED; +} + +static int rmi_f1a_config(struct rmi_function *fn) +{ + struct f1a_data *f1a =3D dev_get_drvdata(&fn->dev); + struct rmi_driver *drv =3D fn->rmi_dev->driver; + + if (f1a->num_keys) + drv->set_irq_bits(fn->rmi_dev, fn->irq_mask); + + return 0; +} + +static int rmi_f1a_initialize(struct rmi_function *fn, struct f1a_data *f1= a) +{ + int ret; + int i; + + ret =3D rmi_f1a_parse_device_properties(fn, f1a); + if (ret) + return ret; + + for (i =3D 0; i < f1a->num_keys; i++) + input_set_capability(f1a->input, EV_KEY, f1a->keymap[i]); + + f1a->input->keycode =3D f1a->keymap; + f1a->input->keycodemax =3D f1a->num_keys; + f1a->input->keycodesize =3D sizeof(f1a->keymap[0]); + + return 0; +} + +static int rmi_f1a_probe(struct rmi_function *fn) +{ + struct rmi_device *rmi_dev =3D fn->rmi_dev; + struct rmi_driver_data *drv_data =3D dev_get_drvdata(&rmi_dev->dev); + struct f1a_data *f1a; + int ret; + + if (!drv_data->input) { + dev_info(&fn->dev, "F1A: no input device found, ignoring\n"); + return -ENXIO; + } + + f1a =3D devm_kzalloc(&fn->dev, sizeof(*f1a), GFP_KERNEL); + if (!f1a) + return -ENOMEM; + + f1a->input =3D drv_data->input; + + ret =3D rmi_f1a_initialize(fn, f1a); + if (ret) + return ret; + + dev_set_drvdata(&fn->dev, f1a); + + return 0; +} + +struct rmi_function_handler rmi_f1a_handler =3D { + .driver =3D { + .name =3D "rmi4_f1a", + }, + .func =3D 0x1a, + .probe =3D rmi_f1a_probe, + .config =3D rmi_f1a_config, + .attention =3D rmi_f1a_attention, +}; --=20 2.50.0