[PATCH v4 12/14] Bluetooth: Implment MSFT avdtp suspend command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In a2dp offload use case, to suspend streaming,
controller needs to sent MSFT avdtp suspend command. Allow BlueZ
daemon to send MSFT avdtp suspend command via setsockopt.

Signed-off-by: Kiran K <kiran.k@xxxxxxxxx>
Reviewed-by: Chethan T N <chethan.tumkur.narayan@xxxxxxxxx>
Reviewed-by: Srivatsa Ravishankar <ravishankar.srivatsa@xxxxxxxxx>
---
 net/bluetooth/msft.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/net/bluetooth/msft.c b/net/bluetooth/msft.c
index e3f7503070a6..b505b32289f8 100644
--- a/net/bluetooth/msft.c
+++ b/net/bluetooth/msft.c
@@ -133,6 +133,12 @@ struct msft_cp_avdtp_start {
 	__le16	avdtp_handle;
 } __packed;
 
+#define MSFT_OP_AVDTP_SUSPEND			0x0A
+struct msft_cp_avdtp_suspend {
+	u8	sub_opcode;
+	__le16	avdtp_handle;
+} __packed;
+
 static int __msft_add_monitor_pattern(struct hci_dev *hdev,
 				      struct adv_monitor *monitor);
 static int __msft_remove_monitor(struct hci_dev *hdev,
@@ -903,6 +909,19 @@ static int msft_avdtp_start(struct hci_dev *hdev, struct sock *sk)
 	return hci_send_cmd(hdev, MSFT_OP_AVDTP, sizeof(cmd), &cmd);
 }
 
+static int msft_avdtp_suspend(struct hci_dev *hdev, struct sock *sk)
+{
+	struct msft_cp_avdtp_suspend cmd;
+
+	if (!bt_sk(sk)->avdtp_handle)
+		return -EBADFD;
+
+	cmd.sub_opcode = MSFT_OP_AVDTP_SUSPEND;
+	cmd.avdtp_handle = cpu_to_le16(bt_sk(sk)->avdtp_handle);
+
+	return hci_send_cmd(hdev, MSFT_OP_AVDTP, sizeof(cmd), &cmd);
+}
+
 int msft_avdtp_cmd(struct hci_dev *hdev, struct l2cap_chan *chan,
 		   sockptr_t optval, int optlen,
 		   struct sock *sk)
@@ -941,6 +960,10 @@ int msft_avdtp_cmd(struct hci_dev *hdev, struct l2cap_chan *chan,
 		err = msft_avdtp_start(hdev, sk);
 		break;
 
+	case MSFT_OP_AVDTP_SUSPEND:
+		err = msft_avdtp_suspend(hdev, sk);
+		break;
+
 	default:
 		err = -EINVAL;
 		bt_dev_err(hdev, "Invalid MSFT avdtp sub opcode = 0x%2.2x",
@@ -999,6 +1022,7 @@ void msft_cc_avdtp(struct hci_dev *hdev, struct sk_buff *skb)
 		break;
 
 	case MSFT_OP_AVDTP_START:
+	case MSFT_OP_AVDTP_SUSPEND:
 		break;
 
 	default:
-- 
2.17.1




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux