From patchwork Tue Apr 25 11:50:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 13223227 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7919DC77B61 for ; Tue, 25 Apr 2023 11:51:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233825AbjDYLva (ORCPT ); Tue, 25 Apr 2023 07:51:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233801AbjDYLv3 (ORCPT ); Tue, 25 Apr 2023 07:51:29 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2063.outbound.protection.outlook.com [40.107.21.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25BD44200; Tue, 25 Apr 2023 04:51:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ihR/0S5O8hX3Yppp7shwsyVQSSJynb/0PxoTCIoOtwyfvju3myZ3R55yrH5IMONYFHwk7X+4/K6QHZbhNELChVzi7atmRMv8PWSpNEtjAN+IhnPpbKys1tgTyIDhoQQkdc9gtUXqqOhxir3WR8Bp21WIga6dyLJwnAbGx2mshLAfw63REdOpxYUaJoxU0QVA87Ie3oaWjzQUPDU/3aYpFKyCu1FD2gePAMi5MopjQo54VZcr5RuFcPafSxNpnGv0y7a7gryHJBFohHtyaxE6A/QOaW03LFqXUnW1D0ptQGfokS2c4nfB3MKbDom9/WtUTbgST6lsb7EmO9kswq03gQ== 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=mILccMTTzS/vZ9Zv1t3NwyGbE1X8hbGefC4Yna5xN8Y=; b=NHXtV0jUsG0RTW+KH5uDhIw71zskWxfsqVVptQYphR8/G3MHUqVORIJCM//SVHXVRUG0YLdZ1R5WkRtM+IgDQuUaRHM6WuZGJAzPEU9G+KS+rvfOc1vlQTkzsprdsObT7N9vbiYwSt9LOfipNdfYlDyukOcWwEIC0M43lFwYEDsB32jyMDpPx8yMy334pQDxY1gLKsREQtxL8N4iLw580pMMgmMZHbKPpGmdWAWLLg3yNw5t5ahn4QyoID1Qa3IpsIYVMzY4UsfPs0FoKEbibV7g8lTe4+3j28bt0ZeMlqasvONzYdnFxYYCrnmt5qpiiyCVY0phqhgcUASHQsdrGg== 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=mILccMTTzS/vZ9Zv1t3NwyGbE1X8hbGefC4Yna5xN8Y=; b=UkTPFtlFZEr3g50rhunkjOBGl3a0pIRCFTrDUN7dN+DH7oGdxWX/qLp0HktES6OueQIrkB3iskG/JEGvkj8RK9fWXR0FtElHz9wLPKPmmX9n6sH2voB5drclIwtw683ZjLAXRPtEFBxF/oZ3UGIjNI/MHzq/ETPG66ptCN8kZQA= 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 DU2PR08MB10203.eurprd08.prod.outlook.com (2603:10a6:10:491::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.33; Tue, 25 Apr 2023 11:51:23 +0000 Received: from VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::6c5a:c28e:206:453]) by VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::6c5a:c28e:206:453%6]) with mapi id 15.20.6319.033; Tue, 25 Apr 2023 11:51:23 +0000 From: Javier Carrasco To: linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Henrik Rydberg , Javier Carrasco , Ulf Hansson , Hans Verkuil , Stephen Boyd , Sebastian Reichel , Linus Walleij , Jonathan Cameron , Uwe Kleine-g , Bastian Hecht , Michael Riesch Subject: [RFC v1 1/4] Input: ts-virtobj - Add touchsreen virtual object handling to the core Date: Tue, 25 Apr 2023 13:50:46 +0200 Message-Id: <20230425115049.870003-2-javier.carrasco@wolfvision.net> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230425115049.870003-1-javier.carrasco@wolfvision.net> References: <20230425115049.870003-1-javier.carrasco@wolfvision.net> X-ClientProxiedBy: VI1P194CA0055.EURP194.PROD.OUTLOOK.COM (2603:10a6:803:3c::44) To VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR08MB4974:EE_|DU2PR08MB10203:EE_ X-MS-Office365-Filtering-Correlation-Id: 4f64fdec-d064-42c3-8ef7-08db45836412 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: s2Pi0Q2QuCz9CWYEUr50hpDTx4juFJsV+RGdhqVtfTK8Y2kdMlObwWDLO3NKTVfg+2jua8XcxGzsmp5Jw9OWTGn+2lIrR4L3xplBq5bDd8Ll9DrqoSUzmeMd3Lg+HAwh/ar+EpIPHhewcfIvdX/YsW4tKakQrlsjZRyp17kCxUVnY9Er2GvlJANbAZ9UdhfKmbC2/Dm+fingukaI4JKzSFKDgVrrkErrAel8h0uV945qZTCz3OMTCwzIVZk19NfgAOATsbf8kTwKekW5BnR4QPqtiBaCh1eT9+4uR9RvTkOzvukIXBeJyqSpccBiQ1NP9YxY4rP0cEKfcqF8g1R8qo8FFnvlxAkFLqW6ty2fhCFDDg3FSy1rAy03o5Nr13LEIP8s3X2P3ZU5wcLN6WTuKnGbgN3eUfWie8CWi8P0LOp2E+Ku+tcgo4+W3FM553MFHOFl69O7LJXct4+uTz1praqSt7aa7oYXHby5z9h4eZhNXJlLtFveFjsXqIgUvjYjDXQPxERXzoCXRcPAhx2UnFVGjArUIcvlBmost5nVr1qApAdcP5UeVp7Ja4rDy9hOwNQGkAlvpmMW6Yg0I/O+/SmMXggijcdLXU5R+AhbEhZpvsKV1IOwE/0U0V+j8e6Y 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:(13230028)(4636009)(376002)(39840400004)(366004)(346002)(396003)(136003)(451199021)(38350700002)(36756003)(8676002)(8936002)(54906003)(478600001)(66476007)(66556008)(66946007)(4326008)(7416002)(44832011)(316002)(41300700001)(30864003)(2906002)(38100700002)(5660300002)(2616005)(86362001)(186003)(26005)(6506007)(6512007)(1076003)(107886003)(52116002)(6486002)(6666004)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: B32AjecXpPxk1YCmtfjFxiQA/h4ZzVqQqNhksDftwllKNhXmdSygYElubBOt1XGGpE1oVKmlg00Jhzxm9MPPMQId+B82x6fYRqapzMBj55PLUsID8JaOIpR0ulvSe0b3zmsoTfiq3rvloydpykUzluDU5vG8iZ2q/fzWLBWtzRSJ4YtejbkYts/wwU1QpxPH9zv54nntNYf6TF3B6MtgKZnk9wTGLWHnG5b0H/IozX5bEmLKW/0Ts6YYaE47xjUum34Q3AU27Ea77PCAVptlRUJ7wC/w/6azYDNL+bqCAFajJNAgGeRnCZaz7QqIHCL5LCc5oaJyfKkye6Q4+XSr1vYGdV9tZPMc8kZdEN00mUJWXh+Vo8/t7emXlhPV7kkEV/tywKO+BO9+BRRrjBut5Dq2bR6TGnRkyEa8gld68+XnBpB8Yz7if03XQxCNiaLbrDOitIDslh3glVbBcOf/PlNQOpczia8v+z3Y8VAtMmxcy4wB8hY6nyLWGe9tD6lLbNhRZiu+sgx0TA2HA4FcRz44TLnS13XelILQwZ1nhosIl/0GwZpxQpFI/qVTSm8hU4B68bKryn7+8GkitmZpqBYTmzlHv1fvh+esB0Glc0NH0AqjsQJHtaB+90l3Wcp+mt1s2srrEpVF3jWXGuM6FMbWuFSLM7EWjWFRQCBmEZ+0Qsmcsmh4Z2E4F//379yNaUucxHHeeNhMsVd4dpNByvUs6X5speftLa2HS9M9qkXnSDvlqOQ1Jzt74orCww6klm9Dx9ZMioBH45aiiy6e6zuq3s9Bj4yeYnl44d03oAABsddGV5A5QOA2JYoxr1gYO5iFBwql6spSjwoFdNtPMShMd2BDJhS5G0+23y2vMfUrFYcMUM5Myg4Jp2D+Xwr4+nY/0KksN8oEu6aIUYATQjiIXOs4BfHU9bnw2Qb+4udbdOOK3RR9bN1deQVnKjzLBhdfjvhZ1w1F75l5oy1ZQ7pHsva0WLOdOOC+o1Mmd6D5SW4gTFrcadb0Gs2V8O7UPMYXvfOxZwMdCeYaSjUZUsqjthHdAfWERqEUy87v2Gs+Tqgx2uoBxd0hF5FXO8ihPZQIq7jKEreU/P5dbMWqu4Jix52uoGQqde+s5xFzqb7vB97rjsP/FWKxuUPnJEIikWtd3vDZLogr6VmY72GOWqICWB2rD8kzVoRJDdemUb9wgh1bIwYbERMocyjcO8twSUn/ndg2QxiouKoTfAOgNdF32qwNZ4Gqnp1vgXQzSF1U3eoLet1/Drchd/pPHXqNQmiy3t+/HO0io4LfXc05v+Qeq6EKrbkdaK4ImHUKSVYpTWZ9kkr2psf/I3Sxsn6EVuwJAEjybE1hoc4HxF08KB2qHaRzEYxIIqznz8BaN7M2eI1gCrdrV6/QNJeN1PjctpywODhLXSKSekou34uSMPPuB9jLSDGJklwQTbE8UO4qgh3NY1EjbMhLAWFcJPmkWitJj71byT8/XRFHSo1mqlS4msRTsCzgYegQBq9TZsMDh2wAq9xlnpQz0ciINksXYG4sBKUggvt/XVRg7fYVB44rY8LmA0IjGnwh8rIoXC1R409J0Ql/R1V3qJ5TrnB7cdp6xVrIwTZtQ79tsZj9dA== X-OriginatorOrg: wolfvision.net X-MS-Exchange-CrossTenant-Network-Message-Id: 4f64fdec-d064-42c3-8ef7-08db45836412 X-MS-Exchange-CrossTenant-AuthSource: VE1PR08MB4974.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Apr 2023 11:51:22.6568 (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: vhibLOWiKkYgRDlWezJWEtG8Gjudd8fyfC9+xOgtWSnB4evnh1rqX9O9Xmsf1QKXcmsn1pPBOn9yEz2jT2HvDvQZfegJXzKDG+mG7TWBR30= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR08MB10203 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Some touchscreens provide mechanical overlays with different objects like buttons or downsized touchscreen surfaces. In order to support these objects, add a series of helper functions to the input core to transform them into virtual objects via device tree nodes. These virtual objects consume the raw touch events and report the expected input events depending on the object properties. Signed-off-by: Javier Carrasco --- drivers/input/Makefile | 1 + drivers/input/ts-virtobj.c | 305 +++++++++++++++++++++++++++++++ include/linux/input/ts-virtobj.h | 59 ++++++ 3 files changed, 365 insertions(+) create mode 100644 drivers/input/ts-virtobj.c create mode 100644 include/linux/input/ts-virtobj.h diff --git a/drivers/input/Makefile b/drivers/input/Makefile index 2266c7d010ef..9c717e28719e 100644 --- a/drivers/input/Makefile +++ b/drivers/input/Makefile @@ -8,6 +8,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 += ts-virtobj.o obj-$(CONFIG_INPUT_FF_MEMLESS) += ff-memless.o obj-$(CONFIG_INPUT_SPARSEKMAP) += sparse-keymap.o diff --git a/drivers/input/ts-virtobj.c b/drivers/input/ts-virtobj.c new file mode 100644 index 000000000000..4bddd8015af3 --- /dev/null +++ b/drivers/input/ts-virtobj.c @@ -0,0 +1,305 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Helper functions for virtual objects on touchscreens + * + * Copyright (c) 2023 Javier Carrasco + */ + +#include +#include +#include +#include +#include + +static int ts_virtobj_count_buttons(struct device *dev) +{ + struct fwnode_handle *child_node; + struct fwnode_handle *child_button; + int count = 0; + + child_node = device_get_named_child_node(dev, ts_virtobj_names[BUTTON]); + if (!child_node) + return 0; + + fwnode_for_each_child_node(child_node, child_button) + count++; + fwnode_handle_put(child_node); + + return count; +} + +static int ts_virtobj_get_shape_properties(struct fwnode_handle *child_node, + struct ts_virtobj_shape *shape) +{ + int rc; + + rc = fwnode_property_read_u32(child_node, "x-origin", &shape->x_origin); + if (rc < 0) + return rc; + + rc = fwnode_property_read_u32(child_node, "y-origin", &shape->y_origin); + if (rc < 0) + return rc; + + rc = fwnode_property_read_u32(child_node, "x-size", &shape->x_size); + if (rc < 0) + return rc; + + rc = fwnode_property_read_u32(child_node, "y-size", &shape->y_size); + if (rc < 0) + return rc; + + return 0; +} + +static int ts_virtobj_get_button_properties(struct device *dev, + struct fwnode_handle *child_node, + struct ts_virtobj_button *btn) +{ + struct fwnode_handle *child_btn; + int rc; + int j = 0; + + fwnode_for_each_child_node(child_node, child_btn) { + rc = ts_virtobj_get_shape_properties(child_btn, &btn[j].shape); + if (rc < 0) { + fwnode_handle_put(child_btn); + return rc; + } + + rc = fwnode_property_read_u32(child_btn, "linux,code", + &btn[j].key); + if (rc < 0) { + fwnode_handle_put(child_btn); + return rc; + } + + dev_info(dev, "Added button at (%u, %u), size %ux%u, code=%u\n", + btn[j].shape.x_origin, btn[j].shape.y_origin, + btn[j].shape.x_size, btn[j].shape.y_size, btn[j].key); + j++; + } + + return 0; +} + +static void ts_virtobj_set_button_caps(struct ts_virtobj_map *map, + struct input_dev *dev) +{ + int i; + + for (i = 0; i < map->button_count; i++) + input_set_capability(dev, EV_KEY, + map->buttons[i].key); +} + +static int ts_virtobj_map_touchscreen(struct device *dev, + struct ts_virtobj_map *map) +{ + struct fwnode_handle *child; + int rc = 0; + + child = device_get_named_child_node(dev, ts_virtobj_names[TOUCHSCREEN]); + if (!child) + return 0; + + map->touchscreen = devm_kzalloc(dev, sizeof(*map->touchscreen), + GFP_KERNEL); + if (!map->touchscreen) { + fwnode_handle_put(child); + return -ENOMEM; + } + rc = ts_virtobj_get_shape_properties(child, map->touchscreen); + if (rc < 0) { + devm_kfree(dev, map->touchscreen); + fwnode_handle_put(child); + return rc; + } + map->virtual_touchscreen = 1; + dev_info(dev, "Added virtual touchscreen at (%u, %u), size %u x %u\n", + map->touchscreen->x_origin, map->touchscreen->y_origin, + map->touchscreen->x_size, map->touchscreen->y_size); + + fwnode_handle_put(child); + return 0; +} + +static int ts_virtobj_map_buttons(struct device *dev, + struct ts_virtobj_map *map, + struct input_dev *input) +{ + struct fwnode_handle *child; + u32 button_count; + int rc; + + button_count = ts_virtobj_count_buttons(dev); + if (button_count) { + map->buttons = devm_kcalloc(dev, button_count, + sizeof(*map->buttons), GFP_KERNEL); + if (!map->buttons) + return -ENOMEM; + + child = device_get_named_child_node(dev, + ts_virtobj_names[BUTTON]); + if (unlikely(!child)) { + devm_kfree(dev, map->buttons); + return 0; + } + rc = ts_virtobj_get_button_properties(dev, child, map->buttons); + if (rc < 0) { + devm_kfree(dev, map->buttons); + return rc; + } + map->button_count = button_count; + ts_virtobj_set_button_caps(map, input); + } + + return 0; +} + +static bool ts_virtobj_defined_objects(struct device *dev) +{ + struct fwnode_handle *child; + int i; + + for (i = 0; i < ARRAY_SIZE(ts_virtobj_names); i++) { + child = device_get_named_child_node(dev, ts_virtobj_names[i]); + if (child) { + fwnode_handle_put(child); + return true; + } + fwnode_handle_put(child); + } + + return false; +} + +struct ts_virtobj_map *ts_virtobj_map_objects(struct device *dev, + struct input_dev *input) +{ + struct ts_virtobj_map *map; + int rc; + + if (!ts_virtobj_defined_objects(dev)) + return NULL; + + map = devm_kzalloc(dev, sizeof(*map), GFP_KERNEL); + if (!map) + return ERR_PTR(-ENOMEM); + + rc = ts_virtobj_map_touchscreen(dev, map); + if (rc < 0) { + devm_kfree(dev, map); + return ERR_PTR(rc); + } + rc = ts_virtobj_map_buttons(dev, map, input); + if (rc < 0) { + devm_kfree(dev, map); + return ERR_PTR(rc); + } + + return map; +} +EXPORT_SYMBOL(ts_virtobj_map_objects); + +void ts_virtobj_retrieve_abs(struct ts_virtobj_map *map, u16 *x, u16 *y) +{ + *x = map->touchscreen->x_size - 1; + *y = map->touchscreen->y_size - 1; +} +EXPORT_SYMBOL(ts_virtobj_retrieve_abs); + +static bool ts_virtobj_event_in_shape_range(struct ts_virtobj_shape *shape, + u32 x, u32 y) +{ + if (!shape) + return false; + + if (x >= shape->x_origin && x < (shape->x_origin + shape->x_size) && + y >= shape->y_origin && y < (shape->y_origin + shape->y_size)) + return true; + + return false; +} + +bool ts_virtobj_touchscreen_event(struct ts_virtobj_shape *touchscreen, + u32 *x, u32 *y) +{ + if (ts_virtobj_event_in_shape_range(touchscreen, *x, *y)) { + *x -= touchscreen->x_origin; + *y -= touchscreen->y_origin; + return true; + } + + return false; +} +EXPORT_SYMBOL(ts_virtobj_touchscreen_event); + +bool ts_virtobj_mapped_touchscreen(struct ts_virtobj_map *map) +{ + if (!map || !map->virtual_touchscreen) + return false; + + return true; +} +EXPORT_SYMBOL(ts_virtobj_mapped_touchscreen); + +static bool ts_virtobj_mapped_button(struct ts_virtobj_map *map) +{ + if (!map || !map->button_count) + return false; + + return true; +} + +bool ts_virtobj_mt_on_touchscreen(struct ts_virtobj_map *map, u32 *x, u32 *y) +{ + if (!ts_virtobj_mapped_touchscreen(map)) + return true; + + if (!ts_virtobj_touchscreen_event(map->touchscreen, x, y)) + return false; + + return true; +} +EXPORT_SYMBOL(ts_virtobj_mt_on_touchscreen); + +bool ts_virtobj_button_event(struct ts_virtobj_map *map, + struct input_dev *input, u32 x, u32 y) +{ + int i; + + if (!ts_virtobj_mapped_button(map)) + return false; + + for (i = 0; i < map->button_count; i++) { + if (ts_virtobj_event_in_shape_range(&map->buttons[i].shape, x, y)) { + input_report_key(input, map->buttons[i].key, 1); + map->buttons[i].pressed = true; + return true; + } + } + + return false; +} +EXPORT_SYMBOL(ts_virtobj_button_event); + +void ts_virtobj_button_release_pressed(struct ts_virtobj_map *map, + struct input_dev *input) +{ + int i; + + if (!map || !map->button_count) + return; + + for (i = 0; i < map->button_count; i++) { + if (map->buttons[i].pressed) { + input_report_key(input, map->buttons[i].key, 0); + map->buttons[i].pressed = false; + } + } +} +EXPORT_SYMBOL(ts_virtobj_button_release_pressed); + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("Helper functions for virtual objects on touchscreens"); diff --git a/include/linux/input/ts-virtobj.h b/include/linux/input/ts-virtobj.h new file mode 100644 index 000000000000..4b61709a2680 --- /dev/null +++ b/include/linux/input/ts-virtobj.h @@ -0,0 +1,59 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (c) 2023 Javier Carrasco + */ + +#ifndef _TS_VIRTOBJ +#define _TS_VIRTOBJ + +struct input_dev; +struct device; + +enum ts_virtobj_valid_objects { + TOUCHSCREEN, + BUTTON, +}; + +static const char * const ts_virtobj_names[] = { + [TOUCHSCREEN] = "virtual-touchscreen", + [BUTTON] = "virtual-buttons", +}; + +struct ts_virtobj_shape { + u32 x_origin; + u32 y_origin; + u32 x_size; + u32 y_size; +}; + +struct ts_virtobj_button { + struct ts_virtobj_shape shape; + u32 key; + bool pressed; +}; + +struct ts_virtobj_map { + struct ts_virtobj_shape *touchscreen; + bool virtual_touchscreen; + struct ts_virtobj_button *buttons; + u32 button_count; +}; + +struct ts_virtobj_map *ts_virtobj_map_objects(struct device *dev, + struct input_dev *input); + +void ts_virtobj_retrieve_abs(struct ts_virtobj_map *map, u16 *x, u16 *y); + +bool ts_virtobj_touchscreen_event(struct ts_virtobj_shape *touchscreen, + u32 *x, u32 *y); + +bool ts_virtobj_mapped_touchscreen(struct ts_virtobj_map *map); + +bool ts_virtobj_mt_on_touchscreen(struct ts_virtobj_map *map, u32 *x, u32 *y); + +bool ts_virtobj_button_event(struct ts_virtobj_map *map, + struct input_dev *input, u32 x, u32 y); + +void ts_virtobj_button_release_pressed(struct ts_virtobj_map *map, + struct input_dev *input); +#endif From patchwork Tue Apr 25 11:50:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 13223228 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22998C77B71 for ; Tue, 25 Apr 2023 11:51:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233892AbjDYLvc (ORCPT ); Tue, 25 Apr 2023 07:51:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233857AbjDYLva (ORCPT ); Tue, 25 Apr 2023 07:51:30 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2063.outbound.protection.outlook.com [40.107.21.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F08D59DA; Tue, 25 Apr 2023 04:51:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZTzCopn0tiBDgS63oNoUWpmK7g40aGGJi3q1qHutCTQLBz6ojcQ5qz+YRTpPKE8fYT1VW9dVUb0HWz0aolbATD/gtUE/BJL81KHTSNcrRFbv5IbfJPNwWupUxpz6Zyvny5ug2WQlI8qcUH1Fv09cFKQNep6EwqoDRylkBvRGpelN45YYNzotVDZnwuMvpyibVegO2nLndwHZmFhHkbqoL+jdovlKRRxE6NNiufdGvG04kX+wIU28DJJcUZ795AgKI7FZrjPZsDCjBcCmj+jScBlIrmH6n6a9G/RHuvtLdSZXc0ICbFIKNr1epnz2xFtalDe0Tp2IoduSjnXLdaeAhA== 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=pQ2XI9f7Pp5cnKI8cUXKPGJggcLoJi3xByEnGE/pBoY=; b=D4MWI7amLs1Au17vmxdWttfcPJMjofKGkzNFY/pkxql/VlIngURP7uwf+c9euh6OqgzNBWxIF312+89UpCmebBg/GuY+SzBHpu2WBssVoD+wZNiuVuKU61J/pEofx+P5DmN6BpZhneiYrAUD5NQQiuA0jhskrIoJYvOcaUj+EL6wO+BQtGLV6MT3OpumfwavBACCOv1dgebEo6d4NweiQkDq5dLGsnO80Jytjxg+g/EA1bBDFy7zmQ9CJT8/XZjHMYCtXxkLu9exiSR56S2ZeXAcWTxc/NYRjHDcnualxTPNs7zbWefuu93cFW6U1lZKKvNACXxpze3L6lJDtk8syQ== 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=pQ2XI9f7Pp5cnKI8cUXKPGJggcLoJi3xByEnGE/pBoY=; b=b2FEuuMONyOhUhckv8Oo471U8TQGQHQa2OcGa5kfnMrdxOG0IO3GKaJ8qeyXoBCnQ0Op8/TFgw+e9GmzeQrC1q8hvTun1FrXx1iL/9MllrNoZMm0A+CUSFtHqf40aojX5pbNvOrSRNSJ2oNjD5UnQwwr649PfiM3cr+8SB/wU4w= 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 DU2PR08MB10203.eurprd08.prod.outlook.com (2603:10a6:10:491::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.33; Tue, 25 Apr 2023 11:51:23 +0000 Received: from VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::6c5a:c28e:206:453]) by VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::6c5a:c28e:206:453%6]) with mapi id 15.20.6319.033; Tue, 25 Apr 2023 11:51:23 +0000 From: Javier Carrasco To: linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Henrik Rydberg , Javier Carrasco , Ulf Hansson , Hans Verkuil , Stephen Boyd , Sebastian Reichel , Linus Walleij , Jonathan Cameron , Uwe Kleine-g , Bastian Hecht , Michael Riesch Subject: [RFC v1 2/4] dt-bindings: touchscreen: add virtual-touchscreen and virtual-buttons properties Date: Tue, 25 Apr 2023 13:50:47 +0200 Message-Id: <20230425115049.870003-3-javier.carrasco@wolfvision.net> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230425115049.870003-1-javier.carrasco@wolfvision.net> References: <20230425115049.870003-1-javier.carrasco@wolfvision.net> X-ClientProxiedBy: VI1P194CA0055.EURP194.PROD.OUTLOOK.COM (2603:10a6:803:3c::44) To VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR08MB4974:EE_|DU2PR08MB10203:EE_ X-MS-Office365-Filtering-Correlation-Id: b8a5d37d-0025-4342-7666-08db4583645c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7cmJXDjtZ/iqwLif0C3wbf09d8API5cG9Xp/n3ZmbgQ++obALdkNT0rkC2GdYYpakz4nDbbpJ7DIoIvXJDjlV0fqaU3BmYgxQ9D6rTw48azjxNocR6JC4wtThpGEcWTkwC7NwIf31JHaHNANjImWl/Ay4TzSS6fJOg6rOgBjayXorvVEL0xCXBcb00zCHnDakS5o9AkhLOAwe1AKMXwX3axh+5suZ30Xu9B5i1pwQefNV52siD+LTKPFO2LS80hi+0+pm2fg5F+zbz92XNFq+lAF7zNi24G9mKBkEjcy1DMNFq88rgpNKf6Y7YHa6Qu0YYrRKvIDLX0gcpTAuP+w8DbSr5ogfXypr597X7Us5IKL6guDg2X8qtaLqJKh88LQEU3a7NyNfdnpkeRFRNBS9t30tmxmoLQmIAdYWDKWxhm4eKwmZ99v5vaVW6Jt6gv/comY9DL4B52f8lb6Agi3pl+5SxNvwqGW5GDq/99wFM8a27A2Gr9aLabxvKQCGtM3ToZyqRB1Yp6eO4OjS/RTOCB2H2p9cdzDDMDnwRiwWtacY4nwFbEjnLipuYFlF/rMUSi3R/pZf1f5+UdMVkkYjCPmmH8cjFDqak1+6TahO81OIZ6og6v+7tuglTu/NyWB 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:(13230028)(4636009)(376002)(39840400004)(366004)(346002)(396003)(136003)(451199021)(38350700002)(36756003)(8676002)(8936002)(54906003)(478600001)(66476007)(66556008)(66946007)(4326008)(7416002)(44832011)(316002)(41300700001)(2906002)(38100700002)(5660300002)(2616005)(86362001)(186003)(26005)(6506007)(6512007)(1076003)(107886003)(52116002)(6486002)(6666004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: eAJrVTIHNiL4dnb4q1aMMLvqMzv2C1KE/y3J0L/H3fzDrbwMUqXC2xUBlQJtA76vLmJ9hh5yGh209JZa6vPXNbrLb0q88uMNOcX21bh+vwfpf6bDofDPtTqbTUPTmwhCZm7lMj506ems6fgKdIVEI+ThxJ5jegLhgZttUMKl0nwH1a9QjcZ6URAe11d4PMsWCacySP7ZB/Q4XGWiFVNdOY6U9KlXXKC8qVtlZncUVgF4SCRPy9O6aanst7/yX6NY6ThR5233iMofLgr5t72aTImkB3mD8qn3mGz8SODDFVTcmTF+Cna864mPGIS16crWlt27akr1jquhG+Zg5c1zzwW9vd1aYnQoMrJGP7rCaB+I+Wu/PNCsEw4FnwofsFwlj1T61aeLMIF7E1zy4+Uay/D5i4o+P1mqtIoWc1s+3UZJ2aWCyanhMXq3FrbJqGq1eDXqZOP7qeD3bdkbeAyXBt17bXdECGM3zt/rENmZ5xbTKUClnmp3+i2ri+9boNzrcwy5RFAF55uEeRyPjp8Hf60zBamGDt9VZiqpMz2F8pm23VnGvQ2lKdhbhQ3BRsCgv79WmLss6VzTkDBbGNeVZprNyVSTEH/LqfL0dKhKp7Fewv4JoDkhuLpeNsFQvNgJhqMQeF8nHrXNY3F4KV6C585cmjzFTmm2H92bI+Bq9R6oPluWcLHSd+TshrVbCl5nLoTmrmpilIuchyhPJyH1IxCaRjSEVYWdjQ6+lVHO1lcnAvmneNgD7zIMDHwdeMfCR0Yx8yG2oOyCH8hO5aCY3oc/fry1uNu+WBsM/vwbrvWDERu8ev27Y5ZQPQYRFW1s0VgqoxRUY3C3+sr7kLUflaRxUeqsnsHCOU5aqFzfbhmjS3PZTezGYnfGERnumcYnEzwX51FMJKezvD3LGzYjgkdmIlj1iptoQyJLF6HgCXldr4piaI4h6LTRpidzzyi9fHvvFPstVQMY+y8WWK8mdnkq2XoC84AxnGkHJyJ4AtKGwNKBpyzQYv6wU7Z6bNf+pdtogY5H22Exh8BMfhlIloz294QWJ8V9IGFPklEGN5jJdQDY9n2CuUO44R7ePev43JX+nvPCwPAZAiY6cswzM5c3aX6uMkZ9WAe65XtvORdA6ZlURjlKWP6R5A4PWMqAI4700b3KbpassfrKpC8JPf8sG94Zb0QyYxb2e18N9td8yGO/tOfYoggV/S59hwPuyB4nprtWFgm4H6zI/FXP9/KqlsK20OuJAeH25j2EoL868LU45Iycj01MX6YF77G5z/BtOY6erZTwDFcSsRCpbIF9UifiMYxB5ugxfkf0D2KmlAyDjitJlbkic4EKU75mSAKRxLlxSyxQuHCzZ86a5AqI84daE8Sb1iAHYJUkTq7R0Ff9lzs25uo9f1XbFXaHWEGOTj2tCyyhoSG/57JRsZezIlEuTaYzSGJs/ReJEAShbqlf1YQ5IR+ovduH37l2jRDtBmdlIotlW8aTKjsit6dZzmxHZzMmBPUtzwGVph1cLwIwwmDuR40iUBUKI/jxPp3HDJNyt0ykMJr1YYxH2ClyAbzF5Y3Z9Op847PJfBbx33WI8ge6TiRFNkpK0wJHDp4fTr/NMMf0vuI149dJaA== X-OriginatorOrg: wolfvision.net X-MS-Exchange-CrossTenant-Network-Message-Id: b8a5d37d-0025-4342-7666-08db4583645c X-MS-Exchange-CrossTenant-AuthSource: VE1PR08MB4974.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Apr 2023 11:51:23.1316 (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: AObV77R7Ve/OcH4ofS0DvhIoIiI0bUAkC/B6HWI8B5ukuLour0QPS4wwju+OHrLkXocUE/ZJfbcwkInNyBYbrH4ObMU+/6sUoDOZuEokFx0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR08MB10203 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org The virtual-touchscreen object defines an area within the touchscreen where touch events are reported and their coordinates get converted to the virtual origin. This object avoids getting events from areas that are physically hidden by overlay frames. For touchscreens where overlay buttons on the touchscreen surface are provided, the virtual-buttons object contains a node for every button and the key event that should be reported when pressed. Signed-off-by: Javier Carrasco --- .../input/touchscreen/touchscreen.yaml | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/Documentation/devicetree/bindings/input/touchscreen/touchscreen.yaml b/Documentation/devicetree/bindings/input/touchscreen/touchscreen.yaml index 895592da9626..869be007eb6f 100644 --- a/Documentation/devicetree/bindings/input/touchscreen/touchscreen.yaml +++ b/Documentation/devicetree/bindings/input/touchscreen/touchscreen.yaml @@ -80,6 +80,60 @@ properties: touchscreen-y-plate-ohms: description: Resistance of the Y-plate in Ohms + virtual-touchscreen: + description: Clipped touchscreen area + type: object + + properties: + x-origin: + description: horizontal origin of the clipped area + $ref: /schemas/types.yaml#/definitions/uint32 + + y-origin: + description: vertical origin of the clipped area + $ref: /schemas/types.yaml#/definitions/uint32 + + x-size: + description: horizontal resolution of the clipped area + $ref: /schemas/types.yaml#/definitions/uint32 + + y-size: + description: vertical resolution of the clipped area + $ref: /schemas/types.yaml#/definitions/uint32 + + virtual-buttons: + description: list of nodes defining the buttons on the touchscreen + type: object + + patternProperties: + '^button-': + type: object + description: + Each button (key) is represented as a sub-node. + + properties: + label: + $ref: /schemas/types.yaml#/definitions/string + description: descriptive name of the button + + linux,code: true + + x-origin: + description: horizontal origin of the button area + $ref: /schemas/types.yaml#/definitions/uint32 + + y-origin: + description: vertical origin of the button area + $ref: /schemas/types.yaml#/definitions/uint32 + + x-size: + description: horizontal resolution of the button area + $ref: /schemas/types.yaml#/definitions/uint32 + + y-size: + description: vertical resolution of the button area + $ref: /schemas/types.yaml#/definitions/uint32 + dependencies: touchscreen-size-x: [ touchscreen-size-y ] touchscreen-size-y: [ touchscreen-size-x ] From patchwork Tue Apr 25 11:50:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 13223229 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2E98C77B61 for ; Tue, 25 Apr 2023 11:51:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233917AbjDYLvm (ORCPT ); Tue, 25 Apr 2023 07:51:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233908AbjDYLvc (ORCPT ); Tue, 25 Apr 2023 07:51:32 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2063.outbound.protection.outlook.com [40.107.21.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2050C49E2; Tue, 25 Apr 2023 04:51:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DNceXVz2md6PzR4n/FvtdjtxO/pudl6Cg2sF1ffctgbmVq8hmTuZ/K/c7RNcavh2gWIRtblonEZndIxlpPpRg+ZTje9kOmwYTnfK4axAmxgOqepzyjbn0aFJVOQvx80619+d69VgeXZmPvID8SI9mqdZipb4qc2/qNG2Vx55tLUcs+J1Cm9Xyy7qS2qd+jTXtS6w8P5bXLl7BX1Pqu8Fmsm/MkUIevOsBndaC8lfPRttEPdEHG5GWQ23f9ET9n46NKDCnQHtTABqPeAgs7jQzwUU8ufxFCVClBr249qjHF9MQCUsC84mlw9fmsavWg1q6KzFWf7WYAa/yS7zqNEsSg== 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=layYqmVSFnwi96LY/EP8SoHFfbmOgCZ7UZfSL1nTpUU=; b=KZpHozEMalUaB4aH0mm8VGtfWLuSH5i7knfxuMQfwkZ/M17WqbrWaekq6spkBN89pjOHRmFbZCJiS10zy1DX/FpoC7WNoILnfcoDBTi3BtAq2MH3oVBOTxTtYttEllOzaoQQgOMWNINewp9cLBGLLR+fCWtanP2cJO9tLu/xsgk80uvcRhEuna5Gkzvyg5a7hkbQvHleeoqjOLM+Wr+dwyTY9HoNZwUJiZegArRqmWDh5m5oXd5LpV63XdwQHH+jRE9MmSXfBzFcPuPcjPH8VtVk06bYZp+cF9DkbpzFowRIVgcGWmbil9wqaIytdmvX3Mm0tjr20CG5rfQxt0+Bkw== 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=layYqmVSFnwi96LY/EP8SoHFfbmOgCZ7UZfSL1nTpUU=; b=oGFyP3ouS/UVYP8fOujiIDRXtn8/g3FIJ+UditfU7pq4mjKet2aGSvGslKXL/6vfV3Qn6c+cylzpGUvP8TpZaxhxu2RPcrrUUzwVSB3hhJ82wwUBe3UZT9ZhNJeEepbi3TC8Bj6efmOQm/C4sIdTQZfIhJvZUdSAzuIiCtOI2n4= 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 DU2PR08MB10203.eurprd08.prod.outlook.com (2603:10a6:10:491::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.33; Tue, 25 Apr 2023 11:51:24 +0000 Received: from VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::6c5a:c28e:206:453]) by VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::6c5a:c28e:206:453%6]) with mapi id 15.20.6319.033; Tue, 25 Apr 2023 11:51:24 +0000 From: Javier Carrasco To: linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Henrik Rydberg , Javier Carrasco , Ulf Hansson , Hans Verkuil , Stephen Boyd , Sebastian Reichel , Linus Walleij , Jonathan Cameron , Uwe Kleine-g , Bastian Hecht , Michael Riesch Subject: [RFC v1 3/4] Input: st1232 - add virtual touchscreen and buttons handling Date: Tue, 25 Apr 2023 13:50:48 +0200 Message-Id: <20230425115049.870003-4-javier.carrasco@wolfvision.net> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230425115049.870003-1-javier.carrasco@wolfvision.net> References: <20230425115049.870003-1-javier.carrasco@wolfvision.net> X-ClientProxiedBy: VI1P194CA0055.EURP194.PROD.OUTLOOK.COM (2603:10a6:803:3c::44) To VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR08MB4974:EE_|DU2PR08MB10203:EE_ X-MS-Office365-Filtering-Correlation-Id: f22e31cf-818c-4348-fb95-08db458364a3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9odGcymKNUOaeaV8ZreQQScJt0Qfg76wjbeseEZmdtllcSmgxebjUnONQ7iawpwOCIKpAsmvcG2+VtijTQAZ7aQHiSdFhOUc9kULxOFJl8VwL7DuG0gNe6Q8MaqwEWCWE5+WxRKDhmd2k4pDCmMU0ydX2qiCgDxbvp+vq+ja5J8bAp+691ScIjehS1lCvUW3monpdTsNJSQRO4GAjaxDa0dQLn6hZs7P3DSuTeJOYHh44dGNsE/NGJbxCUh3Ny8SfL7t+MEit6+2VFw7JKlXVkSXfCAQ8EEXmU9zWjhm8iOpwVbD/Xca7jPKvvrvkkd1YbZSPAbUYFdVDeGU4h72aAhkxeniN5Q6U68KgGNmegQ7nLFNBaSnyD0Wi63lXM05Yh0RPj5d5iR+C4lsnMZjFiXZo2h1TTlY7VBmbjwbV+cM77pw3woLfhf7lWvR18xQ8zQ3q2l+aghsRmtNv+4sGNy1YyvuwFJjXN/aauCovJOLNS5hlEUvRZNxTgrv32IY8RWf2wFYkJkWqui1nmBWYnaR30/u378oLgPahaPLTH/IKGvA1HEcaCPhECA8a3ZLUWZnfGUL2I/VrnDa6Jtb+r0HIZBFWRU3WiomWqfMWDsigT/BdcqtkzAWR1upeLRX 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:(13230028)(4636009)(376002)(39840400004)(366004)(346002)(396003)(136003)(451199021)(38350700002)(36756003)(8676002)(8936002)(54906003)(478600001)(66476007)(66556008)(66946007)(4326008)(7416002)(44832011)(316002)(41300700001)(2906002)(38100700002)(5660300002)(2616005)(86362001)(186003)(26005)(6506007)(6512007)(1076003)(107886003)(52116002)(6486002)(6666004)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WONqWCT7x5/Aw3MVskBH26mEJ6QVH+6irYCBdxk9mAVKz/TkcKcgXTqEokJeNJERVCS2JqGTGQLksfxFvSgr+b9aq6Pv/fIGkNJJfs4nIpIw99KBeUQtyG9DLwXkdQDEnHtWt0hz9gMlUFrldhPLDtQMCceAhRuxxUP6I89QhewlekkH26DmzEe8qW8aRl1FmK9VnxkP0fDK1CprLhbY9GFFqqMbO32XjhvNROMCLEFyOYOGSRfoHTf0VbHoUjYctM52JOeDYqXdkI9NCo1ARIB17RvY0DWd212LH7b+7/3APwqFT6n3dxSE8VnHtAvq1DZK8L/Dxar4aYkvYB/V7hSueuuQ0XstVL2TwldlC/vJ8khGnMy5MtarSXKjYBquhUOpYvzONbQspUiF2DF3wh58lsPHZ7Xc3BQlmIBOHkyFkPXe4eBLuZqxpD/Xr8feG3qxbSO4CbwsK4eK/9pKL3fSRr//xxhjTqLzor6StdVxhoSHBbVbNrlSuk8OzF5CyL5MZ8g0H+bcGbxkpNgd7oGxI2Wbq350/2o6JjCT9nq1bKrIHe3ITmbFNlvG/PSjjYrktnTvmWKG2uTmQ0PbYB4iRHaUyBOx3cQ3BUC0Pb7JhqEPcUjW6fRlf4bUi/qpPt95VzOOamONvV5CkjnJmESzo9d3uKMFnaXGcrafyLtN2e9lkL3yh3OUhG1GQ9qaWuClB8W3QYIAhUW8Jn3BXGfh0DfG4m2Dd/BqZvGHFR2gWXzGBFT0M4nlWidYMLTNDk36tl3keGwgZAj/eVLX5A1cWFwV40Jcw+1pyNFejapPPHFz0wNX6NksyqT7wKtHWJCIebcI4K6QBgz8pkoZdbVDdOjqWILUBOz/aA+u+PHjA+48nSYMvIk0iKHL3LHSnLE/urvFuuxcUASQffk8FQ6tUlWNuiQ+u6j8zw6kelR0Ze/rSwu3LqW2LCGHJKOyPjmeQrgYfFh0UwL2/luMzgYhNnse+pWLX3YetAuTgXm52ZafJ8/FvgOOkbeIG/pyYYVGbEPAiKgouSnQV+iXakqP/rmZLT/wua+46snoJT8pL1ffYO8Sf33iTsW49ep/u0tX/MRreUoc/cPblutR3QoxfMZu1vsD8gVgs+2Z2bzR5VCMVz8KUTimHqhe5dHh3ebNwaQSEc7ialfoIHdv/4nyOlYROO0WNaaXJQYfuEypDGuQDfiTEqdsOJNzd+k6WblVb0vFvWIIUdBK5kRWhcDuVkOmJDa/qBoNP/+m5hY4O9LSNwbXDPzmUxzF5U3jyUVGWfcE/yhvI1PEo1Repjqh98TwkVExCoohkiAj+PtogVa/IZrzMN8zOwgch6UXDPUOiSgizHYdrWQlKWCChKletaIvuBQtZT1pt4Xql7AA/c9yJBvKe+AZz0SKGm3CqdcSqB+ssRE3m34/XyL4Tg93/3S0jKeGf182WfbfolhK7K/t+brGOC5kZZwlpZyy/0qglg17jOHxiSJnu+VsMItrlSzQ3xyJzaPM6CgEsXCMcKYVCquq5rqVCjNe1JKfsSjBVV7UqSd8XGqwPYidI7iEqZHQUktgY4wcvB9o3rWZ2M/2p6NAohfz5wU6dYqOEyfsFl8sT+0xUSuUWNyTle7WE6FGtcn1ZttSi+oZQEM= X-OriginatorOrg: wolfvision.net X-MS-Exchange-CrossTenant-Network-Message-Id: f22e31cf-818c-4348-fb95-08db458364a3 X-MS-Exchange-CrossTenant-AuthSource: VE1PR08MB4974.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Apr 2023 11:51:23.6379 (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: /dTTTY1WKRDG9nCD9S7+VpPmJyGoAr+b6p0Yk7dSkK3vgyVmSrKCxmxVxFcnF8Dm/POb/orhAGIYWI1X96EpsrsgDqJFb9K/Dg5EI8bVmTU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR08MB10203 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Use ts-virtobj to support overlay objects such as buttons and resized frames defined in the device tree. Signed-off-by: Javier Carrasco --- drivers/input/touchscreen/st1232.c | 41 ++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/drivers/input/touchscreen/st1232.c b/drivers/input/touchscreen/st1232.c index f49566dc96f8..025f43c532d8 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" @@ -56,6 +57,7 @@ struct st1232_ts_data { struct touchscreen_properties prop; struct dev_pm_qos_request low_latency_req; struct gpio_desc *reset_gpio; + struct ts_virtobj_map *map; const struct st_chip_info *chip_info; int read_buf_len; u8 *read_buf; @@ -133,6 +135,7 @@ static int st1232_ts_parse_and_report(struct st1232_ts_data *ts) struct input_mt_pos pos[ST_TS_MAX_FINGERS]; u8 z[ST_TS_MAX_FINGERS]; int slots[ST_TS_MAX_FINGERS]; + bool button_slot[ST_TS_MAX_FINGERS] = {false}; int n_contacts = 0; int i; @@ -143,6 +146,11 @@ static int st1232_ts_parse_and_report(struct st1232_ts_data *ts) unsigned int x = ((buf[0] & 0x70) << 4) | buf[1]; unsigned int y = ((buf[0] & 0x07) << 8) | buf[2]; + if (ts_virtobj_button_event(ts->map, ts->input_dev, x, y)) + button_slot[n_contacts] = true; + else if (!ts_virtobj_mt_on_touchscreen(ts->map, &x, &y)) + continue; + touchscreen_set_mt_pos(&pos[n_contacts], &ts->prop, x, y); @@ -158,12 +166,16 @@ static int st1232_ts_parse_and_report(struct st1232_ts_data *ts) for (i = 0; i < n_contacts; i++) { input_mt_slot(input, slots[i]); input_mt_report_slot_state(input, MT_TOOL_FINGER, true); - input_report_abs(input, ABS_MT_POSITION_X, pos[i].x); - input_report_abs(input, ABS_MT_POSITION_Y, pos[i].y); + if (!button_slot[i]) { + input_report_abs(input, ABS_MT_POSITION_X, pos[i].x); + input_report_abs(input, ABS_MT_POSITION_Y, pos[i].y); + } if (ts->chip_info->have_z) input_report_abs(input, ABS_MT_TOUCH_MAJOR, z[i]); } + if (!n_contacts) + ts_virtobj_button_release_pressed(ts->map, ts->input_dev); input_mt_sync_frame(input); input_sync(input); @@ -266,6 +278,11 @@ static int st1232_ts_probe(struct i2c_client *client) ts->client = client; ts->input_dev = input_dev; + /* map virtual objects if defined in the device tree */ + ts->map = ts_virtobj_map_objects(&ts->client->dev, ts->input_dev); + if (IS_ERR(ts->map)) + return PTR_ERR(ts->map); + ts->reset_gpio = devm_gpiod_get_optional(&client->dev, NULL, GPIOD_OUT_HIGH); if (IS_ERR(ts->reset_gpio)) { @@ -292,18 +309,22 @@ 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); + if (ts_virtobj_mapped_touchscreen(ts->map)) { + ts_virtobj_retrieve_abs(ts->map, &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, From patchwork Tue Apr 25 11:50:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 13223230 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C942DC77B61 for ; Tue, 25 Apr 2023 11:51:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233978AbjDYLvo (ORCPT ); Tue, 25 Apr 2023 07:51:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233857AbjDYLvl (ORCPT ); Tue, 25 Apr 2023 07:51:41 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2063.outbound.protection.outlook.com [40.107.21.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4B40E67; Tue, 25 Apr 2023 04:51:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=G81srAa9KI0bfpApv2KdZdp/ywnf0gSoUsLNrm28YFYNVQgeNI48EsSVxsXB31v3XEGmipEwUZpSI3I0pVcX/uT6GRwJkJ6MZd+gUB59+1g3a34WBpsR6pFg782JSKKOK25azrbli0JgNTCtxRbVbz6filzjVuoCYPxLnSGzRrSodJxbsi6fP0Qhs/fV4ZKkCTTGG4kJBXVWfJJUwy4a84Lb0ae0ohm1vtwHApWrzEq/1u6syS/7QUZHkoOQPOaeWZB9IBnKdSEfCNkPmcz+MgxcFnD/+yj7YI88aaEB8dKM9EdQbeIw7eKn+36ZOpLGxWEWqnJ0T8F8Yk6B5CVNoA== 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=yFz/XN8Qi26KZcj4vHc+cQu0T0vJtwQjxfKmff/izPI=; b=TRkr6Si4L6vN7UFyE52t8YEOjHm+y3GGre0bcBcc5O6pTvlWRfjjjM7oLZg3wWdb1JNQw1aTxCHNQEM89xF6jFGngad7IvrxLTuLvimmxrdQX17PgXvVgaoTlOm4El/Bvt8WUUGS6IJaMRu6EUOb5iB+ouKVX1YCn/uI32LUGCPx+yZa01WcfP2MjexN055BCBQYO7IPFJ/qEfss87tYZlciQhpuqc1ovmGkt2V2USkwBqERpQyogFba/gK8ECRa9jlwy2dvZT0XUeYfuh+o5YaWnLGOwrJFN/Z7By5Ro/1MROQTEc+4Ucx0StBOL+q3j7aQBsg9UBNPd6XHOGQBPw== 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=yFz/XN8Qi26KZcj4vHc+cQu0T0vJtwQjxfKmff/izPI=; b=vn2AhAGlEEKulWAbf/6BW8hyOf7qM3jPguuupnfS3zgrfYd2A9Wyk7KiKmkEoFVXrRAD8I6Y4fKYc9hfTyiYF4y7EibOYkk5X0ZfzcBoNBNM7LuShx9GwiFnylv7SA1zNflXowo/QzMi+4QhV4MkX9JFSjmwFyB6kv3FfDKdYos= 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 DU2PR08MB10203.eurprd08.prod.outlook.com (2603:10a6:10:491::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.33; Tue, 25 Apr 2023 11:51:24 +0000 Received: from VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::6c5a:c28e:206:453]) by VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::6c5a:c28e:206:453%6]) with mapi id 15.20.6319.033; Tue, 25 Apr 2023 11:51:24 +0000 From: Javier Carrasco To: linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Henrik Rydberg , Javier Carrasco , Ulf Hansson , Hans Verkuil , Stephen Boyd , Sebastian Reichel , Linus Walleij , Jonathan Cameron , Uwe Kleine-g , Bastian Hecht , Michael Riesch Subject: [RFC v1 4/4] dt-bindings: input: touchscreen: st1232: add virtual objects to the example Date: Tue, 25 Apr 2023 13:50:49 +0200 Message-Id: <20230425115049.870003-5-javier.carrasco@wolfvision.net> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230425115049.870003-1-javier.carrasco@wolfvision.net> References: <20230425115049.870003-1-javier.carrasco@wolfvision.net> X-ClientProxiedBy: VI1P194CA0055.EURP194.PROD.OUTLOOK.COM (2603:10a6:803:3c::44) To VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR08MB4974:EE_|DU2PR08MB10203:EE_ X-MS-Office365-Filtering-Correlation-Id: 32316544-6eb4-415d-6c3c-08db458364f7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4VyIEhjdcgMgX6qI32YYZ4AOxi/bTT6f3l12JKHNZasrjSxSVIeOwAFBm6EcvI9zPmZGjS6VzCra4pcm6NQPrt9OlJwpQSHGFAm3zPG4/1y3lcelX1IsKFwjDSyN6VE/apM0uEjmUX0IB47cJ2U6N+kYcUWSP0xgvJ0cSwYBvykFr0z3uAIhrjxrnKac0pIpV/b3U2eEzauJU06nAaaFlYP+LyPeDv+T9+EOI7kG58u3PaVlY7g0E3hQuHFLqoKAdoLBMzeb8uc5kY7pD74YZ/Gk7IoYKweoZzfwGqtanpjNBNuLvDLYn0Mqwy2YbA6zpDsNur6L+WttdHOZpYaO/GaOvQUbfZ/SOInJHrxhvlSSNDlBVT7LgUaU5SVLyt4QtIT4824FvReQohuqJt84M1HMYNMBSS6X5aA01p7ftnaVwdJ5oRxqEJwGmTqL0im6Zo28zgxSo8bvuJQ61Wv620hd09BFi96wudWSqlN7DEhNeBUw/EHZ68BJ/YwClH40SWBngAhlk2ew6uspEanR0MmHFjZGtVj6CWP508PePmOzS3tstMibkhoEG79ocVqQDVFy3BYMk/zz8uwf3D064jAo0inJJ8dsjJsMOAscin9yPpIDcPkvGDO6BNY7Ees9 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:(13230028)(4636009)(376002)(39840400004)(366004)(346002)(396003)(136003)(451199021)(38350700002)(36756003)(8676002)(8936002)(54906003)(478600001)(66476007)(66556008)(66946007)(4326008)(7416002)(44832011)(316002)(41300700001)(2906002)(38100700002)(5660300002)(2616005)(86362001)(186003)(26005)(6506007)(6512007)(1076003)(107886003)(52116002)(6486002)(6666004)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WG6dJEfoKblQDRKX507UYH/hwzaSDnDSf84/Wyn6+haoTsjA9uxmiRPlzl4RjsCSu1Gm52MkciJTIMyeUhMP0HvnfaG8IIez4SeKOliXyGexPk6m2EE810jhLrsNGVhwejJtvSWvehA7JVhpHoIij1hf6/I+BkHBP5YW9WtnxuCPMEexyjWxCZ/YsD6VjCYMygR00GqnIja018WhhBLMRC5rLLo1vHXoF9k/ynzl5suDiiIkCvrst/N6nDvKz/9SF4Kw7JJPA9itGqh7xMHAvQmj4k8RRfbc0ibFspgNCqXxNqlBV/YTjW3WEmO6nFm1GyQ8Vc/T2k7/j3bHoyAvSxfXDRLTo6hj5Sdik18aiVlZrHef0LlRm+fCft+a/qbUZZQZsrF04Khv4qihmxoWXNM5gaugi7EVmEkAF+dazNyX1vRndPjR+Tvyyonz+C7hOyryHF+k+kSaCts6T+t1hi73w3Wh1lE9dWBkMa21fXCz00Oi54PKHtiNkBOflK5RH1IzgssCPnC/VdpZ/Ftr+plLmzpfPQeU1StihWj3Wt3rOiHW1q46n+9J/PArfyp/FdlmcQvl44qF3JArJDaag+lcswNiwAgUG/eVrCGpYbDOBv5h/uuu1UC2jXTL6hbJEH9Yl4hg/aBtHEZYKx7y3GXkuOJed7FaEqWkjVCMBXvm3cwRXTLgMc86G3bwzuLOjmok/0UIXflzofm9SHN2V6yuvz6WaU9hzUi9RIOP/ekOwRQzTbV/jJ1psIzgQ/0rkuyFDsd9u/khtHJuRCH6klDOt31aLkpqnTmuNVlGfPK3EGZPDzymcDJKD3T9m4M+CYxEXb9nWmJUVP3IMjxwlG2yqnGWZvEOq4tzGw495m9nd6KS1MR8FjsETmAS+l/gYxvEIoMeun/67O8h1DMnqLW6hMW2B1EWW9laVu9/EO9kwnR4eLwlmiPknUt9lKT9cXR1SeG5wjXzCNHvhM1NNJbAGOM5u2J+bjDDJMKq9tGHNVXyaCthd2bmvvsTWabQu+h9NCRaccyHu8jq40NmDDz3+wfMA9hkF/2Ld9fpA62bqctIRPBLG4nnnBuOPHhO0Ir1qPFt1ZtlbeYeq/FUpV0D77sO5pKebMScZuC+imc1qg0V9Uz1wUWB5CqxMBN58FRErB176th6ODNWiSVIRelflidJVThpRQz1l5KbvnotfUju/m/Nv4ezLpl7ApAE2kvdJI6snrNs4IFBAZxuNlSkFf9QbPXfmHTI4DoWWaPjg8BKbyUxGL0Q31lZN+o6YZXKtPhg3QG6ECfDeILdl16JzjFCU+WF/tQzHyiN1V8sd7hwLjZEcvQg2PcGW3uozsafTPI6BEa77f+LamGloMOkRZL9jQbQi+/U79OmaP+vAo9XusXCsGlKGc75Cf69c9CacLKGNBJWC8KEziFqBwSjbRuSAtkNSJdo+VC9bLe5DGROMJUUU0N4QCp/OOwLE/uXXIKcwnxBTQXTdayMjoDdnFwVu3kHIVA7jdb2y9VjP0q0JYuPf/OXQHZg2sdZ35HV5jZCt3KjLbXlGgmJ72W+YBAj1MLsuJarN5Hs86lG5UZj66l7iZ/BK67819qD/tovgg4c+w6N9dIZUUFGkg== X-OriginatorOrg: wolfvision.net X-MS-Exchange-CrossTenant-Network-Message-Id: 32316544-6eb4-415d-6c3c-08db458364f7 X-MS-Exchange-CrossTenant-AuthSource: VE1PR08MB4974.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Apr 2023 11:51:24.2061 (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: UPgeIE4VkuuLRa80rIhZpxXn8vqlvb0QmwhlIwoM43ZulIl5xbaQFnNierQru2it8bL3JXwmRC39NMDl/RGe/gcI8hEsY2A11cWJJnUP4nI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR08MB10203 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org The st1232 driver supports the virtual-touchscreen and virtual-buttons objects defined in the generic touchscreen bindings. In order to support the key codes properties within the virtual buttons, add the required linux-event-codes include as well. Signed-off-by: Javier Carrasco --- .../input/touchscreen/sitronix,st1232.yaml | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Documentation/devicetree/bindings/input/touchscreen/sitronix,st1232.yaml b/Documentation/devicetree/bindings/input/touchscreen/sitronix,st1232.yaml index 1d8ca19fd37a..66b8c85135b1 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,32 @@ examples: reg = <0x55>; interrupts = <2 0>; gpios = <&gpio1 166 0>; + + virtual-touchscreen { + x-origin = <0>; + x-size = <240>; + y-origin = <40>; + y-size = <280>; + }; + + virtual-buttons { + button-light { + label = "Camera light"; + linux,code = ; + x-origin = <40>; + x-size = <40>; + y-origin = <0>; + y-size = <40>; + }; + + button-suspend { + label = "Suspend"; + linux,code = ; + x-origin = <160>; + x-size = <40>; + y-origin = <0>; + y-size = <40>; + }; + }; }; };