Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1567282rdb; Mon, 2 Oct 2023 13:49:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGQHxp7cCySv3ZUTGhwH/2B6KEjf1SwKbKzmC4fB3dnfrrI/wql8tYfTHFEuoqavPN1+cY/ X-Received: by 2002:a17:90b:1c03:b0:268:5620:cfc7 with SMTP id oc3-20020a17090b1c0300b002685620cfc7mr11748825pjb.30.1696279763150; Mon, 02 Oct 2023 13:49:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696279763; cv=pass; d=google.com; s=arc-20160816; b=QWGvEuXVuySlGarvKX1ttveefMnPtXryPCkSjQKDOdzG3TzIajTuzxg9fOXVp64jd0 NY6SnZx35CNcvfV32LM0QF5d+tRewN9hAymoCtYsR2nSeWpL/legTvGU8FBKFg2XDdbz ljNPdJb7KwtXqLq6bdysyukdkphj7pI2UMovEBei4xM4Wq7Gdfr/ab7muXX/IZR1CnLN 9BgylzNnQU3iFsucuhwHCykW9CPSNz7W0m13XGPCxwsxf6qkawcbtWet9nt8N0yPxqbp YvVkmA8MWx2iilqS9jrT+KcneBJWHgZlh7yz3/ji8dYghkZtVlJakNJh4+Yp4bP2xHhR EJxA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=kz5QI6WQMn6cnpEm0g/1seYaY0nchyG0MftLd55y+vI=; fh=lDnEzIzpkpzgt/qzaRCbsI36kr1UI3tvEUiaUCM1Ycw=; b=zhPk02mWUQJ26ouhZ2JsdJnhS12kAjCoLMIqnWi1boXhTmf8txB5x2gn2EnUZjlwoR xePdClWyg8+5EA0j+ePhiWTS3OhlSE1dut9CGF3qm7cJm/infJUea8nUE5MpnIG22Zlx 5a4q3FC/fCgHm16kKhIK9MVBXrT6ilGdLHCvukZ0QMUDKzXup2sl2J/yAYbuxUFlrBUv GmtP4DgiiCfutcdwtjI3DEb2MC96AJ10KJmyQUXWVUkzpglZ2wR8cKXbUhidTn3SMFLO vr2FyPprf4BDoPlzw/V8fOtSm2tt0FdCr4HlEYJA9YH1H32Nn+dp3vP+CaalzvS6UuEH FKJw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=Ht+534lG; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id pf1-20020a17090b1d8100b00279866aa14csi1953986pjb.16.2023.10.02.13.49.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 13:49:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=Ht+534lG; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 6A26F801C810; Mon, 2 Oct 2023 08:34:11 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238133AbjJBPeJ (ORCPT + 99 others); Mon, 2 Oct 2023 11:34:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238130AbjJBPeJ (ORCPT ); Mon, 2 Oct 2023 11:34:09 -0400 Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on2087.outbound.protection.outlook.com [40.107.241.87]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F359EB7 for ; Mon, 2 Oct 2023 08:34:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=liFG0SDLI+metZX3yWqgCTYuxIv0csd/xywywjMO0rC61eaaY016nYEO3NpiJfHWOP5LjTeNaL1i/WurJSbsFwUPEm5wmL2coeu6rhJcFDKEEa2br1Ple+PAKeaPtDH/m001XFBnXgq3owZcYgnBm2xcln/5zCHJVS2S3ruNkprZtMQT1t84UFOOhU5cf64qZg09W0b2pDV1lTUlkHbJAxrz/KBDCAU66+6VBUAZc6MLeOueURbo4G7sXxVeIN7JvNhKXwU7eS2j5+9pahg7433n0ivOb6apUZrtaT6+DnKZhZV/RcKd4HN6oBx4EW8/34+UqnPjaJd87sj9lzbnDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kz5QI6WQMn6cnpEm0g/1seYaY0nchyG0MftLd55y+vI=; b=ZjfWEi5cvPt4n53AK3/31xbltEqTVpjkBXfQAf9/jFE3mC9xG6BDU2Z7pJ3klyE2mXCsmi8EmSeWBmTQUKzO0ECz7cn9UOR5ybL9LcnxkguWEeJ/lZezPSBVuwvfwLebVvh2Eq8JEGH9UgiE7TJu55U1C4Z9slVp+FtbELptY8t1MTyhMCuaNo8jwIUiD3Wssra+esFEfG/APXGR++wkAOICECbj0PQ27uoYqd42QJsnXiJkwwRjf1lOZpUdz77uc5zadfghKAt9GZFPRM6EMDaR6SojJYwdAe+u55+dKjKO/0q11A8XbCk7WhN6wAxdfdihvrvBEGKbvUWV9k6Iug== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kz5QI6WQMn6cnpEm0g/1seYaY0nchyG0MftLd55y+vI=; b=Ht+534lGDmumYHDBrWntAERVonbuZ4kigfsrwZ/SSuw1sffa5OI2hbWG9494JCmGRqeasLDl1bz4xRPB/ImNY4jLWBg27YK5RmxwQseDnxJ7nCNY2hITMjBG3lH7dzr+797T0Qwi2qQRfo0UgKdvwW+jjUfqhqRO0m/p0IE7IWA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) by DU2PR04MB8839.eurprd04.prod.outlook.com (2603:10a6:10:2e2::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.29; Mon, 2 Oct 2023 15:34:04 +0000 Received: from AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::7763:779b:1a89:47da]) by AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::7763:779b:1a89:47da%3]) with mapi id 15.20.6838.024; Mon, 2 Oct 2023 15:34:04 +0000 From: Iulia Tanasescu To: linux-bluetooth@vger.kernel.org Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, silviu.barbulescu@nxp.com, vlad.pruteanu@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com Subject: [PATCH v2 2/3] transport: Update transport release flow for bcast src Date: Mon, 2 Oct 2023 18:33:51 +0300 Message-Id: <20231002153352.3163-3-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231002153352.3163-1-iulia.tanasescu@nxp.com> References: <20231002153352.3163-1-iulia.tanasescu@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: VI1PR0502CA0008.eurprd05.prod.outlook.com (2603:10a6:803:1::21) To AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8898:EE_|DU2PR04MB8839:EE_ X-MS-Office365-Filtering-Correlation-Id: 74715c15-3f7d-4944-6fb6-08dbc35d026e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WY5HyawlAUD6NFchQxVSrQyY6zBcVwB7pnHi5mEMtnRLjkr5F69TN/7ZBPBbBz9TuxW3TiBSaFJc/LDFRLF8VXtaed1/fwA8C2bPKI4OnfYL6SGVf9DJN4s3YZG+qsYv6wD/njNhFSYsV/lG9Ha1+9ppmFiwaxWhC8/muxBMRJWGHjEvC75K/Ub+TmYQijFwRQiRzJZeri1gyrz2mRHZA1bbtucahh2wZGtUQ3zkBghiYqBnpmiv7/T93O8Xp3JDNOpCRPICkpK+/7yaP/mHxkzjFhMutMUz9swgJkW3nt7V22GooRBnRk5MTRBwginp1ZUEcErgFOOOD5Ao3j4uxKxkNCLStz5Pn47JEDV+BWNtMr+3Vb6VEtI+pM15vYzPrEGEeb71FONTLwt+3GRsakfez4gF+VqzrxxmrGRs5NhN5QUjuGUDiCnic5sAqGFfMZ3OcQeKWXtEAHII1kLmx7PJdE4pDXhkGc0P3T2zBNeVv3jWZCRnPWVuq6A35U5mUomTgLMUkpMRdbQBOQXTBsbjMIVy6YuHdNoAQRYYgx74cAFVAAupCpfWdqPE7OfE X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR04MB8898.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(136003)(39860400002)(366004)(396003)(346002)(376002)(230922051799003)(64100799003)(186009)(1800799009)(451199024)(36756003)(2906002)(41300700001)(6916009)(316002)(66476007)(86362001)(4326008)(8676002)(8936002)(44832011)(5660300002)(66556008)(66946007)(15650500001)(83380400001)(6486002)(2616005)(1076003)(478600001)(26005)(38100700002)(6666004)(6512007)(6506007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?zZ/8oSsEQCRZROfuglCizXHnEZSNNiTxMlCSHA6J9SkUCOcHp/FI3x/XG/rp?= =?us-ascii?Q?OrJ2VKCGuBauUVQODr6R+ErAl2NeWgED4Mw047y+JAE564WFUtrXI3wfnjus?= =?us-ascii?Q?dYvO7anyKzXpiq17X1Jyt20NxgXJwN8GJ6I3LCMhl3zIH5CmQUgEYRGqE62A?= =?us-ascii?Q?HYC+WI8j1w5f9jKP0bIwFrhKvpkMx9yuB7gsS4gOFEYDaZueUMQPrQq9nvHn?= =?us-ascii?Q?7S7lXfrratwQ37j5XC2gU0tXI1NQDA1Z6lZJE3jmTt64A/C2d/ZA+TOWh7+h?= =?us-ascii?Q?av3SyLkNpUa7R9ENguRpjO5G0KrgVUdbdaDoSRxQLFiGqw93L0R0ojDgNAcl?= =?us-ascii?Q?zRT5ztw2Xg0DEa2X5xXgMtGnLnBtxvEPmJMfj2V0kr+9kv7ISHOQfO7xk76b?= =?us-ascii?Q?vqJ2skWXaEsINRs6UBacT8jUfR42w+8wLgpqOG4WlxHB4BC1CL3F9UhuHKyP?= =?us-ascii?Q?SUPdiX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NkabOS1NzaGGeKHtxnJiK06?= =?us-ascii?Q?ApT+aS/s7CoRplfRIz75eNKP8YSPKjH534WeM5F8FMxIqIl67mY8xbS6gUSu?= =?us-ascii?Q?1U+bVS72nwztl6feAEMkVFedT4imZe/SzFGzqfj3qxRRbMweSN7HxyrxRWIX?= =?us-ascii?Q?uHN3xONg0bN2O6g231wttF+voDyollnMS9hqSbrWCZaDvzu1DT2pU8w1Vban?= =?us-ascii?Q?4wpS7bpCrh2H3nTl4yeHMZkDuGVgkhHvrjwqiYkbs18S35MZZyN82vHPuYX4?= =?us-ascii?Q?AA=3D=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 74715c15-3f7d-4944-6fb6-08dbc35d026e X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Oct 2023 15:34:04.4961 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: PKZcdCEDZAH2f2l/EDOm0zO2rfOcEwvt3/wVXlJWEAhXdQBBvA18TTMPXiDU1g2Sy52ZKpZ0VV2YgPiW77Dv+A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR04MB8839 X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 02 Oct 2023 08:34:11 -0700 (PDT) From: Silviu Florian Barbulescu Update transport release flow for broadcast source --- profiles/audio/transport.c | 63 ++++++++++++++++++++++---------------- 1 file changed, 36 insertions(+), 27 deletions(-) diff --git a/profiles/audio/transport.c b/profiles/audio/transport.c index 1e03b7b51..646061358 100644 --- a/profiles/audio/transport.c +++ b/profiles/audio/transport.c @@ -606,11 +606,38 @@ static DBusMessage *try_acquire(DBusConnection *conn, DBusMessage *msg, return NULL; } +static void bap_stop_complete(struct bt_bap_stream *stream, + uint8_t code, uint8_t reason, + void *user_data) +{ + struct media_owner *owner = user_data; + struct media_request *req = owner->pending; + struct media_transport *transport = owner->transport; + + /* Release always succeeds */ + if (req) { + req->id = 0; + media_request_reply(req, 0); + media_owner_remove(owner); + } + + transport_set_state(transport, TRANSPORT_STATE_IDLE); + media_transport_remove_owner(transport); +} + +static void bap_disable_complete(struct bt_bap_stream *stream, + uint8_t code, uint8_t reason, + void *user_data) +{ + bap_stop_complete(stream, code, reason, user_data); +} + static DBusMessage *release(DBusConnection *conn, DBusMessage *msg, void *data) { struct media_transport *transport = data; struct media_owner *owner = transport->owner; + struct bap_transport *bap = transport->data; const char *sender; struct media_request *req; guint id; @@ -642,6 +669,11 @@ static DBusMessage *release(DBusConnection *conn, DBusMessage *msg, req = media_request_create(msg, id); media_owner_add(owner, req); + if (bt_bap_stream_get_type(bap->stream) == + BT_BAP_STREAM_TYPE_BCAST) { + bap_disable_complete(bap->stream, 0x00, 0x00, owner); + } + return NULL; } @@ -1370,32 +1402,6 @@ static guint resume_bap(struct media_transport *transport, return id; } -static void bap_stop_complete(struct bt_bap_stream *stream, - uint8_t code, uint8_t reason, - void *user_data) -{ - struct media_owner *owner = user_data; - struct media_request *req = owner->pending; - struct media_transport *transport = owner->transport; - - /* Release always succeeds */ - if (req) { - req->id = 0; - media_request_reply(req, 0); - media_owner_remove(owner); - } - - transport_set_state(transport, TRANSPORT_STATE_IDLE); - media_transport_remove_owner(transport); -} - -static void bap_disable_complete(struct bt_bap_stream *stream, - uint8_t code, uint8_t reason, - void *user_data) -{ - bap_stop_complete(stream, code, reason, user_data); -} - static guint suspend_bap(struct media_transport *transport, struct media_owner *owner) { @@ -1499,9 +1505,12 @@ static void bap_state_changed(struct bt_bap_stream *stream, uint8_t old_state, return; break; case BT_BAP_STREAM_STATE_STREAMING: - if (bt_bap_stream_io_dir(stream) == BT_BAP_BCAST_SOURCE) bap_update_bcast_qos(transport); break; + case BT_BAP_STREAM_STATE_RELEASING: + if (bt_bap_stream_io_dir(stream) == BT_BAP_BCAST_SINK) + return; + break; } io = bt_bap_stream_get_io(stream); -- 2.39.2