Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1725385
| Path | csiph.com!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Bjorn Andersson <bjorn.andersson@linaro.org> |
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 2/2] Bluetooth: btqcomsmd: BD address setup |
| Date | Sat, 02 Sep 2017 00:20:02 +0200 |
| Message-ID | <ul2sa-2Jr-9@gated-at.bofh.it> (permalink) |
| References | <ul134-1I4-11@gated-at.bofh.it> <ul134-1I4-13@gated-at.bofh.it> <ul133-1I4-9@gated-at.bofh.it> |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Hho5hIU36kvrqwDtbkd/DSNKxr9dVmgeMKPX2LoRNkM=; b=RiQOjPVvKZWSIpXBEaQPV+G7rc5O1afLgszcxGbwqEKpBYzzaYXlu/tQ74J+ydy5Ps +tiBhNi/imM6j5PYjG4KzpuO3ExWCnIQoV9nIE3T8oLhjEuIAuUCH/+TWHTvNJdq0nRa I29MCKH5At4qMwQqBHvQZF+Hbz2HVAbe6XxP8= |
| X-Google-Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Hho5hIU36kvrqwDtbkd/DSNKxr9dVmgeMKPX2LoRNkM=; b=Ix7GiUAHZkLTr7GmS04l/BZIhy3LWP+3Uo+3NJv6f7LGqrP4qlNuqPqliBN5KxeQzV UnofFxrJ4sKkXW0CgUBZ7BiGW1jjkTEbvrOFWkXl1HV88sHnHBKaUfFvsEZkSSO33BWB LsRGsn1tQUDKmVLD3pEItAYWJK50VPVAD6EkNLu2SCxezzo4ukFOG3W1+xSOH1S25wP1 GHQ5ZmJSBSEF41Fp4t7d877EKpolI3nWgAQlFrzK1EgpGDFhoZQdFpHcN2zo7XFlFEty GNJPKVtIWWBqC1ClZpJojBOZe4ihSrWbYgv+0p1M/xx7cWRz9wqidCnqsthNQmbraAG6 qsEw== |
| X-Gm-Message-State | AHPjjUhmRF/r/PyTTOYJIKX2HbXvdUtiUMMpgwTxxX2F7kQVQ5hjAbN+ Dvk5aBtVkWR4IHbR |
| X-Google-SMTP-Source | ADKCNb4+QErJia/TvCuOzvyzLxnoU+ZcADmYcERad7trGf6BWdqnVXTaErzyxT0NnZZf9WXI+Uodsg== |
| X-Received | by 10.84.149.102 with SMTP id b35mr4268187plh.392.1504304107522; Fri, 01 Sep 2017 15:15:07 -0700 (PDT) |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Disposition | inline |
| User-Agent | Mutt/1.8.3 (2017-05-23) |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 108 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | "Gustavo F. Padovan" <gustavo@padovan.org>, Johan Hedberg <johan.hedberg@gmail.com>, "David S. Miller" <davem@davemloft.net>, "open list:BLUETOOTH DRIVERS" <linux-bluetooth@vger.kernel.org>, Network Development <netdev@vger.kernel.org>, LKML <linux-kernel@vger.kernel.org>, linux-arm-msm@vger.kernel.org, Loic Poulain <loic.poulain@linaro.org>, Rob Herring <robh@kernel.org> |
| X-Original-Date | Fri, 1 Sep 2017 15:15:03 -0700 |
| X-Original-Message-ID | <20170901221503.GA1165@minitux> |
| X-Original-References | <20170901204118.17123-1-bjorn.andersson@linaro.org> <20170901204118.17123-3-bjorn.andersson@linaro.org> <5EC41247-54CD-4F1D-84EC-E94F80A67805@holtmann.org> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1725385 |
Show key headers only | View raw
On Fri 01 Sep 13:47 PDT 2017, Marcel Holtmann wrote:
> Hi Bjorn,
>
> > Bluetooth BD address can be retrieved in the same way as
> > for wcnss-wlan MAC address. This patch mainly stores the
> > local-mac-address property and sets the BD address during
> > hci device setup.
> >
> > Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
> > Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> > ---
> > drivers/bluetooth/btqcomsmd.c | 28 ++++++++++++++++++++++++++++
> > 1 file changed, 28 insertions(+)
> >
> > diff --git a/drivers/bluetooth/btqcomsmd.c b/drivers/bluetooth/btqcomsmd.c
> > index d00c4fdae924..443bb2099329 100644
> > --- a/drivers/bluetooth/btqcomsmd.c
> > +++ b/drivers/bluetooth/btqcomsmd.c
> > @@ -26,6 +26,7 @@
> > struct btqcomsmd {
> > struct hci_dev *hdev;
> >
> > + const bdaddr_t *addr;
> > struct rpmsg_endpoint *acl_channel;
> > struct rpmsg_endpoint *cmd_channel;
> > };
> > @@ -100,6 +101,27 @@ static int btqcomsmd_close(struct hci_dev *hdev)
> > return 0;
> > }
> >
> > +static int btqcomsmd_setup(struct hci_dev *hdev)
> > +{
> > + struct btqcomsmd *btq = hci_get_drvdata(hdev);
> > + struct sk_buff *skb;
> > +
> > + skb = __hci_cmd_sync(hdev, HCI_OP_RESET, 0, NULL, HCI_INIT_TIMEOUT);
> > + if (IS_ERR(skb))
> > + return PTR_ERR(skb);
> > + kfree_skb(skb);
> > +
> > + if (btq->addr) {
> > + bdaddr_t bdaddr;
> > +
> > + /* btq->addr stored with most significant byte first */
> > + baswap(&bdaddr, btq->addr);
> > + return qca_set_bdaddr_rome(hdev, &bdaddr);
> > + }
> > +
> > + return 0;
> > +}
> > +
> > static int btqcomsmd_probe(struct platform_device *pdev)
> > {
> > struct btqcomsmd *btq;
> > @@ -123,6 +145,11 @@ static int btqcomsmd_probe(struct platform_device *pdev)
> > if (IS_ERR(btq->cmd_channel))
> > return PTR_ERR(btq->cmd_channel);
> >
> > + btq->addr = of_get_property(pdev->dev.of_node, "local-mac-address",
> > + &ret);
> > + if (ret != sizeof(bdaddr_t))
> > + btq->addr = NULL;
> > +
> > hdev = hci_alloc_dev();
> > if (!hdev)
> > return -ENOMEM;
> > @@ -135,6 +162,7 @@ static int btqcomsmd_probe(struct platform_device *pdev)
> > hdev->open = btqcomsmd_open;
> > hdev->close = btqcomsmd_close;
> > hdev->send = btqcomsmd_send;
> > + hdev->setup = btqcomsmd_setup;
> > hdev->set_bdaddr = qca_set_bdaddr_rome;
>
> I do not like this patch. Why not just set HCI_QUIRK_INVALID_BDADDR
> and let a userspace tool deal with reading the BD_ADDR from some
> storage.
>
That's what we currently have, but we regularly get complaints from
developers using our board (DB410c).
We're maintaining a Debian-based and an OpenEmbedded-based build and at
least in the past btmgmt was not available in these - so we would have
to maintain both a custom BlueZ package and then some scripts to inject
the appropriate mac address.
Beyond these reference builds our users tend to build their own system
images and I was hoping that they would not be forced to have a custom
hook running each time hci0 is registered.
> Frankly I do not get this WiFI MAC address or BD_ADDR stored in DT. I
> assumed the DT is suppose to describe hardware and not some value that
> is normally retrieved for OTP or alike.
>
While I share your skepticism here I find it way superior over the
various cases where this information is hard coded in some firmware file
that has to be patched for each device - in particular when considering
the out-of-tree workarounds that follow when said firmware file is not
allowed to be modified on the device (e.g. in Android).
And note that it's not _stored_ in DT, it's passed from the boot loader
in DT - and it's still optional, so if an OEM has other means to
provision the BD_ADDR they can still handle this in user space.
Regards,
Bjorn
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [PATCH 2/2] Bluetooth: btqcomsmd: BD address setup Marcel Holtmann <marcel@holtmann.org> - 2017-09-01 22:50 +0200
Re: [PATCH 2/2] Bluetooth: btqcomsmd: BD address setup Rob Herring <robh@kernel.org> - 2017-09-01 23:30 +0200
Re: [PATCH 2/2] Bluetooth: btqcomsmd: BD address setup Marcel Holtmann <marcel@holtmann.org> - 2017-09-02 08:20 +0200
Re: [PATCH 2/2] Bluetooth: btqcomsmd: BD address setup Bjorn Andersson <bjorn.andersson@linaro.org> - 2017-09-03 23:20 +0200
Re: [PATCH 2/2] Bluetooth: btqcomsmd: BD address setup Bjorn Andersson <bjorn.andersson@linaro.org> - 2017-09-02 00:20 +0200
Re: [PATCH 2/2] Bluetooth: btqcomsmd: BD address setup Marcel Holtmann <marcel@holtmann.org> - 2017-09-02 08:40 +0200
csiph-web