From patchwork Sat May 3 09:08:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaustabh Chakraborty X-Patchwork-Id: 887052 Received: from layka.disroot.org (layka.disroot.org [178.21.23.139]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0BCA41B3956; Sat, 3 May 2025 09:08:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.21.23.139 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746263334; cv=none; b=I/fvHit5nWmMlTg6K7/HhydiBSNo5NDOTObsrEs4QvPsSl3QjXpz7RP9rmEh7KvzSjpZnHstblGL23NaUogOzMneCdYCzJujtgfR2KED/6Hku2lB11etAXbEfSL0ecuRLFrZfFNJDI+UYg+9UvoxDkjOZIbB/Cx8Cv6dhVJ80o4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746263334; c=relaxed/simple; bh=JDWmFaDxoZVY3gQxu6nB8V2vVs15BbtJjuJfl1PZll8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DwbNb3QJkm2dTLWjBcTPcPHlSX/SRnvSDLgLMqcsE2o9wRIUymmKjkIoIBH/k4us80bkD3ZFC2qz5sVU2ckbiQvLhg/ZAZK/M7Z4yPDssY8SBqpmsf9fVKUkeb+a2XuVonoMCYNai/YGdaiou9ks8j8egJTfqst2Fk4Ko7czvuU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=disroot.org; spf=pass smtp.mailfrom=disroot.org; dkim=pass (2048-bit key) header.d=disroot.org header.i=@disroot.org header.b=Nz9Q+Dit; arc=none smtp.client-ip=178.21.23.139 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=disroot.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=disroot.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=disroot.org header.i=@disroot.org header.b="Nz9Q+Dit" Received: from mail01.disroot.lan (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id 1786925ED4; Sat, 3 May 2025 11:08:50 +0200 (CEST) X-Virus-Scanned: SPAM Filter at disroot.org Received: from layka.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id qdsQ83TAFIVs; Sat, 3 May 2025 11:08:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1746263329; bh=JDWmFaDxoZVY3gQxu6nB8V2vVs15BbtJjuJfl1PZll8=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=Nz9Q+Dit/VyelFL41ecgnR90UZhdFzNfLWY775bu2LKk/svJh5IkP/id4PJ9wngZI ZXeYLSbaLldv8ZHKp9Pe20Z9nbjWqm/DNrqFhbWDzO9r2YR+M1Mi2imuTTrf9fe5xK CHNmZA5NQ8PhE5PIS4dFoySAKwOuSzC9ii+0w6orajs4n/Rpk1vr3pjciKNCNI++ef sPoUxHqpDfM0CPNrp9Khu+9wUz5Jtt9ge7DdYcHoye6DIab7sxKHjGaFlYMMVdj9ZH 4rSMI2pyKKzrae4zCNn6SqXaHCyl9EADkbIwbs8s7GGspQ39SLBzsLQjmytYCCBzdS W4XoP3AxGCOIA== From: Kaustabh Chakraborty Date: Sat, 03 May 2025 14:38:27 +0530 Subject: [PATCH RFC 1/4] dt-bindings: input: melfas-mip4: document linux,keycodes property Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250503-mip4-touchkey-v1-1-b483cda29a5b@disroot.org> References: <20250503-mip4-touchkey-v1-0-b483cda29a5b@disroot.org> In-Reply-To: <20250503-mip4-touchkey-v1-0-b483cda29a5b@disroot.org> To: Sangwon Jee , Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Henrik Rydberg Cc: linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Kaustabh Chakraborty X-Developer-Signature: v=1; a=ed25519-sha256; t=1746263323; l=1179; i=kauschluss@disroot.org; s=20250202; h=from:subject:message-id; bh=JDWmFaDxoZVY3gQxu6nB8V2vVs15BbtJjuJfl1PZll8=; b=zHf3GWA9mgYVqAJKyKz0DaMzGfak5Y06FmzYPjE0g+4kmNt4/kC7UZED47jPidQGFvLrquOV+ 4dcJ3oE6pwJAyXbBJ6qT2Itv40jINxBlS4OLe8Mg6PlzAJeFXYh/2G7 X-Developer-Key: i=kauschluss@disroot.org; a=ed25519; pk=h2xeR+V2I1+GrfDPAhZa3M+NWA0Cnbdkkq1bH3ct1hE= Document the linux,keycodes property. The property values are key codes which are used in input key events generated by the touchkey device. Signed-off-by: Kaustabh Chakraborty --- Documentation/devicetree/bindings/input/touchscreen/melfas_mip4.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/input/touchscreen/melfas_mip4.txt b/Documentation/devicetree/bindings/input/touchscreen/melfas_mip4.txt index b2ab5498e51900e887fab4d9b5239cccccec2ea9..16d1031ee017604ac56109dfbebfce6a05491c60 100644 --- a/Documentation/devicetree/bindings/input/touchscreen/melfas_mip4.txt +++ b/Documentation/devicetree/bindings/input/touchscreen/melfas_mip4.txt @@ -7,6 +7,7 @@ Required properties: Optional properties: - ce-gpios: GPIO connected to the CE (chip enable) pin of the chip +- linux,keycodes: array of keycodes to be reported by touchkeys Example: i2c@00000000 { @@ -16,5 +17,6 @@ Example: interrupt-parent = <&gpio>; interrupts = <0 IRQ_TYPE_EDGE_FALLING>; ce-gpios = <&gpio 0 GPIO_ACTIVE_HIGH>; + linux,keycodes = , ; }; }; From patchwork Sat May 3 09:08:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaustabh Chakraborty X-Patchwork-Id: 887051 Received: from layka.disroot.org (layka.disroot.org [178.21.23.139]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B7A5F1DE2CC; Sat, 3 May 2025 09:08:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.21.23.139 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746263339; cv=none; b=fnzdD35NB+o5csNEvGenZYfW7L67ThF6RAJx4znUDjIenGIFd6J4HOoHD4pMMCb7fmnGkB1bFrWsg6hx3bACi1SzCSyFi1z0FLvikCqL04Ap7xfs7oGdVJHktY9s5++IAFXepqfvMXuVydpryjuVSgnxkJSiB3O3OcZ1RbbCzZw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746263339; c=relaxed/simple; bh=db09hgbzvuUJ1yzYHRq+CAMm77k09qcfo3UfxtjsWeY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=p4Y4YYXZLuRJufhTadXXnVz35xNDHpreu+hSlH2po9SzmsFsObINcwYCxDXlxarMsKiAQOUZcj3WDl9pUNLR74KiAT5F3+jmc/798I4wRWHq2KtLV3LkpuulQTHPnhZ8z0qHoC9c1BMEitZY5MwLvJLNmtQ3bJt7YH0bXkVJnPc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=disroot.org; spf=pass smtp.mailfrom=disroot.org; dkim=pass (2048-bit key) header.d=disroot.org header.i=@disroot.org header.b=PDK9adsk; arc=none smtp.client-ip=178.21.23.139 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=disroot.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=disroot.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=disroot.org header.i=@disroot.org header.b="PDK9adsk" Received: from mail01.disroot.lan (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id 10D7225CE4; Sat, 3 May 2025 11:08:56 +0200 (CEST) X-Virus-Scanned: SPAM Filter at disroot.org Received: from layka.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id AE5XxdhkPRVy; Sat, 3 May 2025 11:08:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1746263335; bh=db09hgbzvuUJ1yzYHRq+CAMm77k09qcfo3UfxtjsWeY=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=PDK9adskaoiTMMT9sGngElY1esVrk6c6kFyNwIy5bP9jrvctnQUHtMvAr5+pTp+XG PWwRb7QCajx3FtIOP5zIpM8goDvvnqzTxp/sRT5Y9AmdmCu+hPANJ/SkqIZtznr046 hUBAGJPByCv2HEYy8WbyTZAnBHKWquS3Ch7P30jdgM8Kjfdna0bVQd7RT9N5EXAJzI xZOkxeuyqfPrUiyNUt9djTWngdWekzCSOBnOu5RUl8QXb8FIi7lQwGI4BjWKpsk79P tlBz/EyhcCsPgp1ZPhAEuLkoK2KewNyQ+W4ye4Jj5s0vEXf7mluntCwmJ49TIaJaNi q2VDM7MlXDZ2A== From: Kaustabh Chakraborty Date: Sat, 03 May 2025 14:38:29 +0530 Subject: [PATCH RFC 3/4] Input: melfas-mip4 - initialize touch events only if the device is a touchscreen Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250503-mip4-touchkey-v1-3-b483cda29a5b@disroot.org> References: <20250503-mip4-touchkey-v1-0-b483cda29a5b@disroot.org> In-Reply-To: <20250503-mip4-touchkey-v1-0-b483cda29a5b@disroot.org> To: Sangwon Jee , Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Henrik Rydberg Cc: linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Kaustabh Chakraborty X-Developer-Signature: v=1; a=ed25519-sha256; t=1746263323; l=3948; i=kauschluss@disroot.org; s=20250202; h=from:subject:message-id; bh=db09hgbzvuUJ1yzYHRq+CAMm77k09qcfo3UfxtjsWeY=; b=wlrUg1ONopq6BlhLWr2/7scfe+Kbt+zSC+HxlGSWE2gWSQVyTiboC3DS4GmI0iSlOh2It7E8G wvEdy7hcaD5D7ZUPuuRdHfGkcbLAvBokq0/P+M5WRFcPvCNnmEUtobq X-Developer-Key: i=kauschluss@disroot.org; a=ed25519; pk=h2xeR+V2I1+GrfDPAhZa3M+NWA0Cnbdkkq1bH3ct1hE= Certain MIP4 devices report zero values when enquired for its touchscreen dimensions (MIP4_R1_INFO_RESOLUTION_X and MIP4_R1_INFO_RESOLUTION_Y), which is indicative of the fact that those devices are not touchscreens. While registering for touch events for the device, always check - and proceed - only if the device reports a non-zero resolution. Signed-off-by: Kaustabh Chakraborty --- drivers/input/touchscreen/melfas_mip4.c | 50 ++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/drivers/input/touchscreen/melfas_mip4.c b/drivers/input/touchscreen/melfas_mip4.c index 061ac353bc7a2e28f17581411af81f35c89733a1..57b657694a420220be135c2f78d3ddad3ef6f520 100644 --- a/drivers/input/touchscreen/melfas_mip4.c +++ b/drivers/input/touchscreen/melfas_mip4.c @@ -1146,14 +1146,16 @@ static int mip4_flash_fw(struct mip4_ts *ts, mip4_query_device(ts); /* Refresh device parameters */ - input_set_abs_params(ts->input, ABS_MT_POSITION_X, 0, ts->max_x, 0, 0); - input_set_abs_params(ts->input, ABS_MT_POSITION_Y, 0, ts->max_y, 0, 0); - input_set_abs_params(ts->input, ABS_X, 0, ts->max_x, 0, 0); - input_set_abs_params(ts->input, ABS_Y, 0, ts->max_y, 0, 0); - input_abs_set_res(ts->input, ABS_MT_POSITION_X, ts->ppm_x); - input_abs_set_res(ts->input, ABS_MT_POSITION_Y, ts->ppm_y); - input_abs_set_res(ts->input, ABS_X, ts->ppm_x); - input_abs_set_res(ts->input, ABS_Y, ts->ppm_y); + if (ts->max_x && ts->max_y) { + input_set_abs_params(ts->input, ABS_MT_POSITION_X, 0, ts->max_x, 0, 0); + input_set_abs_params(ts->input, ABS_MT_POSITION_Y, 0, ts->max_y, 0, 0); + input_set_abs_params(ts->input, ABS_X, 0, ts->max_x, 0, 0); + input_set_abs_params(ts->input, ABS_Y, 0, ts->max_y, 0, 0); + input_abs_set_res(ts->input, ABS_MT_POSITION_X, ts->ppm_x); + input_abs_set_res(ts->input, ABS_MT_POSITION_Y, ts->ppm_y); + input_abs_set_res(ts->input, ABS_X, ts->ppm_x); + input_abs_set_res(ts->input, ABS_Y, ts->ppm_y); + } for (i = 0; i < ts->key_num; i++) { if (ts->key_code[i]) @@ -1498,21 +1500,23 @@ static int mip4_probe(struct i2c_client *client) input->keycodesize = sizeof(*ts->key_code); input->keycodemax = ts->key_num; - input_set_abs_params(input, ABS_MT_TOOL_TYPE, 0, MT_TOOL_PALM, 0, 0); - input_set_abs_params(input, ABS_MT_POSITION_X, 0, ts->max_x, 0, 0); - input_set_abs_params(input, ABS_MT_POSITION_Y, 0, ts->max_y, 0, 0); - input_set_abs_params(input, ABS_MT_PRESSURE, - MIP4_PRESSURE_MIN, MIP4_PRESSURE_MAX, 0, 0); - input_set_abs_params(input, ABS_MT_TOUCH_MAJOR, - MIP4_TOUCH_MAJOR_MIN, MIP4_TOUCH_MAJOR_MAX, 0, 0); - input_set_abs_params(input, ABS_MT_TOUCH_MINOR, - MIP4_TOUCH_MINOR_MIN, MIP4_TOUCH_MINOR_MAX, 0, 0); - input_abs_set_res(ts->input, ABS_MT_POSITION_X, ts->ppm_x); - input_abs_set_res(ts->input, ABS_MT_POSITION_Y, ts->ppm_y); - - error = input_mt_init_slots(input, MIP4_MAX_FINGERS, INPUT_MT_DIRECT); - if (error) - return error; + if (ts->max_x && ts->max_y) { + input_set_abs_params(input, ABS_MT_TOOL_TYPE, 0, MT_TOOL_PALM, 0, 0); + input_set_abs_params(input, ABS_MT_POSITION_X, 0, ts->max_x, 0, 0); + input_set_abs_params(input, ABS_MT_POSITION_Y, 0, ts->max_y, 0, 0); + input_set_abs_params(input, ABS_MT_PRESSURE, + MIP4_PRESSURE_MIN, MIP4_PRESSURE_MAX, 0, 0); + input_set_abs_params(input, ABS_MT_TOUCH_MAJOR, + MIP4_TOUCH_MAJOR_MIN, MIP4_TOUCH_MAJOR_MAX, 0, 0); + input_set_abs_params(input, ABS_MT_TOUCH_MINOR, + MIP4_TOUCH_MINOR_MIN, MIP4_TOUCH_MINOR_MAX, 0, 0); + input_abs_set_res(ts->input, ABS_MT_POSITION_X, ts->ppm_x); + input_abs_set_res(ts->input, ABS_MT_POSITION_Y, ts->ppm_y); + + error = input_mt_init_slots(input, MIP4_MAX_FINGERS, INPUT_MT_DIRECT); + if (error) + return error; + } for (i = 0; i < ts->key_num; i++) { if (ts->key_code[i])