Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp4419550pxb; Tue, 31 Aug 2021 04:54:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx58FA5ZQibSbE6XUcapoq2WaO0aKlZOl3RfAFJLJgyg2bV4Ct89bPzRM9qGMa6VeKUe7u2 X-Received: by 2002:a17:906:1bb1:: with SMTP id r17mr30562958ejg.533.1630410879345; Tue, 31 Aug 2021 04:54:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630410879; cv=none; d=google.com; s=arc-20160816; b=yzjpTJEgYwrYJvRDa01NC1MyW9iNj47L+EpZ2W1grfXgiHxYidzNgxYZk8kp+llrMx kNLIIIk1kU0l3x8ceMVcc2O1FrpTK0qbN7obcZlO8KBi3CrplqymWxF3qHyTKs5cmbx8 DtFtdwbJVIW0GuZ6TZKwUJ5uTn7rjgOj0KEiaAAQUqDZ4sePtCzmP/YeW9J1GSlMmSzm 7/ggkcUWEUGn2RM1wSnyi2HSe2jGsEBhYidX7r3FbtZBJp55jAN2wqxiLcytjVhbTWN7 eJy3dFcWjPklXo7OBZ+N7+vUjoWbWY3hBs6J/R0Qp01ViZhIOEM3H29DGaIOfWELfYuk QMCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=SQmWXL59yM2k2cIb73JcF9/rX2Ff8iHzx2HYlJOvlGI=; b=ROJV3cDqYMvwQGv5JrT0NyFSgDS9Y0c3OqhKuD4YumpkTh3346pddYdufWrnINuOJH 9F3tLUXw5y2cLNW+vYrsuzxvNaM8Yaq7GnRbFYvcYI7jR3sWLH3TD/5RcKJB5bpnUNX+ SssDekNdZzd7KVkO7iCEVBDgkR3wv9JtGXtKqlkuoO7Vro0XtDqEaEvU2j0UNbL4cQys T0MmtWwWQFOvh0mycLWMQNK/uIqf5P+IQSOGL/t+uBIVFS6UWnNW9Ke/n9FD9bn04TjQ RFQx0LR0X3CIC7kdgcdIVzrT1h9q91NBFCE+7lufsdLf7Kwc3SEIKFC3AyKXhjtvOk47 fnxg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cw2si18202080ejc.730.2021.08.31.04.53.34; Tue, 31 Aug 2021 04:54:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241607AbhHaLwc (ORCPT + 99 others); Tue, 31 Aug 2021 07:52:32 -0400 Received: from mga02.intel.com ([134.134.136.20]:36804 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241608AbhHaLwa (ORCPT ); Tue, 31 Aug 2021 07:52:30 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10092"; a="205674738" X-IronPort-AV: E=Sophos;i="5.84,366,1620716400"; d="scan'208";a="205674738" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Aug 2021 04:51:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,366,1620716400"; d="scan'208";a="498264553" Received: from intel-lenovo-legion-y540-15irh-pg0.iind.intel.com ([10.224.186.95]) by fmsmga008.fm.intel.com with ESMTP; 31 Aug 2021 04:51:33 -0700 From: Kiran K To: linux-bluetooth@vger.kernel.org Cc: Chethan T N , Kiran K Subject: [PATCH v13 12/12] Bluetooth: Allow usb to auto-suspend when SCO use non-HCI transport Date: Tue, 31 Aug 2021 17:26:37 +0530 Message-Id: <20210831115637.6713-12-kiran.k@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210831115637.6713-1-kiran.k@intel.com> References: <20210831115637.6713-1-kiran.k@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Chethan T N Currently usb tranport is not allowed to suspend when SCO over HCI tranport is active. This patch shall enable the usb tranport to suspend when SCO link use non-HCI transport Signed-off-by: Chethan T N Signed-off-by: Kiran K --- Notes: changes in v13: - suspend usb in HFP offload use case drivers/bluetooth/btintel.c | 2 +- include/net/bluetooth/bluetooth.h | 4 ++++ net/bluetooth/hci_event.c | 20 +++++++++++--------- net/bluetooth/sco.c | 2 +- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c index 6091b691ddc2..2d64e289cf6e 100644 --- a/drivers/bluetooth/btintel.c +++ b/drivers/bluetooth/btintel.c @@ -2215,7 +2215,7 @@ static int btintel_get_codec_config_data(struct hci_dev *hdev, static int btintel_get_data_path_id(struct hci_dev *hdev, __u8 *data_path_id) { /* Intel uses 1 as data path id for all the usecases */ - *data_path_id = 1; + *data_path_id = BT_SCO_PCM_PATH; return 0; } diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h index c1fa90fb7502..9e2745863b33 100644 --- a/include/net/bluetooth/bluetooth.h +++ b/include/net/bluetooth/bluetooth.h @@ -177,6 +177,10 @@ struct bt_codecs { #define CODING_FORMAT_TRANSPARENT 0x03 #define CODING_FORMAT_MSBC 0x05 +/* Audio data transport path used for SCO */ +#define BT_SCO_HCI_PATH 0x00 +#define BT_SCO_PCM_PATH 0x01 + __printf(1, 2) void bt_info(const char *fmt, ...); __printf(1, 2) diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index b48e24629fa4..7ff11cba89cf 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -4516,15 +4516,17 @@ static void hci_sync_conn_complete_evt(struct hci_dev *hdev, bt_dev_dbg(hdev, "SCO connected with air mode: %02x", ev->air_mode); - switch (ev->air_mode) { - case 0x02: - if (hdev->notify) - hdev->notify(hdev, HCI_NOTIFY_ENABLE_SCO_CVSD); - break; - case 0x03: - if (hdev->notify) - hdev->notify(hdev, HCI_NOTIFY_ENABLE_SCO_TRANSP); - break; + if (conn->codec.data_path == BT_SCO_HCI_PATH) { + switch (ev->air_mode) { + case 0x02: + if (hdev->notify) + hdev->notify(hdev, HCI_NOTIFY_ENABLE_SCO_CVSD); + break; + case 0x03: + if (hdev->notify) + hdev->notify(hdev, HCI_NOTIFY_ENABLE_SCO_TRANSP); + break; + } } hci_connect_cfm(conn, ev->status); diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c index 004bce2b5eca..f35c12ca6aa5 100644 --- a/net/bluetooth/sco.c +++ b/net/bluetooth/sco.c @@ -506,7 +506,7 @@ static struct sock *sco_sock_alloc(struct net *net, struct socket *sock, sco_pi(sk)->codec.id = CODING_FORMAT_CVSD; sco_pi(sk)->codec.cid = 0xffff; sco_pi(sk)->codec.vid = 0xffff; - sco_pi(sk)->codec.data_path = 0x00; + sco_pi(sk)->codec.data_path = BT_SCO_HCI_PATH; bt_sock_link(&sco_sk_list, sk); return sk; -- 2.17.1