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