From patchwork Fri Sep 8 13:57:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 9944329 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F3DE5604D4 for ; Fri, 8 Sep 2017 13:58:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E3B152873A for ; Fri, 8 Sep 2017 13:58:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D891128744; Fri, 8 Sep 2017 13:58:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7C6AF2873A for ; Fri, 8 Sep 2017 13:58:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754363AbdIHN6F (ORCPT ); Fri, 8 Sep 2017 09:58:05 -0400 Received: from mail-wm0-f41.google.com ([74.125.82.41]:44479 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753687AbdIHN6D (ORCPT ); Fri, 8 Sep 2017 09:58:03 -0400 Received: by mail-wm0-f41.google.com with SMTP id 137so6318067wmj.1 for ; Fri, 08 Sep 2017 06:58:02 -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=2N4mIUe6U9LD+mrAELqQRux6nvcWu/H9f+8Gpu/lDtk=; b=COwLg3FeP26Oon/d77s8SfD43rqfia7Jq+pRSZuX3rkA8fMc/qQm2tke/8bUtMhsNy 0k+fKewbftUXLkkLlRXfDyl7LhPdPdnqtFn0PU3BkEdOO1xV6DLJh2CexnigY6L8w7Bw OYtCVEArplXz/yg1WRYsJgMLwfDG4dPGcLFJ4= 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=2N4mIUe6U9LD+mrAELqQRux6nvcWu/H9f+8Gpu/lDtk=; b=XtEcndtG+ApVVQ4ChhrvQrnPqnOONn8/n/I1BFTcX2uU5aP4cXIu/xG6ejj+v/iZtt 7IlP8Bsnxj59N7DTXRopW/zrdTIPZZ8Rl4YU/Qg7BqQDf0jpGFKpkMdfTlue0Wa2ReEk QQXHMlchiIQMpjpP7gm1aTDwKu2y8C3LdgDcGylT8yroEhqi421r7enl7qT93rs9L7Wy dquvDfv2pxqk1un2EMOdPF+ogZt5D0+WVr2JzEv9HS88JCBnF/AiF7Zn+kIBTmWk2x5q 6P3oviDt2dZRwPbLS1F3duwD2PbAWTPvlQ7L+ZrHhh0pNLhUrX2JK8D/WBvmoFTiH++s iYkw== X-Gm-Message-State: AHPjjUj+uny4Pexo6STQqXTlTxNEZceos6WSpInetEK7YG/Vc7ULYibj +JvHtC8uD0Jr1S0Q X-Google-Smtp-Source: AOwi7QBplhfK1OGO3uPZ0ARxDh0/ENeH0o9MItyd/sc8UdhP+i1nl8KJNzrwyaqDO8W6U7ioWHxEDA== X-Received: by 10.28.128.131 with SMTP id b125mr1850048wmd.1.1504879081914; Fri, 08 Sep 2017 06:58:01 -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 v2sm1869638wmf.40.2017.09.08.06.58.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 08 Sep 2017 06:58:01 -0700 (PDT) From: Loic Poulain To: marcel@holtmann.org, robh+dt@kernel.org, johan.hedberg@gmail.com Cc: linux-bluetooth@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, bjorn.andersson@linaro.org, Loic Poulain Subject: [PATCH v7 3/3] Bluetooth: btqcomsmd: retrieve BD address from DT property Date: Fri, 8 Sep 2017 15:57:55 +0200 Message-Id: <1504879075-587-3-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1504879075-587-1-git-send-email-loic.poulain@linaro.org> References: <1504879075-587-1-git-send-email-loic.poulain@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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: 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 v6: use of_property_read_u8_array instead of of_get_property v7: use dev_info instead of BT_INFO to have dev context drivers/bluetooth/btqcomsmd.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/bluetooth/btqcomsmd.c b/drivers/bluetooth/btqcomsmd.c index bd810d0..663bed6 100644 --- a/drivers/bluetooth/btqcomsmd.c +++ b/drivers/bluetooth/btqcomsmd.c @@ -15,6 +15,8 @@ #include #include #include +#include + #include #include @@ -156,6 +158,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 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(); if (!hdev) return -ENOMEM;