diff mbox series

[4/8] Bluetooth: hci_h5: Add support for binding RTL8723BS with device tree

Message ID 20190118170232.16142-5-anarsoul@gmail.com (mailing list archive)
State New, archived
Headers show
Series Add support for rtl8723bs/rtl8723cs bluetooth | expand

Commit Message

Vasily Khoruzhick Jan. 18, 2019, 5:02 p.m. UTC
RTL8723BS is often used in ARM boards, so add ability to bind it
using device tree.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
---
 drivers/bluetooth/hci_h5.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

Comments

kernel test robot Jan. 21, 2019, 2:44 p.m. UTC | #1
Hi Vasily,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on bluetooth-next/master]
[also build test ERROR on v5.0-rc2 next-20190116]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Vasily-Khoruzhick/Add-support-for-rtl8723bs-rtl8723cs-bluetooth/20190121-190321
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master
config: nds32-allyesconfig (attached as .config)
compiler: nds32le-linux-gcc (GCC) 6.4.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=6.4.0 make.cross ARCH=nds32 

All errors (new ones prefixed by >>):

>> drivers/bluetooth/hci_h5.c:1034:12: error: 'h5_btrtl_setup' undeclared here (not in a function)
     .setup  = h5_btrtl_setup,
               ^~~~~~~~~~~~~~
>> drivers/bluetooth/hci_h5.c:1035:11: error: 'h5_btrtl_open' undeclared here (not in a function)
     .open  = h5_btrtl_open,
              ^~~~~~~~~~~~~
>> drivers/bluetooth/hci_h5.c:1036:12: error: 'h5_btrtl_close' undeclared here (not in a function)
     .close  = h5_btrtl_close,
               ^~~~~~~~~~~~~~

vim +/h5_btrtl_setup +1034 drivers/bluetooth/hci_h5.c

  1032	
  1033	static struct h5_vnd rtl8723_of_vnd = {
> 1034		.setup		= h5_btrtl_setup,
> 1035		.open		= h5_btrtl_open,
> 1036		.close		= h5_btrtl_close,
  1037	};
  1038	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
kernel test robot Jan. 21, 2019, 3:09 p.m. UTC | #2
Hi Vasily,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on bluetooth-next/master]
[also build test ERROR on v5.0-rc2 next-20190116]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Vasily-Khoruzhick/Add-support-for-rtl8723bs-rtl8723cs-bluetooth/20190121-190321
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master
config: xtensa-allyesconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 8.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=8.2.0 make.cross ARCH=xtensa 

All errors (new ones prefixed by >>):

>> drivers/bluetooth/hci_h5.c:1034:12: error: 'h5_btrtl_setup' undeclared here (not in a function); did you mean 'h5_setup'?
     .setup  = h5_btrtl_setup,
               ^~~~~~~~~~~~~~
               h5_setup
>> drivers/bluetooth/hci_h5.c:1035:11: error: 'h5_btrtl_open' undeclared here (not in a function); did you mean 'h5_open'?
     .open  = h5_btrtl_open,
              ^~~~~~~~~~~~~
              h5_open
>> drivers/bluetooth/hci_h5.c:1036:12: error: 'h5_btrtl_close' undeclared here (not in a function); did you mean 'h5_close'?
     .close  = h5_btrtl_close,
               ^~~~~~~~~~~~~~
               h5_close

vim +1034 drivers/bluetooth/hci_h5.c

  1032	
  1033	static struct h5_vnd rtl8723_of_vnd = {
> 1034		.setup		= h5_btrtl_setup,
> 1035		.open		= h5_btrtl_open,
> 1036		.close		= h5_btrtl_close,
  1037	};
  1038	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox series

Patch

diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c
index 7ead8c3d8657..44f848c02c63 100644
--- a/drivers/bluetooth/hci_h5.c
+++ b/drivers/bluetooth/hci_h5.c
@@ -26,6 +26,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>
 
@@ -823,6 +824,11 @@  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 {
+		h5->vnd = (const struct h5_vnd *)
+				of_device_get_match_data(&serdev->dev);
+		of_property_read_string(serdev->dev.of_node,
+					"firmware-postfix", &h5->id);
 	}
 
 	h5->enable_gpio = devm_gpiod_get_optional(dev, "enable", GPIOD_OUT_LOW);
@@ -1024,12 +1030,26 @@  static const struct dev_pm_ops h5_serdev_pm_ops = {
 	SET_SYSTEM_SLEEP_PM_OPS(h5_serdev_suspend, h5_serdev_resume)
 };
 
+static struct h5_vnd rtl8723_of_vnd = {
+	.setup		= h5_btrtl_setup,
+	.open		= h5_btrtl_open,
+	.close		= h5_btrtl_close,
+};
+
+static const struct of_device_id h5_of_match[] = {
+	{ .compatible = "realtek,rtl8723bs-bt", .data = &rtl8723_of_vnd },
+	{ .compatible = "realtek,rtl8723cs-bt", .data = &rtl8723_of_vnd },
+	{ /* sentinel */ },
+};
+MODULE_DEVICE_TABLE(of, h5_of_match);
+
 static struct serdev_device_driver h5_serdev_driver = {
 	.probe = h5_serdev_probe,
 	.remove = h5_serdev_remove,
 	.driver = {
 		.name = "hci_uart_h5",
 		.acpi_match_table = ACPI_PTR(h5_acpi_match),
+		.of_match_table = of_match_ptr(h5_of_match),
 		.pm = &h5_serdev_pm_ops,
 	},
 };