Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp24184767rwd; Sat, 1 Jul 2023 14:29:30 -0700 (PDT) X-Google-Smtp-Source: APBJJlFWLihLi9ImLnjwpBfS/WjWp+yOwkXqfgQIssKK6tuZ9KyKSFnxAJeZ322N4Z/H0FAC27iX X-Received: by 2002:a17:90a:1954:b0:262:e3aa:fd73 with SMTP id 20-20020a17090a195400b00262e3aafd73mr6891830pjh.17.1688246970681; Sat, 01 Jul 2023 14:29:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1688246970; cv=pass; d=google.com; s=arc-20160816; b=Az0fLcrvAUDUilaX3Z9EEXo5yYu/y7S3XJ3V01dms3cpzWrqWl8CMuSX60AHWrYNpa uyBKNW7b0Apc0zbmZdR9dFWQWiaAFHZ9k8BCkOe76saA788pMBSCOTCBPZId6iv18cLi GVelUISAPZCAe5PpalOcc7E6FxnhA3dqcVOhSo1/fy5PH09Q5q1yRGCP42g/sOEX4leb lXKsHazBzpyaBLk2crU0LUaj4OJAFmhFczGLnLY/Yq0t0swQRRt3vb0oaPIEAN8r9aNt O1rK/hGrlGRDrIRWXfBplbhYzKBtVLQeTRRrHZ+6Wd0RpCYbyTxW5WKf296bZlZ46DHu 9bCw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=donxME4aqb8ZHi702vqxBDf2C9ma9eoxLdKciKtoKMc=; fh=C1KklLkocLL/qILosLMRMHyklCy1j64p2iGkQY3O8e8=; b=iMI9hoQylg5bItTgZB+CiO0yshhsIhBZUiZg6iVXecA+z5FELbZM4QCGwfKZYeuMjh qfysdY3UkZOiJmZF9NkqHXT92nrbNzPWSW77QxStp4LiXg/i8uii3T9XqcE+l1IOETJb wAmQDmKzI8g3zD+543SFZi4zrvi22wW85uJvfmyYkK6YatYs1ULAh93zZBSpqTh9Ntpo OjaOaO03+izdPxLuLweuR67NsQ3On93Y1Mm9fyR528KcNrmKswqlAL7Z/xEtx8GYRPdG UBA9N1oD/lifhPlL5zysnsC0OaibOoqUnl9zZuigtlzqdSGZc8FiR3naXxGd/SkZyqaL Aw8A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@wolfvision.net header.s=selector2 header.b=BRojP72U; arc=pass (i=1 spf=pass spfdomain=wolfvision.net dkim=pass dkdomain=wolfvision.net dmarc=pass fromdomain=wolfvision.net); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wolfvision.net Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x11-20020a17090a9dcb00b00262ca6c0ad7si14955021pjv.116.2023.07.01.14.29.09; Sat, 01 Jul 2023 14:29:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@wolfvision.net header.s=selector2 header.b=BRojP72U; arc=pass (i=1 spf=pass spfdomain=wolfvision.net dkim=pass dkdomain=wolfvision.net dmarc=pass fromdomain=wolfvision.net); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wolfvision.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229646AbjGAU7G (ORCPT + 99 others); Sat, 1 Jul 2023 16:59:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229535AbjGAU7F (ORCPT ); Sat, 1 Jul 2023 16:59:05 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2068.outbound.protection.outlook.com [40.107.21.68]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE78D127; Sat, 1 Jul 2023 13:59:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TKPUqv5T2VMwO6sIBRBV4opZ8jN70vSPktkya4+IiAxJgpxCwADthjwFoMoYEkj5GtPcbnknJ4PINsZgzkR3FMGstV6NGOsBDnUZ/WYRmbqjvLOjvmGDy3cCmD3iQz16RYGdX/RMIgggJaCZgjesvlyfpCRXalf4qKyGd6Ymeh6kEaY6OWHoV9PZQF1yY8qznPvlfcw3vg+oUUEp/VlQxTowF0WBgDKSZsLpxQP3rB9PtA5i5gUfhJGNIVVTC4QvpWHizTn9LIElnnxtQRvb+u3oah9CtfPr5N82wmdt5CH2or6ZO5OLDHB8ZZttwti8KQhSwrVaeBpxMZ2g++tGVA== 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=donxME4aqb8ZHi702vqxBDf2C9ma9eoxLdKciKtoKMc=; b=jkxW0N5jZ1paSRGKzaLOkE9Dk1IBUHp0C76ka+F6gXVvHvhkkGlFpqC38pEYnJPgAWQvcZJPjk8E3u55r7NClmZvJZPNsB8wbK/W4OybUf4ymac8c/TYc3YjytuUJ1hebHlTwKmCgDpeS1N+zgaIy8zCFRTycF/NtTDttTqqNVUmjQnqQx1CdGlun8AmRre4Rz4tgtZmlvsSDBjZpqx7qJyh+ky+zGc1oMEFKI0v37o6TofI4/rBcjbzGYq7Jpt8bX9psaS0/Xoe0HQvtttkaXjElFEK8a2drtLAhGdRmrWBqOW7rq7cK02wGQAWXLvjf/XxTjEToTQQ9UApdr0dJw== 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=donxME4aqb8ZHi702vqxBDf2C9ma9eoxLdKciKtoKMc=; b=BRojP72U1lMoOuF5f8wG1yKsJPvirs2iiZ2f3pfGI4Zx2zVA0d5likbnPl40Z7js8/Tq/7kZbvQnRSedKA1KALZDUAOmwSI/fVv5uQZKLoBu5NS4ePQhL5Mf1aUYK5ytZ1XfsWO3w4iiTdN6gni++aqbGwp/KooGRXxYdQlfbC4= 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 GV2PR08MB8026.eurprd08.prod.outlook.com (2603:10a6:150:ae::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.24; Sat, 1 Jul 2023 20:58:58 +0000 Received: from VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::bd0e:a139:9e67:b86d]) by VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::bd0e:a139:9e67:b86d%4]) with mapi id 15.20.6544.024; Sat, 1 Jul 2023 20:58:58 +0000 Message-ID: Date: Sat, 1 Jul 2023 22:58:54 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH v3 1/4] Input: ts-overlay - Add touchscreen overlay object handling Content-Language: en-US To: Jeff LaBundy Cc: Dmitry Torokhov , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Henrik Rydberg , Bastian Hecht , Michael Riesch , linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, devicetree@vger.kernel.org References: <20230510-feature-ts_virtobj_patch-v3-0-b4fb7fc4bab7@wolfvision.net> <20230510-feature-ts_virtobj_patch-v3-1-b4fb7fc4bab7@wolfvision.net> From: Javier Carrasco In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: VI1PR0902CA0026.eurprd09.prod.outlook.com (2603:10a6:802:1::15) To VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR08MB4974:EE_|GV2PR08MB8026:EE_ X-MS-Office365-Filtering-Correlation-Id: 473dc346-2817-407d-96a4-08db7a75fd17 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SecWXpWtYvUk76eeS607mc/h66VRzIXvNTJx5DeVOH9VocL5WR/qyQhiWhZc6KEowXife68axinEJ1Bc1Vw35aXePuvQLh65itQMuyrpLOKoWytNt5rHIIfYavo2dgGNkXMak/WrRgbVxaRCDh8VJAwR9baLEJOYxJayYJZdWK9UVkisMuY1xLOKo4kib6eU7J1a67kl9kJkGOOzj7RdJ+x2wNmBMyKjx2OwE9acnNLzRXShGz52bjG5DPVX7SJ8nO7bN8eiaGfUdXIpE85+Ck8APVmRYr6jc5cU/HDqVP/X/AjnVmO5XUv/NPxyPUV9AJrdw3bBGIe305QYrgPqhg2M6cMRuyAU+2z1/CEOba3VSYzUMI/AxrdnVCzkZIP4djtuyBaD5NghJUJzUkGI4M0kat1JJh8mpTGKHEoiq2+kOEag5e2rtmLMpsbKbezV4JJAcQ8lKJk7cF5+vazbozstEjzUhEu90VzVGOuC8WpreG7izZPeYN5VaNRw8ufhKzSGOVEUFsZFQAsOKRPclg9qTw0dbl1Ph/Xu5TV2YRCL8XMS6iXuyXBoCCe7GHOHALKONF+frifdaDUughgW860xWZvk3cG2FW1iRnU6f3uYpcF+GzGVvUM6VuO0Ayg15hmbaR1sI1wqG3JjtRYBKQ== 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)(366004)(396003)(39830400003)(376002)(346002)(136003)(451199021)(2906002)(41300700001)(5660300002)(8676002)(8936002)(44832011)(7416002)(36756003)(86362001)(31696002)(186003)(2616005)(31686004)(478600001)(6506007)(6512007)(6666004)(53546011)(6486002)(316002)(4326008)(66476007)(66946007)(66556008)(6916009)(38100700002)(54906003)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?K3QxU3FLN3I3SUhqYlhOWWtpbWNSNWN6K1BNOUNTUGdObTNRODBsK3cza2hl?= =?utf-8?B?S3hyT1N3L2V6cG5MYWZCNHNRVjQvS0VDemxRcC9EeWZ2VUZ6d1dZdkFBa082?= =?utf-8?B?ZzlDNHYrOS9NWU1NUU9oZGYwcDdzdkxLZ2xrRUZna3BZUTNxdVdwcGhuVUcv?= =?utf-8?B?YVlITEJKRS9ieVlET1BTTHBBOWRIbDZlVkNCaUY0bC9Kb21yU0VSdmdKR1Mr?= =?utf-8?B?czVuSDM5ZkVialBjV2NoOXhIR0lwbE1pVC9TRTI0VUE2N1hCeHoxb2NaVm1k?= =?utf-8?B?T3BZSDVuaWhuK0x1YW5zK0RqMDFhM0UwUHFLaFpMaU5PSmVkanBUOFBUSk5i?= =?utf-8?B?dGN0cURyUG1XSUVBMnFEOU91VkNzWnd2S1NBdjlxQnlvOU5oUmk0bGJxSFVE?= =?utf-8?B?YkVqdlVZNlpzVExOQ3dXendvaVBleFhWbmt4QTV0T3ZkYUlzRVlZd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RDnOuV6OHufaVJG15TqkQMLlQtnOdVX4dXk8b594=3D?= X-OriginatorOrg: wolfvision.net X-MS-Exchange-CrossTenant-Network-Message-Id: 473dc346-2817-407d-96a4-08db7a75fd17 X-MS-Exchange-CrossTenant-AuthSource: VE1PR08MB4974.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jul 2023 20:58:58.0754 (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: nQbOPn72E+NRp4SIqwGJeHA+gsvX77HYE+PrwEHCTgDO5N6ks/Upv4pGuHQ0MqcqkDmKewNCVRaAm4EkEuQ6ybwv6pLsDoqQS3GpIP32KnU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV2PR08MB8026 X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jeff, On 26.06.23 04:35, Jeff LaBundy wrote: >> + >> + 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); > > This seems like a dev_dbg() to me. > >> + j++; >> + } >> + >> + return 0; >> + >> +button_prop_cleanup: >> + fwnode_handle_put(child_btn); >> + return rc; >> +} >> + >> +void ts_overlay_set_button_caps(struct ts_overlay_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); >> +} >> +EXPORT_SYMBOL(ts_overlay_set_button_caps); > > I don't see a need to expose this function and require participating drivers > to call it; we should just have one over-arching function for processing the > overlay(s), akin to touchscreen_parse_properties but for the button input > device in case the driver separates the button and touchscreen input devices. > > That one function would then be responsible for parsing the overlay(s) and > calling input_set_capability() on each button. > I just realized that I did not reply anything about this, even though there is a reason why I exposed this function and now that I am working on the v4, some clarification might be required. After it was decided that this feature should work with two different devices (a touchscreen and a keypad), I registered a keypad in the st1232.c probe function if overlay buttons were defined. I did not register the device inside the new functions because I thought that I would be hiding too much magic from the driver. Instead I provided a function to check if a keypad was defined and another one to set the capabilities (the one we are discussing). The driver could just set any parameters it wants before registering the device and use this function within that process. The parsing is not missing, it is carried out before and the programmer does not need to know the key capabilities to call this function. So the process is as follows: 1.- Map overlay objects if they are defined. 2.- If there is a keypad, set the device properties you want it to have (name, etc). The event keys were already parsed and can be set with touch_overlay_set_button_caps() 3.- Register the device whenever and under the circumstances you like. That is the current implementation, not necessarily the best one or the one the community would prefer. If that is preferred, the mapping function could for example register the keypad and return a pointer to the keyboard, inferring the device properties from the "main" device that will be registered anyways (e.g. using its name + "-keypad") or passing them as parameters, which might look a bit artificial. In that case the key capabilities would be automatically set and this function would not be exposed any more. The question is if we would be missing flexibility when setting the device properties prior its registration and if the participating drivers want this to be done under the hood. My solution is the one I found less intrusive for the driver (at the cost of doing the registration itself), but if there are good reasons for a different implementation, I will be alright with it. If not, the driver will control the keypad registration and will use this function to set the key caps. Sorry for the late reply to this particular point and especially for the long text. But a clarification here might save us from another discussion later on :) Best regards, Javier Carrasco