radio-iris.h 27 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141
  1. /*
  2. *
  3. * Copyright (c) 2011-2013 The Linux Foundation. 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. #ifndef __RADIO_HCI_CORE_H
  27. #define __RADIO_HCI_CORE_H
  28. #include <linux/skbuff.h>
  29. #include <linux/interrupt.h>
  30. #include <linux/mutex.h>
  31. #include <linux/atomic.h>
  32. #include "radio-iris-commands.h"
  33. #define MIN_TX_TONE_VAL 0x00
  34. #define MAX_TX_TONE_VAL 0x07
  35. #define MIN_HARD_MUTE_VAL 0x00
  36. #define MAX_HARD_MUTE_VAL 0x03
  37. #define MIN_SRCH_MODE 0x00
  38. #define MAX_SRCH_MODE 0x09
  39. #define MIN_SCAN_DWELL 0x00
  40. #define MAX_SCAN_DWELL 0x0F
  41. #define MIN_SIG_TH 0x00
  42. #define MAX_SIG_TH 0x03
  43. #define MIN_PTY 0X00
  44. #define MAX_PTY 0x1F
  45. #define MIN_PI 0x0000
  46. #define MAX_PI 0xFFFF
  47. #define MIN_SRCH_STATIONS_CNT 0x00
  48. #define MAX_SRCH_STATIONS_CNT 0x14
  49. #define MIN_CHAN_SPACING 0x00
  50. #define MAX_CHAN_SPACING 0x02
  51. #define MIN_EMPHASIS 0x00
  52. #define MAX_EMPHASIS 0x01
  53. #define MIN_RDS_STD 0x00
  54. #define MAX_RDS_STD 0x02
  55. #define MIN_ANTENNA_VAL 0x00
  56. #define MAX_ANTENNA_VAL 0x01
  57. #define MIN_TX_PS_REPEAT_CNT 0x01
  58. #define MAX_TX_PS_REPEAT_CNT 0x0F
  59. #define MIN_SOFT_MUTE 0x00
  60. #define MAX_SOFT_MUTE 0x01
  61. #define MIN_PEEK_ACCESS_LEN 0x01
  62. #define MAX_PEEK_ACCESS_LEN 0xF9
  63. #define MIN_RESET_CNTR 0x00
  64. #define MAX_RESET_CNTR 0x01
  65. #define MIN_HLSI 0x00
  66. #define MAX_HLSI 0x02
  67. #define MIN_NOTCH_FILTER 0x00
  68. #define MAX_NOTCH_FILTER 0x02
  69. #define MIN_INTF_DET_OUT_LW_TH 0x00
  70. #define MAX_INTF_DET_OUT_LW_TH 0xFF
  71. #define MIN_INTF_DET_OUT_HG_TH 0x00
  72. #define MAX_INTF_DET_OUT_HG_TH 0xFF
  73. #define MIN_SINR_TH -128
  74. #define MAX_SINR_TH 127
  75. #define MIN_SINR_SAMPLES 0x01
  76. #define MAX_SINR_SAMPLES 0xFF
  77. #define MIN_BLEND_HI -128
  78. #define MAX_BLEND_HI 127
  79. /* ---- HCI Packet structures ---- */
  80. #define RADIO_HCI_COMMAND_HDR_SIZE sizeof(struct radio_hci_command_hdr)
  81. #define RADIO_HCI_EVENT_HDR_SIZE sizeof(struct radio_hci_event_hdr)
  82. /* HCI data types */
  83. #define RADIO_HCI_COMMAND_PKT 0x11
  84. #define RADIO_HCI_EVENT_PKT 0x14
  85. /*HCI reponce packets*/
  86. #define MAX_RIVA_PEEK_RSP_SIZE 251
  87. /* default data access */
  88. #define DEFAULT_DATA_OFFSET 2
  89. #define DEFAULT_DATA_SIZE 249
  90. /* Power levels are 0-7, but SOC will expect values from 0-255
  91. * So the each level step size will be 255/7 = 36 */
  92. #define FM_TX_PWR_LVL_STEP_SIZE 36
  93. #define FM_TX_PWR_LVL_0 0 /* Lowest power lvl that can be set for Tx */
  94. #define FM_TX_PWR_LVL_MAX 7 /* Max power lvl for Tx */
  95. #define FM_TX_PHY_CFG_MODE 0x3c
  96. #define FM_TX_PHY_CFG_LEN 0x10
  97. #define FM_TX_PWR_GAIN_OFFSET 14
  98. /**RDS CONFIG MODE**/
  99. #define FM_RDS_CNFG_MODE 0x0f
  100. #define FM_RDS_CNFG_LEN 0x10
  101. #define AF_RMSSI_TH_LSB_OFFSET 10
  102. #define AF_RMSSI_TH_MSB_OFFSET 11
  103. #define AF_RMSSI_SAMPLES_OFFSET 15
  104. /**RX CONFIG MODE**/
  105. #define FM_RX_CONFG_MODE 0x15
  106. #define FM_RX_CNFG_LEN 0x20
  107. #define GD_CH_RMSSI_TH_OFFSET 12
  108. #define MAX_GD_CH_RMSSI_TH 127
  109. #define SRCH_ALGO_TYPE_OFFSET 25
  110. #define SINRFIRSTSTAGE_OFFSET 26
  111. #define RMSSIFIRSTSTAGE_OFFSET 27
  112. #define CF0TH12_BYTE1_OFFSET 8
  113. #define CF0TH12_BYTE2_OFFSET 9
  114. #define CF0TH12_BYTE3_OFFSET 10
  115. #define CF0TH12_BYTE4_OFFSET 11
  116. #define MAX_SINR_FIRSTSTAGE 127
  117. #define MAX_RMSSI_FIRSTSTAGE 127
  118. #define RDS_PS0_XFR_MODE 0x01
  119. #define RDS_PS0_LEN 6
  120. #define RX_REPEATE_BYTE_OFFSET 5
  121. #define FM_SPUR_TBL_SIZE 240
  122. #define SPUR_DATA_LEN 16
  123. #define ENTRIES_EACH_CMD 15
  124. #define SPUR_DATA_INDEX 2
  125. #define FM_AF_LIST_MAX_SIZE 200
  126. #define AF_LIST_MAX (FM_AF_LIST_MAX_SIZE / 4) /* Each AF frequency consist
  127. of sizeof(int) bytes */
  128. #define MAX_BLEND_INDEX 49
  129. /* HCI timeouts */
  130. #define RADIO_HCI_TIMEOUT (10000) /* 10 seconds */
  131. #define TUNE_PARAM 16
  132. #define FM_RDS_3A_GRP (0x40)
  133. #define AF_JMP_TUNE 0x03
  134. /**DIGITAL AUDIO 0 MODE**/
  135. #define DIG_AUDIO_0_MODE 0x2B
  136. #define DIG_AUDIO_0_LEN 0x10
  137. #define SMUTE_TH_OFFSET 2
  138. #define MAX_SOFTMUTE_TH 127
  139. struct radio_hci_command_hdr {
  140. __le16 opcode; /* OCF & OGF */
  141. __u8 plen;
  142. } __packed;
  143. struct radio_hci_event_hdr {
  144. __u8 evt;
  145. __u8 plen;
  146. } __packed;
  147. struct radio_hci_dev {
  148. char name[8];
  149. unsigned long flags;
  150. __u16 id;
  151. __u8 bus;
  152. __u8 dev_type;
  153. __u8 dev_name[248];
  154. __u8 dev_class[3];
  155. __u8 features[8];
  156. __u8 commands[64];
  157. unsigned int data_block_len;
  158. unsigned long cmd_last_tx;
  159. struct sk_buff *sent_cmd;
  160. __u32 req_status;
  161. __u32 req_result;
  162. atomic_t cmd_cnt;
  163. struct tasklet_struct cmd_task;
  164. struct tasklet_struct rx_task;
  165. struct tasklet_struct tx_task;
  166. struct sk_buff_head rx_q;
  167. struct sk_buff_head raw_q;
  168. struct sk_buff_head cmd_q;
  169. struct mutex req_lock;
  170. wait_queue_head_t req_wait_q;
  171. int (*open)(struct radio_hci_dev *hdev);
  172. int (*close)(struct radio_hci_dev *hdev);
  173. int (*flush)(struct radio_hci_dev *hdev);
  174. int (*send)(struct sk_buff *skb);
  175. void (*destruct)(struct radio_hci_dev *hdev);
  176. void (*notify)(struct radio_hci_dev *hdev, unsigned int evt);
  177. void (*close_smd)(void);
  178. };
  179. int radio_hci_register_dev(struct radio_hci_dev *hdev);
  180. int radio_hci_unregister_dev(void);
  181. int radio_hci_recv_frame(struct sk_buff *skb);
  182. int radio_hci_send_cmd(struct radio_hci_dev *hdev, __u16 opcode, __u32 plen,
  183. void *param);
  184. void radio_hci_event_packet(struct radio_hci_dev *hdev, struct sk_buff *skb);
  185. /* Opcode OCF */
  186. /* HCI recv control commands opcode */
  187. #define HCI_OCF_FM_ENABLE_RECV_REQ 0x0001
  188. #define HCI_OCF_FM_DISABLE_RECV_REQ 0x0002
  189. #define HCI_OCF_FM_GET_RECV_CONF_REQ 0x0003
  190. #define HCI_OCF_FM_SET_RECV_CONF_REQ 0x0004
  191. #define HCI_OCF_FM_SET_MUTE_MODE_REQ 0x0005
  192. #define HCI_OCF_FM_SET_STEREO_MODE_REQ 0x0006
  193. #define HCI_OCF_FM_SET_ANTENNA 0x0007
  194. #define HCI_OCF_FM_SET_SIGNAL_THRESHOLD 0x0008
  195. #define HCI_OCF_FM_GET_SIGNAL_THRESHOLD 0x0009
  196. #define HCI_OCF_FM_GET_STATION_PARAM_REQ 0x000A
  197. #define HCI_OCF_FM_GET_PROGRAM_SERVICE_REQ 0x000B
  198. #define HCI_OCF_FM_GET_RADIO_TEXT_REQ 0x000C
  199. #define HCI_OCF_FM_GET_AF_LIST_REQ 0x000D
  200. #define HCI_OCF_FM_SEARCH_STATIONS 0x000E
  201. #define HCI_OCF_FM_SEARCH_RDS_STATIONS 0x000F
  202. #define HCI_OCF_FM_SEARCH_STATIONS_LIST 0x0010
  203. #define HCI_OCF_FM_CANCEL_SEARCH 0x0011
  204. #define HCI_OCF_FM_RDS_GRP 0x0012
  205. #define HCI_OCF_FM_RDS_GRP_PROCESS 0x0013
  206. #define HCI_OCF_FM_EN_WAN_AVD_CTRL 0x0014
  207. #define HCI_OCF_FM_EN_NOTCH_CTRL 0x0015
  208. #define HCI_OCF_FM_SET_EVENT_MASK 0x0016
  209. #define HCI_OCF_FM_SET_CH_DET_THRESHOLD 0x0017
  210. #define HCI_OCF_FM_GET_CH_DET_THRESHOLD 0x0018
  211. #define HCI_OCF_FM_SET_BLND_TBL 0x001B
  212. #define HCI_OCF_FM_GET_BLND_TBL 0x001C
  213. /* HCI trans control commans opcode*/
  214. #define HCI_OCF_FM_ENABLE_TRANS_REQ 0x0001
  215. #define HCI_OCF_FM_DISABLE_TRANS_REQ 0x0002
  216. #define HCI_OCF_FM_GET_TRANS_CONF_REQ 0x0003
  217. #define HCI_OCF_FM_SET_TRANS_CONF_REQ 0x0004
  218. #define HCI_OCF_FM_RDS_RT_REQ 0x0008
  219. #define HCI_OCF_FM_RDS_PS_REQ 0x0009
  220. /* HCI common control commands opcode */
  221. #define HCI_OCF_FM_TUNE_STATION_REQ 0x0001
  222. #define HCI_OCF_FM_DEFAULT_DATA_READ 0x0002
  223. #define HCI_OCF_FM_DEFAULT_DATA_WRITE 0x0003
  224. #define HCI_OCF_FM_RESET 0x0004
  225. #define HCI_OCF_FM_GET_FEATURE_LIST 0x0005
  226. #define HCI_OCF_FM_DO_CALIBRATION 0x0006
  227. #define HCI_OCF_FM_SET_CALIBRATION 0x0007
  228. #define HCI_OCF_FM_SET_SPUR_TABLE 0x0008
  229. #define HCI_OCF_FM_GET_SPUR_TABLE 0x0009
  230. /*HCI Status parameters commands*/
  231. #define HCI_OCF_FM_READ_GRP_COUNTERS 0x0001
  232. /*HCI Diagnostic commands*/
  233. #define HCI_OCF_FM_PEEK_DATA 0x0002
  234. #define HCI_OCF_FM_POKE_DATA 0x0003
  235. #define HCI_OCF_FM_SSBI_PEEK_REG 0x0004
  236. #define HCI_OCF_FM_SSBI_POKE_REG 0x0005
  237. #define HCI_OCF_FM_STATION_DBG_PARAM 0x0007
  238. #define HCI_FM_SET_INTERNAL_TONE_GENRATOR 0x0008
  239. /* Opcode OGF */
  240. #define HCI_OGF_FM_RECV_CTRL_CMD_REQ 0x0013
  241. #define HCI_OGF_FM_TRANS_CTRL_CMD_REQ 0x0014
  242. #define HCI_OGF_FM_COMMON_CTRL_CMD_REQ 0x0015
  243. #define HCI_OGF_FM_STATUS_PARAMETERS_CMD_REQ 0x0016
  244. #define HCI_OGF_FM_TEST_CMD_REQ 0x0017
  245. #define HCI_OGF_FM_DIAGNOSTIC_CMD_REQ 0x003F
  246. /* Command opcode pack/unpack */
  247. #define hci_opcode_pack(ogf, ocf) (__u16) ((ocf & 0x03ff)|(ogf << 10))
  248. #define hci_opcode_ogf(op) (op >> 10)
  249. #define hci_opcode_ocf(op) (op & 0x03ff)
  250. #define hci_recv_ctrl_cmd_op_pack(ocf) \
  251. (__u16) hci_opcode_pack(HCI_OGF_FM_RECV_CTRL_CMD_REQ, ocf)
  252. #define hci_trans_ctrl_cmd_op_pack(ocf) \
  253. (__u16) hci_opcode_pack(HCI_OGF_FM_TRANS_CTRL_CMD_REQ, ocf)
  254. #define hci_common_cmd_op_pack(ocf) \
  255. (__u16) hci_opcode_pack(HCI_OGF_FM_COMMON_CTRL_CMD_REQ, ocf)
  256. #define hci_status_param_op_pack(ocf) \
  257. (__u16) hci_opcode_pack(HCI_OGF_FM_STATUS_PARAMETERS_CMD_REQ, ocf)
  258. #define hci_diagnostic_cmd_op_pack(ocf) \
  259. (__u16) hci_opcode_pack(HCI_OGF_FM_DIAGNOSTIC_CMD_REQ, ocf)
  260. /* HCI commands with no arguments*/
  261. #define HCI_FM_ENABLE_RECV_CMD 1
  262. #define HCI_FM_DISABLE_RECV_CMD 2
  263. #define HCI_FM_GET_RECV_CONF_CMD 3
  264. #define HCI_FM_GET_STATION_PARAM_CMD 4
  265. #define HCI_FM_GET_SIGNAL_TH_CMD 5
  266. #define HCI_FM_GET_PROGRAM_SERVICE_CMD 6
  267. #define HCI_FM_GET_RADIO_TEXT_CMD 7
  268. #define HCI_FM_GET_AF_LIST_CMD 8
  269. #define HCI_FM_CANCEL_SEARCH_CMD 9
  270. #define HCI_FM_RESET_CMD 10
  271. #define HCI_FM_GET_FEATURES_CMD 11
  272. #define HCI_FM_STATION_DBG_PARAM_CMD 12
  273. #define HCI_FM_ENABLE_TRANS_CMD 13
  274. #define HCI_FM_DISABLE_TRANS_CMD 14
  275. #define HCI_FM_GET_TX_CONFIG 15
  276. #define HCI_FM_GET_DET_CH_TH_CMD 16
  277. #define HCI_FM_GET_BLND_TBL_CMD 17
  278. /* Defines for FM TX*/
  279. #define TX_PS_DATA_LENGTH 108
  280. #define TX_RT_DATA_LENGTH 64
  281. #define PS_STRING_LEN 9
  282. /* ----- HCI Command request ----- */
  283. struct hci_fm_recv_conf_req {
  284. __u8 emphasis;
  285. __u8 ch_spacing;
  286. __u8 rds_std;
  287. __u8 hlsi;
  288. __u32 band_low_limit;
  289. __u32 band_high_limit;
  290. } __packed;
  291. /* ----- HCI Command request ----- */
  292. struct hci_fm_trans_conf_req_struct {
  293. __u8 emphasis;
  294. __u8 rds_std;
  295. __u32 band_low_limit;
  296. __u32 band_high_limit;
  297. } __packed;
  298. /* ----- HCI Command request ----- */
  299. struct hci_fm_tx_ps {
  300. __u8 ps_control;
  301. __u16 pi;
  302. __u8 pty;
  303. __u8 ps_repeatcount;
  304. __u8 ps_num;
  305. __u8 ps_data[TX_PS_DATA_LENGTH];
  306. } __packed;
  307. struct hci_fm_tx_rt {
  308. __u8 rt_control;
  309. __u16 pi;
  310. __u8 pty;
  311. __u8 rt_len;
  312. __u8 rt_data[TX_RT_DATA_LENGTH];
  313. } __packed;
  314. struct hci_fm_mute_mode_req {
  315. __u8 hard_mute;
  316. __u8 soft_mute;
  317. } __packed;
  318. struct hci_fm_stereo_mode_req {
  319. __u8 stereo_mode;
  320. __u8 sig_blend;
  321. __u8 intf_blend;
  322. __u8 most_switch;
  323. } __packed;
  324. struct hci_fm_search_station_req {
  325. __u8 srch_mode;
  326. __u8 scan_time;
  327. __u8 srch_dir;
  328. } __packed;
  329. struct hci_fm_search_rds_station_req {
  330. struct hci_fm_search_station_req srch_station;
  331. __u8 srch_pty;
  332. __u16 srch_pi;
  333. } __packed;
  334. struct hci_fm_search_station_list_req {
  335. __u8 srch_list_mode;
  336. __u8 srch_list_dir;
  337. __u32 srch_list_max;
  338. __u8 srch_pty;
  339. } __packed;
  340. struct hci_fm_rds_grp_req {
  341. __u32 rds_grp_enable_mask;
  342. __u32 rds_buf_size;
  343. __u8 en_rds_change_filter;
  344. } __packed;
  345. struct hci_fm_en_avd_ctrl_req {
  346. __u8 no_freqs;
  347. __u8 freq_index;
  348. __u8 lo_shft;
  349. __u16 freq_min;
  350. __u16 freq_max;
  351. } __packed;
  352. struct hci_fm_def_data_rd_req {
  353. __u8 mode;
  354. __u8 length;
  355. __u8 param_len;
  356. __u8 param;
  357. } __packed;
  358. struct hci_fm_def_data_wr_req {
  359. __u8 mode;
  360. __u8 length;
  361. __u8 data[DEFAULT_DATA_SIZE];
  362. } __packed;
  363. struct hci_fm_riva_data {
  364. __u8 subopcode;
  365. __u32 start_addr;
  366. __u8 length;
  367. } __packed;
  368. struct hci_fm_riva_poke {
  369. struct hci_fm_riva_data cmd_params;
  370. __u8 data[MAX_RIVA_PEEK_RSP_SIZE];
  371. } __packed;
  372. struct hci_fm_ssbi_req {
  373. __u16 start_addr;
  374. __u8 data;
  375. } __packed;
  376. struct hci_fm_ssbi_peek {
  377. __u16 start_address;
  378. } __packed;
  379. struct hci_fm_ch_det_threshold {
  380. signed char sinr;
  381. __u8 sinr_samples;
  382. __u8 low_th;
  383. __u8 high_th;
  384. } __packed;
  385. struct hci_fm_blend_table {
  386. __u8 ucBlendType;
  387. __u8 ucBlendRampRateUp;
  388. __u8 ucBlendDebounceNumSampleUp;
  389. __u8 ucBlendDebounceIdxUp;
  390. __u8 ucBlendSinrIdxSkipStep;
  391. __u8 scBlendSinrHi;
  392. __u8 scBlendRmssiHi;
  393. __u8 ucBlendIndexHi;
  394. __u8 ucBlendIndex[MAX_BLEND_INDEX];
  395. } __packed;
  396. /*HCI events*/
  397. #define HCI_EV_TUNE_STATUS 0x01
  398. #define HCI_EV_RDS_LOCK_STATUS 0x02
  399. #define HCI_EV_STEREO_STATUS 0x03
  400. #define HCI_EV_SERVICE_AVAILABLE 0x04
  401. #define HCI_EV_SEARCH_PROGRESS 0x05
  402. #define HCI_EV_SEARCH_RDS_PROGRESS 0x06
  403. #define HCI_EV_SEARCH_LIST_PROGRESS 0x07
  404. #define HCI_EV_RDS_RX_DATA 0x08
  405. #define HCI_EV_PROGRAM_SERVICE 0x09
  406. #define HCI_EV_RADIO_TEXT 0x0A
  407. #define HCI_EV_FM_AF_LIST 0x0B
  408. #define HCI_EV_TX_RDS_GRP_AVBLE 0x0C
  409. #define HCI_EV_TX_RDS_GRP_COMPL 0x0D
  410. #define HCI_EV_TX_RDS_CONT_GRP_COMPL 0x0E
  411. #define HCI_EV_CMD_COMPLETE 0x0F
  412. #define HCI_EV_CMD_STATUS 0x10
  413. #define HCI_EV_TUNE_COMPLETE 0x11
  414. #define HCI_EV_SEARCH_COMPLETE 0x12
  415. #define HCI_EV_SEARCH_RDS_COMPLETE 0x13
  416. #define HCI_EV_SEARCH_LIST_COMPLETE 0x14
  417. #define HCI_REQ_DONE 0
  418. #define HCI_REQ_PEND 1
  419. #define HCI_REQ_CANCELED 2
  420. #define HCI_REQ_STATUS 3
  421. #define MAX_RAW_RDS_GRPS 21
  422. #define RDSGRP_DATA_OFFSET 0x1
  423. #define RDS_GRPS_ALL 0xFFFFFFFF
  424. /*RT PLUS*/
  425. #define DUMMY_CLASS 0
  426. #define RT_PLUS_LEN_1_TAG 3
  427. #define RT_ERT_FLAG_BIT 5
  428. #define ITEM_TOGGLE_BIT 4
  429. #define ITEM_RUNNING_BIT 3
  430. /*TAG1*/
  431. #define TAG1_MSB_OFFSET 3
  432. #define TAG1_MSB_MASK 7
  433. #define TAG1_LSB_OFFSET 5
  434. #define TAG1_POS_MSB_MASK 31
  435. #define TAG1_POS_MSB_OFFSET 1
  436. #define TAG1_POS_LSB_OFFSET 7
  437. #define TAG1_LEN_OFFSET 1
  438. #define TAG1_LEN_MASK 63
  439. /*TAG2*/
  440. #define TAG2_MSB_OFFSET 5
  441. #define TAG2_MSB_MASK 1
  442. #define TAG2_LSB_OFFSET 3
  443. #define TAG2_POS_MSB_MASK 7
  444. #define TAG2_POS_MSB_OFFSET 3
  445. #define TAG2_POS_LSB_OFFSET 5
  446. #define TAG2_LEN_MASK 31
  447. #define AGT_MASK 31
  448. /*Extract 5 left most bits of lsb of 2nd block*/
  449. #define AGT(x) (x & AGT_MASK)
  450. /*16 bits of 4th block*/
  451. #define AID(lsb, msb) ((msb << 8) | (lsb))
  452. /*Extract 5 right most bits of msb of 2nd block*/
  453. #define GTC(blk2msb) (blk2msb >> 3)
  454. #define GRP_3A 0x6
  455. #define RT_PLUS_AID 0x4bd7
  456. /*ERT*/
  457. #define ERT_AID 0x6552
  458. #define CARRIAGE_RETURN 0x000D
  459. #define MAX_ERT_SEGMENT 31
  460. #define ERT_FORMAT_DIR_BIT 1
  461. #define EXTRACT_BIT(data, bit_pos) ((data & (1 << bit_pos)) >> bit_pos)
  462. struct hci_ev_tune_status {
  463. __u8 sub_event;
  464. __le32 station_freq;
  465. __u8 serv_avble;
  466. __u8 rssi;
  467. __u8 stereo_prg;
  468. __u8 rds_sync_status;
  469. __u8 mute_mode;
  470. char sinr;
  471. __u8 intf_det_th;
  472. } __packed;
  473. struct rds_blk_data {
  474. __u8 rdsMsb;
  475. __u8 rdsLsb;
  476. __u8 blockStatus;
  477. } __packed;
  478. struct rds_grp_data {
  479. struct rds_blk_data rdsBlk[4];
  480. } __packed;
  481. struct hci_ev_rds_rx_data {
  482. __u8 num_rds_grps;
  483. struct rds_grp_data rds_grp_data[MAX_RAW_RDS_GRPS];
  484. } __packed;
  485. struct hci_ev_prg_service {
  486. __le16 pi_prg_id;
  487. __u8 pty_prg_type;
  488. __u8 ta_prg_code_type;
  489. __u8 ta_ann_code_flag;
  490. __u8 ms_switch_code_flag;
  491. __u8 dec_id_ctrl_code_flag;
  492. __u8 ps_num;
  493. __u8 prg_service_name[119];
  494. } __packed;
  495. struct hci_ev_radio_text {
  496. __le16 pi_prg_id;
  497. __u8 pty_prg_type;
  498. __u8 ta_prg_code_type;
  499. __u8 txt_ab_flag;
  500. __u8 radio_txt[64];
  501. } __packed;
  502. struct hci_ev_af_list {
  503. __le32 tune_freq;
  504. __le16 pi_code;
  505. __u8 af_size;
  506. __u8 af_list[FM_AF_LIST_MAX_SIZE];
  507. } __packed;
  508. struct hci_ev_cmd_complete {
  509. __u8 num_hci_cmd_pkts;
  510. __le16 cmd_opcode;
  511. } __packed;
  512. struct hci_ev_cmd_status {
  513. __u8 status;
  514. __u8 num_hci_cmd_pkts;
  515. __le16 status_opcode;
  516. } __packed;
  517. struct hci_ev_srch_st {
  518. __le32 station_freq;
  519. __u8 rds_cap;
  520. __u8 pty;
  521. __le16 status_opcode;
  522. } __packed;
  523. struct hci_ev_rel_freq {
  524. __u8 rel_freq_msb;
  525. __u8 rel_freq_lsb;
  526. } __packed;
  527. struct hci_ev_srch_list_compl {
  528. __u8 num_stations_found;
  529. struct hci_ev_rel_freq rel_freq[20];
  530. } __packed;
  531. /* ----- HCI Event Response ----- */
  532. struct hci_fm_conf_rsp {
  533. __u8 status;
  534. struct hci_fm_recv_conf_req recv_conf_rsp;
  535. } __packed;
  536. struct hci_fm_get_trans_conf_rsp {
  537. __u8 status;
  538. struct hci_fm_trans_conf_req_struct trans_conf_rsp;
  539. } __packed;
  540. struct hci_fm_sig_threshold_rsp {
  541. __u8 status;
  542. __u8 sig_threshold;
  543. } __packed;
  544. struct hci_fm_station_rsp {
  545. struct hci_ev_tune_status station_rsp;
  546. } __packed;
  547. struct hci_fm_prgm_srv_rsp {
  548. __u8 status;
  549. struct hci_ev_prg_service prg_srv;
  550. } __packed;
  551. struct hci_fm_radio_txt_rsp {
  552. __u8 status;
  553. struct hci_ev_radio_text rd_txt;
  554. } __packed;
  555. struct hci_fm_af_list_rsp {
  556. __u8 status;
  557. struct hci_ev_af_list rd_txt;
  558. } __packed;
  559. struct hci_fm_data_rd_rsp {
  560. __u8 status;
  561. __u8 ret_data_len;
  562. __u8 data[DEFAULT_DATA_SIZE];
  563. } __packed;
  564. struct hci_fm_feature_list_rsp {
  565. __u8 status;
  566. __u8 feature_mask;
  567. } __packed;
  568. struct hci_fm_dbg_param_rsp {
  569. __u8 status;
  570. __u8 blend;
  571. __u8 soft_mute;
  572. __u8 inf_blend;
  573. __u8 inf_soft_mute;
  574. __u8 pilot_pil;
  575. __u8 io_verc;
  576. __u8 in_det_out;
  577. } __packed;
  578. #define CLKSPURID_INDEX0 0
  579. #define CLKSPURID_INDEX1 5
  580. #define CLKSPURID_INDEX2 10
  581. #define CLKSPURID_INDEX3 15
  582. #define CLKSPURID_INDEX4 20
  583. #define CLKSPURID_INDEX5 25
  584. #define MAX_SPUR_FREQ_LIMIT 30
  585. #define CKK_SPUR 0x3B
  586. #define SPUR_DATA_SIZE 0x4
  587. #define SPUR_ENTRIES_PER_ID 0x5
  588. #define COMPUTE_SPUR(val) ((((val) - (76000)) / (50)))
  589. #define GET_FREQ(val, bit) ((bit == 1) ? ((val) >> 8) : ((val) & 0xFF))
  590. #define GET_SPUR_ENTRY_LEVEL(val) ((val) / (5))
  591. struct hci_fm_spur_data {
  592. __u32 freq[MAX_SPUR_FREQ_LIMIT];
  593. __s8 rmssi[MAX_SPUR_FREQ_LIMIT];
  594. __u8 enable[MAX_SPUR_FREQ_LIMIT];
  595. } __packed;
  596. /* HCI dev events */
  597. #define RADIO_HCI_DEV_REG 1
  598. #define RADIO_HCI_DEV_WRITE 2
  599. #define hci_req_lock(d) mutex_lock(&d->req_lock)
  600. #define hci_req_unlock(d) mutex_unlock(&d->req_lock)
  601. /* FM RDS */
  602. #define RDS_PTYPE 2
  603. #define RDS_PID_LOWER 1
  604. #define RDS_PID_HIGHER 0
  605. #define RDS_OFFSET 5
  606. #define RDS_PS_LENGTH_OFFSET 7
  607. #define RDS_STRING 8
  608. #define RDS_PS_DATA_OFFSET 8
  609. #define RDS_CONFIG_OFFSET 3
  610. #define RDS_AF_JUMP_OFFSET 4
  611. #define RDS_RT_OFFSET 0
  612. #define RDS_PS_ALL_OFFSET 1
  613. #define RDS_PS_SIMPLE_OFFSET 2
  614. #define RDS_AF_LIST_OFFSET 3
  615. #define RDS_GRP_3A 6
  616. #define PI_CODE_OFFSET 4
  617. #define AF_SIZE_OFFSET 6
  618. #define AF_LIST_OFFSET 7
  619. #define RT_A_B_FLAG_OFFSET 4
  620. /*FM states*/
  621. enum radio_state_t {
  622. FM_OFF,
  623. FM_RECV,
  624. FM_TRANS,
  625. FM_RESET,
  626. FM_CALIB,
  627. FM_TURNING_OFF,
  628. FM_RECV_TURNING_ON,
  629. FM_TRANS_TURNING_ON,
  630. FM_MAX_NO_STATES,
  631. };
  632. enum emphasis_type {
  633. FM_RX_EMP75 = 0x0,
  634. FM_RX_EMP50 = 0x1
  635. };
  636. enum channel_space_type {
  637. FM_RX_SPACE_200KHZ = 0x0,
  638. FM_RX_SPACE_100KHZ = 0x1,
  639. FM_RX_SPACE_50KHZ = 0x2
  640. };
  641. enum high_low_injection {
  642. AUTO_HI_LO_INJECTION = 0x0,
  643. LOW_SIDE_INJECTION = 0x1,
  644. HIGH_SIDE_INJECTION = 0x2
  645. };
  646. enum fm_rds_type {
  647. FM_RX_RDBS_SYSTEM = 0x0,
  648. FM_RX_RDS_SYSTEM = 0x1
  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. #define STD_BUF_SIZE (256)
  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. enum iris_xfr_t {
  676. IRIS_XFR_SYNC,
  677. IRIS_XFR_ERROR,
  678. IRIS_XFR_SRCH_LIST,
  679. IRIS_XFR_RT_RDS,
  680. IRIS_XFR_PS_RDS,
  681. IRIS_XFR_AF_LIST,
  682. IRIS_XFR_MAX
  683. };
  684. #undef FMDBG
  685. #ifdef FM_DEBUG
  686. #define FMDBG(fmt, args...) pr_info("iris_radio: " fmt, ##args)
  687. #else
  688. #define FMDBG(fmt, args...)
  689. #endif
  690. #undef FMDERR
  691. #define FMDERR(fmt, args...) pr_err("iris_radio: " fmt, ##args)
  692. /* Search options */
  693. enum search_t {
  694. SEEK,
  695. SCAN,
  696. SCAN_FOR_STRONG,
  697. SCAN_FOR_WEAK,
  698. RDS_SEEK_PTY,
  699. RDS_SCAN_PTY,
  700. RDS_SEEK_PI,
  701. RDS_AF_JUMP,
  702. };
  703. enum spur_entry_levels {
  704. ENTRY_0,
  705. ENTRY_1,
  706. ENTRY_2,
  707. ENTRY_3,
  708. ENTRY_4,
  709. ENTRY_5,
  710. };
  711. /* Band limits */
  712. #define REGION_US_EU_BAND_LOW 87500
  713. #define REGION_US_EU_BAND_HIGH 108000
  714. #define REGION_JAPAN_STANDARD_BAND_LOW 76000
  715. #define REGION_JAPAN_STANDARD_BAND_HIGH 90000
  716. #define REGION_JAPAN_WIDE_BAND_LOW 90000
  717. #define REGION_JAPAN_WIDE_BAND_HIGH 108000
  718. #define SRCH_MODE 0x07
  719. #define SRCH_DIR 0x08 /* 0-up 1-down */
  720. #define SCAN_DWELL 0x70
  721. #define SRCH_ON 0x80
  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. /* RDS Control */
  730. #define RDS_ON 0x01
  731. #define RDS_BUF_SZ 100
  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. /*Search RDS stations*/
  743. #define SEARCH_RDS_STNS_MODE_OFFSET 4
  744. /*Search Station list */
  745. #define PARAMS_PER_STATION 0x08
  746. #define STN_NUM_OFFSET 0x01
  747. #define STN_FREQ_OFFSET 0x02
  748. #define KHZ_TO_MHZ 1000
  749. #define GET_MSB(x)((x >> 8) & 0xFF)
  750. #define GET_LSB(x)((x) & 0xFF)
  751. /* control options */
  752. #define CTRL_ON (1)
  753. #define CTRL_OFF (0)
  754. /*Diagnostic commands*/
  755. #define RIVA_PEEK_OPCODE 0x0D
  756. #define RIVA_POKE_OPCODE 0x0C
  757. #define PEEK_DATA_OFSET 0x1
  758. #define RIVA_PEEK_PARAM 0x6
  759. #define RIVA_PEEK_LEN_OFSET 0x6
  760. #define SSBI_PEEK_LEN 0x01
  761. /*Calibration data*/
  762. #define PROCS_CALIB_MODE 1
  763. #define PROCS_CALIB_SIZE 23
  764. #define DC_CALIB_MODE 2
  765. #define DC_CALIB_SIZE 48
  766. #define RSB_CALIB_MODE 3
  767. #define RSB_CALIB_SIZE 4
  768. #define CALIB_DATA_OFSET 2
  769. #define CALIB_MODE_OFSET 1
  770. #define MAX_CALIB_SIZE 75
  771. /* Channel validity */
  772. #define INVALID_CHANNEL (0)
  773. #define VALID_CHANNEL (1)
  774. struct hci_fm_set_cal_req_proc {
  775. __u8 mode;
  776. /*Max process calibration data size*/
  777. __u8 data[PROCS_CALIB_SIZE];
  778. } __packed;
  779. struct hci_fm_set_cal_req_dc {
  780. __u8 mode;
  781. /*Max DC calibration data size*/
  782. __u8 data[DC_CALIB_SIZE];
  783. } __packed;
  784. struct hci_cc_do_calibration_rsp {
  785. __u8 status;
  786. __u8 mode;
  787. __u8 data[MAX_CALIB_SIZE];
  788. } __packed;
  789. struct hci_fm_set_spur_table_req {
  790. __u8 mode;
  791. __u8 no_of_freqs_entries;
  792. u8 spur_data[FM_SPUR_TBL_SIZE];
  793. } __packed;
  794. /* Low Power mode*/
  795. #define SIG_LEVEL_INTR (1 << 0)
  796. #define RDS_SYNC_INTR (1 << 1)
  797. #define AUDIO_CTRL_INTR (1 << 2)
  798. #define AF_JUMP_ENABLE (1 << 4)
  799. int hci_def_data_read(struct hci_fm_def_data_rd_req *arg,
  800. struct radio_hci_dev *hdev);
  801. int hci_def_data_write(struct hci_fm_def_data_wr_req *arg,
  802. struct radio_hci_dev *hdev);
  803. int hci_fm_do_calibration(__u8 *arg, struct radio_hci_dev *hdev);
  804. int hci_fm_do_calibration(__u8 *arg, struct radio_hci_dev *hdev);
  805. int hci_fm_smd_register(void);
  806. void hci_fm_smd_deregister(void);
  807. static inline int is_valid_tone(int tone)
  808. {
  809. if ((tone >= MIN_TX_TONE_VAL) &&
  810. (tone <= MAX_TX_TONE_VAL))
  811. return 1;
  812. else
  813. return 0;
  814. }
  815. static inline int is_valid_hard_mute(int hard_mute)
  816. {
  817. if ((hard_mute >= MIN_HARD_MUTE_VAL) &&
  818. (hard_mute <= MAX_HARD_MUTE_VAL))
  819. return 1;
  820. else
  821. return 0;
  822. }
  823. static inline int is_valid_srch_mode(int srch_mode)
  824. {
  825. if ((srch_mode >= MIN_SRCH_MODE) &&
  826. (srch_mode <= MAX_SRCH_MODE))
  827. return 1;
  828. else
  829. return 0;
  830. }
  831. static inline int is_valid_scan_dwell_prd(int scan_dwell_prd)
  832. {
  833. if ((scan_dwell_prd >= MIN_SCAN_DWELL) &&
  834. (scan_dwell_prd <= MAX_SCAN_DWELL))
  835. return 1;
  836. else
  837. return 0;
  838. }
  839. static inline int is_valid_sig_th(int sig_th)
  840. {
  841. if ((sig_th >= MIN_SIG_TH) &&
  842. (sig_th <= MAX_SIG_TH))
  843. return 1;
  844. else
  845. return 0;
  846. }
  847. static inline int is_valid_pty(int pty)
  848. {
  849. if ((pty >= MIN_PTY) &&
  850. (pty <= MAX_PTY))
  851. return 1;
  852. else
  853. return 0;
  854. }
  855. static inline int is_valid_pi(int pi)
  856. {
  857. if ((pi >= MIN_PI) &&
  858. (pi <= MAX_PI))
  859. return 1;
  860. else
  861. return 0;
  862. }
  863. static inline int is_valid_srch_station_cnt(int cnt)
  864. {
  865. if ((cnt >= MIN_SRCH_STATIONS_CNT) &&
  866. (cnt <= MAX_SRCH_STATIONS_CNT))
  867. return 1;
  868. else
  869. return 0;
  870. }
  871. static inline int is_valid_chan_spacing(int spacing)
  872. {
  873. if ((spacing >= MIN_CHAN_SPACING) &&
  874. (spacing <= MAX_CHAN_SPACING))
  875. return 1;
  876. else
  877. return 0;
  878. }
  879. static inline int is_valid_emphasis(int emphasis)
  880. {
  881. if ((emphasis >= MIN_EMPHASIS) &&
  882. (emphasis <= MAX_EMPHASIS))
  883. return 1;
  884. else
  885. return 0;
  886. }
  887. static inline int is_valid_rds_std(int rds_std)
  888. {
  889. if ((rds_std >= MIN_RDS_STD) &&
  890. (rds_std <= MAX_RDS_STD))
  891. return 1;
  892. else
  893. return 0;
  894. }
  895. static inline int is_valid_antenna(int antenna_type)
  896. {
  897. if ((antenna_type >= MIN_ANTENNA_VAL) &&
  898. (antenna_type <= MAX_ANTENNA_VAL))
  899. return 1;
  900. else
  901. return 0;
  902. }
  903. static inline int is_valid_ps_repeat_cnt(int cnt)
  904. {
  905. if ((cnt >= MIN_TX_PS_REPEAT_CNT) &&
  906. (cnt <= MAX_TX_PS_REPEAT_CNT))
  907. return 1;
  908. else
  909. return 0;
  910. }
  911. static inline int is_valid_soft_mute(int soft_mute)
  912. {
  913. if ((soft_mute >= MIN_SOFT_MUTE) &&
  914. (soft_mute <= MAX_SOFT_MUTE))
  915. return 1;
  916. else
  917. return 0;
  918. }
  919. static inline int is_valid_peek_len(int len)
  920. {
  921. if ((len >= MIN_PEEK_ACCESS_LEN) &&
  922. (len <= MAX_PEEK_ACCESS_LEN))
  923. return 1;
  924. else
  925. return 0;
  926. }
  927. static inline int is_valid_reset_cntr(int cntr)
  928. {
  929. if ((cntr >= MIN_RESET_CNTR) &&
  930. (cntr <= MAX_RESET_CNTR))
  931. return 1;
  932. else
  933. return 0;
  934. }
  935. static inline int is_valid_hlsi(int hlsi)
  936. {
  937. if ((hlsi >= MIN_HLSI) &&
  938. (hlsi <= MAX_HLSI))
  939. return 1;
  940. else
  941. return 0;
  942. }
  943. static inline int is_valid_notch_filter(int filter)
  944. {
  945. if ((filter >= MIN_NOTCH_FILTER) &&
  946. (filter <= MAX_NOTCH_FILTER))
  947. return 1;
  948. else
  949. return 0;
  950. }
  951. static inline int is_valid_intf_det_low_th(int th)
  952. {
  953. if ((th >= MIN_INTF_DET_OUT_LW_TH) &&
  954. (th <= MAX_INTF_DET_OUT_LW_TH))
  955. return 1;
  956. else
  957. return 0;
  958. }
  959. static inline int is_valid_intf_det_hgh_th(int th)
  960. {
  961. if ((th >= MIN_INTF_DET_OUT_HG_TH) &&
  962. (th <= MAX_INTF_DET_OUT_HG_TH))
  963. return 1;
  964. else
  965. return 0;
  966. }
  967. static inline int is_valid_sinr_th(int th)
  968. {
  969. if ((th >= MIN_SINR_TH) &&
  970. (th <= MAX_SINR_TH))
  971. return 1;
  972. else
  973. return 0;
  974. }
  975. static inline int is_valid_sinr_samples(int samples_cnt)
  976. {
  977. if ((samples_cnt >= MIN_SINR_SAMPLES) &&
  978. (samples_cnt <= MAX_SINR_SAMPLES))
  979. return 1;
  980. else
  981. return 0;
  982. }
  983. static inline int is_valid_fm_state(int state)
  984. {
  985. if ((state >= 0) && (state < FM_MAX_NO_STATES))
  986. return 1;
  987. else
  988. return 0;
  989. }
  990. static inline int is_valid_blend_value(int val)
  991. {
  992. if ((val >= MIN_BLEND_HI) && (val <= MAX_BLEND_HI))
  993. return 1;
  994. else
  995. return 0;
  996. }
  997. #endif /* __RADIO_HCI_CORE_H */