From: Kiran K <kiran.k@intel.com>
To: linux-bluetooth@vger.kernel.org
Cc: ravishankar.srivatsa@intel.com, chethan.tumkur.narayan@intel.com,
luiz.von.dentz@intel.com, Kiran K <kiran.k@intel.com>
Subject: [PATCH v1 4/5] avdtp: Add support for offload msft suspend command
Date: Mon, 15 Nov 2021 15:11:07 +0530 [thread overview]
Message-ID: <20211115094108.24331-4-kiran.k@intel.com> (raw)
In-Reply-To: <20211115094108.24331-1-kiran.k@intel.com>
In a2dp offload use case, send MSFT avdtp suspend command
followed by remote AVDTP suspend command.
---
lib/bluetooth.h | 1 +
profiles/audio/avdtp.c | 18 ++++++++++++++++++
2 files changed, 19 insertions(+)
diff --git a/lib/bluetooth.h b/lib/bluetooth.h
index 32a3b5f0c2b9..2bd253aeeed4 100644
--- a/lib/bluetooth.h
+++ b/lib/bluetooth.h
@@ -160,6 +160,7 @@ struct bt_codecs {
#define BT_MSFT_OPEN 20
#define BT_MSFT_START 21
+#define BT_MSFT_SUSPEND 22
#define BT_MSFT_CLOSE 23
/* Connection and socket states */
diff --git a/profiles/audio/avdtp.c b/profiles/audio/avdtp.c
index 1ae96e3e8a07..d5e8c7856be3 100644
--- a/profiles/audio/avdtp.c
+++ b/profiles/audio/avdtp.c
@@ -2958,6 +2958,21 @@ static gboolean avdtp_close_resp(struct avdtp *session,
return TRUE;
}
+static gboolean avdtp_offload_suspend(struct avdtp_stream *stream)
+{
+ int sock;
+
+ if (!stream->io)
+ return FALSE;
+
+ sock = g_io_channel_unix_get_fd(stream->io);
+
+ if (setsockopt(sock, SOL_BLUETOOTH, BT_MSFT_SUSPEND, 0, 0))
+ return FALSE;
+
+ return TRUE;
+}
+
static gboolean avdtp_suspend_resp(struct avdtp *session,
struct avdtp_stream *stream,
void *data, int size)
@@ -2969,6 +2984,9 @@ static gboolean avdtp_suspend_resp(struct avdtp *session,
if (sep->cfm && sep->cfm->suspend)
sep->cfm->suspend(session, sep, stream, NULL, sep->user_data);
+ if (session->use_offload)
+ avdtp_offload_suspend(stream);
+
return TRUE;
}
--
2.17.1
next prev parent reply other threads:[~2021-11-15 9:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-15 9:41 [PATCH v1 1/5] avdtp: Add a flag in struct avdtp to control a2dp offload Kiran K
2021-11-15 9:41 ` [PATCH v1 2/5] avdtp: Add support for offload msft open command Kiran K
2021-11-15 9:41 ` [PATCH v1 3/5] avdtp: Add support for offload msft start command Kiran K
2021-11-15 9:41 ` Kiran K [this message]
2021-11-15 9:41 ` [PATCH v1 5/5] avdtp: Add support for offload msft close command Kiran K
2021-11-15 9:55 ` [v1,1/5] avdtp: Add a flag in struct avdtp to control a2dp offload bluez.test.bot
2021-11-15 19:42 ` [PATCH v1 1/5] " Luiz Augusto von Dentz
2021-11-15 19:44 ` Luiz Augusto von Dentz
2021-11-19 8:12 ` K, Kiran
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211115094108.24331-4-kiran.k@intel.com \
--to=kiran.k@intel.com \
--cc=chethan.tumkur.narayan@intel.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=luiz.von.dentz@intel.com \
--cc=ravishankar.srivatsa@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox