summaryrefslogtreecommitdiff
path: root/drivers/media/radio/CG2900/cg2900_fm_driver.h
blob: 62703fa4690225b97cdf1bf12ab5f61bf7fc5024 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
/*
 * Copyright (C) ST-Ericsson SA 2010
 *
 * Linux FM Driver for CG2900 FM Chip
 *
 * Author: Hemant Gupta <hemant.gupta@stericsson.com> for ST-Ericsson.
 *
 * License terms: GNU General Public License (GPL), version 2
 */

#ifndef _FMDRIVER_H_
#define _FMDRIVER_H_

#include <linux/device.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/uaccess.h>
#include <linux/semaphore.h>
#include <linux/version.h>
#include <linux/kthread.h>
#include <linux/kernel.h>
#include <linux/timer.h>
#include <linux/mutex.h>
#include "cg2900_fm_api.h"

/* structure declared in cg2900_fm_driver.c */
extern struct timespec time_spec;

/* module_param declared in cg2900_fm_driver.c */
extern unsigned short cg2900_fm_debug_level;

/**
 * enum fmd_debug_levels - FM Driver Debug Levels.
 *
 * @FM_NO_LOGS: No Logs are displayed.
 * @FM_ERROR_LOGS: Only Error Logs are displayed.
 * @FM_INFO_LOGS: Function Entry logs are displayed.
 * @FM_DEBUG_LOGS: Full debugging support.
 * @FM_HCI_PACKET_LOGS: HCI Packet Sent/received to/by
 * FM Driver are displayed.
 *
 * Various debug levels for FM Driver.
 */
enum fmd_debug_levels {
	FM_NO_LOGS,
	FM_ERROR_LOGS,
	FM_INFO_LOGS,
	FM_DEBUG_LOGS,
	FM_HCI_PACKET_LOGS
};

#define FM_HEX_REPORT(fmt, arg...) \
	if (cg2900_fm_debug_level == FM_HCI_PACKET_LOGS) { \
		printk(KERN_INFO fmt "\r\n" , ## arg); \
	}

#define FM_DEBUG_REPORT(fmt, arg...) \
	if (cg2900_fm_debug_level > FM_INFO_LOGS && \
			cg2900_fm_debug_level < FM_HCI_PACKET_LOGS) { \
		getnstimeofday(&time_spec); \
		printk(KERN_INFO "\n[%08x:%08x] " \
		"CG2900_FM_Driver: " fmt "\r\n" , \
		(unsigned int)time_spec.tv_sec, \
		(unsigned int)time_spec.tv_nsec, ## arg); \
	}

#define FM_INFO_REPORT(fmt, arg...)    \
	if (cg2900_fm_debug_level > FM_ERROR_LOGS && \
			cg2900_fm_debug_level < FM_HCI_PACKET_LOGS) { \
		getnstimeofday(&time_spec); \
		printk(KERN_INFO "\n[%08x:%08x] " \
		"CG2900_FM_Driver: " fmt "\r\n" , \
		(unsigned int)time_spec.tv_sec, \
		(unsigned int)time_spec.tv_nsec, ## arg); \
	}

#define FM_ERR_REPORT(fmt, arg...)               \
	if (cg2900_fm_debug_level >= FM_ERROR_LOGS) { \
		getnstimeofday(&time_spec); \
		printk(KERN_ERR "\n[%08x:%08x] " \
		"CG2900_FM_Driver: " fmt "\r\n" , \
		(unsigned int)time_spec.tv_sec, \
		(unsigned int)time_spec.tv_nsec, ## arg); \
	}

#define MAX_COUNT_OF_IRQS				16
#define MAX_BUFFER_SIZE					512
#define MAX_NAME_SIZE					100
/* Maximum size of parsable data in bytes, received from CG2900 FM IP */
#define MAX_RESP_SIZE					20
/* Minimum Power level for CG2900. The value is in units of dBuV */
#define MIN_POWER_LEVEL					88
/* Maximum Power level for CG2900. The value is in units of dBuV */
#define MAX_POWER_LEVEL					123
/* Minimum RDS Deviation value for CG2900. The value is in units of 10 Hz */
#define MIN_RDS_DEVIATION				0
/* Default RDS Deviation value for CG2900. The value is in units of 10 Hz */
#define DEFAULT_RDS_DEVIATION				200
/* Maximum RDS Deviation value for CG2900. The value is in units of 10 Hz */
#define MAX_RDS_DEVIATION				750
#define FMD_EU_US_MIN_FREQ_IN_KHZ			87500
#define FMD_EU_US_MAX_FREQ_IN_KHZ			108000
#define FMD_JAPAN_MIN_FREQ_IN_KHZ			76000
#define FMD_JAPAN_MAX_FREQ_IN_KHZ			90000
#define FMD_CHINA_MIN_FREQ_IN_KHZ			70000
#define FMD_CHINA_MAX_FREQ_IN_KHZ			108000
#define FMD_MIN_CHANNEL_NUMBER				0
#define FMD_MAX_CHANNEL_NUMBER				760
/*
 * Maximum supported balance for CG2900. This is just a hexadecimal number
 * with no units.
 */
#define FMD_MAX_BALANCE					0x7FFF
/*
 * Maximum supported volume for CG2900. This is just a hexadecimal number
 * with no units.
 */
#define FMD_MAX_VOLUME					0x7FFF
/* Minimum Program Identification value as per RDS specification */
#define MIN_PI_VALUE					0x0000
/* Maximum Program Identification value as per RDS specification */
#define MAX_PI_VALUE					0xFFFF
/* Minimum Program Type code value as per RDS specification */
#define MIN_PTY_VALUE					0
/* Maximum Program Type code value as per RDS specification */
#define MAX_PTY_VALUE					31
/* Minimum Pilot Deviation value for CG2900. The value is in units of 10 Hz */
#define MIN_PILOT_DEVIATION				0
/* Default Pilot Deviation value for CG2900. The value is in units of 10 Hz */
#define DEFAULT_PILOT_DEVIATION				675
/* Maximum Pilot Deviation value for CG2900. The value is in units of 10 Hz */
#define MAX_PILOT_DEVIATION				1000
/*
 * Default RSSI Threshold for a channel to be considered valid for CG2900.
 * This is just a hexadecimal number with no units.
 */
#define DEFAULT_RSSI_THRESHOLD				0x0100
/*
 * Default Peak Noise level for a channel to be considered valid for CG2900.
 * This is just a hexadecimal number with no units.
 */
#define DEFAULT_PEAK_NOISE_VALUE			0x0035
/* Defines the RF level (at the antenna pin) at which the stereo blending
 * function will stop limiting the channel separation */
#define STEREO_BLENDING_MIN_RSSI			0x0005
/* Defines the RF level (at the antenna pin) at which the stereo blending
 * function will start limiting the channel separation */
#define STEREO_BLENDING_MAX_RSSI			0x0100
/*
 * Default Average Noise level for a channel to be considered valid for CG2900.
 * This is just a hexadecimal number with no units.
 */
#define DEFAULT_AVERAGE_NOISE_MAX_VALUE			0x0030
/*
 * Minimum Audio Deviation Level, as per CG2900 FM User Manual.
 * This is units of 10 Hz.
 */
#define MIN_AUDIO_DEVIATION						0x157C
/*
 * Maximum Audio Deviation Level, as per CG2900 FM UserManual.
 * This is units of 10 Hz.
 */
#define MAX_AUDIO_DEVIATION						0x3840
#define FREQUENCY_CONVERTOR_KHZ_HZ			1000
#define CHANNEL_FREQ_CONVERTER_MHZ			50
/* Interrupt(s) for CG2900 */
#define IRPT_INVALID					0x0000
#define IRPT_OPERATION_SUCCEEDED			0x0001
#define IRPT_OPERATION_FAILED				0x0002
#define IRPT_RX_BUFFERFULL_TX_BUFFEREMPTY		0x0008
#define IRPT_RX_SIGNAL_QUALITYLOW_MUTE_STATUS_CHANGED	0x0010
#define IRPT_RX_MONO_STEREO_TRANSITION			0x0020
#define IRPT_TX_OVERMODULATION				0x0030
#define IRPT_RX_RDS_SYNCFOUND_TX_OVERDRIVE		0x0040
#define IRPT_RDS_SYNC_LOST				0x0080
#define IRPT_PI_CODE_CHANGED				0x0100
#define IRPT_REQUESTED_BLOCK_AVAILABLE			0x0200
#define IRPT_BUFFER_CLEARED				0x2000
#define IRPT_WARM_BOOT_READY				0x4000
#define IRPT_COLD_BOOT_READY				0x8000
/* FM Commands Id */
#define CMD_ID_NONE					0x0000
#define CMD_AUP_EXT_SET_MUTE				0x01E2
#define CMD_AUP_SET_BALANCE				0x0042
#define CMD_AUP_SET_MUTE				0x0062
#define CMD_AUP_SET_VOLUME				0x0022
#define CMD_FMR_DP_BUFFER_GET_GROUP			0x0303
#define CMD_FMR_DP_BUFFER_GET_GROUP_COUNT		0x0323
#define CMD_FMR_DP_BUFFER_SET_SIZE			0x0343
#define CMD_FMR_DP_BUFFER_SET_THRESHOLD			0x06C3
#define CMD_FMR_DP_SET_CONTROL				0x02A3
#define CMD_FMR_DP_SET_GROUP_REJECTION		0x0543
#define CMD_FMR_RP_GET_RSSI				0x0083
#define CMD_FMR_RP_GET_STATE				0x0063
#define CMD_FMR_RP_STEREO_SET_MODE			0x0123
#define CMD_FMR_RP_STEREO_SET_CONTROL_BLENDING_RSSI		0x0143
#define CMD_FMR_SET_ANTENNA				0x0663
#define CMD_FMR_SP_AF_SWITCH_GET_RESULT			0x0603
#define CMD_FMR_SP_AF_SWITCH_START			0x04A3
#define CMD_FMR_SP_AF_UPDATE_GET_RESULT			0x0483
#define CMD_FMR_SP_AF_UPDATE_START			0x0463
#define CMD_FMR_SP_BLOCK_SCAN_GET_RESULT		0x06A3
#define CMD_FMR_SP_BLOCK_SCAN_START			0x0683
#define CMD_FMR_SP_SCAN_GET_RESULT			0x0423
#define CMD_FMR_SP_SCAN_START				0x0403
#define CMD_FMR_SP_SEARCH_START				0x03E3
#define CMD_FMR_SP_STOP					0x0383
#define CMD_FMR_SP_TUNE_GET_CHANNEL			0x03A3
#define CMD_FMR_SP_TUNE_SET_CHANNEL			0x03C3
#define CMD_FMR_TN_SET_BAND				0x0023
#define CMD_FMR_TN_SET_GRID				0x0043
#define CMD_FMR_RP_SET_DEEMPHASIS			0x00C3
#define CMD_FMT_DP_BUFFER_GET_POSITION			0x0204
#define CMD_FMT_DP_BUFFER_SET_GROUP			0x0244
#define CMD_FMT_DP_BUFFER_SET_SIZE			0x0224
#define CMD_FMT_DP_BUFFER_SET_THRESHOLD			0x0284
#define CMD_FMT_DP_SET_CONTROL				0x0264
#define CMD_FMT_PA_SET_CONTROL				0x01A4
#define CMD_FMT_PA_SET_MODE				0x01E4
#define CMD_FMT_RP_SET_PILOT_DEVIATION			0x02A4
#define CMD_FMT_RP_SET_PREEMPHASIS			0x00C4
#define CMD_FMT_RP_SET_RDS_DEVIATION			0x0344
#define CMD_FMT_RP_STEREO_SET_MODE			0x0164
#define CMD_FMT_SP_TUNE_GET_CHANNEL			0x0184
#define CMD_FMT_SP_TUNE_SET_CHANNEL			0x0064
#define CMD_FMT_TN_SET_BAND				0x0024
#define CMD_FMT_TN_SET_GRID				0x0044
#define CMD_GEN_GET_MODE				0x0021
#define CMD_GEN_GET_REGISTER_VALUE			0x00E1
#define CMD_GEN_GET_VERSION				0x00C1
#define CMD_GEN_GOTO_MODE				0x0041
#define CMD_GEN_GOTO_POWERDOWN				0x0081
#define CMD_GEN_GOTO_STANDBY				0x0061
#define CMD_GEN_POWERUP					0x0141
#define CMD_GEN_SELECT_REFERENCE_CLOCK			0x0201
#define CMD_GEN_SET_REFERENCE_CLOCK			0x0161
#define CMD_GEN_SET_REFERENCE_CLOCK_PLL			0x01A1
#define CMD_GEN_SET_REGISTER_VALUE			0x0101
#define CMD_TST_TONE_ENABLE				0x0027
#define CMD_TST_TONE_CONNECT				0x0047
#define CMD_TST_TONE_SET_PARAMS				0x0067
#define CMD_FMT_RP_LIMITER_SETCONTROL				0x01C4

/* FM Command Id Parameter Length */
#define CMD_GET_VERSION_PARAM_LEN			0
#define CMD_GET_VERSION_RSP_PARAM_LEN			7
#define CMD_GOTO_MODE_PARAM_LEN				1
#define CMD_SET_ANTENNA_PARAM_LEN			1
#define CMD_TN_SET_BAND_PARAM_LEN			3
#define CMD_TN_SET_GRID_PARAM_LEN			1
#define CMD_SP_TUNE_SET_CHANNEL_PARAM_LEN		1
#define CMD_SP_TUNE_GET_CHANNEL_PARAM_LEN		0
#define CMD_SP_TUNE_GET_CHANNEL_RSP_PARAM_LEN		1
#define CMD_RP_STEREO_SET_MODE_PARAM_LEN		1
#define CMD_RP_STEREO_SET_CONTROL_BLENDING_RSSI_PARAM_LEN	2
#define CMD_RP_GET_RSSI_PARAM_LEN			0
#define CMD_RP_GET_RSSI_RSP_PARAM_LEN			1
#define CMD_RP_GET_STATE_PARAM_LEN			0
#define CMD_RP_GET_STATE_RSP_PARAM_LEN			2
#define CMD_SP_SEARCH_START_PARAM_LEN			4
#define CMD_SP_SCAN_START_PARAM_LEN			4
#define CMD_SP_SCAN_GET_RESULT_PARAM_LEN		1
#define CMD_SP_SCAN_GET_RESULT_RSP_PARAM_LEN		7
#define CMD_SP_BLOCK_SCAN_START_PARAM_LEN		3
#define CMD_SP_BLOCK_SCAN_GET_RESULT_PARAM_LEN		1
#define CMD_SP_BLOCK_SCAN_GET_RESULT_RSP_PARAM_LEN	7
#define CMD_SP_STOP_PARAM_LEN				0
#define CMD_SP_AF_UPDATE_START_PARAM_LEN		1
#define CMD_SP_AF_UPDATE_GET_RESULT_PARAM_LEN		0
#define CMD_SP_AF_UPDATE_GET_RESULT_RSP_PARAM_LEN	1
#define CMD_SP_AF_SWITCH_START_PARAM_LEN		5
#define CMD_SP_AF_SWITCH_GET_RESULT_PARAM_LEN		0
#define CMD_SP_AF_SWITCH_GET_RESULT_RWSP_PARAM_LEN	3
#define CMD_DP_BUFFER_SET_SIZE_PARAM_LEN		1
#define CMD_DP_BUFFER_SET_THRESHOLD_PARAM_LEN		1
#define CMD_DP_SET_CONTROL_PARAM_LEN			1
#define CMD_DP_SET_GROUP_REJECTION_PARAM_LEN		1
#define CMD_PA_SET_MODE_PARAM_LEN			1
#define CMD_PA_SET_CONTROL_PARAM_LEN			1
#define CMD_RP_SET_PREEMPHASIS_PARAM_LEN		1
#define CMD_RP_SET_DEEMPHASIS_PARAM_LEN			1
#define CMD_RP_SET_PILOT_DEVIATION_PARAM_LEN		1
#define CMD_RP_SET_RDS_DEVIATION_PARAM_LEN		1
#define CMD_DP_BUFFER_SET_GROUP_PARAM_LEN		5
#define CMD_SET_BALANCE_PARAM_LEN			1
#define CMD_SET_VOLUME_PARAM_LEN			1
#define CMD_SET_MUTE_PARAM_LEN				2
#define CMD_EXT_SET_MUTE_PARAM_LEN			1
#define CMD_POWERUP_PARAM_LEN				0
#define CMD_GOTO_STANDBY_PARAM_LEN			0
#define CMD_GOTO_POWERDOWN_PARAM_LEN			0
#define CMD_SELECT_REFERENCE_CLOCK_PARAM_LEN		1
#define CMD_SET_REFERENCE_CLOCK_PLL_PARAM_LEN		1
#define CMD_DP_BUFFER_GET_GROUP_COUNT_PARAM_LEN		0
#define CMD_DP_BUFFER_GET_GROUP_PARAM_LEN		0
#define CMD_IP_ENABLE_CMD_LEN				4
#define CMD_IP_ENABLE_PARAM_LEN				3
#define CMD_IP_DISABLE_CMD_LEN				4
#define CMD_IP_DISABLE_PARAM_LEN			3
#define CMD_TST_TONE_ENABLE_PARAM_LEN			1
#define CMD_TST_TONE_CONNECT_PARAM_LEN			2
#define CMD_TST_TONE_SET_PARAMS_PARAM_LEN		6
#define CMD_FMT_RP_LIMITER_SETCONTROL_PARAM_LEN		2

/* FM HCI Command and event specific */
#define FM_WRITE					0x00
#define FM_READ						0x01
#define FM_CATENA_OPCODE				0xFE
#define HCI_CMD_FM					0xFD50
#define HCI_CMD_VS_WRITE_FILE_BLOCK			0xFC2E
#define FM_EVENT_ID					0x15
#define FM_SUCCESS_STATUS				0x00
#define FM_EVENT					0x01
#define HCI_COMMAND_COMPLETE_EVENT			0x0E
#define HCI_VS_DBG_EVENT				0xFF
#define ST_WRITE_FILE_BLK_SIZE				254
#define ST_MAX_NUMBER_OF_FILE_BLOCKS			256
#define FM_PG1_INTERRUPT_EVENT_LEN			0x04
#define FM_PG2_INTERRUPT_EVENT_LEN			0x06
#define FM_HCI_CMD_HEADER_LEN				6
#define FM_HCI_CMD_PARAM_LEN				5
#define FM_HCI_WRITE_FILE_BLK_HEADER_LEN		5
#define FM_HCI_WRITE_FILE_BLK_PARAM_LEN			4
#define HCI_PACKET_INDICATOR_CMD			0x01
#define HCI_PACKET_INDICATOR_EVENT			0x04
#define HCI_PACKET_INDICATOR_FM_CMD_EVT			0x08
/* FM Functions specific to CG2900 */
#define FM_FUNCTION_ENABLE				0x00
#define FM_FUNCTION_DISABLE				0x01
#define FM_FUNCTION_RESET				0x02
#define FM_FUNCTION_WRITE_COMMAND			0x10
#define FM_FUNCTION_SET_INT_MASK_ALL			0x20
#define FM_FUNCTION_GET_INT_MASK_ALL			0x21
#define FM_FUNCTION_SET_INT_MASK			0x22
#define FM_FUNCTION_GET_INT_MASK			0x23
#define FM_FUNCTION_FIRMWARE_DOWNLOAD			0x30
/* Command succeeded */
#define FM_CMD_STATUS_CMD_SUCCESS			0x00
/* HCI_ERR_HW_FAILURE when no response from the IP */
#define FM_CMD_STATUS_HCI_ERR_HW_FAILURE		0x03
/* HCI_ERR_INVALID_PARAMETERS. */
#define FM_CMD_STATUS_HCI_ERR_INVALID_PARAMETERS	0x12
/* When the host tries to send a command to an IP that hasn't been
 * initialized.
 */
#define FM_CMD_STATUS_IP_UNINIT				0x15
/* HCI_ERR_UNSPECIFIED_ERROR: any other error */
#define FM_CMD_STATUS_HCI_ERR_UNSPECIFIED_ERROR		0x1F
/* HCI_ERR_CMD_DISALLOWED when the host asks for an unauthorized operation
 * (FM state transition for instance)
 */
#define FM_CMD_STATUS_HCI_ERR_CMD_DISALLOWED		0x0C
/* Wrong sequence number for FM FW download command */
#define FM_CMD_STATUS_WRONG_SEQ_NUM			0xF1
/* Unknown file type for FM FW download command */
#define FM_CMD_STATUS_UNKNOWN_FILE_TYPE			0xF2
/* File version mismatch for FM FW download command */
#define FM_CMD_STATUS_FILE_VERSION_MISMATCH		0xF3


/**
 * enum fmd_event - Events received.
 *
 * @FMD_EVENT_OPERATION_COMPLETED: Previous operation has been completed.
 * @FMD_EVENT_ANTENNA_STATUS_CHANGED: Antenna has been changed.
 * @FMD_EVENT_FREQUENCY_CHANGED: Frequency has been changed.
 * @FMD_EVENT_SEEK_COMPLETED: Seek operation has completed.
 * @FMD_EVENT_SCAN_BAND_COMPLETED: Band Scan completed.
 * @FMD_EVENT_BLOCK_SCAN_COMPLETED: Block Scan completed.
 * @FMD_EVENT_AF_UPDATE_SWITCH_COMPLETE: Af Update or AF Switch is complete.
 * @FMD_EVENT_MONO_STEREO_TRANSITION_COMPLETE: Mono stereo transition is
 * completed.
 * @FMD_EVENT_SEEK_STOPPED: Previous Seek/Band Scan/ Block Scan operation is
 * stopped.
 * @FMD_EVENT_GEN_POWERUP: FM IP Powerup has been powered up.
 * @FMD_EVENT_RDSGROUP_RCVD: RDS Groups Full interrupt.
 * @FMD_EVENT_LAST_ELEMENT: Last event, used for keeping count of
 * number of events.
 *
 * Various events received from FM driver for Upper Layer(s) processing.
 */
enum fmd_event {
	FMD_EVENT_OPERATION_COMPLETED,
	FMD_EVENT_ANTENNA_STATUS_CHANGED,
	FMD_EVENT_FREQUENCY_CHANGED,
	FMD_EVENT_SEEK_COMPLETED,
	FMD_EVENT_SCAN_BAND_COMPLETED,
	FMD_EVENT_BLOCK_SCAN_COMPLETED,
	FMD_EVENT_AF_UPDATE_SWITCH_COMPLETE,
	FMD_EVENT_MONO_STEREO_TRANSITION_COMPLETE,
	FMD_EVENT_SEEK_STOPPED,
	FMD_EVENT_GEN_POWERUP,
	FMD_EVENT_RDSGROUP_RCVD,
	FMD_EVENT_LAST_ELEMENT
};

/**
 * enum fmd_mode - FM Driver Modes.
 *
 * @FMD_MODE_IDLE: FM Driver in Idle mode.
 * @FMD_MODE_RX: FM Driver in Rx mode.
 * @FMD_MODE_TX: FM Driver in Tx mode.
 *
 * Various Modes of FM Radio.
 */
enum fmd_mode {
	FMD_MODE_IDLE,
	FMD_MODE_RX,
	FMD_MODE_TX
};

/**
 * enum fmd_antenna - Antenna selection.
 *
 * @FMD_ANTENNA_EMBEDDED: Embedded Antenna.
 * @FMD_ANTENNA_WIRED: Wired Antenna.
 *
 * Antenna to be used for FM Radio.
 */
enum fmd_antenna {
	FMD_ANTENNA_EMBEDDED,
	FMD_ANTENNA_WIRED
};

/**
 * enum fmd_grid - Grid used on FM Radio.
 *
 * @FMD_GRID_50KHZ: 50  kHz grid spacing.
 * @FMD_GRID_100KHZ: 100  kHz grid spacing.
 * @FMD_GRID_200KHZ: 200  kHz grid spacing.
 *
 * Spacing used on FM Radio.
 */
enum fmd_grid {
	FMD_GRID_50KHZ,
	FMD_GRID_100KHZ,
	FMD_GRID_200KHZ
};

/**
 * enum fmd_emphasis - De-emphasis/Pre-emphasis level.
 *
 * @FMD_EMPHASIS_NONE: De-emphasis Disabled.
 * @FMD_EMPHASIS_50US: 50 us de-emphasis/pre-emphasis level.
 * @FMD_EMPHASIS_75US: 75 us de-emphasis/pre-emphasis level.
 *
 * De-emphasis/Pre-emphasis level used on FM Radio.
 */
enum fmd_emphasis {
	FMD_EMPHASIS_NONE = 0,
	FMD_EMPHASIS_50US = 1,
	FMD_EMPHASIS_75US = 2
};

/**
 * enum fmd_freq_range - Frequency range.
 *
 * @FMD_FREQRANGE_EUROAMERICA: EU/US Range (87.5 - 108 MHz).
 * @FMD_FREQRANGE_JAPAN: Japan Range (76 - 90 MHz).
 * @FMD_FREQRANGE_CHINA: China Range (70 - 108 MHz).
 *
 * Various Frequency range(s) supported by FM Radio.
 */
enum fmd_freq_range {
	FMD_FREQRANGE_EUROAMERICA,
	FMD_FREQRANGE_JAPAN,
	FMD_FREQRANGE_CHINA
};

/**
 * enum fmd_stereo_mode - FM Driver Stereo Modes.
 *
 * @FMD_STEREOMODE_OFF: Streo Blending Off.
 * @FMD_STEREOMODE_MONO: Mono Mode.
 * @FMD_STEREOMODE_BLENDING: Blending Mode.
 *
 * Various Stereo Modes of FM Radio.
 */
enum fmd_stereo_mode {
	FMD_STEREOMODE_OFF,
	FMD_STEREOMODE_MONO,
	FMD_STEREOMODE_BLENDING
};

/**
 * enum fmd_pilot_tone - Pilot Tone Selection
 *
 * @FMD_PILOT_TONE_DISABLED: Pilot Tone to be disabled.
 * @FMD_PILOT_TONE_ENABLED: Pilot Tone to be enabled.
 *
 * Pilot Tone to be enabled or disabled.
 */
enum fmd_pilot_tone {
	FMD_PILOT_TONE_DISABLED,
	FMD_PILOT_TONE_ENABLED
};

/**
 * enum fmd_output - Output of Sample Rate Converter.
 *
 * @FMD_OUTPUT_DISABLED: Sample Rate converter in disabled.
 * @FMD_OUTPUT_I2S: I2S Output from Sample rate converter.
 * @FMD_OUTPUT_PARALLEL: Parallel output from sample rate converter.
 *
 * Sample Rate Converter's output to be set on Connectivity Controller.
 */
enum fmd_output {
	FMD_OUTPUT_DISABLED,
	FMD_OUTPUT_I2S,
	FMD_OUTPUT_PARALLEL
};

/**
 * enum fmd_input - Audio Input to Sample Rate Converter.
 *
 * @FMD_INPUT_ANALOG: Selects the ADC's as audio source
 * @FMD_INPUT_DIGITAL: Selects Digital Input as audio source.
 *
 * Audio Input source for Sample Rate Converter.
 */
enum fmd_input {
	FMD_INPUT_ANALOG,
	FMD_INPUT_DIGITAL
};

/**
 * enum fmd_rds_mode - RDS Mode to be selected for FM Rx.
 *
 * @FMD_SWITCH_OFF_RDS: RDS Decoding disabled in FM Chip.
 * @FMD_SWITCH_ON_RDS: RDS Decoding enabled in FM Chip.
 * @FMD_SWITCH_ON_RDS_ENHANCED_MODE: Enhanced RDS Mode.
 * @FMD_SWITCH_ON_RDS_SIMULATOR: RDS Simulator switched on in FM Chip.
 *
 * RDS Mode to be selected for FM Rx.
 */
enum fmd_rds_mode {
	FMD_SWITCH_OFF_RDS,
	FMD_SWITCH_ON_RDS,
	FMD_SWITCH_ON_RDS_ENHANCED_MODE,
	FMD_SWITCH_ON_RDS_SIMULATOR
};

/**
 * enum fmd_rds_group_rejection_mode - RDS Group Rejection
 * to be selected for FM Rx.
 *
 * @FMD_RDS_GROUP_REJECTION_ON: Group rejection is enabled in FM Chip.
 * @FMD_RDS_GROUP_REJECTION_OFF: Group rejection is disabled in FM Chip.
 *
 * RDS Group rejection to be selected for FM Rx.
 */
enum fmd_rds_group_rejection_mode {
	FMD_RDS_GROUP_REJECTION_ON,
	FMD_RDS_GROUP_REJECTION_OFF
};

/**
 * enum fmd_tst_tone_status - Test Tone Generator Status.
 *
 * @FMD_TST_TONE_OFF: Test Tone Generator is off.
 * @FMD_TST_TONE_ON_W_SRC: Test Tone Gen. is on with Sample Rate Conversion.
 * @FMD_TST_TONE_ON_WO_SRC: Test Tone Gen. is on without Sample Rate Conversion.
 *
 * Test Tone Generator status to be set.
 */
enum fmd_tst_tone_status {
	FMD_TST_TONE_OFF,
	FMD_TST_TONE_ON_W_SRC,
	FMD_TST_TONE_ON_WO_SRC
};

/**
 * enum fmd_tst_tone_audio_mode - Test Tone Generator Audio Output/Input Mode.
 *
 * @FMD_TST_TONE_AUDIO_NORMAL: Normal Audio.
 * @FMD_TST_TONE_AUDIO_ZERO: Zero.
 * @FMD_TST_TONE_AUDIO_TONE_1: Tone 1.
 * @FMD_TST_TONE_AUDIO_TONE_2: Tone 2.
 * @FMD_TST_TONE_AUDIO_TONE_SUM: Sum of Tone 1 and Tone 2.
 *
 * Test Tone Generator Audio Output/Input Modes.
 */
enum fmd_tst_tone_audio_mode {
	FMD_TST_TONE_AUDIO_NORMAL,
	FMD_TST_TONE_AUDIO_ZERO,
	FMD_TST_TONE_AUDIO_TONE_1,
	FMD_TST_TONE_AUDIO_TONE_2,
	FMD_TST_TONE_AUDIO_TONE_SUM
};

/**
 * enum fmd_tst_tone - Test Tone of Internal Tone Generator.
 *
 * @FMD_TST_TONE_1: Test Tone 1
 * @FMD_TST_TONE_2: Test Tone 2
 *
 * Test Tone.
 */
enum fmd_tst_tone {
	FMD_TST_TONE_1,
	FMD_TST_TONE_2
};

/**
 * enum fmd_tst_tone_waveform - Test Tone Waveform of Internal Tone Generator.
 *
 * @FMD_TST_TONE_SINE: Sine wave
 * @FMD_TST_TONE_PULSE: Pulse wave
 *
 * Test Tone waveform.
 */
enum fmd_tst_tone_waveform {
	FMD_TST_TONE_SINE,
	FMD_TST_TONE_PULSE
};

/* Callback function to receive radio events. */
typedef void(*fmd_radio_cb)(
		u8 event,
		bool event_successful
		);

/**
 * fmd_init() - Initialize the FM Driver internal structures.
 *
 * Returns:
 *	 0,  if no error.
 *	 -EIO, if there is an error.
 */
int fmd_init(void);

/**
 * fmd_exit() - De-initialize the FM Driver.
 */
void fmd_exit(void);

/**
 * fmd_register_callback() - Function to register callback function.
 *
 * This function registers the callback function provided by upper layers.
 * @callback: Fmradio call back Function pointer
 *
 * Returns:
 *	 0,  if no error.
 *	 -ENOEXEC, if preconditions are violated.
 *	 -EBUSY, if FM Driver is not in idle state.
 */
int fmd_register_callback(
			fmd_radio_cb callback
			);

/**
 * fmd_get_version() - Retrieves the FM HW and FW version.
 *
 * @version: (out) Version Array
 *
 *  Returns:
 *	 0,  if no error.
 *	 -ENOEXEC, if preconditions are violated.
 *	 -EINVAL, if parameters are not valid.
 *	 -EBUSY, if FM Driver is not in idle state.
 *	 -EINVAL, if wrong response received from chip.
 */
int fmd_get_version(
			u16 *version
			);

/**
 * fmd_set_mode() - Starts a transition to the given mode.
 *
 * @mode: Transition mode
 *
 *  Returns:
 *	 0,  if set mode done successfully.
 *	 -EINVAL, if parameter is invalid.
 *	 -ENOEXEC, if preconditions are violated.
 *	 -EINVAL, if wrong response received from chip.
 */
int fmd_set_mode(
			u8 mode
			);

/**
 * fmd_get_freq_range_properties() - Retrieves Freq Range Properties.
 *
 * @range: range of freq
 * @min_freq: (out) Minimum Frequency of the Band in kHz.
 * @max_freq: (out) Maximum Frequency of the Band in kHz
 *
 *  Returns:
 *	 0,  if no error.
 *	 -ENOEXEC, if preconditions are violated.
 *	 -EINVAL, if parameter is invalid.
 */
int fmd_get_freq_range_properties(
			u8 range,
			u32  *min_freq,
			u32  *max_freq
			);

/**
 * fmd_set_antenna() - Selects the antenna to be used in receive mode.
 *
 * embedded - Selects the embedded antenna, wired- Selects the wired antenna.
 * @antenna: Antenna Type
 *
 *  Returns:
 *	 0,  if set antenna done successfully.
 *	 -EINVAL, if parameter is invalid.
 *	 -ENOEXEC, if preconditions are violated.
 *	 -EBUSY, if FM Driver is not in idle state.
 *	 -EINVAL, if wrong response received from chip.
 */
int fmd_set_antenna(
			u8 antenna
			);

/**
 * fmd_get_antenna() - Retrieves the currently used antenna type.
 *
 * @antenna: (out) Antenna Selected on FM Radio.
 *
 *  Returns:
 *	 0,  if no error.
 *	 -ENOEXEC, if preconditions are violated.
 *	 -EBUSY, if FM Driver is not in idle state.
 */
int fmd_get_antenna(
			u8 *antenna
			);

/**
 * fmd_set_freq_range() - Sets the FM band.
 *
 * @range: freq range
 *
 *  Returns:
 *	 0,  if no error.
 *	 -EINVAL, if parameter is invalid.
 *	 -ENOEXEC, if preconditions are violated.
 *	 -EBUSY, if FM Driver is not in idle state.
 *	 -EINVAL, if wrong response received from chip.
 */
int fmd_set_freq_range(
			u8 range
			);

/**
 * fmd_get_freq_range() - Gets the FM band currently in use.
 *
 * @range: (out) Frequency Range set on FM Radio.
 *
 *  Returns:
 *	 0,  if no error.
 *	 -EINVAL, if parameter is invalid.
 *	 -ENOEXEC, if preconditions are violated.
 */
int fmd_get_freq_range(
			u8 *range
			);

/**
 * fmd_rx_set_grid() - Sets the tuning grid.
 *
 * @grid: Tuning grid size
 *
 *  Returns:
 *	 0,  if no error.
 *	 -EINVAL, if parameter is invalid.
 *	 -ENOEXEC, if preconditions are violated.
 *	 -EBUSY, if FM Driver is not in idle state.
 *	 -EINVAL, if wrong response received from chip.
 */
int fmd_rx_set_grid(
			u8 grid
			);

/**
 * fmd_rx_set_frequency() - Sets the FM Channel.
 *
 * @freq: Frequency to Set in Khz
 *
 *  Returns:
 *	 0,  if set frequency done successfully.
 *	 -EINVAL,  if parameters are invalid.
 *	 -ENOEXEC, if preconditions are violated.
 *	 -EBUSY, if FM Driver is not in idle state.
 *	 -EINVAL, if wrong response received from chip.
 */
int fmd_rx_set_frequency(
			u32 freq
			);

/**
 * fmd_rx_get_frequency() - Gets the currently used FM Channel.
 *
 * @freq: (out) Current Frequency set on FM Radio.
 *
 *  Returns:
 *	 0,  if no error.
 *	 -EINVAL,  if parameters are invalid.
 *	 -ENOEXEC, if preconditions are violated.
 *	 -EBUSY, if FM Driver is not in idle state.
 *	 -EINVAL, if wrong response received from chip.
 */
int fmd_rx_get_frequency(
			u32  *freq
			);

/**
 * fmd_rx_set_stereo_mode() - Sets the stereomode functionality.
 *
 * @mode: FMD_STEREOMODE_MONO, FMD_STEREOMODE_STEREO and
 *
 *  Returns:
 *	 0,  if no error.
 *	 -EINVAL, if parameter is invalid.
 *	 -ENOEXEC, if preconditions are violated.
 *	 -EBUSY, if FM Driver is not in idle state.
 *	 -EINVAL, if wrong response received from chip.
 */
int fmd_rx_set_stereo_mode(
			u8 mode
			);

/**
 * fmd_rx_set_stereo_ctrl_blending_rssi() - Sets the stereo blending control setting.
 *
 * @min_rssi: Defines the RF level (at the antenna pin) at which the stereo blending
 *			function will stop limiting the channel separation
 * @max_rssi: Defines the RF level (at the antenna pin) at which the stereo blending
 *			function will start limiting the channel separation.
 *
 *  Returns:
 *	 0,  if no error.
 *	 -EINVAL, if parameter is invalid.
 *	 -ENOEXEC, if preconditions are violated.
 *	 -EBUSY, if FM Driver is not in idle state.
 *	 -EINVAL, if wrong response received from chip.
 */
int fmd_rx_set_stereo_ctrl_blending_rssi(
			u16 min_rssi,
			u16 max_rssi
			);

/**
 * fmd_rx_get_stereo_mode() - Gets the currently used FM mode.
 *
 * FMD_STEREOMODE_MONO, FMD_STEREOMODE_STEREO and
 * FMD_STEREOMODE_AUTO.
 * @mode: (out) Mode set on FM Radio, stereo or mono.
 *
 *  Returns:
 *	 0,  if no error.
 *	 -EINVAL, if parameter is invalid.
 *	 -ENOEXEC, if preconditions are violated.
 *	 -EBUSY, if FM Driver is not in idle state.
 */
int fmd_rx_get_stereo_mode(
			u8 *mode
			);

/**
 * fmd_rx_get_signal_strength() - Gets the RSSI level of current frequency.
 *
 * @strength: (out) RSSI level of current channel.
 *
 *  Returns:
 *	 0,  if no error.
 *	 -EINVAL, if parameter is invalid.
 *	 -ENOEXEC, if preconditions are violated.
 *	 -EBUSY, if FM Driver is not in idle state.
 *	 -EINVAL, if wrong response received from chip.
 */
int fmd_rx_get_signal_strength(
			u16  *strength
			);

/**
 * fmd_rx_set_stop_level() - Sets the FM Rx Seek stop level.
 *
 * @stoplevel: seek stop level
 *
 *  Returns:
 *	 0,  if no error.
 *	 -ENOEXEC, if preconditions are violated.
 *	 -EBUSY, if FM Driver is not in idle state.
 */
int fmd_rx_set_stop_level(
			u16 stoplevel
			);

/**
 * fmd_rx_get_stop_level() - Gets the current FM Rx Seek stop level.
 *
 * @stoplevel: (out) RSSI Threshold set on FM Radio.
 *
 *  Returns:
 *	 0,  if no error.
 *	 -EINVAL, if parameter is invalid.
 *	 -ENOEXEC, if preconditions are violated.
 *	 -EBUSY, if FM Driver is not in idle state.
 */
int fmd_rx_get_stop_level(
			u16  *stoplevel
			);

/**
 * fmd_rx_seek() - Perform FM Seek.
 *
 * Starts searching relative to the actual channel with
 * a specific direction, stop.
 *  level and optional noise levels
 * @upwards: scan up
 *
 *  Returns:
 *	 0,  if seek started successfully.
 *	 -ENOEXEC, if preconditions are violated.
 *	 -EBUSY, if FM Driver is not in idle state.
 *	 -EINVAL, if wrong response received from chip.
 */
int fmd_rx_seek(
			bool upwards
			);

/**
 * fmd_rx_stop_seeking() - Stops a currently active seek or scan band.
 *
 *  Returns:
 *	 0,  if stop seek done successfully.
 *	 -ENOEXEC, if preconditions are violated.
 *	 -ENOEXEC, if FM Driver is
 * not currently in Seek or Scan State..
 *	 -EINVAL, if wrong response received from chip.
 */
int fmd_rx_stop_seeking(void);

/**
 * fmd_rx_af_update_start() - Perform AF update.
 *
 * This is used to switch to a shortly tune to a AF freq,
 * measure its RSSI and tune back to the original frequency.
 * @freq: Alternative frequncy in KHz to be set for AF updation.
 *
 *  Returns:
 * -EBUSY, if FM Driver is not in idle state.
 * 0,  if no error.
 * -ENOEXEC, if preconditions are violated.
 */
int fmd_rx_af_update_start(
			 u32 freq
			 );

/**
 * fmd_rx_get_af_update_result() - Retrive result of AF update.
 *
 * Retrive the RSSI level of the Alternative frequency.
 * @af_level: RSSI level of the Alternative frequency.
 *
 * Returns:
 * -EBUSY, if FM Driver is not in idle state.
 * 0,  if no error.
 * -EINVAL, if parameter is invalid.
 * -ENOEXEC, if preconditions are violated.
 */
int fmd_rx_get_af_update_result(
			 u16 *af_level
			 );

/**
 * fmd_af_switch_start() -Performs AF switch.
 *
 * @freq: Frequency to Set in Khz.
 * @picode:programable id,unique for each station.
 *
 *  Returns:
 * -EBUSY, if FM Driver is not in idle state.
 * 0,  if no error and if AF switch started successfully.
 * -ENOEXEC, if preconditions are violated.
 */
int fmd_rx_af_switch_start(
			u32 freq,
			u16  picode
			);

/**
 * fmd_rx_get_af_switch_results() -Retrieves the results of AF Switch.
 *
 * @afs_conclusion: Conclusion of AF switch.
 * @afs_level: RSSI level of the Alternative frequnecy.
 * @afs_pi: PI code of the alternative channel (if found).
 *
 * Returns:
 * -EBUSY, if FM Driver is not in idle state.
 * 0,  if no error.
 * -EINVAL, if parameter is invalid.
 * -ENOEXEC, if preconditions are violated.
 */
int fmd_rx_get_af_switch_results(
			 u16 *afs_conclusion,
			 u16 *afs_level,
			 u16 *afs_pi
			 );

/**
 * fmd_rx_scan_band() - Starts Band Scan.
 *
 * Starts scanning the active band for the strongest
 * channels above a threshold.
 * @max_channels_to_scan: Maximum number of channels to scan.
 *
 * Returns:
 *   0,  if scan band started successfully.
 *   -ENOEXEC, if preconditions are violated.
 *   -EBUSY, if FM Driver is not in idle state.
 *   -EINVAL, if wrong response received from chip.
 */
int fmd_rx_scan_band(
			u8 max_channels_to_scan
			);

/**
 * fmd_rx_get_max_channels_to_scan() - Retreives the maximum channels.
 *
 * Retrieves the maximum number of channels that can be found during
 * band scann.
 * @max_channels_to_scan: (out) Maximum number of channels to scan.
 *
 * Returns:
 *   -EBUSY, if FM Driver is not in idle state.
 *   -EINVAL, if parameter is invalid.
 *   -EINVAL, if wrong response received from chip.
 */
int fmd_rx_get_max_channels_to_scan(
			u8 *max_channels_to_scan
			);

/**
 * fmd_rx_get_scan_band_info() - Retrieves Channels found during scanning.
 *
 * Retrieves the scanned active band
 * for the strongest channels above a threshold.
 * @index: (out) Index value to retrieve the channels.
 * @numchannels: (out) Number of channels found during Band Scan.
 * @channels: (out) Channels found during band scan.
 * @rssi: (out) Rssi of channels found during Band scan.
 *
 * Returns:
 *   0,  if no error.
 *   -ENOEXEC, if preconditions are violated.
 *   -EINVAL, if parameter is invalid.
 *   -EINVAL, if wrong response received from chip.
 */
int fmd_rx_get_scan_band_info(
			u32 index,
			u16  *numchannels,
			u16  *channels,
			u16  *rssi
			);

/**
 * fmd_block_scan() - Starts Block Scan.
 *
 * Starts block scan for retriving the RSSI level of channels
 * in the given block.
 * @start_freq: Starting frequency of the block from where scanning has
 * to be started.
 * @stop_freq: End frequency of the block to be scanned.
 * @antenna: Antenna to be used during scanning.
 *
 * Returns:
 *   0,  if scan band started successfully.
 *   -EINVAL,  if parameters are invalid.
 *   -ENOEXEC, if preconditions are violated.
 *   -EBUSY, if FM Driver is not in idle state.
 *   -EINVAL, if wrong response received from chip.
 */
int fmd_block_scan(
			u32 start_freq,
			u32 stop_freq,
			u8 antenna
			);

/**
 * fmd_get_block_scan_result() - Retrieves RSSI Level of channels.
 *
 * Retrieves the RSSI level of the channels in the block.
 * @index: (out) Index value to retrieve the channels.
 * @numchannels: (out) Number of channels found during Band Scan.
 * @rssi: (out) Rssi of channels found during Band scan.
 *
 * Returns:
 *   0,  if no error.
 *   -ENOEXEC, if preconditions are violated.
 *   -EINVAL, if parameter is invalid.
 *   -EINVAL, if wrong response received from chip.
 */
int fmd_get_block_scan_result(
			u32 index,
			u16 *numchannels,
			u16 *rssi
			);

/**
 * fmd_rx_get_rds() - Gets the current status of RDS transmission.
 *
 * @on: (out) RDS status
 *
 *  Returns:
 *   0,  if no error.
 *   -ENOEXEC, if preconditions are violated.
 *   -EINVAL, if parameter is invalid.
 *   -EBUSY, if FM Driver is not in idle state.
 */
int fmd_rx_get_rds(
			bool  *on
			);

/**
 * fmd_rx_buffer_set_size() - Sets the number of groups that the data buffer.
 * can contain and clears the buffer.
 *
 * @size: buffer size
 *
 * Returns:
 *   0,  if no error.
 *   -ENOEXEC, if preconditions are violated.
 *   -EBUSY, if FM Driver is not in idle state.
 *   -EINVAL, if wrong response received from chip.
 */
int fmd_rx_buffer_set_size(
			u8 size
			);

/**
 * fmd_rx_buffer_set_threshold() - RDS Buffer Threshold level in FM Chip.
 *
 * Sets the group number at which the RDS buffer full interrupt must be
 * generated. The interrupt will be set after reception of the group.
 * @threshold: threshold level.
 *
 * Returns:
 *   0,  if no error.
 *   -ENOEXEC, if preconditions are violated.
 *   -EBUSY, if FM Driver is not in idle state.
 *   -EINVAL, if wrong response received from chip.
 */
int fmd_rx_buffer_set_threshold(
			u8 threshold
			);

/**
 * fmd_rx_set_rds() - Enables or disables demodulation of RDS data.
 *
 * @on_off_state : Rx Set ON/OFF control
 *
 * Returns:
 *   0,  if no error.
 *   -ENOEXEC, if preconditions are violated.
 *   -EBUSY, if FM Driver is not in idle state.
 *   -EINVAL, if wrong response received from chip.
 */
int fmd_rx_set_rds(
			u8 on_off_state
			);

/**
 * fmd_rx_set_rds_group_rejection() - Enables or disables group rejection
 * in case groups with erroneous blocks are received.
 *
 * @on_off_state : Rx Group Rejection ON /OFF control
 *
 * Returns:
 *   0,  if no error.
 *   -ENOEXEC, if preconditions are violated.
 *   -EBUSY, if FM Driver is not in idle state.
 *   -EINVAL, if wrong response received from chip.
 */

int fmd_rx_set_rds_group_rejection(
			u8 on_off_state
			);

/**
 * fmd_rx_get_low_level_rds_groups() - Gets Low level RDS group data.
 *
 * @index: RDS group index
 * @block1: (out) RDS Block 1
 * @block2: (out) RDS Block 2
 * @block3: (out) RDS Block 3
 * @block4: (out) RDS Block 4
 * @status1: (out) RDS data status 1
 * @status2: (out) RDS data status 2
 * @status3: (out) RDS data status 3
 * @status4: (out) RDS data status 4
 *
 *  Returns:
 *   0,  if no error.
 *   -ENOEXEC, if preconditions are violated.
 *   -EINVAL, if parameter is invalid.
 *   -EBUSY, if FM Driver is not in idle state.
 */
int fmd_rx_get_low_level_rds_groups(
			u8 index,
			u16  *block1,
			u16  *block2,
			u16  *block3,
			u16  *block4,
			u8  *status1,
			u8  *status2,
			u8  *status3,
			u8  *status4
			);

/**
 * fmd_tx_set_pa() - Enables or disables the Power Amplifier.
 *
 * @on: Power Amplifier current state to set
 *
 * Returns:
 *   0,  if set Power Amplifier done successfully.
 *   -ENOEXEC, if preconditions are violated.
 *   -EBUSY, if FM Driver is not in idle state.
 *   -EINVAL, if wrong response received from chip.
 */
int fmd_tx_set_pa(
			bool on
			);

/**
 * fmd_tx_set_signal_strength() - Sets the RF-level of the output FM signal.
 *
 * @strength: Signal strength to be set for FM Tx in dBuV.
 *
 * Returns:
 *   0,  if set RSSI Level done successfully.
 *   -ENOEXEC, if preconditions are violated.
 *   -EINVAL, if parameter is invalid.
 *   -EBUSY, if FM Driver is not in idle state.
 *   -EINVAL, if wrong response received from chip.
 */
int fmd_tx_set_signal_strength(
			u16 strength
			);

/**
 * fmd_tx_get_signal_strength() - Retrieves current RSSI of FM Tx.
 *
 * @strength: (out) Strength of signal being transmitted in dBuV.
 *
 * Returns:
 *   0,  if no error.
 *   -EINVAL, if parameter is invalid.
 *   -ENOEXEC, if preconditions are violated.
 *   -EBUSY, if FM Driver is not in idle state.
 */
int fmd_tx_get_signal_strength(
			u16  *strength
			);

/**
 * fmd_tx_set_freq_range() - Sets the FM band and specifies the custom band.
 *
 * @range: Freq range to set on FM Tx.
 *
 * Returns:
 *   0,  if no error.
 *   -EINVAL, if parameter is invalid.
 *   -ENOEXEC, if preconditions are violated.
 *   -EBUSY, if FM Driver is not in idle state.
 *   -EINVAL, if wrong response received from chip.
 */
int fmd_tx_set_freq_range(
			u8 range
			);

/**
 * fmd_tx_get_freq_range() - Gets the FM band currently in use.
 *
 * @range: (out) Frequency Range set on Fm Tx.
 *
 * Returns:
 *   0,  if no error.
 *   -ENOEXEC, if preconditions are violated.
 *   -EINVAL, if parameter is invalid.
 */
int fmd_tx_get_freq_range(
			u8 *range
			);

/**
 * fmd_tx_set_grid() - Sets the tuning grid size.
 *
 * @grid: FM Grid (50 Khz, 100 Khz, 200 Khz) to be set for FM Tx.
 *
 * Returns:
 *   0,  if no error.
 *   -EINVAL, if parameter is invalid.
 *   -ENOEXEC, if preconditions are violated.
 *   -EBUSY, if FM Driver is not in idle state.
 *   -EINVAL, if wrong response received from chip.
 */
int fmd_tx_set_grid(
			u8 grid
			);

/**
 * fmd_tx_get_grid() - Gets the current tuning grid size.
 *
 * @grid: (out) FM Grid (50 Khz, 100 Khz, 200 Khz) currently set on FM Tx.
 *
 * Returns:
 *   0,  if no error.
 *   -ENOEXEC, if preconditions are violated.
 *   -EINVAL, if parameter is invalid.
 *   -EBUSY, if FM Driver is not in idle state.
 */
int fmd_tx_get_grid(
			u8 *grid
			);

/**
 * fmd_tx_set_preemphasis() - Sets the Preemphasis characteristic of the Tx.
 *
 * @preemphasis: Pre-emphasis level to be set for FM Tx.
 *
 * Returns:
 *   0,  if no error.
 *   -ENOEXEC, if preconditions are violated.
 *   -EINVAL, if wrong response received from chip.
 */
int fmd_tx_set_preemphasis(
			u8 preemphasis
			);

/**
 * fmd_tx_get_preemphasis() - Gets the currently used Preemphasis char of th FM Tx.
 *
 * @preemphasis: (out) Preemphasis Level used for FM Tx.
 *
 * Returns:
 *   0,  if no error.
 *   -ENOEXEC, if preconditions are violated.
 *   -EINVAL, if parameter is invalid.
 *   -EBUSY, if FM Driver is not in idle state.
 */
int fmd_tx_get_preemphasis(
			u8 *preemphasis
			);

/**
 * fmd_tx_set_frequency() - Sets the FM Channel for Tx.
 *
 * @freq: Freq to be set for transmission.
 *
 * Returns:
 *   0,  if set frequency done successfully.
 *   -EINVAL,  if parameters are invalid.
 *   -ENOEXEC, if preconditions are violated.
 *   -EBUSY, if FM Driver is not in idle state.
 *   -EINVAL, if wrong response received from chip.
 */
int fmd_tx_set_frequency(
			u32 freq
			);

/**
 * fmd_rx_get_frequency() - Gets the currently used Channel for Tx.
 *
 * @freq: (out) Frequency set on FM Tx.
 *
 * Returns:
 *   0,  if no error.
 *   -EINVAL,  if parameters are invalid.
 *   -ENOEXEC, if preconditions are violated.
 *   -EBUSY, if FM Driver is not in idle state.
 *   -EINVAL, if wrong response received from chip.
 */
int fmd_tx_get_frequency(
			u32  *freq
			);

/**
 * fmd_tx_enable_stereo_mode() - Sets Stereo mode state for TX.
 *
 * @enable_stereo_mode: Flag indicating enabling or disabling Stereo mode.
 *
 * Returns:
 *   0,  if no error.
 *   -ENOEXEC, if preconditions are violated.
 *   -EBUSY, if FM Driver is not in idle state.
 *   -EINVAL, if wrong response received from chip.
 */
int fmd_tx_enable_stereo_mode(
			bool enable_stereo_mode
			);

/**
 * fmd_tx_get_stereo_mode() - Gets the currently used FM Tx stereo mode.
 *
 * @stereo_mode: (out) Stereo Mode state set on FM Tx.
 *
 * Returns:
 *   0,  if no error.
 *   -EINVAL, if parameter is invalid.
 *   -ENOEXEC, if preconditions are violated.
 *   -EBUSY, if FM Driver is not in idle state.
 */
int fmd_tx_get_stereo_mode(
			bool  *stereo_mode
			);

/**
 * fmd_tx_set_pilot_deviation() - Sets pilot deviation in HZ
 *
 * @deviation: Pilot deviation in HZ to set on FM Tx.
 *
 * Returns:
 *   0,  if no error.
 *   -ENOEXEC, if preconditions are violated.
 *   -EINVAL, if wrong response received from chip.
 */
int fmd_tx_set_pilot_deviation(
			u16 deviation
			);

/**
 * fmd_tx_get_pilot_deviation() - Retrieves the current pilot deviation.
 *
 * @deviation: (out) Pilot deviation set on FM Tx.
 *
 * Returns:
 *   0,  if no error.
 *   -ENOEXEC, if preconditions are violated.
 *   -EINVAL, if parameter is invalid.
 *   -EBUSY, if FM Driver is not in idle state.
 */
int fmd_tx_get_pilot_deviation(
			u16  *deviation
			);

/**
 * fmd_tx_set_rds_deviation() - Sets Rds deviation in HZ.
 *
 * @deviation: RDS deviation in HZ.
 *
 * Returns:
 *   0,  if no error.
 *   -ENOEXEC, if preconditions are violated.
 *   -EBUSY, if FM Driver is not in idle state.
 *   -EINVAL, if wrong response received from chip.
 */
int fmd_tx_set_rds_deviation(
			u16 deviation
			);

/**
 * fmd_tx_get_rds_deviation() - Retrieves the current Rds deviation.
 *
 * @deviation: (out) RDS deviation currently set.
 *
 * Returns:
 *   0,  if no error.
 *   -ENOEXEC, if preconditions are violated.
 *   -EINVAL, if parameter is invalid.
 *   -EBUSY, if FM Driver is not in idle state.
 */
int fmd_tx_get_rds_deviation(
			u16  *deviation
			);

/**
 * fmd_tx_set_rds() - Enables or disables RDS transmission for Tx.
 *
 * @on: Boolean - RDS ON
 *
 * Returns:
 *   0,  if no error.
 *   -ENOEXEC, if preconditions are violated.
 *   -EBUSY, if FM Driver is not in idle state.
 *   -EINVAL, if wrong response received from chip.
 */
int fmd_tx_set_rds(
			bool on
			);

/**
 * fmd_rx_get_rds() - Gets the current status of RDS transmission for FM Tx.
 *
 * @on: (out) Rds enabled or disabled.
 *
 *Returns:
 *   0,  if no error.
 *   -ENOEXEC, if preconditions are violated.
 *   -EINVAL, if parameter is invalid.
 *   -EBUSY, if FM Driver is not in idle state.
 */
int fmd_tx_get_rds(
			bool  *on
			);

/**
 * fmd_tx_set_group() - Programs a grp on a certain position in the RDS buffer.
 *
 * @position: RDS group position
 * @block1: Data to be transmitted in Block 1
 * @block2: Data to be transmitted in Block 2
 * @block3: Data to be transmitted in Block 3
 * @block4: Data to be transmitted in Block 4
 *
 * Returns:
 *   0,  if no error.
 *   -ENOEXEC, if preconditions are violated.
 *   -EBUSY, if FM Driver is not in idle state.
 *   -EINVAL, if parameters are invalid.
 *   -EINVAL, if wrong response received from chip.
 */
int fmd_tx_set_group(
			u16 position,
			u8  *block1,
			u8  *block2,
			u8  *block3,
			u8  *block4
			);

/**
 * fmd_tx_buffer_set_size() - Controls the size of the RDS buffer in groups.
 *
 * @buffer_size: RDS buffer size.
 *
 * Returns:
 *   0,  if no error.
 *   -ENOEXEC, if preconditions are violated.
 *   -EBUSY, if FM Driver is not in idle state.
 *   -EINVAL, if wrong response received from chip.
 */
int fmd_tx_buffer_set_size(
			u16 buffer_size
			);

/**
 * fmd_set_volume() - Sets the receive audio volume.
 *
 * @volume: Audio volume level
 *
 * Returns:
 *   0,  if no error.
 *   -ENOEXEC, if preconditions are violated.
 *   -EBUSY, if FM Driver is not in idle state.
 *   -EINVAL, if wrong response received from chip.
 */
int fmd_set_volume(
			u8 volume
			);

/**
 * fmd_get_volume() - Retrives the current audio volume.
 *
 * @volume: Analog Volume level.
 *
 * Returns:
 *   0,  if no error.
 *   -ENOEXEC, if preconditions are violated.
 *   -EINVAL, if parameter is invalid.
 *   -EBUSY, if FM Driver is not in idle state.
 */
int fmd_get_volume(
			u8 *volume
			);

/**
 * fmd_set_balance() - Controls the receiver audio balance.
 *
 * @balance: Audio balance level
 *
 * Returns:
 *   0,  if no error.
 *   -ENOEXEC, if preconditions are violated.
 *   -EBUSY, if FM Driver is not in idle state.
 *   -EINVAL, if wrong response received from chip.
 */
int fmd_set_balance(
			s8 balance
			);

/**
 * fmd_set_mute() - Enables or disables muting of the analog audio(DAC).
 *
 * @mute_on: bool of mute on
 *
 * Returns:
 *   0,  if mute done successfully.
 *   -ENOEXEC, if preconditions are violated.
 *   -EBUSY, if FM Driver is not in idle state.
 *   -EINVAL, if wrong response received from chip.
 */
int fmd_set_mute(
			bool mute_on
			);

/**
 * fmd_ext_set_mute() - Enables or disables muting of the audio channel.
 *
 * @mute_on: bool to Mute
 *
 * Returns:
 *   0,  if no error.
 *   -ENOEXEC, if preconditions are violated.
 *   -EBUSY, if FM Driver is not in idle state.
 *   -EINVAL, if wrong response received from chip.
 */
int fmd_ext_set_mute(
			bool mute_on
			);

/**
 * fmd_power_up() - Puts the system in Powerup state.
 *
 * Returns:
 *   0,  if power up command sent successfully to chip.
 *   -ENOEXEC, if preconditions are violated.
 *   -EINVAL, if wrong response received from chip.
 */
int fmd_power_up(void);

/**
 * fmd_goto_standby() - Puts the system in standby mode.
 *
 * Returns:
 *   0,  if no error.
 *   -ENOEXEC, if preconditions are violated.
 *   -EINVAL, if wrong response received from chip.
 */
int fmd_goto_standby(void);

/**
 * fmd_goto_power_down() - Puts the system in Powerdown mode.
 *
 * Returns:
 *   0,  if no error.
 *   -ENOEXEC, if preconditions are violated.
 *   -EINVAL, if wrong response received from chip.
 */
int fmd_goto_power_down(void);

/**
 * fmd_select_ref_clk() - Selects the FM reference clock.
 *
 * @ref_clk: Ref Clock.
 *
 * Returns:
 *   0,  if no error.
 *   -ENOEXEC, if preconditions are violated.
 *   -EBUSY, if FM Driver is not in idle state.
 *   -EINVAL, if wrong response received from chip.
 */
int fmd_select_ref_clk(
			u16 ref_clk
			);

/**
 * fmd_set_ref_clk_pll() - Sets the freq of Referece Clock.
 *
 * Sets frequency and offset correction properties of the external
 * reference clock of the PLL
 * @freq: PLL Frequency/ 2 in kHz.
 *
 * Returns:
 *   0,  if no error.
 *   -ENOEXEC, if preconditions are violated.
 *   -EBUSY, if FM Driver is not in idle state.
 *   -EINVAL, if wrong response received from chip.
 */
int fmd_set_ref_clk_pll(
			u16 freq
			);

/**
 * fmd_send_fm_ip_enable()- Enables the FM IP.
 *
 * Returns:
 *	 0: If there is no error.
 *	 -ETIME: Otherwise
 */
int fmd_send_fm_ip_enable(void);

/**
 * fmd_send_fm_ip_disable()- Disables the FM IP.
 *
 * Returns:
 *	 0, If there is no error.
 *	 -ETIME: Otherwise
 */
int fmd_send_fm_ip_disable(void);

/**
 * fmd_send_fm_firmware() - Send the FM Firmware File to Device.
 *
 * @fw_buffer: Firmware to be downloaded.
 * @fw_size: Size of firmware to be downloaded.
 *
 * Returns:
 *	 0, If there is no error.
 *	 -ETIME: Otherwise
 */
int fmd_send_fm_firmware(
			u8 *fw_buffer,
			u16 fw_size
			);

/**
 * fmd_int_bufferfull() - RDS Groups availabe for reading by Host.
 *
 * Gets the number of groups that are available in the
 * buffer. This function is called in RX mode to read RDS groups.
 * @number_of_rds_groups: Number of RDS groups ready to
 * be read from the Host.
 *
 * Returns:
 *	 0, If there is no error.
 *	 corresponding error Otherwise
 */
int fmd_int_bufferfull(
			u16 *number_of_rds_groups
			);

/**
 * fmd_start_rds_thread() - Starts the RDS Thread for receiving RDS Data.
 *
 * This is started by Application when it wants to receive RDS Data.
 * @cb_func: Callback function for receiving RDS Data
 */
void fmd_start_rds_thread(
			cg2900_fm_rds_cb cb_func
			);
/**
 * fmd_stop_rds_thread() - Stops the RDS Thread when Application does not
 * want to receive RDS.
 */
void fmd_stop_rds_thread(void);

/**
 * fmd_get_rds_sem() - Block on RDS Semaphore.
 * Till irpt_BufferFull is received, RDS Task is blocked.
 */
void fmd_get_rds_sem(void);

/**
 * fmd_set_rds_sem() - Unblock on RDS Semaphore.
 * on receiving  irpt_BufferFull, RDS Task is un-blocked.
 */
void fmd_set_rds_sem(void);

/**
 * fmd_set_dev() - Set FM device.
 *
 * @dev: FM Device
 *
 * Returns:
 *	 0, If there is no error.
 *	 corresponding error Otherwise
 */
int fmd_set_dev(
			struct device *dev
			);

/**
 * fmd_set_test_tone_generator_status()- Sets the Test Tone Generator.
 *
 * This function is used to enable/disable the Internal Tone Generator of
 * CG2900.
 * @test_tone_status: Status of tone generator.
 *
 * Returns:
 *	 0,  if operation completed successfully.
 *	 -EINVAL, otherwise.
 */
int fmd_set_test_tone_generator_status(
			u8 test_tone_status
			);

/**
 * fmd_test_tone_connect()- Connect Audio outputs/inputs.
 *
 * This function connects the audio outputs/inputs of the
 * Internal Tone Generator of CG2900.
 * @left_audio_mode: Left Audio Output Mode.
 * @right_audio_mode: Right Audio Output Mode.
 *
 * Returns:
 *	 0,  if operation completed successfully.
 *	 -EINVAL, otherwise.
 */
int fmd_test_tone_connect(
			u8 left_audio_mode,
			u8 right_audio_mode
			);

/**
 * fmd_test_tone_set_params()- Sets the Test Tone Parameters.
 *
 * This function is used to set the parameters of
 * the Internal Tone Generator of CG2900.
 * @tone_gen: Tone to be configured (Tone 1 or Tone 2)
 * @frequency: Frequency of the tone.
 * @volume: Volume of the tone.
 * @phase_offset: Phase offset of the tone.
 * @dc: DC to add to tone.
 * @waveform: Waveform to generate, sine or pulse.
 *
 * Returns:
 *	 0,  if operation completed successfully.
 *	 -EINVAL, otherwise.
 */
int fmd_test_tone_set_params(
			u8 tone_gen,
			u16 frequency,
			u16 volume,
			u16 phase_offset,
			u16 dc,
			u8 waveform
			);

/**
 * fmd_rx_set_deemphasis()- Connect Audio outputs/inputs.
 *
 * This function sets the de-emphasis filter to the
 * specified de-empahsis level.
 * @deemphasis: De-emphasis level to set.
 *
 * Returns:
 *	 0,  if operation completed successfully.
 *	 -EINVAL, otherwise.
 */
int fmd_rx_set_deemphasis(
			u8 deemphasis
			);

/**
 * fmd_limiter_setcontrol()- Sets the Limiter Controls.
 *
 * This function sets the limiter control.
 * @audio_deviation: Limiting level of Audio Deviation.
 * @notification_hold_off_time: Minimum time between
 * two limiting interrupts.
 *
 * Returns:
 *	 0,  if operation completed successfully.
 *	 -EINVAL, otherwise.
 */
int fmd_limiter_setcontrol(
			u16 audio_deviation,
			u16 notification_hold_off_time
			);

#endif /* _FMDRIVER_H_  */