Skip to content

Commit 848fc61

Browse files
rtkbt-maxholtmann
authored andcommitted
Bluetooth: hci_h5: btrtl: Add support for RTL8822C
Add new compatible and FW loading support for RTL8822C. Signed-off-by: Max Chou <max.chou@realtek.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
1 parent e22998f commit 848fc61

3 files changed

Lines changed: 33 additions & 1 deletion

File tree

‎drivers/bluetooth/Kconfig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ config BT_HCIUART_RTL
211211
depends on BT_HCIUART
212212
depends on BT_HCIUART_SERDEV
213213
depends on GPIOLIB
214-
depends on ACPI
214+
depends on (ACPI || SERIAL_DEV_CTRL_TTYPORT)
215215
select BT_HCIUART_3WIRE
216216
select BT_RTL
217217
help

‎drivers/bluetooth/btrtl.c‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,18 @@ static const struct id_table ic_id_table[] = {
136136
.fw_name = "rtl_bt/rtl8761a_fw.bin",
137137
.cfg_name = "rtl_bt/rtl8761a_config" },
138138

139+
/* 8822C with UART interface */
140+
{ .match_flags = IC_MATCH_FL_LMPSUBV | IC_MATCH_FL_HCIREV |
141+
IC_MATCH_FL_HCIBUS,
142+
.lmp_subver = RTL_ROM_LMP_8822B,
143+
.hci_rev = 0x000c,
144+
.hci_ver = 0x0a,
145+
.hci_bus = HCI_UART,
146+
.config_needed = true,
147+
.has_rom_version = true,
148+
.fw_name = "rtl_bt/rtl8822cs_fw.bin",
149+
.cfg_name = "rtl_bt/rtl8822cs_config" },
150+
139151
/* 8822C with USB interface */
140152
{ IC_INFO(RTL_ROM_LMP_8822B, 0xc),
141153
.config_needed = false,

‎drivers/bluetooth/hci_h5.c‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <linux/gpio/consumer.h>
1212
#include <linux/kernel.h>
1313
#include <linux/mod_devicetable.h>
14+
#include <linux/of_device.h>
1415
#include <linux/serdev.h>
1516
#include <linux/skbuff.h>
1617

@@ -810,8 +811,17 @@ static int h5_serdev_probe(struct serdev_device *serdev)
810811
if (h5->vnd->acpi_gpio_map)
811812
devm_acpi_dev_add_driver_gpios(dev,
812813
h5->vnd->acpi_gpio_map);
814+
} else {
815+
const void *data;
816+
817+
data = of_device_get_match_data(dev);
818+
if (!data)
819+
return -ENODEV;
820+
821+
h5->vnd = (const struct h5_vnd *)data;
813822
}
814823

824+
815825
h5->enable_gpio = devm_gpiod_get_optional(dev, "enable", GPIOD_OUT_LOW);
816826
if (IS_ERR(h5->enable_gpio))
817827
return PTR_ERR(h5->enable_gpio);
@@ -1003,13 +1013,23 @@ static const struct dev_pm_ops h5_serdev_pm_ops = {
10031013
SET_SYSTEM_SLEEP_PM_OPS(h5_serdev_suspend, h5_serdev_resume)
10041014
};
10051015

1016+
static const struct of_device_id rtl_bluetooth_of_match[] = {
1017+
#ifdef CONFIG_BT_HCIUART_RTL
1018+
{ .compatible = "realtek,rtl8822cs-bt",
1019+
.data = (const void *)&rtl_vnd },
1020+
#endif
1021+
{ },
1022+
};
1023+
MODULE_DEVICE_TABLE(of, rtl_bluetooth_of_match);
1024+
10061025
static struct serdev_device_driver h5_serdev_driver = {
10071026
.probe = h5_serdev_probe,
10081027
.remove = h5_serdev_remove,
10091028
.driver = {
10101029
.name = "hci_uart_h5",
10111030
.acpi_match_table = ACPI_PTR(h5_acpi_match),
10121031
.pm = &h5_serdev_pm_ops,
1032+
.of_match_table = rtl_bluetooth_of_match,
10131033
},
10141034
};
10151035

0 commit comments

Comments
 (0)