Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1 | /* |
| 2 | * |
Duy Truong | 790f06d | 2013-02-13 16:38:12 -0800 | [diff] [blame] | 3 | * Copyright (c) 2011-2012 The Linux Foundation. All rights reserved. |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 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 |
Venkateshwarlu Domakonda | 787af69 | 2011-10-14 21:23:03 +0530 | [diff] [blame] | 44 | /* default data access */ |
| 45 | #define DEFAULT_DATA_OFFSET 2 |
| 46 | #define DEFAULT_DATA_SIZE 249 |
Venkateshwarlu Domakonda | 71731d5 | 2012-04-04 12:30:51 +0530 | [diff] [blame] | 47 | /* Power levels are 0-7, but SOC will expect values from 0-255 |
| 48 | * So the each level step size will be 255/7 = 36 */ |
| 49 | #define FM_TX_PWR_LVL_STEP_SIZE 36 |
| 50 | #define FM_TX_PWR_LVL_0 0 /* Lowest power lvl that can be set for Tx */ |
| 51 | #define FM_TX_PWR_LVL_MAX 7 /* Max power lvl for Tx */ |
| 52 | #define FM_TX_PHY_CFG_MODE 0x3c |
| 53 | #define FM_TX_PHY_CFG_LEN 0x10 |
| 54 | #define FM_TX_PWR_GAIN_OFFSET 14 |
Ayaz Ahmad | db04b0c | 2013-02-01 17:18:34 +0530 | [diff] [blame^] | 55 | /**RDS CONFIG MODE**/ |
| 56 | #define FM_RDS_CNFG_MODE 0x0f |
| 57 | #define FM_RDS_CNFG_LEN 0x10 |
| 58 | #define AF_RMSSI_TH_LSB_OFFSET 10 |
| 59 | #define AF_RMSSI_TH_MSB_OFFSET 11 |
| 60 | #define AF_RMSSI_SAMPLES_OFFSET 15 |
| 61 | /**RX CONFIG MODE**/ |
| 62 | #define FM_RX_CONFG_MODE 0x15 |
| 63 | #define FM_RX_CNFG_LEN 0x20 |
| 64 | #define GD_CH_RMSSI_TH_OFFSET 12 |
| 65 | #define MAX_GD_CH_RMSSI_TH 127 |
| 66 | #define SRCH_ALGO_TYPE_OFFSET 25 |
| 67 | #define SINRFIRSTSTAGE_OFFSET 26 |
| 68 | #define RMSSIFIRSTSTAGE_OFFSET 27 |
| 69 | #define CF0TH12_BYTE1_OFFSET 8 |
| 70 | #define CF0TH12_BYTE2_OFFSET 9 |
| 71 | #define CF0TH12_BYTE3_OFFSET 10 |
| 72 | #define CF0TH12_BYTE4_OFFSET 11 |
| 73 | #define MAX_SINR_FIRSTSTAGE 127 |
| 74 | #define MAX_RMSSI_FIRSTSTAGE 127 |
| 75 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 76 | /* HCI timeouts */ |
| 77 | #define RADIO_HCI_TIMEOUT (10000) /* 10 seconds */ |
| 78 | |
| 79 | #define TUNE_PARAM 16 |
| 80 | struct radio_hci_command_hdr { |
| 81 | __le16 opcode; /* OCF & OGF */ |
| 82 | __u8 plen; |
| 83 | } __packed; |
| 84 | |
| 85 | struct radio_hci_event_hdr { |
| 86 | __u8 evt; |
| 87 | __u8 plen; |
| 88 | } __packed; |
| 89 | |
| 90 | struct radio_hci_dev { |
| 91 | char name[8]; |
| 92 | unsigned long flags; |
| 93 | __u16 id; |
| 94 | __u8 bus; |
| 95 | __u8 dev_type; |
| 96 | __u8 dev_name[248]; |
| 97 | __u8 dev_class[3]; |
| 98 | __u8 features[8]; |
| 99 | __u8 commands[64]; |
| 100 | |
| 101 | unsigned int data_block_len; |
| 102 | unsigned long cmd_last_tx; |
| 103 | |
| 104 | struct sk_buff *sent_cmd; |
| 105 | |
| 106 | __u32 req_status; |
| 107 | __u32 req_result; |
| 108 | atomic_t cmd_cnt; |
| 109 | |
| 110 | struct tasklet_struct cmd_task; |
| 111 | struct tasklet_struct rx_task; |
| 112 | struct tasklet_struct tx_task; |
| 113 | |
| 114 | struct sk_buff_head rx_q; |
| 115 | struct sk_buff_head raw_q; |
| 116 | struct sk_buff_head cmd_q; |
| 117 | |
| 118 | struct mutex req_lock; |
| 119 | wait_queue_head_t req_wait_q; |
| 120 | |
| 121 | int (*open)(struct radio_hci_dev *hdev); |
| 122 | int (*close)(struct radio_hci_dev *hdev); |
| 123 | int (*flush)(struct radio_hci_dev *hdev); |
| 124 | int (*send)(struct sk_buff *skb); |
| 125 | void (*destruct)(struct radio_hci_dev *hdev); |
| 126 | void (*notify)(struct radio_hci_dev *hdev, unsigned int evt); |
| 127 | }; |
| 128 | |
| 129 | int radio_hci_register_dev(struct radio_hci_dev *hdev); |
| 130 | int radio_hci_unregister_dev(struct radio_hci_dev *hdev); |
| 131 | int radio_hci_recv_frame(struct sk_buff *skb); |
| 132 | int radio_hci_send_cmd(struct radio_hci_dev *hdev, __u16 opcode, __u32 plen, |
| 133 | void *param); |
| 134 | void radio_hci_event_packet(struct radio_hci_dev *hdev, struct sk_buff *skb); |
| 135 | |
| 136 | /* Opcode OCF */ |
| 137 | /* HCI recv control commands opcode */ |
| 138 | #define HCI_OCF_FM_ENABLE_RECV_REQ 0x0001 |
| 139 | #define HCI_OCF_FM_DISABLE_RECV_REQ 0x0002 |
| 140 | #define HCI_OCF_FM_GET_RECV_CONF_REQ 0x0003 |
| 141 | #define HCI_OCF_FM_SET_RECV_CONF_REQ 0x0004 |
| 142 | #define HCI_OCF_FM_SET_MUTE_MODE_REQ 0x0005 |
| 143 | #define HCI_OCF_FM_SET_STEREO_MODE_REQ 0x0006 |
| 144 | #define HCI_OCF_FM_SET_ANTENNA 0x0007 |
| 145 | #define HCI_OCF_FM_SET_SIGNAL_THRESHOLD 0x0008 |
| 146 | #define HCI_OCF_FM_GET_SIGNAL_THRESHOLD 0x0009 |
| 147 | #define HCI_OCF_FM_GET_STATION_PARAM_REQ 0x000A |
| 148 | #define HCI_OCF_FM_GET_PROGRAM_SERVICE_REQ 0x000B |
| 149 | #define HCI_OCF_FM_GET_RADIO_TEXT_REQ 0x000C |
| 150 | #define HCI_OCF_FM_GET_AF_LIST_REQ 0x000D |
| 151 | #define HCI_OCF_FM_SEARCH_STATIONS 0x000E |
| 152 | #define HCI_OCF_FM_SEARCH_RDS_STATIONS 0x000F |
| 153 | #define HCI_OCF_FM_SEARCH_STATIONS_LIST 0x0010 |
| 154 | #define HCI_OCF_FM_CANCEL_SEARCH 0x0011 |
| 155 | #define HCI_OCF_FM_RDS_GRP 0x0012 |
| 156 | #define HCI_OCF_FM_RDS_GRP_PROCESS 0x0013 |
| 157 | #define HCI_OCF_FM_EN_WAN_AVD_CTRL 0x0014 |
| 158 | #define HCI_OCF_FM_EN_NOTCH_CTRL 0x0015 |
Srinivasa Rao Uppala | f856ae6 | 2011-10-17 18:43:26 +0530 | [diff] [blame] | 159 | #define HCI_OCF_FM_SET_EVENT_MASK 0x0016 |
Srinivasa Rao Uppala | d3184a4 | 2012-01-04 21:18:01 +0530 | [diff] [blame] | 160 | #define HCI_OCF_FM_SET_CH_DET_THRESHOLD 0x0017 |
| 161 | #define HCI_OCF_FM_GET_CH_DET_THRESHOLD 0x0018 |
Ankur Nandwani | d928d54 | 2011-08-11 13:15:41 -0700 | [diff] [blame] | 162 | /* HCI trans control commans opcode*/ |
| 163 | #define HCI_OCF_FM_ENABLE_TRANS_REQ 0x0001 |
| 164 | #define HCI_OCF_FM_DISABLE_TRANS_REQ 0x0002 |
| 165 | #define HCI_OCF_FM_GET_TRANS_CONF_REQ 0x0003 |
| 166 | #define HCI_OCF_FM_SET_TRANS_CONF_REQ 0x0004 |
| 167 | #define HCI_OCF_FM_RDS_RT_REQ 0x0008 |
| 168 | #define HCI_OCF_FM_RDS_PS_REQ 0x0009 |
| 169 | |
| 170 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 171 | /* HCI common control commands opcode */ |
| 172 | #define HCI_OCF_FM_TUNE_STATION_REQ 0x0001 |
| 173 | #define HCI_OCF_FM_DEFAULT_DATA_READ 0x0002 |
| 174 | #define HCI_OCF_FM_DEFAULT_DATA_WRITE 0x0003 |
| 175 | #define HCI_OCF_FM_RESET 0x0004 |
| 176 | #define HCI_OCF_FM_GET_FEATURE_LIST 0x0005 |
| 177 | #define HCI_OCF_FM_DO_CALIBRATION 0x0006 |
Srinivasa Rao Uppala | cb48ee6 | 2011-10-25 09:57:06 +0530 | [diff] [blame] | 178 | #define HCI_OCF_FM_SET_CALIBRATION 0x0007 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 179 | |
| 180 | /*HCI Status parameters commands*/ |
| 181 | #define HCI_OCF_FM_READ_GRP_COUNTERS 0x0001 |
| 182 | |
| 183 | /*HCI Diagnostic commands*/ |
| 184 | #define HCI_OCF_FM_PEEK_DATA 0x0002 |
| 185 | #define HCI_OCF_FM_POKE_DATA 0x0003 |
| 186 | #define HCI_OCF_FM_SSBI_PEEK_REG 0x0004 |
| 187 | #define HCI_OCF_FM_SSBI_POKE_REG 0x0005 |
| 188 | #define HCI_OCF_FM_STATION_DBG_PARAM 0x0007 |
Ankur Nandwani | d928d54 | 2011-08-11 13:15:41 -0700 | [diff] [blame] | 189 | #define HCI_FM_SET_INTERNAL_TONE_GENRATOR 0x0008 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 190 | |
| 191 | /* Opcode OGF */ |
| 192 | #define HCI_OGF_FM_RECV_CTRL_CMD_REQ 0x0013 |
Ankur Nandwani | d928d54 | 2011-08-11 13:15:41 -0700 | [diff] [blame] | 193 | #define HCI_OGF_FM_TRANS_CTRL_CMD_REQ 0x0014 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 194 | #define HCI_OGF_FM_COMMON_CTRL_CMD_REQ 0x0015 |
| 195 | #define HCI_OGF_FM_STATUS_PARAMETERS_CMD_REQ 0x0016 |
| 196 | #define HCI_OGF_FM_TEST_CMD_REQ 0x0017 |
| 197 | #define HCI_OGF_FM_DIAGNOSTIC_CMD_REQ 0x003F |
| 198 | |
| 199 | /* Command opcode pack/unpack */ |
| 200 | #define hci_opcode_pack(ogf, ocf) (__u16) ((ocf & 0x03ff)|(ogf << 10)) |
| 201 | #define hci_opcode_ogf(op) (op >> 10) |
| 202 | #define hci_opcode_ocf(op) (op & 0x03ff) |
| 203 | #define hci_recv_ctrl_cmd_op_pack(ocf) \ |
| 204 | (__u16) hci_opcode_pack(HCI_OGF_FM_RECV_CTRL_CMD_REQ, ocf) |
Ankur Nandwani | d928d54 | 2011-08-11 13:15:41 -0700 | [diff] [blame] | 205 | #define hci_trans_ctrl_cmd_op_pack(ocf) \ |
| 206 | (__u16) hci_opcode_pack(HCI_OGF_FM_TRANS_CTRL_CMD_REQ, ocf) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 207 | #define hci_common_cmd_op_pack(ocf) \ |
| 208 | (__u16) hci_opcode_pack(HCI_OGF_FM_COMMON_CTRL_CMD_REQ, ocf) |
| 209 | #define hci_status_param_op_pack(ocf) \ |
| 210 | (__u16) hci_opcode_pack(HCI_OGF_FM_STATUS_PARAMETERS_CMD_REQ, ocf) |
| 211 | #define hci_diagnostic_cmd_op_pack(ocf) \ |
| 212 | (__u16) hci_opcode_pack(HCI_OGF_FM_DIAGNOSTIC_CMD_REQ, ocf) |
| 213 | |
| 214 | |
| 215 | /* HCI commands with no arguments*/ |
| 216 | #define HCI_FM_ENABLE_RECV_CMD 1 |
| 217 | #define HCI_FM_DISABLE_RECV_CMD 2 |
| 218 | #define HCI_FM_GET_RECV_CONF_CMD 3 |
| 219 | #define HCI_FM_GET_STATION_PARAM_CMD 4 |
| 220 | #define HCI_FM_GET_SIGNAL_TH_CMD 5 |
| 221 | #define HCI_FM_GET_PROGRAM_SERVICE_CMD 6 |
| 222 | #define HCI_FM_GET_RADIO_TEXT_CMD 7 |
| 223 | #define HCI_FM_GET_AF_LIST_CMD 8 |
| 224 | #define HCI_FM_CANCEL_SEARCH_CMD 9 |
| 225 | #define HCI_FM_RESET_CMD 10 |
| 226 | #define HCI_FM_GET_FEATURES_CMD 11 |
| 227 | #define HCI_FM_STATION_DBG_PARAM_CMD 12 |
Ankur Nandwani | d928d54 | 2011-08-11 13:15:41 -0700 | [diff] [blame] | 228 | #define HCI_FM_ENABLE_TRANS_CMD 13 |
| 229 | #define HCI_FM_DISABLE_TRANS_CMD 14 |
Srinivasa Rao Uppala | c5320c2 | 2011-11-28 14:28:51 +0530 | [diff] [blame] | 230 | #define HCI_FM_GET_TX_CONFIG 15 |
Srinivasa Rao Uppala | d3184a4 | 2012-01-04 21:18:01 +0530 | [diff] [blame] | 231 | #define HCI_FM_GET_DET_CH_TH_CMD 16 |
Ankur Nandwani | d928d54 | 2011-08-11 13:15:41 -0700 | [diff] [blame] | 232 | |
| 233 | /* Defines for FM TX*/ |
Ayaz Ahmad | 1c0db52 | 2012-08-27 17:52:51 +0530 | [diff] [blame] | 234 | #define TX_PS_DATA_LENGTH 108 |
Ankur Nandwani | d928d54 | 2011-08-11 13:15:41 -0700 | [diff] [blame] | 235 | #define TX_RT_DATA_LENGTH 64 |
Ayaz Ahmad | 1c0db52 | 2012-08-27 17:52:51 +0530 | [diff] [blame] | 236 | #define PS_STRING_LEN 9 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 237 | |
| 238 | /* ----- HCI Command request ----- */ |
| 239 | struct hci_fm_recv_conf_req { |
| 240 | __u8 emphasis; |
| 241 | __u8 ch_spacing; |
| 242 | __u8 rds_std; |
| 243 | __u8 hlsi; |
| 244 | __u32 band_low_limit; |
| 245 | __u32 band_high_limit; |
| 246 | } __packed; |
| 247 | |
Ankur Nandwani | d928d54 | 2011-08-11 13:15:41 -0700 | [diff] [blame] | 248 | /* ----- HCI Command request ----- */ |
| 249 | struct hci_fm_trans_conf_req_struct { |
| 250 | __u8 emphasis; |
| 251 | __u8 rds_std; |
| 252 | __u32 band_low_limit; |
| 253 | __u32 band_high_limit; |
| 254 | } __packed; |
| 255 | |
| 256 | |
| 257 | /* ----- HCI Command request ----- */ |
| 258 | struct hci_fm_tx_ps { |
| 259 | __u8 ps_control; |
| 260 | __u16 pi; |
| 261 | __u8 pty; |
| 262 | __u8 ps_repeatcount; |
Ayaz Ahmad | 1c0db52 | 2012-08-27 17:52:51 +0530 | [diff] [blame] | 263 | __u8 ps_num; |
Ankur Nandwani | d928d54 | 2011-08-11 13:15:41 -0700 | [diff] [blame] | 264 | __u8 ps_data[TX_PS_DATA_LENGTH]; |
| 265 | } __packed; |
| 266 | |
| 267 | struct hci_fm_tx_rt { |
| 268 | __u8 rt_control; |
| 269 | __u16 pi; |
| 270 | __u8 pty; |
Ayaz Ahmad | 1c0db52 | 2012-08-27 17:52:51 +0530 | [diff] [blame] | 271 | __u8 rt_len; |
Ankur Nandwani | d928d54 | 2011-08-11 13:15:41 -0700 | [diff] [blame] | 272 | __u8 rt_data[TX_RT_DATA_LENGTH]; |
| 273 | } __packed; |
| 274 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 275 | struct hci_fm_mute_mode_req { |
| 276 | __u8 hard_mute; |
| 277 | __u8 soft_mute; |
| 278 | } __packed; |
| 279 | |
| 280 | struct hci_fm_stereo_mode_req { |
| 281 | __u8 stereo_mode; |
| 282 | __u8 sig_blend; |
| 283 | __u8 intf_blend; |
| 284 | __u8 most_switch; |
| 285 | } __packed; |
| 286 | |
| 287 | struct hci_fm_search_station_req { |
| 288 | __u8 srch_mode; |
| 289 | __u8 scan_time; |
| 290 | __u8 srch_dir; |
| 291 | } __packed; |
| 292 | |
| 293 | struct hci_fm_search_rds_station_req { |
| 294 | struct hci_fm_search_station_req srch_station; |
| 295 | __u8 srch_pty; |
| 296 | __u16 srch_pi; |
| 297 | } __packed; |
| 298 | |
| 299 | struct hci_fm_search_station_list_req { |
| 300 | __u8 srch_list_mode; |
| 301 | __u8 srch_list_dir; |
| 302 | __u32 srch_list_max; |
| 303 | __u8 srch_pty; |
| 304 | } __packed; |
| 305 | |
| 306 | struct hci_fm_rds_grp_req { |
| 307 | __u32 rds_grp_enable_mask; |
| 308 | __u32 rds_buf_size; |
| 309 | __u8 en_rds_change_filter; |
| 310 | } __packed; |
| 311 | |
| 312 | struct hci_fm_en_avd_ctrl_req { |
| 313 | __u8 no_freqs; |
| 314 | __u8 freq_index; |
| 315 | __u8 lo_shft; |
| 316 | __u16 freq_min; |
| 317 | __u16 freq_max; |
| 318 | } __packed; |
| 319 | |
| 320 | struct hci_fm_def_data_rd_req { |
| 321 | __u8 mode; |
| 322 | __u8 length; |
Venkateshwarlu Domakonda | 787af69 | 2011-10-14 21:23:03 +0530 | [diff] [blame] | 323 | __u8 param_len; |
| 324 | __u8 param; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 325 | } __packed; |
| 326 | |
| 327 | struct hci_fm_def_data_wr_req { |
Venkateshwarlu Domakonda | 787af69 | 2011-10-14 21:23:03 +0530 | [diff] [blame] | 328 | __u8 mode; |
| 329 | __u8 length; |
| 330 | __u8 data[DEFAULT_DATA_SIZE]; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 331 | } __packed; |
| 332 | |
Srinivasa Rao Uppala | abc8efa | 2011-08-02 14:31:30 -0700 | [diff] [blame] | 333 | struct hci_fm_riva_data { |
| 334 | __u8 subopcode; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 335 | __u32 start_addr; |
| 336 | __u8 length; |
| 337 | } __packed; |
| 338 | |
Srinivasa Rao Uppala | abc8efa | 2011-08-02 14:31:30 -0700 | [diff] [blame] | 339 | struct hci_fm_riva_poke { |
| 340 | struct hci_fm_riva_data cmd_params; |
| 341 | __u8 data[MAX_RIVA_PEEK_RSP_SIZE]; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 342 | } __packed; |
| 343 | |
| 344 | struct hci_fm_ssbi_req { |
| 345 | __u16 start_addr; |
| 346 | __u8 data; |
| 347 | } __packed; |
Srinivasa Rao Uppala | abc8efa | 2011-08-02 14:31:30 -0700 | [diff] [blame] | 348 | struct hci_fm_ssbi_peek { |
| 349 | __u16 start_address; |
| 350 | } __packed; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 351 | |
Srinivasa Rao Uppala | d3184a4 | 2012-01-04 21:18:01 +0530 | [diff] [blame] | 352 | struct hci_fm_ch_det_threshold { |
| 353 | char sinr; |
| 354 | __u8 sinr_samples; |
| 355 | __u8 low_th; |
| 356 | __u8 high_th; |
| 357 | |
| 358 | } __packed; |
| 359 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 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 | |
Ayaz Ahmad | 8926511 | 2012-10-05 19:39:11 +0530 | [diff] [blame] | 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 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 434 | struct hci_ev_tune_status { |
| 435 | __u8 sub_event; |
| 436 | __le32 station_freq; |
| 437 | __u8 serv_avble; |
| 438 | __u8 rssi; |
| 439 | __u8 stereo_prg; |
| 440 | __u8 rds_sync_status; |
| 441 | __u8 mute_mode; |
Srinivasa Rao Uppala | acdebcc | 2011-12-23 14:31:38 +0530 | [diff] [blame] | 442 | char sinr; |
| 443 | __u8 intf_det_th; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 444 | } __packed; |
| 445 | |
Ayaz Ahmad | 8926511 | 2012-10-05 19:39:11 +0530 | [diff] [blame] | 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 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 456 | struct hci_ev_rds_rx_data { |
| 457 | __u8 num_rds_grps; |
Ayaz Ahmad | 8926511 | 2012-10-05 19:39:11 +0530 | [diff] [blame] | 458 | struct rds_grp_data rds_grp_data[MAX_RAW_RDS_GRPS]; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 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[25]; |
| 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 | |
Srinivasa Rao Uppala | 18fb80e | 2011-07-17 17:33:00 -0700 | [diff] [blame] | 505 | struct hci_ev_rel_freq { |
| 506 | __u8 rel_freq_msb; |
| 507 | __u8 rel_freq_lsb; |
| 508 | |
| 509 | } __packed; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 510 | struct hci_ev_srch_list_compl { |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 511 | __u8 num_stations_found; |
Srinivasa Rao Uppala | 18fb80e | 2011-07-17 17:33:00 -0700 | [diff] [blame] | 512 | struct hci_ev_rel_freq rel_freq[20]; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 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 | |
Srinivasa Rao Uppala | c5320c2 | 2011-11-28 14:28:51 +0530 | [diff] [blame] | 521 | struct hci_fm_get_trans_conf_rsp { |
| 522 | __u8 status; |
| 523 | struct hci_fm_trans_conf_req_struct trans_conf_rsp; |
| 524 | } __packed; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 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; |
Venkateshwarlu Domakonda | 787af69 | 2011-10-14 21:23:03 +0530 | [diff] [blame] | 552 | __u8 data[DEFAULT_DATA_SIZE]; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 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 | |
Anantha Krishnan | f950e32 | 2012-06-06 14:25:49 +0530 | [diff] [blame] | 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 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 594 | /* HCI dev events */ |
| 595 | #define RADIO_HCI_DEV_REG 1 |
| 596 | #define RADIO_HCI_DEV_WRITE 2 |
| 597 | |
| 598 | #define hci_req_lock(d) mutex_lock(&d->req_lock) |
| 599 | #define hci_req_unlock(d) mutex_unlock(&d->req_lock) |
| 600 | |
Ankur Nandwani | 78a782b | 2011-07-07 21:11:21 -0700 | [diff] [blame] | 601 | /* FM RDS */ |
Ankur Nandwani | 4246251 | 2011-07-15 17:08:24 -0700 | [diff] [blame] | 602 | #define RDS_PTYPE 2 |
| 603 | #define RDS_PID_LOWER 1 |
| 604 | #define RDS_PID_HIGHER 0 |
Ankur Nandwani | 78a782b | 2011-07-07 21:11:21 -0700 | [diff] [blame] | 605 | #define RDS_OFFSET 5 |
| 606 | #define RDS_PS_LENGTH_OFFSET 7 |
| 607 | #define RDS_STRING 8 |
| 608 | #define RDS_PS_DATA_OFFSET 8 |
Srinivasa Rao Uppala | 58273f8 | 2011-08-10 19:07:45 -0700 | [diff] [blame] | 609 | #define RDS_CONFIG_OFFSET 3 |
Srinivasa Rao Uppala | 3c7a8eb | 2011-09-18 09:10:21 +0530 | [diff] [blame] | 610 | #define RDS_AF_JUMP_OFFSET 4 |
| 611 | #define PI_CODE_OFFSET 4 |
| 612 | #define AF_SIZE_OFFSET 6 |
| 613 | #define AF_LIST_OFFSET 7 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 614 | /*FM states*/ |
| 615 | |
| 616 | enum radio_state_t { |
| 617 | FM_OFF, |
| 618 | FM_RECV, |
| 619 | FM_TRANS, |
| 620 | FM_RESET, |
Ayaz Ahmad | c1e6a95 | 2012-05-15 19:29:54 +0530 | [diff] [blame] | 621 | FM_CALIB |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 622 | }; |
| 623 | |
| 624 | enum v4l2_cid_private_iris_t { |
| 625 | V4L2_CID_PRIVATE_IRIS_SRCHMODE = (0x08000000 + 1), |
| 626 | V4L2_CID_PRIVATE_IRIS_SCANDWELL, |
| 627 | V4L2_CID_PRIVATE_IRIS_SRCHON, |
| 628 | V4L2_CID_PRIVATE_IRIS_STATE, |
| 629 | V4L2_CID_PRIVATE_IRIS_TRANSMIT_MODE, |
| 630 | V4L2_CID_PRIVATE_IRIS_RDSGROUP_MASK, |
| 631 | V4L2_CID_PRIVATE_IRIS_REGION, |
| 632 | V4L2_CID_PRIVATE_IRIS_SIGNAL_TH, |
| 633 | V4L2_CID_PRIVATE_IRIS_SRCH_PTY, |
| 634 | V4L2_CID_PRIVATE_IRIS_SRCH_PI, |
| 635 | V4L2_CID_PRIVATE_IRIS_SRCH_CNT, |
| 636 | V4L2_CID_PRIVATE_IRIS_EMPHASIS, |
| 637 | V4L2_CID_PRIVATE_IRIS_RDS_STD, |
| 638 | V4L2_CID_PRIVATE_IRIS_SPACING, |
| 639 | V4L2_CID_PRIVATE_IRIS_RDSON, |
| 640 | V4L2_CID_PRIVATE_IRIS_RDSGROUP_PROC, |
| 641 | V4L2_CID_PRIVATE_IRIS_LP_MODE, |
| 642 | V4L2_CID_PRIVATE_IRIS_ANTENNA, |
| 643 | V4L2_CID_PRIVATE_IRIS_RDSD_BUF, |
Srinivasa Rao Uppala | 0f4098f | 2011-09-06 16:46:28 +0530 | [diff] [blame] | 644 | V4L2_CID_PRIVATE_IRIS_PSALL, /*0x8000014*/ |
Srinivasa Rao Uppala | abc8efa | 2011-08-02 14:31:30 -0700 | [diff] [blame] | 645 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 646 | /*v4l2 Tx controls*/ |
| 647 | V4L2_CID_PRIVATE_IRIS_TX_SETPSREPEATCOUNT, |
| 648 | V4L2_CID_PRIVATE_IRIS_STOP_RDS_TX_PS_NAME, |
| 649 | V4L2_CID_PRIVATE_IRIS_STOP_RDS_TX_RT, |
| 650 | V4L2_CID_PRIVATE_IRIS_IOVERC, |
| 651 | V4L2_CID_PRIVATE_IRIS_INTDET, |
Srinivasa Rao Uppala | 0f4098f | 2011-09-06 16:46:28 +0530 | [diff] [blame] | 652 | V4L2_CID_PRIVATE_IRIS_MPX_DCC, |
| 653 | V4L2_CID_PRIVATE_IRIS_AF_JUMP, |
| 654 | V4L2_CID_PRIVATE_IRIS_RSSI_DELTA, |
| 655 | V4L2_CID_PRIVATE_IRIS_HLSI, /*0x800001d*/ |
Srinivasa Rao Uppala | abc8efa | 2011-08-02 14:31:30 -0700 | [diff] [blame] | 656 | |
| 657 | /*Diagnostic commands*/ |
| 658 | V4L2_CID_PRIVATE_IRIS_SOFT_MUTE, |
| 659 | V4L2_CID_PRIVATE_IRIS_RIVA_ACCS_ADDR, |
| 660 | V4L2_CID_PRIVATE_IRIS_RIVA_ACCS_LEN, |
| 661 | V4L2_CID_PRIVATE_IRIS_RIVA_PEEK, |
| 662 | V4L2_CID_PRIVATE_IRIS_RIVA_POKE, |
| 663 | V4L2_CID_PRIVATE_IRIS_SSBI_ACCS_ADDR, |
| 664 | V4L2_CID_PRIVATE_IRIS_SSBI_PEEK, |
| 665 | V4L2_CID_PRIVATE_IRIS_SSBI_POKE, |
Srinivasa Rao Uppala | 0f4098f | 2011-09-06 16:46:28 +0530 | [diff] [blame] | 666 | V4L2_CID_PRIVATE_IRIS_TX_TONE, |
| 667 | V4L2_CID_PRIVATE_IRIS_RDS_GRP_COUNTERS, |
Anantha Krishnan | 61dc15e | 2011-12-06 11:39:02 +0530 | [diff] [blame] | 668 | V4L2_CID_PRIVATE_IRIS_SET_NOTCH_FILTER, /* 0x8000028 */ |
| 669 | V4L2_CID_PRIVATE_IRIS_SET_AUDIO_PATH, /* TAVARUA specific command */ |
| 670 | V4L2_CID_PRIVATE_IRIS_DO_CALIBRATION, |
| 671 | V4L2_CID_PRIVATE_IRIS_SRCH_ALGORITHM, /* TAVARUA specific command */ |
Srinivasa Rao Uppala | acdebcc | 2011-12-23 14:31:38 +0530 | [diff] [blame] | 672 | V4L2_CID_PRIVATE_IRIS_GET_SINR, |
Srinivasa Rao Uppala | d3184a4 | 2012-01-04 21:18:01 +0530 | [diff] [blame] | 673 | V4L2_CID_PRIVATE_INTF_LOW_THRESHOLD, |
| 674 | V4L2_CID_PRIVATE_INTF_HIGH_THRESHOLD, |
| 675 | V4L2_CID_PRIVATE_SINR_THRESHOLD, |
| 676 | V4L2_CID_PRIVATE_SINR_SAMPLES, |
Anantha Krishnan | f950e32 | 2012-06-06 14:25:49 +0530 | [diff] [blame] | 677 | V4L2_CID_PRIVATE_SPUR_FREQ, |
| 678 | V4L2_CID_PRIVATE_SPUR_FREQ_RMSSI, |
| 679 | V4L2_CID_PRIVATE_SPUR_SELECTION, |
| 680 | V4L2_CID_PRIVATE_UPDATE_SPUR_TABLE, |
Ayaz Ahmad | 37294ba | 2012-07-10 16:38:11 +0530 | [diff] [blame] | 681 | V4L2_CID_PRIVATE_VALID_CHANNEL, |
Ayaz Ahmad | db04b0c | 2013-02-01 17:18:34 +0530 | [diff] [blame^] | 682 | V4L2_CID_PRIVATE_AF_RMSSI_TH, |
| 683 | V4L2_CID_PRIVATE_AF_RMSSI_SAMPLES, |
| 684 | V4L2_CID_PRIVATE_GOOD_CH_RMSSI_TH, |
| 685 | V4L2_CID_PRIVATE_SRCHALGOTYPE, |
| 686 | V4L2_CID_PRIVATE_CF0TH12, |
| 687 | V4L2_CID_PRIVATE_SINRFIRSTSTAGE, |
| 688 | V4L2_CID_PRIVATE_RMSSIFIRSTSTAGE, |
| 689 | |
Anantha Krishnan | 61dc15e | 2011-12-06 11:39:02 +0530 | [diff] [blame] | 690 | |
| 691 | /*using private CIDs under userclass*/ |
| 692 | V4L2_CID_PRIVATE_IRIS_READ_DEFAULT = 0x00980928, |
Venkateshwarlu Domakonda | 787af69 | 2011-10-14 21:23:03 +0530 | [diff] [blame] | 693 | V4L2_CID_PRIVATE_IRIS_WRITE_DEFAULT, |
Srinivasa Rao Uppala | cb48ee6 | 2011-10-25 09:57:06 +0530 | [diff] [blame] | 694 | V4L2_CID_PRIVATE_IRIS_SET_CALIBRATION, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 695 | }; |
| 696 | |
Ankur Nandwani | d928d54 | 2011-08-11 13:15:41 -0700 | [diff] [blame] | 697 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 698 | enum iris_evt_t { |
| 699 | IRIS_EVT_RADIO_READY, |
| 700 | IRIS_EVT_TUNE_SUCC, |
| 701 | IRIS_EVT_SEEK_COMPLETE, |
| 702 | IRIS_EVT_SCAN_NEXT, |
| 703 | IRIS_EVT_NEW_RAW_RDS, |
| 704 | IRIS_EVT_NEW_RT_RDS, |
| 705 | IRIS_EVT_NEW_PS_RDS, |
| 706 | IRIS_EVT_ERROR, |
| 707 | IRIS_EVT_BELOW_TH, |
| 708 | IRIS_EVT_ABOVE_TH, |
| 709 | IRIS_EVT_STEREO, |
| 710 | IRIS_EVT_MONO, |
| 711 | IRIS_EVT_RDS_AVAIL, |
| 712 | IRIS_EVT_RDS_NOT_AVAIL, |
| 713 | IRIS_EVT_NEW_SRCH_LIST, |
| 714 | IRIS_EVT_NEW_AF_LIST, |
| 715 | IRIS_EVT_TXRDSDAT, |
Sunny Kapdi | 0f69eb4 | 2012-01-27 18:01:01 -0800 | [diff] [blame] | 716 | IRIS_EVT_TXRDSDONE, |
Ayaz Ahmad | 8926511 | 2012-10-05 19:39:11 +0530 | [diff] [blame] | 717 | IRIS_EVT_RADIO_DISABLED, |
| 718 | IRIS_EVT_NEW_ODA, |
| 719 | IRIS_EVT_NEW_RT_PLUS, |
| 720 | IRIS_EVT_NEW_ERT, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 721 | }; |
Ankur Nandwani | d928d54 | 2011-08-11 13:15:41 -0700 | [diff] [blame] | 722 | enum emphasis_type { |
| 723 | FM_RX_EMP75 = 0x0, |
| 724 | FM_RX_EMP50 = 0x1 |
| 725 | }; |
| 726 | |
| 727 | enum channel_space_type { |
| 728 | FM_RX_SPACE_200KHZ = 0x0, |
| 729 | FM_RX_SPACE_100KHZ = 0x1, |
| 730 | FM_RX_SPACE_50KHZ = 0x2 |
| 731 | }; |
| 732 | |
| 733 | enum high_low_injection { |
| 734 | AUTO_HI_LO_INJECTION = 0x0, |
| 735 | LOW_SIDE_INJECTION = 0x1, |
| 736 | HIGH_SIDE_INJECTION = 0x2 |
| 737 | }; |
| 738 | |
| 739 | enum fm_rds_type { |
| 740 | FM_RX_RDBS_SYSTEM = 0x0, |
| 741 | FM_RX_RDS_SYSTEM = 0x1 |
| 742 | }; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 743 | |
| 744 | enum iris_region_t { |
| 745 | IRIS_REGION_US, |
| 746 | IRIS_REGION_EU, |
| 747 | IRIS_REGION_JAPAN, |
| 748 | IRIS_REGION_JAPAN_WIDE, |
| 749 | IRIS_REGION_OTHER |
| 750 | }; |
| 751 | |
Ayaz Ahmad | 8926511 | 2012-10-05 19:39:11 +0530 | [diff] [blame] | 752 | #define STD_BUF_SIZE (256) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 753 | |
| 754 | enum iris_buf_t { |
| 755 | IRIS_BUF_SRCH_LIST, |
| 756 | IRIS_BUF_EVENTS, |
| 757 | IRIS_BUF_RT_RDS, |
| 758 | IRIS_BUF_PS_RDS, |
| 759 | IRIS_BUF_RAW_RDS, |
| 760 | IRIS_BUF_AF_LIST, |
Srinivasa Rao Uppala | abc8efa | 2011-08-02 14:31:30 -0700 | [diff] [blame] | 761 | IRIS_BUF_PEEK, |
| 762 | IRIS_BUF_SSBI_PEEK, |
Srinivasa Rao Uppala | 0f4098f | 2011-09-06 16:46:28 +0530 | [diff] [blame] | 763 | IRIS_BUF_RDS_CNTRS, |
Venkateshwarlu Domakonda | 787af69 | 2011-10-14 21:23:03 +0530 | [diff] [blame] | 764 | IRIS_BUF_RD_DEFAULT, |
Srinivasa Rao Uppala | cb48ee6 | 2011-10-25 09:57:06 +0530 | [diff] [blame] | 765 | IRIS_BUF_CAL_DATA, |
Ayaz Ahmad | 8926511 | 2012-10-05 19:39:11 +0530 | [diff] [blame] | 766 | IRIS_BUF_RT_PLUS, |
| 767 | IRIS_BUF_ERT, |
| 768 | IRIS_BUF_MAX, |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 769 | }; |
| 770 | |
| 771 | enum iris_xfr_t { |
| 772 | IRIS_XFR_SYNC, |
| 773 | IRIS_XFR_ERROR, |
| 774 | IRIS_XFR_SRCH_LIST, |
| 775 | IRIS_XFR_RT_RDS, |
| 776 | IRIS_XFR_PS_RDS, |
| 777 | IRIS_XFR_AF_LIST, |
| 778 | IRIS_XFR_MAX |
| 779 | }; |
| 780 | |
| 781 | #undef FMDBG |
| 782 | #ifdef FM_DEBUG |
| 783 | #define FMDBG(fmt, args...) pr_info("iris_radio: " fmt, ##args) |
| 784 | #else |
| 785 | #define FMDBG(fmt, args...) |
| 786 | #endif |
| 787 | |
| 788 | #undef FMDERR |
| 789 | #define FMDERR(fmt, args...) pr_err("iris_radio: " fmt, ##args) |
| 790 | |
| 791 | /* Search options */ |
| 792 | enum search_t { |
| 793 | SEEK, |
| 794 | SCAN, |
| 795 | SCAN_FOR_STRONG, |
| 796 | SCAN_FOR_WEAK, |
| 797 | RDS_SEEK_PTY, |
| 798 | RDS_SCAN_PTY, |
| 799 | RDS_SEEK_PI, |
| 800 | RDS_AF_JUMP, |
| 801 | }; |
| 802 | |
Anantha Krishnan | f950e32 | 2012-06-06 14:25:49 +0530 | [diff] [blame] | 803 | enum spur_entry_levels { |
| 804 | ENTRY_0, |
| 805 | ENTRY_1, |
| 806 | ENTRY_2, |
| 807 | ENTRY_3, |
| 808 | ENTRY_4, |
| 809 | ENTRY_5, |
| 810 | }; |
Ankur Nandwani | d928d54 | 2011-08-11 13:15:41 -0700 | [diff] [blame] | 811 | |
| 812 | /* Band limits */ |
| 813 | #define REGION_US_EU_BAND_LOW 87500 |
Ayaz Ahmad | b69202b | 2012-02-23 19:24:46 +0530 | [diff] [blame] | 814 | #define REGION_US_EU_BAND_HIGH 108000 |
Ankur Nandwani | d928d54 | 2011-08-11 13:15:41 -0700 | [diff] [blame] | 815 | #define REGION_JAPAN_STANDARD_BAND_LOW 76000 |
| 816 | #define REGION_JAPAN_STANDARD_BAND_HIGH 90000 |
| 817 | #define REGION_JAPAN_WIDE_BAND_LOW 90000 |
| 818 | #define REGION_JAPAN_WIDE_BAND_HIGH 108000 |
| 819 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 820 | #define SRCH_MODE 0x07 |
| 821 | #define SRCH_DIR 0x08 /* 0-up 1-down */ |
| 822 | #define SCAN_DWELL 0x70 |
| 823 | #define SRCH_ON 0x80 |
| 824 | |
| 825 | /* I/O Control */ |
| 826 | #define IOC_HRD_MUTE 0x03 |
| 827 | #define IOC_SFT_MUTE 0x01 |
| 828 | #define IOC_MON_STR 0x01 |
| 829 | #define IOC_SIG_BLND 0x01 |
| 830 | #define IOC_INTF_BLND 0x01 |
| 831 | #define IOC_ANTENNA 0x01 |
| 832 | |
| 833 | /* RDS Control */ |
| 834 | #define RDS_ON 0x01 |
| 835 | #define RDS_BUF_SZ 100 |
| 836 | |
Ankur Nandwani | d928d54 | 2011-08-11 13:15:41 -0700 | [diff] [blame] | 837 | /* constants */ |
| 838 | #define RDS_BLOCKS_NUM (4) |
| 839 | #define BYTES_PER_BLOCK (3) |
Ayaz Ahmad | 1c0db52 | 2012-08-27 17:52:51 +0530 | [diff] [blame] | 840 | #define MAX_PS_LENGTH (108) |
Ankur Nandwani | d928d54 | 2011-08-11 13:15:41 -0700 | [diff] [blame] | 841 | #define MAX_RT_LENGTH (64) |
Srinivasa Rao Uppala | 0f4098f | 2011-09-06 16:46:28 +0530 | [diff] [blame] | 842 | #define RDS_GRP_CNTR_LEN (36) |
Srinivasa Rao Uppala | 6983984 | 2012-01-13 18:36:12 +0530 | [diff] [blame] | 843 | #define RX_RT_DATA_LENGTH (63) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 844 | /* Search direction */ |
| 845 | #define SRCH_DIR_UP (0) |
| 846 | #define SRCH_DIR_DOWN (1) |
| 847 | |
Srinivasa Rao Uppala | 7bb2210 | 2011-07-14 11:27:30 -0700 | [diff] [blame] | 848 | /*Search RDS stations*/ |
| 849 | #define SEARCH_RDS_STNS_MODE_OFFSET 4 |
Srinivasa Rao Uppala | 18fb80e | 2011-07-17 17:33:00 -0700 | [diff] [blame] | 850 | |
| 851 | /*Search Station list */ |
Srinivasa Rao Uppala | 4b92e4b | 2011-08-09 15:46:25 -0700 | [diff] [blame] | 852 | #define PARAMS_PER_STATION 0x08 |
Srinivasa Rao Uppala | 18fb80e | 2011-07-17 17:33:00 -0700 | [diff] [blame] | 853 | #define STN_NUM_OFFSET 0x01 |
| 854 | #define STN_FREQ_OFFSET 0x02 |
| 855 | #define KHZ_TO_MHZ 1000 |
| 856 | #define GET_MSB(x)((x >> 8) & 0xFF) |
| 857 | #define GET_LSB(x)((x) & 0xFF) |
| 858 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 859 | /* control options */ |
| 860 | #define CTRL_ON (1) |
| 861 | #define CTRL_OFF (0) |
| 862 | |
Srinivasa Rao Uppala | abc8efa | 2011-08-02 14:31:30 -0700 | [diff] [blame] | 863 | /*Diagnostic commands*/ |
| 864 | |
| 865 | #define RIVA_PEEK_OPCODE 0x0D |
| 866 | #define RIVA_POKE_OPCODE 0x0C |
| 867 | |
| 868 | #define PEEK_DATA_OFSET 0x1 |
| 869 | #define RIVA_PEEK_PARAM 0x6 |
| 870 | #define RIVA_PEEK_LEN_OFSET 0x6 |
| 871 | #define SSBI_PEEK_LEN 0x01 |
Srinivasa Rao Uppala | cb48ee6 | 2011-10-25 09:57:06 +0530 | [diff] [blame] | 872 | /*Calibration data*/ |
| 873 | #define PROCS_CALIB_MODE 1 |
| 874 | #define PROCS_CALIB_SIZE 23 |
| 875 | #define DC_CALIB_MODE 2 |
| 876 | #define DC_CALIB_SIZE 48 |
| 877 | #define RSB_CALIB_MODE 3 |
| 878 | #define RSB_CALIB_SIZE 4 |
| 879 | #define CALIB_DATA_OFSET 2 |
| 880 | #define CALIB_MODE_OFSET 1 |
Srinivasa Rao Uppala | cb48ee6 | 2011-10-25 09:57:06 +0530 | [diff] [blame] | 881 | #define MAX_CALIB_SIZE 75 |
Ayaz Ahmad | 37294ba | 2012-07-10 16:38:11 +0530 | [diff] [blame] | 882 | |
| 883 | /* Channel validity */ |
| 884 | #define INVALID_CHANNEL (0) |
| 885 | #define VALID_CHANNEL (1) |
| 886 | |
Venkateshwarlu Domakonda | 3a0b75d | 2011-11-23 17:03:27 +0530 | [diff] [blame] | 887 | struct hci_fm_set_cal_req_proc { |
Srinivasa Rao Uppala | cb48ee6 | 2011-10-25 09:57:06 +0530 | [diff] [blame] | 888 | __u8 mode; |
Venkateshwarlu Domakonda | 3a0b75d | 2011-11-23 17:03:27 +0530 | [diff] [blame] | 889 | /*Max process calibration data size*/ |
| 890 | __u8 data[PROCS_CALIB_SIZE]; |
Srinivasa Rao Uppala | cb48ee6 | 2011-10-25 09:57:06 +0530 | [diff] [blame] | 891 | } __packed; |
Venkateshwarlu Domakonda | 3a0b75d | 2011-11-23 17:03:27 +0530 | [diff] [blame] | 892 | |
| 893 | struct hci_fm_set_cal_req_dc { |
| 894 | __u8 mode; |
| 895 | /*Max DC calibration data size*/ |
| 896 | __u8 data[DC_CALIB_SIZE]; |
| 897 | } __packed; |
| 898 | |
Srinivasa Rao Uppala | cb48ee6 | 2011-10-25 09:57:06 +0530 | [diff] [blame] | 899 | struct hci_cc_do_calibration_rsp { |
| 900 | __u8 status; |
| 901 | __u8 mode; |
| 902 | __u8 data[MAX_CALIB_SIZE]; |
| 903 | } __packed; |
Srinivasa Rao Uppala | f856ae6 | 2011-10-17 18:43:26 +0530 | [diff] [blame] | 904 | |
| 905 | /* Low Power mode*/ |
| 906 | #define SIG_LEVEL_INTR (1 << 0) |
| 907 | #define RDS_SYNC_INTR (1 << 1) |
| 908 | #define AUDIO_CTRL_INTR (1 << 2) |
| 909 | #define AF_JUMP_ENABLE (1 << 4) |
Anantha Krishnan | f950e32 | 2012-06-06 14:25:49 +0530 | [diff] [blame] | 910 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 911 | int hci_def_data_read(struct hci_fm_def_data_rd_req *arg, |
| 912 | struct radio_hci_dev *hdev); |
| 913 | int hci_def_data_write(struct hci_fm_def_data_wr_req *arg, |
| 914 | struct radio_hci_dev *hdev); |
| 915 | int hci_fm_do_calibration(__u8 *arg, struct radio_hci_dev *hdev); |
| 916 | int hci_fm_do_calibration(__u8 *arg, struct radio_hci_dev *hdev); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 917 | |
| 918 | #endif /* __RADIO_HCI_CORE_H */ |