summaryrefslogtreecommitdiff
path: root/drivers/bluetooth/btusb_qcom.h
blob: 8fbc105f4eaf53b6ba827272bcb532f777e6b726 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Qualcomm Bluetooth USB transport-specific support
 *
 * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
 */

#ifndef __BTUSB_QCOM_H
#define __BTUSB_QCOM_H

#include <linux/types.h>
#include <linux/mutex.h>
#include <linux/skbuff.h>
#include <linux/usb.h>

#include <net/bluetooth/hci_core.h>

#define QPERI_COMMAND_PKT	0x31
#define QPERI_ACLDATA_PKT	0x32
#define QPERI_EVENT_PKT		0x34

struct btusb_qcom {
	__u16                 idVendor;
	__u16                 idProduct;
	struct usb_device    *udev;
	struct usb_interface *intf;
	struct gpio_desc     *reset_gpio;

	/* serializes sending BT and vendor frames to the transport */
	struct mutex          tx_mutex;

	void (*prepare_reset)(struct hci_dev *hdev);
	int (*recv_bt_frame)(struct hci_dev *hdev, struct sk_buff *skb);
	int (*send_bt_frame)(struct hci_dev *hdev, struct sk_buff *skb);
	int (*send_vendor_frame)(struct hci_dev *hdev, struct sk_buff *skb);
};

#if IS_ENABLED(CONFIG_BT_HCIBTUSB_QCOM)

int btusb_qcom_hdev_priv_size(void);
struct btusb_qcom *btusb_qcom_xport_data(struct hci_dev *hdev);

int btusb_qcom_setup(struct hci_dev *hdev);
int btusb_qcom_disconnect(struct hci_dev *hdev);
int btusb_qcom_send_frame(struct hci_dev *hdev, struct sk_buff *skb);

struct sk_buff *btusb_qcom_recv_intr(struct hci_dev *hdev, struct sk_buff *skb,
				     void *buffer, int count, int *err);

struct sk_buff *btusb_qcom_recv_bulk(struct hci_dev *hdev, struct sk_buff *skb,
				     void *buffer, int count, int *err);

#else

static inline int btusb_qcom_hdev_priv_size(void)
{
	return 0;
}

static inline struct btusb_qcom *btusb_qcom_xport_data(struct hci_dev *hdev)
{
	return NULL;
}

static inline int btusb_qcom_setup(struct hci_dev *hdev)
{
	return -EOPNOTSUPP;
}

static inline int btusb_qcom_disconnect(struct hci_dev *hdev)
{
	return -EOPNOTSUPP;
}

static inline int btusb_qcom_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
{
	return -EOPNOTSUPP;
}

static inline struct sk_buff *btusb_qcom_recv_intr(struct hci_dev *hdev,
						   struct sk_buff *skb,
						   void *buffer, int count,
						   int *err)
{
	*err = -EOPNOTSUPP;
	return NULL;
}

static inline struct sk_buff *btusb_qcom_recv_bulk(struct hci_dev *hdev,
						   struct sk_buff *skb,
						   void *buffer, int count,
						   int *err)
{
	*err = -EOPNOTSUPP;
	return NULL;
}

#endif
#endif