Linux USB
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Mani, Rajmohan" <rajmohan.mani@intel.com>,
	linux-usb@vger.kernel.org, stable@vger.kernel.org
Subject: [PATCH 1/5] usb: typec: ucsi: acpi: Increase command completion timeout value
Date: Wed, 16 Sep 2020 11:16:13 +0300	[thread overview]
Message-ID: <20200916081617.17146-2-heikki.krogerus@linux.intel.com> (raw)
In-Reply-To: <20200916081617.17146-1-heikki.krogerus@linux.intel.com>

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 <heikki.krogerus@linux.intel.com>
---
 drivers/usb/typec/ucsi/ucsi_acpi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/typec/ucsi/ucsi_acpi.c b/drivers/usb/typec/ucsi/ucsi_acpi.c
index c0aca2f0f23f0..fbfe8f5933af8 100644
--- 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 ucsi *ucsi, unsigned int offset,
 	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:
-- 
2.28.0


  reply	other threads:[~2020-09-16  8:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-16  8:16 [PATCH 0/5] USB Type-C fixes Heikki Krogerus
2020-09-16  8:16 ` Heikki Krogerus [this message]
2020-09-16  8:16 ` [PATCH 2/5] usb: typec: ucsi: Prevent mode overrun Heikki Krogerus
2020-09-16  8:16 ` [PATCH 3/5] usb: typec: intel_pmc_mux: Add dependency on ACPI Heikki Krogerus
2020-09-16  8:16 ` [PATCH 4/5] usb: typec: intel_pmc_mux: Pass correct USB Type-C port number to SoC Heikki Krogerus
2020-09-16  8:16 ` [PATCH 5/5] usb: typec: intel_pmc_mux: Handle SCU IPC error conditions Heikki Krogerus
2020-09-16  8:37 ` [PATCH 0/5] USB Type-C fixes Greg Kroah-Hartman
2020-09-16  8:42   ` Heikki Krogerus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200916081617.17146-2-heikki.krogerus@linux.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=rajmohan.mani@intel.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox