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