diff mbox series

Bluetooth: SCO: Add support for 16 bits transparent voice setting

Message ID 20241112152020.147178-1-frederic.danis@collabora.com (mailing list archive)
State New
Headers show
Series Bluetooth: SCO: Add support for 16 bits transparent voice setting | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS
tedd_an/SubjectPrefix success Gitlint PASS
tedd_an/BuildKernel success BuildKernel PASS
tedd_an/CheckAllWarning success CheckAllWarning PASS
tedd_an/CheckSparse warning CheckSparse WARNING net/bluetooth/sco.c: note: in included file:./include/net/bluetooth/hci_core.h:147:35: warning: array of flexible structures

Commit Message

Frédéric Danis Nov. 12, 2024, 3:20 p.m. UTC
The BCM4349B1 supports 16 bits transparent data on its I2S port.

Signed-off-by: Frédéric Danis <frederic.danis@collabora.com>
---
 include/net/bluetooth/bluetooth.h | 1 +
 net/bluetooth/sco.c               | 7 +++++--
 2 files changed, 6 insertions(+), 2 deletions(-)

Comments

Luiz Augusto von Dentz Nov. 13, 2024, 4:23 p.m. UTC | #1
Hi Frédéric,

On Tue, Nov 12, 2024 at 10:31 AM Frédéric Danis
<frederic.danis@collabora.com> wrote:
>
> The BCM4349B1 supports 16 bits transparent data on its I2S port.

Ok, but what difference does it make if transparent data or transparent 16 bits?

> Signed-off-by: Frédéric Danis <frederic.danis@collabora.com>
> ---
>  include/net/bluetooth/bluetooth.h | 1 +
>  net/bluetooth/sco.c               | 7 +++++--
>  2 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
> index f66bc85c6411..21e93640c229 100644
> --- a/include/net/bluetooth/bluetooth.h
> +++ b/include/net/bluetooth/bluetooth.h
> @@ -123,6 +123,7 @@ struct bt_voice {
>
>  #define BT_VOICE_TRANSPARENT                   0x0003
>  #define BT_VOICE_CVSD_16BIT                    0x0060
> +#define BT_VOICE_TRANSPARENT_16BIT             0x0063
>
>  #define BT_SNDMTU              12
>  #define BT_RCVMTU              13
> diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
> index 1b8e468d24cf..baaac4d65a5a 100644
> --- a/net/bluetooth/sco.c
> +++ b/net/bluetooth/sco.c
> @@ -319,7 +319,8 @@ static int sco_connect(struct sock *sk)
>         else
>                 type = SCO_LINK;
>
> -       if (sco_pi(sk)->setting == BT_VOICE_TRANSPARENT &&
> +       if ((sco_pi(sk)->setting == BT_VOICE_TRANSPARENT ||
> +            sco_pi(sk)->setting == BT_VOICE_TRANSPARENT_16BIT) &&
>             (!lmp_transp_capable(hdev) || !lmp_esco_capable(hdev))) {
>                 err = -EOPNOTSUPP;
>                 goto unlock;
> @@ -922,6 +923,7 @@ static int sco_sock_setsockopt(struct socket *sock, int level, int optname,
>
>                 /* Explicitly check for these values */
>                 if (voice.setting != BT_VOICE_TRANSPARENT &&
> +                   voice.setting != BT_VOICE_TRANSPARENT_16BIT &&
>                     voice.setting != BT_VOICE_CVSD_16BIT) {
>                         err = -EINVAL;
>                         break;
> @@ -935,7 +937,8 @@ static int sco_sock_setsockopt(struct socket *sock, int level, int optname,
>                         break;
>                 }
>                 if (enhanced_sync_conn_capable(hdev) &&
> -                   voice.setting == BT_VOICE_TRANSPARENT)
> +                   (voice.setting == BT_VOICE_TRANSPARENT ||
> +                    voice.setting == BT_VOICE_TRANSPARENT_16BIT))
>                         sco_pi(sk)->codec.id = BT_CODEC_TRANSPARENT;
>                 hci_dev_put(hdev);
>                 break;
> --
> 2.34.1
>
>
diff mbox series

Patch

diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index f66bc85c6411..21e93640c229 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -123,6 +123,7 @@  struct bt_voice {
 
 #define BT_VOICE_TRANSPARENT			0x0003
 #define BT_VOICE_CVSD_16BIT			0x0060
+#define BT_VOICE_TRANSPARENT_16BIT		0x0063
 
 #define BT_SNDMTU		12
 #define BT_RCVMTU		13
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index 1b8e468d24cf..baaac4d65a5a 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -319,7 +319,8 @@  static int sco_connect(struct sock *sk)
 	else
 		type = SCO_LINK;
 
-	if (sco_pi(sk)->setting == BT_VOICE_TRANSPARENT &&
+	if ((sco_pi(sk)->setting == BT_VOICE_TRANSPARENT ||
+	     sco_pi(sk)->setting == BT_VOICE_TRANSPARENT_16BIT) &&
 	    (!lmp_transp_capable(hdev) || !lmp_esco_capable(hdev))) {
 		err = -EOPNOTSUPP;
 		goto unlock;
@@ -922,6 +923,7 @@  static int sco_sock_setsockopt(struct socket *sock, int level, int optname,
 
 		/* Explicitly check for these values */
 		if (voice.setting != BT_VOICE_TRANSPARENT &&
+		    voice.setting != BT_VOICE_TRANSPARENT_16BIT &&
 		    voice.setting != BT_VOICE_CVSD_16BIT) {
 			err = -EINVAL;
 			break;
@@ -935,7 +937,8 @@  static int sco_sock_setsockopt(struct socket *sock, int level, int optname,
 			break;
 		}
 		if (enhanced_sync_conn_capable(hdev) &&
-		    voice.setting == BT_VOICE_TRANSPARENT)
+		    (voice.setting == BT_VOICE_TRANSPARENT ||
+		     voice.setting == BT_VOICE_TRANSPARENT_16BIT))
 			sco_pi(sk)->codec.id = BT_CODEC_TRANSPARENT;
 		hci_dev_put(hdev);
 		break;