Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 766154b7 authored by Loic Poulain's avatar Loic Poulain Committed by Marcel Holtmann
Browse files

Bluetooth: btqcomsmd: retrieve BD address from DT property



Retrieve BD address from the local-bd-address property.
This address must be unique and is usually added in the DT
by the bootloader which has access to the provisioned data.

Signed-off-by: default avatarLoic Poulain <loic.poulain@linaro.org>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent e7868a2f
Loading
Loading
Loading
Loading
+11 −0
Original line number Original line Diff line number Diff line
@@ -15,6 +15,8 @@
#include <linux/module.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/slab.h>
#include <linux/rpmsg.h>
#include <linux/rpmsg.h>
#include <linux/of.h>

#include <linux/soc/qcom/wcnss_ctrl.h>
#include <linux/soc/qcom/wcnss_ctrl.h>
#include <linux/platform_device.h>
#include <linux/platform_device.h>


@@ -156,6 +158,15 @@ static int btqcomsmd_probe(struct platform_device *pdev)
	if (IS_ERR(btq->cmd_channel))
	if (IS_ERR(btq->cmd_channel))
		return PTR_ERR(btq->cmd_channel);
		return PTR_ERR(btq->cmd_channel);


	/* The local-bd-address property is usually injected by the
	 * bootloader which has access to the allocated BD address.
	 */
	if (!of_property_read_u8_array(pdev->dev.of_node, "local-bd-address",
				       (u8 *)&btq->bdaddr, sizeof(bdaddr_t))) {
		dev_info(&pdev->dev, "BD address %pMR retrieved from device-tree",
			 &btq->bdaddr);
	}

	hdev = hci_alloc_dev();
	hdev = hci_alloc_dev();
	if (!hdev)
	if (!hdev)
		return -ENOMEM;
		return -ENOMEM;