From patchwork Tue Sep 5 10:26:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 111654 Delivered-To: patch@linaro.org Received: by 10.140.94.166 with SMTP id g35csp2640439qge; Tue, 5 Sep 2017 03:26:15 -0700 (PDT) X-Received: by 10.98.178.204 with SMTP id z73mr3214472pfl.107.1504607175707; Tue, 05 Sep 2017 03:26:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1504607175; cv=none; d=google.com; s=arc-20160816; b=tSPx2lC7OmVd5nI5dfcBVFy9blIjgtUFxoTfrg+D3FBYf6TMidhFQoSAqZ+i0/qzR9 I/Y1JsKprL30DJldg95KZ5BSOOdOUSyRfFIdIiLrfmX79fzM10QC6Ys6KAbX+JApzr+J 7ZrS7WbmeD/63Jkg+3sgZ2lDAeZwEg3/qsg0JgZBLzEZvjGz9yCBww72ibVxp1F3KJRi /cLInPbvqq5XOKC6cRKM8JCoVMrKyd4cIP8/nucCW4FJa0aHQrYBIIoME1ObbVQN7xE2 BXVrro1rhBvxTxObzVf4445Lzz5cFDwxxdf4qGyLXwQwY4NCtz0DPrxJU9/61HBmi3mg JuPQ== 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=wc4QLadP6ETN2Ejf7iB2vS1+v6GSqkFD4VOSxC/sMdw=; b=0MaJaSrXzeXTmXbzk6aOL382MFTsp3ZpJ9yzVA5OEwzi5cwplLdR0Ug8BkrDAfysYp fIgYZqR/Mo1taIntWY+GXag01A44R9nnZtnC2iABbmiXs9+2WCa6J00EwkY6sk7rBhNh 2se72Yhud9IvzKGFIyau8VCjS4VYlYwkO9yfT86LGNpTQPmPWVKLqvQE9D813pUyH1HX OvRPSe2/t+LeVXFn72IQdYpSFmabs9zwG67ULYmIWA4Y4CFMVqAmaG1RE+mAwEAck26R c4gzesI3L8Fy/7peo81Zn9kuLsP4EcXTVeh2QTHaeqmFkEGJg0+wgM1WgueAhXfiCePX NQXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=PQqzunJy; 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 m4si41447pgs.319.2017.09.05.03.26.15; Tue, 05 Sep 2017 03:26:15 -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=PQqzunJy; 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 S1751096AbdIEK0O (ORCPT + 2 others); Tue, 5 Sep 2017 06:26:14 -0400 Received: from mail-wm0-f54.google.com ([74.125.82.54]:38782 "EHLO mail-wm0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750946AbdIEK0M (ORCPT ); Tue, 5 Sep 2017 06:26:12 -0400 Received: by mail-wm0-f54.google.com with SMTP id 187so16845017wmn.1 for ; Tue, 05 Sep 2017 03:26:11 -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=tVo5aDlEM3A1X3u66qjmac1Gb8lvE5eZ0HL4x8V+qWQ=; b=PQqzunJymInD2S5czDkz59wPv2jutrFkzcshZ0uiaK9W0xZswoftiKxhq4iwvqpk0H KER/fClCJ1z+TXefRwXPISOHCWZ9Sk/1XlwvA6g8BtDvWf3zCvRg97b8+o1tgqjg1qQu qb1bm74SaUNujA+L232/mSc/7G82LLJUF3u3o= 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=tVo5aDlEM3A1X3u66qjmac1Gb8lvE5eZ0HL4x8V+qWQ=; b=FZQQDhRynBZ74J9VfwvWIdiwnkc5konHyBMvX09/Fm+r5JN/cVmcZamL7QutGXtA0a VlWAjUFwW86Ah9sl8EPdgM8kVxD6lonv1TUYHKRk0y0JL/qDpdjOlNgVGpoMn21lEY4O XZFr5GA5rq/FHHu3wWhOJXnhe+eQubw4GDWpy4KLgXGCqcUXqWjz8eWAIK/2ixWZRjyY cTesZ0APR6W2TLbdAKXXmvYAFtedDQkSZ0Y8NO30RqVopKj1Xmku/YiWhOdjXliaOQMd H/7IZjM9PFkPpCrwjMpW0TSmGM7x8CCVqHXDea8OgLBTmzY9OA34TyUxXzSChq76/Dc4 /YsA== X-Gm-Message-State: AHPjjUh6Gf9iwecT8eSlD8OBnJ1dOuL8UDreQYlaSUUtKkdkeamXcXMH yuV4aqLtIsYJTboy X-Google-Smtp-Source: ADKCNb5hXWcUj9rdDpaCWhTH8EhY+4BKEdotfs3MwHZoWWceTnCyeq71sTTrKQit3oLbgU8y0jeGtQ== X-Received: by 10.28.169.144 with SMTP id s138mr2098020wme.173.1504607171283; Tue, 05 Sep 2017 03:26:11 -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 v82sm214584wmd.44.2017.09.05.03.26.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 05 Sep 2017 03:26:10 -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 v4 2/3] Bluetooth: btqcomsmd: BD address setup Date: Tue, 5 Sep 2017 12:26:03 +0200 Message-Id: <1504607164-12645-2-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1504607164-12645-1-git-send-email-loic.poulain@linaro.org> References: <1504607164-12645-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 This patch implements the hdev setup function. wcnss-bt does not have persistent memory to store an allocated BD address. The device is therefore marked as unconfigured if no BD address has been previously retrieved. 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 drivers/bluetooth/btqcomsmd.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) -- 2.13.0 -- 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 ef730c173d4b..c70fae75c4ad 100644 --- a/drivers/bluetooth/btqcomsmd.c +++ b/drivers/bluetooth/btqcomsmd.c @@ -26,6 +26,7 @@ struct btqcomsmd { struct hci_dev *hdev; + bdaddr_t bdaddr; struct rpmsg_endpoint *acl_channel; struct rpmsg_endpoint *cmd_channel; }; @@ -100,6 +101,29 @@ 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); + + /* Device does not have persistent storage for BD address. + * Mark the device with invalid BD addr flag if no address + * retrieved during probe. + */ + if (!bacmp(&btq->bdaddr, BDADDR_ANY)) { + bt_dev_info(hdev, "No BD address configured"); + set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks); + return 0; + } + + return qca_set_bdaddr_rome(hdev, &btq->bdaddr); +} + static int btqcomsmd_probe(struct platform_device *pdev) { struct btqcomsmd *btq; @@ -135,6 +159,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; ret = hci_register_dev(hdev);