Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp600173pxk; Wed, 23 Sep 2020 10:57:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0yPdzP2S4mvK5m2oXdTNr7o/eXmcy+WA2uRXYJITFnRPJRziIUInkg08LUrIsbAs58h9k X-Received: by 2002:a05:6402:1503:: with SMTP id f3mr511243edw.307.1600883828900; Wed, 23 Sep 2020 10:57:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600883828; cv=none; d=google.com; s=arc-20160816; b=O7Yo0c1qwljNACfvBT8fR7FwyC7hoFA8OLRHsR3chbEJtnNfOIDeNElTmEUrI5RkME EFVSyjHCCIWnWb1e50s9BzJYOxR7sqCUlNpjb5bih0vUw2iY3Qu5l5YMzmnwhKByyBU2 iHlnWuTiNCAW9to7j6oOE/+1PeVhWueFjwgd8EdmmLkn8qZyE7YUQ+Parl55ii4B74HU TtgeB3NQ24ortgVZND7twuP5LB8g2dbCMY+vXwoa7PhUS5RbqLWdcp9vT0aZJPmX5Ikt Qkux9P1Y1W5K7fBbUm61zhlHarwdZEDYu13VNfl6HmmABfQ0wWMpl12xuol66HCJ5WH/ xEzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=5clGXEJfpBDmWdC71qzfOJs+tjRywpj8rjo2U39B9mw=; b=TmqOyYA8obVt3c00g3z4orVvblAzjglamwi97VW1S9rKXQcz+CJytAKm2as1LPABwD KOcxoMWYW52cN5HVtcEAWo0BC6PvCWBtJktFx75uYI524OzdIphLuiMsSpccHKct3YNX hocsSmGv5qK0suYR0uMPEwLkaTYJHVJIvK3JUROr0PCA5wAkKOCQIKKA/kS5Klkzg8oq 5ZH4vLK15a6fZ0wRcqR8yrSBJ1EAH/s1djZ5ZsG4CebPm5FQrPOctyvXw30Q5E3CPm3A w6y88um/jGrd2tbVmEEPwa5UUBeoNzMkgAmS2glE24XLVN96ww7MTjYB5HfWnxYJXTgM SHng== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w6si409492ejy.223.2020.09.23.10.56.27; Wed, 23 Sep 2020 10:57:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726332AbgIWR4P (ORCPT + 99 others); Wed, 23 Sep 2020 13:56:15 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:58081 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726234AbgIWR4P (ORCPT ); Wed, 23 Sep 2020 13:56:15 -0400 Received: from 61-220-137-37.hinet-ip.hinet.net ([61.220.137.37] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kL8zz-0005V0-Hn; Wed, 23 Sep 2020 17:56:12 +0000 From: Kai-Heng Feng To: marcel@holtmann.org, johan.hedberg@gmail.com Cc: alex_lu@realsil.com.cn, Kai-Heng Feng , linux-bluetooth@vger.kernel.org (open list:BLUETOOTH DRIVERS), linux-kernel@vger.kernel.org (open list) Subject: [PATCH] Bluetooth: btusb: Avoid unnecessary reset upon system resume Date: Thu, 24 Sep 2020 01:56:02 +0800 Message-Id: <20200923175602.9523-1-kai.heng.feng@canonical.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Realtek bluetooth controller may fail to work after system sleep: [ 1272.707670] Bluetooth: hci0: command 0x1001 tx timeout [ 1280.835712] Bluetooth: hci0: RTL: HCI_OP_READ_LOCAL_VERSION failed (-110) If platform firmware doesn't cut power off during suspend, the firmware is considered retained in controller but the driver is still asking USB core to perform a reset-resume. This can make bluetooth controller unusable. So avoid unnecessary reset to resolve the issue. For devices that really lose power during suspend, USB core will detect and handle reset-resume correctly. Signed-off-by: Kai-Heng Feng --- drivers/bluetooth/btusb.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 8d2608ddfd08..de86ef4388f9 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -4255,17 +4255,15 @@ static int btusb_suspend(struct usb_interface *intf, pm_message_t message) enable_irq(data->oob_wake_irq); } - /* For global suspend, Realtek devices lose the loaded fw - * in them. But for autosuspend, firmware should remain. - * Actually, it depends on whether the usb host sends + /* For global suspend, Realtek devices lose the loaded fw in them if + * platform firmware cut power off. But for autosuspend, firmware + * should remain. Actually, it depends on whether the usb host sends * set feature (enable wakeup) or not. */ if (test_bit(BTUSB_WAKEUP_DISABLE, &data->flags)) { if (PMSG_IS_AUTO(message) && device_can_wakeup(&data->udev->dev)) data->udev->do_remote_wakeup = 1; - else if (!PMSG_IS_AUTO(message)) - data->udev->reset_resume = 1; } return 0; -- 2.17.1