From mboxrd@z Thu Jan 1 00:00:00 1970 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=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable 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 871A0C433DF for ; Mon, 17 Aug 2020 19:39:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5D2482072D for ; Mon, 17 Aug 2020 19:39:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597693172; bh=7zefk5AnHsO0CJkvNYQwHaA5V3ogPlSFdGnb5lfCmhM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=p09Y461dr4skBxgK0IMWqMmraOHhktf054l7IkMdC95noiuPsgvbRaQLZyfme0cXV 85zuyGhi6I50NVEJOiwqH247zsTsq4LnA1nlqJp1lV0JCtzyJJErCUgzL11kqBGjp1 TQH1yu1glgmHH7Gr4vW3l/xiccA5S3Wu3jIbbZGo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732509AbgHQTj1 (ORCPT ); Mon, 17 Aug 2020 15:39:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:35216 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729813AbgHQP0c (ORCPT ); Mon, 17 Aug 2020 11:26:32 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 6B95323718; Mon, 17 Aug 2020 15:26:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597677991; bh=7zefk5AnHsO0CJkvNYQwHaA5V3ogPlSFdGnb5lfCmhM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XzyjD7sABwZ7QHGRH7dzBHIP3AZyz2o+X2lHpFg4Y9e9+YwMQ1JarmWfx4sWJWlPR qeorOi5mjT+ESLkbMuvSvac+j7hWC7euNxQ24QNWEHmuw4b2ZAUBH14mR5Lt0VIaqb GnbdYO+ZYZNVdbY6RnOJU0Ef09EgRggTcI9pPc9A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Matthias Kaehlcke , Abhishek Pandit-Subedi , Marcel Holtmann , Sasha Levin Subject: [PATCH 5.8 154/464] Bluetooth: hci_qca: Only remove TX clock vote after TX is completed Date: Mon, 17 Aug 2020 17:11:47 +0200 Message-Id: <20200817143841.189648230@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143833.737102804@linuxfoundation.org> References: <20200817143833.737102804@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Matthias Kaehlcke [ Upstream commit eff981f6579d5797d68d27afc0eede529ac8778a ] qca_suspend() removes the vote for the UART TX clock after writing an IBS sleep request to the serial buffer. This is not a good idea since there is no guarantee that the request has been sent at this point. Instead remove the vote after successfully entering IBS sleep. This also fixes the issue of the vote being removed in case of an aborted suspend due to a failure of entering IBS sleep. Fixes: 41d5b25fed0a0 ("Bluetooth: hci_qca: add PM support") Signed-off-by: Matthias Kaehlcke Reviewed-by: Abhishek Pandit-Subedi Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin --- drivers/bluetooth/hci_qca.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c index 25659b8b0c0c8..328919b79f7b9 100644 --- a/drivers/bluetooth/hci_qca.c +++ b/drivers/bluetooth/hci_qca.c @@ -2115,8 +2115,6 @@ static int __maybe_unused qca_suspend(struct device *dev) qca->tx_ibs_state = HCI_IBS_TX_ASLEEP; qca->ibs_sent_slps++; - - qca_wq_serial_tx_clock_vote_off(&qca->ws_tx_vote_off); break; case HCI_IBS_TX_ASLEEP: @@ -2144,8 +2142,10 @@ static int __maybe_unused qca_suspend(struct device *dev) qca->rx_ibs_state == HCI_IBS_RX_ASLEEP, msecs_to_jiffies(IBS_BTSOC_TX_IDLE_TIMEOUT_MS)); - if (ret > 0) + if (ret > 0) { + qca_wq_serial_tx_clock_vote_off(&qca->ws_tx_vote_off); return 0; + } if (ret == 0) ret = -ETIMEDOUT; -- 2.25.1