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
|
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <linux/init.h>
#include <linux/module.h>
#include <linux/device.h>
#include <linux/platform_device.h>
#include <linux/mfd/wcd9xxx/core.h>
#include <linux/bitops.h>
#include <linux/slab.h>
#include <linux/clk.h>
#include <linux/of_device.h>
#include <linux/clk/msm-clk.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/soc.h>
#include <sound/apr_audio-v2.h>
#include <sound/q6afe-v2.h>
#include <sound/msm-dai-q6-v2.h>
#include <linux/qdsp6v2/audio-anc-dev-mgr.h>
#include <linux/qdsp6v2/sdsp_anc.h>
#define LPM_START_ADDR (0x9120000 + 60*1024)
#define LPM_LENGTH (4*1024)
enum {
ANC_DEV_PORT_REFS = 0,
ANC_DEV_PORT_ANC_SPKR,
ANC_DEV_PORT_ANC_MIC,
ANC_DEV_PORT_MAX,
};
struct anc_tdm_port_cfg_info {
u16 port_id;
struct afe_param_id_tdm_cfg port_cfg;
};
struct anc_tdm_group_set_info {
struct afe_param_id_group_device_tdm_cfg gp_cfg;
uint32_t num_tdm_group_ports;
struct afe_clk_set tdm_clk_set;
uint32_t clk_mode;
};
struct anc_dev_drv_info {
uint32_t state;
uint32_t algo_module_id;
};
struct anc_dev_port_cfg_info {
uint32_t port_id;
uint32_t sample_rate;
uint32_t num_channels;
uint32_t bit_width;
};
static struct aud_msvc_param_id_dev_anc_mic_spkr_layout_info
anc_mic_spkr_layout;
static struct anc_dev_port_cfg_info anc_port_cfg[ANC_DEV_PORT_MAX];
static struct anc_tdm_group_set_info anc_dev_tdm_gp_set[IDX_GROUP_TDM_MAX];
static struct anc_tdm_port_cfg_info anc_dev_tdm_port_cfg[IDX_TDM_MAX];
static struct anc_dev_drv_info this_anc_dev_info;
static int anc_dev_get_free_tdm_gp_cfg_idx(void)
{
int idx = -1;
int i;
for (i = 0; i < IDX_GROUP_TDM_MAX; i++) {
if (anc_dev_tdm_gp_set[i].gp_cfg.group_id == 0) {
idx = i;
break;
}
}
return idx;
}
static int anc_dev_get_free_tdm_port_cfg_idx(void)
{
int idx = -1;
int i;
for (i = 0; i < IDX_TDM_MAX; i++) {
if (anc_dev_tdm_port_cfg[i].port_id == 0) {
idx = i;
break;
}
}
return idx;
}
static u16 get_group_id_from_port_id(int32_t port_id)
{
u16 gp_id = AFE_PORT_INVALID;
switch (port_id) {
case AFE_PORT_ID_PRIMARY_TDM_RX:
case AFE_PORT_ID_PRIMARY_TDM_RX_1:
case AFE_PORT_ID_PRIMARY_TDM_RX_2:
case AFE_PORT_ID_PRIMARY_TDM_RX_3:
case AFE_PORT_ID_PRIMARY_TDM_RX_4:
case AFE_PORT_ID_PRIMARY_TDM_RX_5:
case AFE_PORT_ID_PRIMARY_TDM_RX_6:
case AFE_PORT_ID_PRIMARY_TDM_RX_7:
gp_id = AFE_GROUP_DEVICE_ID_PRIMARY_TDM_RX;
break;
case AFE_PORT_ID_SECONDARY_TDM_RX:
case AFE_PORT_ID_SECONDARY_TDM_RX_1:
case AFE_PORT_ID_SECONDARY_TDM_RX_2:
case AFE_PORT_ID_SECONDARY_TDM_RX_3:
case AFE_PORT_ID_SECONDARY_TDM_RX_4:
case AFE_PORT_ID_SECONDARY_TDM_RX_5:
case AFE_PORT_ID_SECONDARY_TDM_RX_6:
case AFE_PORT_ID_SECONDARY_TDM_RX_7:
gp_id = AFE_GROUP_DEVICE_ID_SECONDARY_TDM_RX;
break;
case AFE_PORT_ID_TERTIARY_TDM_RX:
case AFE_PORT_ID_TERTIARY_TDM_RX_1:
case AFE_PORT_ID_TERTIARY_TDM_RX_2:
case AFE_PORT_ID_TERTIARY_TDM_RX_3:
case AFE_PORT_ID_TERTIARY_TDM_RX_4:
case AFE_PORT_ID_TERTIARY_TDM_RX_5:
case AFE_PORT_ID_TERTIARY_TDM_RX_6:
case AFE_PORT_ID_TERTIARY_TDM_RX_7:
gp_id = AFE_GROUP_DEVICE_ID_TERTIARY_TDM_RX;
break;
case AFE_PORT_ID_QUATERNARY_TDM_RX:
case AFE_PORT_ID_QUATERNARY_TDM_RX_1:
case AFE_PORT_ID_QUATERNARY_TDM_RX_2:
case AFE_PORT_ID_QUATERNARY_TDM_RX_3:
case AFE_PORT_ID_QUATERNARY_TDM_RX_4:
case AFE_PORT_ID_QUATERNARY_TDM_RX_5:
case AFE_PORT_ID_QUATERNARY_TDM_RX_6:
case AFE_PORT_ID_QUATERNARY_TDM_RX_7:
gp_id = AFE_GROUP_DEVICE_ID_QUATERNARY_TDM_RX;
break;
default:
break;
}
return gp_id;
}
static int anc_dev_get_matched_tdm_gp_cfg_idx(u16 gp_id)
{
int idx = -1;
int i;
for (i = 0; i < IDX_GROUP_TDM_MAX; i++) {
if (anc_dev_tdm_gp_set[i].gp_cfg.group_id == gp_id) {
idx = i;
break;
}
}
return idx;
}
static int anc_dev_get_matched_tdm_port_cfg_idx(u16 port_id)
{
int idx = -1;
int i;
for (i = 0; i < IDX_TDM_MAX; i++) {
if (anc_dev_tdm_port_cfg[i].port_id == port_id) {
idx = i;
break;
}
}
return idx;
}
static int anc_dev_tdm_set_clk(
struct anc_tdm_group_set_info *gp_set_data,
u16 port_id, bool enable)
{
int rc = 0;
switch (gp_set_data->gp_cfg.group_id) {
case AFE_GROUP_DEVICE_ID_PRIMARY_TDM_RX:
case AFE_GROUP_DEVICE_ID_PRIMARY_TDM_TX:
if (gp_set_data->clk_mode) {
gp_set_data->tdm_clk_set.clk_id =
Q6AFE_LPASS_CLK_ID_PRI_TDM_IBIT;
} else
gp_set_data->tdm_clk_set.clk_id =
Q6AFE_LPASS_CLK_ID_PRI_TDM_EBIT;
break;
case AFE_GROUP_DEVICE_ID_SECONDARY_TDM_RX:
case AFE_GROUP_DEVICE_ID_SECONDARY_TDM_TX:
if (gp_set_data->clk_mode) {
gp_set_data->tdm_clk_set.clk_id =
Q6AFE_LPASS_CLK_ID_SEC_TDM_IBIT;
} else
gp_set_data->tdm_clk_set.clk_id =
Q6AFE_LPASS_CLK_ID_SEC_TDM_EBIT;
break;
case AFE_GROUP_DEVICE_ID_TERTIARY_TDM_RX:
case AFE_GROUP_DEVICE_ID_TERTIARY_TDM_TX:
if (gp_set_data->clk_mode) {
gp_set_data->tdm_clk_set.clk_id =
Q6AFE_LPASS_CLK_ID_TER_TDM_IBIT;
} else
gp_set_data->tdm_clk_set.clk_id =
Q6AFE_LPASS_CLK_ID_TER_TDM_EBIT;
break;
case AFE_GROUP_DEVICE_ID_QUATERNARY_TDM_RX:
case AFE_GROUP_DEVICE_ID_QUATERNARY_TDM_TX:
if (gp_set_data->clk_mode) {
gp_set_data->tdm_clk_set.clk_id =
Q6AFE_LPASS_CLK_ID_QUAD_TDM_IBIT;
} else
gp_set_data->tdm_clk_set.clk_id =
Q6AFE_LPASS_CLK_ID_QUAD_TDM_EBIT;
break;
default:
pr_err("%s: port id 0x%x not supported\n",
__func__, port_id);
return -EINVAL;
}
gp_set_data->tdm_clk_set.enable = enable;
rc = afe_set_lpass_clock_v2(port_id,
&gp_set_data->tdm_clk_set);
if (rc < 0)
pr_err("%s: afe lpass clock failed, err:%d\n",
__func__, rc);
return rc;
}
static int anc_dev_port_start(int32_t which_port)
{
int rc = 0;
int pt_idx;
struct afe_tdm_port_config tdm_cfg;
pt_idx =
anc_dev_get_matched_tdm_port_cfg_idx(anc_port_cfg[which_port].port_id);
if (pt_idx == -1) {
rc = -EINVAL;
goto rtn;
}
tdm_cfg.tdm = anc_dev_tdm_port_cfg[pt_idx].port_cfg;
tdm_cfg.tdm.num_channels = anc_port_cfg[which_port].num_channels;
tdm_cfg.tdm.sample_rate = anc_port_cfg[which_port].sample_rate;
tdm_cfg.tdm.bit_width = anc_port_cfg[which_port].bit_width;
tdm_cfg.tdm.nslots_per_frame = anc_port_cfg[which_port].num_channels;
tdm_cfg.tdm.slot_width = anc_port_cfg[which_port].bit_width;
tdm_cfg.tdm.slot_mask =
((1 << anc_port_cfg[which_port].num_channels) - 1);
pr_debug("%s: port_id %x num_channels %x bit_width %x sample_rate %x nslots_per_frame %x slot_width %x slot_mask %x!\n",
__func__,
anc_port_cfg[which_port].port_id,
tdm_cfg.tdm.num_channels,
tdm_cfg.tdm.bit_width,
tdm_cfg.tdm.sample_rate,
tdm_cfg.tdm.nslots_per_frame,
tdm_cfg.tdm.slot_width,
tdm_cfg.tdm.slot_mask);
rc = anc_if_tdm_port_start(anc_port_cfg[which_port].port_id,
&tdm_cfg);
if (IS_ERR_VALUE(rc)) {
pr_err("%s: fail to open ANC port from SDSP 0x%x\n",
__func__, anc_port_cfg[which_port].port_id);
goto rtn;
}
rtn:
return rc;
}
static int anc_dev_port_stop(int32_t which_port)
{
int rc = 0;
rc = anc_if_tdm_port_stop(anc_port_cfg[which_port].port_id);
if (IS_ERR_VALUE(rc)) {
pr_err("%s: fail to stop ANC port from SDSP 0x%x\n",
__func__, anc_port_cfg[which_port].port_id);
}
return rc;
}
int msm_anc_dev_set_info(void *info_p, int32_t anc_cmd)
{
int rc = -EINVAL;
switch (anc_cmd) {
case ANC_CMD_ALGO_MODULE: {
struct audio_anc_algo_module_info *module_info_p =
(struct audio_anc_algo_module_info *)info_p;
rc = 0;
if (this_anc_dev_info.state)
rc = anc_if_set_algo_module_id(
anc_port_cfg[ANC_DEV_PORT_ANC_SPKR].port_id,
module_info_p->module_id);
else
this_anc_dev_info.algo_module_id =
module_info_p->module_id;
break;
}
case ANC_CMD_ALGO_CALIBRATION: {
rc = -EINVAL;
if (this_anc_dev_info.state)
rc = anc_if_set_algo_module_cali_data(
anc_port_cfg[ANC_DEV_PORT_ANC_SPKR].port_id,
info_p);
else
pr_err("%s: ANC is not running yet\n",
__func__);
break;
}
default:
pr_err("%s: ANC cmd wrong\n",
__func__);
break;
}
return rc;
}
int msm_anc_dev_get_info(void *info_p, int32_t anc_cmd)
{
int rc = -EINVAL;
switch (anc_cmd) {
case ANC_CMD_ALGO_CALIBRATION: {
if (this_anc_dev_info.state)
rc = anc_if_get_algo_module_cali_data(
anc_port_cfg[ANC_DEV_PORT_ANC_SPKR].port_id,
info_p);
else
pr_err("%s: ANC is not running yet\n",
__func__);
break;
}
default:
pr_err("%s: ANC cmd wrong\n",
__func__);
break;
}
return rc;
}
int msm_anc_dev_start(void)
{
int rc = 0;
u16 group_id;
int gp_idx, pt_idx;
union afe_port_group_config anc_dev_gp_cfg;
struct afe_tdm_port_config tdm_cfg;
pr_debug("%s: ANC devices start in!\n", __func__);
memset(&tdm_cfg, 0, sizeof(tdm_cfg));
/*
* Refs port for ADSP
* 1. enable clk
* 2. group cfg and enable
* 3. Refs port cfg and start
*/
group_id =
get_group_id_from_port_id(anc_port_cfg[ANC_DEV_PORT_REFS].port_id);
gp_idx = anc_dev_get_matched_tdm_gp_cfg_idx(group_id);
if (gp_idx == -1) {
rc = -EINVAL;
pr_err("%s: anc_dev_get_matched_tdm_gp_cfg_idx() failed with group_id 0x%x\n",
__func__, group_id);
goto rtn;
} else {
rc = anc_dev_tdm_set_clk(&anc_dev_tdm_gp_set[gp_idx],
(u16)anc_port_cfg[ANC_DEV_PORT_REFS].port_id, true);
if (IS_ERR_VALUE(rc)) {
pr_err("%s: fail to enable AFE clk 0x%x\n",
__func__,
anc_port_cfg[ANC_DEV_PORT_REFS].port_id);
goto rtn;
}
anc_dev_gp_cfg.tdm_cfg = anc_dev_tdm_gp_set[gp_idx].gp_cfg;
anc_dev_gp_cfg.tdm_cfg.group_device_cfg_minor_version =
AFE_API_VERSION_GROUP_DEVICE_TDM_CONFIG;
anc_dev_gp_cfg.tdm_cfg.num_channels =
anc_port_cfg[ANC_DEV_PORT_REFS].num_channels;
anc_dev_gp_cfg.tdm_cfg.bit_width =
anc_port_cfg[ANC_DEV_PORT_REFS].bit_width;
anc_dev_gp_cfg.tdm_cfg.sample_rate =
anc_port_cfg[ANC_DEV_PORT_REFS].sample_rate;
anc_dev_gp_cfg.tdm_cfg.nslots_per_frame =
anc_port_cfg[ANC_DEV_PORT_REFS].num_channels;
anc_dev_gp_cfg.tdm_cfg.slot_width =
anc_port_cfg[ANC_DEV_PORT_REFS].bit_width;
anc_dev_gp_cfg.tdm_cfg.slot_mask =
((1 << anc_port_cfg[ANC_DEV_PORT_REFS].num_channels) - 1);
pr_debug("%s: refs_port_id %x\n", __func__,
anc_port_cfg[ANC_DEV_PORT_REFS].port_id);
pr_debug("%s: anc_dev_gp_cfg num_channels %x bit_width %x sample_rate %x nslots_per_frame %x slot_width %x slot_mask %x!\n",
__func__,
anc_dev_gp_cfg.tdm_cfg.num_channels,
anc_dev_gp_cfg.tdm_cfg.bit_width,
anc_dev_gp_cfg.tdm_cfg.sample_rate,
anc_dev_gp_cfg.tdm_cfg.nslots_per_frame,
anc_dev_gp_cfg.tdm_cfg.slot_width,
anc_dev_gp_cfg.tdm_cfg.slot_mask);
rc = afe_port_group_enable(group_id,
&anc_dev_gp_cfg, true);
if (IS_ERR_VALUE(rc)) {
pr_err("%s: fail to enable AFE group 0x%x\n",
__func__, group_id);
goto rtn;
}
pt_idx =
anc_dev_get_matched_tdm_port_cfg_idx(
anc_port_cfg[ANC_DEV_PORT_REFS].port_id);
if (pt_idx == -1) {
rc = -EINVAL;
pr_err("%s: anc_dev_get_matched_tdm_port_cfg_idx() failed with port_id 0x%x\n",
__func__,
anc_port_cfg[ANC_DEV_PORT_REFS].port_id);
goto rtn;
}
tdm_cfg.tdm = anc_dev_tdm_port_cfg[pt_idx].port_cfg;
tdm_cfg.tdm.num_channels =
anc_port_cfg[ANC_DEV_PORT_REFS].num_channels;
tdm_cfg.tdm.sample_rate =
anc_port_cfg[ANC_DEV_PORT_REFS].sample_rate;
tdm_cfg.tdm.bit_width =
anc_port_cfg[ANC_DEV_PORT_REFS].bit_width;
tdm_cfg.tdm.nslots_per_frame =
anc_dev_gp_cfg.tdm_cfg.nslots_per_frame;
tdm_cfg.tdm.slot_width = anc_dev_gp_cfg.tdm_cfg.slot_width;
tdm_cfg.tdm.slot_mask = anc_dev_gp_cfg.tdm_cfg.slot_mask;
rc = afe_tdm_port_start(anc_port_cfg[ANC_DEV_PORT_REFS].port_id,
&tdm_cfg,
anc_port_cfg[ANC_DEV_PORT_REFS].sample_rate, 0);
if (IS_ERR_VALUE(rc)) {
afe_port_group_enable(group_id,
&anc_dev_gp_cfg, false);
anc_dev_tdm_set_clk(&anc_dev_tdm_gp_set[gp_idx],
(u16)anc_port_cfg[ANC_DEV_PORT_REFS].port_id, false);
pr_err("%s: fail to open AFE port 0x%x\n",
__func__,
anc_port_cfg[ANC_DEV_PORT_REFS].port_id);
goto rtn;
}
}
rc = anc_if_set_anc_mic_spkr_layout(
anc_port_cfg[ANC_DEV_PORT_REFS].port_id,
&anc_mic_spkr_layout);
if (IS_ERR_VALUE(rc)) {
pr_err("%s: fail to pass ANC MIC and SPKR layout info to SDSP 0x%x\n",
__func__,
anc_port_cfg[ANC_DEV_PORT_REFS].port_id);
goto rtn;
}
rc = anc_if_share_resource(
anc_port_cfg[ANC_DEV_PORT_REFS].port_id, 4, 3,
LPM_START_ADDR, LPM_LENGTH);
if (IS_ERR_VALUE(rc)) {
pr_err("%s: fail to assign lpass resource to SDSP 0x%x\n",
__func__,
anc_port_cfg[ANC_DEV_PORT_REFS].port_id);
goto rtn;
}
rc = anc_if_config_ref(anc_port_cfg[ANC_DEV_PORT_REFS].port_id,
anc_port_cfg[ANC_DEV_PORT_REFS].sample_rate,
anc_port_cfg[ANC_DEV_PORT_REFS].bit_width,
anc_port_cfg[ANC_DEV_PORT_REFS].num_channels);
if (IS_ERR_VALUE(rc)) {
pr_err("%s: fail to refs port cfg in SDSP 0x%x\n",
__func__,
anc_port_cfg[ANC_DEV_PORT_REFS].port_id);
goto rtn;
}
if (this_anc_dev_info.algo_module_id != 0)
rc = anc_if_set_algo_module_id(
anc_port_cfg[ANC_DEV_PORT_ANC_SPKR].port_id,
this_anc_dev_info.algo_module_id);
group_id = get_group_id_from_port_id(
anc_port_cfg[ANC_DEV_PORT_ANC_SPKR].port_id);
gp_idx = anc_dev_get_matched_tdm_gp_cfg_idx(group_id);
if (gp_idx == -1) {
rc = -EINVAL;
pr_err("%s: anc_dev_get_matched_tdm_gp_cfg_idx() failed with group_id 0x%x\n",
__func__, group_id);
goto rtn;
} else {
rc = anc_dev_tdm_set_clk(&anc_dev_tdm_gp_set[gp_idx],
(u16)anc_port_cfg[ANC_DEV_PORT_ANC_SPKR].port_id, true);
if (IS_ERR_VALUE(rc)) {
pr_err("%s: fail to enable AFE clk 0x%x\n",
__func__,
anc_port_cfg[ANC_DEV_PORT_ANC_SPKR].port_id);
goto rtn;
}
}
rc = anc_dev_port_start(ANC_DEV_PORT_ANC_MIC);
if (IS_ERR_VALUE(rc)) {
pr_err("%s: fail to enable ANC MIC Port 0x%x\n",
__func__,
anc_port_cfg[ANC_DEV_PORT_ANC_MIC].port_id);
goto rtn;
}
rc = anc_dev_port_start(ANC_DEV_PORT_ANC_SPKR);
if (IS_ERR_VALUE(rc)) {
pr_err("%s: fail to enable ANC SPKR Port 0x%x\n",
__func__,
anc_port_cfg[ANC_DEV_PORT_ANC_SPKR].port_id);
goto rtn;
}
this_anc_dev_info.state = 1;
pr_debug("%s: ANC devices start successfully!\n", __func__);
rtn:
return rc;
}
int msm_anc_dev_stop(void)
{
int rc = 0;
u16 group_id;
int gp_idx;
anc_dev_port_stop(ANC_DEV_PORT_ANC_SPKR);
anc_dev_port_stop(ANC_DEV_PORT_ANC_MIC);
group_id = get_group_id_from_port_id(
anc_port_cfg[ANC_DEV_PORT_ANC_SPKR].port_id);
gp_idx = anc_dev_get_matched_tdm_gp_cfg_idx(group_id);
if (gp_idx == -1) {
rc = -EINVAL;
goto rtn;
} else {
rc = anc_dev_tdm_set_clk(&anc_dev_tdm_gp_set[gp_idx],
(u16)anc_port_cfg[ANC_DEV_PORT_ANC_SPKR].port_id, false);
if (IS_ERR_VALUE(rc)) {
pr_err("%s: fail to disable AFE clk 0x%x\n",
__func__,
anc_port_cfg[ANC_DEV_PORT_ANC_SPKR].port_id);
}
}
group_id =
get_group_id_from_port_id(anc_port_cfg[ANC_DEV_PORT_REFS].port_id);
gp_idx = anc_dev_get_matched_tdm_gp_cfg_idx(group_id);
if (gp_idx == -1) {
rc = -EINVAL;
goto rtn;
}
afe_close(anc_port_cfg[ANC_DEV_PORT_REFS].port_id);
afe_port_group_enable(group_id, NULL, false);
anc_dev_tdm_set_clk(&anc_dev_tdm_gp_set[gp_idx],
(u16)anc_port_cfg[ANC_DEV_PORT_REFS].port_id, false);
this_anc_dev_info.state = 0;
this_anc_dev_info.algo_module_id = 0;
pr_debug("%s: ANC devices stop successfully!\n", __func__);
rtn:
return rc;
}
static int msm_anc_tdm_dev_group_cfg_info(
struct platform_device *pdev,
struct device_node *ctx_node)
{
int rc = 0;
const uint32_t *port_id_array = NULL;
uint32_t num_tdm_group_ports = 0;
uint32_t array_length = 0;
int i = 0;
int gp_idx = anc_dev_get_free_tdm_gp_cfg_idx();
if ((gp_idx < 0) || (gp_idx > IDX_GROUP_TDM_MAX)) {
dev_err(&pdev->dev, "%s: could not get abaiable tdm group cfg slot\n",
__func__);
rc = -EINVAL;
goto rtn;
}
/* extract tdm group info into static */
rc = of_property_read_u32(ctx_node,
"qcom,msm-cpudai-tdm-group-id",
(u32 *)&anc_dev_tdm_gp_set[gp_idx].gp_cfg.group_id);
if (rc) {
dev_err(&pdev->dev, "%s: Group ID from DT file %s\n",
__func__, "qcom,msm-cpudai-tdm-group-id");
goto rtn;
}
dev_dbg(&pdev->dev, "%s: dev_name: %s group_id: 0x%x\n",
__func__, dev_name(&pdev->dev),
anc_dev_tdm_gp_set[gp_idx].gp_cfg.group_id);
rc = of_property_read_u32(ctx_node,
"qcom,msm-cpudai-tdm-group-num-ports",
&num_tdm_group_ports);
if (rc) {
dev_err(&pdev->dev, "%s: Group Num Ports from DT file %s\n",
__func__, "qcom,msm-cpudai-tdm-group-num-ports");
goto rtn;
}
dev_dbg(&pdev->dev, "%s: Group Num Ports from DT file 0x%x\n",
__func__, num_tdm_group_ports);
if (num_tdm_group_ports > AFE_GROUP_DEVICE_NUM_PORTS) {
dev_err(&pdev->dev, "%s Group Num Ports %d greater than Max %d\n",
__func__, num_tdm_group_ports,
AFE_GROUP_DEVICE_NUM_PORTS);
rc = -EINVAL;
goto rtn;
}
port_id_array = of_get_property(ctx_node,
"qcom,msm-cpudai-tdm-group-port-id",
&array_length);
if (port_id_array == NULL) {
dev_err(&pdev->dev, "%s port_id_array is not valid\n",
__func__);
rc = -EINVAL;
goto rtn;
}
if (array_length != sizeof(uint32_t) * num_tdm_group_ports) {
dev_err(&pdev->dev, "%s array_length is %d, expected is %zd\n",
__func__, array_length,
sizeof(uint32_t) * num_tdm_group_ports);
rc = -EINVAL;
goto rtn;
}
for (i = 0; i < num_tdm_group_ports; i++)
anc_dev_tdm_gp_set[gp_idx].gp_cfg.port_id[i] =
(u16)be32_to_cpu(port_id_array[i]);
/* Unused index should be filled with 0 or AFE_PORT_INVALID */
for (i = num_tdm_group_ports;
i < AFE_GROUP_DEVICE_NUM_PORTS; i++)
anc_dev_tdm_gp_set[gp_idx].gp_cfg.port_id[i] = AFE_PORT_INVALID;
anc_dev_tdm_gp_set[gp_idx].num_tdm_group_ports = num_tdm_group_ports;
/* extract tdm clk info into static */
rc = of_property_read_u32(ctx_node,
"qcom,msm-cpudai-tdm-clk-rate",
&anc_dev_tdm_gp_set[gp_idx].tdm_clk_set.clk_freq_in_hz);
if (rc) {
dev_err(&pdev->dev, "%s: Clk Rate from DT file %s\n",
__func__, "qcom,msm-cpudai-tdm-clk-rate");
goto rtn;
}
dev_dbg(&pdev->dev, "%s: Clk Rate from DT file %d\n",
__func__,
anc_dev_tdm_gp_set[gp_idx].tdm_clk_set.clk_freq_in_hz);
anc_dev_tdm_gp_set[gp_idx].tdm_clk_set.clk_set_minor_version =
Q6AFE_LPASS_CLK_CONFIG_API_VERSION;
anc_dev_tdm_gp_set[gp_idx].tdm_clk_set.clk_attri =
Q6AFE_LPASS_CLK_ATTRIBUTE_INVERT_COUPLE_NO;
anc_dev_tdm_gp_set[gp_idx].tdm_clk_set.clk_root =
Q6AFE_LPASS_CLK_ROOT_DEFAULT;
/* extract tdm clk attribute into static */
if (of_find_property(ctx_node,
"qcom,msm-cpudai-tdm-clk-attribute", NULL)) {
rc = of_property_read_u16(ctx_node,
"qcom,msm-cpudai-tdm-clk-attribute",
&anc_dev_tdm_gp_set[gp_idx].tdm_clk_set.clk_attri);
if (rc) {
dev_err(&pdev->dev, "%s: No Clk attribute in DT file %s\n",
__func__,
"qcom,msm-cpudai-tdm-clk-attribute");
goto rtn;
}
} else {
dev_dbg(&pdev->dev, "%s: Clk Attribute from DT file %d\n",
__func__,
anc_dev_tdm_gp_set[gp_idx].tdm_clk_set.clk_attri);
}
/* extract tdm clk src master/slave info into static */
rc = of_property_read_u32(ctx_node,
"qcom,msm-cpudai-tdm-clk-internal",
&anc_dev_tdm_gp_set[gp_idx].clk_mode);
if (rc) {
dev_err(&pdev->dev, "%s: Clk id from DT file %s\n",
__func__, "qcom,msm-cpudai-tdm-clk-internal");
goto rtn;
}
dev_dbg(&pdev->dev, "%s: Clk id from DT file %d\n",
__func__, anc_dev_tdm_gp_set[gp_idx].clk_mode);
rtn:
return rc;
}
static int msm_anc_tdm_dev_port_cfg_info(
struct platform_device *pdev,
struct device_node *ctx_node)
{
int rc = 0;
u32 tdm_dev_id = 0;
int pt_idx = anc_dev_get_free_tdm_port_cfg_idx();
struct device_node *tdm_parent_node = NULL;
if ((pt_idx < 0) || (pt_idx > IDX_TDM_MAX)) {
dev_err(&pdev->dev, "%s: could not get abaiable tdm port cfg slot\n",
__func__);
rc = -EINVAL;
goto rtn;
}
/* retrieve device/afe id */
rc = of_property_read_u32(ctx_node,
"qcom,msm-cpudai-tdm-dev-id",
&tdm_dev_id);
if (rc) {
dev_err(&pdev->dev, "%s: Device ID missing in DT file\n",
__func__);
goto rtn;
}
if ((tdm_dev_id < AFE_PORT_ID_TDM_PORT_RANGE_START) ||
(tdm_dev_id > AFE_PORT_ID_TDM_PORT_RANGE_END)) {
dev_err(&pdev->dev, "%s: Invalid TDM Device ID 0x%x in DT file\n",
__func__, tdm_dev_id);
rc = -ENXIO;
goto rtn;
}
anc_dev_tdm_port_cfg[pt_idx].port_id = tdm_dev_id;
dev_dbg(&pdev->dev, "%s: dev_name: %s dev_id: 0x%x\n",
__func__, dev_name(&pdev->dev), tdm_dev_id);
/* TDM CFG */
tdm_parent_node = of_get_parent(ctx_node);
rc = of_property_read_u32(tdm_parent_node,
"qcom,msm-cpudai-tdm-sync-mode",
(u32 *)&anc_dev_tdm_port_cfg[pt_idx].port_cfg.sync_mode);
if (rc) {
dev_err(&pdev->dev, "%s: Sync Mode from DT file %s\n",
__func__, "qcom,msm-cpudai-tdm-sync-mode");
goto rtn;
}
dev_dbg(&pdev->dev, "%s: Sync Mode from DT file 0x%x\n",
__func__, anc_dev_tdm_port_cfg[pt_idx].port_cfg.sync_mode);
rc = of_property_read_u32(tdm_parent_node,
"qcom,msm-cpudai-tdm-sync-src",
(u32 *)&anc_dev_tdm_port_cfg[pt_idx].port_cfg.sync_src);
if (rc) {
dev_err(&pdev->dev, "%s: Sync Src from DT file %s\n",
__func__, "qcom,msm-cpudai-tdm-sync-src");
goto rtn;
}
dev_dbg(&pdev->dev, "%s: Sync Src from DT file 0x%x\n",
__func__, anc_dev_tdm_port_cfg[pt_idx].port_cfg.sync_src);
rc = of_property_read_u32(tdm_parent_node,
"qcom,msm-cpudai-tdm-data-out",
(u32 *)&anc_dev_tdm_port_cfg[pt_idx].port_cfg.ctrl_data_out_enable);
if (rc) {
dev_err(&pdev->dev, "%s: Data Out from DT file %s\n",
__func__, "qcom,msm-cpudai-tdm-data-out");
goto rtn;
}
dev_dbg(&pdev->dev, "%s: Data Out from DT file 0x%x\n",
__func__,
anc_dev_tdm_port_cfg[pt_idx].port_cfg.ctrl_data_out_enable);
rc = of_property_read_u32(tdm_parent_node,
"qcom,msm-cpudai-tdm-invert-sync",
(u32 *)&anc_dev_tdm_port_cfg[pt_idx].port_cfg.ctrl_invert_sync_pulse);
if (rc) {
dev_err(&pdev->dev, "%s: Invert Sync from DT file %s\n",
__func__, "qcom,msm-cpudai-tdm-invert-sync");
goto rtn;
}
dev_dbg(&pdev->dev, "%s: Invert Sync from DT file 0x%x\n",
__func__,
anc_dev_tdm_port_cfg[pt_idx].port_cfg.ctrl_invert_sync_pulse);
rc = of_property_read_u32(tdm_parent_node,
"qcom,msm-cpudai-tdm-data-delay",
(u32 *)&anc_dev_tdm_port_cfg[pt_idx].port_cfg.ctrl_sync_data_delay);
if (rc) {
dev_err(&pdev->dev, "%s: Data Delay from DT file %s\n",
__func__, "qcom,msm-cpudai-tdm-data-delay");
goto rtn;
}
dev_dbg(&pdev->dev, "%s: Data Delay from DT file 0x%x\n",
__func__,
anc_dev_tdm_port_cfg[pt_idx].port_cfg.ctrl_sync_data_delay);
/* TDM CFG -- set default */
anc_dev_tdm_port_cfg[pt_idx].port_cfg.data_format = AFE_LINEAR_PCM_DATA;
anc_dev_tdm_port_cfg[pt_idx].port_cfg.tdm_cfg_minor_version =
AFE_API_VERSION_TDM_CONFIG;
msm_anc_tdm_dev_group_cfg_info(pdev, tdm_parent_node);
return 0;
rtn:
return rc;
}
static int msm_anc_dev_probe(struct platform_device *pdev)
{
int rc = 0;
u32 port_id = 0;
const uint32_t *layout_array = NULL;
uint32_t num_anc_io = 0;
uint32_t array_length = 0;
int i = 0;
uint32_t sample_rate = 0;
uint32_t num_channels = 0;
uint32_t bit_width = 0;
rc = of_property_read_u32(pdev->dev.of_node,
"qcom,refs-port-id",
(u32 *)&port_id);
if (rc) {
dev_err(&pdev->dev, "%s: ANC refs-port-id DT file %s\n",
__func__, "qcom,refs-port-id");
goto rtn;
}
anc_port_cfg[ANC_DEV_PORT_REFS].port_id = port_id;
dev_dbg(&pdev->dev, "%s: refs-port-id 0x%x\n",
__func__, port_id);
port_id = 0;
rc = of_property_read_u32(pdev->dev.of_node,
"qcom,spkr-port-id",
(u32 *)&port_id);
if (rc) {
dev_err(&pdev->dev, "%s: ANC spkr-port-id DT file %s\n",
__func__, "qcom,spkr-port-id");
goto rtn;
}
anc_port_cfg[ANC_DEV_PORT_ANC_SPKR].port_id = port_id;
dev_dbg(&pdev->dev, "%s: spkr-port-id 0x%x\n",
__func__, port_id);
port_id = 0;
rc = of_property_read_u32(pdev->dev.of_node,
"qcom,mic-port-id",
(u32 *)&port_id);
if (rc) {
dev_err(&pdev->dev, "%s: ANC mic-port-id DT file %s\n",
__func__, "qcom,mic-port-id");
goto rtn;
}
anc_port_cfg[ANC_DEV_PORT_ANC_MIC].port_id = port_id;
dev_dbg(&pdev->dev, "%s: mic-port-id 0x%x\n",
__func__, port_id);
rc = of_property_read_u32(pdev->dev.of_node,
"qcom,sample-rate",
(u32 *)&sample_rate);
if (rc) {
dev_err(&pdev->dev, "%s: ANC sample rate DT file %s\n",
__func__, "qcom,sample-rate");
goto rtn;
}
dev_dbg(&pdev->dev, "%s: ANC sample rate 0x%x\n",
__func__, sample_rate);
rc = of_property_read_u32(pdev->dev.of_node,
"qcom,num-channels",
(u32 *)&num_channels);
if (rc) {
dev_err(&pdev->dev, "%s: ANC num channels DT file %s\n",
__func__, "qcom,num-channels");
goto rtn;
}
dev_dbg(&pdev->dev, "%s: ANC num channel 0x%x\n",
__func__, num_channels);
rc = of_property_read_u32(pdev->dev.of_node,
"qcom,bit-width",
(u32 *)&bit_width);
if (rc) {
dev_err(&pdev->dev, "%s: ANC bit width DT file %s\n",
__func__, "qcom,bit-width");
goto rtn;
}
dev_dbg(&pdev->dev, "%s: ANC bit width 0x%x\n",
__func__, bit_width);
for (i = 0; i < ANC_DEV_PORT_MAX; i++) {
anc_port_cfg[i].sample_rate = sample_rate;
anc_port_cfg[i].num_channels = num_channels;
anc_port_cfg[i].bit_width = bit_width;
}
memset(&anc_mic_spkr_layout, 0, sizeof(anc_mic_spkr_layout));
anc_mic_spkr_layout.minor_version = 1;
rc = of_property_read_u32(pdev->dev.of_node,
"qcom,num-anc-mic",
(u32 *)&num_anc_io);
if (rc) {
dev_err(&pdev->dev, "%s: ANC num_anc_mic DT file %s\n",
__func__, "qcom,num-anc-mic");
goto rtn;
}
layout_array = of_get_property(pdev->dev.of_node,
"qcom,anc-mic-array",
&array_length);
if (layout_array == NULL) {
dev_err(&pdev->dev, "%s layout_array is not valid\n",
__func__);
rc = -EINVAL;
goto rtn;
}
if (array_length != sizeof(uint32_t) * num_anc_io) {
dev_err(&pdev->dev, "%s array_length is %d, expected is %zd\n",
__func__, array_length,
sizeof(uint32_t) * num_anc_io);
rc = -EINVAL;
goto rtn;
}
anc_mic_spkr_layout.num_anc_mic = num_anc_io;
for (i = 0; i < num_anc_io; i++)
anc_mic_spkr_layout.mic_layout_array[i] =
(u16)be32_to_cpu(layout_array[i]);
num_anc_io = 0;
rc = of_property_read_u32(pdev->dev.of_node,
"qcom,num-anc-spkr",
(u32 *)&num_anc_io);
if (rc) {
dev_err(&pdev->dev, "%s: ANC num_anc_mic DT file %s\n",
__func__, "qcom,num-anc-spkr");
goto rtn;
}
layout_array = of_get_property(pdev->dev.of_node,
"qcom,anc-spkr-array",
&array_length);
if (layout_array == NULL) {
dev_err(&pdev->dev, "%s layout_array is not valid\n",
__func__);
rc = -EINVAL;
goto rtn;
}
if (array_length != sizeof(uint32_t) * num_anc_io) {
dev_err(&pdev->dev, "%s array_length is %d, expected is %zd\n",
__func__, array_length,
sizeof(uint32_t) * num_anc_io);
rc = -EINVAL;
goto rtn;
}
anc_mic_spkr_layout.num_anc_spkr = num_anc_io;
for (i = 0; i < num_anc_io; i++)
anc_mic_spkr_layout.spkr_layout_array[i] =
(u16)be32_to_cpu(layout_array[i]);
dev_dbg(&pdev->dev, "%s: num_anc_mic 0x%x\n",
__func__, anc_mic_spkr_layout.num_anc_mic);
dev_dbg(&pdev->dev, "%s: num_anc_spkr 0x%x\n",
__func__, anc_mic_spkr_layout.num_anc_spkr);
num_anc_io = 0;
rc = of_property_read_u32(pdev->dev.of_node,
"qcom,num-add-mic-signal",
(u32 *)&num_anc_io);
if (rc) {
dev_err(&pdev->dev, "%s: ANC num_add_mic_signal DT file %s\n",
__func__, "qcom,num-add-mic-signal");
goto rtn;
}
anc_mic_spkr_layout.num_add_mic_signal = num_anc_io;
num_anc_io = 0;
rc = of_property_read_u32(pdev->dev.of_node,
"qcom,num-add-spkr-signal",
(u32 *)&num_anc_io);
if (rc) {
dev_err(&pdev->dev, "%s: ANC num_add_spkr_signal DT file %s\n",
__func__, "qcom,num-add-spkr-signal");
goto rtn;
}
anc_mic_spkr_layout.num_add_spkr_signal = num_anc_io;
dev_dbg(&pdev->dev, "%s: num_add_mic_signal 0x%x\n",
__func__, anc_mic_spkr_layout.num_add_mic_signal);
dev_dbg(&pdev->dev, "%s: num_add_spkr_signal 0x%x\n",
__func__, anc_mic_spkr_layout.num_add_spkr_signal);
/* TDM group CFG and TDM port CFG */
{
struct device_node *ctx_node = NULL;
ctx_node = of_parse_phandle(pdev->dev.of_node,
"qcom,refs-tdm-rx", 0);
if (!ctx_node) {
pr_err("%s Could not find refs-tdm-rx info\n",
__func__);
return -EINVAL;
}
rc = msm_anc_tdm_dev_port_cfg_info(pdev, ctx_node);
if (IS_ERR_VALUE(rc)) {
pr_err("%s: fail to probe TDM group info\n",
__func__);
}
ctx_node = of_parse_phandle(pdev->dev.of_node,
"qcom,spkr-tdm-rx", 0);
if (!ctx_node) {
pr_err("%s Could not find spkr-tdm-rx info\n",
__func__);
return -EINVAL;
}
rc = msm_anc_tdm_dev_port_cfg_info(pdev, ctx_node);
if (IS_ERR_VALUE(rc)) {
pr_err("%s: fail to probe TDM group info\n",
__func__);
}
ctx_node = of_parse_phandle(pdev->dev.of_node,
"qcom,mic-tdm-tx", 0);
if (!ctx_node) {
pr_err("%s Could not find mic-tdm-tx info\n",
__func__);
return -EINVAL;
}
rc = msm_anc_tdm_dev_port_cfg_info(pdev, ctx_node);
if (IS_ERR_VALUE(rc)) {
pr_err("%s: fail to probe TDM group info\n",
__func__);
}
}
rc = msm_anc_dev_create(pdev);
rtn:
return rc;
}
static int msm_anc_dev_remove(struct platform_device *pdev)
{
return msm_anc_dev_destroy(pdev);
}
static const struct of_device_id msm_anc_dev_dt_match[] = {
{ .compatible = "qcom,msm-ext-anc", },
{}
};
MODULE_DEVICE_TABLE(of, msm_anc_dev_dt_match);
static struct platform_driver msm_anc_dev = {
.probe = msm_anc_dev_probe,
.remove = msm_anc_dev_remove,
.driver = {
.name = "msm-ext-anc",
.owner = THIS_MODULE,
.of_match_table = msm_anc_dev_dt_match,
},
};
int msm_anc_dev_init(void)
{
int rc = 0;
memset(&anc_dev_tdm_gp_set, 0, sizeof(anc_dev_tdm_gp_set));
memset(&anc_dev_tdm_port_cfg, 0, sizeof(anc_dev_tdm_port_cfg));
memset(&anc_port_cfg, 0, sizeof(anc_port_cfg));
memset(&this_anc_dev_info, 0, sizeof(this_anc_dev_info));
rc = platform_driver_register(&msm_anc_dev);
if (rc)
pr_err("%s: fail to register msm ANC device driver\n",
__func__);
return rc;
}
int msm_anc_dev_deinit(void)
{
platform_driver_unregister(&msm_anc_dev);
return 0;
}
|