tavarua.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596
  1. #ifndef __LINUX_TAVARUA_H
  2. #define __LINUX_TAVARUA_H
  3. #ifdef __KERNEL__
  4. #include <linux/types.h>
  5. #include <asm/sizes.h>
  6. #else
  7. #include <stdint.h>
  8. #endif
  9. #include <linux/ioctl.h>
  10. #include <linux/videodev2.h>
  11. #undef FM_DEBUG
  12. /* constants */
  13. #define RDS_BLOCKS_NUM (4)
  14. #define BYTES_PER_BLOCK (3)
  15. #define MAX_PS_LENGTH (96)
  16. #define MAX_RT_LENGTH (64)
  17. #define RX_STATIONS0_LEN (15)
  18. #define XFRDAT0 (0x20)
  19. #define XFRDAT1 (0x21)
  20. #define XFRDAT2 (0x22)
  21. #define INTDET_PEEK_MSB (0x88)
  22. #define INTDET_PEEK_LSB (0x26)
  23. #define RMSSI_PEEK_MSB (0x88)
  24. #define RMSSI_PEEK_LSB (0xA8)
  25. #define MPX_DCC_BYPASS_POKE_MSB (0x88)
  26. #define MPX_DCC_BYPASS_POKE_LSB (0xC0)
  27. #define MPX_DCC_PEEK_MSB_REG1 (0x88)
  28. #define MPX_DCC_PEEK_LSB_REG1 (0xC2)
  29. #define MPX_DCC_PEEK_MSB_REG2 (0x88)
  30. #define MPX_DCC_PEEK_LSB_REG2 (0xC3)
  31. #define MPX_DCC_PEEK_MSB_REG3 (0x88)
  32. #define MPX_DCC_PEEK_LSB_REG3 (0xC4)
  33. #define ON_CHANNEL_TH_MSB (0x0B)
  34. #define ON_CHANNEL_TH_LSB (0xA8)
  35. #define OFF_CHANNEL_TH_MSB (0x0B)
  36. #define OFF_CHANNEL_TH_LSB (0xAC)
  37. #define ENF_200Khz (1)
  38. #define SRCH200KHZ_OFFSET (7)
  39. #define SRCH_MASK (1 << SRCH200KHZ_OFFSET)
  40. /* Standard buffer size */
  41. #define STD_BUF_SIZE (256)
  42. /* Search direction */
  43. #define SRCH_DIR_UP (0)
  44. #define SRCH_DIR_DOWN (1)
  45. /* control options */
  46. #define CTRL_ON (1)
  47. #define CTRL_OFF (0)
  48. #define US_LOW_BAND (87.5)
  49. #define US_HIGH_BAND (108)
  50. /* constant for Tx */
  51. #define MASK_PI (0x0000FFFF)
  52. #define MASK_PI_MSB (0x0000FF00)
  53. #define MASK_PI_LSB (0x000000FF)
  54. #define MASK_PTY (0x0000001F)
  55. #define MASK_TXREPCOUNT (0x0000000F)
  56. #undef FMDBG
  57. #ifdef FM_DEBUG
  58. #define FMDBG(fmt, args...) printk(KERN_INFO "tavarua_radio: " fmt, ##args)
  59. #else
  60. #define FMDBG(fmt, args...)
  61. #endif
  62. #undef FMDERR
  63. #define FMDERR(fmt, args...) printk(KERN_INFO "tavarua_radio: " fmt, ##args)
  64. #undef FMDBG_I2C
  65. #ifdef FM_DEBUG_I2C
  66. #define FMDBG_I2C(fmt, args...) printk(KERN_INFO "fm_i2c: " fmt, ##args)
  67. #else
  68. #define FMDBG_I2C(fmt, args...)
  69. #endif
  70. /* function declarations */
  71. /* FM Core audio paths. */
  72. #define TAVARUA_AUDIO_OUT_ANALOG_OFF (0)
  73. #define TAVARUA_AUDIO_OUT_ANALOG_ON (1)
  74. #define TAVARUA_AUDIO_OUT_DIGITAL_OFF (0)
  75. #define TAVARUA_AUDIO_OUT_DIGITAL_ON (1)
  76. int tavarua_set_audio_path(int digital_on, int analog_on);
  77. /* defines and enums*/
  78. #define MARIMBA_A0 0x01010013
  79. #define MARIMBA_2_1 0x02010204
  80. #define BAHAMA_1_0 0x0302010A
  81. #define BAHAMA_2_0 0x04020205
  82. #define BAHAMA_2_1 0x04020309
  83. #define WAIT_TIMEOUT 2000
  84. #define RADIO_INIT_TIME 15
  85. #define TAVARUA_DELAY 10
  86. /*
  87. * The frequency is set in units of 62.5 Hz when using V4L2_TUNER_CAP_LOW,
  88. * 62.5 kHz otherwise.
  89. * The tuner is able to have a channel spacing of 50, 100 or 200 kHz.
  90. * tuner->capability is therefore set to V4L2_TUNER_CAP_LOW
  91. * The FREQ_MUL is then: 1 MHz / 62.5 Hz = 16000
  92. */
  93. #define FREQ_MUL (1000000 / 62.5)
  94. enum v4l2_cid_private_tavarua_t {
  95. V4L2_CID_PRIVATE_TAVARUA_SRCHMODE = (V4L2_CID_PRIVATE_BASE + 1),
  96. V4L2_CID_PRIVATE_TAVARUA_SCANDWELL,
  97. V4L2_CID_PRIVATE_TAVARUA_SRCHON,
  98. V4L2_CID_PRIVATE_TAVARUA_STATE,
  99. V4L2_CID_PRIVATE_TAVARUA_TRANSMIT_MODE,
  100. V4L2_CID_PRIVATE_TAVARUA_RDSGROUP_MASK,
  101. V4L2_CID_PRIVATE_TAVARUA_REGION,
  102. V4L2_CID_PRIVATE_TAVARUA_SIGNAL_TH,
  103. V4L2_CID_PRIVATE_TAVARUA_SRCH_PTY,
  104. V4L2_CID_PRIVATE_TAVARUA_SRCH_PI,
  105. V4L2_CID_PRIVATE_TAVARUA_SRCH_CNT,
  106. V4L2_CID_PRIVATE_TAVARUA_EMPHASIS,
  107. V4L2_CID_PRIVATE_TAVARUA_RDS_STD,
  108. V4L2_CID_PRIVATE_TAVARUA_SPACING,
  109. V4L2_CID_PRIVATE_TAVARUA_RDSON,
  110. V4L2_CID_PRIVATE_TAVARUA_RDSGROUP_PROC,
  111. V4L2_CID_PRIVATE_TAVARUA_LP_MODE,
  112. V4L2_CID_PRIVATE_TAVARUA_ANTENNA,
  113. V4L2_CID_PRIVATE_TAVARUA_RDSD_BUF,
  114. V4L2_CID_PRIVATE_TAVARUA_PSALL,
  115. /*v4l2 Tx controls*/
  116. V4L2_CID_PRIVATE_TAVARUA_TX_SETPSREPEATCOUNT,
  117. V4L2_CID_PRIVATE_TAVARUA_STOP_RDS_TX_PS_NAME,
  118. V4L2_CID_PRIVATE_TAVARUA_STOP_RDS_TX_RT,
  119. V4L2_CID_PRIVATE_TAVARUA_IOVERC,
  120. V4L2_CID_PRIVATE_TAVARUA_INTDET,
  121. V4L2_CID_PRIVATE_TAVARUA_MPX_DCC,
  122. V4L2_CID_PRIVATE_TAVARUA_AF_JUMP,
  123. V4L2_CID_PRIVATE_TAVARUA_RSSI_DELTA,
  124. V4L2_CID_PRIVATE_TAVARUA_HLSI,
  125. /*
  126. * Here we have IOCTl's that are specific to IRIS
  127. * (V4L2_CID_PRIVATE_BASE + 0x1E to V4L2_CID_PRIVATE_BASE + 0x28)
  128. */
  129. V4L2_CID_PRIVATE_SOFT_MUTE,/* 0x800001E*/
  130. V4L2_CID_PRIVATE_RIVA_ACCS_ADDR,
  131. V4L2_CID_PRIVATE_RIVA_ACCS_LEN,
  132. V4L2_CID_PRIVATE_RIVA_PEEK,
  133. V4L2_CID_PRIVATE_RIVA_POKE,
  134. V4L2_CID_PRIVATE_SSBI_ACCS_ADDR,
  135. V4L2_CID_PRIVATE_SSBI_PEEK,
  136. V4L2_CID_PRIVATE_SSBI_POKE,
  137. V4L2_CID_PRIVATE_TX_TONE,
  138. V4L2_CID_PRIVATE_RDS_GRP_COUNTERS,
  139. V4L2_CID_PRIVATE_SET_NOTCH_FILTER,/* 0x8000028 */
  140. V4L2_CID_PRIVATE_TAVARUA_SET_AUDIO_PATH,/* 0x8000029 */
  141. V4L2_CID_PRIVATE_TAVARUA_DO_CALIBRATION,/* 0x800002A : IRIS */
  142. V4L2_CID_PRIVATE_TAVARUA_SRCH_ALGORITHM,/* 0x800002B */
  143. V4L2_CID_PRIVATE_IRIS_GET_SINR, /* 0x800002C : IRIS */
  144. V4L2_CID_PRIVATE_INTF_LOW_THRESHOLD, /* 0x800002D */
  145. V4L2_CID_PRIVATE_INTF_HIGH_THRESHOLD, /* 0x800002E */
  146. V4L2_CID_PRIVATE_SINR_THRESHOLD, /* 0x800002F : IRIS */
  147. V4L2_CID_PRIVATE_SINR_SAMPLES, /* 0x8000030 : IRIS */
  148. V4L2_CID_PRIVATE_SPUR_FREQ,
  149. V4L2_CID_PRIVATE_SPUR_FREQ_RMSSI,
  150. V4L2_CID_PRIVATE_SPUR_SELECTION,
  151. V4L2_CID_PRIVATE_UPDATE_SPUR_TABLE,
  152. V4L2_CID_PRIVATE_VALID_CHANNEL,
  153. };
  154. enum tavarua_buf_t {
  155. TAVARUA_BUF_SRCH_LIST,
  156. TAVARUA_BUF_EVENTS,
  157. TAVARUA_BUF_RT_RDS,
  158. TAVARUA_BUF_PS_RDS,
  159. TAVARUA_BUF_RAW_RDS,
  160. TAVARUA_BUF_AF_LIST,
  161. TAVARUA_BUF_MAX
  162. };
  163. enum tavarua_xfr_t {
  164. TAVARUA_XFR_SYNC,
  165. TAVARUA_XFR_ERROR,
  166. TAVARUA_XFR_SRCH_LIST,
  167. TAVARUA_XFR_RT_RDS,
  168. TAVARUA_XFR_PS_RDS,
  169. TAVARUA_XFR_AF_LIST,
  170. TAVARUA_XFR_MAX
  171. };
  172. enum channel_spacing {
  173. FM_CH_SPACE_200KHZ,
  174. FM_CH_SPACE_100KHZ,
  175. FM_CH_SPACE_50KHZ
  176. };
  177. enum step_size {
  178. NO_SRCH200khz,
  179. ENF_SRCH200khz
  180. };
  181. enum emphasis {
  182. EMP_75,
  183. EMP_50
  184. };
  185. enum rds_std {
  186. RBDS_STD,
  187. RDS_STD
  188. };
  189. /* offsets */
  190. #define RAW_RDS 0x0F
  191. #define RDS_BLOCK 3
  192. /* registers*/
  193. #define MARIMBA_XO_BUFF_CNTRL 0x07
  194. #define RADIO_REGISTERS 0x30
  195. #define XFR_REG_NUM 16
  196. #define STATUS_REG_NUM 3
  197. /* TX constants */
  198. #define HEADER_SIZE 4
  199. #define TX_ON 0x80
  200. #define TAVARUA_TX_RT RDS_RT_0
  201. #define TAVARUA_TX_PS RDS_PS_0
  202. enum register_t {
  203. STATUS_REG1 = 0,
  204. STATUS_REG2,
  205. STATUS_REG3,
  206. RDCTRL,
  207. FREQ,
  208. TUNECTRL,
  209. SRCHRDS1,
  210. SRCHRDS2,
  211. SRCHCTRL,
  212. IOCTRL,
  213. RDSCTRL,
  214. ADVCTRL,
  215. AUDIOCTRL,
  216. RMSSI,
  217. IOVERC,
  218. AUDIOIND = 0x1E,
  219. XFRCTRL,
  220. FM_CTL0 = 0xFF,
  221. LEAKAGE_CNTRL = 0xFE,
  222. };
  223. #define BAHAMA_RBIAS_CTL1 0x07
  224. #define BAHAMA_FM_MODE_REG 0xFD
  225. #define BAHAMA_FM_CTL1_REG 0xFE
  226. #define BAHAMA_FM_CTL0_REG 0xFF
  227. #define BAHAMA_FM_MODE_NORMAL 0x00
  228. #define BAHAMA_LDO_DREG_CTL0 0xF0
  229. #define BAHAMA_LDO_AREG_CTL0 0xF4
  230. /* Radio Control */
  231. #define RDCTRL_STATE_OFFSET 0
  232. #define RDCTRL_STATE_MASK (3 << RDCTRL_STATE_OFFSET)
  233. #define RDCTRL_BAND_OFFSET 2
  234. #define RDCTRL_BAND_MASK (1 << RDCTRL_BAND_OFFSET)
  235. #define RDCTRL_CHSPACE_OFFSET 3
  236. #define RDCTRL_CHSPACE_MASK (3 << RDCTRL_CHSPACE_OFFSET)
  237. #define RDCTRL_DEEMPHASIS_OFFSET 5
  238. #define RDCTRL_DEEMPHASIS_MASK (1 << RDCTRL_DEEMPHASIS_OFFSET)
  239. #define RDCTRL_HLSI_OFFSET 6
  240. #define RDCTRL_HLSI_MASK (3 << RDCTRL_HLSI_OFFSET)
  241. #define RDSAF_OFFSET 6
  242. #define RDSAF_MASK (1 << RDSAF_OFFSET)
  243. /* Tune Control */
  244. #define TUNE_STATION 0x01
  245. #define ADD_OFFSET (1 << 1)
  246. #define SIGSTATE (1 << 5)
  247. #define MOSTSTATE (1 << 6)
  248. #define RDSSYNC (1 << 7)
  249. /* Search Control */
  250. #define SRCH_MODE_OFFSET 0
  251. #define SRCH_MODE_MASK (7 << SRCH_MODE_OFFSET)
  252. #define SRCH_DIR_OFFSET 3
  253. #define SRCH_DIR_MASK (1 << SRCH_DIR_OFFSET)
  254. #define SRCH_DWELL_OFFSET 4
  255. #define SRCH_DWELL_MASK (7 << SRCH_DWELL_OFFSET)
  256. #define SRCH_STATE_OFFSET 7
  257. #define SRCH_STATE_MASK (1 << SRCH_STATE_OFFSET)
  258. /* I/O Control */
  259. #define IOC_HRD_MUTE 0x03
  260. #define IOC_SFT_MUTE (1 << 2)
  261. #define IOC_MON_STR (1 << 3)
  262. #define IOC_SIG_BLND (1 << 4)
  263. #define IOC_INTF_BLND (1 << 5)
  264. #define IOC_ANTENNA (1 << 6)
  265. #define IOC_ANTENNA_OFFSET 6
  266. #define IOC_ANTENNA_MASK (1 << IOC_ANTENNA_OFFSET)
  267. /* RDS Control */
  268. #define RDS_ON 0x01
  269. #define RDSCTRL_STANDARD_OFFSET 1
  270. #define RDSCTRL_STANDARD_MASK (1 << RDSCTRL_STANDARD_OFFSET)
  271. /* Advanced features controls */
  272. #define RDSRTEN (1 << 3)
  273. #define RDSPSEN (1 << 4)
  274. /* Audio path control */
  275. #define AUDIORX_ANALOG_OFFSET 0
  276. #define AUDIORX_ANALOG_MASK (1 << AUDIORX_ANALOG_OFFSET)
  277. #define AUDIORX_DIGITAL_OFFSET 1
  278. #define AUDIORX_DIGITAL_MASK (1 << AUDIORX_DIGITAL_OFFSET)
  279. #define AUDIOTX_OFFSET 2
  280. #define AUDIOTX_MASK (1 << AUDIOTX_OFFSET)
  281. #define I2SCTRL_OFFSET 3
  282. #define I2SCTRL_MASK (1 << I2SCTRL_OFFSET)
  283. /* Search options */
  284. enum search_t {
  285. SEEK,
  286. SCAN,
  287. SCAN_FOR_STRONG,
  288. SCAN_FOR_WEAK,
  289. RDS_SEEK_PTY,
  290. RDS_SCAN_PTY,
  291. RDS_SEEK_PI,
  292. RDS_AF_JUMP,
  293. };
  294. /* Band limits */
  295. #define REGION_US_EU_BAND_LOW 87500
  296. #define REGION_US_EU_BAND_HIGH 108000
  297. #define REGION_JAPAN_STANDARD_BAND_LOW 76000
  298. #define REGION_JAPAN_STANDARD_BAND_HIGH 90000
  299. #define REGION_JAPAN_WIDE_BAND_LOW 90000
  300. #define REGION_JAPAN_WIDE_BAND_HIGH 108000
  301. #define MPX_DCC_BYPASS_REG 0x88C0
  302. #define MPX_DCC_DATA_REG 0x88C2
  303. enum audio_path {
  304. FM_DIGITAL_PATH,
  305. FM_ANALOG_PATH
  306. };
  307. #define SRCH_MODE 0x07
  308. #define SRCH_DIR 0x08 /* 0-up 1-down */
  309. #define SCAN_DWELL 0x70
  310. #define SRCH_ON 0x80
  311. /* RDS CONFIG */
  312. #define RDS_CONFIG_PSALL 0x01
  313. #define FM_ENABLE 0x22
  314. #define SET_REG_FIELD(reg, val, offset, mask) \
  315. (reg = (reg & ~mask) | (((val) << offset) & mask))
  316. #define GET_REG_FIELD(reg, offset, mask) ((reg & mask) >> offset)
  317. #define RSH_DATA(val, offset) ((val) >> (offset))
  318. #define LSH_DATA(val, offset) ((val) << (offset))
  319. #define GET_ABS_VAL(val) ((val) & (0xFF))
  320. enum radio_state_t {
  321. FM_OFF,
  322. FM_RECV,
  323. FM_TRANS,
  324. FM_RESET,
  325. };
  326. #define XFRCTRL_WRITE (1 << 7)
  327. /* Interrupt status */
  328. /* interrupt register 1 */
  329. #define READY (1 << 0) /* Radio ready after powerup or reset */
  330. #define TUNE (1 << 1) /* Tune completed */
  331. #define SEARCH (1 << 2) /* Search completed (read FREQ) */
  332. #define SCANNEXT (1 << 3) /* Scanning for next station */
  333. #define SIGNAL (1 << 4) /* Signal indicator change (read SIGSTATE) */
  334. #define INTF (1 << 5) /* Interference cnt has fallen outside range */
  335. #define SYNC (1 << 6) /* RDS sync state change (read RDSSYNC) */
  336. #define AUDIO (1 << 7) /* Audio Control indicator (read AUDIOIND) */
  337. /* interrupt register 2 */
  338. #define RDSDAT (1 << 0) /* New unread RDS data group available */
  339. #define BLOCKB (1 << 1) /* Block-B match condition exists */
  340. #define PROGID (1 << 2) /* Block-A or Block-C matched stored PI value*/
  341. #define RDSPS (1 << 3) /* New RDS Program Service Table available */
  342. #define RDSRT (1 << 4) /* New RDS Radio Text available */
  343. #define RDSAF (1 << 5) /* New RDS AF List available */
  344. #define TXRDSDAT (1 << 6) /* Transmitted an RDS group */
  345. #define TXRDSDONE (1 << 7) /* RDS raw group one-shot transmit completed */
  346. /* interrupt register 3 */
  347. #define TRANSFER (1 << 0) /* Data transfer (XFR) completed */
  348. #define RDSPROC (1 << 1) /* Dynamic RDS Processing complete */
  349. #define ERROR (1 << 7) /* Err occurred.Read code to determine cause */
  350. #define FM_TX_PWR_LVL_0 0 /* Lowest power lvl that can be set for Tx */
  351. #define FM_TX_PWR_LVL_MAX 7 /* Max power lvl for Tx */
  352. /* Tone Generator control value */
  353. #define TONE_GEN_CTRL_BYTE 0x00
  354. #define TONE_CHANNEL_EN_AND_SCALING_BYTE 0x01
  355. #define TONE_LEFT_FREQ_BYTE 0x02
  356. #define TONE_RIGHT_FREQ_BYTE 0x03
  357. #define TONE_LEFT_PHASE 0x04
  358. #define TONE_RIGHT_PHASE 0x05
  359. #define TONE_LEFT_CH_ENABLED 0x01
  360. #define TONE_RIGHT_CH_ENABLED 0x02
  361. #define TONE_LEFT_RIGHT_CH_ENABLED (TONE_LEFT_CH_ENABLED\
  362. | TONE_RIGHT_CH_ENABLED)
  363. #define TONE_SCALING_SHIFT 0x02
  364. /* Transfer */
  365. enum tavarua_xfr_ctrl_t {
  366. RDS_PS_0 = 0x01,
  367. RDS_PS_1,
  368. RDS_PS_2,
  369. RDS_PS_3,
  370. RDS_PS_4,
  371. RDS_PS_5,
  372. RDS_PS_6,
  373. RDS_RT_0,
  374. RDS_RT_1,
  375. RDS_RT_2,
  376. RDS_RT_3,
  377. RDS_RT_4,
  378. RDS_AF_0,
  379. RDS_AF_1,
  380. RDS_CONFIG,
  381. RDS_TX_GROUPS,
  382. RDS_COUNT_0,
  383. RDS_COUNT_1,
  384. RDS_COUNT_2,
  385. RADIO_CONFIG,
  386. RX_CONFIG,
  387. RX_TIMERS,
  388. RX_STATIONS_0,
  389. RX_STATIONS_1,
  390. INT_CTRL,
  391. ERROR_CODE,
  392. CHIPID,
  393. CAL_DAT_0 = 0x20,
  394. CAL_DAT_1,
  395. CAL_DAT_2,
  396. CAL_DAT_3,
  397. CAL_CFG_0,
  398. CAL_CFG_1,
  399. DIG_INTF_0,
  400. DIG_INTF_1,
  401. DIG_AGC_0,
  402. DIG_AGC_1,
  403. DIG_AGC_2,
  404. DIG_AUDIO_0,
  405. DIG_AUDIO_1,
  406. DIG_AUDIO_2,
  407. DIG_AUDIO_3,
  408. DIG_AUDIO_4,
  409. DIG_RXRDS,
  410. DIG_DCC,
  411. DIG_SPUR,
  412. DIG_MPXDCC,
  413. DIG_PILOT,
  414. DIG_DEMOD,
  415. DIG_MOST,
  416. DIG_TX_0,
  417. DIG_TX_1,
  418. PHY_TXGAIN = 0x3B,
  419. PHY_CONFIG,
  420. PHY_TXBLOCK,
  421. PHY_TCB,
  422. XFR_EXT,
  423. XFR_PEEK_MODE = 0x40,
  424. XFR_POKE_MODE = 0xC0,
  425. TAVARUA_XFR_CTRL_MAX
  426. };
  427. enum tavarua_evt_t {
  428. TAVARUA_EVT_RADIO_READY,
  429. TAVARUA_EVT_TUNE_SUCC,
  430. TAVARUA_EVT_SEEK_COMPLETE,
  431. TAVARUA_EVT_SCAN_NEXT,
  432. TAVARUA_EVT_NEW_RAW_RDS,
  433. TAVARUA_EVT_NEW_RT_RDS,
  434. TAVARUA_EVT_NEW_PS_RDS,
  435. TAVARUA_EVT_ERROR,
  436. TAVARUA_EVT_BELOW_TH,
  437. TAVARUA_EVT_ABOVE_TH,
  438. TAVARUA_EVT_STEREO,
  439. TAVARUA_EVT_MONO,
  440. TAVARUA_EVT_RDS_AVAIL,
  441. TAVARUA_EVT_RDS_NOT_AVAIL,
  442. TAVARUA_EVT_NEW_SRCH_LIST,
  443. TAVARUA_EVT_NEW_AF_LIST,
  444. TAVARUA_EVT_TXRDSDAT,
  445. TAVARUA_EVT_TXRDSDONE,
  446. TAVARUA_EVT_RADIO_DISABLED
  447. };
  448. enum tavarua_region_t {
  449. TAVARUA_REGION_US,
  450. TAVARUA_REGION_EU,
  451. TAVARUA_REGION_JAPAN,
  452. TAVARUA_REGION_JAPAN_WIDE,
  453. TAVARUA_REGION_OTHER
  454. };
  455. enum {
  456. ONE_BYTE = 1,
  457. TWO_BYTE,
  458. THREE_BYTE,
  459. FOUR_BYTE,
  460. FIVE_BYTE,
  461. SIX_BYTE,
  462. SEVEN_BYTE,
  463. EIGHT_BYTE,
  464. NINE_BYTE,
  465. TEN_BYTE,
  466. ELEVEN_BYTE,
  467. TWELVE_BYTE,
  468. THIRTEEN_BYTE
  469. };
  470. #define XFR_READ (0)
  471. #define XFR_WRITE (1)
  472. #define XFR_MODE_OFFSET (0)
  473. #define XFR_ADDR_MSB_OFFSET (1)
  474. #define XFR_ADDR_LSB_OFFSET (2)
  475. #define XFR_DATA_OFFSET (3)
  476. #define SPUR_DATA_SIZE (3)
  477. #define MAX_SPUR_FREQ_LIMIT (30)
  478. #define READ_COMPLETE (0x20)
  479. #define SPUR_TABLE_ADDR (0x0BB7)
  480. #define SPUR_TABLE_START_ADDR (SPUR_TABLE_ADDR + 1)
  481. #define XFR_PEEK_COMPLETE (XFR_PEEK_MODE | READ_COMPLETE)
  482. #define XFR_POKE_COMPLETE (XFR_POKE_MODE)
  483. #define TUNE_MULT (16)
  484. #define ADJ_CHANNEL_KHZ (50)
  485. #define MPX_DCC_UPPER_LIMIT (20000)
  486. #define MPX_DCC_LIMIT (12566)
  487. #define INVALID_CHANNEL (0)
  488. #define VALID_CHANNEL (1)
  489. #define COMPUTE_SPUR(val) ((((val) - (76000)) / (50)))
  490. #define GET_FREQ(val, bit) ((bit == 1) ? ((val) >> 8) : ((val) & 0xFF))
  491. struct fm_spur_data {
  492. int freq[MAX_SPUR_FREQ_LIMIT];
  493. __s8 rmssi[MAX_SPUR_FREQ_LIMIT];
  494. } __packed;
  495. struct fm_def_data_wr_req {
  496. __u8 mode;
  497. __u8 length;
  498. __u8 data[XFR_REG_NUM];
  499. } __packed;
  500. enum Internal_tone_gen_vals {
  501. ONE_KHZ_LR_EQUA_0DBFS = 1,
  502. ONE_KHZ_LEFTONLY_EQUA_0DBFS,
  503. ONE_KHZ_RIGHTONLY_EQUA_0DBFS,
  504. ONE_KHZ_LR_EQUA_l8DBFS,
  505. FIFTEEN_KHZ_LR_EQUA_l8DBFS
  506. };
  507. enum Tone_scaling_indexes {
  508. TONE_SCALE_IND_0,
  509. TONE_SCALE_IND_1,
  510. TONE_SCALE_IND_2,
  511. TONE_SCALE_IND_3,
  512. TONE_SCALE_IND_4,
  513. TONE_SCALE_IND_5,
  514. TONE_SCALE_IND_6,
  515. TONE_SCALE_IND_7,
  516. TONE_SCALE_IND_8,
  517. TONE_SCALE_IND_9,
  518. TONE_SCALE_IND_10,
  519. TONE_SCALE_IND_11,
  520. TONE_SCALE_IND_12
  521. };
  522. #endif /* __LINUX_TAVARUA_H */