From patchwork Tue Sep 5 18:58:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 111710 Delivered-To: patch@linaro.org Received: by 10.140.94.166 with SMTP id g35csp3230211qge; Tue, 5 Sep 2017 11:58:57 -0700 (PDT) X-Received: by 10.84.246.200 with SMTP id j8mr5412721plt.360.1504637937132; Tue, 05 Sep 2017 11:58:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504637937; cv=none; d=google.com; s=arc-20160816; b=gV9JKPT0T5ab9eIMuHVlFkPCu9VXHx9otQed7Jx+qTneViERJL7rAhFsXWmdlQ8u0m yMxZXqRmG9yLnn5f50Fjc7NUxc17/4yFs0jEOZYDwN1dedFqxIU00onxdzf1O/ubsf6A pyjD/8T5EPJ+6bMlclDzYJE5DW5KGBpVOBFw/mzl33oiq/sIfVH1vWyEYcLj3QK+cRyq xzAWQ1U8iPkT8HlnV3csuGuGSx4u+RlbmIp7ksHqUgJU0DqW+eKBMBsV402PKQ7d93tv keAjUbklD7gUSyAYjjfFApPSU3J/4eZxc/X4vdYoiQgqrwK/zih2/aR3qG6lwxcMhZ03 zphg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=G1dl8ZQPfDkDlkaqyYSGlVXlnaq4/JMTkTO6ufRxJfo=; b=OXtulewD3ZbImxTCIce7YwhfWDwA8cirfu23CfOg2aqln2WeMWzpItg+VUFelSfb8K hLF9gywEQrXoFn1HWt8EaUeCKKbVctXTcUMPgDhIJRAOV8j/lptu+oLYAFNtbtucsai/ u9vjor3mUWPPGUiK511GubQMnT9K6SX2q1Uq2YEpMyotSTTaisxxFUzG0WBF+0jfj5Vb ptPFpnyWweRQe/RzLvMeHXW1vWN6kL14HeoWMhp2AKYBBdgMYmBzQA3TdyjASU/uA2pg iacT1ZOAka4rjdTttuzO3XuGXPNNj8PvpxEcR+KCHChMC4SxGxoP6aQSx4SmP1JJeEU/ C0+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=KpJLVxCo; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33si796789pla.341.2017.09.05.11.58.56; Tue, 05 Sep 2017 11:58:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=KpJLVxCo; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751413AbdIES6x (ORCPT + 6 others); Tue, 5 Sep 2017 14:58:53 -0400 Received: from mail-wr0-f179.google.com ([209.85.128.179]:35416 "EHLO mail-wr0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752384AbdIES6w (ORCPT ); Tue, 5 Sep 2017 14:58:52 -0400 Received: by mail-wr0-f179.google.com with SMTP id y15so10417273wrc.2 for ; Tue, 05 Sep 2017 11:58:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yeeGYQ6i2SMXzivn0GbTL2Z3a4WjMgSl9NaAvYtpkTo=; b=KpJLVxCoJdzTdCem3Q2TICjGoDh684qhjAyQHTxr7YHqAadoTQN28gLi/9RQ6BBV4r gld39iNBSx24ZqFMN84JzQJzTLGNzDnucW62XbzKbqWRQ4OCvJV+QU//lBDBL8cy+zj0 pd05F2vuaEAskb9vSgVVUKUOa6SADJdVsIgRc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=yeeGYQ6i2SMXzivn0GbTL2Z3a4WjMgSl9NaAvYtpkTo=; b=rT9CPxKKVSR3X/hTe+ftZYmNInuIfSXd2ilILLvMoeA5zCW5KUJdOLzMjzuC++n0MU s9boUDIJ2NjRjFc0AA+KRnt6bRJ3WNqQV2bTD6XQfZ+Q9cweisDtEAFirMxEqKCXPvzr UTLPUN2tGHeeNLNG4ZXvRDApT5XnqwJGGl83/xu0FffjyJWOPXFy23sR1RToTVCL+ZuN 9UyiAUcx29D18RxWZgMBASEF7++vn8VNRVKu8Y5v8pXDIhV4TWqXMCzXjGKnMRCzK2EP tm2H3a//1f5srJDbiKnO9TfvgGvQCo/XuXdtXL61jxkEAXJvBVOHG+5Qd8M+UzdD7jHs PJbg== X-Gm-Message-State: AHPjjUjdYT5Rdc7oyIL0QlStX1jTEtU/Nebvho5iaSFbWnhU7PXw83EV kALI7JzW5Qa9VGlQ X-Google-Smtp-Source: ADKCNb7D9WSFbMaKlWtJgeuWBFcrca9ZkyGGil2igaCllOLeAV5wdhIkocWiSk2IwIG8vGmFBOJQ9Q== X-Received: by 10.223.165.137 with SMTP id g9mr13688wrc.269.1504637930905; Tue, 05 Sep 2017 11:58:50 -0700 (PDT) Received: from loic-XPS-12.home (LFbn-1-2083-208.w90-76.abo.wanadoo.fr. [90.76.148.208]) by smtp.gmail.com with ESMTPSA id i15sm1312935wmg.26.2017.09.05.11.58.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 05 Sep 2017 11:58:50 -0700 (PDT) From: Loic Poulain To: marcel@holtmann.org, johan.hedberg@gmail.com, robh+dt@kernel.org Cc: linux-bluetooth@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, bjorn.andersson@linaro.org, Loic Poulain Subject: [PATCH v5 3/3] Bluetooth: btqcomsmd: retieve BD address from DT Date: Tue, 5 Sep 2017 20:58:43 +0200 Message-Id: <1504637923-21652-3-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1504637923-21652-1-git-send-email-loic.poulain@linaro.org> References: <1504637923-21652-1-git-send-email-loic.poulain@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Retrieve BD address from the DT 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: Loic Poulain --- v2: Set device as unconfigured if default address detected Add warning if BD addr retrieved from DT v3: if no addr retrieved from DT, unconditionally set the invalid BD addr flag. swap and set bdaddr in the platform probe v4: Add dt-bindings documentation split patch in two parts (setup, dt prop) use local-bd-address name instead of local-mac-address v5: remove 2/3 merged in bluetooth-next tree Add bluetooth.txt for common BT bindings expect local-bd-address in little-endian format drivers/bluetooth/btqcomsmd.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/bluetooth/btqcomsmd.c b/drivers/bluetooth/btqcomsmd.c index bd810d0..c6d3fd9 100644 --- a/drivers/bluetooth/btqcomsmd.c +++ b/drivers/bluetooth/btqcomsmd.c @@ -15,6 +15,8 @@ #include #include #include +#include + #include #include @@ -135,6 +137,7 @@ static int btqcomsmd_setup(struct hci_dev *hdev) static int btqcomsmd_probe(struct platform_device *pdev) { + const bdaddr_t *bdaddr; struct btqcomsmd *btq; struct hci_dev *hdev; void *wcnss; @@ -156,6 +159,15 @@ static int btqcomsmd_probe(struct platform_device *pdev) if (IS_ERR(btq->cmd_channel)) return PTR_ERR(btq->cmd_channel); + /* The local-bd-address DT property is usually injected by the + * bootloader which has access to the allocated BD address. + */ + bdaddr = of_get_property(pdev->dev.of_node, "local-bd-address", &ret); + if (bdaddr && ret == sizeof(bdaddr_t)) { + BT_INFO("BD address %pMR retrieved from device-tree", bdaddr); + bacpy(&btq->bdaddr, bdaddr); + } + hdev = hci_alloc_dev(); if (!hdev) return -ENOMEM;