Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Bluetooth: hci_sync: Add LE Channel Sounding HCI Command/event structures

1. Implement LE Event Mask to include events required for
LE Channel Sounding
2. Enable Channel Sounding feature bit in the
LE Host Supported Features command
3. Define HCI command and event structures necessary for
LE Channel Sounding functionality

Signed-off-by: Naga Bhavani Akella <naga.akella@oss.qualcomm.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

authored by

Naga Bhavani Akella and committed by
Luiz Augusto von Dentz
fe05e3c0 48fea7d4

+367 -7
+323
include/net/bluetooth/hci.h
··· 654 654 #define HCI_LE_ISO_BROADCASTER 0x40 655 655 #define HCI_LE_ISO_SYNC_RECEIVER 0x80 656 656 #define HCI_LE_LL_EXT_FEATURE 0x80 657 + #define HCI_LE_CS 0x40 658 + #define HCI_LE_CS_HOST 0x80 657 659 658 660 /* Connection modes */ 659 661 #define HCI_CM_ACTIVE 0x0000 ··· 2271 2269 __u8 pages; 2272 2270 } __packed; 2273 2271 2272 + /* Channel Sounding Commands */ 2273 + #define HCI_OP_LE_CS_RD_LOCAL_SUPP_CAP 0x2089 2274 + struct hci_rp_le_cs_rd_local_supp_cap { 2275 + __u8 status; 2276 + __u8 num_config_supported; 2277 + __le16 max_consecutive_procedures_supported; 2278 + __u8 num_antennas_supported; 2279 + __u8 max_antenna_paths_supported; 2280 + __u8 roles_supported; 2281 + __u8 modes_supported; 2282 + __u8 rtt_capability; 2283 + __u8 rtt_aa_only_n; 2284 + __u8 rtt_sounding_n; 2285 + __u8 rtt_random_payload_n; 2286 + __le16 nadm_sounding_capability; 2287 + __le16 nadm_random_capability; 2288 + __u8 cs_sync_phys_supported; 2289 + __le16 subfeatures_supported; 2290 + __le16 t_ip1_times_supported; 2291 + __le16 t_ip2_times_supported; 2292 + __le16 t_fcs_times_supported; 2293 + __le16 t_pm_times_supported; 2294 + __u8 t_sw_time_supported; 2295 + __u8 tx_snr_capability; 2296 + } __packed; 2297 + 2298 + #define HCI_OP_LE_CS_RD_RMT_SUPP_CAP 0x208A 2299 + struct hci_cp_le_cs_rd_local_supp_cap { 2300 + __le16 handle; 2301 + } __packed; 2302 + 2303 + #define HCI_OP_LE_CS_WR_CACHED_RMT_SUPP_CAP 0x208B 2304 + struct hci_cp_le_cs_wr_cached_rmt_supp_cap { 2305 + __le16 handle; 2306 + __u8 num_config_supported; 2307 + __le16 max_consecutive_procedures_supported; 2308 + __u8 num_antennas_supported; 2309 + __u8 max_antenna_paths_supported; 2310 + __u8 roles_supported; 2311 + __u8 modes_supported; 2312 + __u8 rtt_capability; 2313 + __u8 rtt_aa_only_n; 2314 + __u8 rtt_sounding_n; 2315 + __u8 rtt_random_payload_n; 2316 + __le16 nadm_sounding_capability; 2317 + __le16 nadm_random_capability; 2318 + __u8 cs_sync_phys_supported; 2319 + __le16 subfeatures_supported; 2320 + __le16 t_ip1_times_supported; 2321 + __le16 t_ip2_times_supported; 2322 + __le16 t_fcs_times_supported; 2323 + __le16 t_pm_times_supported; 2324 + __u8 t_sw_time_supported; 2325 + __u8 tx_snr_capability; 2326 + } __packed; 2327 + 2328 + struct hci_rp_le_cs_wr_cached_rmt_supp_cap { 2329 + __u8 status; 2330 + __le16 handle; 2331 + } __packed; 2332 + 2333 + #define HCI_OP_LE_CS_SEC_ENABLE 0x208C 2334 + struct hci_cp_le_cs_sec_enable { 2335 + __le16 handle; 2336 + } __packed; 2337 + 2338 + #define HCI_OP_LE_CS_SET_DEFAULT_SETTINGS 0x208D 2339 + struct hci_cp_le_cs_set_default_settings { 2340 + __le16 handle; 2341 + __u8 role_enable; 2342 + __u8 cs_sync_ant_sel; 2343 + __s8 max_tx_power; 2344 + } __packed; 2345 + 2346 + struct hci_rp_le_cs_set_default_settings { 2347 + __u8 status; 2348 + __le16 handle; 2349 + } __packed; 2350 + 2351 + #define HCI_OP_LE_CS_RD_RMT_FAE_TABLE 0x208E 2352 + struct hci_cp_le_cs_rd_rmt_fae_table { 2353 + __le16 handle; 2354 + } __packed; 2355 + 2356 + #define HCI_OP_LE_CS_WR_CACHED_RMT_FAE_TABLE 0x208F 2357 + struct hci_cp_le_cs_wr_rmt_cached_fae_table { 2358 + __le16 handle; 2359 + __u8 remote_fae_table[72]; 2360 + } __packed; 2361 + 2362 + struct hci_rp_le_cs_wr_rmt_cached_fae_table { 2363 + __u8 status; 2364 + __le16 handle; 2365 + } __packed; 2366 + 2367 + #define HCI_OP_LE_CS_CREATE_CONFIG 0x2090 2368 + struct hci_cp_le_cs_create_config { 2369 + __le16 handle; 2370 + __u8 config_id; 2371 + __u8 create_context; 2372 + __u8 main_mode_type; 2373 + __u8 sub_mode_type; 2374 + __u8 min_main_mode_steps; 2375 + __u8 max_main_mode_steps; 2376 + __u8 main_mode_repetition; 2377 + __u8 mode_0_steps; 2378 + __u8 role; 2379 + __u8 rtt_type; 2380 + __u8 cs_sync_phy; 2381 + __u8 channel_map[10]; 2382 + __u8 channel_map_repetition; 2383 + __u8 channel_selection_type; 2384 + __u8 ch3c_shape; 2385 + __u8 ch3c_jump; 2386 + __u8 reserved; 2387 + } __packed; 2388 + 2389 + #define HCI_OP_LE_CS_REMOVE_CONFIG 0x2091 2390 + struct hci_cp_le_cs_remove_config { 2391 + __le16 handle; 2392 + __u8 config_id; 2393 + } __packed; 2394 + 2395 + #define HCI_OP_LE_CS_SET_CH_CLASSIFICATION 0x2092 2396 + struct hci_cp_le_cs_set_ch_classification { 2397 + __u8 ch_classification[10]; 2398 + } __packed; 2399 + 2400 + struct hci_rp_le_cs_set_ch_classification { 2401 + __u8 status; 2402 + } __packed; 2403 + 2404 + #define HCI_OP_LE_CS_SET_PROC_PARAM 0x2093 2405 + struct hci_cp_le_cs_set_proc_param { 2406 + __le16 handle; 2407 + __u8 config_id; 2408 + __le16 max_procedure_len; 2409 + __le16 min_procedure_interval; 2410 + __le16 max_procedure_interval; 2411 + __le16 max_procedure_count; 2412 + __u8 min_subevent_len[3]; 2413 + __u8 max_subevent_len[3]; 2414 + __u8 tone_antenna_config_selection; 2415 + __u8 phy; 2416 + __u8 tx_power_delta; 2417 + __u8 preferred_peer_antenna; 2418 + __u8 snr_control_initiator; 2419 + __u8 snr_control_reflector; 2420 + } __packed; 2421 + 2422 + struct hci_rp_le_cs_set_proc_param { 2423 + __u8 status; 2424 + __le16 handle; 2425 + } __packed; 2426 + 2427 + #define HCI_OP_LE_CS_SET_PROC_ENABLE 0x2094 2428 + struct hci_cp_le_cs_set_proc_enable { 2429 + __le16 handle; 2430 + __u8 config_id; 2431 + __u8 enable; 2432 + } __packed; 2433 + 2434 + #define HCI_OP_LE_CS_TEST 0x2095 2435 + struct hci_cp_le_cs_test { 2436 + __u8 main_mode_type; 2437 + __u8 sub_mode_type; 2438 + __u8 main_mode_repetition; 2439 + __u8 mode_0_steps; 2440 + __u8 role; 2441 + __u8 rtt_type; 2442 + __u8 cs_sync_phy; 2443 + __u8 cs_sync_antenna_selection; 2444 + __u8 subevent_len[3]; 2445 + __le16 subevent_interval; 2446 + __u8 max_num_subevents; 2447 + __u8 transmit_power_level; 2448 + __u8 t_ip1_time; 2449 + __u8 t_ip2_time; 2450 + __u8 t_fcs_time; 2451 + __u8 t_pm_time; 2452 + __u8 t_sw_time; 2453 + __u8 tone_antenna_config_selection; 2454 + __u8 reserved; 2455 + __u8 snr_control_initiator; 2456 + __u8 snr_control_reflector; 2457 + __le16 drbg_nonce; 2458 + __u8 channel_map_repetition; 2459 + __le16 override_config; 2460 + __u8 override_parameters_length; 2461 + __u8 override_parameters_data[]; 2462 + } __packed; 2463 + 2464 + struct hci_rp_le_cs_test { 2465 + __u8 status; 2466 + } __packed; 2467 + 2468 + #define HCI_OP_LE_CS_TEST_END 0x2096 2469 + 2274 2470 /* ---- HCI Events ---- */ 2275 2471 struct hci_ev_status { 2276 2472 __u8 status; ··· 3158 2958 __u8 max_pages; 3159 2959 __u8 valid_pages; 3160 2960 __u8 features[248]; 2961 + } __packed; 2962 + 2963 + /* Channel Sounding Events */ 2964 + #define HCI_EVT_LE_CS_READ_RMT_SUPP_CAP_COMPLETE 0x2C 2965 + struct hci_evt_le_cs_read_rmt_supp_cap_complete { 2966 + __u8 status; 2967 + __le16 handle; 2968 + __u8 num_configs_supp; 2969 + __le16 max_consec_proc_supp; 2970 + __u8 num_ant_supp; 2971 + __u8 max_ant_path_supp; 2972 + __u8 roles_supp; 2973 + __u8 modes_supp; 2974 + __u8 rtt_cap; 2975 + __u8 rtt_aa_only_n; 2976 + __u8 rtt_sounding_n; 2977 + __u8 rtt_rand_payload_n; 2978 + __le16 nadm_sounding_cap; 2979 + __le16 nadm_rand_cap; 2980 + __u8 cs_sync_phys_supp; 2981 + __le16 sub_feat_supp; 2982 + __le16 t_ip1_times_supp; 2983 + __le16 t_ip2_times_supp; 2984 + __le16 t_fcs_times_supp; 2985 + __le16 t_pm_times_supp; 2986 + __u8 t_sw_times_supp; 2987 + __u8 tx_snr_cap; 2988 + } __packed; 2989 + 2990 + #define HCI_EVT_LE_CS_READ_RMT_FAE_TABLE_COMPLETE 0x2D 2991 + struct hci_evt_le_cs_read_rmt_fae_table_complete { 2992 + __u8 status; 2993 + __le16 handle; 2994 + __u8 remote_fae_table[72]; 2995 + } __packed; 2996 + 2997 + #define HCI_EVT_LE_CS_SECURITY_ENABLE_COMPLETE 0x2E 2998 + struct hci_evt_le_cs_security_enable_complete { 2999 + __u8 status; 3000 + __le16 handle; 3001 + } __packed; 3002 + 3003 + #define HCI_EVT_LE_CS_CONFIG_COMPLETE 0x2F 3004 + struct hci_evt_le_cs_config_complete { 3005 + __u8 status; 3006 + __le16 handle; 3007 + __u8 config_id; 3008 + __u8 action; 3009 + __u8 main_mode_type; 3010 + __u8 sub_mode_type; 3011 + __u8 min_main_mode_steps; 3012 + __u8 max_main_mode_steps; 3013 + __u8 main_mode_rep; 3014 + __u8 mode_0_steps; 3015 + __u8 role; 3016 + __u8 rtt_type; 3017 + __u8 cs_sync_phy; 3018 + __u8 channel_map[10]; 3019 + __u8 channel_map_rep; 3020 + __u8 channel_sel_type; 3021 + __u8 ch3c_shape; 3022 + __u8 ch3c_jump; 3023 + __u8 reserved; 3024 + __u8 t_ip1_time; 3025 + __u8 t_ip2_time; 3026 + __u8 t_fcs_time; 3027 + __u8 t_pm_time; 3028 + } __packed; 3029 + 3030 + #define HCI_EVT_LE_CS_PROCEDURE_ENABLE_COMPLETE 0x30 3031 + struct hci_evt_le_cs_procedure_enable_complete { 3032 + __u8 status; 3033 + __le16 handle; 3034 + __u8 config_id; 3035 + __u8 state; 3036 + __u8 tone_ant_config_sel; 3037 + __s8 sel_tx_pwr; 3038 + __u8 sub_evt_len[3]; 3039 + __u8 sub_evts_per_evt; 3040 + __le16 sub_evt_intrvl; 3041 + __le16 evt_intrvl; 3042 + __le16 proc_intrvl; 3043 + __le16 proc_counter; 3044 + __le16 max_proc_len; 3045 + } __packed; 3046 + 3047 + #define HCI_EVT_LE_CS_SUBEVENT_RESULT 0x31 3048 + struct hci_evt_le_cs_subevent_result { 3049 + __le16 handle; 3050 + __u8 config_id; 3051 + __le16 start_acl_conn_evt_counter; 3052 + __le16 proc_counter; 3053 + __le16 freq_comp; 3054 + __u8 ref_pwr_lvl; 3055 + __u8 proc_done_status; 3056 + __u8 subevt_done_status; 3057 + __u8 abort_reason; 3058 + __u8 num_ant_paths; 3059 + __u8 num_steps_reported; 3060 + __u8 step_mode[0]; /* depends on num_steps_reported */ 3061 + __u8 step_channel[0]; /* depends on num_steps_reported */ 3062 + __u8 step_data_length[0]; /* depends on num_steps_reported */ 3063 + __u8 step_data[0]; /* depends on num_steps_reported */ 3064 + } __packed; 3065 + 3066 + #define HCI_EVT_LE_CS_SUBEVENT_RESULT_CONTINUE 0x32 3067 + struct hci_evt_le_cs_subevent_result_continue { 3068 + __le16 handle; 3069 + __u8 config_id; 3070 + __u8 proc_done_status; 3071 + __u8 subevt_done_status; 3072 + __u8 abort_reason; 3073 + __u8 num_ant_paths; 3074 + __u8 num_steps_reported; 3075 + __u8 step_mode[0]; /* depends on num_steps_reported */ 3076 + __u8 step_channel[0]; /* depends on num_steps_reported */ 3077 + __u8 step_data_length[0]; /* depends on num_steps_reported */ 3078 + __u8 step_data[0]; /* depends on num_steps_reported */ 3079 + } __packed; 3080 + 3081 + #define HCI_EVT_LE_CS_TEST_END_COMPLETE 0x33 3082 + struct hci_evt_le_cs_test_end_complete { 3083 + __u8 status; 3161 3084 } __packed; 3162 3085 3163 3086 #define HCI_EV_VENDOR 0xff
+6
include/net/bluetooth/hci_core.h
··· 2073 2073 #define ll_ext_feature_capable(dev) \ 2074 2074 ((dev)->le_features[7] & HCI_LE_LL_EXT_FEATURE) 2075 2075 2076 + /* Channel sounding support */ 2077 + #define le_cs_capable(dev) \ 2078 + ((dev)->le_features[5] & HCI_LE_CS) 2079 + #define le_cs_host_capable(dev) \ 2080 + ((dev)->le_features[5] & HCI_LE_CS_HOST) 2081 + 2076 2082 #define mws_transport_config_capable(dev) (((dev)->commands[30] & 0x08) && \ 2077 2083 (!hci_test_quirk((dev), HCI_QUIRK_BROKEN_MWS_TRANSPORT_CONFIG))) 2078 2084
+38 -7
net/bluetooth/hci_sync.c
··· 4428 4428 events[4] |= 0x02; /* LE BIG Info Advertising Report */ 4429 4429 } 4430 4430 4431 + if (le_cs_capable(hdev)) { 4432 + /* Channel Sounding events */ 4433 + events[5] |= 0x08; /* LE CS Read Remote Supported Cap Complete event */ 4434 + events[5] |= 0x10; /* LE CS Read Remote FAE Table Complete event */ 4435 + events[5] |= 0x20; /* LE CS Security Enable Complete event */ 4436 + events[5] |= 0x40; /* LE CS Config Complete event */ 4437 + events[5] |= 0x80; /* LE CS Procedure Enable Complete event */ 4438 + events[6] |= 0x01; /* LE CS Subevent Result event */ 4439 + events[6] |= 0x02; /* LE CS Subevent Result Continue event */ 4440 + events[6] |= 0x04; /* LE CS Test End Complete event */ 4441 + } 4431 4442 return __hci_cmd_sync_status(hdev, HCI_OP_LE_SET_EVENT_MASK, 4432 4443 sizeof(events), events, HCI_CMD_TIMEOUT); 4433 4444 } ··· 4571 4560 } 4572 4561 4573 4562 /* LE Set Host Feature */ 4574 - static int hci_le_set_host_feature_sync(struct hci_dev *hdev) 4563 + static int hci_le_set_host_feature_sync(struct hci_dev *hdev, u8 bit, u8 value) 4575 4564 { 4576 4565 struct hci_cp_le_set_host_feature cp; 4577 - 4578 - if (!iso_capable(hdev)) 4579 - return 0; 4580 4566 4581 4567 memset(&cp, 0, sizeof(cp)); 4582 4568 4583 4569 /* Connected Isochronous Channels (Host Support) */ 4584 - cp.bit_number = 32; 4585 - cp.bit_value = iso_enabled(hdev) ? 0x01 : 0x00; 4570 + cp.bit_number = bit; 4571 + cp.bit_value = value; 4586 4572 4587 4573 return __hci_cmd_sync_status(hdev, HCI_OP_LE_SET_HOST_FEATURE, 4588 4574 sizeof(cp), &cp, HCI_CMD_TIMEOUT); 4575 + } 4576 + 4577 + /* Set Host Features, each feature needs to be sent separately since 4578 + * HCI_OP_LE_SET_HOST_FEATURE doesn't support setting all of them at once. 4579 + */ 4580 + static int hci_le_set_host_features_sync(struct hci_dev *hdev) 4581 + { 4582 + int err; 4583 + 4584 + if (iso_capable(hdev)) { 4585 + /* Connected Isochronous Channels (Host Support) */ 4586 + err = hci_le_set_host_feature_sync(hdev, 32, 4587 + (iso_enabled(hdev) ? 0x01 : 4588 + 0x00)); 4589 + if (err) 4590 + return err; 4591 + } 4592 + 4593 + if (le_cs_capable(hdev)) 4594 + /* Channel Sounding (Host Support) */ 4595 + err = hci_le_set_host_feature_sync(hdev, 47, 0x01); 4596 + 4597 + return err; 4589 4598 } 4590 4599 4591 4600 /* LE Controller init stage 3 command sequence */ ··· 4635 4604 /* HCI_OP_WRITE_LE_HOST_SUPPORTED */ 4636 4605 HCI_INIT(hci_set_le_support_sync), 4637 4606 /* HCI_OP_LE_SET_HOST_FEATURE */ 4638 - HCI_INIT(hci_le_set_host_feature_sync), 4607 + HCI_INIT(hci_le_set_host_features_sync), 4639 4608 {} 4640 4609 }; 4641 4610