Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4510377ybv; Mon, 17 Feb 2020 00:15:41 -0800 (PST) X-Google-Smtp-Source: APXvYqyT3ll0YOxM4bumKngdNWS5oSirwWUjXQIfBevr9WWCgiE69etQqGCAHCCYn6kESA1sQFnb X-Received: by 2002:a9d:664a:: with SMTP id q10mr10733339otm.298.1581927341151; Mon, 17 Feb 2020 00:15:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581927341; cv=none; d=google.com; s=arc-20160816; b=VZ2GdgkVm1VE06wQHHHDL+ESqXG5TmtmTYMbmOTovIzs0+8HIv8ijf/g2g2kC7D8vG jhURLPzUcovtRwDKVOWWO8VDZpuS4CPmpjzqqUhXaHryhz+Hqe1SAfIg8POS8dKjklTD kRRb2pgOXRN/a4p40mHlAmIfBOUJK8HRMvjKrWzqrLo3djpKP2fAE+pFk8RKWYTi25bZ QSS4LIWau01dZmDKeHwiQB11ESg8y3QsgRiyM1mNz5THwEWIi7Nl/33tmwaCRtkmzGB/ iXzK9b2CxrGT/9JD9kjAjuoPGOaloOiQJyxALoCihRbmRaZObnAOBRJ1LNvcAh90rG9i AsTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:authenticated-by; bh=Wx1DzBhl9AZBc9GmrhN2SedkYcV3/AFta21k6nb7q/Q=; b=StCYETASgl59+eEIg4wDn22D0slM+1dIjdXaT2j5OyfLzxRkhqGSE4Vl9lsuqUBxn3 Aq7qbZVQ53Bw1BEWtuWYt/jI/VuGtyKBStblhNZvmtDJyDmnu5rk8dkr+I+32zx2y8HW JSLiueQzgrubkioTyN+J175c5Wc1XUl25alatVY27roe0MoI7nFaS1trtms5+muGC/ov n+2MVEAimxbbSuLgtFYK7opRi/zTNSEyltphyxfh874v3kvS6ngQfBldMIFfyScqgs1t XrteJgXyqC86UOLBftvQzIvMe8eyAPBUFW0i+lIYhu1f2bG69mD2GjDHZ+ugHvXltiI/ 4j2w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m14si6567259otr.131.2020.02.17.00.15.23; Mon, 17 Feb 2020 00:15:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727545AbgBQIPR (ORCPT + 99 others); Mon, 17 Feb 2020 03:15:17 -0500 Received: from rtits2.realtek.com ([211.75.126.72]:51860 "EHLO rtits2.realtek.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727332AbgBQIPR (ORCPT ); Mon, 17 Feb 2020 03:15:17 -0500 Authenticated-By: X-SpamFilter-By: BOX Solutions SpamTrap 5.62 with qID 01H8F432028939, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (RTEXMB06.realtek.com.tw[172.21.6.99]) by rtits2.realtek.com.tw (8.15.2/2.57/5.78) with ESMTPS id 01H8F432028939 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 Feb 2020 16:15:04 +0800 Received: from RTEXMB03.realtek.com.tw (172.21.6.96) by RTEXMB06.realtek.com.tw (172.21.6.99) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1779.2; Mon, 17 Feb 2020 16:15:03 +0800 Received: from localhost.localdomain (172.21.83.110) by RTEXMB03.realtek.com.tw (172.21.6.96) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1779.2; Mon, 17 Feb 2020 16:15:03 +0800 From: To: CC: , , , , , Subject: [PATCH v2] Bluetooth: hci_h5: btrtl: Add support for RTL8822C Date: Mon, 17 Feb 2020 16:14:55 +0800 Message-ID: <20200217081455.30938-1-max.chou@realtek.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.21.83.110] X-ClientProxiedBy: RTEXMB03.realtek.com.tw (172.21.6.96) To RTEXMB03.realtek.com.tw (172.21.6.96) Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Max Chou Add new compatible and FW loading support for RTL8822C. Signed-off-by: Max Chou --- Changes in v2: - Separate the code description for ACPI and OF - Note that forgiving my less experience, I can not find bt3wire.c from the upstream. I just find hci_h5.c can support Realtek Bluetooth controller, so I modify the code here for new chip support. --- drivers/bluetooth/Kconfig | 2 +- drivers/bluetooth/btrtl.c | 12 ++++++++++++ drivers/bluetooth/hci_h5.c | 19 +++++++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/drivers/bluetooth/Kconfig b/drivers/bluetooth/Kconfig index f7aa2dc1ff85..052020b07e56 100644 --- a/drivers/bluetooth/Kconfig +++ b/drivers/bluetooth/Kconfig @@ -211,7 +211,7 @@ config BT_HCIUART_RTL depends on BT_HCIUART depends on BT_HCIUART_SERDEV depends on GPIOLIB - depends on ACPI + depends on (ACPI || SERIAL_DEV_CTRL_TTYPORT) select BT_HCIUART_3WIRE select BT_RTL help diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c index 577cfa3329db..67f4bc21e7c5 100644 --- a/drivers/bluetooth/btrtl.c +++ b/drivers/bluetooth/btrtl.c @@ -136,6 +136,18 @@ static const struct id_table ic_id_table[] = { .fw_name = "rtl_bt/rtl8761a_fw.bin", .cfg_name = "rtl_bt/rtl8761a_config" }, + /* 8822C with UART interface */ + { .match_flags = IC_MATCH_FL_LMPSUBV | IC_MATCH_FL_HCIREV | + IC_MATCH_FL_HCIBUS, + .lmp_subver = RTL_ROM_LMP_8822B, + .hci_rev = 0x000c, + .hci_ver = 0x0a, + .hci_bus = HCI_UART, + .config_needed = true, + .has_rom_version = true, + .fw_name = "rtl_bt/rtl8822cs_fw.bin", + .cfg_name = "rtl_bt/rtl8822cs_config" }, + /* 8822C with USB interface */ { IC_INFO(RTL_ROM_LMP_8822B, 0xc), .config_needed = false, diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c index 0b14547482a7..4e4d58a73295 100644 --- a/drivers/bluetooth/hci_h5.c +++ b/drivers/bluetooth/hci_h5.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include @@ -786,6 +787,7 @@ static const struct hci_uart_proto h5p = { static int h5_serdev_probe(struct serdev_device *serdev) { const struct acpi_device_id *match; + const void *data; struct device *dev = &serdev->dev; struct h5 *h5; @@ -810,8 +812,15 @@ static int h5_serdev_probe(struct serdev_device *serdev) if (h5->vnd->acpi_gpio_map) devm_acpi_dev_add_driver_gpios(dev, h5->vnd->acpi_gpio_map); + } else { + data = of_device_get_match_data(dev); + if (!data) + return -ENODEV; + + h5->vnd = (const struct h5_vnd *)data; } + h5->enable_gpio = devm_gpiod_get_optional(dev, "enable", GPIOD_OUT_LOW); if (IS_ERR(h5->enable_gpio)) return PTR_ERR(h5->enable_gpio); @@ -1003,6 +1012,15 @@ static const struct dev_pm_ops h5_serdev_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(h5_serdev_suspend, h5_serdev_resume) }; +static const struct of_device_id rtl_bluetooth_of_match[] = { +#ifdef CONFIG_BT_HCIUART_RTL + { .compatible = "realtek,rtl8822cs-bt", + .data = (const void *)&rtl_vnd }, +#endif + { }, +}; +MODULE_DEVICE_TABLE(of, rtl_bluetooth_of_match); + static struct serdev_device_driver h5_serdev_driver = { .probe = h5_serdev_probe, .remove = h5_serdev_remove, @@ -1010,6 +1028,7 @@ static struct serdev_device_driver h5_serdev_driver = { .name = "hci_uart_h5", .acpi_match_table = ACPI_PTR(h5_acpi_match), .pm = &h5_serdev_pm_ops, + .of_match_table = rtl_bluetooth_of_match, }, }; -- 2.17.1