Bluetooth: hci_h5: btrtl: Add support for RTL8822C
PATCH v2 1/1 Bluetooth: hci_h5: btrtl: Add support for RTL8822C
From: Max Chou <[email protected]>
Add new compatible and FW loading support for RTL8822C.
---
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(-)
drivers/bluetooth/Kconfig +1 -1
@@ -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
drivers/bluetooth/btrtl.c +12 -0
@@ -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,
drivers/bluetooth/hci_h5.c +19 -0
@@ -11,6 +11,7 @@#include <linux/gpio/consumer.h> #include <linux/kernel.h> #include <linux/mod_devicetable.h> +#include <linux/of_device.h> #include <linux/serdev.h> #include <linux/skbuff.h>
@@ -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, }, };
Signature · 1 line
2.17.1
Marcel Holtmann
maintainerHi Max,
Quoted 10 lines
Add new compatible and FW loading support for RTL8822C.
Signed-off-by Max Chou <[email protected]>---
Changes in v2:
- Separate the code description for ACPI and OF
- Note that forgiving my less experience, I can not findbt3wire.cfrom the upstream. I just findhci_h5.ccan support Realtek Bluetooth controller, so I modify the code here for new chip support.
---
Quoted 4 lines
drivers/bluetooth/Kconfig | 2 +- drivers/bluetooth/btrtl.c | 12 ++++++++++++ drivers/bluetooth/hci_h5.c | 19 +++++++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-)
patch has been applied to bluetooth-next tree.
Regards
Marcel