From patchwork Fri Dec 2 22:33:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maximilian Luz X-Patchwork-Id: 29128 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1102131wrr; Fri, 2 Dec 2022 14:35:11 -0800 (PST) X-Google-Smtp-Source: AA0mqf7gLMsq1KfX1sFRZPRTtlj6bzvY41OBA5YMvaacJooL26f11l/PRjVelVUS62mfb0Cynzn4 X-Received: by 2002:a17:906:488a:b0:7c0:ab1e:e30b with SMTP id v10-20020a170906488a00b007c0ab1ee30bmr9440132ejq.632.1670020511411; Fri, 02 Dec 2022 14:35:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670020511; cv=none; d=google.com; s=arc-20160816; b=mQgKS6FV4tD23Uqo+lu37pfzAxeg4C86g1WITkEeMtwhTjRHPfQegmkYRHsmJgzjDc /OrmcOX2ZB9ghDkQYvZzPuPJGtSAh+bOhKkDslHJuY2MJ1sn1DiWZ0WxBFc9uSGeJQd9 5qGOgibUbY4VIpKC6WgegtT1T/g8KR7nFeyTmOxsA/MSr9QJq8LeIZE+HzDFjW1i8H9L LqEpOgiC4tht2W//wQnGqrHp9+4GRW7tgGbqiSAyXnZDAiYrkeNdBf4wAkHR5Ta9Ygw/ /Q9ceutbqZuqw0/NfNYvbLyEBrgWwChpmdvb1utgtiug9uPKTkmWGG3NUZG0ZBnJimjq TALQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=AbJ18LAT9an/pDAz9Nw5nBcBjSUSHEByKAYbNNUtlYA=; b=Qb+UdLgzebNCUsATJ1PEZNoeSc0zHGpDk7ZTClmrSRqoZREritwvfnjWOqYefZFXqz VJvBhMEtBXhvMWdyo5vOcAqJGvFFow+Wm3a3tFh8yID3JL8z7EJnCVHQELf952Mh2b9f h+X4DGP7wKWqrbPDGBk8nDX4fQhRsNSeQPS9s7GhQ+V5yOtrok2E7CsWS6DasagLedcI WrL3tJdZvDnlQLyRnktcHXy4sOAvpgMTcTFLaHKHnaMdu7Jaq/jLRVtETFIsincQAgCN Ri6eH0uBpvTvtz6fSQ6+vB94wAlBpV35UD9cXr99A8+ml2BerQzLEhUhXYgIkV11O4Ic fNHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=VLCLkNLe; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fq32-20020a1709069da000b0078e11e9286csi1324382ejc.195.2022.12.02.14.34.48; Fri, 02 Dec 2022 14:35:11 -0800 (PST) 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=@gmail.com header.s=20210112 header.b=VLCLkNLe; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234490AbiLBWdo (ORCPT + 99 others); Fri, 2 Dec 2022 17:33:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234609AbiLBWdl (ORCPT ); Fri, 2 Dec 2022 17:33:41 -0500 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAC43FD07; Fri, 2 Dec 2022 14:33:39 -0800 (PST) Received: by mail-ed1-x529.google.com with SMTP id r26so8206440edc.10; Fri, 02 Dec 2022 14:33:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=AbJ18LAT9an/pDAz9Nw5nBcBjSUSHEByKAYbNNUtlYA=; b=VLCLkNLeQVtnJpjeks0ZFTraYAYw730AEzkkSm91i0rWDWMwJOJAwoaQ7nzKOfRGZz lVLPW1WwC7IAwSNB/kYEYnni0y+lL5m6ytRh0MDLmZUC9EuYzh9KGgbU0jeYiC7gwxrk AgXs5PofaG1Vn1TTTkuTBuWt3PTf+k9GY6XDztvr6Y7nczdczxs4qX8v8Vu3HargJM3y BeukPcXYVLmf2OQTmzWiE03F42PkFwsPaKhA7B9w6lyE5ojTRZ6MYt7FmjWLnth3tAec 4g4HusyWoPjA7JgB/DI7H6uLX9ONlzjXEgZi+6stQgQxNrA41R/c2JkVz+eZWN7FbUpr 3F+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AbJ18LAT9an/pDAz9Nw5nBcBjSUSHEByKAYbNNUtlYA=; b=dMj2oOFhLd4g9/vEBMOOZLRFlXNs8ogPcYLR/Gg/OpII8KzrNjpmg6wneWisInz1MU rQh8ZGFOjsPokWJtwpfR7Ov8/pOIzo9k8nYTNqhiujsSsxlQoe84yq22GtvHWlDMP5K4 yuiPnuLbWxyHR0SQJSU3LiyVC0Qs+Kp715yaPJKY3QuYqLepoIn6hhZVmYdnVxnYDRu0 dKETJGZQi7/xE+8Lh0aeRniBsJQkRoUyNT4bTJbzaO7YGLX1lBuBA8HZHN6Kjnk/ucsY nqtQ8+OCk/aaB3OlVkz3xvrp3x41KfEUGGrVhNcY7BtFz6H5eoooB31BMi7fX4VDIYJL jc+A== X-Gm-Message-State: ANoB5pmxqu8W8W7Zy5ojyKtxb8vNz7ACGgPt1tmnyHI/AD8nG8hGpDmZ HxImBnMR2N9t+52A5UQAu+A= X-Received: by 2002:aa7:cf82:0:b0:46b:34b:5804 with SMTP id z2-20020aa7cf82000000b0046b034b5804mr25495060edx.240.1670020418316; Fri, 02 Dec 2022 14:33:38 -0800 (PST) Received: from xws.localdomain ([37.120.217.162]) by smtp.gmail.com with ESMTPSA id j17-20020a17090623f100b007c0d0dad9c6sm575340ejg.108.2022.12.02.14.33.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 14:33:37 -0800 (PST) From: Maximilian Luz To: Hans de Goede Cc: Maximilian Luz , Mark Gross , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/9] platform/surface: aggregator: Ignore command messages not intended for us Date: Fri, 2 Dec 2022 23:33:19 +0100 Message-Id: <20221202223327.690880-2-luzmaximilian@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221202223327.690880-1-luzmaximilian@gmail.com> References: <20221202223327.690880-1-luzmaximilian@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751143427960570157?= X-GMAIL-MSGID: =?utf-8?q?1751143427960570157?= It is possible that we (the host/kernel driver) receive command messages that are not intended for us. Ignore those for now. The whole story is a bit more complicated: It is possible to enable debug output on SAM, which is sent via SSH command messages. By default this output is sent to a debug connector, with its own target ID (TID=0x03). It is possible to override the target of the debug output and set it to the host/kernel driver. This, however, does not change the original target ID of the message. Meaning, we receive messages with TID=0x03 (debug) but expect to only receive messages with TID=0x00 (host). The problem is that the different target ID also comes with a different scope of request IDs. In particular, these do not follow the standard event rules (i.e. do not fall into a set of small reserved values). Therefore, current message handling interprets them as responses to pending requests and tries to match them up via the request ID. However, these debug output messages are not in fact responses, and therefore this will at best fail to find the request and at worst pass on the wrong data as response for a request. Therefore ignore any command messages not intended for us (host) for now. We can implement support for the debug messages once we have a better understanding of them. Note that this may also provide a bit more stability and avoid some driver confusion in case any other targets want to talk to us in the future, since we don't yet know what to do with those as well. A warning for the dropped messages should suffice for now and also give us a chance of discovering new targets if they come along without any potential for bugs/instabilities. Fixes: c167b9c7e3d6 ("platform/surface: Add Surface Aggregator subsystem") Signed-off-by: Maximilian Luz --- Note: I've simplified this commit so that it can be applied independently of the rest of the series for easier backporting. --- .../surface/aggregator/ssh_request_layer.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/platform/surface/aggregator/ssh_request_layer.c b/drivers/platform/surface/aggregator/ssh_request_layer.c index f5565570f16c..69132976d297 100644 --- a/drivers/platform/surface/aggregator/ssh_request_layer.c +++ b/drivers/platform/surface/aggregator/ssh_request_layer.c @@ -916,6 +916,20 @@ static void ssh_rtl_rx_command(struct ssh_ptl *p, const struct ssam_span *data) if (sshp_parse_command(dev, data, &command, &command_data)) return; + /* + * Check if the message was intended for us. If not, drop it. + * + * Note: We will need to change this to handle debug messages. On newer + * generation devices, these seem to be sent to tid_out=0x03. We as + * host can still receive them as they can be forwarded via an override + * option on SAM, but doing so does not change tid_out=0x00. + */ + if (command->tid_out != 0x00) { + rtl_warn(rtl, "rtl: dropping message not intended for us (tid = %#04x)\n", + command->tid_out); + return; + } + if (ssh_rqid_is_event(get_unaligned_le16(&command->rqid))) ssh_rtl_rx_event(rtl, command, &command_data); else From patchwork Fri Dec 2 22:33:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maximilian Luz X-Patchwork-Id: 29127 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1102104wrr; Fri, 2 Dec 2022 14:35:08 -0800 (PST) X-Google-Smtp-Source: AA0mqf7s8EKSwfqzgfuEfIN3SnqRQTKZEJlF+8oXO06Vf6gWpKT/M5waTz5Y1RSWghLIPenfdrbL X-Received: by 2002:a17:906:6aca:b0:7ad:dfb5:a3f2 with SMTP id q10-20020a1709066aca00b007addfb5a3f2mr47828391ejs.351.1670020508117; Fri, 02 Dec 2022 14:35:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670020508; cv=none; d=google.com; s=arc-20160816; b=RgoxQt05NuNRuoI/k6uzKMPObeyktbYbOzaIzSUIlMCjLL1sljvnHHw6Xnq8FXkPAo uPSD01+8it1/KTlswDixAPd3Cds0aFQVYjDf0N1aXYRkNH2md04iKGL1JwMMXWOcD841 bWbGXuOzJYz8anx2aciEqz5UdP3hGOBbDJlmmq3M978uisTmMC6RQPyS7rUrbirXfDg3 AhCfbYv30FnDZopGxZZrlJ2G0lXZUV13GnZg88TAWJdOGFsk4JJ/FLiRjMnZZdqsdOW+ QXhvJEU1FJyNzWjJs0UUQm4EVmmvzv3DunD+ZqPrLWaymTv0Z27zi5e7a5u3mXwI7JkM OJDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=6ZvT2BrJWUgYMbwn3ocx26UrzsJe4/rr8jByj9AM/40=; b=VguKaZCwSbcfkovYlK5EkAyTHqsNFaRLUsGiJtQXDJmZrD1VCQE4X97jCVNv27d7I8 tswI84BoF4z6h5btNJsei306FG2ru0BIRLxbbeLCSIbTA6edKN6D2mE3wd49DDvcFvSo otTvmBjGy24mKhdhIXnkcv7CeG12h97+sNXXU92kVfLXxzBsFhBBDOATHjram2AjV/H/ g/BYWk9rQu4VnfTBxnOmDj6KgLwBpcYYzXLmRjf4rjQ816CqBaAzwnv/HgWzgF+HNpVT /a0BR/5TPicaXT0Ofosv8wWW4HNGUU9vAdU0M+X1PeA3FvyPnGoidJ/pFrdbbdHrTAe6 ymNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=PJUcfZQ2; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hz5-20020a1709072ce500b0078db70cc9b8si7468083ejc.606.2022.12.02.14.34.45; Fri, 02 Dec 2022 14:35:08 -0800 (PST) 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=@gmail.com header.s=20210112 header.b=PJUcfZQ2; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234885AbiLBWds (ORCPT + 99 others); Fri, 2 Dec 2022 17:33:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234485AbiLBWdm (ORCPT ); Fri, 2 Dec 2022 17:33:42 -0500 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45881EBC92; Fri, 2 Dec 2022 14:33:41 -0800 (PST) Received: by mail-ed1-x533.google.com with SMTP id m19so8207684edj.8; Fri, 02 Dec 2022 14:33:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6ZvT2BrJWUgYMbwn3ocx26UrzsJe4/rr8jByj9AM/40=; b=PJUcfZQ2pP0SvbdjdVKl4KmEhk8EznUJVyJ2cwVQy40vub6TzrMXcGVwURBe2m5ZWq WEdtQpvjkVvEqJSkJQbGqJa7HNaOsEOGPIVO/f9yysk+eYuHL5ogzaOdKO1Q6237VWN4 xFSk4lKcSb3M1I899YyYeTybqVCpyMEYYtmgEcXax6GWP/HQiBJjVDhMwGgZ4vYxX1mD 2tlA18FLic3yI0THcqShNFDnZ1AgGMHb/BY+ObV0qYnabupvAqCuSL6TqbgRDGryJn6+ CxaLic9kuifbG9VXnZiQiSWw/uSBRLFIegIjHZZJ0tNUt6wh7TFdII4nvrAKUauhkyqY mqrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6ZvT2BrJWUgYMbwn3ocx26UrzsJe4/rr8jByj9AM/40=; b=g6cWlJz/Zz93NzXQAAwsmHM9UxI80d+cdOhJ3gQQu221fNrZhAgqmSdwsiDSIL9p9j CfdrROpEg2jgn0DhcWXhDk7RemFJmrmhH8YPcexshAnpogDL08hN47mTNQ/HG2NujKw9 1+Pn3uy5anlQPhIwwPkwlH3fYmDTP1HHsxCIzf7vPjEeL4YuYsBfVfxNZJ0wDsdQh1Gp ZRLTXE4G6FZV2S+cRYYG7dNVAwXxlPfjLwv6e9v/D5H2c13VHAvxohbY/Z9sHQZxemqt CAyQYobW5asi26K02jaMuujOYVVnJApZfxLiyD5Xy2crs34J8nCETUuF+MUxJ+XXE9Bm n7qQ== X-Gm-Message-State: ANoB5pkzV+TCkPGIEdd3QFfgKd0u5SPym+UWXqZ779mSAIh1KeBINJcb DXVBacX55E/7rI6vcgU1tLH3CmXjAZNkEA== X-Received: by 2002:a05:6402:509:b0:466:7500:b5df with SMTP id m9-20020a056402050900b004667500b5dfmr65577268edv.48.1670020419552; Fri, 02 Dec 2022 14:33:39 -0800 (PST) Received: from xws.localdomain ([37.120.217.162]) by smtp.gmail.com with ESMTPSA id j17-20020a17090623f100b007c0d0dad9c6sm575340ejg.108.2022.12.02.14.33.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 14:33:38 -0800 (PST) From: Maximilian Luz To: Hans de Goede Cc: Maximilian Luz , Mark Gross , Jonathan Corbet , platform-driver-x86@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/9] platform/surface: aggregator: Improve documentation and handling of message target and source IDs Date: Fri, 2 Dec 2022 23:33:20 +0100 Message-Id: <20221202223327.690880-3-luzmaximilian@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221202223327.690880-1-luzmaximilian@gmail.com> References: <20221202223327.690880-1-luzmaximilian@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751143423885869480?= X-GMAIL-MSGID: =?utf-8?q?1751143423885869480?= The `tid_in` and `tid_out` fields of the serial hub protocol command struct (struct ssh_command) are actually source and target IDs, indicating the peer from which the message originated and the peer for which it is intended. Change the naming of those fields accordingly and improve the protocol documentation. Additionally, introduce an enum containing all currently known peers, i.e. targets and sources. Signed-off-by: Maximilian Luz --- .../driver-api/surface_aggregator/client.rst | 4 +- .../driver-api/surface_aggregator/ssh.rst | 36 +++++++++-------- .../platform/surface/aggregator/controller.c | 12 +++--- .../platform/surface/aggregator/ssh_msgb.h | 4 +- .../surface/aggregator/ssh_request_layer.c | 11 ++--- include/linux/surface_aggregator/controller.h | 4 +- include/linux/surface_aggregator/serial_hub.h | 40 +++++++++++++------ 7 files changed, 64 insertions(+), 47 deletions(-) diff --git a/Documentation/driver-api/surface_aggregator/client.rst b/Documentation/driver-api/surface_aggregator/client.rst index 27f95abdbe99..9d7411223a84 100644 --- a/Documentation/driver-api/surface_aggregator/client.rst +++ b/Documentation/driver-api/surface_aggregator/client.rst @@ -191,7 +191,7 @@ data received from it is converted from little-endian to host endianness. * they do not correspond to an actual SAM/EC request. */ rqst.target_category = SSAM_SSH_TC_SAM; - rqst.target_id = 0x01; + rqst.target_id = SSAM_SSH_TID_SAM; rqst.command_id = 0x02; rqst.instance_id = 0x03; rqst.flags = SSAM_REQUEST_HAS_RESPONSE; @@ -241,7 +241,7 @@ one of the generator macros, for example via: SSAM_DEFINE_SYNC_REQUEST_W(__ssam_tmp_perf_mode_set, __le32, { .target_category = SSAM_SSH_TC_TMP, - .target_id = 0x01, + .target_id = SSAM_SSH_TID_SAM, .command_id = 0x03, .instance_id = 0x00, }); diff --git a/Documentation/driver-api/surface_aggregator/ssh.rst b/Documentation/driver-api/surface_aggregator/ssh.rst index bf007d6c9873..18fd0f0aee84 100644 --- a/Documentation/driver-api/surface_aggregator/ssh.rst +++ b/Documentation/driver-api/surface_aggregator/ssh.rst @@ -13,6 +13,7 @@ .. |DATA_NSQ| replace:: ``DATA_NSQ`` .. |TC| replace:: ``TC`` .. |TID| replace:: ``TID`` +.. |SID| replace:: ``SID`` .. |IID| replace:: ``IID`` .. |RQID| replace:: ``RQID`` .. |CID| replace:: ``CID`` @@ -219,13 +220,13 @@ following fields, packed together and in order: - |u8| - Target category. - * - |TID| (out) + * - |TID| - |u8| - - Target ID for outgoing (host to EC) commands. + - Target ID for commands/messages. - * - |TID| (in) + * - |SID| - |u8| - - Target ID for incoming (EC to host) commands. + - Source ID for commands/messages. * - |IID| - |u8| @@ -286,19 +287,20 @@ general, however, a single target category should map to a single reserved event request ID. Furthermore, requests, responses, and events have an associated target ID -(``TID``). This target ID is split into output (host to EC) and input (EC to -host) fields, with the respecting other field (e.g. output field on incoming -messages) set to zero. Two ``TID`` values are known: Primary (``0x01``) and -secondary (``0x02``). In general, the response to a request should have the -same ``TID`` value, however, the field (output vs. input) should be used in -accordance to the direction in which the response is sent (i.e. on the input -field, as responses are generally sent from the EC to the host). - -Note that, even though requests and events should be uniquely identifiable -by target category and command ID alone, the EC may require specific -target ID and instance ID values to accept a command. A command that is -accepted for ``TID=1``, for example, may not be accepted for ``TID=2`` -and vice versa. +(``TID``) and source ID (``SID``). These two fields indicate where a message +originates from (``SID``) and what the intended target of the message is +(``TID``). Note that a response to a specific request therefore has the source +and target IDs swapped when compared to the original request (i.e. the request +target is the response source and the request source is the response target). +See (:c:type:`enum ssh_request_id `) for possible values of +both. + +Note that, even though requests and events should be uniquely identifiable by +target category and command ID alone, the EC may require specific target ID and +instance ID values to accept a command. A command that is accepted for +``TID=1``, for example, may not be accepted for ``TID=2`` and vice versa. While +this may not always hold in reality, you can think of different target/source +IDs indicating different physical ECs with potentially different feature sets. Limitations and Observations diff --git a/drivers/platform/surface/aggregator/controller.c b/drivers/platform/surface/aggregator/controller.c index 43e765199137..54bfb1f3d2dc 100644 --- a/drivers/platform/surface/aggregator/controller.c +++ b/drivers/platform/surface/aggregator/controller.c @@ -994,7 +994,7 @@ static void ssam_handle_event(struct ssh_rtl *rtl, item->rqid = get_unaligned_le16(&cmd->rqid); item->event.target_category = cmd->tc; - item->event.target_id = cmd->tid_in; + item->event.target_id = cmd->sid; item->event.command_id = cmd->cid; item->event.instance_id = cmd->iid; memcpy(&item->event.data[0], data->ptr, data->len); @@ -1777,35 +1777,35 @@ EXPORT_SYMBOL_GPL(ssam_request_sync_with_buffer); SSAM_DEFINE_SYNC_REQUEST_R(ssam_ssh_get_firmware_version, __le32, { .target_category = SSAM_SSH_TC_SAM, - .target_id = 0x01, + .target_id = SSAM_SSH_TID_SAM, .command_id = 0x13, .instance_id = 0x00, }); SSAM_DEFINE_SYNC_REQUEST_R(ssam_ssh_notif_display_off, u8, { .target_category = SSAM_SSH_TC_SAM, - .target_id = 0x01, + .target_id = SSAM_SSH_TID_SAM, .command_id = 0x15, .instance_id = 0x00, }); SSAM_DEFINE_SYNC_REQUEST_R(ssam_ssh_notif_display_on, u8, { .target_category = SSAM_SSH_TC_SAM, - .target_id = 0x01, + .target_id = SSAM_SSH_TID_SAM, .command_id = 0x16, .instance_id = 0x00, }); SSAM_DEFINE_SYNC_REQUEST_R(ssam_ssh_notif_d0_exit, u8, { .target_category = SSAM_SSH_TC_SAM, - .target_id = 0x01, + .target_id = SSAM_SSH_TID_SAM, .command_id = 0x33, .instance_id = 0x00, }); SSAM_DEFINE_SYNC_REQUEST_R(ssam_ssh_notif_d0_entry, u8, { .target_category = SSAM_SSH_TC_SAM, - .target_id = 0x01, + .target_id = SSAM_SSH_TID_SAM, .command_id = 0x34, .instance_id = 0x00, }); diff --git a/drivers/platform/surface/aggregator/ssh_msgb.h b/drivers/platform/surface/aggregator/ssh_msgb.h index f3ecad92eefd..438873e06098 100644 --- a/drivers/platform/surface/aggregator/ssh_msgb.h +++ b/drivers/platform/surface/aggregator/ssh_msgb.h @@ -189,8 +189,8 @@ static inline void msgb_push_cmd(struct msgbuf *msgb, u8 seq, u16 rqid, __msgb_push_u8(msgb, SSH_PLD_TYPE_CMD); /* Payload type. */ __msgb_push_u8(msgb, rqst->target_category); /* Target category. */ - __msgb_push_u8(msgb, rqst->target_id); /* Target ID (out). */ - __msgb_push_u8(msgb, 0x00); /* Target ID (in). */ + __msgb_push_u8(msgb, rqst->target_id); /* Target ID. */ + __msgb_push_u8(msgb, SSAM_SSH_TID_HOST); /* Source ID. */ __msgb_push_u8(msgb, rqst->instance_id); /* Instance ID. */ __msgb_push_u16(msgb, rqid); /* Request ID. */ __msgb_push_u8(msgb, rqst->command_id); /* Command ID. */ diff --git a/drivers/platform/surface/aggregator/ssh_request_layer.c b/drivers/platform/surface/aggregator/ssh_request_layer.c index 69132976d297..90634dcacabf 100644 --- a/drivers/platform/surface/aggregator/ssh_request_layer.c +++ b/drivers/platform/surface/aggregator/ssh_request_layer.c @@ -920,13 +920,14 @@ static void ssh_rtl_rx_command(struct ssh_ptl *p, const struct ssam_span *data) * Check if the message was intended for us. If not, drop it. * * Note: We will need to change this to handle debug messages. On newer - * generation devices, these seem to be sent to tid_out=0x03. We as - * host can still receive them as they can be forwarded via an override - * option on SAM, but doing so does not change tid_out=0x00. + * generation devices, these seem to be sent to SSAM_SSH_TID_DEBUG. We + * as host can still receive them as they can be forwarded via an + * override option on SAM, but doing so does not change the target ID + * to SSAM_SSH_TID_HOST. */ - if (command->tid_out != 0x00) { + if (command->tid != SSAM_SSH_TID_HOST) { rtl_warn(rtl, "rtl: dropping message not intended for us (tid = %#04x)\n", - command->tid_out); + command->tid); return; } diff --git a/include/linux/surface_aggregator/controller.h b/include/linux/surface_aggregator/controller.h index d11a1c6e3186..8932bc0bae18 100644 --- a/include/linux/surface_aggregator/controller.h +++ b/include/linux/surface_aggregator/controller.h @@ -912,10 +912,10 @@ enum ssam_event_mask { }) #define SSAM_EVENT_REGISTRY_SAM \ - SSAM_EVENT_REGISTRY(SSAM_SSH_TC_SAM, 0x01, 0x0b, 0x0c) + SSAM_EVENT_REGISTRY(SSAM_SSH_TC_SAM, SSAM_SSH_TID_SAM, 0x0b, 0x0c) #define SSAM_EVENT_REGISTRY_KIP \ - SSAM_EVENT_REGISTRY(SSAM_SSH_TC_KIP, 0x02, 0x27, 0x28) + SSAM_EVENT_REGISTRY(SSAM_SSH_TC_KIP, SSAM_SSH_TID_KIP, 0x27, 0x28) #define SSAM_EVENT_REGISTRY_REG(tid)\ SSAM_EVENT_REGISTRY(SSAM_SSH_TC_REG, tid, 0x01, 0x02) diff --git a/include/linux/surface_aggregator/serial_hub.h b/include/linux/surface_aggregator/serial_hub.h index 45501b6e54e8..5c4ae1a26183 100644 --- a/include/linux/surface_aggregator/serial_hub.h +++ b/include/linux/surface_aggregator/serial_hub.h @@ -83,23 +83,21 @@ enum ssh_payload_type { /** * struct ssh_command - Payload of a command-type frame. - * @type: The type of the payload. See &enum ssh_payload_type. Should be - * SSH_PLD_TYPE_CMD for this struct. - * @tc: Command target category. - * @tid_out: Output target ID. Should be zero if this an incoming (EC to host) - * message. - * @tid_in: Input target ID. Should be zero if this is an outgoing (host to - * EC) message. - * @iid: Instance ID. - * @rqid: Request ID. Used to match requests with responses and differentiate - * between responses and events. - * @cid: Command ID. + * @type: The type of the payload. See &enum ssh_payload_type. Should be + * SSH_PLD_TYPE_CMD for this struct. + * @tc: Command target category. + * @tid: Target ID. Indicates the target of the message. + * @sid: Source ID. Indicates the source of the message. + * @iid: Instance ID. + * @rqid: Request ID. Used to match requests with responses and differentiate + * between responses and events. + * @cid: Command ID. */ struct ssh_command { u8 type; u8 tc; - u8 tid_out; - u8 tid_in; + u8 tid; + u8 sid; u8 iid; __le16 rqid; u8 cid; @@ -280,6 +278,22 @@ struct ssam_span { size_t len; }; +/** + * enum ssam_ssh_tid - Target/source IDs for Serial Hub messages. + * @SSAM_SSH_TID_HOST: We as the kernel Serial Hub driver. + * @SSAM_SSH_TID_SAM: The Surface Aggregator EC. + * @SSAM_SSH_TID_KIP: Keyboard and perihperal controller. + * @SSAM_SSH_TID_DEBUG: Debug connector. + * @SSAM_SSH_TID_SURFLINK: SurfLink connector. + */ +enum ssam_ssh_tid { + SSAM_SSH_TID_HOST = 0x00, + SSAM_SSH_TID_SAM = 0x01, + SSAM_SSH_TID_KIP = 0x02, + SSAM_SSH_TID_DEBUG = 0x03, + SSAM_SSH_TID_SURFLINK = 0x04, +}; + /* * Known SSH/EC target categories. * From patchwork Fri Dec 2 22:33:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maximilian Luz X-Patchwork-Id: 29129 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1102159wrr; Fri, 2 Dec 2022 14:35:16 -0800 (PST) X-Google-Smtp-Source: AA0mqf6FuvEuWjuoNV9KSWK4fytT2RYCDKP8fHnCWE4lWhnKk8lJALG6AjRQY14h74ofXU02p6br X-Received: by 2002:a17:906:2e82:b0:7ae:44b2:cb7f with SMTP id o2-20020a1709062e8200b007ae44b2cb7fmr46678767eji.437.1670020516312; Fri, 02 Dec 2022 14:35:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670020516; cv=none; d=google.com; s=arc-20160816; b=hu56tgPqIeEN2Ka2BCg+URv2Lr++Y1NT+EFvP9f8gAJF7qVCu4oE3WDfS1aixHPjvY 3WILrQCECt0A/puHFoD9ngJ81w2Al6ONgXpB6+rvBezw9yVjOdTGaKiHrl1+c65f2sF0 QEfc4tM/CauM+LnRbJATBw2Fyj6+LT8bmPfzg8LXdYJ3HkfeLUYXUpXFTZp1Y86O5qrg XQvdPtDp3xz5ctHn/6JaFiqGdYoM+FfFW897GqjhyZ7bovT2TLYML6LaO5lqv3cVMM/E 4jrTRkNb/214ySGcDiSIWGuiwJ5X6cv3lX9ASz7YuhN8FTxcwgVjsYYU/ZWPukabuoPO sszQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=AKtY0PCIbwOrLL3mI4KdSnkCzj1WtOxnZ//2cdus9tE=; b=RxVdNT2FeS6Df58LHUeuI2hkg8zK3kJYPnNWLxs5a4yesYmYmMl+5rYC/YCpCrvNwS +q8xSG/5skVTZf+1MnMite3j8oQbGk8TFMtxYkOuK2/1g2JrqSH+cfQDNKUD2ocwBqAD xOlxvSX3mmRwhxqZ53DsfiUyMVqFf+TimbzZuIERnZRVOsXAAovyLe1eVXjk3dmoSCfX BjxsjDuJTlB3LNLSW9+oa0nxF5azRf9WV/o8SqetvAgLqnjRbhcVaHoJyzozoVmliJwD 4BAK35k9lbAJw0p/2zUx2aKMVezJdOb/Ha1/DSzfTLpX2GF4+0OmznXPFUfJ/Co6tcph BPZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=fV9QYuMo; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id di7-20020a170906730700b007add5af39f6si3339907ejc.929.2022.12.02.14.34.53; Fri, 02 Dec 2022 14:35:16 -0800 (PST) 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=@gmail.com header.s=20210112 header.b=fV9QYuMo; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234911AbiLBWdy (ORCPT + 99 others); Fri, 2 Dec 2022 17:33:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234733AbiLBWdn (ORCPT ); Fri, 2 Dec 2022 17:33:43 -0500 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FBEDEC0AE; Fri, 2 Dec 2022 14:33:42 -0800 (PST) Received: by mail-ed1-x52c.google.com with SMTP id r26so8206509edc.10; Fri, 02 Dec 2022 14:33:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=AKtY0PCIbwOrLL3mI4KdSnkCzj1WtOxnZ//2cdus9tE=; b=fV9QYuMo7r8ovhJQx4HRp3/8U5kAGujDa/A8VSel4cQlwVJtGZg3rH4u+jWD8aCLAN rv5j8kYAvXk5am4ZoHdSY6Z5JFcNdItahMKtIbGnog7Ktxc69AJKLYD+huaGycbi2yrB 8/ESqaWyh/bOJVLjGatXhrTwm3JHXidlX7kC/ARYsZqy2Us/6srLtcMEatZKYEZpteFO jhCj3EMdy1ElqlkzsIVu9XVSr/XBkL2r2jMx2RHDv1nT3pmVb82okJAyqJhuJ/w2onSi pThUlDm/4A8vQSGgikhRV6rPSTB6ao5e5F/pOEI/1+LA/jOUd5CPa4zl+ujKC1/KCXOO T6lQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AKtY0PCIbwOrLL3mI4KdSnkCzj1WtOxnZ//2cdus9tE=; b=WEFG9Ow1vuG6Ryy+d16wLIdxuH4+G39Ld1pQh+vrOERQRDA0erM+6YMGjsW9iSWOG7 aJJ8AaJGwJxsgbe+P4BmW41VDD1VkLDlePO78bBgET/psrtPWX0vPLx9znGbd+D6EGtv uBSqaGsQnLcC3S0xv1bPZTVmRcHcIHdRWiA15u+HLcKIu/+rcILj7+Va6c2cNdAUBzuN oCA1nxlvPMd4zjYcYD3qZoCjs0RjB4wHb10vCpBG0B8glIS2IMY4fbrhKWcum8JBssan C7KqP+du8zp8iQrAl+E+v+53FuEdVaQvKY5mzL59kWur5SWc7KhTwQGP3z1+liH2hWJW 4Scw== X-Gm-Message-State: ANoB5pmr7x/OPkncX8bUb2GwdnSaAC7J8A5L7xKYdSPAqHJWMknj/Ign 9OgK0ZCQwtln6yQX2aa0X3k= X-Received: by 2002:aa7:c055:0:b0:45a:1af2:ed6d with SMTP id k21-20020aa7c055000000b0045a1af2ed6dmr50115866edo.364.1670020420656; Fri, 02 Dec 2022 14:33:40 -0800 (PST) Received: from xws.localdomain ([37.120.217.162]) by smtp.gmail.com with ESMTPSA id j17-20020a17090623f100b007c0d0dad9c6sm575340ejg.108.2022.12.02.14.33.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 14:33:40 -0800 (PST) From: Maximilian Luz To: Hans de Goede Cc: Maximilian Luz , Mark Gross , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/9] platform/surface: aggregator: Add target and source IDs to command trace events Date: Fri, 2 Dec 2022 23:33:21 +0100 Message-Id: <20221202223327.690880-4-luzmaximilian@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221202223327.690880-1-luzmaximilian@gmail.com> References: <20221202223327.690880-1-luzmaximilian@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751143432601004552?= X-GMAIL-MSGID: =?utf-8?q?1751143432601004552?= Add command source and target IDs to trace events. Tracing support for the Surface Aggregator driver was originally implemented at a time when only two peers were known: Host and SAM. We now know that there are at least five, with three actively being used (Host, SAM, KIP; four with Debug if you want to count manually enabling that interface). So it makes sense to also explicitly name the peers involved when tracing. Signed-off-by: Maximilian Luz --- drivers/platform/surface/aggregator/trace.h | 73 +++++++++++++++++++-- 1 file changed, 67 insertions(+), 6 deletions(-) diff --git a/drivers/platform/surface/aggregator/trace.h b/drivers/platform/surface/aggregator/trace.h index 2a2c17771d01..55cc61bba1da 100644 --- a/drivers/platform/surface/aggregator/trace.h +++ b/drivers/platform/surface/aggregator/trace.h @@ -96,6 +96,7 @@ TRACE_DEFINE_ENUM(SSAM_SSH_TC_POS); #define SSAM_SEQ_NOT_APPLICABLE ((u16)-1) #define SSAM_RQID_NOT_APPLICABLE ((u32)-1) #define SSAM_SSH_TC_NOT_APPLICABLE 0 +#define SSAM_SSH_TID_NOT_APPLICABLE ((u8)-1) #ifndef _SURFACE_AGGREGATOR_TRACE_HELPERS #define _SURFACE_AGGREGATOR_TRACE_HELPERS @@ -150,12 +151,44 @@ static inline u32 ssam_trace_get_request_id(const struct ssh_packet *p) return get_unaligned_le16(&p->data.ptr[SSH_MSGOFFSET_COMMAND(rqid)]); } +/** + * ssam_trace_get_request_tid() - Read the packet's request target ID. + * @p: The packet. + * + * Return: Returns the packet's request target ID (TID) field if the packet + * represents a request with command data, or %SSAM_SSH_TID_NOT_APPLICABLE + * if not (e.g. flush request, control packet). + */ +static inline u32 ssam_trace_get_request_tid(const struct ssh_packet *p) +{ + if (!p->data.ptr || p->data.len < SSH_COMMAND_MESSAGE_LENGTH(0)) + return SSAM_SSH_TID_NOT_APPLICABLE; + + return get_unaligned_le16(&p->data.ptr[SSH_MSGOFFSET_COMMAND(tid)]); +} + +/** + * ssam_trace_get_request_sid() - Read the packet's request source ID. + * @p: The packet. + * + * Return: Returns the packet's request source ID (SID) field if the packet + * represents a request with command data, or %SSAM_SSH_TID_NOT_APPLICABLE + * if not (e.g. flush request, control packet). + */ +static inline u32 ssam_trace_get_request_sid(const struct ssh_packet *p) +{ + if (!p->data.ptr || p->data.len < SSH_COMMAND_MESSAGE_LENGTH(0)) + return SSAM_SSH_TID_NOT_APPLICABLE; + + return get_unaligned_le16(&p->data.ptr[SSH_MSGOFFSET_COMMAND(sid)]); +} + /** * ssam_trace_get_request_tc() - Read the packet's request target category. * @p: The packet. * * Return: Returns the packet's request target category (TC) field if the - * packet represents a request with command data, or %SSAM_TC_NOT_APPLICABLE + * packet represents a request with command data, or %SSAM_SSH_TC_NOT_APPLICABLE * if not (e.g. flush request, control packet). */ static inline u32 ssam_trace_get_request_tc(const struct ssh_packet *p) @@ -232,8 +265,18 @@ static inline u32 ssam_trace_get_request_tc(const struct ssh_packet *p) { SSAM_RQID_NOT_APPLICABLE, "N/A" } \ ) -#define ssam_show_ssh_tc(rqid) \ - __print_symbolic(rqid, \ +#define ssam_show_ssh_tid(tid) \ + __print_symbolic(tid, \ + { SSAM_SSH_TID_NOT_APPLICABLE, "N/A" }, \ + { SSAM_SSH_TID_HOST, "Host" }, \ + { SSAM_SSH_TID_SAM, "SAM" }, \ + { SSAM_SSH_TID_KIP, "KIP" }, \ + { SSAM_SSH_TID_DEBUG, "Debug" }, \ + { SSAM_SSH_TID_SURFLINK, "SurfLink" } \ + ) + +#define ssam_show_ssh_tc(tc) \ + __print_symbolic(tc, \ { SSAM_SSH_TC_NOT_APPLICABLE, "N/A" }, \ { SSAM_SSH_TC_SAM, "SAM" }, \ { SSAM_SSH_TC_BAT, "BAT" }, \ @@ -313,6 +356,8 @@ DECLARE_EVENT_CLASS(ssam_command_class, TP_STRUCT__entry( __field(u16, rqid) __field(u16, len) + __field(u8, tid) + __field(u8, sid) __field(u8, tc) __field(u8, cid) __field(u8, iid) @@ -320,14 +365,18 @@ DECLARE_EVENT_CLASS(ssam_command_class, TP_fast_assign( __entry->rqid = get_unaligned_le16(&cmd->rqid); + __entry->tid = cmd->tid; + __entry->sid = cmd->sid; __entry->tc = cmd->tc; __entry->cid = cmd->cid; __entry->iid = cmd->iid; __entry->len = len; ), - TP_printk("rqid=%#06x, tc=%s, cid=%#04x, iid=%#04x, len=%u", + TP_printk("rqid=%#06x, tid=%s, sid=%s, tc=%s, cid=%#04x, iid=%#04x, len=%u", __entry->rqid, + ssam_show_ssh_tid(__entry->tid), + ssam_show_ssh_tid(__entry->sid), ssam_show_ssh_tc(__entry->tc), __entry->cid, __entry->iid, @@ -430,6 +479,8 @@ DECLARE_EVENT_CLASS(ssam_request_class, __field(u8, tc) __field(u16, cid) __field(u16, iid) + __field(u8, tid) + __field(u8, sid) ), TP_fast_assign( @@ -439,16 +490,20 @@ DECLARE_EVENT_CLASS(ssam_request_class, __entry->state = READ_ONCE(request->state); __entry->rqid = ssam_trace_get_request_id(p); ssam_trace_ptr_uid(p, __entry->uid); + __entry->tid = ssam_trace_get_request_tid(p); + __entry->sid = ssam_trace_get_request_sid(p); __entry->tc = ssam_trace_get_request_tc(p); __entry->cid = ssam_trace_get_command_field_u8(p, cid); __entry->iid = ssam_trace_get_command_field_u8(p, iid); ), - TP_printk("uid=%s, rqid=%s, ty=%s, sta=%s, tc=%s, cid=%s, iid=%s", + TP_printk("uid=%s, rqid=%s, ty=%s, sta=%s, tid=%s, sid=%s, tc=%s, cid=%s, iid=%s", __entry->uid, ssam_show_request_id(__entry->rqid), ssam_show_request_type(__entry->state), ssam_show_request_state(__entry->state), + ssam_show_ssh_tid(__entry->tid), + ssam_show_ssh_tid(__entry->sid), ssam_show_ssh_tc(__entry->tc), ssam_show_generic_u8_field(__entry->cid), ssam_show_generic_u8_field(__entry->iid) @@ -474,6 +529,8 @@ DECLARE_EVENT_CLASS(ssam_request_status_class, __field(u8, tc) __field(u16, cid) __field(u16, iid) + __field(u8, tid) + __field(u8, sid) ), TP_fast_assign( @@ -484,16 +541,20 @@ DECLARE_EVENT_CLASS(ssam_request_status_class, __entry->rqid = ssam_trace_get_request_id(p); __entry->status = status; ssam_trace_ptr_uid(p, __entry->uid); + __entry->tid = ssam_trace_get_request_tid(p); + __entry->sid = ssam_trace_get_request_sid(p); __entry->tc = ssam_trace_get_request_tc(p); __entry->cid = ssam_trace_get_command_field_u8(p, cid); __entry->iid = ssam_trace_get_command_field_u8(p, iid); ), - TP_printk("uid=%s, rqid=%s, ty=%s, sta=%s, tc=%s, cid=%s, iid=%s, status=%d", + TP_printk("uid=%s, rqid=%s, ty=%s, sta=%s, tid=%s, sid=%s, tc=%s, cid=%s, iid=%s, status=%d", __entry->uid, ssam_show_request_id(__entry->rqid), ssam_show_request_type(__entry->state), ssam_show_request_state(__entry->state), + ssam_show_ssh_tid(__entry->tid), + ssam_show_ssh_tid(__entry->sid), ssam_show_ssh_tc(__entry->tc), ssam_show_generic_u8_field(__entry->cid), ssam_show_generic_u8_field(__entry->iid), From patchwork Fri Dec 2 22:33:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maximilian Luz X-Patchwork-Id: 29130 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1102180wrr; Fri, 2 Dec 2022 14:35:20 -0800 (PST) X-Google-Smtp-Source: AA0mqf6pTxgVE8OyXQEocBlZvs3K2b/XuOiFDLS9Z9k7tlCiGz+83ocLvLc8OEc7GLiMUp689fOi X-Received: by 2002:a17:907:2144:b0:7bd:c280:e94d with SMTP id rk4-20020a170907214400b007bdc280e94dmr27315054ejb.562.1670020520516; Fri, 02 Dec 2022 14:35:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670020520; cv=none; d=google.com; s=arc-20160816; b=LLOcR3O+MFOscOokPDXsOWTdaObcyV5G6O26wB581ZDeEu1bBMtOWS3wyH1xK+fYPM ttJVj10bUbZfXNHxTAK6qS5sVzOjUseLPhT9PZ8ZZvoQv0k+vYIu2+e5Cd3DROUnNdBu xvEU84CTdmqrli0veAy8KD74D26DeTblk4WRqsiQG/GaWFL9UpYLC4FgQRjnBC2Nmm8v BOx9OF6muOc2BrtqKThlu+Owokx/aar3Meq9ZtyEsp4NvIV6o+7xw+ub2SYRXgoMHXUi Z2s6YoHdrZjczpZzNYZz5yv5CvnrKeOu8duKnpr5kXV8BGJRZq6clb2HSofjnDvm0vK2 X65Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NdlZUggfG0fxjaA+cqLRw4yaCZJ4vPfUgkLv65iJoHU=; b=dQIZ379PwtouOlg4xOLl9+a1Eg3F7icyZEgr9T3ax0Ij/N3tpQDdpC2DngJ2Uz29Vs iJS7houChmPkgkBIIGd5mwx1AKNX6vDYXu1JkspEVe+4UbyDZTRw5lKYwBIUfEOtHyXi wMkS/OZrBDPWT2Denh6LFED0TUlFH0xhtswNSjATt/OCDZmZcBCLL8tzmzE0mTBe7PZY UJaWs0QbBgVU12qSVw64ObpDfQ3kJouKIv3+1EucF36ODJOgxFboa/Hcun+hUd1Ez+6j 1sLBH0bv5D1fgtyz9jh3K1qW19S5cqp8kQqKoLenjGj9QfB1qBz4XXeunFSFCnY71l1K xJpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=oGnPuMFh; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pg10-20020a170907204a00b007a858ead52dsi5463488ejb.732.2022.12.02.14.34.57; Fri, 02 Dec 2022 14:35:20 -0800 (PST) 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=@gmail.com header.s=20210112 header.b=oGnPuMFh; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234881AbiLBWd7 (ORCPT + 99 others); Fri, 2 Dec 2022 17:33:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234756AbiLBWdo (ORCPT ); Fri, 2 Dec 2022 17:33:44 -0500 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A9B2EC82D; Fri, 2 Dec 2022 14:33:43 -0800 (PST) Received: by mail-ej1-x631.google.com with SMTP id vp12so14654930ejc.8; Fri, 02 Dec 2022 14:33:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NdlZUggfG0fxjaA+cqLRw4yaCZJ4vPfUgkLv65iJoHU=; b=oGnPuMFhCjREozXvRwStzRjpcDIQs+PMnHa51gR1gSJYj7pA/g87px7M4nfB4DCtDU OMke+Z0vozViBGsAWra8YSGnMPG5fEQ8NGV14Ey9x1ujsiro85Mc5zIvNkA/h9HD+iY5 hBbxpJpLF+XLBgE0o3gxpa11FFWBIsd40Hay3CN+931h4vNN8G6+9iDcsC/RxqTxiXXM 2in6t9NlQtHV0WG2k/jH7PB0R2Vczcly5Zhfj7tcSC0QmDqwvmr7E/mBZxzXOGrK8AcC Y/bjMdanpuGfOcIkUIvFJwUs/O26pPROERCETFj3wX1u1azcsr/vxZWrrO7uEUjc3nNo ewig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NdlZUggfG0fxjaA+cqLRw4yaCZJ4vPfUgkLv65iJoHU=; b=eF3kK0y3PXWGH4Gt2Yj2ge5lvnJb0+E8JO8LBNYMbqUUFzu8lScoNiCyKhmN++X+xs HiXOw3zeoICDqk/ZnGf68cu5vPPVqeLTLN6zFWKzQvoF2CdQQ8u3m9dOcezSV+QvPOKO aXMfVoQA2fy3xkEJsk0zAsjPKLgJ0xgkAaXbYOMbpTGdqoBMlHls9/Y8gnVMADKFnJEb re05aS7bvNxizZXoYXg8uvlCCaCsFDOBaaFdFMd37+QBl+BtivRQOL47g3qfdHmDhjFG Oacci1CGBWhUu5skdpYn5+GjGHEn8yQJjNH3sA8+TLHI8olOxo+mMB/xDk1H9yD2C6QT 2XDg== X-Gm-Message-State: ANoB5pk8840jjsrB4kKEBk4XAMtehzN2nYZsc+1rzI7ttuC+j8md+2yO ci64bWLk9EFdtN8jAE/IKWo= X-Received: by 2002:a17:907:a06f:b0:7ad:948f:11bb with SMTP id ia15-20020a170907a06f00b007ad948f11bbmr45884701ejc.354.1670020421905; Fri, 02 Dec 2022 14:33:41 -0800 (PST) Received: from xws.localdomain ([37.120.217.162]) by smtp.gmail.com with ESMTPSA id j17-20020a17090623f100b007c0d0dad9c6sm575340ejg.108.2022.12.02.14.33.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 14:33:41 -0800 (PST) From: Maximilian Luz To: Hans de Goede Cc: Maximilian Luz , Mark Gross , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/9] platform/surface: aggregator_hub: Use target-ID enum instead of hard-coding values Date: Fri, 2 Dec 2022 23:33:22 +0100 Message-Id: <20221202223327.690880-5-luzmaximilian@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221202223327.690880-1-luzmaximilian@gmail.com> References: <20221202223327.690880-1-luzmaximilian@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751143437335447106?= X-GMAIL-MSGID: =?utf-8?q?1751143437335447106?= Instead of hard-coding the target ID, use the respective enum ssam_ssh_tid value. Signed-off-by: Maximilian Luz --- drivers/platform/surface/surface_aggregator_hub.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/platform/surface/surface_aggregator_hub.c b/drivers/platform/surface/surface_aggregator_hub.c index 43061514be38..62f27cdb6ca8 100644 --- a/drivers/platform/surface/surface_aggregator_hub.c +++ b/drivers/platform/surface/surface_aggregator_hub.c @@ -214,7 +214,7 @@ static void ssam_hub_remove(struct ssam_device *sdev) SSAM_DEFINE_SYNC_REQUEST_R(ssam_bas_query_opmode, u8, { .target_category = SSAM_SSH_TC_BAS, - .target_id = 0x01, + .target_id = SSAM_SSH_TID_SAM, .command_id = 0x0d, .instance_id = 0x00, }); @@ -292,7 +292,7 @@ static const struct ssam_hub_desc base_hub = { SSAM_DEFINE_SYNC_REQUEST_R(__ssam_kip_query_state, u8, { .target_category = SSAM_SSH_TC_KIP, - .target_id = 0x01, + .target_id = SSAM_SSH_TID_SAM, .command_id = 0x2c, .instance_id = 0x00, }); From patchwork Fri Dec 2 22:33:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maximilian Luz X-Patchwork-Id: 29131 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1102198wrr; Fri, 2 Dec 2022 14:35:25 -0800 (PST) X-Google-Smtp-Source: AA0mqf4eH2yzova8TSDOGQnQctPT3UOf/dFHpSSPJhAR5a05bJ2GOKnApsOu+j6vm5y/iAWqgzCZ X-Received: by 2002:a17:906:3145:b0:7b5:665a:fca5 with SMTP id e5-20020a170906314500b007b5665afca5mr8658910eje.10.1670020525751; Fri, 02 Dec 2022 14:35:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670020525; cv=none; d=google.com; s=arc-20160816; b=qPCmAFwGz5kBURDUiW3KT5JDMTFD1seBgphfgQToiOi9u7tTTpt3HszQ0o/BkYkbNz k2WBatL85uoHP4ij8hA6/YpSsuia/17buipeFBIe5ji2FZEFqDZO+BEQAOSk8tnxk+ph vOh+F51zvvbGYgb+6WKAZSUNqG5O8oroHMk3zOaxplwming+mFB6EI1td3lyvoT0JQIx 80wXV0+8Y2DCD3t5fMU3BrA+w21bprTKqjHvfB+sGt+1XFDQtrzhlZ0sVVKqOWClT4EX xjcL81jZkQj/kDNsbkiHoxsndbSpcXVgAgo0tuOvGiQuJ1xwmbB1lTsGRZbCbHVj9jrp vjqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=JJBRCJuPeD4sVOppZ4nKmrCrzkzn8rXvXzlwDq8fCmI=; b=tONSC8/nNX17dL4+A7DtC3WOEKcYHEhEZQK5zKbbxksFxQpFmSx3WCdhFBG+ECPu5O BAClIHly2Gm1NlVh+drEGVYa8oNuMMce8YsG9A6LMsmhWRoQHHcKPeBhsN1ept0+ye45 V5hGg1YnDJ8iJ94TjnKRuNe5qdIyhWLBJn18dLrN6ugmgTNvSumUj9iIhLZb3hn/wtyb c+gQNu6wR1kfbH0w33vQcb0UsNX+zgCvXccIQ3tRKYj4V8oCKjSQGjIssfnD0LHIA9K3 1RSpTGkbD8v0Tmay7FC6iUb00s/4tJlTKWLrOGfKd9IBfJr0EXHJlvE95gVXYLweAT44 bjRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=GGe+iTwG; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w18-20020aa7dcd2000000b0044ee4ec8915si3254455edu.39.2022.12.02.14.35.02; Fri, 02 Dec 2022 14:35:25 -0800 (PST) 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=@gmail.com header.s=20210112 header.b=GGe+iTwG; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234923AbiLBWeC (ORCPT + 99 others); Fri, 2 Dec 2022 17:34:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234786AbiLBWdr (ORCPT ); Fri, 2 Dec 2022 17:33:47 -0500 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7811AECA1B; Fri, 2 Dec 2022 14:33:43 -0800 (PST) Received: by mail-ed1-x52d.google.com with SMTP id d20so8324568edn.0; Fri, 02 Dec 2022 14:33:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JJBRCJuPeD4sVOppZ4nKmrCrzkzn8rXvXzlwDq8fCmI=; b=GGe+iTwGyOOaFKNTDlCAjR6dKR8wb5gMcZ/dMjIhA46ZT6K3stZiPKFn9fWRmgFGb3 FLAJj/dwDbeywMhmpk36ITl9i7nP2/mPrUuzzQwlTfFwcWJkE0X9G0nJRyGa+DzvIkY1 pqBYLiaXsGTGJ1X+RcZnEmnYsyF5e4Nphz2CpKT1zcLyvGlAoqJEwBryRTiZDJDfccH2 wvbdTjZNf29D6bae/165/3v0hU39Xw6nlBi0y+wm/yD9Fl1lqKBNOJDMRZoa7L7vpB+5 lP/wMW2xkGOADRNqRu6nf0IiwYg+Cm1C0xqV5DdKnmpTxk3TP/gsdre3tfwJ67wCePai Q8pQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JJBRCJuPeD4sVOppZ4nKmrCrzkzn8rXvXzlwDq8fCmI=; b=7/SOencGnXoZm2TI246WLw1Bg3vgNfzNZOR9XpYn405safYP48ssmqqE/nDZzlooS1 7xMBuzuj7ipNYDo4Zkaka+OTrkL0dLfO9deK2RIaA1NBYRl3YK2n29ngyXUOpbYzf0ar khWPAE9da0d5zTCnwlwe5g2cc6y5NCnnCAEWERoML9uZtJzWYjw48lw2bb+Oq/i0zrq0 j/QPw7Qdp6bL+4Zkzv3Bwq4bHN6frR+zBcNkFIYyq8OtHWTTmm3RCvgSMKJ10RE7a0Ug sv7hUvnaHx+nHwKISz3NnWEmzc0bY+u4AM4L+0gOaifHCqk2y7lXCfHiXRWn0OUJo3vP q1uA== X-Gm-Message-State: ANoB5plOLDXRPKlAkwkvEXsx3effW2+MwqOBESKDZJexeM8pMYGVgbsz fbfTawXzS3glPVrTroaWqFs= X-Received: by 2002:a05:6402:144f:b0:46b:51e5:832a with SMTP id d15-20020a056402144f00b0046b51e5832amr21328502edx.331.1670020423103; Fri, 02 Dec 2022 14:33:43 -0800 (PST) Received: from xws.localdomain ([37.120.217.162]) by smtp.gmail.com with ESMTPSA id j17-20020a17090623f100b007c0d0dad9c6sm575340ejg.108.2022.12.02.14.33.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 14:33:42 -0800 (PST) From: Maximilian Luz To: Hans de Goede Cc: Maximilian Luz , Mark Gross , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/9] platform/surface: aggregator_tabletsw: Use target-ID enum instead of hard-coding values Date: Fri, 2 Dec 2022 23:33:23 +0100 Message-Id: <20221202223327.690880-6-luzmaximilian@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221202223327.690880-1-luzmaximilian@gmail.com> References: <20221202223327.690880-1-luzmaximilian@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751143442917853059?= X-GMAIL-MSGID: =?utf-8?q?1751143442917853059?= Instead of hard-coding the target ID, use the respective enum ssam_ssh_tid value. Signed-off-by: Maximilian Luz --- drivers/platform/surface/surface_aggregator_tabletsw.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/platform/surface/surface_aggregator_tabletsw.c b/drivers/platform/surface/surface_aggregator_tabletsw.c index 27d95a6a7851..bd8cd453c393 100644 --- a/drivers/platform/surface/surface_aggregator_tabletsw.c +++ b/drivers/platform/surface/surface_aggregator_tabletsw.c @@ -247,7 +247,7 @@ static bool ssam_kip_cover_state_is_tablet_mode(struct ssam_tablet_sw *sw, u32 s SSAM_DEFINE_SYNC_REQUEST_R(__ssam_kip_get_cover_state, u8, { .target_category = SSAM_SSH_TC_KIP, - .target_id = 0x01, + .target_id = SSAM_SSH_TID_SAM, .command_id = 0x1d, .instance_id = 0x00, }); @@ -371,7 +371,7 @@ static int ssam_pos_get_sources_list(struct ssam_tablet_sw *sw, struct ssam_sour int status; rqst.target_category = SSAM_SSH_TC_POS; - rqst.target_id = 0x01; + rqst.target_id = SSAM_SSH_TID_SAM; rqst.command_id = 0x01; rqst.instance_id = 0x00; rqst.flags = SSAM_REQUEST_HAS_RESPONSE; @@ -430,7 +430,7 @@ static int ssam_pos_get_source(struct ssam_tablet_sw *sw, u32 *source_id) SSAM_DEFINE_SYNC_REQUEST_WR(__ssam_pos_get_posture_for_source, __le32, __le32, { .target_category = SSAM_SSH_TC_POS, - .target_id = 0x01, + .target_id = SSAM_SSH_TID_SAM, .command_id = 0x02, .instance_id = 0x00, }); From patchwork Fri Dec 2 22:33:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maximilian Luz X-Patchwork-Id: 29134 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1102739wrr; Fri, 2 Dec 2022 14:37:18 -0800 (PST) X-Google-Smtp-Source: AA0mqf7s7AUD6UzNwX3IyEJeDdh/6V44nhL9dhLB2RD2GyxhikymHVnZke8P0BukyyyHyoiTjI3I X-Received: by 2002:a17:906:5583:b0:78d:b3ef:656c with SMTP id y3-20020a170906558300b0078db3ef656cmr44575471ejp.627.1670020638467; Fri, 02 Dec 2022 14:37:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670020638; cv=none; d=google.com; s=arc-20160816; b=PSd95+a9i0Jc/S5PaQnXgrLIL5XkR0dBzptE6PdWFrmNNNTHsiq9OLGVovcLI0hbtk B/tnLJTtBbGrYEAwDd8BbDy07/h6s/zfvaUuhmBv4D7ZsDyv+9ztYewxE+4joJYKW6ed xf2AuAABtRWXe5rsiUMyKHHS8yiOLmWnSXFxvchz+lfTB5lnfdalG/H6ijRtNPD0S4EQ bid/58VGNf8/D3M7uU0OcZJBzEuJtx7Wkv2zl4rQWJNAzMN7y3NLS7CAeKofHJj2w7tU X9FjLJ8SzczMUgU6hWoCgdRzWTN5PDd1b+LdzrfH8zJ4BMOuOUrn+oG8JDC90iT8g6kh cRKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=o4RJx9RRdpMAE8kiYEvU6NCFJlSYb1Rttu5ZW2+HQ2Q=; b=aIaZcd+vpKlYQ372u8HkTypUqB9vwAv6BtYjOUqWECIuXvoa4Hgw8ntVnYjWTML8mG IXyJmuDHbKyQu7EcjP6FXQiulqHGaUlMSWu8Iw9VhJhLLYp2bEcyomD+gSrf+J0y60Er YEdHqdaidtyH9/TUmCsik4Jt1cedkNHo7Ul8bvJ3uGU7+hQp9t6ZVx5QNhXjrxRkROYR it319N36oi4WOtFKnMNiwJq3EK+nlplvCyTkccA0CQOiiv/vFdXdG9WXMcV0j95MOzOV 2OSm9ZKiOczpe3v+PELKYy/I71oERQcb8DpWppPfK7yv/+mGHkeyawHNg9gZyA02chTJ Eu8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=aemu7vqZ; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t13-20020a170906178d00b007af13652caasi5535549eje.325.2022.12.02.14.36.55; Fri, 02 Dec 2022 14:37:18 -0800 (PST) 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=@gmail.com header.s=20210112 header.b=aemu7vqZ; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234941AbiLBWeO (ORCPT + 99 others); Fri, 2 Dec 2022 17:34:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234894AbiLBWdv (ORCPT ); Fri, 2 Dec 2022 17:33:51 -0500 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CA7FF81B5; Fri, 2 Dec 2022 14:33:45 -0800 (PST) Received: by mail-ed1-x52c.google.com with SMTP id e13so8205981edj.7; Fri, 02 Dec 2022 14:33:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=o4RJx9RRdpMAE8kiYEvU6NCFJlSYb1Rttu5ZW2+HQ2Q=; b=aemu7vqZtiB00kfnuBczj8M5Jjt6opfkZZiQURopS8WTh114XJm+FB1JHceAShBaLB ZgkdiGRyKQJ7NG/+ABojtF6sHjopjfHz0hqlqVEz0Ha71rcdNwSGh96VcEL/hhplEwaj q6bb2yWb+i2mQ0Am2ALMVma3hb62djZuahu1oTM7LugrcvTBjhyAzH0pwHImNuzCRnzN gBkfnFW10oLo6tUDpxsoyhaFC5ZTbf3l8lP0j3TnZeU6x+eGrNWuCiiboFgLN/up/GTY j09AG3V7u/HWVLNvGCFstqSpqDcfzJiwktht/1ckQOXGSoqs1Cbbi90tVh7P2B2EDcHy f7Qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=o4RJx9RRdpMAE8kiYEvU6NCFJlSYb1Rttu5ZW2+HQ2Q=; b=My/4YTbkufUYN9kIMlNtKTPV6FDwJ3ZaEZ1Md+Ljv4I80Odmm8ndbzpmkdxMrlbAf5 YcyztF55l76srjrMVY0eTlMqaCkwb+N1H1Xw1MjLmV26en2F2OHh35MIJ88PPR8g6/XH MvkHZpDIz9TY/2TBfYWX8fIh/q+DrvcJaHYughl9lEzX555CwILQ2vEAhdxBMKOLCgof BshQKAwbg5ktYNflLzePesOV81oS7zJBUvaMTI6ktZsOwp07UFsUYroR6B6nr1Tw0FTH RBOvnQWaKIkEle49jiXROZxGfhLuQONbQew89I94pJaoZX03Jit/NysUVDvCr7cFlT08 2Oiw== X-Gm-Message-State: ANoB5pkdyGCeeis1ZfaCiIwk5EH2eJuXjNuUClf852IwsFmP5wAkxy20 s/KX2BydJ6hGiqfbLVvVdHA= X-Received: by 2002:aa7:cd04:0:b0:46b:34c:5574 with SMTP id b4-20020aa7cd04000000b0046b034c5574mr27293913edw.175.1670020424225; Fri, 02 Dec 2022 14:33:44 -0800 (PST) Received: from xws.localdomain ([37.120.217.162]) by smtp.gmail.com with ESMTPSA id j17-20020a17090623f100b007c0d0dad9c6sm575340ejg.108.2022.12.02.14.33.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 14:33:43 -0800 (PST) From: Maximilian Luz To: Hans de Goede Cc: Maximilian Luz , Mark Gross , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 6/9] platform/surface: dtx: Use target-ID enum instead of hard-coding values Date: Fri, 2 Dec 2022 23:33:24 +0100 Message-Id: <20221202223327.690880-7-luzmaximilian@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221202223327.690880-1-luzmaximilian@gmail.com> References: <20221202223327.690880-1-luzmaximilian@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751143560938545240?= X-GMAIL-MSGID: =?utf-8?q?1751143560938545240?= Instead of hard-coding the target ID, use the respective enum ssam_ssh_tid value. Signed-off-by: Maximilian Luz --- drivers/platform/surface/surface_dtx.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/platform/surface/surface_dtx.c b/drivers/platform/surface/surface_dtx.c index ed36944467f9..0de76a784a35 100644 --- a/drivers/platform/surface/surface_dtx.c +++ b/drivers/platform/surface/surface_dtx.c @@ -71,63 +71,63 @@ static_assert(sizeof(struct ssam_bas_base_info) == 2); SSAM_DEFINE_SYNC_REQUEST_N(ssam_bas_latch_lock, { .target_category = SSAM_SSH_TC_BAS, - .target_id = 0x01, + .target_id = SSAM_SSH_TID_SAM, .command_id = 0x06, .instance_id = 0x00, }); SSAM_DEFINE_SYNC_REQUEST_N(ssam_bas_latch_unlock, { .target_category = SSAM_SSH_TC_BAS, - .target_id = 0x01, + .target_id = SSAM_SSH_TID_SAM, .command_id = 0x07, .instance_id = 0x00, }); SSAM_DEFINE_SYNC_REQUEST_N(ssam_bas_latch_request, { .target_category = SSAM_SSH_TC_BAS, - .target_id = 0x01, + .target_id = SSAM_SSH_TID_SAM, .command_id = 0x08, .instance_id = 0x00, }); SSAM_DEFINE_SYNC_REQUEST_N(ssam_bas_latch_confirm, { .target_category = SSAM_SSH_TC_BAS, - .target_id = 0x01, + .target_id = SSAM_SSH_TID_SAM, .command_id = 0x09, .instance_id = 0x00, }); SSAM_DEFINE_SYNC_REQUEST_N(ssam_bas_latch_heartbeat, { .target_category = SSAM_SSH_TC_BAS, - .target_id = 0x01, + .target_id = SSAM_SSH_TID_SAM, .command_id = 0x0a, .instance_id = 0x00, }); SSAM_DEFINE_SYNC_REQUEST_N(ssam_bas_latch_cancel, { .target_category = SSAM_SSH_TC_BAS, - .target_id = 0x01, + .target_id = SSAM_SSH_TID_SAM, .command_id = 0x0b, .instance_id = 0x00, }); SSAM_DEFINE_SYNC_REQUEST_R(ssam_bas_get_base, struct ssam_bas_base_info, { .target_category = SSAM_SSH_TC_BAS, - .target_id = 0x01, + .target_id = SSAM_SSH_TID_SAM, .command_id = 0x0c, .instance_id = 0x00, }); SSAM_DEFINE_SYNC_REQUEST_R(ssam_bas_get_device_mode, u8, { .target_category = SSAM_SSH_TC_BAS, - .target_id = 0x01, + .target_id = SSAM_SSH_TID_SAM, .command_id = 0x0d, .instance_id = 0x00, }); SSAM_DEFINE_SYNC_REQUEST_R(ssam_bas_get_latch_status, u8, { .target_category = SSAM_SSH_TC_BAS, - .target_id = 0x01, + .target_id = SSAM_SSH_TID_SAM, .command_id = 0x11, .instance_id = 0x00, }); From patchwork Fri Dec 2 22:33:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maximilian Luz X-Patchwork-Id: 29133 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1102431wrr; Fri, 2 Dec 2022 14:36:18 -0800 (PST) X-Google-Smtp-Source: AA0mqf4HVTQH5tL92eLsd2kAmw0oXpBlgKFTUoa3913S92WH7LJPXfanUYk2e0NXWVJo3h+MqDwd X-Received: by 2002:a17:906:99d6:b0:7c0:c91c:5d38 with SMTP id s22-20020a17090699d600b007c0c91c5d38mr3124305ejn.50.1670020578650; Fri, 02 Dec 2022 14:36:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670020578; cv=none; d=google.com; s=arc-20160816; b=jNuwiJKh9zvJvSMBydH7vsteIVLD60QbIEonEbZdZPCLlIIHd0SSydMgC1aaEb1206 FEyWCbS8yJ90vF6lu8f/dBNlyHAL7olzU8eiRQakz1sVNAYdpeztKQroZPihrctjb77h DC3v1QHX8exsX+TqhcvhCdxpQz9BYHgGuGbEv6d94PYnksU0u2lRBguzWe/7zqW2cvI/ uoR3zbnTZ/6b/bscL2/gJzlrHn6cDwV1eBHKwYwLVFMreXTh9O8CRiB5S0PURXxCtAoa wXSLfvM+/znLwyAJo2rvO2oyR3/+an4lIPkx2WsDwkTpv6chy0HDSx4D6c2y4DmymTL1 ztXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=mQeLaykTQhLHe0LY2chW9NXtLPDLXYYg3zfnSmdV2ko=; b=MOJOlQNEFUgyoTLX3kuWgiL4IKzYGhx/xLDNTs/T1t9Ee48OH+iDaLTRXiWFpXLJNK qh9oIh8va3vcuSi5q6d+WACyRtmxsZhPmC4sqbUq7EuiHLjf479iAHQl+GLWuQHCn+SO n+vuIbjtJTfjmWJ7snq2mWZ7qTz9N7wSLzfZDs6BILaQUkYe7ukThLpuLQk5CviAfj0t CiSJKq7SEaDYxaJRdXSQ3jZtDyqnOhw9Qb2X7zF+18nK1gwMouzhKZ5RpKTvtDFX2iUF P5pJ64JB/T36KWuJq+3ruzOftXS1PLsMwz5msCl2aLKkcgZY12BmLTSSbEPLgRs2W3uT /G4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=O61y9WQ0; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sc15-20020a1709078a0f00b007ad6a0afbc6si3544709ejc.7.2022.12.02.14.35.55; Fri, 02 Dec 2022 14:36:18 -0800 (PST) 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=@gmail.com header.s=20210112 header.b=O61y9WQ0; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234927AbiLBWeS (ORCPT + 99 others); Fri, 2 Dec 2022 17:34:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234859AbiLBWdy (ORCPT ); Fri, 2 Dec 2022 17:33:54 -0500 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0608AEBCB2; Fri, 2 Dec 2022 14:33:47 -0800 (PST) Received: by mail-ej1-x631.google.com with SMTP id b2so14647118eja.7; Fri, 02 Dec 2022 14:33:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mQeLaykTQhLHe0LY2chW9NXtLPDLXYYg3zfnSmdV2ko=; b=O61y9WQ0DLbLKnd/RASQLvTLxHIYdc9PRDkhd1Wc7w8o4N3S9Z+7SS1+lSeh4zCXY+ PySt5j/g49kBZeOmBGFJ9KaJROd4z5SCVYNIzv5HUeqfVlhjy0P7PCtXRJtp8uIvK9bn JhNnfvU23O9/Z+isN5sDxEoA6PAHnbLXhudmM/o4Z5xjqHrB7rtiMt6hAvQTxKZxnAk5 KRN/HQVwmhXcjpy4G4Ei735Vis9bq8XcK14otmfrMqUmPLnbJCmnLBZ9G+x/npQzsfzc f6bq4gspDnBwNbYdQDbDeBZh0agYEEvz5V7DW4sl0dqxwQCmcQgyXVTxt677Ch0nsCjr xcZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mQeLaykTQhLHe0LY2chW9NXtLPDLXYYg3zfnSmdV2ko=; b=wzmlC+ElPU5R972zeHMS9pE7llqP40tt6nCY7hXOmrdNM8ccesxzLjf3P+2HFVarJT VdbZ7wMx5N24s2lIa9ctPfdpBvEanOXTlGKvcGOR2vP5DDBmRsz9d+1tNnEuWqJw+769 sK/iSwlRHdfB86KcIUU14tgZ0xY66Nvb8ygKlAHCbWr43DIKZ/WQvPAI7gnkUhOMyIOm yJvsbvSt0XqFC5xPIF13rW4/JNgKHzlUJ85J5a4Pp91nueTqkz9J+OJk2WJxf3i/M+gP hF/ufPh3NTMYWFdjt7X9esuGTQ+kirZ0I+YEAttwVG4It82UNkGJ7Q3/JvnBmJeZCEVc x4xQ== X-Gm-Message-State: ANoB5pm+K+DZ8EjqjNA4BvBfLQdBJgCpwfkmwKJJgFvPCO2XFSYisXuu gasjpCHM4z1JVntwcHnI1NQ= X-Received: by 2002:a17:906:5dcd:b0:7bf:707a:7247 with SMTP id p13-20020a1709065dcd00b007bf707a7247mr22734535ejv.196.1670020425570; Fri, 02 Dec 2022 14:33:45 -0800 (PST) Received: from xws.localdomain ([37.120.217.162]) by smtp.gmail.com with ESMTPSA id j17-20020a17090623f100b007c0d0dad9c6sm575340ejg.108.2022.12.02.14.33.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 14:33:45 -0800 (PST) From: Maximilian Luz To: Hans de Goede , Jiri Kosina , Benjamin Tissoires Cc: Maximilian Luz , Mark Gross , linux-input@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 7/9] HID: surface-hid: Use target-ID enum instead of hard-coding values Date: Fri, 2 Dec 2022 23:33:25 +0100 Message-Id: <20221202223327.690880-8-luzmaximilian@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221202223327.690880-1-luzmaximilian@gmail.com> References: <20221202223327.690880-1-luzmaximilian@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751143498295286772?= X-GMAIL-MSGID: =?utf-8?q?1751143498295286772?= Instead of hard-coding the target ID, use the respective enum ssam_ssh_tid value. Signed-off-by: Maximilian Luz --- drivers/hid/surface-hid/surface_kbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hid/surface-hid/surface_kbd.c b/drivers/hid/surface-hid/surface_kbd.c index 0635341bc517..42933bf3e925 100644 --- a/drivers/hid/surface-hid/surface_kbd.c +++ b/drivers/hid/surface-hid/surface_kbd.c @@ -250,7 +250,7 @@ static int surface_kbd_probe(struct platform_device *pdev) shid->uid.domain = SSAM_DOMAIN_SERIALHUB; shid->uid.category = SSAM_SSH_TC_KBD; - shid->uid.target = 2; + shid->uid.target = SSAM_SSH_TID_KIP; shid->uid.instance = 0; shid->uid.function = 0; From patchwork Fri Dec 2 22:33:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maximilian Luz X-Patchwork-Id: 29132 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1102395wrr; Fri, 2 Dec 2022 14:36:13 -0800 (PST) X-Google-Smtp-Source: AA0mqf55HQcUfX4ik5oa/QondkDevQxQzrsH1UD+scOKFFVwb4LNY/Za9usRkOFz6RtFR9HJyLgf X-Received: by 2002:a17:906:94c1:b0:7c0:68c8:19db with SMTP id d1-20020a17090694c100b007c068c819dbmr21163384ejy.485.1670020573382; Fri, 02 Dec 2022 14:36:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670020573; cv=none; d=google.com; s=arc-20160816; b=YyuC5l7anku+Z/FWCZ/mzyzP+PhDi+gdXOC7KdAL24RnI83UMhLwF8S2ty/uOlxH1g si+w+k5KVomlII53aFZ3jHdLBBm9ouWAMXwXtAqWX2zIiG/scXX5t+3J163XwKST6KPR LsQ5q+4kcrWnhcn2BNsgkvc9Vb3qQQDk+uLXiytcUFqrGk/vurBdZ7D7KY35hCMNOChi /YMw+Scb5OzG8K0AktWgbn1PBMtVZRQ/x987+6/SpgLqpCwbiKdnqts7awzfREj7MTCh 0YDqA4lTtFeP2X9j9kkG7tFCdyMzyOo/iJ3Tqv+3dwNX42J3OO/PcwLrFb3ZSDuHl7vO Mu5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=AvtD66Z6AMevOIHQl87ix4bKuxbdxW7Yl3ZiVOzqn1s=; b=XHlVXA0w2XvYrRqcBOBvq0TASphGYcyhpI/V5SsfuVYgX7glIt6Mf0wXeV32DGQ0PJ nmFFI0n5wwRjrLeaXZVhW7PVkyxuX7Y9Jc2IZ2shRDsRsONsi8oIQS3GzXNnOAXe0bby Z3tWx+wQ6ZRe8UopKcPmxUDHZxERrL4aBvfqAsJbKH7gYL+MTG9tlOi7PFxcrwZ4hjzY CPOfh36VaiyluVxO+JNnr058nzcYElcToeFLOQ5QybGHGAOm9Ij9hIODsbSBg3l3NNsQ m7F6OXOb66GID5hkDMJ69shTW7/Tk7d7cDOQVRIllRVpb3OIGzN21P3Ba+L5uxy+LVr5 5qTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=onbNhJnM; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id he41-20020a1709073da900b007a71a3cb3afsi8289847ejc.294.2022.12.02.14.35.50; Fri, 02 Dec 2022 14:36:13 -0800 (PST) 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=@gmail.com header.s=20210112 header.b=onbNhJnM; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234974AbiLBWeY (ORCPT + 99 others); Fri, 2 Dec 2022 17:34:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234930AbiLBWeM (ORCPT ); Fri, 2 Dec 2022 17:34:12 -0500 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64C23F9330; Fri, 2 Dec 2022 14:33:48 -0800 (PST) Received: by mail-ed1-x52b.google.com with SMTP id z92so8294275ede.1; Fri, 02 Dec 2022 14:33:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=AvtD66Z6AMevOIHQl87ix4bKuxbdxW7Yl3ZiVOzqn1s=; b=onbNhJnMyZ+8g+RqwYEtI5LUuGm5EaY3OYGEG/i3dyOUFzxfQVtt9wpjHide7Tiux6 DXVh5Yg+UQ4zpo3SDj2CogD/JEA1s993jZ/F/u9HWhRsWBe7jMmeLKFLR9Q3V+ab2+i4 R+tJ29xQEg0y4Vo8L0mLyLk0ZmGISLEIorXZ+61YpXq4ywavdOP9JZl5x9o59uUHYzYs NXGiQmdwIaO9gqLumQRbxEFv83QlO4srIxeqeZJmr4rpT1YBsMFbUwcK2QZF6q/tBPB4 zSj2bqjp7Du+JgTVT7S7row768nyoupX2YE71UgWntsYhxdrTnGIn7ZJV5gbJqDzJ5Bd k52g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AvtD66Z6AMevOIHQl87ix4bKuxbdxW7Yl3ZiVOzqn1s=; b=ZPoQEtB+hnZofmPEloCpVoTC2OHhV1ygzbJTrGVR4iKEnCBb6Y5f/Ve0InK6aE2eCW 9V/ri7Q1XGrHmyYucIhusg4qGfO6J/6+c6GORo+398FFXyM3wXwJ/Oix7MW3A2CvVeff YL27fYvN4RIu5QWc45OGWBe0g/siu5LGP01+Q9ofMzHcB+sRqr3CrSG38FVEDYw/y6vw ntR+RYuGD4asXu8SDNa3W9Vrn0P8MjoKew3QNw8XV5VW7s/CwAjQUkZeNuwODTgMNahq rFT264DR9/AQDswd5L95httkjZp8djd1rQdPJDe4ZMHsFLaXE3cRxNUrpyyKliYoWLfy v6KA== X-Gm-Message-State: ANoB5plz5sWmDaM60AtMqMs4hgKnKX2x2UsQQYo7N/6saz+SI3L6mjxC Fo1yo7WAg4pWQ9yzbZoEmBc= X-Received: by 2002:a05:6402:100b:b0:461:f1c6:1f22 with SMTP id c11-20020a056402100b00b00461f1c61f22mr52417880edu.95.1670020426873; Fri, 02 Dec 2022 14:33:46 -0800 (PST) Received: from xws.localdomain ([37.120.217.162]) by smtp.gmail.com with ESMTPSA id j17-20020a17090623f100b007c0d0dad9c6sm575340ejg.108.2022.12.02.14.33.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 14:33:46 -0800 (PST) From: Maximilian Luz To: Hans de Goede , Jiri Kosina , Benjamin Tissoires , Sebastian Reichel Cc: Maximilian Luz , Mark Gross , platform-driver-x86@vger.kernel.org, linux-input@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 8/9] platform/surface: aggregator: Enforce use of target-ID enum in device ID macros Date: Fri, 2 Dec 2022 23:33:26 +0100 Message-Id: <20221202223327.690880-9-luzmaximilian@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221202223327.690880-1-luzmaximilian@gmail.com> References: <20221202223327.690880-1-luzmaximilian@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751143493031309835?= X-GMAIL-MSGID: =?utf-8?q?1751143493031309835?= Similar to the target category (TC), the target ID (TID) can be one value out of a small number of choices, given in enum ssam_ssh_tid. In the device ID macros, SSAM_SDEV() and SSAM_VDEV() we already use text expansion to, both, remove some textual clutter for the target category values and enforce that the value belongs to the known set. Now that we know the names for the target IDs, use the same trick for them as well. Also rename the SSAM_ANY_x macros to SSAM_SSH_x_ANY to better fit in. Signed-off-by: Maximilian Luz Acked-by: Sebastian Reichel --- drivers/hid/surface-hid/surface_hid.c | 2 +- .../platform/surface/surface_aggregator_hub.c | 4 +- .../surface/surface_aggregator_tabletsw.c | 4 +- drivers/platform/surface/surface_dtx.c | 2 +- .../surface/surface_platform_profile.c | 2 +- drivers/power/supply/surface_battery.c | 4 +- drivers/power/supply/surface_charger.c | 2 +- include/linux/surface_aggregator/device.h | 50 +++++++++---------- 8 files changed, 35 insertions(+), 35 deletions(-) diff --git a/drivers/hid/surface-hid/surface_hid.c b/drivers/hid/surface-hid/surface_hid.c index d4aa8c81903a..aa80d83a83d1 100644 --- a/drivers/hid/surface-hid/surface_hid.c +++ b/drivers/hid/surface-hid/surface_hid.c @@ -230,7 +230,7 @@ static void surface_hid_remove(struct ssam_device *sdev) } static const struct ssam_device_id surface_hid_match[] = { - { SSAM_SDEV(HID, SSAM_ANY_TID, SSAM_ANY_IID, 0x00) }, + { SSAM_SDEV(HID, ANY, SSAM_SSH_IID_ANY, 0x00) }, { }, }; MODULE_DEVICE_TABLE(ssam, surface_hid_match); diff --git a/drivers/platform/surface/surface_aggregator_hub.c b/drivers/platform/surface/surface_aggregator_hub.c index 62f27cdb6ca8..6abd1efe2088 100644 --- a/drivers/platform/surface/surface_aggregator_hub.c +++ b/drivers/platform/surface/surface_aggregator_hub.c @@ -348,8 +348,8 @@ static const struct ssam_hub_desc kip_hub = { /* -- Driver registration. -------------------------------------------------- */ static const struct ssam_device_id ssam_hub_match[] = { - { SSAM_VDEV(HUB, 0x01, SSAM_SSH_TC_KIP, 0x00), (unsigned long)&kip_hub }, - { SSAM_VDEV(HUB, 0x02, SSAM_SSH_TC_BAS, 0x00), (unsigned long)&base_hub }, + { SSAM_VDEV(HUB, SAM, SSAM_SSH_TC_KIP, 0x00), (unsigned long)&kip_hub }, + { SSAM_VDEV(HUB, KIP, SSAM_SSH_TC_BAS, 0x00), (unsigned long)&base_hub }, { } }; MODULE_DEVICE_TABLE(ssam, ssam_hub_match); diff --git a/drivers/platform/surface/surface_aggregator_tabletsw.c b/drivers/platform/surface/surface_aggregator_tabletsw.c index bd8cd453c393..6147aa887939 100644 --- a/drivers/platform/surface/surface_aggregator_tabletsw.c +++ b/drivers/platform/surface/surface_aggregator_tabletsw.c @@ -510,8 +510,8 @@ static const struct ssam_tablet_sw_desc ssam_pos_sw_desc = { /* -- Driver registration. -------------------------------------------------- */ static const struct ssam_device_id ssam_tablet_sw_match[] = { - { SSAM_SDEV(KIP, 0x01, 0x00, 0x01), (unsigned long)&ssam_kip_sw_desc }, - { SSAM_SDEV(POS, 0x01, 0x00, 0x01), (unsigned long)&ssam_pos_sw_desc }, + { SSAM_SDEV(KIP, SAM, 0x00, 0x01), (unsigned long)&ssam_kip_sw_desc }, + { SSAM_SDEV(POS, SAM, 0x00, 0x01), (unsigned long)&ssam_pos_sw_desc }, { }, }; MODULE_DEVICE_TABLE(ssam, ssam_tablet_sw_match); diff --git a/drivers/platform/surface/surface_dtx.c b/drivers/platform/surface/surface_dtx.c index 0de76a784a35..30cbde278c59 100644 --- a/drivers/platform/surface/surface_dtx.c +++ b/drivers/platform/surface/surface_dtx.c @@ -1214,7 +1214,7 @@ static void surface_dtx_ssam_remove(struct ssam_device *sdev) } static const struct ssam_device_id surface_dtx_ssam_match[] = { - { SSAM_SDEV(BAS, 0x01, 0x00, 0x00) }, + { SSAM_SDEV(BAS, SAM, 0x00, 0x00) }, { }, }; MODULE_DEVICE_TABLE(ssam, surface_dtx_ssam_match); diff --git a/drivers/platform/surface/surface_platform_profile.c b/drivers/platform/surface/surface_platform_profile.c index fbf2e11fd6ce..f433a13c3689 100644 --- a/drivers/platform/surface/surface_platform_profile.c +++ b/drivers/platform/surface/surface_platform_profile.c @@ -169,7 +169,7 @@ static void surface_platform_profile_remove(struct ssam_device *sdev) } static const struct ssam_device_id ssam_platform_profile_match[] = { - { SSAM_SDEV(TMP, 0x01, 0x00, 0x01) }, + { SSAM_SDEV(TMP, SAM, 0x00, 0x01) }, { }, }; MODULE_DEVICE_TABLE(ssam, ssam_platform_profile_match); diff --git a/drivers/power/supply/surface_battery.c b/drivers/power/supply/surface_battery.c index 540707882bb0..19d2f8834e56 100644 --- a/drivers/power/supply/surface_battery.c +++ b/drivers/power/supply/surface_battery.c @@ -852,8 +852,8 @@ static const struct spwr_psy_properties spwr_psy_props_bat2_sb3 = { }; static const struct ssam_device_id surface_battery_match[] = { - { SSAM_SDEV(BAT, 0x01, 0x01, 0x00), (unsigned long)&spwr_psy_props_bat1 }, - { SSAM_SDEV(BAT, 0x02, 0x01, 0x00), (unsigned long)&spwr_psy_props_bat2_sb3 }, + { SSAM_SDEV(BAT, SAM, 0x01, 0x00), (unsigned long)&spwr_psy_props_bat1 }, + { SSAM_SDEV(BAT, KIP, 0x01, 0x00), (unsigned long)&spwr_psy_props_bat2_sb3 }, { }, }; MODULE_DEVICE_TABLE(ssam, surface_battery_match); diff --git a/drivers/power/supply/surface_charger.c b/drivers/power/supply/surface_charger.c index 59182d55742d..cabdd8da12d0 100644 --- a/drivers/power/supply/surface_charger.c +++ b/drivers/power/supply/surface_charger.c @@ -260,7 +260,7 @@ static const struct spwr_psy_properties spwr_psy_props_adp1 = { }; static const struct ssam_device_id surface_ac_match[] = { - { SSAM_SDEV(BAT, 0x01, 0x01, 0x01), (unsigned long)&spwr_psy_props_adp1 }, + { SSAM_SDEV(BAT, SAM, 0x01, 0x01), (unsigned long)&spwr_psy_props_adp1 }, { }, }; MODULE_DEVICE_TABLE(ssam, surface_ac_match); diff --git a/include/linux/surface_aggregator/device.h b/include/linux/surface_aggregator/device.h index 46c45d1b6368..4da20b7a0ee5 100644 --- a/include/linux/surface_aggregator/device.h +++ b/include/linux/surface_aggregator/device.h @@ -68,9 +68,9 @@ struct ssam_device_uid { * match_flags member of the device ID structure. Do not use them directly * with struct ssam_device_id or struct ssam_device_uid. */ -#define SSAM_ANY_TID 0xffff -#define SSAM_ANY_IID 0xffff -#define SSAM_ANY_FUN 0xffff +#define SSAM_SSH_TID_ANY 0xffff +#define SSAM_SSH_IID_ANY 0xffff +#define SSAM_SSH_FUN_ANY 0xffff /** * SSAM_DEVICE() - Initialize a &struct ssam_device_id with the given @@ -83,25 +83,25 @@ struct ssam_device_uid { * * Initializes a &struct ssam_device_id with the given parameters. See &struct * ssam_device_uid for details regarding the parameters. The special values - * %SSAM_ANY_TID, %SSAM_ANY_IID, and %SSAM_ANY_FUN can be used to specify that + * %SSAM_SSH_TID_ANY, %SSAM_SSH_IID_ANY, and %SSAM_SSH_FUN_ANY can be used to specify that * matching should ignore target ID, instance ID, and/or sub-function, * respectively. This macro initializes the ``match_flags`` field based on the * given parameters. * * Note: The parameters @d and @cat must be valid &u8 values, the parameters - * @tid, @iid, and @fun must be either valid &u8 values or %SSAM_ANY_TID, - * %SSAM_ANY_IID, or %SSAM_ANY_FUN, respectively. Other non-&u8 values are not + * @tid, @iid, and @fun must be either valid &u8 values or %SSAM_SSH_TID_ANY, + * %SSAM_SSH_IID_ANY, or %SSAM_SSH_FUN_ANY, respectively. Other non-&u8 values are not * allowed. */ #define SSAM_DEVICE(d, cat, tid, iid, fun) \ - .match_flags = (((tid) != SSAM_ANY_TID) ? SSAM_MATCH_TARGET : 0) \ - | (((iid) != SSAM_ANY_IID) ? SSAM_MATCH_INSTANCE : 0) \ - | (((fun) != SSAM_ANY_FUN) ? SSAM_MATCH_FUNCTION : 0), \ + .match_flags = (((tid) != SSAM_SSH_TID_ANY) ? SSAM_MATCH_TARGET : 0) \ + | (((iid) != SSAM_SSH_IID_ANY) ? SSAM_MATCH_INSTANCE : 0) \ + | (((fun) != SSAM_SSH_FUN_ANY) ? SSAM_MATCH_FUNCTION : 0), \ .domain = d, \ .category = cat, \ - .target = __builtin_choose_expr((tid) != SSAM_ANY_TID, (tid), 0), \ - .instance = __builtin_choose_expr((iid) != SSAM_ANY_IID, (iid), 0), \ - .function = __builtin_choose_expr((fun) != SSAM_ANY_FUN, (fun), 0) + .target = __builtin_choose_expr((tid) != SSAM_SSH_TID_ANY, (tid), 0), \ + .instance = __builtin_choose_expr((iid) != SSAM_SSH_IID_ANY, (iid), 0), \ + .function = __builtin_choose_expr((fun) != SSAM_SSH_FUN_ANY, (fun), 0) /** * SSAM_VDEV() - Initialize a &struct ssam_device_id as virtual device with @@ -113,18 +113,18 @@ struct ssam_device_uid { * * Initializes a &struct ssam_device_id with the given parameters in the * virtual domain. See &struct ssam_device_uid for details regarding the - * parameters. The special values %SSAM_ANY_TID, %SSAM_ANY_IID, and - * %SSAM_ANY_FUN can be used to specify that matching should ignore target ID, + * parameters. The special values %SSAM_SSH_TID_ANY, %SSAM_SSH_IID_ANY, and + * %SSAM_SSH_FUN_ANY can be used to specify that matching should ignore target ID, * instance ID, and/or sub-function, respectively. This macro initializes the * ``match_flags`` field based on the given parameters. * * Note: The parameter @cat must be a valid &u8 value, the parameters @tid, - * @iid, and @fun must be either valid &u8 values or %SSAM_ANY_TID, - * %SSAM_ANY_IID, or %SSAM_ANY_FUN, respectively. Other non-&u8 values are not + * @iid, and @fun must be either valid &u8 values or %SSAM_SSH_TID_ANY, + * %SSAM_SSH_IID_ANY, or %SSAM_SSH_FUN_ANY, respectively. Other non-&u8 values are not * allowed. */ #define SSAM_VDEV(cat, tid, iid, fun) \ - SSAM_DEVICE(SSAM_DOMAIN_VIRTUAL, SSAM_VIRTUAL_TC_##cat, tid, iid, fun) + SSAM_DEVICE(SSAM_DOMAIN_VIRTUAL, SSAM_VIRTUAL_TC_##cat, SSAM_SSH_TID_##tid, iid, fun) /** * SSAM_SDEV() - Initialize a &struct ssam_device_id as physical SSH device @@ -136,18 +136,18 @@ struct ssam_device_uid { * * Initializes a &struct ssam_device_id with the given parameters in the SSH * domain. See &struct ssam_device_uid for details regarding the parameters. - * The special values %SSAM_ANY_TID, %SSAM_ANY_IID, and %SSAM_ANY_FUN can be - * used to specify that matching should ignore target ID, instance ID, and/or - * sub-function, respectively. This macro initializes the ``match_flags`` - * field based on the given parameters. + * The special values %SSAM_SSH_TID_ANY, %SSAM_SSH_IID_ANY, and + * %SSAM_SSH_FUN_ANY can be used to specify that matching should ignore target + * ID, instance ID, and/or sub-function, respectively. This macro initializes + * the ``match_flags`` field based on the given parameters. * * Note: The parameter @cat must be a valid &u8 value, the parameters @tid, - * @iid, and @fun must be either valid &u8 values or %SSAM_ANY_TID, - * %SSAM_ANY_IID, or %SSAM_ANY_FUN, respectively. Other non-&u8 values are not - * allowed. + * @iid, and @fun must be either valid &u8 values or %SSAM_SSH_TID_ANY, + * %SSAM_SSH_IID_ANY, or %SSAM_SSH_FUN_ANY, respectively. Other non-&u8 values + * are not allowed. */ #define SSAM_SDEV(cat, tid, iid, fun) \ - SSAM_DEVICE(SSAM_DOMAIN_SERIALHUB, SSAM_SSH_TC_##cat, tid, iid, fun) + SSAM_DEVICE(SSAM_DOMAIN_SERIALHUB, SSAM_SSH_TC_##cat, SSAM_SSH_TID_##tid, iid, fun) /* * enum ssam_device_flags - Flags for SSAM client devices. From patchwork Fri Dec 2 22:33:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maximilian Luz X-Patchwork-Id: 29135 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1103019wrr; Fri, 2 Dec 2022 14:38:21 -0800 (PST) X-Google-Smtp-Source: AA0mqf6moQvCdGCJuhx6p8fst4reNVs0WBhXu9p7ewzz7fM7HxTl+wiSE/LEs6mZUaBAh00ALRBT X-Received: by 2002:aa7:d68d:0:b0:46a:e912:fbcd with SMTP id d13-20020aa7d68d000000b0046ae912fbcdmr28940645edr.378.1670020701603; Fri, 02 Dec 2022 14:38:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670020701; cv=none; d=google.com; s=arc-20160816; b=pWZwGoZ4a/x9uD4SSi25wpX19YVabaOlPkaLUGvkBn/NDb2Mm3oyYLYbVnTPtPnNZ+ dXiTPjl7YbKkD4LcrU1d4oeP2oLYopbcOFok9l9ogDA/mNFnE90udMGh15d+FoMl/Vhh ueGe+v/lppAfikZsDh8eF7n6Hc2Xwy/PgMIlDUHoOtZ0j8FbonapKeKWeThDktBrp1ZG WXqVBH1D/fafE2te/BrYahQr5LNce9YuvPbWEJKCb7ndgFbRIsOjv+Du41tcTOydl8mS H7qPtla9Ye+u8D+Z3DAO6fLjCySlq6ry6fXDKnV/jPv5ryU9RDMP3lNScBwipOR1MEHn I1bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=g/p1+V/z+oR39h38nh1M5hCwPSL3t8Y/qdykCOeejV0=; b=TwDkp/3xnigFvR5KTiUrOBRQmNmEsDM7jX95HEMIJysWaFBZ2f7L/2Sk+ad7EZ3Zf6 Jip3ipRMuYNoILtj92M2N4U9LhKPIf8M6tuahfuNXYbRk47W2H1WZhx00GIlfQF1rAzj 6t1hVCsVf0F9TTvXXe294Pr3gbxZQ4KnWTPWFjd0l8KVydAT7Sx+7/9YX965n5Yc/kY2 QH7hlKlp7wVaX8apmMR85c21PEgBInRh/msYBmUawAIqDeu0syIV0YLwHNG89KbUAJt6 WXXuK4JEtKghorxotvYfs5wRImkSYc1voNyt513j8eJj8t2LrO6pJEfJgnTkPic5eo3m rnlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=a+50oLwN; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gs8-20020a1709072d0800b007b273d1f664si8391901ejc.128.2022.12.02.14.37.57; Fri, 02 Dec 2022 14:38:21 -0800 (PST) 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=@gmail.com header.s=20210112 header.b=a+50oLwN; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234990AbiLBWe3 (ORCPT + 99 others); Fri, 2 Dec 2022 17:34:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234940AbiLBWeO (ORCPT ); Fri, 2 Dec 2022 17:34:14 -0500 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BBF2FB88C; Fri, 2 Dec 2022 14:33:49 -0800 (PST) Received: by mail-ej1-x629.google.com with SMTP id ha10so14700296ejb.3; Fri, 02 Dec 2022 14:33:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=g/p1+V/z+oR39h38nh1M5hCwPSL3t8Y/qdykCOeejV0=; b=a+50oLwNxjPhsywArY16tosqg875B9DBC57M3kQPZvQ+ach28oR8C+aEWIz01Ccabg JRJNW+YyvhAS29M1sSxSY4AP8LPgHVzlv/sfvH7AR2FLW+JDImaeGzMEO6OdqHIdam8f fVjwEog2vr3o+97yDA8vz5/rWSdFeYl+qS4DvtnXZ6L30K8tFX9nZeasfF3VQ5AX0og1 0mN/BQ8vzzaMM4spCCz58L9rnWSD85eshQgniJqcPMoVCeDlUbTu3JT+WibZ/5S+P1cK Y8TCh6+uSiz3UCAIw1PwWtH023IO6f7z+foESvBcwVXWWTJFRhLNO/Z8li4EA9hkc1JK e4DA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=g/p1+V/z+oR39h38nh1M5hCwPSL3t8Y/qdykCOeejV0=; b=Xv1b/LuYLayVNGEFBXSGhVGLBNYGiepNRo9Ua3H05rftwJHamKS6Ofrf6/4En13pvQ w10VegqAxV/yYxryzwVoJzdQUNH9fGgumOtQglZjeC5p6Pe6aqEZNJYAgIz4YyV9d+Sz lc3XcjHLivwHqArmynfeILg0zQtgqajVOvjbQPTc7XEBiL8foEGmLCGBZKeViY4aIy1p wV46P29OtPD4+vQmBuZWAuI8Sv4RVyCep+ghAvsdtra4oCoaz6sv2Xc2xn/wL8pqUSOA YpuvHHNrsUKLNgq4+u1omXAwHGVRoZetWYr0ihRVSBRZdurv9jjPU9Z3e3GeZt3s4E51 3yGg== X-Gm-Message-State: ANoB5pnHRjFnIGEwV6lFOfiE0p/uL14BbqIGRPxG6DAdCxWRyh9I6pWo VBwR6BPhC68H0kzTJotzWHBJY7F+b6PhXg== X-Received: by 2002:a17:907:d60b:b0:7bc:dbd8:184b with SMTP id wd11-20020a170907d60b00b007bcdbd8184bmr31632110ejc.110.1670020428205; Fri, 02 Dec 2022 14:33:48 -0800 (PST) Received: from xws.localdomain ([37.120.217.162]) by smtp.gmail.com with ESMTPSA id j17-20020a17090623f100b007c0d0dad9c6sm575340ejg.108.2022.12.02.14.33.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 14:33:47 -0800 (PST) From: Maximilian Luz To: Hans de Goede Cc: Maximilian Luz , Mark Gross , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 9/9] platform/surface: aggregator_registry: Fix target-ID of base-hub Date: Fri, 2 Dec 2022 23:33:27 +0100 Message-Id: <20221202223327.690880-10-luzmaximilian@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221202223327.690880-1-luzmaximilian@gmail.com> References: <20221202223327.690880-1-luzmaximilian@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751143626938366164?= X-GMAIL-MSGID: =?utf-8?q?1751143626938366164?= The target ID of the base hub is currently set to KIP (keyboard/ peripherals). However, even though it manages such devices with the KIP target ID, the base hub itself is actually accessed via the SAM target ID. So set it accordingly. Note that the target ID of the hub can be chosen arbitrarily and does not directly correspond to any physical or virtual component of the EC. This change is only a code improvement intended for consistency and clarity, it does not fix an actual bug. Signed-off-by: Maximilian Luz --- drivers/platform/surface/surface_aggregator_hub.c | 2 +- drivers/platform/surface/surface_aggregator_registry.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/platform/surface/surface_aggregator_hub.c b/drivers/platform/surface/surface_aggregator_hub.c index 6abd1efe2088..8b8b80228c14 100644 --- a/drivers/platform/surface/surface_aggregator_hub.c +++ b/drivers/platform/surface/surface_aggregator_hub.c @@ -349,7 +349,7 @@ static const struct ssam_hub_desc kip_hub = { static const struct ssam_device_id ssam_hub_match[] = { { SSAM_VDEV(HUB, SAM, SSAM_SSH_TC_KIP, 0x00), (unsigned long)&kip_hub }, - { SSAM_VDEV(HUB, KIP, SSAM_SSH_TC_BAS, 0x00), (unsigned long)&base_hub }, + { SSAM_VDEV(HUB, SAM, SSAM_SSH_TC_BAS, 0x00), (unsigned long)&base_hub }, { } }; MODULE_DEVICE_TABLE(ssam, ssam_hub_match); diff --git a/drivers/platform/surface/surface_aggregator_registry.c b/drivers/platform/surface/surface_aggregator_registry.c index 023f126121d7..296f72d52e6a 100644 --- a/drivers/platform/surface/surface_aggregator_registry.c +++ b/drivers/platform/surface/surface_aggregator_registry.c @@ -46,7 +46,7 @@ static const struct software_node ssam_node_hub_kip = { /* Base device hub (devices attached to Surface Book 3 base). */ static const struct software_node ssam_node_hub_base = { - .name = "ssam:00:00:02:11:00", + .name = "ssam:00:00:01:11:00", .parent = &ssam_node_root, };