Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2499927lqz; Tue, 2 Apr 2024 22:27:47 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVzSSpyMi3AW9aJn8PNbYB0rZM9Q9Xf3QxRkI6aZAZTtAG2tTSDTIM6gw3qQ6dB8KmEfKXp2PcPIyZD6+2sC8bSC0B8eFQErQETLkyp/A== X-Google-Smtp-Source: AGHT+IGu4cQCWEw0nyK64dfU2Hqos3ZsB/pagD83F17mOE0ZtRHrc2olMrzFJEZQLyVId6AnMhnR X-Received: by 2002:a05:6a21:150b:b0:1a5:6f21:f8a8 with SMTP id nq11-20020a056a21150b00b001a56f21f8a8mr1938649pzb.15.1712122067210; Tue, 02 Apr 2024 22:27:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712122067; cv=pass; d=google.com; s=arc-20160816; b=xSwV5itfzGO4AxqQkMQxd+VnKElplpucE0R6nFIdOSxccDkCBRwc84oLsRyN8D/5UE r1OANb2xjySKRCYSTxo2To2YienRSCWJbXrYoOPaUubBuu/PEti0Zw0eXRU/hCDPlxTJ sNQlZ27V7uabhklaLZC0kpgjcF+R4n5hraG3EuraepWofV5G/NB2N6r9g1y9iFXEYCZz pQVrVKppjfJcogtggGC41H/s31WPM7yubClPsjOfz2z30JDPKftFAl0UKdNVqfLKDi1Q /GYa9sGai/iVCiIGg5eMMoj4+RnfhY8dy2xleBkFPeRuH7earLjBBkSgBvcvLy+apQCK fvTw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:feedback-id:dkim-signature:dkim-signature; bh=WFzsaT48GQrgSEFr3BSkVJlT7btMWqBLkTOeqH2ftUo=; fh=wDrqx0f+299Z9E/ydfQE0sLKgm4EkrYz7I1GVgXm5co=; b=L8RzoXLmOrUqFUluz4Wa62cdb3OhZfBXyD1cKwy0n8z5QA/l3zxnWSbDCWf7sBfDW5 9+55IlLY29uVpZJBNrhZdAajb8CUC5REB2AjmffMKwCLw8q81yljfFq9jg44f0y10Q8m YuLug5JNzdGHWAzV6uCK2msNWbufJ3tyz2R9qPiFoLfHV1mPVnUEZBW75XEvR7X9BSXm TUCyKPWbfDen18zuTgTx0GMmjTyCQ8KDXLu6gLl4ZGHlJJhPUvM15rQzm/r4Gd/HnwzG /I3tYsshzOiQPbp+AOxq5ZcJqYMZsTG3PZUYjwnxSn7KO4kMGrjHcf0LBdT+nqNVm7kh Q+aA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ljones.dev header.s=fm3 header.b=RygKvskk; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=GdyOrsZf; arc=pass (i=1 dkim=pass dkdomain=ljones.dev dkim=pass dkdomain=messagingengine.com); spf=pass (google.com: domain of linux-kernel+bounces-128880-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-128880-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id i11-20020a17090a974b00b002a1f8ae409esi13530057pjw.152.2024.04.02.22.27.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 22:27:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-128880-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ljones.dev header.s=fm3 header.b=RygKvskk; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=GdyOrsZf; arc=pass (i=1 dkim=pass dkdomain=ljones.dev dkim=pass dkdomain=messagingengine.com); spf=pass (google.com: domain of linux-kernel+bounces-128880-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-128880-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 2D143B2392A for ; Wed, 3 Apr 2024 00:31:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BF4F61CD10; Wed, 3 Apr 2024 00:29:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ljones.dev header.i=@ljones.dev header.b="RygKvskk"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="GdyOrsZf" Received: from fhigh5-smtp.messagingengine.com (fhigh5-smtp.messagingengine.com [103.168.172.156]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 16D131BC3C; Wed, 3 Apr 2024 00:29:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.156 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712104189; cv=none; b=AsxcKbb0Tj8MFTU+3AtzjAhIhPjVu6gcDoNLfpaLPwhqkHPC/xxUCSKWTPFgGFnXBSOV5DpPfRn8vcFSr/E5ArabB+lqcy9O3hFz0k6ZxyyFWcblHrTJP2S1tx+wV7B8lXnRgcOVTjMuaaSHWq5p0IvIJldChC6X6e/JgFR5y6E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712104189; c=relaxed/simple; bh=hqQcBz8tjJvePBEV24EgLsCD/lpRWZ3kNVG5ktQlrmk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Uyb4vU7jHxQQiDkRA1pIZHo13kQklneUkJbtD8/rHm5JAG8ydq6PYWl07I2G6RxrXQRM4M0Zrwsy+XKIIxIXCb6GoUcTVUhuZbKWUe5ABJrYuM+Ln1nh0hVuzUZDbPHCss67A/nJtBSxcCmE9MjkaUxMndmBMPXVV6c2oeC0amc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ljones.dev; spf=none smtp.mailfrom=ljones.dev; dkim=pass (2048-bit key) header.d=ljones.dev header.i=@ljones.dev header.b=RygKvskk; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=GdyOrsZf; arc=none smtp.client-ip=103.168.172.156 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ljones.dev Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ljones.dev Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailfhigh.nyi.internal (Postfix) with ESMTP id 1A8C7114010D; Tue, 2 Apr 2024 20:29:47 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Tue, 02 Apr 2024 20:29:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ljones.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1712104187; x=1712190587; bh=WFzsaT48GQrgSEFr3BSkVJlT7btMWqBLkTOeqH2ftUo=; b= RygKvskkKo3VnfRVe3PKHP418GAYUpY6JHezr5vnL8tn29kaktywdQLZ6DO3Ozyn Fkvvw7xsF4VJucUfD0I0hrjQs5oH9bpjWWKrqegqhX2aNhXYmvMR2yPlU3/IamhI yaIOJv8/gTPvaEa889imZXBJxN0ipisMQXWm2iarJYLP3IHtjXl47tJ+3kxCT7Fx kbkIYB9uWEsKCU7s/49plY5Iwa7gRliP8rOci99EtP8OoiC8YfumdS/aEt6YhQYA 8dYawZgIa9FdHrvocFVxQ/2af88I+isxXHQw1K+bnfQtjlpX3liA9nodg2DNfkNE sR+AwNmT/tuvWTPscEzwDA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1712104187; x= 1712190587; bh=WFzsaT48GQrgSEFr3BSkVJlT7btMWqBLkTOeqH2ftUo=; b=G dyOrsZf/6xTZC1yeEHaBpTvMYv/5d8jQJCBb3vNK0GHL24HSW0D5PgF+n3BaojvZ z5+06wG/BXYz7qhMCXwNWM9WKTFw40782EHehJUW4AwPA3D22zUoikF20unKT/BF bHEOh2MMv5ZwPWUhHQNk21wT10h/WFU+PjbNa8t2A5JT30KNbeWnUkxMSaRw46lq Zk+Q5MAmBdc0c/eqZ/JBAxwdqbqkw9WDEEmGUjTJG6V65QKqqsxSpSaLuzuIeFbY ICpUBA3aY8VjxUFdUTlRX4J02jrxkLKh6bWRlzNm1Kvk7R1nbhj3otxBRfffEAG4 78o7t6VVXrrrpdat/0Ecw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudeffedgfeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfgggtgfesth ekredtredtjeenucfhrhhomhepfdfnuhhkvgcuffdrucflohhnvghsfdcuoehluhhkvges lhhjohhnvghsrdguvghvqeenucggtffrrghtthgvrhhnpeduudetudehiedvvdevveelhf egkeefffdvfeetuefgveefgffgffeiffeitdelieenucevlhhushhtvghrufhiiigvpeef necurfgrrhgrmhepmhgrihhlfhhrohhmpehluhhkvgeslhhjohhnvghsrdguvghv X-ME-Proxy: Feedback-ID: i5ec1447f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 2 Apr 2024 20:29:44 -0400 (EDT) From: "Luke D. Jones" To: hdegoede@redhat.com Cc: corentin.chary@gmail.com, ilpo.jarvinen@linux.intel.com, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, "Luke D. Jones" Subject: [PATCH v3 7/9] platform/x86: asus-wmi: ROG Ally increase wait time, allow MCU powersave Date: Wed, 3 Apr 2024 13:29:15 +1300 Message-ID: <20240403002917.2870959-8-luke@ljones.dev> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240403002917.2870959-1-luke@ljones.dev> References: <20240403002917.2870959-1-luke@ljones.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous work to allow the MCU to be resumed correctly after sleep and resume tried to take the shortest possible time. However as work continues in various other parts of the s2idle subsystems it has shown that it wasn't entirely reliable. If the MCU disable/enable call is done correctly the MCU fully removes its USB endpoints, and this shows as a full USB device reconnection on resume. When we tried to short this as much as possible sometimes the MCU doesn't get to complete what it needs to do before going to low-power and this affected the reconnection. Through trial it is found that the minimum time required is approx 1200ms to allow a proper disconnect and disable, and the same amount of time on resume is required to prevent a rapid disconnect/reconnect happening on seemingly random occasions. To be safe the time is now 1500ms for msleep. Reviewed-by: Ilpo Järvinen Signed-off-by: Luke D. Jones --- drivers/platform/x86/asus-wmi.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index aad4f94cfdba..7867178a9121 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -140,7 +140,7 @@ module_param(fnlock_default, bool, 0444); /* Controls the power state of the USB0 hub on ROG Ally which input is on */ #define ASUS_USB0_PWR_EC0_CSEE "\\_SB.PCI0.SBRG.EC0.CSEE" /* 300ms so far seems to produce a reliable result on AC and battery */ -#define ASUS_USB0_PWR_EC0_CSEE_WAIT 300 +#define ASUS_USB0_PWR_EC0_CSEE_WAIT 1500 static const char * const ashs_ids[] = { "ATK4001", "ATK4002", NULL }; @@ -4827,6 +4827,7 @@ static int asus_hotk_resume_early(struct device *device) struct asus_wmi *asus = dev_get_drvdata(device); if (asus->ally_mcu_usb_switch) { + /* sleep required to prevent USB0 being yanked then reappearing rapidly */ if (ACPI_FAILURE(acpi_execute_simple_method(NULL, ASUS_USB0_PWR_EC0_CSEE, 0xB8))) dev_err(device, "ROG Ally MCU failed to connect USB dev\n"); else @@ -4838,17 +4839,8 @@ static int asus_hotk_resume_early(struct device *device) static int asus_hotk_prepare(struct device *device) { struct asus_wmi *asus = dev_get_drvdata(device); - int result, err; if (asus->ally_mcu_usb_switch) { - /* When powersave is enabled it causes many issues with resume of USB hub */ - result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_MCU_POWERSAVE); - if (result == 1) { - dev_warn(device, "MCU powersave enabled, disabling to prevent resume issues"); - err = asus_wmi_set_devstate(ASUS_WMI_DEVID_MCU_POWERSAVE, 0, &result); - if (err || result != 1) - dev_err(device, "Failed to set MCU powersave mode: %d\n", err); - } /* sleep required to ensure USB0 is disabled before sleep continues */ if (ACPI_FAILURE(acpi_execute_simple_method(NULL, ASUS_USB0_PWR_EC0_CSEE, 0xB7))) dev_err(device, "ROG Ally MCU failed to disconnect USB dev\n"); -- 2.44.0