From patchwork Thu Oct 21 13:09:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maximilian Luz X-Patchwork-Id: 12575051 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0570C433FE for ; Thu, 21 Oct 2021 13:09:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 86C096109F for ; Thu, 21 Oct 2021 13:09:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230379AbhJUNLe (ORCPT ); Thu, 21 Oct 2021 09:11:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230463AbhJUNLd (ORCPT ); Thu, 21 Oct 2021 09:11:33 -0400 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88E52C061749; Thu, 21 Oct 2021 06:09:17 -0700 (PDT) Received: by mail-ed1-x530.google.com with SMTP id y12so340404eda.4; Thu, 21 Oct 2021 06:09:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eWhS/VWKVIIu5u4miltvI+qmcq5c4uC9DbdWdhggI74=; b=WoEZhEev9dqTz70m5xKBKNf7wHRR7VifKNE72uszia0hVOhHB9JTG0fnwPnTK4KESM EDS8crGqRr7wLjRBGcxRmlucVhdcC09WrDR1X/05BqBt4j7ijeVDLKtvRewCEBYZTRTD U/6xiRfb49kqLKqmG46TXT+IxAteZuWJMdyx0E/wW6+s0XR/pzhv7mh0fQ/1qlUAw2Ki 6Mr4SJ/Kmx8k6C+anoLVvJyhL5MkZehfcFXRIvRrrkv/d7qyhdv9R7/Q3ayVOKTi+Xic WNd5SjJ/DeNmOz40ejoajBPYBcP8CWWu9JS1a0USnUQZ/v4gU9qS80wm8gSTxb128HYG ZWbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eWhS/VWKVIIu5u4miltvI+qmcq5c4uC9DbdWdhggI74=; b=y/X01+oXK6OPiSuUUbmpWyetNRrNevWCqqxQgZWAmGoRye1ZyTISS2JhiitfrKW+0e 5OQep7bWCyU8NTZFOnKTMsDpYKfh0zyK92cTTnOmJUm+VRhmInMcJu+rDirZqUIjFNMh FwVrQg+OxfFum5oR0hXUeVj4wH4l141kkQ5srsXaH03unYquyaq13gvYGyu53MZSFLz+ Di3DVHwJgBK6BluvyXzt7tzGognEQMSj9JDrt+hHN2610oMQ09bI3CmQ4rHWZ1SXeX0u VOj90AV/NGeMZJfzjIA/jnXyAy7pHCxVYsvJ0oWSILp4OSFkPPVgBd/jYpFTenWtRpWu xPZw== X-Gm-Message-State: AOAM531r20LAH2NEcNvujdsBtpWJKbGFz6seb8r/qSedsaZSrbvrsaCv iaazBR1uzdsFV2AkA33XlN4= X-Google-Smtp-Source: ABdhPJya7JxoJvLdTO8E9eHXLyvVxpJiDn8P8sb9CewYUGQHWqceeK916mRIeer6xLmdg5IroxlHjA== X-Received: by 2002:a17:906:58c1:: with SMTP id e1mr7249968ejs.327.1634821756171; Thu, 21 Oct 2021 06:09:16 -0700 (PDT) Received: from xws.localdomain ([194.126.177.11]) by smtp.gmail.com with ESMTPSA id q6sm126987eds.96.2021.10.21.06.09.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Oct 2021 06:09:15 -0700 (PDT) From: Maximilian Luz Cc: Maximilian Luz , Hans de Goede , Mark Gross , Jiri Kosina , Benjamin Tissoires , platform-driver-x86@vger.kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH 2/3] HID: surface-hid: Use correct event registry for managing HID events Date: Thu, 21 Oct 2021 15:09:03 +0200 Message-Id: <20211021130904.862610-3-luzmaximilian@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211021130904.862610-1-luzmaximilian@gmail.com> References: <20211021130904.862610-1-luzmaximilian@gmail.com> MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Until now, we have only ever seen the REG-category registry being used on devices addressed with target ID 2. In fact, we have only ever seen Surface Aggregator Module (SAM) HID devices with target ID 2. For those devices, the registry also has to be addressed with target ID 2. Some devices, like the new Surface Laptop Studio, however, address their HID devices on target ID 1. As a result of this, any target ID 2 commands time out. This includes event management commands addressed to the target ID 2 REG-category registry. For these devices, the registry has to be addressed via target ID 1 instead. We therefore assume that the target ID of the registry to be used depends on the target ID of the respective device. Implement this accordingly. Note that we currently allow the surface HID driver to only load against devices with target ID 2, so these timeouts are not happening (yet). This is just a preparation step before we allow the driver to load against all target IDs. Cc: stable@vger.kernel.org # 5.14+ Signed-off-by: Maximilian Luz --- drivers/hid/surface-hid/surface_hid.c | 2 +- include/linux/surface_aggregator/controller.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/hid/surface-hid/surface_hid.c b/drivers/hid/surface-hid/surface_hid.c index a3a70e4f3f6c..daa452367c0b 100644 --- a/drivers/hid/surface-hid/surface_hid.c +++ b/drivers/hid/surface-hid/surface_hid.c @@ -209,7 +209,7 @@ static int surface_hid_probe(struct ssam_device *sdev) shid->notif.base.priority = 1; shid->notif.base.fn = ssam_hid_event_fn; - shid->notif.event.reg = SSAM_EVENT_REGISTRY_REG; + shid->notif.event.reg = SSAM_EVENT_REGISTRY_REG(sdev->uid.target); shid->notif.event.id.target_category = sdev->uid.category; shid->notif.event.id.instance = sdev->uid.instance; shid->notif.event.mask = SSAM_EVENT_MASK_STRICT; diff --git a/include/linux/surface_aggregator/controller.h b/include/linux/surface_aggregator/controller.h index 068e1982ad37..74bfdffaf7b0 100644 --- a/include/linux/surface_aggregator/controller.h +++ b/include/linux/surface_aggregator/controller.h @@ -792,8 +792,8 @@ enum ssam_event_mask { #define SSAM_EVENT_REGISTRY_KIP \ SSAM_EVENT_REGISTRY(SSAM_SSH_TC_KIP, 0x02, 0x27, 0x28) -#define SSAM_EVENT_REGISTRY_REG \ - SSAM_EVENT_REGISTRY(SSAM_SSH_TC_REG, 0x02, 0x01, 0x02) +#define SSAM_EVENT_REGISTRY_REG(tid)\ + SSAM_EVENT_REGISTRY(SSAM_SSH_TC_REG, tid, 0x01, 0x02) /** * enum ssam_event_notifier_flags - Flags for event notifiers. From patchwork Thu Oct 21 13:09:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maximilian Luz X-Patchwork-Id: 12575055 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D74E2C433FE for ; Thu, 21 Oct 2021 13:09:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C39D461362 for ; Thu, 21 Oct 2021 13:09:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231207AbhJUNLi (ORCPT ); Thu, 21 Oct 2021 09:11:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230463AbhJUNLg (ORCPT ); Thu, 21 Oct 2021 09:11:36 -0400 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 0C2C0C06161C; Thu, 21 Oct 2021 06:09:20 -0700 (PDT) Received: by mail-ed1-x52c.google.com with SMTP id t16so1005004eds.9; Thu, 21 Oct 2021 06:09:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LECEOaMB1G/jWwI9IEg6kx6EfVlOlUadsdIvepR6ADo=; b=gnRvGwNwNBSjUKx7RQ9Gpa3xYp8zS8uwlavatUf55lWTcsRDZmJIVsXPbNuYcazH55 mQMQsRHHmw//d6RirvsNLL5x1IJMfdEi1/CB6s6fgpZapMkq1/hrQ687R/HvtJBDAJtT 6xz01YbG28uFwfo4Ra5YRGgnH1pTrQWlWpYvwHhuO3hyAxc6zgzAjhj/d/7CISdgR+Fv OLQ3h1E2bPxSWPSF5EXr53aDTYMtYcWpT3vuLA03scaY3I6m2cDnMQNTaLOUksy0ZnA/ O6eTBO0MweOihpynBq2/+wczCzcJyjqi8Mudp7AULfmWvEMiRdv29sLLNa5TGgeD83md Jr/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LECEOaMB1G/jWwI9IEg6kx6EfVlOlUadsdIvepR6ADo=; b=T5caiCMZ5eUJYp3rZimW2Hbo/XVn5t2pUrru7X+ZRGJbYL3xPOxM7jZwoBIyEeN7xH 3EoJr2bbLZNRLx5lgoZ5GsQwy24lSdjivckdCNO9RtFlOlcEqmveSpnvBlFXau6h7CEp pYUQLw3qtopKe/je8WQ9zxsiIbdQkyIoimThtS0TvuUrd3iJsh5UAomI+dtSDhMQLC3C 3W2GMuzAPzmgKcM3lMkdQEdb5fByu8gxJYGxcfyHa3DhDxV93wy7vuLItXqQ5vM2FWyW mbNdC8PUYcyce08ZTB5LFujR22Ovm5IKHBFzijc1q1CKw/fetK9W5/eAqwGZt0+T0YPX fN5A== X-Gm-Message-State: AOAM531YAuicormS3pBxQRsl8bhePOum5D4GAKlAuZdK4EOMSz1D9Nwy A5LYtkavbySI8qZgND3H0AO4WOcQhmA= X-Google-Smtp-Source: ABdhPJyXxI70UbL9XtJH+weCYz849WYcLNzw99qUd3iov1sm5Qv3s0hS8gyHmQfYn9Qq7jo7DA8/Zg== X-Received: by 2002:a05:6402:1e8e:: with SMTP id f14mr7819119edf.27.1634821757166; Thu, 21 Oct 2021 06:09:17 -0700 (PDT) Received: from xws.localdomain ([194.126.177.11]) by smtp.gmail.com with ESMTPSA id q6sm126987eds.96.2021.10.21.06.09.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Oct 2021 06:09:16 -0700 (PDT) From: Maximilian Luz Cc: Maximilian Luz , Hans de Goede , Mark Gross , Jiri Kosina , Benjamin Tissoires , platform-driver-x86@vger.kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH 3/3] HID: surface-hid: Allow driver matching for target ID 1 devices Date: Thu, 21 Oct 2021 15:09:04 +0200 Message-Id: <20211021130904.862610-4-luzmaximilian@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211021130904.862610-1-luzmaximilian@gmail.com> References: <20211021130904.862610-1-luzmaximilian@gmail.com> MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Until now we have only ever seen HID devices with target ID 2. The new Surface Laptop Studio however uses HID devices with target ID 1. Allow matching this driver to those as well. Cc: stable@vger.kernel.org # 5.14+ Signed-off-by: Maximilian Luz --- drivers/hid/surface-hid/surface_hid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hid/surface-hid/surface_hid.c b/drivers/hid/surface-hid/surface_hid.c index daa452367c0b..d4aa8c81903a 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, 0x02, SSAM_ANY_IID, 0x00) }, + { SSAM_SDEV(HID, SSAM_ANY_TID, SSAM_ANY_IID, 0x00) }, { }, }; MODULE_DEVICE_TABLE(ssam, surface_hid_match);