Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1 | /* |
| 2 | * |
| 3 | * Copyright (c) 2011 Code Aurora Forum. All rights reserved. |
| 4 | * |
| 5 | * This file is based on include/net/bluetooth/hci_core.h |
| 6 | * |
| 7 | * Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com> |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License version 2 as |
| 11 | * published by the Free Software Foundation; |
| 12 | * |
| 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 14 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. |
| 16 | * IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY |
| 17 | * CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES |
| 18 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
| 19 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 20 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 21 | * |
| 22 | * ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, |
| 23 | * COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS |
| 24 | * SOFTWARE IS DISCLAIMED. |
| 25 | */ |
| 26 | |
| 27 | #ifndef __RADIO_HCI_CORE_H |
| 28 | #define __RADIO_HCI_CORE_H |
| 29 | |
| 30 | #include <linux/skbuff.h> |
| 31 | #include <linux/interrupt.h> |
| 32 | #include <linux/mutex.h> |
| 33 | #include <linux/atomic.h> |
| 34 | |
| 35 | /* ---- HCI Packet structures ---- */ |
| 36 | #define RADIO_HCI_COMMAND_HDR_SIZE sizeof(struct radio_hci_command_hdr) |
| 37 | #define RADIO_HCI_EVENT_HDR_SIZE sizeof(struct radio_hci_event_hdr) |
| 38 | |
| 39 | /* HCI data types */ |
| 40 | #define RADIO_HCI_COMMAND_PKT 0x11 |
| 41 | #define RADIO_HCI_EVENT_PKT 0x14 |
Srinivasa Rao Uppala | abc8efa | 2011-08-02 14:31:30 -0700 | [diff] [blame] | 42 | /*HCI reponce packets*/ |
| 43 | #define MAX_RIVA_PEEK_RSP_SIZE 251 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 44 | |
| 45 | /* HCI timeouts */ |
| 46 | #define RADIO_HCI_TIMEOUT (10000) /* 10 seconds */ |
| 47 | |
| 48 | #define TUNE_PARAM 16 |
| 49 | struct radio_hci_command_hdr { |
| 50 | __le16 opcode; /* OCF & OGF */ |
| 51 | __u8 plen; |
| 52 | } __packed; |
| 53 | |
| 54 | struct radio_hci_event_hdr { |
| 55 | __u8 evt; |
| 56 | __u8 plen; |
| 57 | } __packed; |
| 58 | |
| 59 | struct radio_hci_dev { |
| 60 | char name[8]; |
| 61 | unsigned long flags; |
| 62 | __u16 id; |
| 63 | __u8 bus; |
| 64 | __u8 dev_type; |
| 65 | __u8 dev_name[248]; |
| 66 | __u8 dev_class[3]; |
| 67 | __u8 features[8]; |
| 68 | __u8 commands[64]; |
| 69 | |
| 70 | unsigned int data_block_len; |
| 71 | unsigned long cmd_last_tx; |
| 72 | |
| 73 | struct sk_buff *sent_cmd; |
| 74 | |
| 75 | __u32 req_status; |
| 76 | __u32 req_result; |
| 77 | atomic_t cmd_cnt; |
| 78 | |
| 79 | struct tasklet_struct cmd_task; |
| 80 | struct tasklet_struct rx_task; |
| 81 | struct tasklet_struct tx_task; |
| 82 | |
| 83 | struct sk_buff_head rx_q; |
| 84 | struct sk_buff_head raw_q; |
| 85 | struct sk_buff_head cmd_q; |
| 86 | |
| 87 | struct mutex req_lock; |
| 88 | wait_queue_head_t req_wait_q; |
| 89 | |
| 90 | int (*open)(struct radio_hci_dev *hdev); |
| 91 | int (*close)(struct radio_hci_dev *hdev); |
| 92 | int (*flush)(struct radio_hci_dev *hdev); |
| 93 | int (*send)(struct sk_buff *skb); |
| 94 | void (*destruct)(struct radio_hci_dev *hdev); |
| 95 | void (*notify)(struct radio_hci_dev *hdev, unsigned int evt); |
| 96 | }; |
| 97 | |
| 98 | int radio_hci_register_dev(struct radio_hci_dev *hdev); |
| 99 | int radio_hci_unregister_dev(struct radio_hci_dev *hdev); |
| 100 | int radio_hci_recv_frame(struct sk_buff *skb); |
| 101 | int radio_hci_send_cmd(struct radio_hci_dev *hdev, __u16 opcode, __u32 plen, |
| 102 | void *param); |
| 103 | void radio_hci_event_packet(struct radio_hci_dev *hdev, struct sk_buff *skb); |
| 104 | |
| 105 | /* Opcode OCF */ |
| 106 | /* HCI recv control commands opcode */ |
| 107 | #define HCI_OCF_FM_ENABLE_RECV_REQ 0x0001 |
| 108 | #define HCI_OCF_FM_DISABLE_RECV_REQ 0x0002 |
| 109 | #define HCI_OCF_FM_GET_RECV_CONF_REQ 0x0003 |
| 110 | #define HCI_OCF_FM_SET_RECV_CONF_REQ 0x0004 |
| 111 | #define HCI_OCF_FM_SET_MUTE_MODE_REQ 0x0005 |
| 112 | #define HCI_OCF_FM_SET_STEREO_MODE_REQ 0x0006 |
| 113 | #define HCI_OCF_FM_SET_ANTENNA 0x0007 |
| 114 | #define HCI_OCF_FM_SET_SIGNAL_THRESHOLD 0x0008 |
| 115 | #define HCI_OCF_FM_GET_SIGNAL_THRESHOLD 0x0009 |
| 116 | #define HCI_OCF_FM_GET_STATION_PARAM_REQ 0x000A |
| 117 | #define HCI_OCF_FM_GET_PROGRAM_SERVICE_REQ 0x000B |
| 118 | #define HCI_OCF_FM_GET_RADIO_TEXT_REQ 0x000C |
| 119 | #define HCI_OCF_FM_GET_AF_LIST_REQ 0x000D |
| 120 | #define HCI_OCF_FM_SEARCH_STATIONS 0x000E |
| 121 | #define HCI_OCF_FM_SEARCH_RDS_STATIONS 0x000F |
| 122 | #define HCI_OCF_FM_SEARCH_STATIONS_LIST 0x0010 |
| 123 | #define HCI_OCF_FM_CANCEL_SEARCH 0x0011 |
| 124 | #define HCI_OCF_FM_RDS_GRP 0x0012 |
| 125 | #define HCI_OCF_FM_RDS_GRP_PROCESS 0x0013 |
| 126 | #define HCI_OCF_FM_EN_WAN_AVD_CTRL 0x0014 |
| 127 | #define HCI_OCF_FM_EN_NOTCH_CTRL 0x0015 |
| 128 | |
| 129 | /* HCI common control commands opcode */ |
| 130 | #define HCI_OCF_FM_TUNE_STATION_REQ 0x0001 |
| 131 | #define HCI_OCF_FM_DEFAULT_DATA_READ 0x0002 |
| 132 | #define HCI_OCF_FM_DEFAULT_DATA_WRITE 0x0003 |
| 133 | #define HCI_OCF_FM_RESET 0x0004 |
| 134 | #define HCI_OCF_FM_GET_FEATURE_LIST 0x0005 |
| 135 | #define HCI_OCF_FM_DO_CALIBRATION 0x0006 |
| 136 | |
| 137 | /*HCI Status parameters commands*/ |
| 138 | #define HCI_OCF_FM_READ_GRP_COUNTERS 0x0001 |
| 139 | |
| 140 | /*HCI Diagnostic commands*/ |
| 141 | #define HCI_OCF_FM_PEEK_DATA 0x0002 |
| 142 | #define HCI_OCF_FM_POKE_DATA 0x0003 |
| 143 | #define HCI_OCF_FM_SSBI_PEEK_REG 0x0004 |
| 144 | #define HCI_OCF_FM_SSBI_POKE_REG 0x0005 |
| 145 | #define HCI_OCF_FM_STATION_DBG_PARAM 0x0007 |
| 146 | |
| 147 | /* Opcode OGF */ |
| 148 | #define HCI_OGF_FM_RECV_CTRL_CMD_REQ 0x0013 |
| 149 | #define HCI_OGF_FM_COMMON_CTRL_CMD_REQ 0x0015 |
| 150 | #define HCI_OGF_FM_STATUS_PARAMETERS_CMD_REQ 0x0016 |
| 151 | #define HCI_OGF_FM_TEST_CMD_REQ 0x0017 |
| 152 | #define HCI_OGF_FM_DIAGNOSTIC_CMD_REQ 0x003F |
| 153 | |
| 154 | /* Command opcode pack/unpack */ |
| 155 | #define hci_opcode_pack(ogf, ocf) (__u16) ((ocf & 0x03ff)|(ogf << 10)) |
| 156 | #define hci_opcode_ogf(op) (op >> 10) |
| 157 | #define hci_opcode_ocf(op) (op & 0x03ff) |
| 158 | #define hci_recv_ctrl_cmd_op_pack(ocf) \ |
| 159 | (__u16) hci_opcode_pack(HCI_OGF_FM_RECV_CTRL_CMD_REQ, ocf) |
| 160 | #define hci_common_cmd_op_pack(ocf) \ |
| 161 | (__u16) hci_opcode_pack(HCI_OGF_FM_COMMON_CTRL_CMD_REQ, ocf) |
| 162 | #define hci_status_param_op_pack(ocf) \ |
| 163 | (__u16) hci_opcode_pack(HCI_OGF_FM_STATUS_PARAMETERS_CMD_REQ, ocf) |
| 164 | #define hci_diagnostic_cmd_op_pack(ocf) \ |
| 165 | (__u16) hci_opcode_pack(HCI_OGF_FM_DIAGNOSTIC_CMD_REQ, ocf) |
| 166 | |
| 167 | |
| 168 | /* HCI commands with no arguments*/ |
| 169 | #define HCI_FM_ENABLE_RECV_CMD 1 |
| 170 | #define HCI_FM_DISABLE_RECV_CMD 2 |
| 171 | #define HCI_FM_GET_RECV_CONF_CMD 3 |
| 172 | #define HCI_FM_GET_STATION_PARAM_CMD 4 |
| 173 | #define HCI_FM_GET_SIGNAL_TH_CMD 5 |
| 174 | #define HCI_FM_GET_PROGRAM_SERVICE_CMD 6 |
| 175 | #define HCI_FM_GET_RADIO_TEXT_CMD 7 |
| 176 | #define HCI_FM_GET_AF_LIST_CMD 8 |
| 177 | #define HCI_FM_CANCEL_SEARCH_CMD 9 |
| 178 | #define HCI_FM_RESET_CMD 10 |
| 179 | #define HCI_FM_GET_FEATURES_CMD 11 |
| 180 | #define HCI_FM_STATION_DBG_PARAM_CMD 12 |
| 181 | |
| 182 | /* ----- HCI Command request ----- */ |
| 183 | struct hci_fm_recv_conf_req { |
| 184 | __u8 emphasis; |
| 185 | __u8 ch_spacing; |
| 186 | __u8 rds_std; |
| 187 | __u8 hlsi; |
| 188 | __u32 band_low_limit; |
| 189 | __u32 band_high_limit; |
| 190 | } __packed; |
| 191 | |
| 192 | struct hci_fm_mute_mode_req { |
| 193 | __u8 hard_mute; |
| 194 | __u8 soft_mute; |
| 195 | } __packed; |
| 196 | |
| 197 | struct hci_fm_stereo_mode_req { |
| 198 | __u8 stereo_mode; |
| 199 | __u8 sig_blend; |
| 200 | __u8 intf_blend; |
| 201 | __u8 most_switch; |
| 202 | } __packed; |
| 203 | |
| 204 | struct hci_fm_search_station_req { |
| 205 | __u8 srch_mode; |
| 206 | __u8 scan_time; |
| 207 | __u8 srch_dir; |
| 208 | } __packed; |
| 209 | |
| 210 | struct hci_fm_search_rds_station_req { |
| 211 | struct hci_fm_search_station_req srch_station; |
| 212 | __u8 srch_pty; |
| 213 | __u16 srch_pi; |
| 214 | } __packed; |
| 215 | |
| 216 | struct hci_fm_search_station_list_req { |
| 217 | __u8 srch_list_mode; |
| 218 | __u8 srch_list_dir; |
| 219 | __u32 srch_list_max; |
| 220 | __u8 srch_pty; |
| 221 | } __packed; |
| 222 | |
| 223 | struct hci_fm_rds_grp_req { |
| 224 | __u32 rds_grp_enable_mask; |
| 225 | __u32 rds_buf_size; |
| 226 | __u8 en_rds_change_filter; |
| 227 | } __packed; |
| 228 | |
| 229 | struct hci_fm_en_avd_ctrl_req { |
| 230 | __u8 no_freqs; |
| 231 | __u8 freq_index; |
| 232 | __u8 lo_shft; |
| 233 | __u16 freq_min; |
| 234 | __u16 freq_max; |
| 235 | } __packed; |
| 236 | |
| 237 | struct hci_fm_def_data_rd_req { |
| 238 | __u8 mode; |
| 239 | __u8 length; |
| 240 | } __packed; |
| 241 | |
| 242 | struct hci_fm_def_data_wr_req { |
| 243 | struct hci_fm_def_data_rd_req data_rd; |
Srinivasa Rao Uppala | abc8efa | 2011-08-02 14:31:30 -0700 | [diff] [blame] | 244 | __u8 data[256]; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 245 | } __packed; |
| 246 | |
Srinivasa Rao Uppala | abc8efa | 2011-08-02 14:31:30 -0700 | [diff] [blame] | 247 | struct hci_fm_riva_data { |
| 248 | __u8 subopcode; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 249 | __u32 start_addr; |
| 250 | __u8 length; |
| 251 | } __packed; |
| 252 | |
Srinivasa Rao Uppala | abc8efa | 2011-08-02 14:31:30 -0700 | [diff] [blame] | 253 | struct hci_fm_riva_poke { |
| 254 | struct hci_fm_riva_data cmd_params; |
| 255 | __u8 data[MAX_RIVA_PEEK_RSP_SIZE]; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 256 | } __packed; |
| 257 | |
| 258 | struct hci_fm_ssbi_req { |
| 259 | __u16 start_addr; |
| 260 | __u8 data; |
| 261 | } __packed; |
Srinivasa Rao Uppala | abc8efa | 2011-08-02 14:31:30 -0700 | [diff] [blame] | 262 | struct hci_fm_ssbi_peek { |
| 263 | __u16 start_address; |
| 264 | } __packed; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 265 | |
| 266 | /*HCI events*/ |
| 267 | #define HCI_EV_TUNE_STATUS 0x01 |
| 268 | #define HCI_EV_RDS_LOCK_STATUS 0x02 |
| 269 | #define HCI_EV_STEREO_STATUS 0x03 |
| 270 | #define HCI_EV_SERVICE_AVAILABLE 0x04 |
| 271 | #define HCI_EV_SEARCH_PROGRESS 0x05 |
| 272 | #define HCI_EV_SEARCH_RDS_PROGRESS 0x06 |
| 273 | #define HCI_EV_SEARCH_LIST_PROGRESS 0x07 |
| 274 | #define HCI_EV_RDS_RX_DATA 0x08 |
| 275 | #define HCI_EV_PROGRAM_SERVICE 0x09 |
| 276 | #define HCI_EV_RADIO_TEXT 0x0A |
| 277 | #define HCI_EV_FM_AF_LIST 0x0B |
| 278 | #define HCI_EV_TX_RDS_GRP_AVBLE 0x0C |
| 279 | #define HCI_EV_TX_RDS_GRP_COMPL 0x0D |
| 280 | #define HCI_EV_TX_RDS_CONT_GRP_COMPL 0x0E |
| 281 | #define HCI_EV_CMD_COMPLETE 0x0F |
| 282 | #define HCI_EV_CMD_STATUS 0x10 |
| 283 | #define HCI_EV_TUNE_COMPLETE 0x11 |
| 284 | #define HCI_EV_SEARCH_COMPLETE 0x12 |
| 285 | #define HCI_EV_SEARCH_RDS_COMPLETE 0x13 |
| 286 | #define HCI_EV_SEARCH_LIST_COMPLETE 0x14 |
| 287 | |
| 288 | #define HCI_REQ_DONE 0 |
| 289 | #define HCI_REQ_PEND 1 |
| 290 | #define HCI_REQ_CANCELED 2 |
| 291 | #define HCI_REQ_STATUS 3 |
| 292 | |
| 293 | struct hci_ev_tune_status { |
| 294 | __u8 sub_event; |
| 295 | __le32 station_freq; |
| 296 | __u8 serv_avble; |
| 297 | __u8 rssi; |
| 298 | __u8 stereo_prg; |
| 299 | __u8 rds_sync_status; |
| 300 | __u8 mute_mode; |
| 301 | } __packed; |
| 302 | |
| 303 | struct hci_ev_rds_rx_data { |
| 304 | __u8 num_rds_grps; |
| 305 | __u8 rds_grp_data[12]; |
| 306 | } __packed; |
| 307 | |
| 308 | struct hci_ev_prg_service { |
| 309 | __le16 pi_prg_id; |
| 310 | __u8 pty_prg_type; |
| 311 | __u8 ta_prg_code_type; |
| 312 | __u8 ta_ann_code_flag; |
| 313 | __u8 ms_switch_code_flag; |
| 314 | __u8 dec_id_ctrl_code_flag; |
| 315 | __u8 ps_num; |
| 316 | __u8 prg_service_name[119]; |
| 317 | } __packed; |
| 318 | |
| 319 | struct hci_ev_radio_text { |
| 320 | __le16 pi_prg_id; |
| 321 | __u8 pty_prg_type; |
| 322 | __u8 ta_prg_code_type; |
| 323 | __u8 txt_ab_flag; |
| 324 | __u8 radio_txt[64]; |
| 325 | } __packed; |
| 326 | |
| 327 | struct hci_ev_af_list { |
| 328 | __le32 tune_freq; |
| 329 | __le16 pi_code; |
| 330 | __u8 af_size; |
| 331 | __u8 af_list[25]; |
| 332 | } __packed; |
| 333 | |
| 334 | struct hci_ev_cmd_complete { |
| 335 | __u8 num_hci_cmd_pkts; |
| 336 | __le16 cmd_opcode; |
| 337 | } __packed; |
| 338 | |
| 339 | struct hci_ev_cmd_status { |
| 340 | __u8 status; |
| 341 | __u8 num_hci_cmd_pkts; |
| 342 | __le16 status_opcode; |
| 343 | } __packed; |
| 344 | |
| 345 | struct hci_ev_srch_st { |
| 346 | __le32 station_freq; |
| 347 | __u8 rds_cap; |
| 348 | __u8 pty; |
| 349 | __le16 status_opcode; |
| 350 | } __packed; |
| 351 | |
Srinivasa Rao Uppala | 18fb80e | 2011-07-17 17:33:00 -0700 | [diff] [blame] | 352 | struct hci_ev_rel_freq { |
| 353 | __u8 rel_freq_msb; |
| 354 | __u8 rel_freq_lsb; |
| 355 | |
| 356 | } __packed; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 357 | struct hci_ev_srch_list_compl { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 358 | __u8 num_stations_found; |
Srinivasa Rao Uppala | 18fb80e | 2011-07-17 17:33:00 -0700 | [diff] [blame] | 359 | struct hci_ev_rel_freq rel_freq[20]; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 360 | } __packed; |
| 361 | |
| 362 | /* ----- HCI Event Response ----- */ |
| 363 | struct hci_fm_conf_rsp { |
| 364 | __u8 status; |
| 365 | struct hci_fm_recv_conf_req recv_conf_rsp; |
| 366 | } __packed; |
| 367 | |
| 368 | struct hci_fm_sig_threshold_rsp { |
| 369 | __u8 status; |
| 370 | __u8 sig_threshold; |
| 371 | } __packed; |
| 372 | |
| 373 | struct hci_fm_station_rsp { |
| 374 | struct hci_ev_tune_status station_rsp; |
| 375 | } __packed; |
| 376 | |
| 377 | struct hci_fm_prgm_srv_rsp { |
| 378 | __u8 status; |
| 379 | struct hci_ev_prg_service prg_srv; |
| 380 | } __packed; |
| 381 | |
| 382 | struct hci_fm_radio_txt_rsp { |
| 383 | __u8 status; |
| 384 | struct hci_ev_radio_text rd_txt; |
| 385 | } __packed; |
| 386 | |
| 387 | struct hci_fm_af_list_rsp { |
| 388 | __u8 status; |
| 389 | struct hci_ev_af_list rd_txt; |
| 390 | } __packed; |
| 391 | |
| 392 | struct hci_fm_data_rd_rsp { |
| 393 | __u8 status; |
| 394 | __u8 ret_data_len; |
| 395 | __u8 data[256]; |
| 396 | } __packed; |
| 397 | |
| 398 | struct hci_fm_feature_list_rsp { |
| 399 | __u8 status; |
| 400 | __u8 feature_mask; |
| 401 | } __packed; |
| 402 | |
| 403 | struct hci_fm_dbg_param_rsp { |
| 404 | __u8 status; |
| 405 | __u8 blend; |
| 406 | __u8 soft_mute; |
| 407 | __u8 inf_blend; |
| 408 | __u8 inf_soft_mute; |
| 409 | __u8 pilot_pil; |
| 410 | __u8 io_verc; |
| 411 | __u8 in_det_out; |
| 412 | } __packed; |
| 413 | |
| 414 | /* HCI dev events */ |
| 415 | #define RADIO_HCI_DEV_REG 1 |
| 416 | #define RADIO_HCI_DEV_WRITE 2 |
| 417 | |
| 418 | #define hci_req_lock(d) mutex_lock(&d->req_lock) |
| 419 | #define hci_req_unlock(d) mutex_unlock(&d->req_lock) |
| 420 | |
Ankur Nandwani | 78a782b | 2011-07-07 21:11:21 -0700 | [diff] [blame] | 421 | /* FM RDS */ |
Ankur Nandwani | 4246251 | 2011-07-15 17:08:24 -0700 | [diff] [blame] | 422 | #define RDS_PTYPE 2 |
| 423 | #define RDS_PID_LOWER 1 |
| 424 | #define RDS_PID_HIGHER 0 |
Ankur Nandwani | 78a782b | 2011-07-07 21:11:21 -0700 | [diff] [blame] | 425 | #define RDS_OFFSET 5 |
| 426 | #define RDS_PS_LENGTH_OFFSET 7 |
| 427 | #define RDS_STRING 8 |
| 428 | #define RDS_PS_DATA_OFFSET 8 |
Srinivasa Rao Uppala | 58273f8 | 2011-08-10 19:07:45 -0700 | [diff] [blame^] | 429 | #define RDS_CONFIG_OFFSET 3 |
Ankur Nandwani | 78a782b | 2011-07-07 21:11:21 -0700 | [diff] [blame] | 430 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 431 | /*FM states*/ |
| 432 | |
| 433 | enum radio_state_t { |
| 434 | FM_OFF, |
| 435 | FM_RECV, |
| 436 | FM_TRANS, |
| 437 | FM_RESET, |
| 438 | }; |
| 439 | |
| 440 | enum v4l2_cid_private_iris_t { |
| 441 | V4L2_CID_PRIVATE_IRIS_SRCHMODE = (0x08000000 + 1), |
| 442 | V4L2_CID_PRIVATE_IRIS_SCANDWELL, |
| 443 | V4L2_CID_PRIVATE_IRIS_SRCHON, |
| 444 | V4L2_CID_PRIVATE_IRIS_STATE, |
| 445 | V4L2_CID_PRIVATE_IRIS_TRANSMIT_MODE, |
| 446 | V4L2_CID_PRIVATE_IRIS_RDSGROUP_MASK, |
| 447 | V4L2_CID_PRIVATE_IRIS_REGION, |
| 448 | V4L2_CID_PRIVATE_IRIS_SIGNAL_TH, |
| 449 | V4L2_CID_PRIVATE_IRIS_SRCH_PTY, |
| 450 | V4L2_CID_PRIVATE_IRIS_SRCH_PI, |
| 451 | V4L2_CID_PRIVATE_IRIS_SRCH_CNT, |
| 452 | V4L2_CID_PRIVATE_IRIS_EMPHASIS, |
| 453 | V4L2_CID_PRIVATE_IRIS_RDS_STD, |
| 454 | V4L2_CID_PRIVATE_IRIS_SPACING, |
| 455 | V4L2_CID_PRIVATE_IRIS_RDSON, |
| 456 | V4L2_CID_PRIVATE_IRIS_RDSGROUP_PROC, |
| 457 | V4L2_CID_PRIVATE_IRIS_LP_MODE, |
| 458 | V4L2_CID_PRIVATE_IRIS_ANTENNA, |
| 459 | V4L2_CID_PRIVATE_IRIS_RDSD_BUF, |
| 460 | V4L2_CID_PRIVATE_IRIS_PSALL, |
Srinivasa Rao Uppala | abc8efa | 2011-08-02 14:31:30 -0700 | [diff] [blame] | 461 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 462 | /*v4l2 Tx controls*/ |
| 463 | V4L2_CID_PRIVATE_IRIS_TX_SETPSREPEATCOUNT, |
| 464 | V4L2_CID_PRIVATE_IRIS_STOP_RDS_TX_PS_NAME, |
| 465 | V4L2_CID_PRIVATE_IRIS_STOP_RDS_TX_RT, |
| 466 | V4L2_CID_PRIVATE_IRIS_IOVERC, |
| 467 | V4L2_CID_PRIVATE_IRIS_INTDET, |
Srinivasa Rao Uppala | abc8efa | 2011-08-02 14:31:30 -0700 | [diff] [blame] | 468 | |
| 469 | /*Diagnostic commands*/ |
| 470 | V4L2_CID_PRIVATE_IRIS_SOFT_MUTE, |
| 471 | V4L2_CID_PRIVATE_IRIS_RIVA_ACCS_ADDR, |
| 472 | V4L2_CID_PRIVATE_IRIS_RIVA_ACCS_LEN, |
| 473 | V4L2_CID_PRIVATE_IRIS_RIVA_PEEK, |
| 474 | V4L2_CID_PRIVATE_IRIS_RIVA_POKE, |
| 475 | V4L2_CID_PRIVATE_IRIS_SSBI_ACCS_ADDR, |
| 476 | V4L2_CID_PRIVATE_IRIS_SSBI_PEEK, |
| 477 | V4L2_CID_PRIVATE_IRIS_SSBI_POKE, |
| 478 | V4L2_CID_PRIVATE_IRIS_HLSI, |
| 479 | VL2_CID_PRIVATE_IRIS_TX_TONE, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 480 | }; |
| 481 | |
| 482 | enum iris_evt_t { |
| 483 | IRIS_EVT_RADIO_READY, |
| 484 | IRIS_EVT_TUNE_SUCC, |
| 485 | IRIS_EVT_SEEK_COMPLETE, |
| 486 | IRIS_EVT_SCAN_NEXT, |
| 487 | IRIS_EVT_NEW_RAW_RDS, |
| 488 | IRIS_EVT_NEW_RT_RDS, |
| 489 | IRIS_EVT_NEW_PS_RDS, |
| 490 | IRIS_EVT_ERROR, |
| 491 | IRIS_EVT_BELOW_TH, |
| 492 | IRIS_EVT_ABOVE_TH, |
| 493 | IRIS_EVT_STEREO, |
| 494 | IRIS_EVT_MONO, |
| 495 | IRIS_EVT_RDS_AVAIL, |
| 496 | IRIS_EVT_RDS_NOT_AVAIL, |
| 497 | IRIS_EVT_NEW_SRCH_LIST, |
| 498 | IRIS_EVT_NEW_AF_LIST, |
| 499 | IRIS_EVT_TXRDSDAT, |
| 500 | IRIS_EVT_TXRDSDONE |
| 501 | }; |
| 502 | |
| 503 | enum iris_region_t { |
| 504 | IRIS_REGION_US, |
| 505 | IRIS_REGION_EU, |
| 506 | IRIS_REGION_JAPAN, |
| 507 | IRIS_REGION_JAPAN_WIDE, |
| 508 | IRIS_REGION_OTHER |
| 509 | }; |
| 510 | |
| 511 | #define STD_BUF_SIZE (64) |
| 512 | |
| 513 | enum iris_buf_t { |
| 514 | IRIS_BUF_SRCH_LIST, |
| 515 | IRIS_BUF_EVENTS, |
| 516 | IRIS_BUF_RT_RDS, |
| 517 | IRIS_BUF_PS_RDS, |
| 518 | IRIS_BUF_RAW_RDS, |
| 519 | IRIS_BUF_AF_LIST, |
Srinivasa Rao Uppala | abc8efa | 2011-08-02 14:31:30 -0700 | [diff] [blame] | 520 | IRIS_BUF_PEEK, |
| 521 | IRIS_BUF_SSBI_PEEK, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 522 | IRIS_BUF_MAX |
| 523 | }; |
| 524 | |
| 525 | enum iris_xfr_t { |
| 526 | IRIS_XFR_SYNC, |
| 527 | IRIS_XFR_ERROR, |
| 528 | IRIS_XFR_SRCH_LIST, |
| 529 | IRIS_XFR_RT_RDS, |
| 530 | IRIS_XFR_PS_RDS, |
| 531 | IRIS_XFR_AF_LIST, |
| 532 | IRIS_XFR_MAX |
| 533 | }; |
| 534 | |
| 535 | #undef FMDBG |
| 536 | #ifdef FM_DEBUG |
| 537 | #define FMDBG(fmt, args...) pr_info("iris_radio: " fmt, ##args) |
| 538 | #else |
| 539 | #define FMDBG(fmt, args...) |
| 540 | #endif |
| 541 | |
| 542 | #undef FMDERR |
| 543 | #define FMDERR(fmt, args...) pr_err("iris_radio: " fmt, ##args) |
| 544 | |
| 545 | /* Search options */ |
| 546 | enum search_t { |
| 547 | SEEK, |
| 548 | SCAN, |
| 549 | SCAN_FOR_STRONG, |
| 550 | SCAN_FOR_WEAK, |
| 551 | RDS_SEEK_PTY, |
| 552 | RDS_SCAN_PTY, |
| 553 | RDS_SEEK_PI, |
| 554 | RDS_AF_JUMP, |
| 555 | }; |
| 556 | |
| 557 | #define SRCH_MODE 0x07 |
| 558 | #define SRCH_DIR 0x08 /* 0-up 1-down */ |
| 559 | #define SCAN_DWELL 0x70 |
| 560 | #define SRCH_ON 0x80 |
| 561 | |
| 562 | /* I/O Control */ |
| 563 | #define IOC_HRD_MUTE 0x03 |
| 564 | #define IOC_SFT_MUTE 0x01 |
| 565 | #define IOC_MON_STR 0x01 |
| 566 | #define IOC_SIG_BLND 0x01 |
| 567 | #define IOC_INTF_BLND 0x01 |
| 568 | #define IOC_ANTENNA 0x01 |
| 569 | |
| 570 | /* RDS Control */ |
| 571 | #define RDS_ON 0x01 |
| 572 | #define RDS_BUF_SZ 100 |
| 573 | |
| 574 | /* Search direction */ |
| 575 | #define SRCH_DIR_UP (0) |
| 576 | #define SRCH_DIR_DOWN (1) |
| 577 | |
Srinivasa Rao Uppala | 7bb2210 | 2011-07-14 11:27:30 -0700 | [diff] [blame] | 578 | /*Search RDS stations*/ |
| 579 | #define SEARCH_RDS_STNS_MODE_OFFSET 4 |
Srinivasa Rao Uppala | 18fb80e | 2011-07-17 17:33:00 -0700 | [diff] [blame] | 580 | |
| 581 | /*Search Station list */ |
Srinivasa Rao Uppala | 4b92e4b | 2011-08-09 15:46:25 -0700 | [diff] [blame] | 582 | #define PARAMS_PER_STATION 0x08 |
Srinivasa Rao Uppala | 18fb80e | 2011-07-17 17:33:00 -0700 | [diff] [blame] | 583 | #define STN_NUM_OFFSET 0x01 |
| 584 | #define STN_FREQ_OFFSET 0x02 |
| 585 | #define KHZ_TO_MHZ 1000 |
| 586 | #define GET_MSB(x)((x >> 8) & 0xFF) |
| 587 | #define GET_LSB(x)((x) & 0xFF) |
| 588 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 589 | /* control options */ |
| 590 | #define CTRL_ON (1) |
| 591 | #define CTRL_OFF (0) |
| 592 | |
Srinivasa Rao Uppala | abc8efa | 2011-08-02 14:31:30 -0700 | [diff] [blame] | 593 | /*Diagnostic commands*/ |
| 594 | |
| 595 | #define RIVA_PEEK_OPCODE 0x0D |
| 596 | #define RIVA_POKE_OPCODE 0x0C |
| 597 | |
| 598 | #define PEEK_DATA_OFSET 0x1 |
| 599 | #define RIVA_PEEK_PARAM 0x6 |
| 600 | #define RIVA_PEEK_LEN_OFSET 0x6 |
| 601 | #define SSBI_PEEK_LEN 0x01 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 602 | int hci_def_data_read(struct hci_fm_def_data_rd_req *arg, |
| 603 | struct radio_hci_dev *hdev); |
| 604 | int hci_def_data_write(struct hci_fm_def_data_wr_req *arg, |
| 605 | struct radio_hci_dev *hdev); |
| 606 | int hci_fm_do_calibration(__u8 *arg, struct radio_hci_dev *hdev); |
| 607 | int hci_fm_do_calibration(__u8 *arg, struct radio_hci_dev *hdev); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 608 | |
| 609 | #endif /* __RADIO_HCI_CORE_H */ |