From patchwork Mon Sep 21 16:28:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "gregkh@linuxfoundation.org" X-Patchwork-Id: 263674 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66184C43465 for ; Mon, 21 Sep 2020 16:47:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 15264238D7 for ; Mon, 21 Sep 2020 16:47:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600706824; bh=Ene7O8YK1qgIDkHOO2I0Sb/9C+Q1OqyCAPRST8nYiRo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=UL6KMWWvQqn7Be6xO8w2NbSz5GfmOrsslq0Jx2zcBNyiqrdkMcBNIh4dx5q6PJO25 YxoYGfZPi3Zufz8j8QRR6A57FgRbMeITg/7uG234nCT9sR5gvvE86jeM2+jSclEgf2 utO0SEVN17D/y/MhxIPN25nSZr8d5jbZh1zBm6R8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728107AbgIUQrC (ORCPT ); Mon, 21 Sep 2020 12:47:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:53586 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728636AbgIUQq7 (ORCPT ); Mon, 21 Sep 2020 12:46:59 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6B8082388B; Mon, 21 Sep 2020 16:46:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600706818; bh=Ene7O8YK1qgIDkHOO2I0Sb/9C+Q1OqyCAPRST8nYiRo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I5dVXI/BX9FWZtbScPZ7AikaubENPYiGAhaS9Z+hnHukiozlCQPu26Umuf8+RwQoU rXRi8ZjdJ2onG7KZXRwUxaKv+Gv6EZRJZUgGeGY+UxaSSbMLw5SXbMOe+Xnglaa8vl RM3+wc3axaXua/Sq35zxMc1t6LjJRmXUvVWTtnDk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Heikki Krogerus Subject: [PATCH 5.8 089/118] usb: typec: ucsi: acpi: Increase command completion timeout value Date: Mon, 21 Sep 2020 18:28:21 +0200 Message-Id: <20200921162040.486534913@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200921162036.324813383@linuxfoundation.org> References: <20200921162036.324813383@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Heikki Krogerus commit 130a96d698d7bee9f339832d1e47ab26aad8dbf1 upstream. UCSI specification quite clearly states that if a command can't be completed in 10ms, the firmware must notify about BUSY condition. Unfortunately almost none of the platforms (the firmware on them) generate the BUSY notification even if a command can't be completed in time. The driver already considered that, and used a timeout value of 5 seconds, but processing especially the alternate mode discovery commands takes often considerable amount of time from the firmware, much more than the 5 seconds. That happens especially after bootup when devices are already connected to the USB Type-C connector. For now on those platforms the alternate mode discovery has simply failed because of the timeout. To improve the situation, increasing the timeout value for the command completion to 1 minute. That should give enough time for even the slowest firmware to process the commands. Fixes: f56de278e8ec ("usb: typec: ucsi: acpi: Move to the new API") Cc: stable@vger.kernel.org Signed-off-by: Heikki Krogerus Link: https://lore.kernel.org/r/20200916090034.25119-2-heikki.krogerus@linux.intel.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/typec/ucsi/ucsi_acpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/usb/typec/ucsi/ucsi_acpi.c +++ b/drivers/usb/typec/ucsi/ucsi_acpi.c @@ -78,7 +78,7 @@ static int ucsi_acpi_sync_write(struct u if (ret) goto out_clear_bit; - if (!wait_for_completion_timeout(&ua->complete, msecs_to_jiffies(5000))) + if (!wait_for_completion_timeout(&ua->complete, 60 * HZ)) ret = -ETIMEDOUT; out_clear_bit: