devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vasily Khoruzhick <anarsoul@gmail.com>
To: "David S. Miller" <davem@davemloft.net>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Maxime Ripard <maxime.ripard@bootlin.com>,
	Chen-Yu Tsai <wens@csie.org>,
	Marcel Holtmann <marcel@holtmann.org>,
	Johan Hedberg <johan.hedberg@gmail.com>,
	Vasily Khoruzhick <anarsoul@gmail.com>,
	netdev@vger.kernel.org, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-bluetooth@vger.kernel.org
Subject: [PATCH 4/8] Bluetooth: hci_h5: Add support for binding RTL8723BS with device tree
Date: Fri, 18 Jan 2019 09:02:28 -0800	[thread overview]
Message-ID: <20190118170232.16142-5-anarsoul@gmail.com> (raw)
In-Reply-To: <20190118170232.16142-1-anarsoul@gmail.com>

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(+)

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,
 	},
 };
-- 
2.20.1

  parent reply	other threads:[~2019-01-18 17:02 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-18 17:02 [PATCH 0/8] Add support for rtl8723bs/rtl8723cs bluetooth Vasily Khoruzhick
2019-01-18 17:02 ` [PATCH 1/8] Bluetooth: Add new quirk for broken local ext features max_page Vasily Khoruzhick
2019-01-18 17:02 ` [PATCH 2/8] Bluetooth: hci_h5: Add support for reset GPIO Vasily Khoruzhick
2019-01-18 17:13   ` Chen-Yu Tsai
2019-01-18 17:02 ` [PATCH 3/8] dt-bindings: net: bluetooth: Add rtl8723bs-bluetooth Vasily Khoruzhick
2019-02-18 21:10   ` Rob Herring
2019-02-18 21:24     ` Vasily Khoruzhick
2019-02-18 22:08       ` Stefan Wahren
2019-02-18 22:10         ` Stefan Wahren
2019-02-18 22:28         ` Vasily Khoruzhick
2019-02-19 14:17           ` Rob Herring
2019-02-19 21:09             ` David Summers
2019-02-20  2:59               ` Chen-Yu Tsai
2019-02-22 19:14           ` David Summers
2019-02-22 19:21             ` Vasily Khoruzhick
2019-02-23 20:16               ` David Summers
2019-03-01 20:15               ` Martin Blumenstingl
2019-03-02  9:28                 ` 答复: " 陆朱伟
2019-03-02 16:43                   ` Martin Blumenstingl
2019-03-04  5:17                     ` 答复: " 陆朱伟
2019-02-19  8:56       ` Stefan Wahren
2019-02-19 14:14       ` Rob Herring
2019-02-19 21:25         ` Vasily Khoruzhick
2019-06-02  9:33         ` Luca Weiss
2019-01-18 17:02 ` Vasily Khoruzhick [this message]
2019-01-21 14:44   ` [PATCH 4/8] Bluetooth: hci_h5: Add support for binding RTL8723BS with device tree kbuild test robot
2019-01-21 15:09   ` kbuild test robot
2019-01-18 17:02 ` [PATCH 5/8] Bluetooth: btrtl: add support for the RTL8723CS Vasily Khoruzhick
2019-01-21 14:31   ` kbuild test robot
2019-01-18 17:02 ` [PATCH 6/8] arm64: allwinner: a64: enable Bluetooth On Pinebook Vasily Khoruzhick
2019-01-18 17:02 ` [PATCH 7/8] DO-NOT-MERGE: arm64: allwinner: a64: enable Bluetooth On Pine64 Vasily Khoruzhick
2019-01-18 17:02 ` [PATCH 8/8] DO-NOT-MERGE: arm64: allwinner: a64: enable Bluetooth On SoPine baseboard Vasily Khoruzhick

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190118170232.16142-5-anarsoul@gmail.com \
    --to=anarsoul@gmail.com \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=johan.hedberg@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=mark.rutland@arm.com \
    --cc=maxime.ripard@bootlin.com \
    --cc=netdev@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).