diff options
author | Jack Pham <jackp@codeaurora.org> | 2018-06-08 10:10:12 -0700 |
---|---|---|
committer | Michael Bestas <mkbestas@gmail.com> | 2020-04-18 03:47:15 +0300 |
commit | 951444b6cd99b6941cf1470cd51df803862b1785 (patch) | |
tree | 3a1106d103d185340c95558e956564e12dbbdc50 /drivers/usb | |
parent | 9b0c939d0a6714818d36e16588a6e0f6a84768f4 (diff) |
usb: pd: qpnp-pdphy: Switch to hrtimer-based wait
Currently wait_event_interruptible_timeout() is used when
sending a message or hard reset signal to wait for a completion
interrupt. However, the jiffies-based timer is not accurate for
the short timeout durations used (15ms TX, 5ms hard reset) and
can result in timing out too early. Switch to hrtimer-based
wait_event_interruptible_hrtimeout() for better accuracy.
Change-Id: I1c9866114b548ce849ec6002c0eb1362ac9a7786
Signed-off-by: Jack Pham <jackp@codeaurora.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/pd/qpnp-pdphy.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/usb/pd/qpnp-pdphy.c b/drivers/usb/pd/qpnp-pdphy.c index 1685fc3c37ae..85acc9f943e0 100644 --- a/drivers/usb/pd/qpnp-pdphy.c +++ b/drivers/usb/pd/qpnp-pdphy.c @@ -437,12 +437,12 @@ int pd_phy_signal(enum pd_sig_type sig) if (ret) return ret; - ret = wait_event_interruptible_timeout(pdphy->tx_waitq, + ret = wait_event_interruptible_hrtimeout(pdphy->tx_waitq, pdphy->tx_status != -EINPROGRESS, - msecs_to_jiffies(HARD_RESET_COMPLETE_TIME)); - if (ret <= 0) { + ms_to_ktime(HARD_RESET_COMPLETE_TIME)); + if (ret) { dev_err(pdphy->dev, "%s: failed ret %d", __func__, ret); - return ret ? ret : -ETIMEDOUT; + return ret; } ret = pdphy_reg_write(pdphy, USB_PDPHY_TX_CONTROL, 0); @@ -526,12 +526,12 @@ int pd_phy_write(u16 hdr, const u8 *data, size_t data_len, enum pd_sop_type sop) if (ret) return ret; - ret = wait_event_interruptible_timeout(pdphy->tx_waitq, + ret = wait_event_interruptible_hrtimeout(pdphy->tx_waitq, pdphy->tx_status != -EINPROGRESS, - msecs_to_jiffies(RECEIVER_RESPONSE_TIME)); - if (ret <= 0) { + ms_to_ktime(RECEIVER_RESPONSE_TIME)); + if (ret) { dev_err(pdphy->dev, "%s: failed ret %d", __func__, ret); - return ret ? ret : -ETIMEDOUT; + return ret; } if (hdr && !pdphy->tx_status) |