1 /* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */ 2 /* 3 * Copyright (c) 2016-2019, The Linux Foundation. All rights reserved. 4 */ 5 #ifndef __UAPI_RADIO_IRIS_H 6 #define __UAPI_RADIO_IRIS_H 7 8 #include <linux/types.h> 9 #include <media/radio-iris-commands.h> 10 11 #define MIN_TX_TONE_VAL 0x00 12 #define MAX_TX_TONE_VAL 0x07 13 #define MIN_HARD_MUTE_VAL 0x00 14 #define MAX_HARD_MUTE_VAL 0x03 15 #define MIN_SRCH_MODE 0x00 16 #define MAX_SRCH_MODE 0x09 17 #define MIN_SCAN_DWELL 0x00 18 #define MAX_SCAN_DWELL 0x0F 19 #define MIN_SIG_TH 0x00 20 #define MAX_SIG_TH 0x03 21 #define MIN_PTY 0X00 22 #define MAX_PTY 0x1F 23 #define MIN_PI 0x0000 24 #define MAX_PI 0xFFFF 25 #define MIN_SRCH_STATIONS_CNT 0x00 26 #define MAX_SRCH_STATIONS_CNT 0x14 27 #define MIN_CHAN_SPACING 0x00 28 #define MAX_CHAN_SPACING 0x02 29 #define MIN_EMPHASIS 0x00 30 #define MAX_EMPHASIS 0x01 31 #define MIN_RDS_STD 0x00 32 #define MAX_RDS_STD 0x02 33 #define MIN_ANTENNA_VAL 0x00 34 #define MAX_ANTENNA_VAL 0x01 35 #define MIN_TX_PS_REPEAT_CNT 0x01 36 #define MAX_TX_PS_REPEAT_CNT 0x0F 37 #define MIN_SOFT_MUTE 0x00 38 #define MAX_SOFT_MUTE 0x01 39 #define MIN_PEEK_ACCESS_LEN 0x01 40 #define MAX_PEEK_ACCESS_LEN 0xF9 41 #define MIN_RESET_CNTR 0x00 42 #define MAX_RESET_CNTR 0x01 43 #define MIN_HLSI 0x00 44 #define MAX_HLSI 0x02 45 #define MIN_NOTCH_FILTER 0x00 46 #define MAX_NOTCH_FILTER 0x02 47 #define MIN_INTF_DET_OUT_LW_TH 0x00 48 #define MAX_INTF_DET_OUT_LW_TH 0xFF 49 #define MIN_INTF_DET_OUT_HG_TH 0x00 50 #define MAX_INTF_DET_OUT_HG_TH 0xFF 51 #define MIN_SINR_TH -128 52 #define MAX_SINR_TH 127 53 #define MIN_SINR_SAMPLES 0x01 54 #define MAX_SINR_SAMPLES 0xFF 55 #define MIN_BLEND_HI -128 56 #define MAX_BLEND_HI 127 57 58 59 /* ---- HCI Packet structures ---- */ 60 #define RADIO_HCI_COMMAND_HDR_SIZE sizeof(struct radio_hci_command_hdr) 61 #define RADIO_HCI_EVENT_HDR_SIZE sizeof(struct radio_hci_event_hdr) 62 63 /* HCI data types */ 64 #define RADIO_HCI_COMMAND_PKT 0x11 65 #define RADIO_HCI_EVENT_PKT 0x14 66 /*HCI reponce packets*/ 67 #define MAX_RIVA_PEEK_RSP_SIZE 251 68 /* default data access */ 69 #define DEFAULT_DATA_OFFSET 2 70 #define DEFAULT_DATA_SIZE 249 71 /* Power levels are 0-7, but SOC will expect values from 0-255 72 * So the each level step size will be 255/7 = 36 73 */ 74 #define FM_TX_PWR_LVL_STEP_SIZE 36 75 #define FM_TX_PWR_LVL_0 0 /* Lowest power lvl that can be set for Tx */ 76 #define FM_TX_PWR_LVL_MAX 7 /* Max power lvl for Tx */ 77 #define FM_TX_PHY_CFG_MODE 0x3c 78 #define FM_TX_PHY_CFG_LEN 0x10 79 #define FM_TX_PWR_GAIN_OFFSET 14 80 /**RDS CONFIG MODE**/ 81 #define FM_RDS_CNFG_MODE 0x0f 82 #define FM_RDS_CNFG_LEN 0x10 83 #define AF_RMSSI_TH_LSB_OFFSET 10 84 #define AF_RMSSI_TH_MSB_OFFSET 11 85 #define AF_RMSSI_SAMPLES_OFFSET 15 86 /**RX CONFIG MODE**/ 87 #define FM_RX_CONFG_MODE 0x15 88 #define FM_RX_CNFG_LEN 0x20 89 #define GD_CH_RMSSI_TH_OFFSET 12 90 #define MAX_GD_CH_RMSSI_TH 127 91 #define SRCH_ALGO_TYPE_OFFSET 25 92 #define SINRFIRSTSTAGE_OFFSET 26 93 #define RMSSIFIRSTSTAGE_OFFSET 27 94 #define CF0TH12_BYTE1_OFFSET 8 95 #define CF0TH12_BYTE2_OFFSET 9 96 #define CF0TH12_BYTE3_OFFSET 10 97 #define CF0TH12_BYTE4_OFFSET 11 98 #define MAX_SINR_FIRSTSTAGE 127 99 #define MAX_RMSSI_FIRSTSTAGE 127 100 #define RDS_PS0_XFR_MODE 0x01 101 #define RDS_PS0_LEN 6 102 #define RX_REPEATE_BYTE_OFFSET 5 103 #define FM_SPUR_TBL_SIZE 240 104 #define SPUR_DATA_LEN 16 105 #define ENTRIES_EACH_CMD 15 106 #define SPUR_DATA_INDEX 2 107 #define FM_AF_LIST_MAX_SIZE 200 108 /* Each AF frequency consist of sizeof(int) bytes */ 109 #define AF_LIST_MAX (FM_AF_LIST_MAX_SIZE / 4) 110 111 #define MAX_BLEND_INDEX 49 112 113 #define TUNE_PARAM 16 114 #define FM_RDS_3A_GRP (0x40) 115 struct radio_hci_command_hdr { 116 __le16 opcode; /* OCF & OGF */ 117 __u8 plen; 118 } __attribute__((packed)); 119 120 struct radio_hci_event_hdr { 121 __u8 evt; 122 __u8 plen; 123 } __attribute__((packed)); 124 125 /* Opcode OCF */ 126 /* HCI recv control commands opcode */ 127 #define HCI_OCF_FM_ENABLE_RECV_REQ 0x0001 128 #define HCI_OCF_FM_DISABLE_RECV_REQ 0x0002 129 #define HCI_OCF_FM_GET_RECV_CONF_REQ 0x0003 130 #define HCI_OCF_FM_SET_RECV_CONF_REQ 0x0004 131 #define HCI_OCF_FM_SET_MUTE_MODE_REQ 0x0005 132 #define HCI_OCF_FM_SET_STEREO_MODE_REQ 0x0006 133 #define HCI_OCF_FM_SET_ANTENNA 0x0007 134 #define HCI_OCF_FM_SET_SIGNAL_THRESHOLD 0x0008 135 #define HCI_OCF_FM_GET_SIGNAL_THRESHOLD 0x0009 136 #define HCI_OCF_FM_GET_STATION_PARAM_REQ 0x000A 137 #define HCI_OCF_FM_GET_PROGRAM_SERVICE_REQ 0x000B 138 #define HCI_OCF_FM_GET_RADIO_TEXT_REQ 0x000C 139 #define HCI_OCF_FM_GET_AF_LIST_REQ 0x000D 140 #define HCI_OCF_FM_SEARCH_STATIONS 0x000E 141 #define HCI_OCF_FM_SEARCH_RDS_STATIONS 0x000F 142 #define HCI_OCF_FM_SEARCH_STATIONS_LIST 0x0010 143 #define HCI_OCF_FM_CANCEL_SEARCH 0x0011 144 #define HCI_OCF_FM_RDS_GRP 0x0012 145 #define HCI_OCF_FM_RDS_GRP_PROCESS 0x0013 146 #define HCI_OCF_FM_EN_WAN_AVD_CTRL 0x0014 147 #define HCI_OCF_FM_EN_NOTCH_CTRL 0x0015 148 #define HCI_OCF_FM_SET_EVENT_MASK 0x0016 149 #define HCI_OCF_FM_SET_CH_DET_THRESHOLD 0x0017 150 #define HCI_OCF_FM_GET_CH_DET_THRESHOLD 0x0018 151 #define HCI_OCF_FM_SET_BLND_TBL 0x001B 152 #define HCI_OCF_FM_GET_BLND_TBL 0x001C 153 /* HCI trans control commans opcode*/ 154 #define HCI_OCF_FM_ENABLE_TRANS_REQ 0x0001 155 #define HCI_OCF_FM_DISABLE_TRANS_REQ 0x0002 156 #define HCI_OCF_FM_GET_TRANS_CONF_REQ 0x0003 157 #define HCI_OCF_FM_SET_TRANS_CONF_REQ 0x0004 158 #define HCI_OCF_FM_RDS_RT_REQ 0x0008 159 #define HCI_OCF_FM_RDS_PS_REQ 0x0009 160 161 162 /* HCI common control commands opcode */ 163 #define HCI_OCF_FM_TUNE_STATION_REQ 0x0001 164 #define HCI_OCF_FM_DEFAULT_DATA_READ 0x0002 165 #define HCI_OCF_FM_DEFAULT_DATA_WRITE 0x0003 166 #define HCI_OCF_FM_RESET 0x0004 167 #define HCI_OCF_FM_GET_FEATURE_LIST 0x0005 168 #define HCI_OCF_FM_DO_CALIBRATION 0x0006 169 #define HCI_OCF_FM_SET_CALIBRATION 0x0007 170 #define HCI_OCF_FM_SET_SPUR_TABLE 0x0008 171 #define HCI_OCF_FM_GET_SPUR_TABLE 0x0009 172 173 /*HCI Status parameters commands*/ 174 #define HCI_OCF_FM_READ_GRP_COUNTERS 0x0001 175 176 /*HCI Diagnostic commands*/ 177 #define HCI_OCF_FM_PEEK_DATA 0x0002 178 #define HCI_OCF_FM_POKE_DATA 0x0003 179 #define HCI_OCF_FM_SSBI_PEEK_REG 0x0004 180 #define HCI_OCF_FM_SSBI_POKE_REG 0x0005 181 #define HCI_OCF_FM_STATION_DBG_PARAM 0x0007 182 #define HCI_FM_SET_INTERNAL_TONE_GENRATOR 0x0008 183 184 /* Opcode OGF */ 185 #define HCI_OGF_FM_RECV_CTRL_CMD_REQ 0x0013 186 #define HCI_OGF_FM_TRANS_CTRL_CMD_REQ 0x0014 187 #define HCI_OGF_FM_COMMON_CTRL_CMD_REQ 0x0015 188 #define HCI_OGF_FM_STATUS_PARAMETERS_CMD_REQ 0x0016 189 #define HCI_OGF_FM_TEST_CMD_REQ 0x0017 190 #define HCI_OGF_FM_DIAGNOSTIC_CMD_REQ 0x003F 191 192 /* Command opcode pack/unpack */ 193 #define hci_opcode_pack(ogf, ocf) ((__u16) ((ocf & 0x03ff)|(ogf << 10))) 194 #define hci_opcode_ogf(op) (op >> 10) 195 #define hci_opcode_ocf(op) (op & 0x03ff) 196 #define hci_recv_ctrl_cmd_op_pack(ocf) \ 197 ((__u16) hci_opcode_pack(HCI_OGF_FM_RECV_CTRL_CMD_REQ, ocf)) 198 #define hci_trans_ctrl_cmd_op_pack(ocf) \ 199 ((__u16) hci_opcode_pack(HCI_OGF_FM_TRANS_CTRL_CMD_REQ, ocf)) 200 #define hci_common_cmd_op_pack(ocf) \ 201 ((__u16) hci_opcode_pack(HCI_OGF_FM_COMMON_CTRL_CMD_REQ, ocf)) 202 #define hci_status_param_op_pack(ocf) \ 203 ((__u16) hci_opcode_pack(HCI_OGF_FM_STATUS_PARAMETERS_CMD_REQ, ocf)) 204 #define hci_diagnostic_cmd_op_pack(ocf) \ 205 ((__u16) hci_opcode_pack(HCI_OGF_FM_DIAGNOSTIC_CMD_REQ, ocf)) 206 207 208 /* HCI commands with no arguments*/ 209 #define HCI_FM_ENABLE_RECV_CMD 1 210 #define HCI_FM_DISABLE_RECV_CMD 2 211 #define HCI_FM_GET_RECV_CONF_CMD 3 212 #define HCI_FM_GET_STATION_PARAM_CMD 4 213 #define HCI_FM_GET_SIGNAL_TH_CMD 5 214 #define HCI_FM_GET_PROGRAM_SERVICE_CMD 6 215 #define HCI_FM_GET_RADIO_TEXT_CMD 7 216 #define HCI_FM_GET_AF_LIST_CMD 8 217 #define HCI_FM_CANCEL_SEARCH_CMD 9 218 #define HCI_FM_RESET_CMD 10 219 #define HCI_FM_GET_FEATURES_CMD 11 220 #define HCI_FM_STATION_DBG_PARAM_CMD 12 221 #define HCI_FM_ENABLE_TRANS_CMD 13 222 #define HCI_FM_DISABLE_TRANS_CMD 14 223 #define HCI_FM_GET_TX_CONFIG 15 224 #define HCI_FM_GET_DET_CH_TH_CMD 16 225 #define HCI_FM_GET_BLND_TBL_CMD 17 226 227 /* Defines for FM TX*/ 228 #define TX_PS_DATA_LENGTH 108 229 #define TX_RT_DATA_LENGTH 64 230 #define PS_STRING_LEN 9 231 232 /* ----- HCI Command request ----- */ 233 struct hci_fm_recv_conf_req { 234 __u8 emphasis; 235 __u8 ch_spacing; 236 __u8 rds_std; 237 __u8 hlsi; 238 __u32 band_low_limit; 239 __u32 band_high_limit; 240 } __attribute__((packed)); 241 242 /* ----- HCI Command request ----- */ 243 struct hci_fm_trans_conf_req_struct { 244 __u8 emphasis; 245 __u8 rds_std; 246 __u32 band_low_limit; 247 __u32 band_high_limit; 248 } __attribute__((packed)); 249 250 251 /* ----- HCI Command request ----- */ 252 struct hci_fm_tx_ps { 253 __u8 ps_control; 254 __u16 pi; 255 __u8 pty; 256 __u8 ps_repeatcount; 257 __u8 ps_num; 258 __u8 ps_data[TX_PS_DATA_LENGTH]; 259 } __attribute__((packed)); 260 261 struct hci_fm_tx_rt { 262 __u8 rt_control; 263 __u16 pi; 264 __u8 pty; 265 __u8 rt_len; 266 __u8 rt_data[TX_RT_DATA_LENGTH]; 267 } __attribute__((packed)); 268 269 struct hci_fm_mute_mode_req { 270 __u8 hard_mute; 271 __u8 soft_mute; 272 } __attribute__((packed)); 273 274 struct hci_fm_stereo_mode_req { 275 __u8 stereo_mode; 276 __u8 sig_blend; 277 __u8 intf_blend; 278 __u8 most_switch; 279 } __attribute__((packed)); 280 281 struct hci_fm_search_station_req { 282 __u8 srch_mode; 283 __u8 scan_time; 284 __u8 srch_dir; 285 } __attribute__((packed)); 286 287 struct hci_fm_search_rds_station_req { 288 struct hci_fm_search_station_req srch_station; 289 __u8 srch_pty; 290 __u16 srch_pi; 291 } __attribute__((packed)); 292 293 struct hci_fm_search_station_list_req { 294 __u8 srch_list_mode; 295 __u8 srch_list_dir; 296 __u32 srch_list_max; 297 __u8 srch_pty; 298 } __attribute__((packed)); 299 300 struct hci_fm_rds_grp_req { 301 __u32 rds_grp_enable_mask; 302 __u32 rds_buf_size; 303 __u8 en_rds_change_filter; 304 } __attribute__((packed)); 305 306 struct hci_fm_en_avd_ctrl_req { 307 __u8 no_freqs; 308 __u8 freq_index; 309 __u8 lo_shft; 310 __u16 freq_min; 311 __u16 freq_max; 312 } __attribute__((packed)); 313 314 struct hci_fm_def_data_rd_req { 315 __u8 mode; 316 __u8 length; 317 __u8 param_len; 318 __u8 param; 319 } __attribute__((packed)); 320 321 struct hci_fm_def_data_wr_req { 322 __u8 mode; 323 __u8 length; 324 __u8 data[DEFAULT_DATA_SIZE]; 325 } __attribute__((packed)); 326 327 struct hci_fm_riva_data { 328 __u8 subopcode; 329 __u32 start_addr; 330 __u8 length; 331 } __attribute__((packed)); 332 333 struct hci_fm_riva_poke { 334 struct hci_fm_riva_data cmd_params; 335 __u8 data[MAX_RIVA_PEEK_RSP_SIZE]; 336 } __attribute__((packed)); 337 338 struct hci_fm_ssbi_req { 339 __u16 start_addr; 340 __u8 data; 341 } __attribute__((packed)); 342 struct hci_fm_ssbi_peek { 343 __u16 start_address; 344 } __attribute__((packed)); 345 346 struct hci_fm_ch_det_threshold { 347 char sinr; 348 __u8 sinr_samples; 349 __u8 low_th; 350 __u8 high_th; 351 352 } __attribute__((packed)); 353 354 struct hci_fm_blend_table { 355 __u8 ucBlendType; 356 __u8 ucBlendRampRateUp; 357 __u8 ucBlendDebounceNumSampleUp; 358 __u8 ucBlendDebounceIdxUp; 359 __u8 ucBlendSinrIdxSkipStep; 360 __u8 scBlendSinrHi; 361 __u8 scBlendRmssiHi; 362 __u8 ucBlendIndexHi; 363 __u8 ucBlendIndex[MAX_BLEND_INDEX]; 364 } __attribute__((packed)); 365 366 /*HCI events*/ 367 #define HCI_EV_TUNE_STATUS 0x01 368 #define HCI_EV_RDS_LOCK_STATUS 0x02 369 #define HCI_EV_STEREO_STATUS 0x03 370 #define HCI_EV_SERVICE_AVAILABLE 0x04 371 #define HCI_EV_SEARCH_PROGRESS 0x05 372 #define HCI_EV_SEARCH_RDS_PROGRESS 0x06 373 #define HCI_EV_SEARCH_LIST_PROGRESS 0x07 374 #define HCI_EV_RDS_RX_DATA 0x08 375 #define HCI_EV_PROGRAM_SERVICE 0x09 376 #define HCI_EV_RADIO_TEXT 0x0A 377 #define HCI_EV_FM_AF_LIST 0x0B 378 #define HCI_EV_TX_RDS_GRP_AVBLE 0x0C 379 #define HCI_EV_TX_RDS_GRP_COMPL 0x0D 380 #define HCI_EV_TX_RDS_CONT_GRP_COMPL 0x0E 381 #define HCI_EV_CMD_COMPLETE 0x0F 382 #define HCI_EV_CMD_STATUS 0x10 383 #define HCI_EV_TUNE_COMPLETE 0x11 384 #define HCI_EV_SEARCH_COMPLETE 0x12 385 #define HCI_EV_SEARCH_RDS_COMPLETE 0x13 386 #define HCI_EV_SEARCH_LIST_COMPLETE 0x14 387 388 #define HCI_REQ_DONE 0 389 #define HCI_REQ_PEND 1 390 #define HCI_REQ_CANCELED 2 391 #define HCI_REQ_STATUS 3 392 393 #define MAX_RAW_RDS_GRPS 21 394 395 #define RDSGRP_DATA_OFFSET 0x1 396 397 /*RT PLUS*/ 398 #define DUMMY_CLASS 0 399 #define RT_PLUS_LEN_1_TAG 3 400 #define RT_ERT_FLAG_BIT 5 401 402 /*TAG1*/ 403 #define TAG1_MSB_OFFSET 3 404 #define TAG1_MSB_MASK 7 405 #define TAG1_LSB_OFFSET 5 406 #define TAG1_POS_MSB_MASK 31 407 #define TAG1_POS_MSB_OFFSET 1 408 #define TAG1_POS_LSB_OFFSET 7 409 #define TAG1_LEN_OFFSET 1 410 #define TAG1_LEN_MASK 63 411 412 /*TAG2*/ 413 #define TAG2_MSB_OFFSET 5 414 #define TAG2_MSB_MASK 1 415 #define TAG2_LSB_OFFSET 3 416 #define TAG2_POS_MSB_MASK 7 417 #define TAG2_POS_MSB_OFFSET 3 418 #define TAG2_POS_LSB_OFFSET 5 419 #define TAG2_LEN_MASK 31 420 421 #define AGT_MASK 31 422 /*Extract 5 left most bits of lsb of 2nd block*/ 423 #define AGT(x) (x & AGT_MASK) 424 /*16 bits of 4th block*/ 425 #define AID(lsb, msb) ((msb << 8) | (lsb)) 426 /*Extract 5 right most bits of msb of 2nd block*/ 427 #define GTC(blk2msb) (blk2msb >> 3) 428 429 #define GRP_3A 0x6 430 #define RT_PLUS_AID 0x4bd7 431 432 /*ERT*/ 433 #define ERT_AID 0x6552 434 #define CARRIAGE_RETURN 0x000D 435 #define MAX_ERT_SEGMENT 31 436 #define ERT_FORMAT_DIR_BIT 1 437 438 #define EXTRACT_BIT(data, bit_pos) ((data & (1 << bit_pos)) >> bit_pos) 439 440 struct hci_ev_tune_status { 441 __u8 sub_event; 442 __le32 station_freq; 443 __u8 serv_avble; 444 char rssi; 445 __u8 stereo_prg; 446 __u8 rds_sync_status; 447 __u8 mute_mode; 448 char sinr; 449 __u8 intf_det_th; 450 } __attribute__((packed)); 451 452 struct rds_blk_data { 453 __u8 rdsMsb; 454 __u8 rdsLsb; 455 __u8 blockStatus; 456 } __attribute__((packed)); 457 458 struct rds_grp_data { 459 struct rds_blk_data rdsBlk[4]; 460 } __attribute__((packed)); 461 462 struct hci_ev_rds_rx_data { 463 __u8 num_rds_grps; 464 struct rds_grp_data rds_grp_data[MAX_RAW_RDS_GRPS]; 465 } __attribute__((packed)); 466 467 struct hci_ev_prg_service { 468 __le16 pi_prg_id; 469 __u8 pty_prg_type; 470 __u8 ta_prg_code_type; 471 __u8 ta_ann_code_flag; 472 __u8 ms_switch_code_flag; 473 __u8 dec_id_ctrl_code_flag; 474 __u8 ps_num; 475 __u8 prg_service_name[119]; 476 } __attribute__((packed)); 477 478 struct hci_ev_radio_text { 479 __le16 pi_prg_id; 480 __u8 pty_prg_type; 481 __u8 ta_prg_code_type; 482 __u8 txt_ab_flag; 483 __u8 radio_txt[64]; 484 } __attribute__((packed)); 485 486 struct hci_ev_af_list { 487 __le32 tune_freq; 488 __le16 pi_code; 489 __u8 af_size; 490 __u8 af_list[FM_AF_LIST_MAX_SIZE]; 491 } __attribute__((packed)); 492 493 struct hci_ev_cmd_complete { 494 __u8 num_hci_cmd_pkts; 495 __le16 cmd_opcode; 496 } __attribute__((packed)); 497 498 struct hci_ev_cmd_status { 499 __u8 status; 500 __u8 num_hci_cmd_pkts; 501 __le16 status_opcode; 502 } __attribute__((packed)); 503 504 struct hci_ev_srch_st { 505 __le32 station_freq; 506 __u8 rds_cap; 507 __u8 pty; 508 __le16 status_opcode; 509 } __attribute__((packed)); 510 511 struct hci_ev_rel_freq { 512 __u8 rel_freq_msb; 513 __u8 rel_freq_lsb; 514 515 } __attribute__((packed)); 516 struct hci_ev_srch_list_compl { 517 __u8 num_stations_found; 518 struct hci_ev_rel_freq rel_freq[20]; 519 } __attribute__((packed)); 520 521 /* ----- HCI Event Response ----- */ 522 struct hci_fm_conf_rsp { 523 __u8 status; 524 struct hci_fm_recv_conf_req recv_conf_rsp; 525 } __attribute__((packed)); 526 527 struct hci_fm_get_trans_conf_rsp { 528 __u8 status; 529 struct hci_fm_trans_conf_req_struct trans_conf_rsp; 530 } __attribute__((packed)); 531 struct hci_fm_sig_threshold_rsp { 532 __u8 status; 533 __u8 sig_threshold; 534 } __attribute__((packed)); 535 536 struct hci_fm_station_rsp { 537 struct hci_ev_tune_status station_rsp; 538 } __attribute__((packed)); 539 540 struct hci_fm_prgm_srv_rsp { 541 __u8 status; 542 struct hci_ev_prg_service prg_srv; 543 } __attribute__((packed)); 544 545 struct hci_fm_radio_txt_rsp { 546 __u8 status; 547 struct hci_ev_radio_text rd_txt; 548 } __attribute__((packed)); 549 550 struct hci_fm_af_list_rsp { 551 __u8 status; 552 struct hci_ev_af_list rd_txt; 553 } __attribute__((packed)); 554 555 struct hci_fm_data_rd_rsp { 556 __u8 status; 557 __u8 ret_data_len; 558 __u8 data[DEFAULT_DATA_SIZE]; 559 } __attribute__((packed)); 560 561 struct hci_fm_feature_list_rsp { 562 __u8 status; 563 __u8 feature_mask; 564 } __attribute__((packed)); 565 566 struct hci_fm_dbg_param_rsp { 567 __u8 status; 568 __u8 blend; 569 __u8 soft_mute; 570 __u8 inf_blend; 571 __u8 inf_soft_mute; 572 __u8 pilot_pil; 573 __u8 io_verc; 574 __u8 in_det_out; 575 } __attribute__((packed)); 576 577 #define CLKSPURID_INDEX0 0 578 #define CLKSPURID_INDEX1 5 579 #define CLKSPURID_INDEX2 10 580 #define CLKSPURID_INDEX3 15 581 #define CLKSPURID_INDEX4 20 582 #define CLKSPURID_INDEX5 25 583 584 #define MAX_SPUR_FREQ_LIMIT 30 585 #define CKK_SPUR 0x3B 586 #define SPUR_DATA_SIZE 0x4 587 #define SPUR_ENTRIES_PER_ID 0x5 588 589 #define COMPUTE_SPUR(val) ((((val) - (76000)) / (50))) 590 #define GET_FREQ(val, bit) ((bit == 1) ? ((val) >> 8) : ((val) & 0xFF)) 591 #define GET_SPUR_ENTRY_LEVEL(val) ((val) / (5)) 592 593 struct hci_fm_spur_data { 594 __u32 freq[MAX_SPUR_FREQ_LIMIT]; 595 __s8 rmssi[MAX_SPUR_FREQ_LIMIT]; 596 __u8 enable[MAX_SPUR_FREQ_LIMIT]; 597 } __attribute__((packed)); 598 599 600 /* HCI dev events */ 601 #define RADIO_HCI_DEV_REG 1 602 #define RADIO_HCI_DEV_WRITE 2 603 604 /* FM RDS */ 605 #define RDS_PTYPE 2 606 #define RDS_PID_LOWER 1 607 #define RDS_PID_HIGHER 0 608 #define RDS_OFFSET 5 609 #define RDS_PS_LENGTH_OFFSET 7 610 #define RDS_STRING 8 611 #define RDS_PS_DATA_OFFSET 8 612 #define RDS_CONFIG_OFFSET 3 613 #define RDS_AF_JUMP_OFFSET 4 614 #define PI_CODE_OFFSET 4 615 #define AF_SIZE_OFFSET 6 616 #define AF_LIST_OFFSET 7 617 #define RT_A_B_FLAG_OFFSET 4 618 /*FM states*/ 619 620 enum radio_state_t { 621 FM_OFF, 622 FM_RECV, 623 FM_TRANS, 624 FM_RESET, 625 FM_CALIB, 626 FM_TURNING_OFF, 627 FM_RECV_TURNING_ON, 628 FM_TRANS_TURNING_ON, 629 FM_MAX_NO_STATES, 630 }; 631 632 enum emphasis_type { 633 FM_RX_EMP75 = 0x0, 634 FM_RX_EMP50 = 0x1 635 }; 636 637 enum channel_space_type { 638 FM_RX_SPACE_200KHZ = 0x0, 639 FM_RX_SPACE_100KHZ = 0x1, 640 FM_RX_SPACE_50KHZ = 0x2 641 }; 642 643 enum high_low_injection { 644 AUTO_HI_LO_INJECTION = 0x0, 645 LOW_SIDE_INJECTION = 0x1, 646 HIGH_SIDE_INJECTION = 0x2 647 }; 648 649 enum fm_rds_type { 650 FM_RX_RDBS_SYSTEM = 0x0, 651 FM_RX_RDS_SYSTEM = 0x1 652 }; 653 654 enum iris_region_t { 655 IRIS_REGION_US, 656 IRIS_REGION_EU, 657 IRIS_REGION_JAPAN, 658 IRIS_REGION_JAPAN_WIDE, 659 IRIS_REGION_OTHER 660 }; 661 662 #define STD_BUF_SIZE (256) 663 664 enum iris_buf_t { 665 IRIS_BUF_SRCH_LIST, 666 IRIS_BUF_EVENTS, 667 IRIS_BUF_RT_RDS, 668 IRIS_BUF_PS_RDS, 669 IRIS_BUF_RAW_RDS, 670 IRIS_BUF_AF_LIST, 671 IRIS_BUF_PEEK, 672 IRIS_BUF_SSBI_PEEK, 673 IRIS_BUF_RDS_CNTRS, 674 IRIS_BUF_RD_DEFAULT, 675 IRIS_BUF_CAL_DATA, 676 IRIS_BUF_RT_PLUS, 677 IRIS_BUF_ERT, 678 IRIS_BUF_SPUR, 679 IRIS_BUF_MAX, 680 }; 681 682 enum iris_xfr_t { 683 IRIS_XFR_SYNC, 684 IRIS_XFR_ERROR, 685 IRIS_XFR_SRCH_LIST, 686 IRIS_XFR_RT_RDS, 687 IRIS_XFR_PS_RDS, 688 IRIS_XFR_AF_LIST, 689 IRIS_XFR_MAX 690 }; 691 692 /* Search options */ 693 enum search_t { 694 SEEK, 695 SCAN, 696 SCAN_FOR_STRONG, 697 SCAN_FOR_WEAK, 698 RDS_SEEK_PTY, 699 RDS_SCAN_PTY, 700 RDS_SEEK_PI, 701 RDS_AF_JUMP, 702 }; 703 704 enum spur_entry_levels { 705 ENTRY_0, 706 ENTRY_1, 707 ENTRY_2, 708 ENTRY_3, 709 ENTRY_4, 710 ENTRY_5, 711 }; 712 713 /* Band limits */ 714 #define REGION_US_EU_BAND_LOW 87500 715 #define REGION_US_EU_BAND_HIGH 108000 716 #define REGION_JAPAN_STANDARD_BAND_LOW 76000 717 #define REGION_JAPAN_STANDARD_BAND_HIGH 90000 718 #define REGION_JAPAN_WIDE_BAND_LOW 90000 719 #define REGION_JAPAN_WIDE_BAND_HIGH 108000 720 721 #define SRCH_MODE 0x07 722 #define SRCH_DIR 0x08 /* 0-up 1-down */ 723 #define SCAN_DWELL 0x70 724 #define SRCH_ON 0x80 725 726 /* I/O Control */ 727 #define IOC_HRD_MUTE 0x03 728 #define IOC_SFT_MUTE 0x01 729 #define IOC_MON_STR 0x01 730 #define IOC_SIG_BLND 0x01 731 #define IOC_INTF_BLND 0x01 732 #define IOC_ANTENNA 0x01 733 734 /* RDS Control */ 735 #define RDS_ON 0x01 736 #define RDS_BUF_SZ 100 737 738 /* constants */ 739 #define RDS_BLOCKS_NUM (4) 740 #define BYTES_PER_BLOCK (3) 741 #define MAX_PS_LENGTH (108) 742 #define MAX_RT_LENGTH (64) 743 #define RDS_GRP_CNTR_LEN (36) 744 #define RX_RT_DATA_LENGTH (63) 745 /* Search direction */ 746 #define SRCH_DIR_UP (0) 747 #define SRCH_DIR_DOWN (1) 748 749 /*Search RDS stations*/ 750 #define SEARCH_RDS_STNS_MODE_OFFSET 4 751 752 /*Search Station list */ 753 #define PARAMS_PER_STATION 0x08 754 #define STN_NUM_OFFSET 0x01 755 #define STN_FREQ_OFFSET 0x02 756 #define KHZ_TO_MHZ 1000 757 #define GET_MSB(x)((x >> 8) & 0xFF) 758 #define GET_LSB(x)((x) & 0xFF) 759 760 /* control options */ 761 #define CTRL_ON (1) 762 #define CTRL_OFF (0) 763 764 /*Diagnostic commands*/ 765 766 #define RIVA_PEEK_OPCODE 0x0D 767 #define RIVA_POKE_OPCODE 0x0C 768 769 #define PEEK_DATA_OFSET 0x1 770 #define RIVA_PEEK_PARAM 0x6 771 #define RIVA_PEEK_LEN_OFSET 0x6 772 #define SSBI_PEEK_LEN 0x01 773 /*Calibration data*/ 774 #define PROCS_CALIB_MODE 1 775 #define PROCS_CALIB_SIZE 23 776 #define DC_CALIB_MODE 2 777 #define DC_CALIB_SIZE 48 778 #define RSB_CALIB_MODE 3 779 #define RSB_CALIB_SIZE 4 780 #define CALIB_DATA_OFSET 2 781 #define CALIB_MODE_OFSET 1 782 #define MAX_CALIB_SIZE 75 783 784 /* Channel validity */ 785 #define INVALID_CHANNEL (0) 786 #define VALID_CHANNEL (1) 787 788 struct hci_fm_set_cal_req_proc { 789 __u8 mode; 790 /*Max process calibration data size*/ 791 __u8 data[PROCS_CALIB_SIZE]; 792 } __attribute__((packed)); 793 794 struct hci_fm_set_cal_req_dc { 795 __u8 mode; 796 /*Max DC calibration data size*/ 797 __u8 data[DC_CALIB_SIZE]; 798 } __attribute__((packed)); 799 800 struct hci_cc_do_calibration_rsp { 801 __u8 status; 802 __u8 mode; 803 __u8 data[MAX_CALIB_SIZE]; 804 } __attribute__((packed)); 805 806 struct hci_fm_set_spur_table_req { 807 __u8 mode; 808 __u8 no_of_freqs_entries; 809 __u8 spur_data[FM_SPUR_TBL_SIZE]; 810 } __attribute__((packed)); 811 /* Low Power mode*/ 812 #define SIG_LEVEL_INTR (1 << 0) 813 #define RDS_SYNC_INTR (1 << 1) 814 #define AUDIO_CTRL_INTR (1 << 2) 815 #define AF_JUMP_ENABLE (1 << 4) 816 817 #endif 818