4040#include <linux/platform_device.h>
4141#include <linux/regulator/consumer.h>
4242#include <linux/serdev.h>
43+ #include <asm/unaligned.h>
4344
4445#include <net/bluetooth/bluetooth.h>
4546#include <net/bluetooth/hci_core.h>
6364/* susclk rate */
6465#define SUSCLK_RATE_32KHZ 32768
6566
67+ /* Controller debug log header */
68+ #define QCA_DEBUG_HANDLE 0x2EDC
69+
6670/* HCI_IBS transmit side sleep protocol states */
6771enum tx_ibs_states {
6872 HCI_IBS_TX_ASLEEP ,
@@ -849,6 +853,19 @@ static int qca_ibs_wake_ack(struct hci_dev *hdev, struct sk_buff *skb)
849853 return 0 ;
850854}
851855
856+ static int qca_recv_acl_data (struct hci_dev * hdev , struct sk_buff * skb )
857+ {
858+ /* We receive debug logs from chip as an ACL packets.
859+ * Instead of sending the data to ACL to decode the
860+ * received data, we are pushing them to the above layers
861+ * as a diagnostic packet.
862+ */
863+ if (get_unaligned_le16 (skb -> data ) == QCA_DEBUG_HANDLE )
864+ return hci_recv_diag (hdev , skb );
865+
866+ return hci_recv_frame (hdev , skb );
867+ }
868+
852869#define QCA_IBS_SLEEP_IND_EVENT \
853870 .type = HCI_IBS_SLEEP_IND, \
854871 .hlen = 0, \
@@ -871,7 +888,7 @@ static int qca_ibs_wake_ack(struct hci_dev *hdev, struct sk_buff *skb)
871888 .maxlen = HCI_MAX_IBS_SIZE
872889
873890static const struct h4_recv_pkt qca_recv_pkts [] = {
874- { H4_RECV_ACL , .recv = hci_recv_frame },
891+ { H4_RECV_ACL , .recv = qca_recv_acl_data },
875892 { H4_RECV_SCO , .recv = hci_recv_frame },
876893 { H4_RECV_EVENT , .recv = hci_recv_frame },
877894 { QCA_IBS_WAKE_IND_EVENT , .recv = qca_ibs_wake_ind },
0 commit comments