From patchwork Thu Aug 29 12:49:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 823622 Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazon11011019.outbound.protection.outlook.com [52.101.70.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D3BC41B013F for ; Thu, 29 Aug 2024 12:50:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.70.19 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724935802; cv=fail; b=FJYu/2up/26cFskWo5muRF/5kk69a7ToWRFPg646+K5Uq33PZbeu7leGlTcZuq5EBdd9gsd+kAshfJ7xLGJABChZQLqbvAXwW4wuTMiJ/3Z2p7S/BK9mb3FpKT2v7GawTPDcW/nq+YHaaCpw/9g7OgWt7aGy9Qu67vqWMnndAMY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724935802; c=relaxed/simple; bh=Xj0iuXMp4wmKPn2xSlhixHToEFcoUPboiEoVbnGWTnk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=Cb9JOfPvJY1vaej8bSZtehI+cMLA2urs3T6IEpLIa+2gcYaEBLqkA79oB3ypSN6yrnYZ15xA1QLiJRB4IfiudrP0o5IiNbpYG2HET99kDRF/DLwR+ofjpTHkpjSNyxzAAQS7y9VJmNjefOeo2UkoyvBppfAI2F45t7SMKVF1rxo= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=B/O+kLqK; arc=fail smtp.client-ip=52.101.70.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="B/O+kLqK" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=GXeeCdeyyikAUrvidrZkjkeQAXlZmgc8xwMjUMImwU5YPeXjqG7KqE223QUSbXfK+yzL8ZukZbwRQc5SANk/GLN2wl8uU3JNZqmKWfekshboRYf27f6wft0AeXEcJWow9lSgkxeG4K2bqE/l1sOTYM1RTXRPtNBipTEAcYk/KzsxygnM+FgC50xG58CJW1KZft+nITv4IH3U0AsqNL7Sy8IFcGcTnqZA6/ckrKXC8ukU3FjTHFImSlRsiP1gcB0RpIgs4vW62hC5uQ74Ox1cHHwDgpDltBf8siT5XphyAmE9RyRkVoFHScQUWKVrb5Et7wDM1z/B3Q5FYN7N7cW+iQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=oTUifbOiXRLSvfccmIcxkAcS1tj32YAhduDe53d0QDA=; b=IEpZ9922pMN00x9Wubs6Hc3f857eA2LjQuAOmREnAR9wxyDkUDjYVoOL4Kp4QwfGgozDFFZx/76CkmKuOdkdYQUjF0zjtfH/DiB5jXHmn9jfHqdT0NfCbYALwY5hQvc0DULRt5CzxgGn4mkGlywkUVTErypdAOxiNAHrFR1noRZN8oalRpirkpw5yroxDdrGWmH8qsSFCq+EUEnyiAAYQdZ2Vw7krRCN0HCmZKVmVHsYEikHtOhvB3wxuHTRBXZlYLdboAKADDNE57WrVswSAL7WQl3AG4L1azdcv7Vy1gFNdlRbqLmjg9vVV6ARCZFmrZwGjtdXE277NiruP02SLg== 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=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oTUifbOiXRLSvfccmIcxkAcS1tj32YAhduDe53d0QDA=; b=B/O+kLqKT+j8qDBZWvrARNi1VoW2pl2KAcF8YYRfAo+oQMBp5+F8dEHnnMjvLA8jyT6We7Dc1Qli4ThcIEFEzv2nMa4b9uL7uV5sgAQiFZlXjl6uukbAVQA6ClkIG6nUDeJItFBRph8g01y3sQZQQeiCxPBMaXTPlBcdj2Bn5kzgiaF+evHii75t+MnKOx3BmX/rFrW6EpDDciBs5UJnmwtZFfvK2aYJPuduInddg46IHgg/zkiiDZiqKznjWdK67itdVa6IOodKGGJVnKYL2wMUW8L4hVAS2l3xlr5qI2Qd5RfAJo0YJZ+RB3JS9IniaP/Ux6atDtJ2GEzLvIyvgQ== 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 AM8PR04MB7939.eurprd04.prod.outlook.com (2603:10a6:20b:241::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.20; Thu, 29 Aug 2024 12:49:59 +0000 Received: from AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654]) by AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654%5]) with mapi id 15.20.7897.027; Thu, 29 Aug 2024 12:49:59 +0000 From: Iulia Tanasescu To: linux-bluetooth@vger.kernel.org Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, vlad.pruteanu@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Iulia Tanasescu Subject: [PATCH BlueZ v2 12/16] shared/bass: Add APIs to set/clear BIS sync bits Date: Thu, 29 Aug 2024 15:49:14 +0300 Message-Id: <20240829124918.84809-13-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240829124918.84809-1-iulia.tanasescu@nxp.com> References: <20240829124918.84809-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AM8P191CA0008.EURP191.PROD.OUTLOOK.COM (2603:10a6:20b:21a::13) To AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8898:EE_|AM8PR04MB7939:EE_ X-MS-Office365-Filtering-Correlation-Id: 9ba872f8-6c1b-4df4-ed6d-08dcc8291765 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014; X-Microsoft-Antispam-Message-Info: ROOLSPIIL8BIiCnIRaqXICrW/4tTGCR3paXTUvkMgZ/CYorPyD7sGEMXS5U48n17JTqHllELxkxLdmJV8Gpdc2f6K28UMuIBcDOFWs0SgvJMXOTwNpe7XP6KsNjUGxvQP9yiAOtekWMixG0QAd8QFwqnGOoL4NB6TUIsmP1nQsYbwPB9q6CIUjbNn1QSLUQ+dabTsPudzP2+Mb16FYTfUtV3q+USiga6UVQvx7xAONUbnfsNa2TmAzG1IKCmIh6zAX5gjspnSJ7VJ1uIp4zJXRKVYk2XW8UNHBuvO2aZaoT3z4uSNv8A740/f4sWbYv0lWmoSTkEndNmICAi1rJsZ4Ledgd4dx7NYxhbjWlBMmOKb9F/md3KY06RKwnSEwmdFZG5QbB/cX0ZuumJdePUX+DnwYn7LysGp+BE3Ma2EGSLt60TbmppZ6EpX+RCvIywUFtoTWaP7uABTUBT3krapKWxeQnaVf9ZHOzdIWC65mHNWiEp1MH4jPdrR6cYyvndNWmlWkAMIxkGRAsbRdbi0FWYrEaJqDhbwqBientOM11fXCe3YWIPOEODneE9hfuGoHMFzwrwjBZDRDnCw4kon0Qqzc0Ws9gXnP0VxJO/5QsNVBZ/ABxCsg6nvVkiGGODAN4nlcQKOXj/IGMwmdvA8uM2flm2AoZsMojs2ai7fD/P24/aJHmayqvuduNiZZl3Jy2BIbi8WUmOMJifpF+37mjrGJlAXleAbojdxzMbidb5p51o5PD/Cu7GrjAtT/Mp/2L1YzZIWAEzTtS5xdp/wGxTE1IbpE7mjp9ILVUhEBoH/w/809ua5hgG06G5ZQB/w5GeQdbMMdHyVsUEdhNNcqlFTP649GyzjFxuH+QIyRvxXyTaivmeeqYcnhC0O4OfErCtis+6boTFsl+PdeSt04HW8fhlRssiKkILEcysxlhz1Hi50gJtp7b5z/ECaDIfuSqOjomgjKnmBUIBE5g9/IWRNefKpnQODxQ64tR3gaSgfxHEaRAIBTgFHSQzB5/XLopXJnEvk3HWIJzAxOqr23SlYl1mSugleh/hYMDNmUoxCHSI4d/38gaT1jPB5XVcz4kr8oeo7lBcMpx0MUt6boM3v96x32GwSJpdeuPujzZFdEuVt7ltAm/evn1sN8ZcVd0xr2wR57xS9ExhInoEzRyd4+cCqfNzaZQiyAnn3NICMJxgzq8DlfhIEG2Nf7O98nzTj3n/qd/3yQAqidHtjOyBQrejjTbTkmn3ey0iF3mv5dNKhCKc8uqbCCD8O8xpegfGwP9IiYfTHXehdDFu8Irp5eOfbcdJIgdAcGnSPL9PSQEYLlXCRgpA7mGwNVL5PErmXfGeF+oPsXELjPCmEA== 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:(13230040)(1800799024)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VbBSFz6PV9ka/0v2laCUADKe8htAoZK4AOpMc0KDdaZA0SjwtNVlroxhwc2JfDByyFqeCFYlgiDCRJ21Ah0iaoyN1rsAs4KmQ8gNXJsLxGxaRVwJSfSbJr9k1ziY5/lacLElSOfdVK2Xq5iVuhA/ayLVJpxCABj/xgtDc/n5K4Xcm+a+/IcrNgRfbdC8PESshhqwaCzVTLiq/CmrdWHJ+kjp6oDqgEVjwPDDJoCkKJdPd57JSboCEVLRnjKOPDNvx9ZZ0A/vXNqEv515GFJIC4MBAywmfEo64XDkJ9UKiSvJm65ookAsJlQ0zXsMH/7RnbMhw1l7EwUffD4bzzXp5ajKn8wOXPy8gv+WwZmfGyq/RXpns6hnz9UNvBTx3l4GUw6Wl3M7A6GeCLvlLmG9k3cj1KRTnKqRW/iMIR4q9v7FyBNdH342IMg1Sxq26VBXtXRWmJClMVb9Y/G9T8+B0Tzzx1H89VC8DWsKBzv0zFyp+0YSj4goAdf8LgjcG2I7XPLiq9kuA5Z0/IlwoZ92aA5gnqVc+U2tGudIAL6E21mXS1XPwhvY6NW6vPLBVf1AXRmGxNtwnbGD8nhsqgCpmoNjJ8cIxxmsgvjueMt8FZgj+VtRGbXfxwJmW9YgCjLOhA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9ba872f8-6c1b-4df4-ed6d-08dcc8291765 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Aug 2024 12:49:59.2595 (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: qMndSVyVb7RTu4X+v0Ra7Fck100wOnfLl78CBojSL5nXeRGmpWHGpHhX0IoLpBX6rAyyTUK2kVS697kerLioYQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7939 This adds shared/bass APIs to set/clear bits inside the BIS sync bitmask of Broadcast Receive State characteristics. Notifications are sent to the peers each time the characteristic is updated. --- src/shared/bass.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++ src/shared/bass.h | 2 ++ 2 files changed, 54 insertions(+) diff --git a/src/shared/bass.c b/src/shared/bass.c index 958b6f788..8f02086a1 100644 --- a/src/shared/bass.c +++ b/src/shared/bass.c @@ -1766,3 +1766,55 @@ int bt_bass_set_pa_sync(struct bt_bcast_src *bcast_src, uint8_t sync_state) return 0; } + +int bt_bass_set_bis_sync(struct bt_bcast_src *bcast_src, uint8_t bis) +{ + struct iovec *iov; + + for (uint8_t i = 0; i < bcast_src->num_subgroups; i++) { + struct bt_bass_subgroup_data *sgrp = + &bcast_src->subgroup_data[i]; + uint32_t bitmask = 1 << (bis - 1); + + if (sgrp->pending_bis_sync & bitmask) { + sgrp->bis_sync |= bitmask; + + iov = bass_parse_bcast_src(bcast_src); + if (!iov) + return -ENOMEM; + + bt_bass_notify_all(bcast_src->attr, iov); + + free(iov->iov_base); + free(iov); + } + } + + return 0; +} + +int bt_bass_clear_bis_sync(struct bt_bcast_src *bcast_src, uint8_t bis) +{ + struct iovec *iov; + + for (uint8_t i = 0; i < bcast_src->num_subgroups; i++) { + struct bt_bass_subgroup_data *sgrp = + &bcast_src->subgroup_data[i]; + uint32_t bitmask = 1 << (bis - 1); + + if (sgrp->pending_bis_sync & bitmask) { + sgrp->bis_sync &= ~bitmask; + + iov = bass_parse_bcast_src(bcast_src); + if (!iov) + return -ENOMEM; + + bt_bass_notify_all(bcast_src->attr, iov); + + free(iov->iov_base); + free(iov); + } + } + + return 0; +} diff --git a/src/shared/bass.h b/src/shared/bass.h index a82d8f573..f3f708246 100644 --- a/src/shared/bass.h +++ b/src/shared/bass.h @@ -130,3 +130,5 @@ unsigned int bt_bass_cp_handler_register(struct bt_bass *bass, bool bt_bass_cp_handler_unregister(struct bt_bass *bass, unsigned int id); int bt_bass_set_pa_sync(struct bt_bcast_src *bcast_src, uint8_t sync_state); +int bt_bass_set_bis_sync(struct bt_bcast_src *bcast_src, uint8_t bis); +int bt_bass_clear_bis_sync(struct bt_bcast_src *bcast_src, uint8_t bis);