-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrt5659.c
5917 lines (5190 loc) · 173 KB
/
rt5659.c
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
/*
* rt5659.c -- RT5659/RT5658 ALSA SoC audio codec driver
*
* Copyright 2015 Realtek Semiconductor Corp.
* Author: Bard Liao <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/pm.h>
#include <linux/i2c.h>
#include <linux/platform_device.h>
#include <linux/spi/spi.h>
#include <linux/acpi.h>
#include <linux/mutex.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/jack.h>
#include <sound/soc.h>
#include <sound/soc-dapm.h>
#include <sound/initval.h>
#include <sound/tlv.h>
#include <sound/rt5659.h>
#include <linux/regulator/consumer.h>
#include "rt5659.h"
#ifdef CONFIG_DYNAMIC_MICBIAS_CONTROL_RT5659
static struct snd_soc_codec *registered_codec;
#endif
static struct class *codec_efs_class;
static struct device *codec_efs_dev;
/* Delay(ms) after powering on DMIC for avoiding pop */
static int dmic_power_delay = 450;
module_param(dmic_power_delay, int, 0644);
#if defined(CONFIG_SEC_FACTORY)
static int adc_power_delay = 200;
#else
static int adc_power_delay = 100;
#endif
module_param(adc_power_delay, int, 0644);
#define VERSION "0.4 alsa 1.0.25"
#define VDD_CODEC_1P8 "vdd_codec_1p8_ap"
#define VDD_CODEC_3P3 "vdd_codec_3p3_ap"
static struct reg_default init_list[] = {
{RT5659_BIAS_CUR_CTRL_8, 0xa502},
{RT5659_CHOP_DAC, 0x3030},
{RT5659_PRE_DIV_1, 0xef00},
{RT5659_PRE_DIV_2, 0xeffc},
{RT5659_MONO_GAIN, 0x0003},
{RT5659_CLASSD_0, 0x2021},
{RT5659_HP_CALIB_CTRL_7, 0x0000},
/* Jack detect (JD3 to IRQ)*/
{RT5659_RC_CLK_CTRL, 0x9000},
{RT5659_GPIO_CTRL_1, 0x8000}, /*set GPIO1 to IRQ*/
{RT5659_GPIO_CTRL_2, 0x8000}, /*set GPIO to I2S3*/
{RT5659_PWR_ANLG_2, 0x0001}, /*JD3 power on */
{RT5659_IRQ_CTRL_2, 0x0040}, /*JD3 detection*/
{RT5659_EJD_CTRL_1, 0x70c0},
{RT5659_ASRC_8, 0x0120},
{RT5659_4BTN_IL_CMD_1, 0x000b},
{RT5659_MONO_DRE_CTRL_2, 0x003a},
{RT5659_DUMMY_2, 0x001d},
};
#define RT5659_INIT_REG_LEN ARRAY_SIZE(init_list)
static const struct reg_default rt5659_reg[RT5659_ADC_R_EQ_POST_VOL + 1] = {
{ 0x0000, 0x0000 },
{ 0x0001, 0x4848 },
{ 0x0002, 0x8080 },
{ 0x0003, 0xc8c8 },
{ 0x0004, 0xc80a },
{ 0x0005, 0x0000 },
{ 0x0006, 0x0000 },
{ 0x0007, 0x0103 },
{ 0x0008, 0x0080 },
{ 0x0009, 0x0000 },
{ 0x000a, 0x0000 },
{ 0x000c, 0x0000 },
{ 0x000d, 0x0000 },
{ 0x000f, 0x0808 },
{ 0x0010, 0x3080 },
{ 0x0011, 0x4a00 },
{ 0x0012, 0x4e00 },
{ 0x0015, 0x42c1 },
{ 0x0016, 0x0000 },
{ 0x0018, 0x000b },
{ 0x0019, 0xafaf },
{ 0x001a, 0xafaf },
{ 0x001b, 0x0011 },
{ 0x001c, 0x2f2f },
{ 0x001d, 0x2f2f },
{ 0x001e, 0x2f2f },
{ 0x001f, 0x0000 },
{ 0x0020, 0x0000 },
{ 0x0021, 0x0000 },
{ 0x0022, 0x5757 },
{ 0x0023, 0x0039 },
{ 0x0026, 0xc060 },
{ 0x0027, 0xd8d8 },
{ 0x0029, 0x8080 },
{ 0x002a, 0xaaaa },
{ 0x002b, 0xaaaa },
{ 0x002c, 0x00af },
{ 0x002d, 0x0000 },
{ 0x002f, 0x1002 },
{ 0x0031, 0x5000 },
{ 0x0032, 0x0000 },
{ 0x0033, 0x0000 },
{ 0x0034, 0x0000 },
{ 0x0035, 0x0000 },
{ 0x0036, 0x0000 },
{ 0x003a, 0x0000 },
{ 0x003b, 0x0000 },
{ 0x003c, 0x007f },
{ 0x003d, 0x0000 },
{ 0x003e, 0x007f },
{ 0x0040, 0x0808 },
{ 0x0046, 0x001f },
{ 0x0047, 0x001f },
{ 0x0048, 0x0003 },
{ 0x0049, 0xe061 },
{ 0x004a, 0x0000 },
{ 0x004b, 0x031f },
{ 0x004d, 0x0000 },
{ 0x004e, 0x001f },
{ 0x004f, 0x0000 },
{ 0x0050, 0x001f },
{ 0x0052, 0xf000 },
{ 0x0053, 0x0111 },
{ 0x0054, 0x0064 },
{ 0x0055, 0x0080 },
{ 0x0056, 0xef0e },
{ 0x0057, 0xf0f0 },
{ 0x0058, 0xef0e },
{ 0x0059, 0xf0f0 },
{ 0x005a, 0xef0e },
{ 0x005b, 0xf0f0 },
{ 0x005c, 0xf000 },
{ 0x005d, 0x0000 },
{ 0x005e, 0x1f2c },
{ 0x005f, 0x1f2c },
{ 0x0060, 0x2717 },
{ 0x0061, 0x0000 },
{ 0x0062, 0x0000 },
{ 0x0063, 0x003e },
{ 0x0064, 0x0000 },
{ 0x0065, 0x0000 },
{ 0x0066, 0x0000 },
{ 0x0067, 0x0000 },
{ 0x006a, 0x0000 },
{ 0x006b, 0x0000 },
{ 0x006c, 0x0000 },
{ 0x006e, 0x0000 },
{ 0x006f, 0x0000 },
{ 0x0070, 0x8000 },
{ 0x0071, 0x8000 },
{ 0x0072, 0x8000 },
{ 0x0073, 0x1110 },
{ 0x0074, 0xfe00 },
{ 0x0075, 0x2409 },
{ 0x0076, 0x000a },
{ 0x0077, 0x00f0 },
{ 0x0078, 0x0000 },
{ 0x0079, 0x0000 },
{ 0x007a, 0x0123 },
{ 0x007b, 0x8003 },
{ 0x0080, 0x0000 },
{ 0x0081, 0x0000 },
{ 0x0082, 0x0000 },
{ 0x0083, 0x0000 },
{ 0x0084, 0x0000 },
{ 0x0085, 0x0000 },
{ 0x0086, 0x0008 },
{ 0x0087, 0x0000 },
{ 0x0088, 0x0000 },
{ 0x0089, 0x0000 },
{ 0x008a, 0x0000 },
{ 0x008b, 0x0000 },
{ 0x008c, 0x0003 },
{ 0x008e, 0x0000 },
{ 0x008f, 0x1000 },
{ 0x0090, 0x0646 },
{ 0x0091, 0x0c16 },
{ 0x0092, 0x0073 },
{ 0x0093, 0x0000 },
{ 0x0094, 0x0080 },
{ 0x0097, 0x0000 },
{ 0x0098, 0x0000 },
{ 0x0099, 0x0000 },
{ 0x009a, 0x0000 },
{ 0x009b, 0x0000 },
{ 0x009c, 0x007f },
{ 0x009d, 0x0000 },
{ 0x009e, 0x007f },
{ 0x009f, 0x0000 },
{ 0x00a0, 0x0060 },
{ 0x00a1, 0x90a1 },
{ 0x00ae, 0x2000 },
{ 0x00af, 0x0000 },
{ 0x00b0, 0x2000 },
{ 0x00b1, 0x0000 },
{ 0x00b2, 0x0000 },
{ 0x00b6, 0x0000 },
{ 0x00b7, 0x0000 },
{ 0x00b8, 0x0000 },
{ 0x00b9, 0x0000 },
{ 0x00ba, 0x0000 },
{ 0x00bb, 0x0000 },
{ 0x00be, 0x0000 },
{ 0x00bf, 0x0000 },
{ 0x00c0, 0x0000 },
{ 0x00c1, 0x0000 },
{ 0x00c2, 0x0000 },
{ 0x00c3, 0x0000 },
{ 0x00c4, 0x0003 },
{ 0x00c5, 0x0000 },
{ 0x00cb, 0xa02f },
{ 0x00cc, 0x0000 },
{ 0x00cd, 0x0e02 },
{ 0x00d6, 0x0000 },
{ 0x00d7, 0x2244 },
{ 0x00d9, 0x0809 },
{ 0x00da, 0x0000 },
{ 0x00db, 0x0008 },
{ 0x00dc, 0x00c0 },
{ 0x00dd, 0x6724 },
{ 0x00de, 0x3131 },
{ 0x00df, 0x0008 },
{ 0x00e0, 0x4000 },
{ 0x00e1, 0x3131 },
{ 0x00e4, 0x400c },
{ 0x00e5, 0x8031 },
{ 0x00ea, 0xb320 },
{ 0x00eb, 0x0000 },
{ 0x00ec, 0xb300 },
{ 0x00ed, 0x0000 },
{ 0x00f0, 0x0000 },
{ 0x00f1, 0x0202 },
{ 0x00f2, 0x0ddd },
{ 0x00f3, 0x0ddd },
{ 0x00f4, 0x0ddd },
{ 0x00f6, 0x0000 },
{ 0x00f7, 0x0000 },
{ 0x00f8, 0x0000 },
{ 0x00f9, 0x0000 },
{ 0x00fa, 0x8000 },
{ 0x00fb, 0x0000 },
{ 0x00fc, 0x0000 },
{ 0x00fd, 0x0001 },
{ 0x00fe, 0x10ec },
{ 0x00ff, 0x6311 },
{ 0x0100, 0xaaaa },
{ 0x010a, 0xaaaa },
{ 0x010b, 0x00a0 },
{ 0x010c, 0xaeae },
{ 0x010d, 0xaaaa },
{ 0x010e, 0xaaa8 },
{ 0x010f, 0xa0aa },
{ 0x0110, 0xe02a },
{ 0x0111, 0xa702 },
{ 0x0112, 0xaaaa },
{ 0x0113, 0x2800 },
{ 0x0116, 0x0000 },
{ 0x0117, 0x0f00 },
{ 0x011a, 0x0020 },
{ 0x011b, 0x0011 },
{ 0x011c, 0x0150 },
{ 0x011d, 0x0000 },
{ 0x011e, 0x0000 },
{ 0x011f, 0x0000 },
{ 0x0120, 0x0000 },
{ 0x0121, 0x009b },
{ 0x0122, 0x5014 },
{ 0x0123, 0x0421 },
{ 0x0124, 0x7cea },
{ 0x0125, 0x0420 },
{ 0x0126, 0x5550 },
{ 0x0132, 0x0000 },
{ 0x0133, 0x0000 },
{ 0x0137, 0x5055 },
{ 0x0138, 0x3700 },
{ 0x0139, 0x79a1 },
{ 0x013a, 0x2020 },
{ 0x013b, 0x2020 },
{ 0x013c, 0x2005 },
{ 0x013e, 0x1f00 },
{ 0x013f, 0x0000 },
{ 0x0145, 0x0002 },
{ 0x0146, 0x0000 },
{ 0x0147, 0x0000 },
{ 0x0148, 0x0000 },
{ 0x0150, 0x1813 },
{ 0x0151, 0x0690 },
{ 0x0152, 0x1c17 },
{ 0x0153, 0x6883 },
{ 0x0154, 0xd3ce },
{ 0x0155, 0x352d },
{ 0x0156, 0x00eb },
{ 0x0157, 0x3717 },
{ 0x0158, 0x4c6a },
{ 0x0159, 0xe41b },
{ 0x015a, 0x2a13 },
{ 0x015b, 0xb600 },
{ 0x015c, 0xc730 },
{ 0x015d, 0x35d4 },
{ 0x015e, 0x00bf },
{ 0x0160, 0x0ec0 },
{ 0x0161, 0x0020 },
{ 0x0162, 0x0080 },
{ 0x0163, 0x0800 },
{ 0x0164, 0x0000 },
{ 0x0165, 0x0000 },
{ 0x0166, 0x0000 },
{ 0x0167, 0x001f },
{ 0x0170, 0x4e80 },
{ 0x0171, 0x0020 },
{ 0x0172, 0x0080 },
{ 0x0173, 0x0800 },
{ 0x0174, 0x000c },
{ 0x0175, 0x0000 },
{ 0x0190, 0x3300 },
{ 0x0191, 0x2200 },
{ 0x0192, 0x0000 },
{ 0x01b0, 0x4b38 },
{ 0x01b1, 0x0000 },
{ 0x01b2, 0x0000 },
{ 0x01b3, 0x0000 },
{ 0x01c0, 0x0045 },
{ 0x01c1, 0x0540 },
{ 0x01c2, 0x0000 },
{ 0x01c3, 0x0030 },
{ 0x01c7, 0x0000 },
{ 0x01c8, 0x5757 },
{ 0x01c9, 0x5757 },
{ 0x01ca, 0x5757 },
{ 0x01cb, 0x5757 },
{ 0x01cc, 0x5757 },
{ 0x01cd, 0x5757 },
{ 0x01ce, 0x006f },
{ 0x01da, 0x0000 },
{ 0x01db, 0x0000 },
{ 0x01de, 0x7d00 },
{ 0x01df, 0x10c0 },
{ 0x01e0, 0x06a1 },
{ 0x01e1, 0x0000 },
{ 0x01e2, 0x0000 },
{ 0x01e3, 0x0000 },
{ 0x01e4, 0x0001 },
{ 0x01e6, 0x0000 },
{ 0x01e7, 0x0000 },
{ 0x01e8, 0x0000 },
{ 0x01ea, 0x0000 },
{ 0x01eb, 0x0000 },
{ 0x01ec, 0x0000 },
{ 0x01ed, 0x0000 },
{ 0x01ee, 0x0000 },
{ 0x01ef, 0x0000 },
{ 0x01f0, 0x0000 },
{ 0x01f1, 0x0000 },
{ 0x01f2, 0x0000 },
{ 0x01f6, 0x1e04 },
{ 0x01f7, 0x01a1 },
{ 0x01f8, 0x0000 },
{ 0x01f9, 0x0000 },
{ 0x01fa, 0x0002 },
{ 0x01fb, 0x0000 },
{ 0x01fc, 0x0000 },
{ 0x01fd, 0x0000 },
{ 0x01fe, 0x0000 },
{ 0x0200, 0x066c },
{ 0x0201, 0x7fff },
{ 0x0202, 0x7fff },
{ 0x0203, 0x0000 },
{ 0x0204, 0x0000 },
{ 0x0205, 0x0000 },
{ 0x0206, 0x0000 },
{ 0x0207, 0x0000 },
{ 0x0208, 0x0000 },
{ 0x0256, 0x0000 },
{ 0x0257, 0x0000 },
{ 0x0258, 0x0000 },
{ 0x0259, 0x0000 },
{ 0x025a, 0x0000 },
{ 0x025b, 0x3333 },
{ 0x025c, 0x3333 },
{ 0x025d, 0x3333 },
{ 0x025e, 0x0000 },
{ 0x025f, 0x0000 },
{ 0x0260, 0x0000 },
{ 0x0261, 0x0022 },
{ 0x0262, 0x0300 },
{ 0x0265, 0x1e80 },
{ 0x0266, 0x0131 },
{ 0x0267, 0x0003 },
{ 0x0268, 0x0000 },
{ 0x0269, 0x0000 },
{ 0x026a, 0x0000 },
{ 0x026b, 0x0000 },
{ 0x026c, 0x0000 },
{ 0x026d, 0x0000 },
{ 0x026e, 0x0000 },
{ 0x026f, 0x0000 },
{ 0x0270, 0x0000 },
{ 0x0271, 0x0000 },
{ 0x0272, 0x0000 },
{ 0x0273, 0x0000 },
{ 0x0280, 0x0000 },
{ 0x0281, 0x0000 },
{ 0x0282, 0x0418 },
{ 0x0283, 0x7fff },
{ 0x0284, 0x7000 },
{ 0x0290, 0x01d0 },
{ 0x0291, 0x0100 },
{ 0x02fa, 0x0000 },
{ 0x02fb, 0x0000 },
{ 0x02fc, 0x0000 },
{ 0x0300, 0x001f },
{ 0x0301, 0x032c },
{ 0x0302, 0x5f21 },
{ 0x0303, 0x4000 },
{ 0x0304, 0x4000 },
{ 0x0305, 0x0600 },
{ 0x0306, 0x8000 },
{ 0x0307, 0x0700 },
{ 0x0308, 0x001f },
{ 0x0309, 0x032c },
{ 0x030a, 0x5f21 },
{ 0x030b, 0x4000 },
{ 0x030c, 0x4000 },
{ 0x030d, 0x0600 },
{ 0x030e, 0x8000 },
{ 0x030f, 0x0700 },
{ 0x0310, 0x4560 },
{ 0x0311, 0xa4a8 },
{ 0x0312, 0x7418 },
{ 0x0313, 0x0000 },
{ 0x0314, 0x0006 },
{ 0x0315, 0x00ff },
{ 0x0316, 0xc400 },
{ 0x0317, 0x4560 },
{ 0x0318, 0xa4a8 },
{ 0x0319, 0x7418 },
{ 0x031a, 0x0000 },
{ 0x031b, 0x0006 },
{ 0x031c, 0x00ff },
{ 0x031d, 0xc400 },
{ 0x0320, 0x0f20 },
{ 0x0321, 0x8700 },
{ 0x0322, 0x7dc2 },
{ 0x0323, 0xa178 },
{ 0x0324, 0x5383 },
{ 0x0325, 0x7dc2 },
{ 0x0326, 0xa178 },
{ 0x0327, 0x5383 },
{ 0x0328, 0x003e },
{ 0x0329, 0x02c1 },
{ 0x032a, 0xd37d },
{ 0x0330, 0x00a6 },
{ 0x0331, 0x04c3 },
{ 0x0332, 0x27c8 },
{ 0x0333, 0xbf50 },
{ 0x0334, 0x0045 },
{ 0x0335, 0x2007 },
{ 0x0336, 0x7418 },
{ 0x0337, 0x0501 },
{ 0x0338, 0x0000 },
{ 0x0339, 0x0010 },
{ 0x033a, 0x1010 },
{ 0x0340, 0x0800 },
{ 0x0341, 0x0800 },
{ 0x0342, 0x0800 },
{ 0x0343, 0x0800 },
{ 0x0344, 0x0000 },
{ 0x0345, 0x0000 },
{ 0x0346, 0x0000 },
{ 0x0347, 0x0000 },
{ 0x0348, 0x0000 },
{ 0x0349, 0x0000 },
{ 0x034a, 0x0000 },
{ 0x034b, 0x0000 },
{ 0x034c, 0x0000 },
{ 0x034d, 0x0000 },
{ 0x034e, 0x0000 },
{ 0x034f, 0x0000 },
{ 0x0350, 0x0000 },
{ 0x0351, 0x0000 },
{ 0x0352, 0x0000 },
{ 0x0353, 0x0000 },
{ 0x0354, 0x0000 },
{ 0x0355, 0x0000 },
{ 0x0356, 0x0000 },
{ 0x0357, 0x0000 },
{ 0x0358, 0x0000 },
{ 0x0359, 0x0000 },
{ 0x035a, 0x0000 },
{ 0x035b, 0x0000 },
{ 0x035c, 0x0000 },
{ 0x035d, 0x0000 },
{ 0x035e, 0x2000 },
{ 0x035f, 0x0000 },
{ 0x0360, 0x2000 },
{ 0x0361, 0x2000 },
{ 0x0362, 0x0000 },
{ 0x0363, 0x2000 },
{ 0x0364, 0x0200 },
{ 0x0365, 0x0000 },
{ 0x0366, 0x0000 },
{ 0x0367, 0x0000 },
{ 0x0368, 0x0000 },
{ 0x0369, 0x0000 },
{ 0x036a, 0x0000 },
{ 0x036b, 0x0000 },
{ 0x036c, 0x0000 },
{ 0x036d, 0x0000 },
{ 0x036e, 0x0200 },
{ 0x036f, 0x0000 },
{ 0x0370, 0x0000 },
{ 0x0371, 0x0000 },
{ 0x0372, 0x0000 },
{ 0x0373, 0x0000 },
{ 0x0374, 0x0000 },
{ 0x0375, 0x0000 },
{ 0x0376, 0x0000 },
{ 0x0377, 0x0000 },
{ 0x03d0, 0x0000 },
{ 0x03d1, 0x0000 },
{ 0x03d2, 0x0000 },
{ 0x03d3, 0x0000 },
{ 0x03d4, 0x2000 },
{ 0x03d5, 0x2000 },
{ 0x03d6, 0x0000 },
{ 0x03d7, 0x0000 },
{ 0x03d8, 0x2000 },
{ 0x03d9, 0x2000 },
{ 0x03da, 0x2000 },
{ 0x03db, 0x2000 },
{ 0x03dc, 0x0000 },
{ 0x03dd, 0x0000 },
{ 0x03de, 0x0000 },
{ 0x03df, 0x2000 },
{ 0x03e0, 0x0000 },
{ 0x03e1, 0x0000 },
{ 0x03e2, 0x0000 },
{ 0x03e3, 0x0000 },
{ 0x03e4, 0x0000 },
{ 0x03e5, 0x0000 },
{ 0x03e6, 0x0000 },
{ 0x03e7, 0x0000 },
{ 0x03e8, 0x0000 },
{ 0x03e9, 0x0000 },
{ 0x03ea, 0x0000 },
{ 0x03eb, 0x0000 },
{ 0x03ec, 0x0000 },
{ 0x03ed, 0x0000 },
{ 0x03ee, 0x0000 },
{ 0x03ef, 0x0000 },
{ 0x03f0, 0x0800 },
{ 0x03f1, 0x0800 },
{ 0x03f2, 0x0800 },
{ 0x03f3, 0x0800 },
};
static bool rt5659_volatile_register(struct device *dev, unsigned int reg)
{
switch (reg) {
case RT5659_RESET:
case RT5659_EJD_CTRL_2:
case RT5659_SILENCE_CTRL:
case RT5659_DAC1_DIG_VOL:
case RT5659_DAC2_DIG_VOL:
case RT5659_DAC_CTRL:
case RT5659_HP_IMP_GAIN_2:
case RT5659_AD_DA_MIXER:
case RT5659_PDM_OUT_CTRL:
case RT5659_PDM_DATA_CTRL_1:
case RT5659_PDM_DATA_CTRL_4:
case RT5659_HAPTIC_GEN_CTRL_1:
case RT5659_HAPTIC_GEN_CTRL_3:
case RT5659_HAPTIC_LPF_CTRL_3:
case RT5659_CLK_DET:
case RT5659_PLL_CTRL_2:
case RT5659_MICBIAS_1:
case RT5659_ASRC_11:
case RT5659_ADC_EQ_CTRL_1:
case RT5659_DAC_EQ_CTRL_1:
case RT5659_INT_ST_1:
case RT5659_INT_ST_2:
case RT5659_GPIO_STA:
case RT5659_SINE_GEN_CTRL_1:
case RT5659_IL_CMD_1:
case RT5659_4BTN_IL_CMD_1:
case RT5659_PSV_IL_CMD_1:
case RT5659_AJD1_CTRL:
case RT5659_AJD2_AJD3_CTRL:
case RT5659_JD_CTRL_3:
case RT5659_VENDOR_ID:
case RT5659_VENDOR_ID_1:
case RT5659_DEVICE_ID:
case RT5659_MEMORY_TEST:
case RT5659_SOFT_RAMP_DEPOP_DAC_CLK_CTRL:
case RT5659_VOL_TEST:
case RT5659_STO_DRE_CTRL_1:
case RT5659_STO_DRE_CTRL_5:
case RT5659_STO_DRE_CTRL_6:
case RT5659_STO_DRE_CTRL_7:
case RT5659_MONO_DRE_CTRL_1:
case RT5659_MONO_DRE_CTRL_5:
case RT5659_MONO_DRE_CTRL_6:
case RT5659_HP_IMP_SENS_CTRL_1:
case RT5659_HP_IMP_SENS_CTRL_3:
case RT5659_HP_IMP_SENS_CTRL_4:
case RT5659_HP_CALIB_CTRL_1:
case RT5659_HP_CALIB_CTRL_9:
case RT5659_HP_CALIB_STA_1:
case RT5659_HP_CALIB_STA_2:
case RT5659_HP_CALIB_STA_3:
case RT5659_HP_CALIB_STA_4:
case RT5659_HP_CALIB_STA_5:
case RT5659_HP_CALIB_STA_6:
case RT5659_HP_CALIB_STA_7:
case RT5659_HP_CALIB_STA_8:
case RT5659_HP_CALIB_STA_9:
case RT5659_MONO_AMP_CALIB_CTRL_1:
case RT5659_MONO_AMP_CALIB_CTRL_3:
case RT5659_MONO_AMP_CALIB_STA_1:
case RT5659_MONO_AMP_CALIB_STA_2:
case RT5659_MONO_AMP_CALIB_STA_3:
case RT5659_MONO_AMP_CALIB_STA_4:
case RT5659_SPK_PWR_LMT_STA_1:
case RT5659_SPK_PWR_LMT_STA_2:
case RT5659_SPK_PWR_LMT_STA_3:
case RT5659_SPK_PWR_LMT_STA_4:
case RT5659_SPK_PWR_LMT_STA_5:
case RT5659_SPK_PWR_LMT_STA_6:
case RT5659_SPK_DC_CAILB_CTRL_1:
case RT5659_SPK_DC_CAILB_STA_1:
case RT5659_SPK_DC_CAILB_STA_2:
case RT5659_SPK_DC_CAILB_STA_3:
case RT5659_SPK_DC_CAILB_STA_4:
case RT5659_SPK_DC_CAILB_STA_5:
case RT5659_SPK_DC_CAILB_STA_6:
case RT5659_SPK_DC_CAILB_STA_7:
case RT5659_SPK_DC_CAILB_STA_8:
case RT5659_SPK_DC_CAILB_STA_9:
case RT5659_SPK_DC_CAILB_STA_10:
case RT5659_SPK_VDD_STA_1:
case RT5659_SPK_VDD_STA_2:
case RT5659_SPK_DC_DET_CTRL_1:
case RT5659_PURE_DC_DET_CTRL_1:
case RT5659_PURE_DC_DET_CTRL_2:
case RT5659_DRC1_PRIV_1:
case RT5659_DRC1_PRIV_4:
case RT5659_DRC1_PRIV_5:
case RT5659_DRC1_PRIV_6:
case RT5659_DRC1_PRIV_7:
case RT5659_DRC2_PRIV_1:
case RT5659_DRC2_PRIV_4:
case RT5659_DRC2_PRIV_5:
case RT5659_DRC2_PRIV_6:
case RT5659_DRC2_PRIV_7:
case RT5659_ALC_PGA_STA_1:
case RT5659_ALC_PGA_STA_2:
case RT5659_ALC_PGA_STA_3:
return true;
default:
return false;
}
}
static bool rt5659_readable_register(struct device *dev, unsigned int reg)
{
switch (reg) {
case RT5659_RESET:
case RT5659_SPO_VOL:
case RT5659_HP_VOL:
case RT5659_LOUT:
case RT5659_MONO_OUT:
case RT5659_HPL_GAIN:
case RT5659_HPR_GAIN:
case RT5659_MONO_GAIN:
case RT5659_SPDIF_CTRL_1:
case RT5659_SPDIF_CTRL_2:
case RT5659_CAL_BST_CTRL:
case RT5659_IN1_IN2:
case RT5659_IN3_IN4:
case RT5659_INL1_INR1_VOL:
case RT5659_EJD_CTRL_1:
case RT5659_EJD_CTRL_2:
case RT5659_EJD_CTRL_3:
case RT5659_SILENCE_CTRL:
case RT5659_PSV_CTRL:
case RT5659_SIDETONE_CTRL:
case RT5659_DAC1_DIG_VOL:
case RT5659_DAC2_DIG_VOL:
case RT5659_DAC_CTRL:
case RT5659_STO1_ADC_DIG_VOL:
case RT5659_MONO_ADC_DIG_VOL:
case RT5659_STO2_ADC_DIG_VOL:
case RT5659_STO1_BOOST:
case RT5659_MONO_BOOST:
case RT5659_STO2_BOOST:
case RT5659_HP_IMP_GAIN_1:
case RT5659_HP_IMP_GAIN_2:
case RT5659_STO1_ADC_MIXER:
case RT5659_MONO_ADC_MIXER:
case RT5659_AD_DA_MIXER:
case RT5659_STO_DAC_MIXER:
case RT5659_MONO_DAC_MIXER:
case RT5659_DIG_MIXER:
case RT5659_A_DAC_MUX:
case RT5659_DIG_INF23_DATA:
case RT5659_PDM_OUT_CTRL:
case RT5659_PDM_DATA_CTRL_1:
case RT5659_PDM_DATA_CTRL_2:
case RT5659_PDM_DATA_CTRL_3:
case RT5659_PDM_DATA_CTRL_4:
case RT5659_SPDIF_CTRL:
case RT5659_REC1_GAIN:
case RT5659_REC1_L1_MIXER:
case RT5659_REC1_L2_MIXER:
case RT5659_REC1_R1_MIXER:
case RT5659_REC1_R2_MIXER:
case RT5659_CAL_REC:
case RT5659_REC2_L1_MIXER:
case RT5659_REC2_L2_MIXER:
case RT5659_REC2_R1_MIXER:
case RT5659_REC2_R2_MIXER:
case RT5659_SPK_L_MIXER:
case RT5659_SPK_R_MIXER:
case RT5659_SPO_AMP_GAIN:
case RT5659_ALC_BACK_GAIN:
case RT5659_MONOMIX_GAIN:
case RT5659_MONOMIX_IN_GAIN:
case RT5659_OUT_L_GAIN:
case RT5659_OUT_L_MIXER:
case RT5659_OUT_R_GAIN:
case RT5659_OUT_R_MIXER:
case RT5659_LOUT_MIXER:
case RT5659_HAPTIC_GEN_CTRL_1:
case RT5659_HAPTIC_GEN_CTRL_2:
case RT5659_HAPTIC_GEN_CTRL_3:
case RT5659_HAPTIC_GEN_CTRL_4:
case RT5659_HAPTIC_GEN_CTRL_5:
case RT5659_HAPTIC_GEN_CTRL_6:
case RT5659_HAPTIC_GEN_CTRL_7:
case RT5659_HAPTIC_GEN_CTRL_8:
case RT5659_HAPTIC_GEN_CTRL_9:
case RT5659_HAPTIC_GEN_CTRL_10:
case RT5659_HAPTIC_GEN_CTRL_11:
case RT5659_HAPTIC_LPF_CTRL_1:
case RT5659_HAPTIC_LPF_CTRL_2:
case RT5659_HAPTIC_LPF_CTRL_3:
case RT5659_PWR_DIG_1:
case RT5659_PWR_DIG_2:
case RT5659_PWR_ANLG_1:
case RT5659_PWR_ANLG_2:
case RT5659_PWR_ANLG_3:
case RT5659_PWR_MIXER:
case RT5659_PWR_VOL:
case RT5659_PRIV_INDEX:
case RT5659_CLK_DET:
case RT5659_PRIV_DATA:
case RT5659_PRE_DIV_1:
case RT5659_PRE_DIV_2:
case RT5659_I2S1_SDP:
case RT5659_I2S2_SDP:
case RT5659_I2S3_SDP:
case RT5659_ADDA_CLK_1:
case RT5659_ADDA_CLK_2:
case RT5659_DMIC_CTRL_1:
case RT5659_DMIC_CTRL_2:
case RT5659_TDM_CTRL_1:
case RT5659_TDM_CTRL_2:
case RT5659_TDM_CTRL_3:
case RT5659_TDM_CTRL_4:
case RT5659_TDM_CTRL_5:
case RT5659_GLB_CLK:
case RT5659_PLL_CTRL_1:
case RT5659_PLL_CTRL_2:
case RT5659_ASRC_1:
case RT5659_ASRC_2:
case RT5659_ASRC_3:
case RT5659_ASRC_4:
case RT5659_ASRC_5:
case RT5659_ASRC_6:
case RT5659_ASRC_7:
case RT5659_ASRC_8:
case RT5659_ASRC_9:
case RT5659_ASRC_10:
case RT5659_DEPOP_1:
case RT5659_DEPOP_2:
case RT5659_DEPOP_3:
case RT5659_HP_CHARGE_PUMP_1:
case RT5659_HP_CHARGE_PUMP_2:
case RT5659_MICBIAS_1:
case RT5659_MICBIAS_2:
case RT5659_ASRC_11:
case RT5659_ASRC_12:
case RT5659_ASRC_13:
case RT5659_REC_M1_M2_GAIN_CTRL:
case RT5659_RC_CLK_CTRL:
case RT5659_CLASSD_CTRL_1:
case RT5659_CLASSD_CTRL_2:
case RT5659_ADC_EQ_CTRL_1:
case RT5659_ADC_EQ_CTRL_2:
case RT5659_DAC_EQ_CTRL_1:
case RT5659_DAC_EQ_CTRL_2:
case RT5659_DAC_EQ_CTRL_3:
case RT5659_IRQ_CTRL_1:
case RT5659_IRQ_CTRL_2:
case RT5659_IRQ_CTRL_3:
case RT5659_IRQ_CTRL_4:
case RT5659_IRQ_CTRL_5:
case RT5659_IRQ_CTRL_6:
case RT5659_INT_ST_1:
case RT5659_INT_ST_2:
case RT5659_GPIO_CTRL_1:
case RT5659_GPIO_CTRL_2:
case RT5659_GPIO_CTRL_3:
case RT5659_GPIO_CTRL_4:
case RT5659_GPIO_CTRL_5:
case RT5659_GPIO_STA:
case RT5659_SINE_GEN_CTRL_1:
case RT5659_SINE_GEN_CTRL_2:
case RT5659_SINE_GEN_CTRL_3:
case RT5659_HP_AMP_DET_CTRL_1:
case RT5659_HP_AMP_DET_CTRL_2:
case RT5659_SV_ZCD_1:
case RT5659_SV_ZCD_2:
case RT5659_IL_CMD_1:
case RT5659_IL_CMD_2:
case RT5659_IL_CMD_3:
case RT5659_IL_CMD_4:
case RT5659_4BTN_IL_CMD_1:
case RT5659_4BTN_IL_CMD_2:
case RT5659_4BTN_IL_CMD_3:
case RT5659_PSV_IL_CMD_1:
case RT5659_PSV_IL_CMD_2:
case RT5659_ADC_STO1_HP_CTRL_1:
case RT5659_ADC_STO1_HP_CTRL_2:
case RT5659_ADC_MONO_HP_CTRL_1:
case RT5659_ADC_MONO_HP_CTRL_2:
case RT5659_AJD1_CTRL:
case RT5659_AJD2_AJD3_CTRL:
case RT5659_JD1_THD:
case RT5659_JD2_THD:
case RT5659_JD3_THD:
case RT5659_JD_CTRL_1:
case RT5659_JD_CTRL_2:
case RT5659_JD_CTRL_3:
case RT5659_JD_CTRL_4:
case RT5659_DIG_MISC:
case RT5659_DUMMY_2:
case RT5659_DUMMY_3:
case RT5659_VENDOR_ID:
case RT5659_VENDOR_ID_1:
case RT5659_DEVICE_ID:
case RT5659_DAC_ADC_DIG_VOL:
case RT5659_BIAS_CUR_CTRL_1:
case RT5659_BIAS_CUR_CTRL_2:
case RT5659_BIAS_CUR_CTRL_3:
case RT5659_BIAS_CUR_CTRL_4:
case RT5659_BIAS_CUR_CTRL_5:
case RT5659_BIAS_CUR_CTRL_6:
case RT5659_BIAS_CUR_CTRL_7:
case RT5659_BIAS_CUR_CTRL_8:
case RT5659_BIAS_CUR_CTRL_9:
case RT5659_BIAS_CUR_CTRL_10:
case RT5659_MEMORY_TEST:
case RT5659_VREF_REC_OP_FB_CAP_CTRL:
case RT5659_CLASSD_0:
case RT5659_CLASSD_1:
case RT5659_CLASSD_2:
case RT5659_CLASSD_3:
case RT5659_CLASSD_4:
case RT5659_CLASSD_5:
case RT5659_CLASSD_6:
case RT5659_CLASSD_7:
case RT5659_CLASSD_8:
case RT5659_CLASSD_9:
case RT5659_CLASSD_10:
case RT5659_CHARGE_PUMP_1:
case RT5659_CHARGE_PUMP_2:
case RT5659_DIG_IN_CTRL_1:
case RT5659_DIG_IN_CTRL_2:
case RT5659_PAD_DRIVING_CTRL:
case RT5659_SOFT_RAMP_DEPOP:
case RT5659_PLL:
case RT5659_CHOP_DAC:
case RT5659_CHOP_ADC:
case RT5659_CALIB_ADC_CTRL:
case RT5659_SOFT_RAMP_DEPOP_DAC_CLK_CTRL:
case RT5659_VOL_TEST:
case RT5659_TEST_MODE_CTRL_1:
case RT5659_TEST_MODE_CTRL_2:
case RT5659_TEST_MODE_CTRL_3:
case RT5659_TEST_MODE_CTRL_4:
case RT5659_BASSBACK_CTRL:
case RT5659_MP3_PLUS_CTRL_1:
case RT5659_MP3_PLUS_CTRL_2:
case RT5659_MP3_HPF_A1:
case RT5659_MP3_HPF_A2:
case RT5659_MP3_HPF_H0:
case RT5659_MP3_LPF_H0:
case RT5659_3D_SPK_CTRL:
case RT5659_3D_SPK_COEF_1:
case RT5659_3D_SPK_COEF_2:
case RT5659_3D_SPK_COEF_3:
case RT5659_3D_SPK_COEF_4:
case RT5659_3D_SPK_COEF_5:
case RT5659_3D_SPK_COEF_6:
case RT5659_3D_SPK_COEF_7:
case RT5659_STO_DRE_CTRL_1:
case RT5659_STO_DRE_CTRL_2:
case RT5659_STO_DRE_CTRL_3:
case RT5659_STO_DRE_CTRL_4:
case RT5659_STO_DRE_CTRL_5:
case RT5659_STO_DRE_CTRL_6:
case RT5659_STO_DRE_CTRL_7:
case RT5659_STO_DRE_CTRL_8:
case RT5659_MONO_DRE_CTRL_1:
case RT5659_MONO_DRE_CTRL_2:
case RT5659_MONO_DRE_CTRL_3:
case RT5659_MONO_DRE_CTRL_4:
case RT5659_MONO_DRE_CTRL_5:
case RT5659_MONO_DRE_CTRL_6:
case RT5659_MID_HP_AMP_DET:
case RT5659_LOW_HP_AMP_DET:
case RT5659_LDO_CTRL:
case RT5659_HP_DECROSS_CTRL_1:
case RT5659_HP_DECROSS_CTRL_2:
case RT5659_HP_DECROSS_CTRL_3:
case RT5659_HP_DECROSS_CTRL_4:
case RT5659_HP_IMP_SENS_CTRL_1:
case RT5659_HP_IMP_SENS_CTRL_2:
case RT5659_HP_IMP_SENS_CTRL_3:
case RT5659_HP_IMP_SENS_CTRL_4:
case RT5659_HP_IMP_SENS_MAP_1:
case RT5659_HP_IMP_SENS_MAP_2:
case RT5659_HP_IMP_SENS_MAP_3:
case RT5659_HP_IMP_SENS_MAP_4:
case RT5659_HP_IMP_SENS_MAP_5:
case RT5659_HP_IMP_SENS_MAP_6:
case RT5659_HP_IMP_SENS_MAP_7:
case RT5659_HP_IMP_SENS_MAP_8:
case RT5659_HP_LOGIC_CTRL_1:
case RT5659_HP_LOGIC_CTRL_2:
case RT5659_HP_CALIB_CTRL_1:
case RT5659_HP_CALIB_CTRL_2:
case RT5659_HP_CALIB_CTRL_3:
case RT5659_HP_CALIB_CTRL_4:
case RT5659_HP_CALIB_CTRL_5:
case RT5659_HP_CALIB_CTRL_6:
case RT5659_HP_CALIB_CTRL_7:
case RT5659_HP_CALIB_CTRL_9:
case RT5659_HP_CALIB_CTRL_10:
case RT5659_HP_CALIB_CTRL_11:
case RT5659_HP_CALIB_STA_1:
case RT5659_HP_CALIB_STA_2:
case RT5659_HP_CALIB_STA_3:
case RT5659_HP_CALIB_STA_4:
case RT5659_HP_CALIB_STA_5:
case RT5659_HP_CALIB_STA_6:
case RT5659_HP_CALIB_STA_7:
case RT5659_HP_CALIB_STA_8:
case RT5659_HP_CALIB_STA_9:
case RT5659_MONO_AMP_CALIB_CTRL_1:
case RT5659_MONO_AMP_CALIB_CTRL_2:
case RT5659_MONO_AMP_CALIB_CTRL_3:
case RT5659_MONO_AMP_CALIB_CTRL_4:
case RT5659_MONO_AMP_CALIB_CTRL_5:
case RT5659_MONO_AMP_CALIB_STA_1:
case RT5659_MONO_AMP_CALIB_STA_2:
case RT5659_MONO_AMP_CALIB_STA_3:
case RT5659_MONO_AMP_CALIB_STA_4:
case RT5659_SPK_PWR_LMT_CTRL_1:
case RT5659_SPK_PWR_LMT_CTRL_2:
case RT5659_SPK_PWR_LMT_CTRL_3:
case RT5659_SPK_PWR_LMT_STA_1:
case RT5659_SPK_PWR_LMT_STA_2:
case RT5659_SPK_PWR_LMT_STA_3:
case RT5659_SPK_PWR_LMT_STA_4:
case RT5659_SPK_PWR_LMT_STA_5:
case RT5659_SPK_PWR_LMT_STA_6:
case RT5659_FLEX_SPK_BST_CTRL_1:
case RT5659_FLEX_SPK_BST_CTRL_2:
case RT5659_FLEX_SPK_BST_CTRL_3: