From patchwork Wed Jan 26 05:31:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viacheslav X-Patchwork-Id: 12724611 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2ADADC2BA4C for ; Wed, 26 Jan 2022 05:31:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233300AbiAZFbT (ORCPT ); Wed, 26 Jan 2022 00:31:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233112AbiAZFbR (ORCPT ); Wed, 26 Jan 2022 00:31:17 -0500 Received: from mx.msync.work (mx.msync.work [IPv6:2a01:4f9:2b:2dc2::3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDD06C061744; Tue, 25 Jan 2022 21:31:16 -0800 (PST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id C42BE282C36; Wed, 26 Jan 2022 05:31:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lexina.in; s=dkim; t=1643175074; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=3t996u2cCjv/tctIaoZzV+hoyE2QUpyMSv9doBI04So=; b=ajkW+Lz5FzQfoGu79yh2Bv8jcbbpZj4x0a1JSyZSNniu5+k7NkFJ8HXPXsJVcf+81fqhis z+WzzLUm6Z8MM2DszUPoNEw0e+/eSornVrM+qDDRdKoutfYwC9sN3N7UFtbum5G7EzIahv btt42ubNeOPlki/Kg+ykyFR2A7cLPcwoMmyL7a09XnhnS6Esh//Y9voToO+7rVnvhacKOq aPO1eZXABb3ke4GLw7jYhwn0bVXdhwShZB6xkZbTa07ug9A9HsBY9ic3fxedTp3HMxkqJ2 X7BaKuxZeaLftciWmCP8f/TVbWd51bhxpHaMwWFHc1vQQPnqh2GJ/c0R3VUKwA== From: Vyacheslav Bocharov To: marcel@holtmann.org, johan.hedberg@gmail.com, luiz.dentz@gmail.com, linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Rudi Heitbaum Subject: [PATCH v6 1/2] Bluetooth: btrtl: Add support for RTL8822C hci_ver 0x08 Date: Wed, 26 Jan 2022 08:31:02 +0300 Message-Id: <20220126053103.3261693-2-adeep@lexina.in> In-Reply-To: <20220126053103.3261693-1-adeep@lexina.in> References: <20220126053103.3261693-1-adeep@lexina.in> MIME-Version: 1.0 X-Last-TLS-Session-Version: TLSv1.3 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Add a variation of RTL8822CS with hci_ver = 0x08. This is fully similar to RTL8822CS with hci_ver = 0x0a observed on the Tanix TX6 Android set-top box and JetHome JetHub H1. Signed-off-by: Vyacheslav Bocharov Signed-off-by: Rudi Heitbaum --- drivers/bluetooth/btrtl.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c index c2bdd1e6060e..c2030f7e25b4 100644 --- a/drivers/bluetooth/btrtl.c +++ b/drivers/bluetooth/btrtl.c @@ -148,6 +148,14 @@ static const struct id_table ic_id_table[] = { .fw_name = "rtl_bt/rtl8761bu_fw.bin", .cfg_name = "rtl_bt/rtl8761bu_config" }, + /* 8822C with UART interface */ + { IC_INFO(RTL_ROM_LMP_8822B, 0xc, 0x8, HCI_UART), + .config_needed = true, + .has_rom_version = true, + .has_msft_ext = true, + .fw_name = "rtl_bt/rtl8822cs_fw.bin", + .cfg_name = "rtl_bt/rtl8822cs_config" }, + /* 8822C with UART interface */ { IC_INFO(RTL_ROM_LMP_8822B, 0xc, 0xa, HCI_UART), .config_needed = true, From patchwork Wed Jan 26 05:31:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viacheslav X-Patchwork-Id: 12724610 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67E79C63686 for ; Wed, 26 Jan 2022 05:31:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233427AbiAZFbU (ORCPT ); Wed, 26 Jan 2022 00:31:20 -0500 Received: from mx.msync.work ([95.217.65.204]:48834 "EHLO mx.msync.work" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233071AbiAZFbT (ORCPT ); Wed, 26 Jan 2022 00:31:19 -0500 X-Greylist: delayed 47802 seconds by postgrey-1.27 at vger.kernel.org; Wed, 26 Jan 2022 00:31:19 EST Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id D1171282C37; Wed, 26 Jan 2022 05:31:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lexina.in; s=dkim; t=1643175075; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=43g7eQfNihO4PvfDCp/q0KW8Ai3xysLurmj0NB1X6JI=; b=VCRhhIFdjeNKSoofU6YOSCS+vKVgFmgWOdy4dfk2phMG7BiPvu5yIiEk0bRLtadwzZrGKB sZ8RMmMC7O/rPSq+BCegZ1CLVYNuf3BddjnixVjidxmtOdawNYXZtuPUOmBDMov9ivSsq2 VP4fvjXz/dkCG2M/Q6vbmOMItp0/M6nHwjO1dQNZdCc2u9m0FACD9PFfQD1nlWrbyglxjn yjFCBHa6/hNJD02A3aFeeGTilkyTppNqXgfBXPPg5ouvc7F0gxanxih9a5g0PWUxKIms2r 1jS+hqL+rECjxNgdcOTyWB9IShnJHEGPmMHHuW2flMc7V+3D8V+bQuPOtkVTnQ== From: Vyacheslav Bocharov To: marcel@holtmann.org, johan.hedberg@gmail.com, luiz.dentz@gmail.com, linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Rudi Heitbaum Subject: [PATCH v6 2/2] Bluetooth: hci_h5: Add power reset via gpio in h5_btrtl_open Date: Wed, 26 Jan 2022 08:31:03 +0300 Message-Id: <20220126053103.3261693-3-adeep@lexina.in> In-Reply-To: <20220126053103.3261693-1-adeep@lexina.in> References: <20220126053103.3261693-1-adeep@lexina.in> MIME-Version: 1.0 X-Last-TLS-Session-Version: TLSv1.3 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Add power reset for bluetooth via enable-gpios in h5_btrtl_open function. While testing the RTL8822CS SDIO WiFi/BT adapter, it was found that in some cases the kernel could not initialize BT firmware. However, manually resetting the adapter via gpio (off/on sequence) allows it to start correctly. Apparently, when the system starts, the adapter is in an undefined state (including unknown gpio state after starting uboot). A forced reset helps to initialize the adapter in most cases. It has been found experimentally that 100 ms is sufficient for a reset. Signed-off-by: Vyacheslav Bocharov --- drivers/bluetooth/hci_h5.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c index 34286ffe0568..fdf504b0d265 100644 --- a/drivers/bluetooth/hci_h5.c +++ b/drivers/bluetooth/hci_h5.c @@ -966,6 +966,11 @@ static void h5_btrtl_open(struct h5 *h5) pm_runtime_enable(&h5->hu->serdev->dev); } + /* The controller needs reset to startup */ + gpiod_set_value_cansleep(h5->enable_gpio, 0); + gpiod_set_value_cansleep(h5->device_wake_gpio, 0); + msleep(100); + /* The controller needs up to 500ms to wakeup */ gpiod_set_value_cansleep(h5->enable_gpio, 1); gpiod_set_value_cansleep(h5->device_wake_gpio, 1);