From patchwork Wed Mar 20 07:58:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 781442 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2094.outbound.protection.outlook.com [40.107.22.94]) (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 D90AF3D3A2; Wed, 20 Mar 2024 07:58:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.94 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710921503; cv=fail; b=VxcV6jn3KmQLtPWIAN1/FX0zKBGLOab4i2dgPniqCOB7XSxtbO/VQybzHDoSI9EWZLDegxpqqM6WdW/loH1OjqArGZpVKboWwF+Kf6PmfMhujaRoNDoz7Dj8x3aSMh/++JlNaVw1Gp+nQRV5hM0CBpzJO86WvMNWEH0+TYOYCwA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710921503; c=relaxed/simple; bh=We4djLZrQmwTewoy3TXvLCuEcuRF2BZn64gf0yEafpU=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=LBgeUvo3SZ2CEnMEzueHT2+fPyIPllGxmCIOW7YqHzw+oJOUqkhSEzHoeMR0wcv8OA5wfMPkGx5RB5XKx4o4q74IIMc5w4GPHdqKr24g2XE2vkJlEYrEb2SdfwSt1tjzg22NZU0ZEiDCO3uFzY2Nm2aK/X43gjgFAioJp3Tortc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wolfvision.net; spf=pass smtp.mailfrom=wolfvision.net; dkim=pass (1024-bit key) header.d=wolfvision.net header.i=@wolfvision.net header.b=21Gv6cL4; arc=fail smtp.client-ip=40.107.22.94 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wolfvision.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wolfvision.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=wolfvision.net header.i=@wolfvision.net header.b="21Gv6cL4" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BdJvp34sTn/Q9Gk/Nvf8nMshRjWB6ygMpRpYHDb0wmpgY+byUPyP65GsRO8HmGBG5WEah6iXwiJuonbeKOO12acr0zjIghEblkVZfGqcRhHHeshL93oHTf2Gifx80iJJvz1Pjh5hHelbYfk7RJDDGiXBKrYyZ/GXs6sOw5pAQzC9Bd3DQ37pLlM3mRIFSMVKobEBY/bxx/aMSTaoKq0DGJDBlrx64L2G1hcNCeUWHxq1ENwhwTmkBNlc05sZ/D2yj/C+ujeklXqy/567ZocLE/D813FMa6QGYWZLGjv2tIsTJTf+kL/epaEwTORqYg3ZW2HSLmFHB1C3slLTDu8ctA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lRUe7KDkC01XwoHUft0RG9xZV2wyedfrobtHpSyaX+g=; b=cfCKh8qkRYDppexZq94R3dAz72VQ+zdbfI4I6qb1Ddtb0mX7WqMpau1zKuCaK/TeonemG29heUnaKk05dVe8zHnhbqIpNqCe9CaBqh5Tn3tkxylb6Cpo1LeyeCjEeJbNUIV49WGMHF796M03DP8AXkdADfzZNK8mnaul0+rnU43p8mC6FMKEMN8T2t5AE0dJQx548voFEKJxkvahZnDH2YK5RtIPTufvbzjCo5sws1p7eaMGXx01GDY7Xvin8eBvUMNEbMHRpkcGGzKKLkh4Xp9KM5L74TLzKBE+XRA0SKWUU3y1Ihool+TqcrT999/uAuJplPq1J8eGSN2KJTjrrg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wolfvision.net; dmarc=pass action=none header.from=wolfvision.net; dkim=pass header.d=wolfvision.net; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wolfvision.net; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lRUe7KDkC01XwoHUft0RG9xZV2wyedfrobtHpSyaX+g=; b=21Gv6cL4ShvdUCH9xl/IE/OQnMK4nFBsCejNn5EabWS5NsGYR9pkZqHqa2IOmP5l/1uVArWe812abOoq943lPc26gzojjVhplAoMTNBPAyDbDya5gbmOL9RT7VPQHtYW6fJLhHGhiB7mTmTjiZ3+MiC1az8vHle5Guwh9lQfqpA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=wolfvision.net; Received: from VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) by DB4PR08MB8056.eurprd08.prod.outlook.com (2603:10a6:10:387::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.28; Wed, 20 Mar 2024 07:58:12 +0000 Received: from VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::9e35:6de9:e4fc:843f]) by VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::9e35:6de9:e4fc:843f%7]) with mapi id 15.20.7386.025; Wed, 20 Mar 2024 07:58:12 +0000 From: Javier Carrasco Date: Wed, 20 Mar 2024 08:58:06 +0100 Subject: [PATCH v8 1/4] dt-bindings: touchscreen: add touch-overlay property Message-Id: <20240320-feature-ts_virtobj_patch-v8-1-cab6e7dcb1f6@wolfvision.net> References: <20240320-feature-ts_virtobj_patch-v8-0-cab6e7dcb1f6@wolfvision.net> In-Reply-To: <20240320-feature-ts_virtobj_patch-v8-0-cab6e7dcb1f6@wolfvision.net> To: Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bastian Hecht , Michael Riesch Cc: linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Javier Carrasco , Jeff LaBundy X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1710921491; l=7148; i=javier.carrasco@wolfvision.net; s=20240320; h=from:subject:message-id; bh=We4djLZrQmwTewoy3TXvLCuEcuRF2BZn64gf0yEafpU=; b=xbHRhMZf3j2RJXqiOH5VwThjrghylI62i7Te0nmyw8Px64oiXiYMacbBViloJUCZ3HqqDv+aM Z2sWHhxXg8UBYqqzDHlrxHDujW/M9PxYuxbM+9oMoZ2a7EWMlXHchxj X-Developer-Key: i=javier.carrasco@wolfvision.net; a=ed25519; pk=Vxk2/0sGIxM8rsKnceszFuSuHVfQwa1Yo8+is7BX2nY= X-ClientProxiedBy: VI1PR07CA0286.eurprd07.prod.outlook.com (2603:10a6:800:130::14) To VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR08MB4974:EE_|DB4PR08MB8056:EE_ X-MS-Office365-Filtering-Correlation-Id: acaa3bd4-d3d6-4005-8198-08dc48b37d39 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sbOtxcf5uWKR60WedFeSXS2tSSPlMGRZkP9aC/uXFoNfv70ktWU9Md26zWwtrNu1hNqLJ+cWH3+wt/AsFiZk095RekLUXTt7wWnhr2oc+gV/lTb/rQPaD0HnDhgtybL+xCCtyR1BRDBKHGj1ogQjxaYuJEInbDNG1bUtlXCFwmWBVLCIVcxP+V1larNCh7ZS5Is+E3V4L0z6Reteul3/qdZd5L89H78MGdi+vHlmT+XfnjD2T90kMJV8w8IPhDwK0XETLLFDrPv6fUd4GYKM+j0Vc89x1OdNZWiJ7Gg9LgkWOguDi+tUg+iHHMHNMDYtK/PzkeMvFCKEhzDGEbHlmOh6XPzvQ6FCM7QOnnlAQ/RMF4tNElC5reKZnk48VpAQNL11/tqNkWa5CZmHf6lWeqMh34/m7b+4nn1lTZC+TnWoNxMglGGqnuSahbqUKKOA4s8W1qOLVOYZcYpd2lb8OnIJVUhkRDkRGdgq3CWQcHwO3otMPVpwyo0Ik05nhfa+Ny5uZiHoELwVTktXPb/KWXFdQHLM4kfKD0dv7kddmhL/yJC6A/JnXH18JVqhT+d4b8P6ZBCIFS3TYBZlKn9RXQCUp19z24AVw/leWDrLHWMG+R0QvLB+1DofvbdegZpocWVNrb9lFOXz/qaqgSlEYDJ643NgAUmRydUZbGxvu2aDesBYINOOTU2HYdBcc9GyVcQI43j5m3xWUkRNa3Y3ECt4+b5kKnME95bVxQMyGzA= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VE1PR08MB4974.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376005)(366007)(1800799015)(52116005)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?hmogTsHP0I+O6p8/pIaZt+tkGsfu?= =?utf-8?q?CTR7B6JX7oXZUH4RdRFKFLXvhxVEJA+wH9GBG5VMAMwEMz0zkvw0cfrq1OfwEJAVp?= =?utf-8?q?71Aq7Skcb5jXDd3DQmlsLdeAuru+AzLsHrtV8wkHYkZKhQ5iWqbvXaiY5bPk3lQ9L?= =?utf-8?q?SmfVr1W7MeMAUBHcN5JXjsowmS6vwQw/3Y+qgoCuhF1GjU1tMfQgsLgubM8tz547Z?= =?utf-8?q?nY6gNvTbMT8ckAR2lwciA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QNHyKvwMz1DIbhKbfc4YAt/hFMWeaGIhBD4ssK9YVQb?= =?utf-8?q?VBO3jKA0bjsFTFbCqQ6H704xXOGAYoiFtlHpNd8vEHriMFvrlSaT1bGj3/ovXg/gX?= =?utf-8?q?+PLuZlW1bObNpd3HmstS/S7h6BEmfQ/oiLWf7I/4uxXWWPdINBo3EUDrvLQ5MY9/U?= =?utf-8?q?aElr3iQLvB2GQGemHKQ/pzpvZzbdLB2yJDnwtlKfvsRxGSiW+ttStcI8lvH96wDPI?= =?utf-8?q?QWansYxNHAKa7yE9LB3nh4veHSeIY4dFWvU4ZF8ATQQaoxsPhWSjkH1vQpJ4lxSbc?= =?utf-8?q?4F+QBRwLGwdWPtpBMBQoEbY1lBhqYd7PhSb5cUx0BW6Ly9sZj3WLmoFOCQk8DXlSE?= =?utf-8?q?2T6J/JBTGugTwoJKVyrv+fOkxK8H3MynT7X1iaYH2TmYc8bYYtaFN5Qdx7nvuduyF?= =?utf-8?q?ezhn0SOqPHk4qXvg42b/5u2ulbx+/VNBmktAHV+FpyQpDapn0C3HA/Y=3D?= X-OriginatorOrg: wolfvision.net X-MS-Exchange-CrossTenant-Network-Message-Id: acaa3bd4-d3d6-4005-8198-08dc48b37d39 X-MS-Exchange-CrossTenant-AuthSource: VE1PR08MB4974.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Mar 2024 07:58:11.8159 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: e94ec9da-9183-471e-83b3-51baa8eb804f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Y3MmJMPNSRioVrs0+cBcYF5+tsn5XWTJhLhLYV6SV2GpBpmdMrdBM8s/ispNCwfB7EIb/dL4hsa0OElqQPHEXskPZQe94MVO38PTAFCuHKs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR08MB8056 The touch-overlay encompasses a number of touch areas that define a clipped touchscreen area and/or buttons with a specific functionality. A clipped touchscreen area avoids getting events from regions that are physically hidden by overlay frames. For touchscreens with printed overlay buttons, sub-nodes with a suitable key code can be defined to report key events instead of the original touch events. Reviewed-by: Jeff LaBundy Reviewed-by: Rob Herring Signed-off-by: Javier Carrasco --- .../bindings/input/touchscreen/touchscreen.yaml | 119 +++++++++++++++++++++ 1 file changed, 119 insertions(+) diff --git a/Documentation/devicetree/bindings/input/touchscreen/touchscreen.yaml b/Documentation/devicetree/bindings/input/touchscreen/touchscreen.yaml index 431c13335c40..3e3572aa483a 100644 --- a/Documentation/devicetree/bindings/input/touchscreen/touchscreen.yaml +++ b/Documentation/devicetree/bindings/input/touchscreen/touchscreen.yaml @@ -87,6 +87,125 @@ properties: touchscreen-y-plate-ohms: description: Resistance of the Y-plate in Ohms + touch-overlay: + description: | + List of nodes defining segments (touch areas) on the touchscreen. + + This object can be used to describe a series of segments to restrict + the region within touch events are reported or buttons with a specific + functionality. + + This is of special interest if the touchscreen is shipped with a physical + overlay on top of it with a frame that hides some part of the original + touchscreen area. Printed buttons on that overlay are also a typical + use case. + + A new touchscreen area is defined as a sub-node without a key code. If a + key code is defined in the sub-node, it will be interpreted as a button. + + The x-origin and y-origin properties of a touchscreen area define the + offset of a new origin from where the touchscreen events are referenced. + This offset is applied to the events accordingly. The x-size and y-size + properties define the size of the touchscreen effective area. + + The following example shows a new touchscreen area with the new origin + (0',0') for the touch events generated by the device. + + Touchscreen (full area) + ┌────────────────────────────────────────┐ + │ ┌───────────────────────────────┐ │ + │ │ │ │ + │ ├ y-size │ │ + │ │ │ │ + │ │ touchscreen area │ │ + │ │ (no key code) │ │ + │ │ │ │ + │ │ x-size │ │ + │ ┌└──────────────┴────────────────┘ │ + │(0',0') │ + ┌└────────────────────────────────────────┘ + (0,0) + + where (0',0') = (0+x-origin,0+y-origin) + + Sub-nodes with key codes report the touch events on their surface as key + events instead. + + The following example shows a touchscreen with a single button on it. + + Touchscreen (full area) + ┌───────────────────────────────────┐ + │ │ + │ │ + │ ┌─────────┐ │ + │ │button 0 │ │ + │ │KEY_POWER│ │ + │ └─────────┘ │ + │ │ + │ │ + ┌└───────────────────────────────────┘ + (0,0) + + Segments defining buttons and clipped toushcreen areas can be combined + as shown in the following example. + In that case only the events within the touchscreen area are reported + as touch events. Events within the button areas report their associated + key code. Any events outside the defined areas are ignored. + + Touchscreen (full area) + ┌─────────┬──────────────────────────────┐ + │ │ │ + │ │ ┌───────────────────────┐ │ + │ button 0│ │ │ │ + │KEY_POWER│ │ │ │ + │ │ │ │ │ + ├─────────┤ │ touchscreen area │ │ + │ │ │ (no key code) │ │ + │ │ │ │ │ + │ button 1│ │ │ │ + │ KEY_INFO│ ┌└───────────────────────┘ │ + │ │(0',0') │ + ┌└─────────┴──────────────────────────────┘ + (0,0) + + type: object + + patternProperties: + '^segment-': + type: object + description: + Each segment is represented as a sub-node. + properties: + x-origin: + description: horizontal origin of the node area + $ref: /schemas/types.yaml#/definitions/uint32 + + y-origin: + description: vertical origin of the node area + $ref: /schemas/types.yaml#/definitions/uint32 + + x-size: + description: horizontal resolution of the node area + $ref: /schemas/types.yaml#/definitions/uint32 + + y-size: + description: vertical resolution of the node area + $ref: /schemas/types.yaml#/definitions/uint32 + + label: + description: descriptive name of the segment + $ref: /schemas/types.yaml#/definitions/string + + linux,code: true + + required: + - x-origin + - y-origin + - x-size + - y-size + + unevaluatedProperties: false + dependencies: touchscreen-size-x: [ touchscreen-size-y ] touchscreen-size-y: [ touchscreen-size-x ] From patchwork Wed Mar 20 07:58:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 781711 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2094.outbound.protection.outlook.com [40.107.22.94]) (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 1EE233FB3C; Wed, 20 Mar 2024 07:58:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.94 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710921506; cv=fail; b=Rb0phlYlMnWRSnPtD+TqJ/u2NObS/2KjJcgut6ehtwFN3c+orTjPDqRcE62hTgF6eWCr83WxCn+McXxmi3XpEvNdOqBzI3niKPicyFggmJu4d33ZosZ7KBdTRguJEd1DvYIdRO1loq9WCgiS+VgaquHPUAQmOO9suwiEPNLeo5g= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710921506; c=relaxed/simple; bh=lA7G8GeH3hF2mn3NqOewcppznWGrwH1CDzlUIw3l16w=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=qJyStS7yR/1hhADP6uIZgCDIJplQaLFnZTFiAE8fV1YIO6gRFvk66m0lSuLdsecrCQhQ/z8yjUHe5u8z29ehXiyO8U7UO03DowxnfV9d8i+gmk9zDc7goBsC3qBX7EToSYRswsi5k5n95PhbJovOPA+X1ioptd9ck06gBJ1e71A= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wolfvision.net; spf=pass smtp.mailfrom=wolfvision.net; dkim=pass (1024-bit key) header.d=wolfvision.net header.i=@wolfvision.net header.b=pv1QCk6L; arc=fail smtp.client-ip=40.107.22.94 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wolfvision.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wolfvision.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=wolfvision.net header.i=@wolfvision.net header.b="pv1QCk6L" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WwQtmSCZnk96X9zD7m7tgU/ozysu6rI6fvalkCQmj4mtmPkCV1XYx6NaBcvQqnfrhGtyrhVhPCbZHcwxR6NPtuHob/FYESD4m/R464Jnd0Oc+K5vJlq1zrOM+YWrv3opoxJj1bRBu4y2oI3E9T1vembFGGd51byIfYXUuAj5SCLAC5QcmCgaIT53llM24phPZtWiGQKJfRqUBkQm+7bGMgqv+5dfEsjBX+cXToYnmw139oz/YBJANw1aOmz0L+xToz5SwcN1ZRbFjUUa6nJCgJ/WlG3EffGx8ZUQ/RCd2lZSsDP/WCA/+hE8RvuqzVKSepVjC4Ekwj+UdnhMpnH1MA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wGi3+vk18Zep1ahuxciQtqKsydgtgm635r+qTfxkvkI=; b=Prb1HDpFi/8LcvQe8v3nVuKaoOV9BnoDhjilFK3cuXBnetqeFlDvZJ6kVo9/uRQPV09AqHHrC9e0k3NlZ87BKP8UDY/Vkt7MxS+UjZelrWTgl8x2W3Jpy8qHmbnC0D9nHQMsC3xYXP28XvPGS1tTzBqKioV90fJe+gLf5QR0HchZkynHVdT/MqAA2MogE9v5X7iFfV3TWQUXks/YEMMGxs6KQFy/q4o97x+WQU+ZR62wR+cSvHnV1ZYxOLHXYU+lUf11CB775BtZVAQAnCYZeKYq/Ibcyr4FWzxQMGDxyi3Zh+xzOe/PdbEJT+d/NK6Tuk1tvbnaqv1As0VhXB/r4Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wolfvision.net; dmarc=pass action=none header.from=wolfvision.net; dkim=pass header.d=wolfvision.net; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wolfvision.net; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wGi3+vk18Zep1ahuxciQtqKsydgtgm635r+qTfxkvkI=; b=pv1QCk6LhCcVEQ9kQ/fx5uPRe4gOj/svvwb7YvDxLErh01UcLj2HMoQrKQBNw7jMvTXeDe2tl9KMKejhu2XsYc7XFYHrnHg8Ccp6Vg+M+r8LshVe6ex7GiO8gOG81ANEo4p7SN1hd+7IP91wKTbjzdJZUXE2Qs+JYzYer44X25Y= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=wolfvision.net; Received: from VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) by DB4PR08MB8056.eurprd08.prod.outlook.com (2603:10a6:10:387::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.28; Wed, 20 Mar 2024 07:58:16 +0000 Received: from VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::9e35:6de9:e4fc:843f]) by VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::9e35:6de9:e4fc:843f%7]) with mapi id 15.20.7386.025; Wed, 20 Mar 2024 07:58:12 +0000 From: Javier Carrasco Date: Wed, 20 Mar 2024 08:58:07 +0100 Subject: [PATCH v8 2/4] Input: touch-overlay - Add touchscreen overlay handling Message-Id: <20240320-feature-ts_virtobj_patch-v8-2-cab6e7dcb1f6@wolfvision.net> References: <20240320-feature-ts_virtobj_patch-v8-0-cab6e7dcb1f6@wolfvision.net> In-Reply-To: <20240320-feature-ts_virtobj_patch-v8-0-cab6e7dcb1f6@wolfvision.net> To: Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bastian Hecht , Michael Riesch Cc: linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Javier Carrasco , Jeff LaBundy X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1710921491; l=10518; i=javier.carrasco@wolfvision.net; s=20240320; h=from:subject:message-id; bh=lA7G8GeH3hF2mn3NqOewcppznWGrwH1CDzlUIw3l16w=; b=XHkak1I2jaQ7pHbnnB3WJBKclinwvIn8WFC7pmr1/2k6YuevyDwPH9XcfN3FuWgw093/H20mT p4jRBTgPptACph6dy1H6vPTXEfMjS2HbOqsxGRouT82v6IsTFwwhcis X-Developer-Key: i=javier.carrasco@wolfvision.net; a=ed25519; pk=Vxk2/0sGIxM8rsKnceszFuSuHVfQwa1Yo8+is7BX2nY= X-ClientProxiedBy: VI1PR07CA0286.eurprd07.prod.outlook.com (2603:10a6:800:130::14) To VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR08MB4974:EE_|DB4PR08MB8056:EE_ X-MS-Office365-Filtering-Correlation-Id: 0a8ab68c-9d30-4a1e-d583-08dc48b37d6b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UErVTFgYPDd/A9Y9AyIBlCmNlLUyVBlf0RB8pQbarNOogPzS8lYFYeNslYCIkHQY0jkkYEq3D3pSzABTDsqZ40yEcbhrFi7dZObjx2UkYbdeS5dzq+3+lTxo36W+9iZpRjfwJPHzv55jSwBsbEO7g3s5tfduAQYZN0c+MjgAaBUKNlnf2R3SPIVelG8ICEcyMowj9MwrjeXfokJIZrnL8L8OVNazGLNKDHFFJUr4zMgYvR/IaPw6/29eW15cKcjSghuTs9s+yNYGF7A7OzRX8pEV/AGP0cTJp81rptxa2euDaqZfebrOslsEG/LjNlqHWU526ORWPBAyUync/cTbP4QYms82aAFb4/daLWDNwgUiHq/p+LYFP0yD945joO1ol5w+j4KvU85L5fzwx6FBBSInQIIP8npCLgWeQfqxUjNFmqUqY4jA+x8eVr9HR965WwIbsW7IqSnCG9yS1rYceRbocNkIe42udXP77/TG0g2ZCmvhX5+5KDY3I4ZsRB5EQETM5eVsdzHchW6rlVQcw5bc71GOidvO45aO1Q6y1RHtt/ag73IIx6jmvniZaJ4IGFf2S5C5csBQ2YV+Wqmz2QucPVFy2GVZ+2WVlCo3+wQw3n1pmgZ/8QWjKkyuWYGUIBDedLWc5XcwVUBNmNedmJH3LBz4EdVdxtpddK+lJ1++Mak6hbXT8NRNXpBfsXzBhImVdv0WgoUhG/Axoif6OZLgzHpIamDxesNShBDkivM= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VE1PR08MB4974.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376005)(366007)(1800799015)(52116005)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?86whLibc27sumhkijy4WQuz8bRBb?= =?utf-8?q?ouXxIcq8r65+cp8LkYMrxJ2T7tZl2dE/Ne+WJ1wDYq9Pa0wUTEmQhwBdcM+Ftg/fB?= =?utf-8?q?J8zztK9lAWOFe7R0nr9/8xSmpMdpxxB7BIo5us4Vi7P5z81JaiW901gIoTqrA+dz7?= =?utf-8?q?xKNV7U4WEy9kmPmzhNqVYf/rkGkpnhFDBTD7gjZrTSPdLyIEKlAIwhINYyo89sgT7?= =?utf-8?q?zN2sj45ElTQjwXzpn7aaVo+ankZ6BIhioiVCJAT7QRtp05MNx3EjhnM0fVrL+KsdO?= =?utf-8?q?vqRVt8+n6faJtazvgBaDHP+XUbC0CJOIButIcClsYJpQz5p11ZEwnguwUVCL3NQhE?= =?utf-8?q?NHKwMjQCv4lykcYlP+5BU9+PEZbbPyqzUyHD8bk6STNaiL3duA5cuPGbCw80a1Prq?= =?utf-8?q?WMSGCE5+kQkfZkofa1bAsn0gMlxCNecBOwHGEHNbGc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ob1EHSd35YkqgmXcFufsrz?= =?utf-8?q?yrjrsOsMDJUCWhQ3miMQw9ytyUMs+kEcq3CpQGovzeTBxNSaEQD5MqCm35A2N9wyp?= =?utf-8?q?2Z37g6bZPXxhwoGwxQJnVjTXaBiyg0OGOfITdFPBnvK75AIw31W9hOyYGUSHz3/c/?= =?utf-8?q?IABnCxF7IRJcXyciQ2SUeG5Yw0PL/eTJc+brON3Aj9w5tonQZ5zaeaf9WJXG3vXbf?= =?utf-8?q?wPKPhz0c84iVqqjWmZFxTFKG6U7L+tvYAz9LM62GZvej+Ys1DRau594=3D?= X-OriginatorOrg: wolfvision.net X-MS-Exchange-CrossTenant-Network-Message-Id: 0a8ab68c-9d30-4a1e-d583-08dc48b37d6b X-MS-Exchange-CrossTenant-AuthSource: VE1PR08MB4974.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Mar 2024 07:58:12.1431 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: e94ec9da-9183-471e-83b3-51baa8eb804f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: xy0AymZumTHsWgKVY0MTAU42lPX5R+4RFTZ7YLjuFLqiPrWccRFyHnVN1UGnJnZf4+nL5vLuoDYEuVbDZE1gDYSsXxSwsX1DiqEJNpYlW30= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR08MB8056 Some touch devices provide mechanical overlays with different objects like buttons or clipped touchscreen surfaces. In order to support these objects, add a series of helper functions to the input subsystem to transform them into overlay objects via device tree nodes. These overlay objects consume the raw touch events and report the expected input events depending on the object properties. Note that the current implementation allows for multiple definitions of touchscreen areas (regions that report touch events), but only the first one will be used for the touchscreen device that the consumers typically provide. Should the need for multiple touchscreen areas arise, additional touchscreen devices would be required at the consumer side. There is no limitation in the number of touch areas defined as buttons. Reviewed-by: Jeff LaBundy Signed-off-by: Javier Carrasco --- MAINTAINERS | 7 + drivers/input/Makefile | 2 +- drivers/input/touch-overlay.c | 250 ++++++++++++++++++++++++++++++++++++ include/linux/input/touch-overlay.h | 22 ++++ 4 files changed, 280 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 1339918df52a..94426c470a2d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -22338,6 +22338,13 @@ L: platform-driver-x86@vger.kernel.org S: Maintained F: drivers/platform/x86/toshiba-wmi.c +TOUCH OVERLAY +M: Javier Carrasco +L: linux-input@vger.kernel.org +S: Maintained +F: drivers/input/touch-overlay.c +F: include/linux/input/touch-overlay.h + TPM DEVICE DRIVER M: Peter Huewe M: Jarkko Sakkinen diff --git a/drivers/input/Makefile b/drivers/input/Makefile index c78753274921..393e9f4d00dc 100644 --- a/drivers/input/Makefile +++ b/drivers/input/Makefile @@ -7,7 +7,7 @@ obj-$(CONFIG_INPUT) += input-core.o input-core-y := input.o input-compat.o input-mt.o input-poller.o ff-core.o -input-core-y += touchscreen.o +input-core-y += touchscreen.o touch-overlay.o obj-$(CONFIG_INPUT_FF_MEMLESS) += ff-memless.o obj-$(CONFIG_INPUT_SPARSEKMAP) += sparse-keymap.o diff --git a/drivers/input/touch-overlay.c b/drivers/input/touch-overlay.c new file mode 100644 index 000000000000..42b6ad753a00 --- /dev/null +++ b/drivers/input/touch-overlay.c @@ -0,0 +1,250 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Helper functions for overlay objects on touchscreens + * + * Copyright (c) 2023 Javier Carrasco + */ + +#include +#include +#include +#include +#include +#include + +struct touch_overlay_segment { + struct list_head list; + u32 x_origin; + u32 y_origin; + u32 x_size; + u32 y_size; + u32 key; + bool pressed; + int slot; +}; + +static int touch_overlay_get_segment(struct fwnode_handle *segment_node, + struct touch_overlay_segment *segment, + struct input_dev *input) +{ + int error; + + error = fwnode_property_read_u32(segment_node, "x-origin", + &segment->x_origin); + if (error) + return error; + + error = fwnode_property_read_u32(segment_node, "y-origin", + &segment->y_origin); + if (error) + return error; + + error = fwnode_property_read_u32(segment_node, "x-size", + &segment->x_size); + if (error) + return error; + + error = fwnode_property_read_u32(segment_node, "y-size", + &segment->y_size); + if (error) + return error; + + error = fwnode_property_read_u32(segment_node, "linux,code", + &segment->key); + if (!error) + input_set_capability(input, EV_KEY, segment->key); + else if (error != -EINVAL) + return error; + + return 0; +} + +/** + * touch_overlay_map - map overlay objects from the device tree and set + * key capabilities if buttons are defined. + * @list: pointer to the list that will hold the segments + * @input: pointer to the already allocated input_dev + * + * Returns 0 on success and error number otherwise. + * + * If buttons are defined, key capabilities are set accordingly. + */ +int touch_overlay_map(struct list_head *list, struct input_dev *input) +{ + struct fwnode_handle *overlay, *fw_segment; + struct device *dev = input->dev.parent; + struct touch_overlay_segment *segment; + int error; + + overlay = device_get_named_child_node(dev, "touch-overlay"); + if (!overlay) + return 0; + + fwnode_for_each_child_node(overlay, fw_segment) { + segment = devm_kzalloc(dev, sizeof(*segment), GFP_KERNEL); + if (!segment) { + error = -ENOMEM; + fwnode_handle_put(overlay); + break; + } + error = touch_overlay_get_segment(fw_segment, segment, input); + if (error) { + fwnode_handle_put(overlay); + break; + } + list_add_tail(&segment->list, list); + } + + return error; +} +EXPORT_SYMBOL(touch_overlay_map); + +/** + * touch_overlay_get_touchscreen_abs - get abs size from the touchscreen area. + * @list: pointer to the list that holds the segments + * @x: horizontal abs + * @y: vertical abs + */ +void touch_overlay_get_touchscreen_abs(struct list_head *list, u16 *x, u16 *y) +{ + struct touch_overlay_segment *segment; + struct list_head *ptr; + + list_for_each(ptr, list) { + segment = list_entry(ptr, struct touch_overlay_segment, list); + if (!segment->key) { + *x = segment->x_size - 1; + *y = segment->y_size - 1; + break; + } + } +} +EXPORT_SYMBOL(touch_overlay_get_touchscreen_abs); + +static bool touch_overlay_segment_event(struct touch_overlay_segment *seg, + u32 x, u32 y) +{ + if (!seg) + return false; + + if (x >= seg->x_origin && x < (seg->x_origin + seg->x_size) && + y >= seg->y_origin && y < (seg->y_origin + seg->y_size)) + return true; + + return false; +} + +/** + * touch_overlay_mapped_touchscreen - check if a touchscreen area is mapped + * @list: pointer to the list that holds the segments + * + * Returns true if a touchscreen area is mapped or false otherwise. + */ +bool touch_overlay_mapped_touchscreen(struct list_head *list) +{ + struct touch_overlay_segment *segment; + struct list_head *ptr; + + list_for_each(ptr, list) { + segment = list_entry(ptr, struct touch_overlay_segment, list); + if (!segment->key) + return true; + } + + return false; +} +EXPORT_SYMBOL(touch_overlay_mapped_touchscreen); + +static bool touch_overlay_event_on_ts(struct list_head *list, u32 *x, u32 *y) +{ + struct touch_overlay_segment *segment; + struct list_head *ptr; + bool valid_touch = true; + + if (!x || !y) + return false; + + list_for_each(ptr, list) { + segment = list_entry(ptr, struct touch_overlay_segment, list); + if (segment->key) + continue; + + if (touch_overlay_segment_event(segment, *x, *y)) { + *x -= segment->x_origin; + *y -= segment->y_origin; + return true; + } + /* ignore touch events outside the defined area */ + valid_touch = false; + } + + return valid_touch; +} + +static bool touch_overlay_button_event(struct input_dev *input, + struct touch_overlay_segment *segment, + const u32 *x, const u32 *y, u32 slot) +{ + bool contact = x && y; + + if (!contact && segment->pressed && segment->slot == slot) { + segment->pressed = false; + input_report_key(input, segment->key, false); + input_sync(input); + return true; + } else if (contact && touch_overlay_segment_event(segment, *x, *y)) { + segment->pressed = true; + segment->slot = slot; + input_report_key(input, segment->key, true); + input_sync(input); + return true; + } + + return false; +} + +/** + * touch_overlay_process_event - process input events according to the overlay + * mapping. This function acts as a filter to release the calling driver from + * the events that are either related to overlay buttons or out of the overlay + * touchscreen area, if defined. + * @list: pointer to the list that holds the segments + * @input: pointer to the input device associated to the event + * @x: pointer to the x coordinate (NULL if not available - no contact) + * @y: pointer to the y coordinate (NULL if not available - no contact) + * @slot: slot associated to the event + * + * Returns true if the event was processed (reported for valid key events + * and dropped for events outside the overlay touchscreen area) or false + * if the event must be processed by the caller. In that case this function + * shifts the (x,y) coordinates to the overlay touchscreen axis if required. + */ +bool touch_overlay_process_event(struct list_head *list, + struct input_dev *input, + u32 *x, u32 *y, u32 slot) +{ + struct touch_overlay_segment *segment; + struct list_head *ptr; + + /* + * buttons must be prioritized over overlay touchscreens to account for + * overlappings e.g. a button inside the touchscreen area. + */ + list_for_each(ptr, list) { + segment = list_entry(ptr, struct touch_overlay_segment, list); + if (segment->key && + touch_overlay_button_event(input, segment, x, y, slot)) { + return true; + } + } + + /* + * valid touch events on the overlay touchscreen are left for the client + * to be processed/reported according to its (possibly) unique features. + */ + return !touch_overlay_event_on_ts(list, x, y); +} +EXPORT_SYMBOL(touch_overlay_process_event); + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("Helper functions for overlay objects on touch devices"); diff --git a/include/linux/input/touch-overlay.h b/include/linux/input/touch-overlay.h new file mode 100644 index 000000000000..cef05c46000d --- /dev/null +++ b/include/linux/input/touch-overlay.h @@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (c) 2023 Javier Carrasco + */ + +#ifndef _TOUCH_OVERLAY +#define _TOUCH_OVERLAY + +#include + +struct input_dev; + +int touch_overlay_map(struct list_head *list, struct input_dev *input); + +void touch_overlay_get_touchscreen_abs(struct list_head *list, u16 *x, u16 *y); + +bool touch_overlay_mapped_touchscreen(struct list_head *list); + +bool touch_overlay_process_event(struct list_head *list, struct input_dev *input, + u32 *x, u32 *y, u32 slot); + +#endif From patchwork Wed Mar 20 07:58:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 781441 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2094.outbound.protection.outlook.com [40.107.22.94]) (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 51DF53FBB9; Wed, 20 Mar 2024 07:58:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.22.94 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710921507; cv=fail; b=HH0oQe1D94LAk7L5TywmswMqP9M2akvgJiFCDfKSDFFgH8m/SdGnJ32DM1hh5EHoHyK2ROtknNX0XodPjVY+Vl14n7JdhkM1pgYD46RUN6yHVgpzPHdkbOnhhJh9/J9J9CnBcvC3HPt6m9ZCFZPSwiWTlOjE5PI6a1pvv51N7yw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710921507; c=relaxed/simple; bh=3tqHLMst+mhiK4QFgwslIHL8ziDdEQua0JAC67hS/k8=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=aaI5uFCVwo77qxW0IVLkLj/jCAjLxyyPlYIzuo4MuBEDrltDAnhwAUvFSeJdHvhFBVf8pWp7hmEOz9rhLg5Qijq5+c4VHU84jd12d82Hz6Y2JMhtFHkGgXa4TRT0363vWiCpkxqQQINKHvbXk2Pi6lrqPYQxSi3eyPyIAxaKnC0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wolfvision.net; spf=pass smtp.mailfrom=wolfvision.net; dkim=pass (1024-bit key) header.d=wolfvision.net header.i=@wolfvision.net header.b=MbJyt/x9; arc=fail smtp.client-ip=40.107.22.94 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wolfvision.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wolfvision.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=wolfvision.net header.i=@wolfvision.net header.b="MbJyt/x9" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ElSeSFsM1n/h3cgPTfGXGStmIZ/Q5U1Z3VntJR2Ho+JEfYZvYsET1iLhC015PEwUXmngs+/Or4ugRVaGQTsrhNwBfJtPdl7LwZyZhFUtb2JMDvIQZn34UNitzcMGTZn823qLkjLQS7S4MOBO2d5Yn/iW1DmWSrl3UjIza6BoGFLLYn7lTFbBu7aKgkks+BBCyvr/PbNvfGYnWpQi0eA+MXqh/Zta1trjLdOXHXnTpvpmRHnJ761z43QeHa9xqoIxOkhK3i5i21OojHBgGsdDj5t4ex5vlURdag2GJEZrgE7pLz269caK1IlWSSOrAjgQ+Avm61WqfxjEkoHvA7ydSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=pOX3tiBOxZrggRpnLxNwFouyH6dOHwsiI7ZIXmenRY0=; b=MHrrHeUzV8Vcfv9oBa0g65v9eXjmTsBkctOOOJq0dt9oZwdaO2Nfi7GFRdpxCxe6Ya0B68zuQRPFYSldH+iCEZLfaK4SvBhQBRq2l7Bc514Y5I8fcE/ws8Q89FMXwKfOh+73GpNqpoAutURzQcVev8IWyEcBrsD3KvYxgtlysne9dzMplv+f+2I8s0/TkAgGLyMY6dKTczrB/P815fbv+YTJO/nX+8CYBdhCXndY9QFzpKqkXJHnzSHWHGiB2GVMgvI8SF2pCoBg7IKApLW02/Zmcau/4GDWNpGvaBBeU5Ibn3xQ5yJlGFV6ykSR7XCzY8AkHVglttQK4h6OctU8xw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wolfvision.net; dmarc=pass action=none header.from=wolfvision.net; dkim=pass header.d=wolfvision.net; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wolfvision.net; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pOX3tiBOxZrggRpnLxNwFouyH6dOHwsiI7ZIXmenRY0=; b=MbJyt/x9orExaYtAMWIC3xlpKq9nlvTiYPp18Vy/8ljyar60/h8NBKPO01aR0uzJRtwDJPf1IfL5o0CpadYOK7Mufp8wYa9hY3Ub/JO0xns6YL5mbQ5i5AgCDOynf8GiF6u/TU5MwPgBbVv2Q/vNYaaldsX5QPSC09zh5RRw+hQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=wolfvision.net; Received: from VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) by DB4PR08MB8056.eurprd08.prod.outlook.com (2603:10a6:10:387::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.28; Wed, 20 Mar 2024 07:58:17 +0000 Received: from VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::9e35:6de9:e4fc:843f]) by VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::9e35:6de9:e4fc:843f%7]) with mapi id 15.20.7386.025; Wed, 20 Mar 2024 07:58:17 +0000 From: Javier Carrasco Date: Wed, 20 Mar 2024 08:58:08 +0100 Subject: [PATCH v8 3/4] dt-bindings: input: touchscreen: st1232: add touch-overlay example Message-Id: <20240320-feature-ts_virtobj_patch-v8-3-cab6e7dcb1f6@wolfvision.net> References: <20240320-feature-ts_virtobj_patch-v8-0-cab6e7dcb1f6@wolfvision.net> In-Reply-To: <20240320-feature-ts_virtobj_patch-v8-0-cab6e7dcb1f6@wolfvision.net> To: Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bastian Hecht , Michael Riesch Cc: linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Javier Carrasco X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1710921491; l=2517; i=javier.carrasco@wolfvision.net; s=20240320; h=from:subject:message-id; bh=3tqHLMst+mhiK4QFgwslIHL8ziDdEQua0JAC67hS/k8=; b=atdLQXyA66hccpIs9ihGdq22LNGwXJKOzAYMmjPiGS0iriBn+D3uwc8kZJR2eDAlpcuI42nZ3 F1ObXtmuhTzBfYlNJ9xP4veiVVYlwT009TgAtfDECMbZQl9mYy27jq1 X-Developer-Key: i=javier.carrasco@wolfvision.net; a=ed25519; pk=Vxk2/0sGIxM8rsKnceszFuSuHVfQwa1Yo8+is7BX2nY= X-ClientProxiedBy: VI1PR07CA0286.eurprd07.prod.outlook.com (2603:10a6:800:130::14) To VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR08MB4974:EE_|DB4PR08MB8056:EE_ X-MS-Office365-Filtering-Correlation-Id: 0662cc7f-a688-4cfc-faf9-08dc48b37d9b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mh98VB17WH2gxah7vQsz7rQa3RjjRXWFSVss9QkHUJS5JV6mHfgDtPXCKjx4u4HiIZygan+8dfgI4Hf1BoOHm3+UIcLve1OvxmYEodhFH0O7s57avOUQqJawrHoMQ6/mucjbqFbC3QKEkyLPCIhg0XR4y9q+Y06vN0cvhJyuVmckpusAlAQqVUPDw+fD+d3thZX7C1jQClaQUnRhxzb+RwOzAuxorxZePxJfUBkYo6EQNJ3+PrfuxkC1xQhHkzsGSGyZ69wXH8CpEqOKlyGY5211jWsqKux24fvjmW6pu0d9Ae/hBa/Es/PiMOaMxVO+tEF3/E/IgaYaSe20n/1dEjLzhUqCd8ZdFw5tzTRKZLix4vO5NrawuHLTKaew9Vo0LBacb8NLBeVwJwvNpjp5XHS8YQqMUGteUIKS1oFiOd1eiltjNBzrF4gVTowlN2o0OxinZ0GQwtFqE1sd28DMgzZECISDto0241PVQ6V5WbUQAkReeBj0jZUSePFvPutV/DGJM9ekcyQtq/R5IX1zpwZcZSRG1Hu82JY74te/WBdkyLmTYHkZ1G8oSLZ1dyEyAKBJ/lr64uWbOTfTYp+h+q3i/VlwRXgL4wYRyZqKuh5qypIVH6iJLkjBEMJMRe16ZKfhAUuUUUwHYP1DEmASqdTNpWQ+FX7GbM8VVjdIbtTU8uRPl8SHcd8AmGGrwFFzKsBhniszrpqYE4+a815bVQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VE1PR08MB4974.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376005)(366007)(1800799015)(52116005)(38350700005); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?Ttkm1LDllEv0zYwt3XZP6Qds9UeI?= =?utf-8?q?lf+r5RexkGFEUIbCCcz0vv9aLkY5M3uxCRG5XmS9aNSdZ0orcFSeK+Sb/eEKdMrmM?= =?utf-8?q?WQPlpEtTjcHLaLLvBgCo2Nvw+xhSIbhsoDrn+BvdZaTuq5MOEK7qE0YNXQdMv/Wwh?= =?utf-8?q?eU6PEtiNCox0CJNvpigrd3zosI7o79IQ2Wi3D9tuSiAaAV0jfJbbbpkr49lftpgG5?= =?utf-8?q?ErFbGUTn/700J/VQAsn+5h6/8JtDGENfzgqGhPAOTzoI/392B69FYRE8FTnAcm1s6?= =?utf-8?q?scL1JXTfseSnkPOOi0t7aJPV86BwIJeEenE9RY8hveBrJQFtHuONfyGfkIu9TGert?= =?utf-8?q?KHL8s6P+RKE8e0hOoRdWruXlqAYBRLDkCVaco+DpY9W2TWN4+o3dloAoTkzIEtJ1x?= =?utf-8?q?ulJazlPOunZKme0yuTHUeVe1JKBhDSays48LuROWXIng/r5u94v/O9cjpB5uf3sbr?= =?utf-8?q?hKgbFS9/vuwYuVwSwStEB2v2vBeObFGLQ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RmwzP4ToeJLAzpsyYVwDu?= =?utf-8?q?jC6YvyG3epAAtNCMlQYUu915H9DsgyabxmxCmcOU7xb77pXtC+kPtI7Td6sYurhh8?= =?utf-8?q?WWq2Habf8UNxZ0YBKQwqQRrRrxAU9KEQDC99XIOjY6XK4Qt9QRfp14QegYkIpNRTm?= =?utf-8?q?rp/FxOnDV8hSmzovVKHt7DLECdHo4medzE0MkOjEjrKk1J8A6wMEq4s=3D?= X-OriginatorOrg: wolfvision.net X-MS-Exchange-CrossTenant-Network-Message-Id: 0662cc7f-a688-4cfc-faf9-08dc48b37d9b X-MS-Exchange-CrossTenant-AuthSource: VE1PR08MB4974.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Mar 2024 07:58:12.4732 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: e94ec9da-9183-471e-83b3-51baa8eb804f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 274i+ZyUP+DU5f1Alv9O6iFneBcqqfO87CdRDjJTINcTVpeVG005TEpLyMBhPPSAIHA8lhYd6MVIOrzWtBWUln/Pw3dukRHD7+QE5OhFV8s= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4PR08MB8056 The touch-overaly feature adds support for segments (touch areas) on the touchscreen surface that represent overlays with clipped touchscreen areas and printed buttons. Add nodes for a clipped touchscreen and overlay buttons to the existing example. Reviewed-by: Rob Herring Signed-off-by: Javier Carrasco --- .../input/touchscreen/sitronix,st1232.yaml | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/Documentation/devicetree/bindings/input/touchscreen/sitronix,st1232.yaml b/Documentation/devicetree/bindings/input/touchscreen/sitronix,st1232.yaml index 1d8ca19fd37a..e7ee7a0d74c4 100644 --- a/Documentation/devicetree/bindings/input/touchscreen/sitronix,st1232.yaml +++ b/Documentation/devicetree/bindings/input/touchscreen/sitronix,st1232.yaml @@ -37,6 +37,7 @@ unevaluatedProperties: false examples: - | + #include i2c { #address-cells = <1>; #size-cells = <0>; @@ -46,5 +47,33 @@ examples: reg = <0x55>; interrupts = <2 0>; gpios = <&gpio1 166 0>; + + touch-overlay { + segment-0 { + label = "Touchscreen"; + x-origin = <0>; + x-size = <240>; + y-origin = <40>; + y-size = <280>; + }; + + segment-1a { + label = "Camera light"; + linux,code = ; + x-origin = <40>; + x-size = <40>; + y-origin = <0>; + y-size = <40>; + }; + + segment-2a { + label = "Power"; + linux,code = ; + x-origin = <160>; + x-size = <40>; + y-origin = <0>; + y-size = <40>; + }; + }; }; }; From patchwork Wed Mar 20 07:58:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 781710 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2091.outbound.protection.outlook.com [40.107.6.91]) (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 53A2F23DE; Wed, 20 Mar 2024 07:58:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.6.91 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710921510; cv=fail; b=XSqi0VoPRuLMsvJoJzJYlUuHRyf3Mnp8wwICrw8OQW8IC8MVwWTquMBwTzUM6Oo8JFIPpBtPSIO1Q5y9T7xXTuJlgwELUxH3tJty682j8wJNpeqlTit9W6vGTVqwz2W/jlRSRa7FIrEKSlf2bz6xcv4fvwA0je3vOrBq7+kkJBs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710921510; c=relaxed/simple; bh=CRZ0sSYsoUecSbz+oUC0fLIT0nSbJZhwa7o6rQIIR/k=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=olAvEino1GsAfClrujWvQBnxpwqtOkKyi2pel2Nzs6dVGjgQeZxcPYJubDOmApOS4HdBxneNJdhQTUdZ5hzGQF0UPoGf1Hx7Y/lTmko4gZokzG/Aa/faxwXB+QU7YHSe1mPFzqoQuuC4QiKFP6MZC9jb2oTwHZfu4oagsbjSmAc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wolfvision.net; spf=pass smtp.mailfrom=wolfvision.net; dkim=pass (1024-bit key) header.d=wolfvision.net header.i=@wolfvision.net header.b=fEIBGJRr; arc=fail smtp.client-ip=40.107.6.91 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wolfvision.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wolfvision.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=wolfvision.net header.i=@wolfvision.net header.b="fEIBGJRr" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T63C+xc7h2jEdRvepaDLnqY7qgnsy361GAFnWL0KjaUfZD2+RMr6Jz1M2VdFmAZfSnw2RFCM9vFLS5YLd1E4YZnoVbxnNbm3eBv23j2/CVuk/+cZRyTsIaHZs4evMFog4Eq0zoOna0ppJpp6uvxo7PM23lOQ2LErI+CHbNsaW/MXXFGXNgQMSDCLVjyf9rCr8XYFMoxfWlCeuiq5ksp19QIbXIU+kz1opu9FVE6/1P7ULju8M/q7TutBh0n4QtKXhmCnMEBpU4l+vLW3ZRRFD5blgWJ5EXQ2J4BpHZBuplbEYVqhVgHO4DwjoFx6BLiAQC6sjyb4oxki2+VQdbZY0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=c+IO+awHoDqlqKjGNEtdGlN859aV5MdUs044vwjEIJE=; b=Ln9s9hUDuo2FZXJDEvLPlTLWi3qa/aPIdPJmU9nee7cLwzCEuWtInUPcM5bVNkQ+Mj5GKd+jYGABgP2ZjoSEYZ2frhMAgANkIi/PKVul4y7zicrukf0L1GLEsWuUnPyz5FkM7S4ouOD7iDfQe0dy6dGLilvGSoishXEEQVh+reBzYE1218XfvUUp2DvaOD8u4iMeCV5V7t2OKPEBooATPLKaAh4MIyS1P+I72eaWwdreVAS6VDiCd6LBK7XmyfExRodtVOeVWVQ2blPD7ihytZqfGxTBS9avHZj2iPLh1LZP4jgwwHf5v6wAnNCOPuVBw+AtG/kIqSgbVTeCmbKGOA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wolfvision.net; dmarc=pass action=none header.from=wolfvision.net; dkim=pass header.d=wolfvision.net; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wolfvision.net; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=c+IO+awHoDqlqKjGNEtdGlN859aV5MdUs044vwjEIJE=; b=fEIBGJRrPkaQIwwStjeW877PT8p6Ui0qn+SoO6nRPyVUth1xZ6a3L0FuQ5/HQvtOcMtcCRTgGL1itGPad1y6jxi77o9gvwRnuv8sXiDPI/kDf8qE8rbiavWsNHD5h4CMk5kLuU6qVxXV4Y77uGJDND9mIRcGrsCgjMK1t64Ly5U= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=wolfvision.net; Received: from VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) by GV2PR08MB8703.eurprd08.prod.outlook.com (2603:10a6:150:b3::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.30; Wed, 20 Mar 2024 07:58:19 +0000 Received: from VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::9e35:6de9:e4fc:843f]) by VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::9e35:6de9:e4fc:843f%7]) with mapi id 15.20.7386.025; Wed, 20 Mar 2024 07:58:17 +0000 From: Javier Carrasco Date: Wed, 20 Mar 2024 08:58:09 +0100 Subject: [PATCH v8 4/4] Input: st1232 - add touch overlays handling Message-Id: <20240320-feature-ts_virtobj_patch-v8-4-cab6e7dcb1f6@wolfvision.net> References: <20240320-feature-ts_virtobj_patch-v8-0-cab6e7dcb1f6@wolfvision.net> In-Reply-To: <20240320-feature-ts_virtobj_patch-v8-0-cab6e7dcb1f6@wolfvision.net> To: Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bastian Hecht , Michael Riesch Cc: linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Javier Carrasco , Jeff LaBundy X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1710921491; l=3456; i=javier.carrasco@wolfvision.net; s=20240320; h=from:subject:message-id; bh=CRZ0sSYsoUecSbz+oUC0fLIT0nSbJZhwa7o6rQIIR/k=; b=WRwmy6ZSnciUyXQAk16pOUHYUsKKRQiOTj1pJZayRYy1A+TOWjjC4mDmLBm3URVwrTV56ViXh DlJotJOQr/8BvgmlyF520IuWWcadGXiMDei/RTa6dtc2Gfc7l0Tfgy4 X-Developer-Key: i=javier.carrasco@wolfvision.net; a=ed25519; pk=Vxk2/0sGIxM8rsKnceszFuSuHVfQwa1Yo8+is7BX2nY= X-ClientProxiedBy: VI1PR07CA0286.eurprd07.prod.outlook.com (2603:10a6:800:130::14) To VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR08MB4974:EE_|GV2PR08MB8703:EE_ X-MS-Office365-Filtering-Correlation-Id: 56a985c7-a1ee-4db0-d4e9-08dc48b37dd2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Me/mEcxh1J1YgyIU7TJ/LFQq9G6xSMcpHaGT3/WJm30FwbxhGG03b9J6oFMuxDt2MkXriDZoWEooVaOEekdpx/SmSj/fDcIvKx+7fTZ5YyzEElJ2maQ3Z6Lj2IsnwKSCA81F86WJ5SvatWd4cuTewrV7u56goMleB5e3vp8whphjlUVJQGIO4vH5PN73SDf7ASt1yIRVBD6dqrlOZYJBwSoy7N8gidv0lsjg53kPnKjtleS/q1r/OPqPis2JP6M02kwyTSAqbryYsrXVXjAs98ZA8bH0js26UhfD/QD85V1Xeyi6IghmJvzEx2Q7F8zL73/IiV/Om84xpNl3pC87JWaMFIe7904797GJY+mMhr8cPfJ0NuVgpHNR8GVr1aEmFwgGyKTVl0vpN9tEK9r9ZtdcDHnBlfCJI41ksh+YJFnJzBvKheaGUnoFB12DW9xBLhA28Z5VD/7w0y4EloIHf+PVhjYDSXxr+HCDZj2qqhY70JGQaXQAqVrhg7DCqx3lpN3wRDGDEkCLksc+qKV+OE8E8SnNt1ogEmdA8fKuehJoKEyW1LPwe3Mm3Iq4AtS84AvJiRaM4Jf+PXWtqr3Qtv0v6hOAzUxLdxuXGQ59s9ZbZss2PfT9Unm8AAxgNfES54a8XsLtXqHtiejj/UylhwKDSZhC1N0vp9LxuHt4/7PP/gIiuU/Jd49zoPRowYFZAzKZuEzo6WmRAugJ9zMtVesOX/0NED0cqlgb2in6NW4= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VE1PR08MB4974.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(52116005)(376005)(366007)(1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Tenant-AuthSource: VE1PR08MB4974.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Mar 2024 07:58:12.8047 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: e94ec9da-9183-471e-83b3-51baa8eb804f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: CZZtvVfZwDgo2goRUpCLxFeX4IWGJDzy7Fmw3bBP0yyb3cbeGQV2fdfmpG3IBz0ZYe2rJxDmQVVVEfZFHEmN1UiQqyzZ8aeLaI1GsM6ehHM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2PR08MB8703 Use touch-overlay to support overlay objects such as buttons and a resized frame defined in the device tree. If buttons are provided, register an additional device to report key events separately. A key event will be generated if the coordinates of a touch event are within the area defined by the button properties. Reviewed-by: Jeff LaBundy Signed-off-by: Javier Carrasco --- drivers/input/touchscreen/st1232.c | 48 +++++++++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 14 deletions(-) diff --git a/drivers/input/touchscreen/st1232.c b/drivers/input/touchscreen/st1232.c index 6475084aee1b..4fa31447dbc1 100644 --- a/drivers/input/touchscreen/st1232.c +++ b/drivers/input/touchscreen/st1232.c @@ -22,6 +22,7 @@ #include #include #include +#include #define ST1232_TS_NAME "st1232-ts" #define ST1633_TS_NAME "st1633-ts" @@ -57,6 +58,7 @@ struct st1232_ts_data { struct dev_pm_qos_request low_latency_req; struct gpio_desc *reset_gpio; const struct st_chip_info *chip_info; + struct list_head touch_overlay_list; int read_buf_len; u8 *read_buf; }; @@ -138,14 +140,20 @@ static int st1232_ts_parse_and_report(struct st1232_ts_data *ts) for (i = 0; i < ts->chip_info->max_fingers; i++) { u8 *buf = &ts->read_buf[i * 4]; + bool contact = buf[0] & BIT(7); + unsigned int x, y; - if (buf[0] & BIT(7)) { - unsigned int x = ((buf[0] & 0x70) << 4) | buf[1]; - unsigned int y = ((buf[0] & 0x07) << 8) | buf[2]; - - touchscreen_set_mt_pos(&pos[n_contacts], - &ts->prop, x, y); + if (contact) { + x = ((buf[0] & 0x70) << 4) | buf[1]; + y = ((buf[0] & 0x07) << 8) | buf[2]; + } + if (touch_overlay_process_event(&ts->touch_overlay_list, input, + contact ? &x : NULL, + contact ? &y : NULL, i)) + continue; + if (contact) { + touchscreen_set_mt_pos(&pos[n_contacts], &ts->prop, x, y); /* st1232 includes a z-axis / touch strength */ if (ts->chip_info->have_z) z[n_contacts] = ts->read_buf[i + 6]; @@ -292,18 +300,30 @@ static int st1232_ts_probe(struct i2c_client *client) if (error) return error; - /* Read resolution from the chip */ - error = st1232_ts_read_resolution(ts, &max_x, &max_y); - if (error) { - dev_err(&client->dev, - "Failed to read resolution: %d\n", error); - return error; - } - if (ts->chip_info->have_z) input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR, 0, ts->chip_info->max_area, 0, 0); + /* map overlay objects if defined in the device tree */ + INIT_LIST_HEAD(&ts->touch_overlay_list); + error = touch_overlay_map(&ts->touch_overlay_list, input_dev); + if (error) + return error; + + if (touch_overlay_mapped_touchscreen(&ts->touch_overlay_list)) { + /* Read resolution from the overlay touchscreen if defined */ + touch_overlay_get_touchscreen_abs(&ts->touch_overlay_list, + &max_x, &max_y); + } else { + /* Read resolution from the chip */ + error = st1232_ts_read_resolution(ts, &max_x, &max_y); + if (error) { + dev_err(&client->dev, + "Failed to read resolution: %d\n", error); + return error; + } + } + input_set_abs_params(input_dev, ABS_MT_POSITION_X, 0, max_x, 0, 0); input_set_abs_params(input_dev, ABS_MT_POSITION_Y,