@@ -395,40 +395,48 @@ static struct net_buf *hci_le_set_cig_params(struct bt_iso_create_param *param)
395395 memset (req , 0 , sizeof (* req ));
396396
397397 req -> cig_id = param -> conns [0 ]-> iso .cig_id ;
398- sys_put_le24 (param -> chans [0 ]-> qos -> interval , req -> m_interval );
399- sys_put_le24 (param -> chans [0 ]-> qos -> interval , req -> s_interval );
398+ sys_put_le24 (param -> chans [0 ]-> qos -> tx -> interval , req -> m_interval );
399+ sys_put_le24 (param -> chans [0 ]-> qos -> rx -> interval , req -> s_interval );
400400 req -> sca = param -> chans [0 ]-> qos -> sca ;
401401 req -> packing = param -> chans [0 ]-> qos -> packing ;
402402 req -> framing = param -> chans [0 ]-> qos -> framing ;
403- req -> m_latency = sys_cpu_to_le16 (param -> chans [0 ]-> qos -> latency );
404- req -> s_latency = sys_cpu_to_le16 (param -> chans [0 ]-> qos -> latency );
403+ req -> m_latency = sys_cpu_to_le16 (param -> chans [0 ]-> qos -> tx -> latency );
404+ req -> s_latency = sys_cpu_to_le16 (param -> chans [0 ]-> qos -> rx -> latency );
405405 req -> num_cis = param -> num_conns ;
406406
407407 /* Program the cis parameters */
408408 for (i = 0 ; i < param -> num_conns ; i ++ ) {
409+ struct bt_iso_chan_qos * qos = param -> chans [i ]-> qos ;
410+
409411 cis = net_buf_add (buf , sizeof (* cis ));
410412
411413 memset (cis , 0 , sizeof (* cis ));
412414
413415 cis -> cis_id = param -> conns [i ]-> iso .cis_id ;
414416
415- switch (param -> chans [i ]-> qos -> dir ) {
416- case BT_ISO_CHAN_QOS_IN :
417- cis -> s_sdu = param -> chans [i ]-> qos -> sdu ;
418- break ;
419- case BT_ISO_CHAN_QOS_OUT :
420- cis -> m_sdu = param -> chans [i ]-> qos -> sdu ;
421- break ;
422- case BT_ISO_CHAN_QOS_INOUT :
423- cis -> m_sdu = param -> chans [i ]-> qos -> sdu ;
424- cis -> s_sdu = param -> chans [i ]-> qos -> sdu ;
425- break ;
417+ if (!qos -> tx && !qos -> rx ) {
418+ BT_ERR ("Both TX and RX QoS are disabled" );
419+ net_buf_unref (buf );
420+ return NULL ;
426421 }
427422
428- cis -> m_phy = param -> chans [i ]-> qos -> phy ;
429- cis -> s_phy = param -> chans [i ]-> qos -> phy ;
430- cis -> m_rtn = param -> chans [i ]-> qos -> rtn ;
431- cis -> s_rtn = param -> chans [i ]-> qos -> rtn ;
423+ if (!qos -> tx ) {
424+ /* Use RX PHY if TX is not set (disabled) */
425+ cis -> m_phy = qos -> rx -> phy ;
426+ } else {
427+ cis -> m_sdu = sys_cpu_to_le16 (qos -> tx -> sdu );
428+ cis -> m_phy = qos -> tx -> phy ;
429+ cis -> m_rtn = qos -> tx -> rtn ;
430+ }
431+
432+ if (!qos -> rx ) {
433+ /* Use TX PHY if RX is not set (disabled) */
434+ cis -> s_phy = qos -> tx -> phy ;
435+ } else {
436+ cis -> s_sdu = sys_cpu_to_le16 (qos -> rx -> sdu );
437+ cis -> s_phy = qos -> rx -> phy ;
438+ cis -> s_rtn = qos -> rx -> rtn ;
439+ }
432440 }
433441
434442 err = bt_hci_cmd_send_sync (BT_HCI_OP_LE_SET_CIG_PARAMS , buf , & rsp );
@@ -702,24 +710,15 @@ static int bt_iso_setup_data_path(struct bt_conn *conn)
702710 return - EINVAL ;
703711 }
704712
705- in_path .path = chan -> path ? chan -> path : & path ;
706- out_path .path = chan -> path ? chan -> path : & path ;
713+ in_path .path = chan -> qos -> tx -> path ? chan -> qos -> tx -> path : & path ;
714+ out_path .path = chan -> qos -> rx -> path ? chan -> qos -> rx -> path : & path ;
707715
708- switch (chan -> qos -> dir ) {
709- case BT_ISO_CHAN_QOS_IN :
710- in_path .pid = in_path .path -> pid ;
711- out_path .pid = BT_ISO_DATA_PATH_DISABLED ;
712- break ;
713- case BT_ISO_CHAN_QOS_OUT :
716+ if (!chan -> qos -> tx ) {
714717 in_path .pid = BT_ISO_DATA_PATH_DISABLED ;
715- out_path .pid = out_path .path -> pid ;
716- break ;
717- case BT_ISO_CHAN_QOS_INOUT :
718- in_path .pid = in_path .path -> pid ;
719- out_path .pid = out_path .path -> pid ;
720- break ;
721- default :
722- return - EINVAL ;
718+ }
719+
720+ if (!chan -> qos -> rx ) {
721+ out_path .pid = BT_ISO_DATA_PATH_DISABLED ;
723722 }
724723
725724 err = hci_le_setup_iso_data_path (conn , & in_path );
@@ -1242,8 +1241,7 @@ static int big_init_bis(struct bt_iso_big *big, bool broadcaster)
12421241 return - EALREADY ;
12431242 }
12441243
1245- if (!bis -> qos ||
1246- bis -> qos -> dir != (broadcaster ? BT_ISO_CHAN_QOS_IN : BT_ISO_CHAN_QOS_OUT )) {
1244+ if (!bis -> qos || (!bis -> qos -> tx && broadcaster )) {
12471245 BT_DBG ("BIS QOS was invalid" );
12481246 return - EINVAL ;
12491247 }
@@ -1286,11 +1284,11 @@ static int hci_le_create_big(struct bt_le_ext_adv *padv, struct bt_iso_big *big,
12861284 req -> big_handle = big -> handle ;
12871285 req -> adv_handle = padv -> handle ;
12881286 req -> num_bis = big -> num_bis ;
1289- sys_put_le24 (qos -> interval , req -> sdu_interval );
1290- req -> max_sdu = sys_cpu_to_le16 (qos -> sdu );
1291- req -> max_latency = sys_cpu_to_le16 (qos -> latency );
1292- req -> rtn = qos -> rtn ;
1293- req -> phy = qos -> phy ;
1287+ sys_put_le24 (qos -> tx -> interval , req -> sdu_interval );
1288+ req -> max_sdu = sys_cpu_to_le16 (qos -> tx -> sdu );
1289+ req -> max_latency = sys_cpu_to_le16 (qos -> tx -> latency );
1290+ req -> rtn = qos -> tx -> rtn ;
1291+ req -> phy = qos -> tx -> phy ;
12941292 req -> packing = qos -> packing ;
12951293 req -> framing = qos -> framing ;
12961294 req -> encryption = param -> encryption ;
@@ -1428,7 +1426,7 @@ int bt_iso_big_terminate(struct bt_iso_big *big)
14281426 }
14291427
14301428 /* They all have the same QOS dir so we can just check the first */
1431- broadcaster = big -> bis [0 ]-> qos -> dir == BT_ISO_CHAN_QOS_IN ;
1429+ broadcaster = big -> bis [0 ]-> qos -> tx ? true : false ;
14321430
14331431 if (broadcaster ) {
14341432 err = hci_le_terminate_big (big );
0 commit comments