aboutsummaryrefslogtreecommitdiff
path: root/drivers/media/radio/CG2900/fmdriver.h
blob: 28ab6c649e49a779ef2f13d66da5fc7e82f29635 (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
/*
 * 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_

#define IRPT_INVALID					0x0000
#define IRPT_OPERATIONSUCCEEDED				0x0001
#define IRPT_OPERATIONFAILED				0x0002
#define IRPT_RX_BUFFERFULL_TX_BUFFEREMPTY		0x0008
#define IRPT_RX_SIGNALQUALITYLOW_MUTE_STATUS_CHANGED	0x0010
#define IRPT_RX_MONOSTEREO_TRANSITION	0x0020
#define IRPT_TX_OVERMODULATION	0x0030
#define IRPT_RX_RDSSYNCFOUND_TX_OVERDRIVE		0x0040
#define IRPT_RDSSYNCLOST				0x0080
#define IRPT_PICODECHANGED				0x0100
#define IRPT_REQUESTEDBLOCKAVAILABLE			0x0200
#define IRPT_BUFFER_CLEARED				0x2000
#define IRPT_WARMBOOTREADY				0x4000
#define IRPT_COLDBOOTREADY				0x8000

#define CMD_AIP_BT_SETCONTROL				0x01A6
#define CMD_AIP_BT_SETMODE				0x01E6
#define CMD_AIP_FADE_START				0x0046
#define CMD_AIP_LEVEL_GETSTATUS				0x0106
#define CMD_AIP_LEVEL_SETMODE				0x00E6
#define CMD_AIP_OVERDRIVE_SETCONTROL			0x0166
#define CMD_AIP_OVERDRIVE_SETMODE			0x0126
#define CMD_AIP_SETAUDIOADC				0x00A6
#define CMD_AIP_SETAUDIOADC_CONTROL			0x00C6
#define CMD_AIP_SETBALANCE				0x0086
#define CMD_AIP_SETGAIN					0x0066
#define CMD_AIP_SETMIXER				0x0146
#define CMD_AIP_SETMODE					0x01C6
#define CMD_AUP_BT_SETBALANCE				0x0142
#define CMD_AUP_BT_SETCONTROL				0x00E2
#define CMD_AUP_BT_SETMODE				0x00C2
#define CMD_AUP_BT_SETVOLUME				0x0122
#define CMD_AUP_EXT_SETCONTROL				0x0182
#define CMD_AUP_EXT_SETMODE				0x0162
#define CMD_AUP_EXT_FADESTART				0x0102
#define CMD_AUP_EXT_SETMUTE				0x01E2
#define CMD_AUP_FADE_START				0x00A2
#define CMD_AUP_SETAUDIODAC				0x0082
#define CMD_AUP_SETBALANCE				0x0042
#define CMD_AUP_SETMUTE					0x0062
#define CMD_AUP_SETVOLUME				0x0022
#define CMD_FMR_DP_BLOCKREQUEST_CONTROL			0x0583
#define CMD_FMR_DP_BLOCKREQUEST_GETBLOCK		0x05A3
#define CMD_FMR_DP_BUFFER_GETGROUP			0x0303
#define CMD_FMR_DP_BUFFER_GETGROUPCOUNT			0x0323
#define CMD_FMR_DP_BUFFER_SETSIZE			0x0343
#define CMD_FMR_DP_BUFFER_SETTHRESHOLD			0x06C3
#define CMD_FMR_DP_GETSTATE				0x0283
#define CMD_FMR_DP_PICORRELATION_SETCONTROL		0x0363
#define CMD_FMR_DP_QUALITY_GETRESULT			0x05E3
#define CMD_FMR_DP_QUALITY_START			0x05C3
#define CMD_FMR_DP_SETCONTROL				0x02A3
#define CMD_FMR_DP_SETEBLOCKREJECTION			0x02E3
#define CMD_FMR_DP_SETGROUPREJECTION			0x0543
#define CMD_FMR_GETSTATE				0x04E3
#define CMD_FMR_RP_GETRSSI				0x0083
#define CMD_FMR_RP_GETSTATE				0x0063
#define CMD_FMR_RP_HIGHCUT_SETCONTROL			0x0263
#define CMD_FMR_RP_HIGHCUT_SETMODE			0x0243
#define CMD_FMR_RP_SETDEEMPHASIS			0x00C3
#define CMD_FMR_RP_SETRSSIQUALITYTHRESHOLD		0x00A3
#define CMD_FMR_RP_SOFTMUTE_SETCONTROL			0x0223
#define CMD_FMR_RP_SOFTMUTE_SETMODE			0x0203
#define CMD_FMR_RP_STEREO_SETCONTROL_BLENDINGPILOT 	0x0163
#define CMD_FMR_RP_STEREO_SETCONTROL_BLENDINGRSSI 	0x0143
#define CMD_FMR_RP_STEREO_SETMODE			0x0123
#define CMD_FMR_RP_THRESHOLDEXTENSION_SETCONTROL 	0x0103
#define CMD_FMR_RP_THRESHOLDEXTENSION_SETMODE		0x00E3
#define CMD_FMR_RP_XSTEREO_SETCONTROL			0x01E3
#define CMD_FMR_RP_XSTEREO_SETMODE			0x01C3
#define CMD_FMR_SETANTENNA				0x0663
#define CMD_FMR_SETCOEXFILTER				0x06E3
#define CMD_FMR_SETPROCESSINGMODE			0x0643
#define CMD_FMR_SP_AFSWITCH_GETRESULT			0x0603
#define CMD_FMR_SP_AFSWITCH_START			0x04A3
#define CMD_FMR_SP_AFUPDATE_GETRESULT			0x0483
#define CMD_FMR_SP_AFUPDATE_START			0x0463
#define CMD_FMR_SP_BLOCKSCAN_GETRESULT			0x06A3
#define CMD_FMR_SP_BLOCKSCAN_START			0x0683
#define CMD_FMR_SP_PRESETPI_GETRESULT			0x0623
#define CMD_FMR_SP_PRESETPI_START			0x0443
#define CMD_FMR_SP_SCAN_GETRESULT			0x0423
#define CMD_FMR_SP_SCAN_START				0x0403
#define CMD_FMR_SP_SEARCH_START				0x03E3
#define CMD_FMR_SP_SEARCHPI_START			0x0703
#define CMD_FMR_SP_STOP					0x0383
#define CMD_FMR_SP_TUNE_GETCHANNEL			0x03A3
#define CMD_FMR_SP_TUNE_SETCHANNEL			0x03C3
#define CMD_FMR_SP_TUNE_STEPCHANNEL			0x04C3
#define CMD_FMR_TN_SETBAND				0x0023
#define CMD_FMR_TN_SETGRID				0x0043
#define CMD_FMR_TN_SETINJECTIONMODE			0x0523
#define CMD_FMR_TN_SETINJECTIONMODEAFUPDATE		0x0563
#define CMD_FMT_DP_BUFFER_GETPOSITION			0x0204
#define CMD_FMT_DP_BUFFER_SETGROUP			0x0244
#define CMD_FMT_DP_BUFFER_SETSIZE			0x0224
#define CMD_FMT_DP_BUFFER_SETTHRESHOLD			0x0284
#define CMD_FMT_DP_SETCONTROL				0x0264
#define CMD_FMT_GETSTATE				0x0084
#define CMD_FMT_PA_SETCONTROL				0x01A4
#define CMD_FMT_PA_SETMODE				0x01E4
#define CMD_FMT_RP_LIMITER_SETCONTROL			0x01C4
#define CMD_FMT_RP_LIMITER_SETMODE			0x0124
#define CMD_FMT_RP_LIMITER_SETTIMING			0x02C4
#define CMD_FMT_RP_MUTE_SETCONTROL			0x0104
#define CMD_FMT_RP_MUTE_SETCONTROL_BEEP			0x0304
#define CMD_FMT_RP_MUTE_SETMODE				0x00E4
#define CMD_FMT_RP_SETPILOTDEVIATION			0x02A4
#define CMD_FMT_RP_SETPREEMPHASIS			0x00C4
#define CMD_FMT_RP_SETRDSDEVIATION			0x0344
#define CMD_FMT_RP_STEREO_SETMODE			0x0164
#define CMD_FMT_SETCOEXFILTER				0x02E4
#define CMD_FMT_SP_TUNE_GETCHANNEL			0x0184
#define CMD_FMT_SP_TUNE_SETCHANNEL			0x0064
#define CMD_FMT_TN_DUALCHANNEL_SETCONTROL		0x0384
#define CMD_FMT_TN_DUALCHANNEL_SETMODE			0x0364
#define CMD_FMT_TN_SETBAND				0x0024
#define CMD_FMT_TN_SETGRID				0x0044
#define CMD_FMT_TN_SETINJECTIONMODE			0x0144
#define CMD_GEN_ANTENNA_GETINFO				0x02C1
#define CMD_GEN_ANTENNACHECK_START			0x02A1
#define CMD_GEN_COHABITATION_ASK			0x01E1
#define CMD_GEN_COHABITATION_SETMODE			0x01C1
#define CMD_GEN_COMMANDINVALID				0x1001
#define CMD_GEN_GETMODE					0x0021
#define CMD_GEN_GETREGISTERVALUE			0x00E1
#define CMD_GEN_GETVERSION				0x00C1
#define CMD_GEN_GOTOMODE				0x0041
#define CMD_GEN_GOTOPOWERDOWN				0x0081
#define CMD_GEN_GOTOSTANDBY				0x0061
#define CMD_GEN_POWERUP					0x0141
#define CMD_GEN_PARAMETERINVALID			0x0FE1
#define CMD_GEN_POWERSUPPLY_SETMODE			0x0221
#define CMD_GEN_SELECTREFERENCECLOCK			0x0201
#define CMD_GEN_SETPROCESSINGCLOCK			0x0241
#define CMD_GEN_SETPROCESSPARAMETERS			0x0261
#define CMD_GEN_SETPRODUCTIONTESTMODE			0x0181
#define CMD_GEN_SETREFERENCECLOCK			0x0161
#define CMD_GEN_SETREFERENCECLOCKPLL			0x01A1
#define CMD_GEN_SETREGISTERVALUE			0x0101
#define CMD_GEN_SETTEMPERATURE				0x0281
#define CMD_TST_FPGA_SETDELTAPHI			0x0127
#define CMD_TST_FPGA_SETFSCOR				0x0107
#define CMD_TST_FPGA_SETRSSI				0x00E7
#define CMD_TST_STRESS_START				0x00A7
#define CMD_TST_STRESS_STOP				0x00C7
#define CMD_TST_TONE_CONNECT				0x0047
#define CMD_TST_TONE_ENABLE				0x0027
#define CMD_TST_TONE_GETFSCOR				0x0087
#define CMD_TST_TONE_SETPAR				0x0067
#define CMD_TST_TX_RAMP_START				0x0147

#define ST_WRITE_FILE_BLK_SIZE				254
#define CATENA_OPCODE					0xFE

#define FM_WRITE					0x00
#define FM_READ						0x01

/* HCI Events  */
#define HCI_COMMAND_COMPLETE_EVENT			0x0E
#define HCI_VS_DBG_EVENT				0xFF

/* HCI Packets indicators  */
#define HCI_PACKET_INDICATOR_CMD			0x01
 #define HCI_PACKET_INDICATOR_EVENT			0x04
 #define HCI_PACKET_INDICATOR_FM_CMD_EVT		0x08

/* HCI Command opcodes  */
#define HCI_CMD_FM					0xFD50
#define HCI_CMD_VS_WRITE_FILE_BLOCK			0xFC2E
#define FM_EVENT					0x15

#define FM_FUNCTION_ENABLE				0x00
#define FM_FUNCTION_DISABLE				0x01
#define FM_FUNCTION_RESET				0x02
#define FM_FUNCTION_WRITECOMMAND			0x10
#define FM_FUNCTION_SETINTMASKALL			0x20
#define FM_FUNCTION_GETINTMASKALL			0x21
#define FM_FUNCTION_SETINTMASK				0x22
#define FM_FUNCTION_GETINTMASK				0x23
#define FM_FUNCTION_FMFWDOWNLOAD			0x30

/*  FM status in return parameter Size: 1 Byte */

/* 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_UNKOWNFILE_TYPE			0xF2
/* File version mismatch for FM FW download command */
#define FM_CMD_STATUS_FILE_VERSION_MISMATCH		0xF3

/**
 * enum fmd_status_t - Status of some operations.
 * @FMD_RESULT_SUCCESS: Current operation is completed with success.
 * @FMD_RESULT_PRECONDITIONS_VIOLATED: Frequency has been changed.
 * @FMD_RESULT_PARAMETER_INVALID: Frequency Range has been changed.
 * @FMD_RESULT_IO_ERROR: Seek operation has completed.
 * @FMD_RESULT_FEATURE_UNSUPPORTED: Band Scan Completed.
 * @FMD_RESULT_BUSY: Block Scan completed.
 * @FMD_RESULT_ONGOING: Af Update or AF Switch is complete.
 * stopped.
 * @FMD_RESULT_RESPONSE_WRONG: FM IP Powerup has been powered up.
 * Various status returned for any operation by FM Driver.
 */
enum fmd_status_t {
	FMD_RESULT_SUCCESS,
	FMD_RESULT_PRECONDITIONS_VIOLATED,
	FMD_RESULT_PARAMETER_INVALID,
	FMD_RESULT_IO_ERROR,
	FMD_RESULT_FEATURE_UNSUPPORTED,
	FMD_RESULT_BUSY,
	FMD_RESULT_ONGOING,
	FMD_RESULT_RESPONSE_WRONG
};

/**
 * enum fmd_event_t - Events received.
 * @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_MONOSTEREO_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_t {
	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_MONOSTEREO_TRANSITION_COMPLETE,
	FMD_EVENT_SEEK_STOPPED,
	FMD_EVENT_GEN_POWERUP,
	FMD_EVENT_RDSGROUP_RCVD,
	FMD_EVENT_LAST_ELEMENT
};

/**
 * enum fmd_mode_t - 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_t {
	FMD_MODE_IDLE,
	FMD_MODE_RX,
	FMD_MODE_TX
};

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

/**
 * enum fmd_grid_t - 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_t {
	FMD_GRID_50KHZ,
	FMD_GRID_100KHZ,
	FMD_GRID_200KHZ
};

/**
 * enum fmd_emphasis_t - De-emphasis/Pre-emphasis level.
 * @FMD_EMPHASIS_50US: 50 us de-emphasis/pre-emphasis level.
 * @FMD_EMPHASIS_75US: 100 us de-emphasis/pre-emphasi level.
 * De-emphasis/Pre-emphasis level used on FM Radio.
 */
enum fmd_emphasis_t {
	FMD_EMPHASIS_50US,
	FMD_EMPHASIS_75US
};

/**
 * enum fmd_freq_range_t - 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_t {
	FMD_FREQRANGE_EUROAMERICA,
	FMD_FREQRANGE_JAPAN,
	FMD_FREQRANGE_CHINA
};

/**
 * enum fmd_stereo_mode_t - 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_t {
	FMD_STEREOMODE_OFF,
	FMD_STEREOMODE_MONO,
	FMD_STEREOMODE_BLENDING
};

/*Remove the below two enum w.r.t audio_config redundancy*/

 /**
 * enum fmd_output_t - 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_t {
	FMD_OUTPUT_DISABLED,
	FMD_OUTPUT_I2S,
	FMD_OUTPUT_PARALLEL
};

 /**
 * enum fmd_input_t - 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_t {
	FMD_INPUT_ANALOG,
	FMD_INPUT_DIGITAL
};


/**
* enum fmd_rds_mode_t - 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_t {
	FMD_SWITCH_OFF_RDS,
	FMD_SWITCH_ON_RDS,
	FMD_SWITCH_ON_RDS_ENHANCED_MODE,
	FMD_SWITCH_ON_RDS_SIMULATOR
};

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

/**
 * fmd_init() - Initialize the FM Driver internal structures.
 * @context: (out) FM Driver Context
 * Returns:
 *	 FMD_RESULT_SUCCESS,  if no error.
 *	 FMD_RESULT_IO_ERROR, if there is an error.
 */
u8 fmd_init(
		void  **context
		);

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

/**
 * fmd_register_callback() - Function to register callback function.
 * This function registers the callback function provided by upper layers.
 * @context: FM Driver Context
 * @callback: Fmradio call back Function pointer
 * Returns:
 *	 FMD_RESULT_SUCCESS,  if no error.
 *	 FMD_RESULT_IO_ERROR, if there is an error.
 *	 FMD_RESULT_BUSY, if FM Driver is not in idle state.
 */
u8 fmd_register_callback(
		void  *context,
		fmd_radio_cb callback
		);

/**
 * fmd_get_version() - Retrieves the FM HW and FW version.
 * @context: FM Driver Context
 * @version: (out) Version Array
 *  Returns:
 *	 FMD_RESULT_SUCCESS,  if no error.
 *	 FMD_RESULT_IO_ERROR, if there is an error.
 *	 FMD_RESULT_BUSY, if FM Driver is not in idle state.
 *	 FMD_RESULT_RESPONSE_WRONG, if wrong response received from chip.
 */
u8 fmd_get_version(
		void  *context,
		u16 version[7]
		);

/**
 * fmd_set_mode() - Starts a transition to the given mode.
 * @context: FM Driver Context
 * @mode: Transition mode
 *  Returns:
 *	 FMD_RESULT_SUCCESS,  if set mode done successfully.
 *	 FMD_RESULT_PARAMETER_INVALID, if parameter is invalid.
 *	 FMD_RESULT_IO_ERROR, if there is an error.
 *	 FMD_RESULT_RESPONSE_WRONG, if wrong response received from chip.
 */

u8 fmd_set_mode(
		void  *context,
		u8 mode
		);

/**
 * fmd_get_freq_range_properties() - Retrieves Freq Range Properties.
 * @context: FM Driver Context
 * @range: range of freq
 * @minfreq: (out) Minimum Frequency of the Band in kHz.
 * @maxfreq: (out) Maximum Frequency of the Band in kHz
 *  Returns:
 *	 FMD_RESULT_SUCCESS,  if no error.
 *	 FMD_RESULT_IO_ERROR, if there is an error.
 *	 FMD_RESULT_BUSY, if FM Driver is not in idle state.
 */
u8 fmd_get_freq_range_properties(
		void  *context,
		u8 range,
		u32  *minfreq,
		u32  *maxfreq
		);

/**
 * fmd_set_antenna() - Selects the antenna to be used in receive mode.
 * embedded - Selects the embedded antenna, wired- Selects the wired antenna.
 * @context: FM Driver Context
 * @antenna: Antenna Type
 *  Returns:
 *	 FMD_RESULT_SUCCESS,  if set antenna done successfully.
 *	 FMD_RESULT_PARAMETER_INVALID, if parameter is invalid.
 *	 FMD_RESULT_IO_ERROR, if there is an error.
 *	 FMD_RESULT_BUSY, if FM Driver is not in idle state.
 *	 FMD_RESULT_RESPONSE_WRONG, if wrong response received from chip.
 */
u8 fmd_set_antenna(
		void  *context,
		u8 antenna
		);

/**
 * fmd_get_antenna() - Retrieves the currently used antenna type.
 * @context: FM Driver Context
 * @antenna: (out) Antenna Selected on FM Radio.
 *  Returns:
 *	 FMD_RESULT_SUCCESS,  if no error.
 *	 FMD_RESULT_IO_ERROR, if there is an error.
 *	 FMD_RESULT_BUSY, if FM Driver is not in idle state.
 */
u8 fmd_get_antenna(
		void  *context,
		u8 *antenna
		);

/**
 * fmd_set_freq_range() - Sets the FM band.
 * @context: FM Driver Context
 * @range: freq range
 *  Returns:
 *	 FMD_RESULT_SUCCESS,  if no error.
 *	 FMD_RESULT_PARAMETER_INVALID, if parameter is invalid.
 *	 FMD_RESULT_IO_ERROR, if there is an error.
 *	 FMD_RESULT_BUSY, if FM Driver is not in idle state.
 *	 FMD_RESULT_RESPONSE_WRONG, if wrong response received from chip.
 */
u8 fmd_set_freq_range(
		void  *context,
		u8 range
		);

/**
 * fmd_get_freq_range() - Gets the FM band currently in use.
 * @context: FM Driver Context
 * @range: (out) Frequency Range set on FM Radio.
 *  Returns:
 *	 FMD_RESULT_SUCCESS,  if no error.
 *	 FMD_RESULT_IO_ERROR, if there is an error.
 *	 FMD_RESULT_BUSY, if FM Driver is not in idle state.
 */
u8 fmd_get_freq_range(
		void  *context,
		u8 *range
		);

/**
 * fmd_rx_set_grid() - Sets the tuning grid.
 * @context: FM Driver Context
 * @grid: Tuning grid size
 *  Returns:
 *	 FMD_RESULT_SUCCESS,  if no error.
 *	 FMD_RESULT_PARAMETER_INVALID, if parameter is invalid.
 *	 FMD_RESULT_IO_ERROR, if there is an error.
 *	 FMD_RESULT_BUSY, if FM Driver is not in idle state.
 *	 FMD_RESULT_RESPONSE_WRONG, if wrong response received from chip.
 */
u8 fmd_rx_set_grid(
		void  *context,
		u8 grid
		);

/**
 * fmd_rx_set_frequency() - Sets the FM Channel.
 * @context: FM Driver Context
 * @freq: Frequency to Set in Khz
 *  Returns:
 *	 FMD_RESULT_SUCCESS,  if set frequency done successfully.
 *	 FMD_RESULT_IO_ERROR, if there is an error.
 *	 FMD_RESULT_BUSY, if FM Driver is not in idle state.
 *	 FMD_RESULT_RESPONSE_WRONG, if wrong response received from chip.
 */
u8 fmd_rx_set_frequency(
		void  *context,
		u32 freq
		);

/**
 * fmd_rx_get_frequency() - Gets the currently used FM Channel.
 * @context: FM Driver Context
 * @freq: (out) Current Frequency set on FM Radio.
 *  Returns:
 *	 FMD_RESULT_SUCCESS,  if no error.
 *	 FMD_RESULT_IO_ERROR, if there is an error.
 *	 FMD_RESULT_BUSY, if FM Driver is not in idle state.
 *	 FMD_RESULT_RESPONSE_WRONG, if wrong response received from chip.
 */
u8 fmd_rx_get_frequency(
		void  *context,
		u32  *freq
		);

/**
 * fmd_rx_set_stereo_mode() - Sets the stereomode functionality.
 * @context: FM Driver Context
 * @mode: FMD_STEREOMODE_MONO, FMD_STEREOMODE_STEREO and
 *  Returns:
 *	 FMD_RESULT_SUCCESS,  if no error.
 *	 FMD_RESULT_PARAMETER_INVALID, if parameter is invalid.
 *	 FMD_RESULT_IO_ERROR, if there is an error.
 *	 FMD_RESULT_BUSY, if FM Driver is not in idle state.
 *	 FMD_RESULT_RESPONSE_WRONG, if wrong response received from chip.
 */
u8 fmd_rx_set_stereo_mode(
		void  *context,
		u8 mode
		);

/**
 * fmd_rx_get_stereo_mode() - Gets the currently used FM mode.
 * FMD_STEREOMODE_MONO, FMD_STEREOMODE_STEREO and
 * FMD_STEREOMODE_AUTO.
 * @context: FM Driver Context
 * @mode: (out) Mode set on FM Radio, stereo or mono.
 *  Returns:
 *	 FMD_RESULT_SUCCESS,  if no error.
 *	 FMD_RESULT_IO_ERROR, if there is an error.
 *	 FMD_RESULT_BUSY, if FM Driver is not in idle state.
 */
u8 fmd_rx_get_stereo_mode(
		void  *context,
		u8 *mode
		);

/**
 * fmd_rx_get_signal_strength() - Gets the RSSI level of current frequency.
 * @context: FM Driver Context
 * @strength: (out) RSSI level of current channel.
 *  Returns:
 *	 FMD_RESULT_SUCCESS,  if no error.
 *	 FMD_RESULT_IO_ERROR, if there is an error.
 *	 FMD_RESULT_BUSY, if FM Driver is not in idle state.
 *	 FMD_RESULT_RESPONSE_WRONG, if wrong response received from chip.
 */
u8 fmd_rx_get_signal_strength(
		void  *context,
		u16  *strength
		);

/**
 * fmd_rx_set_stop_level() - Sets the FM Rx Seek stop level.
 * @context: FM Driver Context
 * @stoplevel: seek stop level
 *  Returns:
 *	 FMD_RESULT_SUCCESS,  if no error.
 *	 FMD_RESULT_IO_ERROR, if there is an error.
 *	 FMD_RESULT_BUSY, if FM Driver is not in idle state.
 */
u8 fmd_rx_set_stop_level(
		void  *context,
		u16 stoplevel
		);

/**
 * fmd_rx_get_stop_level() - Gets the current FM Rx Seek stop level.
 * @context: FM Driver Context
 * @stoplevel: (out) RSSI Threshold set on FM Radio.
 *  Returns:
 *	 FMD_RESULT_SUCCESS,  if no error.
 *	 FMD_RESULT_IO_ERROR, if there is an error.
 *	 FMD_RESULT_BUSY, if FM Driver is not in idle state.
 */
u8 fmd_rx_get_stop_level(
		void  *context,
		u16  *stoplevel
		);

/**
 * fmd_rx_seek() - Perform FM Seek.
 * Starts searching relative to the actual channel with
 * a specific direction, stop.
 * @context: FM Driver Context
 *  level and optional noise levels
 * @upwards: scan up
 *  Returns:
 *	 FMD_RESULT_ONGOING,  if seek started successfully.
 *	 FMD_RESULT_IO_ERROR, if there is an error.
 *	 FMD_RESULT_BUSY, if FM Driver is not in idle state.
 *	 FMD_RESULT_RESPONSE_WRONG, if wrong response received from chip.
 */
u8 fmd_rx_seek(
		void  *context,
		bool upwards
		);

/**
 * fmd_rx_stop_seeking() - Stops a currently active seek or scan band.
 * @context: FM Driver Context
 *  Returns:
 *	 FMD_RESULT_SUCCESS,  if stop seek done successfully.
 *	 FMD_RESULT_IO_ERROR, if there is an error.
 *	 FMD_RESULT_PRECONDITIONS_VIOLATED, if FM Driver is
 * not currently in Seek or Scan State..
 *	 FMD_RESULT_RESPONSE_WRONG, if wrong response received from chip.
 */
u8 fmd_rx_stop_seeking(
		void  *context
		);

/**
 * 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.
 * @context: FM Driver Context
 * @freq: Alternative frequncy in KHz to be set for AF updation.
 *  Returns:
 * FMD_RESULT_BUSY, if FM Driver is not in idle state.
 * FMD_RESULT_SUCCESS,  if no error.
 * FMD_RESULT_IO_ERROR, if there is an error.
 */
u8 fmd_rx_af_update_start(
		 void *context,
		 u32 freq
		 );

/**
 * fmd_rx_get_af_update_result() - Retrive result of AF update.
 * Retrive the RSSI level of the Alternative frequency.
 * @context: FM Driver Context
 * @af_level: RSSI level of the Alternative frequency.
 * Returns:
 * FMD_RESULT_BUSY, if FM Driver is not in idle state.
 * FMD_RESULT_SUCCESS,  if no error.
 * FMD_RESULT_IO_ERROR, if there is an error.
 */
u8 fmd_rx_get_af_update_result(
		 void *context,
		 u16 *af_level
		 );


/**
 * fmd_af_switch_start() -Performs AF switch.
 * @context: FM Driver Context
 * @freq: Frequency to Set in Khz.
 * @picode:programable id,unique for each station.
 *
 *  Returns:
 * FMD_RESULT_BUSY, if FM Driver is not in idle state.
 * FMD_RESULT_SUCCESS,  if no error.
 * FMD_RESULT_SUCCESS, if AF switch started successfully.
 * FMD_RESULT_IO_ERROR, if there is an error.
 */
u8 fmd_rx_af_switch_start(
		void *context,
		u32 freq,
		u16  picode
		);

/**
 * fmd_rx_get_af_switch_results() -Retrieves the results of AF Switch.
 * @context: FM Driver Context
 * @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:
 * FMD_RESULT_BUSY, if FM Driver is not in idle state.
 * FMD_RESULT_SUCCESS,  if no error.
 * FMD_RESULT_IO_ERROR, if there is an error.
 */
u8 fmd_rx_get_af_switch_results(
		 void *context,
		 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.
 * @context: FM Driver Context
 * @max_channels_to_scan: Maximum number of channels to scan.
 * Returns:
 *   FMD_RESULT_ONGOING,  if scan band started successfully.
 *   FMD_RESULT_IO_ERROR, if there is an error.
 *   FMD_RESULT_BUSY, if FM Driver is not in idle state.
 *   FMD_RESULT_RESPONSE_WRONG, if wrong response received from chip.
 */
u8 fmd_rx_scan_band(
		void  *context,
		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.
 * @context: FM Driver Context
 * @max_channels_to_scan: (out) Maximum number of channels to scan.
 * Returns:
 *   FMD_RESULT_BUSY, if FM Driver is not in idle state.
 *   FMD_RESULT_RESPONSE_WRONG, if wrong response received from chip.
 */
u8 fmd_rx_get_max_channels_to_scan(
		void *context,
		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.
 * @context: FM Driver Context
 * @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:
 *   FMD_RESULT_ONGOING,  if no error.
 *   FMD_RESULT_IO_ERROR, if there is an error.
 *   FMD_RESULT_RESPONSE_WRONG, if wrong response received from chip.
 */
u8 fmd_rx_get_scan_band_info(
		void  *context,
		u32 index,
		u16  *numchannels,
		u16  *channels,
		u16  *rssi
		);

/**
 * fmd_rx_block_scan() - Starts Block Scan.
 * Starts block scan for retriving the RSSI level of channels
 * in the given block.
 * @context: FM Driver Context
 * @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:
 *   FMD_RESULT_ONGOING,  if scan band started successfully.
 *   FMD_RESULT_PARAMETER_INVALID,  if parameters are invalid.
 *   FMD_RESULT_IO_ERROR, if there is an error.
 *   FMD_RESULT_BUSY, if FM Driver is not in idle state.
 *   FMD_RESULT_RESPONSE_WRONG, if wrong response received from chip.
 */
u8 fmd_rx_block_scan(
		void *context,
		u32 start_freq,
		u32 stop_freq,
		u8 antenna
		);

/**
 * fmd_rx_get_block_scan_result() - Retrieves RSSI Level of channels.
 * Retrieves the RSSI level of the channels in the block.
 * @context: FM Driver Context
 * @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:
 *   FMD_RESULT_ONGOING,  if no error.
 *   FMD_RESULT_IO_ERROR, if there is an error.
 *   FMD_RESULT_RESPONSE_WRONG, if wrong response received from chip.
 */
u8 fmd_rx_get_block_scan_result(
		void *context,
		u32 index,
		u16 *numchannels,
		u16 *rssi
		);

/**
 * fmd_rx_get_rds() - Gets the current status of RDS transmission.
 * @context: FM Driver Context
 * @on: (out) RDS status
 *  Returns:
 *	 FMD_RESULT_SUCCESS,  if no error.
 *	 FMD_RESULT_IO_ERROR, if there is an error.
 *       FMD_RESULT_BUSY, if FM Driver is not in idle state.
 */
u8 fmd_rx_get_rds(
		void  *context,
		bool  *on
		);

/**
 * fmd_rx_buffer_set_size() - Sets the number of groups that the data buffer.
 * can contain and clears the buffer.
 * @context: FM Driver Context
 * @size: buffer size
 * Returns:
 *   FMD_RESULT_SUCCESS,  if no error.
 *   FMD_RESULT_IO_ERROR, if there is an error.
 *   FMD_RESULT_BUSY, if FM Driver is not in idle state.
 *   FMD_RESULT_RESPONSE_WRONG, if wrong response received from chip.
 */
u8 fmd_rx_buffer_set_size(
		void  *context,
		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.
 * @context: FM Driver Context
 * @threshold: threshold level.
 * Returns:
 *   FMD_RESULT_SUCCESS,  if no error.
 *   FMD_RESULT_IO_ERROR, if there is an error.
 *   FMD_RESULT_BUSY, if FM Driver is not in idle state.
 *   FMD_RESULT_RESPONSE_WRONG, if wrong response received from chip.
 */
u8 fmd_rx_buffer_set_threshold(
		void  *context,
		u8 threshold
		);

/**
 * fmd_rx_set_rds() - Enables or disables demodulation of RDS data.
 * @context: FM Driver Context
 * @on_off_state : Rx Set ON /OFF control
 * Returns:
 *   FMD_RESULT_SUCCESS,  if no error.
 *   FMD_RESULT_IO_ERROR, if there is an error.
 *   FMD_RESULT_BUSY, if FM Driver is not in idle state.
 *   FMD_RESULT_RESPONSE_WRONG, if wrong response received from chip.
 */
u8 fmd_rx_set_rds(
		void  *context,
		u8 on_off_state
		);

/**
 * fmd_rx_get_low_level_rds_groups() - Gets Low level RDS group data.
 * @context: FM Driver Context
 * @index: RDS group index
 * @rds_buf_count: Count for RDS buffer
 * @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:
 *	 FMD_RESULT_SUCCESS,  if no error.
 *	 FMD_RESULT_IO_ERROR, if there is an error.
 *       FMD_RESULT_BUSY, if FM Driver is not in idle state.
 */
u8 fmd_rx_get_low_level_rds_groups(
		void  *context,
		u8 index,
		u8 *rds_buf_count,
		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.
 * @context: FM Driver Context
 * @on: Power Amplifier current state to set
 * Returns:
 *   FMD_RESULT_SUCCESS,  if set Power Amplifier done successfully.
 *   FMD_RESULT_IO_ERROR, if there is an error.
 *   FMD_RESULT_BUSY, if FM Driver is not in idle state.
 *   FMD_RESULT_RESPONSE_WRONG, if wrong response received from chip.
 */
u8 fmd_tx_set_pa(
		void  *context,
		bool on
		);

/**
 * fmd_tx_set_signal_strength() - Sets the RF-level of the output FM signal.
 * @context: FM Driver Context
 * @strength: Signal strength to be set for FM Tx in dBuV.
 * Returns:
 *   FMD_RESULT_SUCCESS,  if set RSSI Level done successfully.
 *   FMD_RESULT_IO_ERROR, if there is an error.
 *   FMD_RESULT_PARAMETER_INVALID, if parameter is invalid.
 *   FMD_RESULT_BUSY, if FM Driver is not in idle state.
 *   FMD_RESULT_RESPONSE_WRONG, if wrong response received from chip.
 */
u8 fmd_tx_set_signal_strength(
		void  *context,
		u16 strength
		);

/**
 * fmd_tx_get_signal_strength() - Retrieves current RSSI of FM Tx.
 * @context: FM Driver Context
 * @strength: (out) Strength of signal being transmitted in dBuV.
 * Returns:
 *   FMD_RESULT_SUCCESS,  if no error.
 *   FMD_RESULT_IO_ERROR, if there is an error.
 *   FMD_RESULT_BUSY, if FM Driver is not in idle state.
 */
u8 fmd_tx_get_signal_strength(
		void  *context,
		u16  *strength
		);

/**
 * fmd_tx_set_freq_range() - Sets the FM band and specifies the custom band.
 * @context: FM Driver Context
 * @range: Freq range to set on FM Tx.
 * Returns:
 *   FMD_RESULT_SUCCESS,  if no error.
 *   FMD_RESULT_PARAMETER_INVALID, if parameter is invalid.
 *   FMD_RESULT_IO_ERROR, if there is an error.
 *   FMD_RESULT_BUSY, if FM Driver is not in idle state.
 *   FMD_RESULT_RESPONSE_WRONG, if wrong response received from chip.
 */
u8 fmd_tx_set_freq_range(
		void  *context,
		u8 range
		);

/**
 * fmd_tx_get_freq_range() - Gets the FM band currently in use.
 * @context: FM Driver Context
 * @range: (out) Frequency Range set on Fm Tx.
 * Returns:
 *   FMD_RESULT_SUCCESS,  if no error.
 *   FMD_RESULT_IO_ERROR, if there is an error.
 *   FMD_RESULT_BUSY, if FM Driver is not in idle state.
 */
u8 fmd_tx_get_freq_range(
		void  *context,
		u8 *range
		);

/**
 * fmd_tx_set_grid() - Sets the tuning grid size.
 * @context: FM Driver Context
 * @grid: FM Grid (50 Khz, 100 Khz, 200 Khz) to be set for FM Tx.
 * Returns:
 *   FMD_RESULT_SUCCESS,  if no error.
 *   FMD_RESULT_PARAMETER_INVALID, if parameter is invalid.
 *   FMD_RESULT_IO_ERROR, if there is an error.
 *   FMD_RESULT_BUSY, if FM Driver is not in idle state.
 *   FMD_RESULT_RESPONSE_WRONG, if wrong response received from chip.
 */
u8 fmd_tx_set_grid(
		void  *context,
		u8 grid
		);

/**
 * fmd_tx_get_grid() - Gets the current tuning grid size.
 * @context: FM Driver Context
 * @grid: (out) FM Grid (50 Khz, 100 Khz, 200 Khz) currently set on FM Tx.
 * Returns:
 *   FMD_RESULT_SUCCESS,  if no error.
 *   FMD_RESULT_IO_ERROR, if there is an error.
 *   FMD_RESULT_BUSY, if FM Driver is not in idle state.
 */
u8 fmd_tx_get_grid(
		void  *context,
		u8 *grid
		);

/**
 * fmd_tx_set_preemphasis() - Sets the Preemphasis characteristic of the Tx.
 * @context: FM Driver Context
 * @preemphasis: Pre-emphasis level to be set for FM Tx.
 * Returns:
 *   FMD_RESULT_SUCCESS,  if no error.
 *   FMD_RESULT_IO_ERROR, if there is an error.
 *   FMD_RESULT_RESPONSE_WRONG, if wrong response received from chip.
 */
u8 fmd_tx_set_preemphasis(
		void  *context,
		u8 preemphasis
		);

/**
 * fmd_tx_get_preemphasis() - Gets the currently used Preemphasis char of th FM Tx.
 * @context: FM Driver Context.
 * @preemphasis: (out) Preemphasis Level used for FM Tx.
 * Returns:
 *   FMD_RESULT_SUCCESS,  if no error.
 *   FMD_RESULT_IO_ERROR, if there is an error.
 *   FMD_RESULT_BUSY, if FM Driver is not in idle state.
 */
u8 fmd_tx_get_preemphasis(
		void  *context,
		u8 *preemphasis
		);

/**
 * fmd_tx_set_frequency() - Sets the FM Channel for Tx.
 * @context: FM Driver Context
 * @freq: Freq to be set for transmission.
 * Returns:
 *   FMD_RESULT_SUCCESS,  if set frequency done successfully.
 *   FMD_RESULT_IO_ERROR, if there is an error.
 *   FMD_RESULT_BUSY, if FM Driver is not in idle state.
 *   FMD_RESULT_RESPONSE_WRONG, if wrong response received from chip.
 */
u8 fmd_tx_set_frequency(
		void  *context,
		u32 freq
		);

/**
 * fmd_rx_get_frequency() - Gets the currently used Channel for Tx.
 * @context: FM Driver Context
 * @freq: (out) Frequency set on FM Tx.
 * Returns:
 *   FMD_RESULT_SUCCESS,  if no error.
 *   FMD_RESULT_IO_ERROR, if there is an error.
 *   FMD_RESULT_BUSY, if FM Driver is not in idle state.
 *   FMD_RESULT_RESPONSE_WRONG, if wrong response received from chip.
 */
u8 fmd_tx_get_frequency(
		void  *context,
		u32  *freq
		);

/**
 * fmd_tx_enable_stereo_mode() - Sets Stereo mode state for TX.
 * @context: FM Driver Context
 * @enable_stereo_mode: Flag indicating enabling or disabling Stereo mode.
 * Returns:
 *   FMD_RESULT_SUCCESS,  if no error.
 *   FMD_RESULT_IO_ERROR, if there is an error.
 *   FMD_RESULT_BUSY, if FM Driver is not in idle state.
 *   FMD_RESULT_RESPONSE_WRONG, if wrong response received from chip.
 */
u8 fmd_tx_enable_stereo_mode(
		void  *context,
		bool enable_stereo_mode
		);

/**
 * fmd_tx_get_stereo_mode() - Gets the currently used FM Tx stereo mode.
 * @context: FM Driver Context
 * @stereo_mode: (out) Stereo Mode state set on FM Tx.
 * Returns:
 *   FMD_RESULT_SUCCESS,  if no error.
 *   FMD_RESULT_IO_ERROR, if there is an error.
 *   FMD_RESULT_BUSY, if FM Driver is not in idle state.
 */
u8 fmd_tx_get_stereo_mode(
		void  *context,
		bool  *stereo_mode
		);

/**
 * fmd_tx_set_pilot_deviation() - Sets pilot deviation in HZ
 * @context: FM Driver Context
 * @deviation: Pilot deviation in HZ to set on FM Tx.
 * Returns:
 *   FMD_RESULT_SUCCESS,  if no error.
 *   FMD_RESULT_IO_ERROR, if there is an error.
 *   FMD_RESULT_RESPONSE_WRONG, if wrong response received from chip.
 */
u8 fmd_tx_set_pilot_deviation(
		void  *context,
		u16 deviation
		);

/**
 * fmd_tx_get_pilot_deviation() - Retrieves the current pilot deviation.
 * @context: FM Driver Context
 * @deviation: (out) Pilot deviation set on FM Tx.
 * Returns:
 *   FMD_RESULT_SUCCESS,  if no error.
 *   FMD_RESULT_IO_ERROR, if there is an error.
 *   FMD_RESULT_BUSY, if FM Driver is not in idle state.
 */
u8 fmd_tx_get_pilot_deviation(
		void  *context,
		u16  *deviation
		);

/**
 * fmd_tx_set_rds_deviation() - Sets Rds deviation in HZ.
 * @context: FM Driver Context
 * @deviation: RDS deviation in HZ.
 * Returns:
 *   FMD_RESULT_SUCCESS,  if no error.
 *   FMD_RESULT_IO_ERROR, if there is an error.
 *   FMD_RESULT_BUSY, if FM Driver is not in idle state.
 *   FMD_RESULT_RESPONSE_WRONG, if wrong response received from chip.
 */
u8 fmd_tx_set_rds_deviation(
		void  *context,
		u16 deviation
		);

/**
 * fmd_tx_get_rds_deviation() - Retrieves the current Rds deviation.
 * @context: FM Driver Context
 * @deviation: (out) RDS deviation currently set.
 * Returns:
 *   FMD_RESULT_SUCCESS,  if no error.
 *   FMD_RESULT_IO_ERROR, if there is an error.
 *   FMD_RESULT_BUSY, if FM Driver is not in idle state.
 */
u8 fmd_tx_get_rds_deviation(
		void  *context,
		u16  *deviation
		);

/**
 * fmd_tx_set_rds() - Enables or disables RDS transmission for Tx.
 * @context: FM Driver Context
 * @on: Boolean - RDS ON
 * Returns:
 *   FMD_RESULT_SUCCESS,  if no error.
 *   FMD_RESULT_IO_ERROR, if there is an error.
 *   FMD_RESULT_BUSY, if FM Driver is not in idle state.
 *   FMD_RESULT_RESPONSE_WRONG, if wrong response received from chip.
 */
u8 fmd_tx_set_rds(
		void  *context,
		bool on
		);

/**
 * fmd_rx_get_rds() - Gets the current status of RDS transmission for FM Tx.
 * @context: FM Driver Context
 * @on: (out) Rds enabled or disabled.
 * Returns:
 *   FMD_RESULT_SUCCESS,  if no error.
 *   FMD_RESULT_IO_ERROR, if there is an error.
 *   FMD_RESULT_BUSY, if FM Driver is not in idle state.
 */
u8 fmd_tx_get_rds(
		void  *context,
		bool  *on
		);

/**
 * fmd_tx_set_group() - Programs a grp on a certain position in the RDS buffer.
 * @context: FM Driver Context
 * @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:
 *   FMD_RESULT_SUCCESS,  if no error.
 *   FMD_RESULT_IO_ERROR, if there is an error.
 *   FMD_RESULT_BUSY, if FM Driver is not in idle state.
 *   FMD_RESULT_RESPONSE_WRONG, if wrong response received from chip.
 */
u8 fmd_tx_set_group(
		void  *context,
		u16 position,
		u8  block1[2],
		u8  block2[2],
		u8  block3[2],
		u8  block4[2]
		);

/**
 * fmd_tx_buffer_set_size() - Controls the size of the RDS buffer in groups.
 * @context: FM Driver Context
 * @buffer_size: RDS buffer size.
 * Returns:
 *   FMD_RESULT_SUCCESS,  if no error.
 *   FMD_RESULT_IO_ERROR, if there is an error.
 *   FMD_RESULT_BUSY, if FM Driver is not in idle state.
 *   FMD_RESULT_RESPONSE_WRONG, if wrong response received from chip.
 */
u8 fmd_tx_buffer_set_size(
		void  *context,
		u16 buffer_size
		);

/**
 * fmd_set_volume() - Sets the receive audio volume.
 * @context: FM Driver Context
 * @volume: Audio volume level
 * Returns:
 *   FMD_RESULT_SUCCESS,  if no error.
 *   FMD_RESULT_IO_ERROR, if there is an error.
 *   FMD_RESULT_BUSY, if FM Driver is not in idle state.
 *   FMD_RESULT_RESPONSE_WRONG, if wrong response received from chip.
 */
u8 fmd_set_volume(
		void  *context,
		u8 volume
		);

/**
 * fmd_get_volume() - Retrives the current audio volume.
 * @context: FM Driver Context
 * @volume: Analog Volume level.
 * Returns:
 *   FMD_RESULT_SUCCESS,  if no error.
 *   FMD_RESULT_IO_ERROR, if there is an error.
 *   FMD_RESULT_BUSY, if FM Driver is not in idle state.
 */
u8 fmd_get_volume(
		void  *context,
		u8 *volume
		);

/**
 * fmd_set_balance() - Controls the receiver audio balance.
 * @context: FM Driver Context
 * @balance: Audio balance level
 * Returns:
 *   FMD_RESULT_SUCCESS,  if no error.
 *   FMD_RESULT_IO_ERROR, if there is an error.
 *   FMD_RESULT_BUSY, if FM Driver is not in idle state.
 *   FMD_RESULT_RESPONSE_WRONG, if wrong response received from chip.
 */
u8 fmd_set_balance(
		void  *context,
		s8 balance
		);

/**
 * fmd_set_mute() - Enables or disables muting of the analog audio(DAC).
 * @context: FM Driver Context
 * @mute_on: bool of mute on
 * Returns:
 *   FMD_RESULT_SUCCESS,  if mute done successfully.
 *   FMD_RESULT_IO_ERROR, if there is an error.
 *   FMD_RESULT_BUSY, if FM Driver is not in idle state.
 *   FMD_RESULT_RESPONSE_WRONG, if wrong response received from chip.
 */
u8 fmd_set_mute(
		void  *context,
		bool mute_on
		);

/**
 * fmd_ext_set_mute() - Enables or disables muting of the audio channel.
 * @context: FM Driver Context
 * @mute_on: bool to Mute
 * Returns:
 *   FMD_RESULT_SUCCESS,  if no error.
 *   FMD_RESULT_IO_ERROR, if there is an error.
 *   FMD_RESULT_BUSY, if FM Driver is not in idle state.
 *   FMD_RESULT_RESPONSE_WRONG, if wrong response received from chip.
 */
u8 fmd_ext_set_mute(
		void  *context,
		bool mute_on
		);

/**
 * fmd_power_up() - Puts the system in Powerup state.
 * @context: FM Driver Context
 * Returns:
 *   FMD_RESULT_SUCCESS,  if power up command sent successfully to chip.
 *   FMD_RESULT_IO_ERROR, if there is an error.
 *   FMD_RESULT_RESPONSE_WRONG, if wrong response received from chip.
 */
u8 fmd_power_up(
		void  *context
		);

/**
 * fmd_goto_standby() - Puts the system in standby mode.
 * @context: FM Driver Context
 * Returns:
 *   FMD_RESULT_SUCCESS,  if no error.
 *   FMD_RESULT_IO_ERROR, if there is an error.
 *   FMD_RESULT_RESPONSE_WRONG, if wrong response received from chip.
 */
u8 fmd_goto_standby(
		void  *context
		);

/**
 * fmd_goto_power_down() - Puts the system in Powerdown mode.
 * @context: FM Driver Context
 * Returns:
 *   FMD_RESULT_SUCCESS,  if no error.
 *   FMD_RESULT_IO_ERROR, if there is an error.
 *   FMD_RESULT_RESPONSE_WRONG, if wrong response received from chip.
 */
u8 fmd_goto_power_down(
		void  *context
		);

/**
 * fmd_select_ref_clk() - Selects the FM reference clock.
 * @context: FM Driver Context
 * @ref_clk: Ref Clock.
 * Returns:
 *   FMD_RESULT_SUCCESS,  if no error.
 *   FMD_RESULT_IO_ERROR, if there is an error.
 *   FMD_RESULT_BUSY, if FM Driver is not in idle state.
 *   FMD_RESULT_RESPONSE_WRONG, if wrong response received from chip.
 */
u8 fmd_select_ref_clk(
		void  *context,
		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
 * @context: FM driver context.
 * @freq: PLL Frequency/ 2 in kHz.
 * Returns:
 *   FMD_RESULT_SUCCESS,  if no error.
 *   FMD_RESULT_IO_ERROR, if there is an error.
 *   FMD_RESULT_BUSY, if FM Driver is not in idle state.
 *   FMD_RESULT_RESPONSE_WRONG, if wrong response received from chip.
 */
u8 fmd_set_ref_clk_pll(
		void  *context,
		u16 freq
		);

/**
 * fmd_send_fm_ip_enable()- Enables the FM IP.
 * Returns:
 *   0,  if operation completed successfully.
 *   1, otherwise.
 */
u8 fmd_send_fm_ip_enable(void);

/**
 * fmd_send_fm_ip_disable()- Disables the FM IP.
 * Returns:
 *   0,  if operation completed successfully.
 *   1, otherwise.
 */
u8 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 operation completed successfully.
 *   1, otherwise.
 */
u8 fmd_send_fm_firmware(
		u8 *fw_buffer,
		u16 fw_size
		);

/**
 * fmd_receive_data() - Processes the FM data received from device.
 * @packet_length: Length of received Data Packet
 * @packet_buffer: Received Data buffer.
 */
void fmd_receive_data(
		u16 packet_length,
		u8 *packet_buffer
		);

/**
 * 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.
 */
void fmd_int_bufferfull(void);

/**
 * fmd_hexdump() - Displays the HCI Data Bytes exchanged with FM Chip.
 * @prompt: Prompt signifying the direction '<' for Rx '>' for Tx
 * @buffer: Buffer to be displayed.
 * @num_bytes: Number of bytes of the buffer.
 */
void fmd_hexdump(
		char prompt,
		u8 *buffer,
		int num_bytes
		);

/**
 * fmd_isr() - FM Interrupt Service Routine.
 * This function processes the Interrupt received from chip and performs the
 * necessary action.
 */
void fmd_isr(void);


#endif /* _FMDRIVER_H_  */