From patchwork Mon Oct 1 13:51:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balakrishna Godavarthi X-Patchwork-Id: 10622157 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BF29513BB for ; Mon, 1 Oct 2018 13:51:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B6EDE2958E for ; Mon, 1 Oct 2018 13:51:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A773A29592; Mon, 1 Oct 2018 13:51:17 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 442B12958E for ; Mon, 1 Oct 2018 13:51:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729289AbeJAU3K (ORCPT ); Mon, 1 Oct 2018 16:29:10 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:50016 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729253AbeJAU3K (ORCPT ); Mon, 1 Oct 2018 16:29:10 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 59DB860128; Mon, 1 Oct 2018 13:51:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1538401875; bh=ExW6SnUp8lMc7bPWEfR1QYwUAsuREaNx3m3j625zmWs=; h=From:To:Cc:Subject:Date:From; b=EJi71KkLxH6vokVFkxmZ5XDkAQLqNqBXUVACpVhXevybKqWYvDc/JvGn83S3wt8Qz 05GQQeX9B/p6RQ6KNWu5+DmSyhL0YBWyN4vVvXEctdrsy0k9S/cFbrxH+EUEBSSG6l brCPQl1pD+j0x3i692n4oaUE1+21A4yycF5weTKE= Received: from bgodavar-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: bgodavar@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 094B160866; Mon, 1 Oct 2018 13:51:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1538401874; bh=ExW6SnUp8lMc7bPWEfR1QYwUAsuREaNx3m3j625zmWs=; h=From:To:Cc:Subject:Date:From; b=BYil3AUHuxcw/ZM9MyBMAXSVP5goBhPabgS/y5/773n3GrHOOLAUXw7J0Az/o5v6u YcecpOuY7GnKSD4XT44pROUra8WoGKKxAxoeEpy5ovGCTRlrIjYdhLXRV6Y0zAs2wh urhxr2TI3EtI5c0KjqlbER4m+U3/yGg8HgdETNsQ= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 094B160866 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=bgodavar@codeaurora.org From: Balakrishna Godavarthi To: marcel@holtmann.org, johan.hedberg@gmail.com Cc: mka@chromium.org, linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org, hemantg@codeaurora.org, linux-arm-msm@vger.kernel.org, Balakrishna Godavarthi , Harish Bandi Subject: [PATCH v1] Bluetooth: hci_qca: Add support for controller debug logs. Date: Mon, 1 Oct 2018 19:21:02 +0530 Message-Id: <20181001135102.17453-1-bgodavar@codeaurora.org> X-Mailer: git-send-email 2.18.0 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 This patch will prevent error messages splashing on console. [ 78.426697] Bluetooth: hci_core.c:hci_acldata_packet() hci0: ACL packet for unknown connection handle 3804 [ 78.436682] Bluetooth: hci_core.c:hci_acldata_packet() hci0: ACL packet for unknown connection handle 3804 [ 78.446639] Bluetooth: hci_core.c:hci_acldata_packet() hci0: ACL packet for unknown connection handle 3804 [ 78.456596] Bluetooth: hci_core.c:hci_acldata_packet() hci0: ACL packet for unknown connection handle 3804 QCA wcn3990 will send the debug logs in the form of ACL packets. While decoding packet in qca_recv(), marking the received debug log packet as diagnostic packet. Signed-off-by: Harish Bandi Signed-off-by: Balakrishna Godavarthi --- drivers/bluetooth/hci_qca.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c index d98ed0442201..a00910aaed54 100644 --- a/drivers/bluetooth/hci_qca.c +++ b/drivers/bluetooth/hci_qca.c @@ -63,6 +63,10 @@ /* susclk rate */ #define SUSCLK_RATE_32KHZ 32768 +/* Controller debug log header */ +#define QCA_DEBUG_HDR_MSB 0xDC +#define QCA_DEBUG_HDR_LSB 0x2E + /* HCI_IBS transmit side sleep protocol states */ enum tx_ibs_states { HCI_IBS_TX_ASLEEP, @@ -849,6 +853,20 @@ static int qca_ibs_wake_ack(struct hci_dev *hdev, struct sk_buff *skb) return 0; } +static int qca_recv_acl_data(struct hci_dev *hdev, struct sk_buff *skb) +{ + /* We receive debug logs from chip as an ACL packets. + * Instead of sending the data to ACL to decode the + * received data, we are pushing them to the above layers + * as a diagnostic packet. + */ + if ((skb->len > 2) && (skb->data[0] == QCA_DEBUG_HDR_MSB) && + (skb->data[1] == QCA_DEBUG_HDR_LSB)) + return hci_recv_diag(hdev, skb); + else + return hci_recv_frame(hdev, skb); +} + #define QCA_IBS_SLEEP_IND_EVENT \ .type = HCI_IBS_SLEEP_IND, \ .hlen = 0, \ @@ -870,13 +888,20 @@ static int qca_ibs_wake_ack(struct hci_dev *hdev, struct sk_buff *skb) .lsize = 0, \ .maxlen = HCI_MAX_IBS_SIZE +#define QCA_RECV_ACL_DATA \ + .type = HCI_ACLDATA_PKT, \ + .hlen = HCI_ACL_HDR_SIZE, \ + .loff = 2, \ + .lsize = 2, \ + .maxlen = HCI_MAX_FRAME_SIZE + static const struct h4_recv_pkt qca_recv_pkts[] = { - { H4_RECV_ACL, .recv = hci_recv_frame }, { H4_RECV_SCO, .recv = hci_recv_frame }, { H4_RECV_EVENT, .recv = hci_recv_frame }, { QCA_IBS_WAKE_IND_EVENT, .recv = qca_ibs_wake_ind }, { QCA_IBS_WAKE_ACK_EVENT, .recv = qca_ibs_wake_ack }, { QCA_IBS_SLEEP_IND_EVENT, .recv = qca_ibs_sleep_ind }, + { QCA_RECV_ACL_DATA, .recv = qca_recv_acl_data }, }; static int qca_recv(struct hci_uart *hu, const void *data, int count)