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