From patchwork Wed Sep 6 12:11:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 111764 Delivered-To: patch@linaro.org Received: by 10.140.94.166 with SMTP id g35csp763693qge; Wed, 6 Sep 2017 05:11:51 -0700 (PDT) X-Received: by 10.84.245.16 with SMTP id i16mr3467055pll.373.1504699911134; Wed, 06 Sep 2017 05:11:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504699911; cv=none; d=google.com; s=arc-20160816; b=kUuvCtvhZTAKlWmedrlWFsRnc2GY+CkvuND0WxnW1lgmSenoDg2bZbBKbmXe5GNXM6 ClU+YFf8GNgIc2Pws9Ts1d0oEMqx1nHLadjvjpbUcHu5Gy9C2AG1VbgXUJa8fsQTPVZQ QhIHuMWyPdPXqCCYAYjJDsdRHbH70xgC5iifZrg/KonkodRGRLdyF2TcCN0eyBA3E/sx EqM2xGi6V4N1HghiClu2apR6cEXOkoOFLZDOojEBzsPxeJFt3tWtu8ySF+O6jg36GLD/ k2UHHesJscgV78lPLGw7/8015WSpjl0rsbqWkZ1ziUs8xdCKl/ZOOyepARW0TcuqTVdg 1u4A== 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=4uW0KHgIoCV48LEKC/PyHiy9tNSljume+0h01Boivb0=; b=s1C9v6ijNwZCqo94OLmIQ4X9ggbj5lJtOXMCISFGN+N4iiM3KVfqlosTlWGDSq34o1 g9xZeyPqLCsS++ssEGeoMdah8tcBTPVQ1a0LLP3o0wsUXLkiUKp36ysF3wdUoK6EW9KG ORaTCHAonm2azgGstC+NJhyzLGnf1PIACDF1vRSh1YHiSehJBJ3nhn9rzQrUhVyuBgFK bqLkuWZzxKWVGH81GVm1lZlkIyf1Ew36Gr2GgwqdU8f1HMc1Kjvb02+JAJ1DuTBNWe8V CuoiyFJt7rSptJ//DJVc6EgaCBqem7KeBrT+2zUnBlhXlux7Wbevinimxpnc7nGEhGoB fFpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=bHoGuRDQ; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-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 e8si1064043pgu.636.2017.09.06.05.11.51; Wed, 06 Sep 2017 05:11:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-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=bHoGuRDQ; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-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 S1753228AbdIFMLu (ORCPT + 2 others); Wed, 6 Sep 2017 08:11:50 -0400 Received: from mail-wr0-f179.google.com ([209.85.128.179]:33601 "EHLO mail-wr0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752856AbdIFMLq (ORCPT ); Wed, 6 Sep 2017 08:11:46 -0400 Received: by mail-wr0-f179.google.com with SMTP id a43so13518395wrc.0 for ; Wed, 06 Sep 2017 05:11:45 -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=/itcg2jjKWCZ9H9eXI1kcgmsn097wPQqFVtTMzFXa0U=; b=bHoGuRDQ1+JkAKd9vC/aU0fBBJrvCr5p3yBY9GFlQ1KkcgA9zZLrWqBsfYlB2dBvna Shz0hcEpMbQSV3qarv9346ztjxs+iqmRCEHLJH4JDhnAziPaH3utrxCizLFhfPM/QHu+ YMwkyOTh9McK5LXlT34Wp83askSZfkxTBNoNA= 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=/itcg2jjKWCZ9H9eXI1kcgmsn097wPQqFVtTMzFXa0U=; b=iSwi0QvojMrWco0iHdfvJUPcjKE++YbF/6UXLzd9YsW2HoABzJiYTZtCFjpw50VEy+ 0rTxHqoxLMkBeaPJujg1ifluI4I+SszhhlaInILMRYcrpZtv94Q2xiAk4WAkqcj2zlEx pGT2h6Uiw4YM7D5PIleSkflyjY6ovTRFB1HSX7lD8TirP1cgj/OKE0oD0wHx0rLAyXhd DjCPq7ApPsYcsww9yPgauCbLJd8FvQetk5bDA4h93tTKd8GuPE44rvWhVmR5uooY/W94 yMXsQvhsQrN3ww2a84CzUL58PwxO1pBHM7rkPfu0jIl9ko1YVUfjAK/Q4eyrHRBV1ShQ TqLQ== X-Gm-Message-State: AHPjjUi8ENOiMKtpd5QkPj74YzKitvo1Wp23RsvdMNkDFDw0HlDalgHy vEURsefwJjzWRwMY X-Google-Smtp-Source: ADKCNb6DrOSV89MrYjvM13JwqA2kkk9Mo7dlqhWOegfc5IHXAvVqUMX63Hgtpnx3HuDptlmaJHtUIw== X-Received: by 10.223.195.205 with SMTP id d13mr1508114wrg.193.1504699905124; Wed, 06 Sep 2017 05:11:45 -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 w6sm2254477wra.45.2017.09.06.05.11.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 06 Sep 2017 05:11:44 -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 v6 3/3] Bluetooth: btqcomsmd: retrieve BD address from DT property Date: Wed, 6 Sep 2017 14:11:38 +0200 Message-Id: <1504699898-28011-3-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1504699898-28011-1-git-send-email-loic.poulain@linaro.org> References: <1504699898-28011-1-git-send-email-loic.poulain@linaro.org> Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org 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 drivers/bluetooth/btqcomsmd.c | 11 +++++++++++ 1 file changed, 11 insertions(+) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" 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..b5716f0 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))) { + BT_INFO("BD address %pMR retrieved from device-tree", + &btq->bdaddr); + } + hdev = hci_alloc_dev(); if (!hdev) return -ENOMEM;