Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp7992374ybc; Fri, 29 Nov 2019 04:11:31 -0800 (PST) X-Google-Smtp-Source: APXvYqxQeD5vjErjpARA3bFMKM+SQOckbeWlKJzz/j0ELLvUMRjrwG5FBLpxQSJLFkSy5+5focgp X-Received: by 2002:a17:906:385:: with SMTP id b5mr2859341eja.10.1575029491408; Fri, 29 Nov 2019 04:11:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575029491; cv=none; d=google.com; s=arc-20160816; b=Kjs2/cxwcCBuAQDTTaBPyFhYlnv7qnxyS8Ov50ydF3FMLmhlGW0+0Gk1ymjHsgntOl odqnA5vXOtkC2F078VXZrdsJTIs7B83/6ZWfV5G8uiP6bLgshdwJ8Gp1464MRCc7c7Zz BneaFpr/mc6X7CPtyYJ2MCplJqt/ziJ2hmo1cK359O8m6kfKDk7SRnfiVkpThvrvZVBo 7Q6C2m0M9aFbZfH+zNEoP0MVtlNTCbjPMUjfbLaIeoxo/GtvMEgYPF4QwhsFZqYPNG+/ wepXA6arv77+H5pglgMKoNbUcMPu2cycF+0BAxpQhQV/ZrnlwKwPFA9OPzuIk45mYaeB yBLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=gO9llKC2KXPue9JeAEtEbIyNliFR5hHEKY5y9mKMpIc=; b=n3A1aIKOzArywQ1eBZmFCrkwYF/qKzeWxdDFhanwfU6QspOkekRGuYpjjt5LjHU2S2 Hi+x4SzwKSsMndNupgUsgoeHyEhZ0XB7H0q7v8jzI8kllDllGbAt1OJpqqzvimNWkj0R UDSIyJyqrtdqDa4Qeb2CpaBtupT7AFtVZlI+9W2AlYGASdnzLoDLIl+2r1Q306gU3PNh KjXFrXp28ZQeCErW/4KzfhD3SjilYbHgfvZ1MO0VC9kRBAUfcb7ASXIDg77+7dBd5qmH au42ugNmEKjKpj/MYc8PCLGu/87tb7GqKHXCRYpX9klKhmQ8KbAA1CrflSiqNldNTpf1 UI/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=R64HjNLD; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c15si14040769ejd.74.2019.11.29.04.10.51; Fri, 29 Nov 2019 04:11:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=R64HjNLD; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726604AbfK2MKa (ORCPT + 99 others); Fri, 29 Nov 2019 07:10:30 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:36417 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726360AbfK2MKa (ORCPT ); Fri, 29 Nov 2019 07:10:30 -0500 Received: by mail-pl1-f196.google.com with SMTP id k20so405045pls.3 for ; Fri, 29 Nov 2019 04:10:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=gO9llKC2KXPue9JeAEtEbIyNliFR5hHEKY5y9mKMpIc=; b=R64HjNLDijenQt2l1xkEtFxL7jFqYkkdlzX2uLbmTv4HZXWmDR9E8xJV/kSD1jvdHB Gm6TX9OiaHPwhZATnu7vyg5+WVw+fVCdU9AqJBTx34u4zdj7a3bINa5ujwTynC21k1J9 MDoNKg3ZRwsTTX5QCGT4AwtCTrMTXkIG1vnWIMqLU9E419scWb+as1ACV3HRHRN0LRwV pCwH5jCKr4mgSaHwSxj6HJi0pcD5C3sM7XMZ7gcRyrCnLudHDnBQf5HMz8HmkHc9pozv wfRwUBDDgLoEQz+dYpbAnkzmfwVDiD9WQzkYcy4egZigzF0FcLs8JqFjCQDr2C7hsvkv 2lUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=gO9llKC2KXPue9JeAEtEbIyNliFR5hHEKY5y9mKMpIc=; b=lgU9Fl6yJdRbwe6/wfcB+Xs30zkxgvVMtxL6itB0L3iSZGChbePL1rtCFBHm0QI7c/ fPKX5XPnPFhrqExJMCs/pBwvP3Ia/RyRGp0UCcQo9ea17ny1trsi3GiQLRKiKTWgZJ3x Zgd4pVwN1+Uiq6XFFg0rBIsuHGov3TyAjahhIFugUCg7WYSY5+oX+zLJ53bohZyYVAll FTRwE7n+pjDXSUsQYCSrxj0g2uyZa1NgD5vu2giDQp2xalnsZu6vT/QYSxcz1EjdgXRw 8mTWAnaX5bw0WvW+beENPN8M99c4wIZF6dhp5fIPVxjV2uES2cjOfcSDB4DXm89bNfUZ 5Hfw== X-Gm-Message-State: APjAAAU2utm4iuShXBqB83wWorXePOi5717tIsA1qimZnsfJWOLBu/eQ iovsmtB0oQA79Xju0inkvoF9kIROzZw= X-Received: by 2002:a17:90a:2a44:: with SMTP id d4mr18201632pjg.91.1575029429349; Fri, 29 Nov 2019 04:10:29 -0800 (PST) Received: from nsathish-Latitude-7480.iind.intel.com (fmdmzpr03-ext.fm.intel.com. [192.55.54.38]) by smtp.gmail.com with ESMTPSA id g26sm12137556pfo.128.2019.11.29.04.10.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Nov 2019 04:10:28 -0800 (PST) From: Sathish Narsimman X-Google-Original-From: Sathish Narsimman To: linux-bluetooth@vger.kernel.org Cc: Sathish Narsimman Subject: [PATCH v5 1/2] bluetooth: add support to notify SCO air mode Date: Fri, 29 Nov 2019 17:40:41 +0530 Message-Id: <20191129121042.3311-1-sathish.narasimman@intel.com> X-Mailer: git-send-email 2.17.1 Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org notifying HCI_NOTIFY_CONN_ADD for SCO connection is generic in case of msbc audio. To differnetiate SCO air mode audio introducing HCI_NOTIFY_SCO_CVSD and HCI_NOTIFY_SCO_TRASP. Signed-off-by: Sathish Narsimman --- include/net/bluetooth/hci.h | 3 +++ include/net/bluetooth/hci_core.h | 3 +++ net/bluetooth/hci_conn.c | 19 +++++++++++++++---- net/bluetooth/hci_event.c | 9 +++++++++ 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 5bc1e30dedde..bfaaef1aa4d6 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -52,6 +52,9 @@ #define HCI_NOTIFY_CONN_ADD 1 #define HCI_NOTIFY_CONN_DEL 2 #define HCI_NOTIFY_VOICE_SETTING 3 +#define HCI_NOTIFY_ENABLE_SCO_CVSD 4 +#define HCI_NOTIFY_ENABLE_SCO_TRANSP 5 +#define HCI_NOTIFY_DISABLE_SCO 6 /* HCI bus types */ #define HCI_VIRTUAL 0 diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index b689aceb636b..9258e19f8cc5 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -1604,4 +1604,7 @@ void hci_copy_identity_address(struct hci_dev *hdev, bdaddr_t *bdaddr, #define SCO_AIRMODE_CVSD 0x0000 #define SCO_AIRMODE_TRANSP 0x0003 +#define SCO_CODED_CVSD 0x02 +#define SCO_CODED_TRANSP 0x03 + #endif /* __HCI_CORE_H */ diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 87691404d0c6..097a179418d6 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c @@ -122,8 +122,13 @@ static void hci_conn_cleanup(struct hci_conn *conn) hci_conn_hash_del(hdev, conn); - if (hdev->notify) - hdev->notify(hdev, HCI_NOTIFY_CONN_DEL); + if (conn->type == SCO_LINK || conn->type == ESCO_LINK) { + if (hdev->notify) + hdev->notify(hdev, HCI_NOTIFY_DISABLE_SCO); + } else { + if (hdev->notify) + hdev->notify(hdev, HCI_NOTIFY_CONN_DEL); + } hci_conn_del_sysfs(conn); @@ -561,8 +566,14 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst, hci_dev_hold(hdev); hci_conn_hash_add(hdev, conn); - if (hdev->notify) - hdev->notify(hdev, HCI_NOTIFY_CONN_ADD); + + /* As HCI_NOTIFY_ENABLE_SCO_CVSD & HCI_NOTIFY_ENABLE_SCO_TRANSP is + * used to notify SCO connections during sync_conn_complete event + */ + if (conn->type != SCO_LINK && conn->type != ESCO_LINK) { + if (hdev->notify) + hdev->notify(hdev, HCI_NOTIFY_CONN_ADD); + } hci_conn_init_sysfs(conn); diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index c1d3a303d97f..ecad696db139 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -4231,6 +4231,15 @@ static void hci_sync_conn_complete_evt(struct hci_dev *hdev, break; } + BT_DBG("sco connected with air mode: %02x", ev->air_mode); + if (ev->air_mode == SCO_CODED_CVSD) { + if (hdev->notify) + hdev->notify(hdev, HCI_NOTIFY_ENABLE_SCO_CVSD); + } else if (ev->air_mode == SCO_CODED_TRANSP) { + if (hdev->notify) + hdev->notify(hdev, HCI_NOTIFY_ENABLE_SCO_TRANSP); + } + hci_connect_cfm(conn, ev->status); if (ev->status) hci_conn_del(conn); -- 2.17.1