blob: e45a930a2f9c9c6922efdf2f72742d25b48e3226 (
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
|
/*
* max98504.h -- MAX98504 ALSA SoC Audio driver
*
* Copyright 2011-2012 Maxim Integrated Products
*
* 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.
*/
#ifndef _MAX98504_H
#define _MAX98504_H
#include <linux/version.h>
int max98504_set_speaker_status(int OnOff);
/*
* MAX98504 Register Definitions
*/
#define MAX98504_REG_01_INTERRUPT_STATUS 0x01
#define MAX98504_REG_02_INTERRUPT_FLAGS 0x02
#define MAX98504_REG_03_INTERRUPT_ENABLES 0x03
#define MAX98504_REG_04_INTERRUPT_FLAG_CLEARS 0x04
#define MAX98504_REG_10_GPIO_ENABLE 0x10
#define MAX98504_REG_11_GPIO_CONFIG 0x11
#define MAX98504_REG_12_WATCHDOG_ENABLE 0x12
#define MAX98504_REG_13_WATCHDOG_CONFIG 0x13
#define MAX98504_REG_14_WATCHDOG_CLEAR 0x14
#define MAX98504_REG_15_CLOCK_MONITOR_ENABLE 0x15
#define MAX98504_REG_16_PVDD_BROWNOUT_ENABLE 0x16
#define MAX98504_REG_17_PVDD_BROWNOUT_CONFIG_1 0x17
#define MAX98504_REG_18_PVDD_BROWNOUT_CONFIG_2 0x18
#define MAX98504_REG_19_PVDD_BROWNOUT_CONFIG_3 0x19
#define MAX98504_REG_1A_PVDD_BROWNOUT_CONFIG_4 0x1a
#define MAX98504_REG_20_PCM_RX_ENABLES 0x20
#define MAX98504_REG_21_PCM_TX_ENABLES 0x21
#define MAX98504_REG_22_PCM_TX_HIZ_CONTROL 0x22
#define MAX98504_REG_23_PCM_TX_CHANNEL_SOURCES 0x23
#define MAX98504_REG_24_PCM_MODE_CONFIG 0x24
#define MAX98504_REG_25_PCM_DSP_CONFIG 0x25
#define MAX98504_REG_26_PCM_CLOCK_SETUP 0x26
#define MAX98504_REG_27_PCM_SAMPLE_RATE_SETUP 0x27
#define MAX98504_REG_28_PCM_TO_SPEAKER_MONOMIX 0x28
#define MAX98504_REG_30_PDM_TX_ENABLES 0x30
#define MAX98504_REG_31_PDM_TX_HIZ_CONTROL 0x31
#define MAX98504_REG_32_PDM_TX_CONTROL 0x32
#define MAX98504_REG_33_PDM_RX_ENABLE 0x33
#define MAX98504_REG_34_SPEAKER_ENABLE 0x34
#define MAX98504_REG_35_SPEAKER_SOURCE_SELECT 0x35
#define MAX98504_REG_36_MEASUREMENT_ENABLES 0x36
#define MAX98504_REG_37_ANALOGUE_INPUT_GAIN 0x37
#define MAX98504_REG_38_TEMPERATURE_LIMIT_CONFIG 0x38
#define MAX98504_REG_39_ANALOGUE_SPARE 0x39
#define MAX98504_REG_40_GLOBAL_ENABLE 0x40
#define MAX98504_REG_41_SOFTWARE_RESET 0x41
#define MAX98504_REG_7FFF_REV_ID 0x7fff
#define MAX98504_REG_CNT (MAX98504_REG_41_SOFTWARE_RESET+1)
/* MAX98504 Register Bit Fields */
/* MAX98504_REG_01_INTERRUPT_STATUS*/
#define M98504_INT_GENFAIL_STATUS_MASK (1<<7)
#define M98504_INT_GENFAIL_STATUS_SHIFT 7
#define M98504_INT_GENFAIL_STATUS_WIDTH 1
#define M98504_INT_AUTHDONE_STATUS_MASK (1<<6)
#define M98504_INT_AUTHDONE_STATUS_SHIFT 6
#define M98504_INT_AUTHDONE_STATUS_WIDTH 1
#define M98504_INT_VBATBROWN_STATUS_MASK (1<<5)
#define M98504_INT_VBATBROWN_STATUS_SHIFT 5
#define M98504_INT_VBATBROWN_STATUS_WIDTH 1
#define M98504_INT_WATCHFAIL_STATUS_MASK (1<<4)
#define M98504_INT_WATCHFAIL_STATUS_SHIFT 4
#define M98504_INT_WATCHFAIL_STATUS_WIDTH 1
#define M98504_INT_THERMWARN_STATUS_MASK (1<<3)
#define M98504_INT_THERMWARN_STATUS_SHIFT 3
#define M98504_INT_THERMWARN_STATUS_WIDTH 1
#define M98504_INT_THERMSHDN_STATUS_MASK (1<<1)
#define M98504_INT_THERMSHDN_STATUS_SHIFT 1
#define M98504_INT_THERMSHDN_STATUS_WIDTH 1
#define M98504_INT_INTERRUPT_STATUS_MASK (\
M98504_INT_GENFAIL_STATUS_MASK|M98504_INT_AUTHDONE_STATUS_MASK\
|M98504_INT_VBATBROWN_STATUS_MASK|M98504_INT_WATCHFAIL_STATUS_MASK\
|M98504_INT_THERMWARN_STATUS_MASK|M98504_INT_THERMSHDN_STATUS_MASK)
/* MAX98504_REG_02_INTERRUPT_FLAGS*/
#define M98504_INT_GENFAIL_FLAG_MASK (1<<7)
#define M98504_INT_GENFAIL_FLAG_SHIFT 7
#define M98504_INT_GENFAIL_FLAG_WIDTH 1
#define M98504_INT_AUTHDONE_FLAG_MASK (1<<6)
#define M98504_INT_AUTHDONE_FLAG_SHIFT 6
#define M98504_INT_AUTHDONE_FLAG_WIDTH 1
#define M98504_INT_VBATBROWN_FLAG_MASK (1<<5)
#define M98504_INT_VBATBROWN_FLAG_SHIFT 5
#define M98504_INT_VBATBROWN_FLAG_WIDTH 1
#define M98504_INT_WATCHFAIL_FLAG_MASK (1<<4)
#define M98504_INT_WATCHFAIL_FLAG_SHIFT 4
#define M98504_INT_WATCHFAIL_FLAG_WIDTH 1
#define M98504_INT_THERMWARN_END_FLAG_MASK (1<<3)
#define M98504_INT_THERMWARN_END_FLAG_SHIFT 3
#define M98504_INT_THERMWARN_END_FLAG_WIDTH 1
#define M98504_INT_THERMWARN_BGN_FLAG_MASK (1<<2)
#define M98504_INT_THERMWARN_BGN_FLAG_SHIFT 2
#define M98504_INT_THERMWARN_BGN_FLAG_WIDTH 1
#define M98504_INT_THERMSHDN_END_EN_MASK (1<<1)
#define M98504_INT_THERMSHDN_END_FLAG_SHIFT 1
#define M98504_INT_THERMSHDN_END_FLAG_WIDTH 1
#define M98504_INT_THERMSHDN_BGN_FLAG_MASK (1<<0)
#define M98504_INT_THERMSHDN_BGN_FLAG_SHIFT 0
#define M98504_INT_THERMSHDN_BGN_FLAG_WIDTH 1
/* MAX98504_REG_03_INTERRUPT_ENABLES*/
#define M98504_INT_GENFAIL_EN_MASK (1<<7)
#define M98504_INT_GENFAIL_EN_SHIFT 7
#define M98504_INT_GENFAIL_EN_WIDTH 1
#define M98504_INT_AUTHDONE_EN_MASK (1<<6)
#define M98504_INT_AUTHDONE_EN_SHIFT 6
#define M98504_INT_AUTHDONE_EN_WIDTH 1
#define M98504_INT_VBATBROWN_EN_MASK (1<<5)
#define M98504_INT_VBATBROWN_EN_SHIFT 5
#define M98504_INT_VBATBROWN_EN_WIDTH 1
#define M98504_INT_WATCHFAIL_EN_MASK (1<<4)
#define M98504_INT_WATCHFAIL_EN_SHIFT 4
#define M98504_INT_WATCHFAIL_EN_WIDTH 1
#define M98504_INT_THERMWARN_END_EN_MASK (1<<3)
#define M98504_INT_THERMWARN_END_EN_SHIFT 3
#define M98504_INT_THERMWARN_END_EN_WIDTH 1
#define M98504_INT_THERMWARN_BGN_EN_MASK (1<<2)
#define M98504_INT_THERMWARN_BGN_EN_SHIFT 2
#define M98504_INT_THERMWARN_BGN_EN_WIDTH 1
#define M98504_INT_THERMSHDN_END_EN_MASK (1<<1)
#define M98504_INT_THERMSHDN_END_EN_SHIFT 1
#define M98504_INT_THERMSHDN_END_EN_WIDTH 1
#define M98504_INT_THERMSHDN_BGN_EN_MASK (1<<0)
#define M98504_INT_THERMSHDN_BGN_EN_SHIFT 0
#define M98504_INT_THERMSHDN_BGN_EN_WIDTH 1
/* MAX98504_REG_04_INTERRUPT_FLAG_CLEARS*/
#define M98504_INT_FLAG_GENFAIL_CLR_MASK (1<<7)
#define M98504_INT_FLAG_GENFAIL_CLR_SHIFT 7
#define M98504_INT_FLAG_GENFAIL_CLR_WIDTH 1
#define M98504_INT_FLAG_AUTHDONE_CLR_MASK (1<<6)
#define M98504_INT_FLAG_AUTHDONE_CLR_SHIFT 6
#define M98504_INT_FLAG_AUTHDONE_CLR_WIDTH 1
#define M98504_INT_FLAG_VBATBROWN_CLR_MASK (1<<5)
#define M98504_INT_FLAG_VBATBROWN_CLR_SHIFT 5
#define M98504_INT_FLAG_VBATBROWN_CLR_WIDTH 1
#define M98504_INT_FLAG_WATCHFAIL_CLR_MASK (1<<4)
#define M98504_INT_FLAG_WATCHFAIL_CLR_SHIFT 4
#define M98504_INT_FLAG_WATCHFAIL_CLR_WIDTH 1
#define M98504_INT_FLAG_THERMWARN_END_CLR_MASK (1<<3)
#define M98504_INT_FLAG_THERMWARN_END_CLR_SHIFT 3
#define M98504_INT_FLAG_THERMWARN_END_CLR_WIDTH 1
#define M98504_INT_FLAG_THERMWARN_BGN_CLR_MASK (1<<2)
#define M98504_INT_FLAG_THERMWARN_BGN_CLR_SHIFT 2
#define M98504_INT_FLAG_THERMWARN_BGN_CLR_WIDTH 1
#define M98504_INT_FLAG_THERMSHDN_END_CLR_MASK (1<<1)
#define M98504_INT_FLAG_THERMSHDN_END_CLR_SHIFT 1
#define M98504_INT_FLAG_THERMSHDN_END_CLR_WIDTH 1
#define M98504_INT_FLAG_THERMSHDN_BGN_CLR_MASK (1<<0)
#define M98504_INT_FLAG_THERMSHDN_BGN_CLR_SHIFT 0
#define M98504_INT_FLAG_THERMSHDN_BGN_CLR_WIDTH 1
/* MAX98504_REG_10_GPIO_ENABLE*/
#define M98504_GPIO_ENABLE_MASK (1<<0)
#define M98504_GPIO_ENALBE_SHIFT 0
#define M98504_GPIO_ENABLE_WIDTH 1
/* MAX98504_REG_11_GPIO_CONFIG*/
#define M98504_GPIO_OP_MODE_MASK (1<<0)
#define M98504_GPIO_OP_MODE_SHIFT 0
#define M98504_GPIO_OP_MODE_WIDTH 1
/* MAX98504_REG_12_WATCHDOG_ENABLE*/
#define M98504_WDOG_ENABLE_MASK (1<<0)
#define M98504_WDOG_ENABLE_SHIFT 0
#define M98504_WDOG_ENABLE_WIDTH 1
/* MAX98504_REG_13_WATCHDOG_CONFIG*/
#define M98504_WDOG_CONFIG_MASK (0x3<<0)
#define M98504_WDOG_CONFIG_SHIFT 0
#define M98504_WDOG_CONFIG_WIDTH 2
#define M98504_WDOG_CONFIG_100MS 0
#define M98504_WDOG_CONFIG_500MS 1
#define M98504_WDOG_CONFIG_1000MS 2
#define M98504_WDOG_CONFIG_2000MS 3
/* MAX98504_REG_14_WATCHDOG_CLEAR*/
#define M98504_WDOG_CLEAR_MASK (0xff<<0)
#define M98504_WDOG_CLEAR_SHIFT 0
#define M98504_WDOG_CLEAR_WIDTH 8
/* MAX98504_REG_15_CLOCK_MONITOR_ENABLE*/
#define M98504_CMON_ENA_MASK (1<<0)
#define M98504_CMON_ENA_SHIFT 0
#define M98504_CMON_ENA_WIDTH 1
/* MAX98504_REG_16_PVDD_BROWNOUT_ENABLE*/
#define M98504_PVDD_BROWNOUT_ENA_MASK (1<<0)
#define M98504_PVDD_BROWNOUT_ENA_SHIFT 0
#define M98504_PVDD_BROWNOUT_ENA_WIDTH 1
/* MAX98504_REG_17_PVDD_BROWNOUT_CONFIG_1*/
#define M98504_PVDD_BROWNOUT_CFG1_CODE_MASK (0x1f<<3)
#define M98504_PVDD_BROWNOUT_CFG1_CODE_SHIFT 3
#define M98504_PVDD_BROWNOUT_CFG1_CODE_WIDTH 5
#define M98504_PVDD_BROWNOUT_CFG1_MAX_ATTEN_MASK (0x7<<0)
#define M98504_PVDD_BROWNOUT_CFG1_MAX_ATTEN_SHIFT 0
#define M98504_PVDD_BROWNOUT_CFG1_MAX_ATTEN_WIDTH 3
/* MAX98504_REG_18_PVDD_BROWNOUT_CONFIG_2*/
#define M98504_PVDD_BROWNOUT_CFG2_ATTK_HOLD_MASK (0xff<<0)
#define M98504_PVDD_BROWNOUT_CFG2_ATTK_HOLD_SHIFT 0
#define M98504_PVDD_BROWNOUT_CFG2_ATTK_HOLD_WIDTH 8
/* MAX98504_REG_19_PVDD_BROWNOUT_CONFIG_3*/
#define M98504_PVDD_BROWNOUT_CFG3_TIMED_HOLD_MASK (0xff<<0)
#define M98504_PVDD_BROWNOUT_CFG3_TIMED_HOLD_SHIFT 0
#define M98504_PVDD_BROWNOUT_CFG3_TIMED_HOLD_WIDTH 8
/* MAX98504_REG_1A_PVDD_BROWNOUT_CONFIG_4*/
#define M98504_PVDD_BROWNOUT_CFG4_RELEASE_MASK (0xff<<0)
#define M98504_PVDD_BROWNOUT_CFG4_RELEASE_SHIFT 0
#define M98504_PVDD_BROWNOUT_CFG4_RELEASE_WIDTH 8
/* MAX98504_REG_20_PCM_RX_ENABLES*/
#define M98504_PCM_RX_EN_CH7_MASK (1<<7)
#define M98504_PCM_RX_EN_CH7_SHIFT 7
#define M98504_PCM_RX_EN_CH7_WIDTH 1
#define M98504_PCM_RX_EN_CH6_MASK (1<<6)
#define M98504_PCM_RX_EN_CH6_SHIFT 6
#define M98504_PCM_RX_EN_CH6_WIDTH 1
#define M98504_PCM_RX_EN_CH5_MASK (1<<5)
#define M98504_PCM_RX_EN_CH5_SHIFT 5
#define M98504_PCM_RX_EN_CH5_WIDTH 1
#define M98504_PCM_RX_EN_CH4_MASK (1<<4)
#define M98504_PCM_RX_EN_CH4_SHIFT 4
#define M98504_PCM_RX_EN_CH4_WIDTH 1
#define M98504_PCM_RX_EN_CH3_MASK (1<<3)
#define M98504_PCM_RX_EN_CH3_SHIFT 3
#define M98504_PCM_RX_EN_CH3_WIDTH 1
#define M98504_PCM_RX_EN_CH2_MASK (1<<2)
#define M98504_PCM_RX_EN_CH2_SHIFT 2
#define M98504_PCM_RX_EN_CH2_WIDTH 1
#define M98504_PCM_RX_EN_CH1_MASK (1<<1)
#define M98504_PCM_RX_EN_CH1_SHIFT 1
#define M98504_PCM_RX_EN_CH1_WIDTH 1
#define M98504_PCM_RX_EN_CH0_MASK (1<<0)
#define M98504_PCM_RX_EN_CH0_SHIFT 0
#define M98504_PCM_RX_EN_CH0_WIDTH 1
/* MAX98504_REG_21_PCM_TX_ENABLES*/
#define M98504_PCM_TX_EN_CH7_MASK (1<<7)
#define M98504_PCM_TX_EN_CH7_SHIFT 7
#define M98504_PCM_TX_EN_CH7_WIDTH 1
#define M98504_PCM_TX_EN_CH6_MASK (1<<6)
#define M98504_PCM_TX_EN_CH6_SHIFT 6
#define M98504_PCM_TX_EN_CH6_WIDTH 1
#define M98504_PCM_TX_EN_CH5_MASK (1<<5)
#define M98504_PCM_TX_EN_CH5_SHIFT 5
#define M98504_PCM_TX_EN_CH5_WIDTH 1
#define M98504_PCM_TX_EN_CH4_MASK (1<<4)
#define M98504_PCM_TX_EN_CH4_SHIFT 4
#define M98504_PCM_TX_EN_CH4_WIDTH 1
#define M98504_PCM_TX_EN_CH3_MASK (1<<3)
#define M98504_PCM_TX_EN_CH3_SHIFT 3
#define M98504_PCM_TX_EN_CH3_WIDTH 1
#define M98504_PCM_TX_EN_CH2_MASK (1<<2)
#define M98504_PCM_TX_EN_CH2_SHIFT 2
#define M98504_PCM_TX_EN_CH2_WIDTH 1
#define M98504_PCM_TX_EN_CH1_MASK (1<<1)
#define M98504_PCM_TX_EN_CH1_SHIFT 1
#define M98504_PCM_TX_EN_CH1_WIDTH 1
#define M98504_PCM_TX_EN_CH0_MASK (1<<0)
#define M98504_PCM_TX_EN_CH0_SHIFT 0
#define M98504_PCM_TX_EN_CH0_WIDTH 1
/* MAX98504_REG_22_PCM_TX_HIZ_CONTROL*/
#define M98504_PCM_TX_HIZ_CTRL_CH7_MASK (1<<7)
#define M98504_PCM_TX_HIZ_CTRL_CH7_SHIFT 7
#define M98504_PCM_TX_HIZ_CTRL_CH7_WIDTH 1
#define M98504_PCM_TX_HIZ_CTRL_CH6_MASK (1<<6)
#define M98504_PCM_TX_HIZ_CTRL_CH6_SHIFT 6
#define M98504_PCM_TX_HIZ_CTRL_CH6_WIDTH 1
#define M98504_PCM_TX_HIZ_CTRL_CH5_MASK (1<<5)
#define M98504_PCM_TX_HIZ_CTRL_CH5_SHIFT 5
#define M98504_PCM_TX_HIZ_CTRL_CH5_WIDTH 1
#define M98504_PCM_TX_HIZ_CTRL_CH4_MASK (1<<4)
#define M98504_PCM_TX_HIZ_CTRL_CH4_SHIFT 4
#define M98504_PCM_TX_HIZ_CTRL_CH4_WIDTH 1
#define M98504_PCM_TX_HIZ_CTRL_CH3_MASK (1<<3)
#define M98504_PCM_TX_HIZ_CTRL_CH3_SHIFT 3
#define M98504_PCM_TX_HIZ_CTRL_CH3_WIDTH 1
#define M98504_PCM_TX_HIZ_CTRL_CH2_MASK (1<<2)
#define M98504_PCM_TX_HIZ_CTRL_CH2_SHIFT 2
#define M98504_PCM_TX_HIZ_CTRL_CH2_WIDTH 1
#define M98504_PCM_TX_HIZ_CTRL_CH1_MASK (1<<1)
#define M98504_PCM_TX_HIZ_CTRL_CH1_SHIFT 1
#define M98504_PCM_TX_HIZ_CTRL_CH1_WIDTH 1
#define M98504_PCM_TX_HIZ_CTRL_CH0_MASK (1<<0)
#define M98504_PCM_TX_HIZ_CTRL_CH0_SHIFT 0
#define M98504_PCM_TX_HIZ_CTRL_CH0_WIDTH 1
/* MAX98504_REG_23_PCM_TX_CHANNEL_SOURCES*/
#define M98504_PCM_TX_SOURCE_CH7_MASK (1<<7)
#define M98504_PCM_TX_SOURCE_CH7_SHIFT 7
#define M98504_PCM_TX_SOURCE_CH7_WIDTH 1
#define M98504_PCM_TX_SOURCE_CH6_MASK (1<<6)
#define M98504_PCM_TX_SOURCE_CH6_SHIFT 6
#define M98504_PCM_TX_SOURCE_CH6_WIDTH 1
#define M98504_PCM_TX_SOURCE_CH5_MASK (1<<5)
#define M98504_PCM_TX_SOURCE_CH5_SHIFT 5
#define M98504_PCM_TX_SOURCE_CH5_WIDTH 1
#define M98504_PCM_TX_SOURCE_CH4_MASK (1<<4)
#define M98504_PCM_TX_SOURCE_CH4_SHIFT 4
#define M98504_PCM_TX_SOURCE_CH4_WIDTH 1
#define M98504_PCM_TX_SOURCE_CH3_MASK (1<<3)
#define M98504_PCM_TX_SOURCE_CH3_SHIFT 3
#define M98504_PCM_TX_SOURCE_CH3_WIDTH 1
#define M98504_PCM_TX_SOURCE_CH2_MASK (1<<2)
#define M98504_PCM_TX_SOURCE_CH2_SHIFT 2
#define M98504_PCM_TX_SOURCE_CH2_WIDTH 1
#define M98504_PCM_TX_SOURCE_CH1_MASK (1<<1)
#define M98504_PCM_TX_SOURCE_CH1_SHIFT 1
#define M98504_PCM_TX_SOURCE_CH1_WIDTH 1
#define M98504_PCM_TX_SOURCE_CH0_MASK (1<<0)
#define M98504_PCM_TX_SOURCE_CH0_SHIFT 0
#define M98504_PCM_TX_SOURCE_CH0_WIDTH 1
/* MAX98504_REG_24_PCM_MODE_CONFIG*/
#define M98504_PCM_MODE_CFG_CH_SIZE_MASK (0x3<<6)
#define M98504_PCM_MODE_CFG_CH_SIZE_SHIFT 6
#define M98504_PCM_MODE_CFG_CH_SIZE_WIDTH 2
#define M98504_PCM_MODE_CFG_CH_SIZE_8_MASK \
(0<<M98504_PCM_MODE_CFG_CH_SIZE_SHIFT)
#define M98504_PCM_MODE_CFG_CH_SIZE_16_MASK \
(1<<M98504_PCM_MODE_CFG_CH_SIZE_SHIFT)
#define M98504_PCM_MODE_CFG_CH_SIZE_24_MASK \
(2<<M98504_PCM_MODE_CFG_CH_SIZE_SHIFT)
#define M98504_PCM_MODE_CFG_CH_SIZE_32_MASK \
(3<<M98504_PCM_MODE_CFG_CH_SIZE_SHIFT)
#define M98504_PCM_MODE_CFG_FORMAT_MASK (0x7<<3)
#define M98504_PCM_MODE_CFG_FORMAT_SHIFT 3
#define M98504_PCM_MODE_CFG_FORMAT_WIDTH 3
#define M98504_PCM_MODE_CFG_FORMAT_I2S_MASK \
(0<<M98504_PCM_MODE_CFG_FORMAT_SHIFT)
#define M98504_PCM_MODE_CFG_FORMAT_LJ_MASK \
(1<<M98504_PCM_MODE_CFG_FORMAT_SHIFT)
#define M98504_PCM_MODE_CFG_FORMAT_RJ_MASK \
(2<<M98504_PCM_MODE_CFG_FORMAT_SHIFT)
#define M98504_PCM_MODE_CFG_FORMAT_TDM_MODE1_MASK \
(3<<M98504_PCM_MODE_CFG_FORMAT_SHIFT)
#define M98504_PCM_MODE_CFG_FORMAT_TDM_MODE2_MASK \
(4<<M98504_PCM_MODE_CFG_FORMAT_SHIFT)
#define M98504_PCM_MODE_CFG_BCLKEDGE_MASK (1<<2)
#define M98504_PCM_MODE_CFG_BCLKEDGE_SHIFT 2
#define M98504_PCM_MODE_CFG_BCLKEDGE_WIDTH 1
#define M98504_PCM_MODE_CFG_CHSEL_MASK (1<<1)
#define M98504_PCM_MODE_CFG_CHSEL_SHIFT 1
#define M98504_PCM_MODE_CFG_CHSEL_WIDTH 1
#define M98504_PCM_MODE_CFG_TX_EXTRA_HIZ_MASK (1<<0)
#define M98504_PCM_MODE_CFG_TX_EXTRA_HIZ_SHIFT 0
#define M98504_PCM_MODE_CFG_TX_EXTRA_HIZ_WIDTH 1
/* MAX98504_REG_25_PCM_DSP_CONFIG*/
#define M98504_PCM_DSP_CFG_TX_DITH_EN_MASK (1<<7)
#define M98504_PCM_DSP_CFG_TX_DITH_EN_SHIFT 7
#define M98504_PCM_DSP_CFG_TX_DITH_EN_WIDTH 1
#define M98504_PCM_DSP_CFG_MEAS_DCBLK_EN_MASK (1<<6)
#define M98504_PCM_DSP_CFG_MEAS_DCBLK_EN_SHIFT 6
#define M98504_PCM_DSP_CFG_MEAS_DCBLK_EN_WIDTH 1
#define M98504_PCM_DSP_CFG_RX_DITH_EN_MASK (1<<5)
#define M98504_PCM_DSP_CFG_RX_DITH_EN_SHIFT 5
#define M98504_PCM_DSP_CFG_RX_DITH_EN_WIDTH 1
#define M98504_PCM_DSP_CFG_RX_FLT_MODE_MASK (1<<4)
#define M98504_PCM_DSP_CFG_RX_FLT_MODE_SHIFT 4
#define M98504_PCM_DSP_CFG_RX_FLT_MODE_WIDTH 1
#define M98504_PCM_DSP_CFG_FLT_MASK (\
M98504_PCM_DSP_CFG_TX_DITH_EN_MASK|\
M98504_PCM_DSP_CFG_MEAS_DCBLK_EN_MASK|\
M98504_PCM_DSP_CFG_RX_DITH_EN_MASK|\
M98504_PCM_DSP_CFG_RX_FLT_MODE_MASK)
#define M98504_PCM_DSP_CFG_FLT_SHIFT 4
#define M98504_PCM_DSP_CFG_FLT_WIDTH 4
#define M98504_PCM_DSP_CFG_RX_GAIN_MASK (0xf<<0)
#define M98504_PCM_DSP_CFG_RX_GAIN_SHIFT 0
#define M98504_PCM_DSP_CFG_RX_GAIN_WIDTH 4
/* MAX98504_REG_26_PCM_CLOCK_SETUP*/
#define M98504_PCM_CLK_SETUP_BSEL_MASK (0xf<<0)
#define M98504_PCM_CLK_SETUP_BSEL_SHIFT 0
#define M98504_PCM_CLK_SETUP_BSEL_WIDTH 4
#define M98094_PCM_CLK_SETUP_DAI_BSEL64 (1<<2)
/* MAX98504_REG_27_PCM_SAMPLE_RATE_SETUP*/
#define M98504_PCM_SR_SETUP_SPK_SR_MASK (0xf<<4)
#define M98504_PCM_SR_SETUP_SPK_SR_SHIFT 4
#define M98504_PCM_SR_SETUP_SPK_SR_WIDTH 4
#define M98504_PCM_SR_SETUP_MEAS_SR_MASK (0xf<<0)
#define M98504_PCM_SR_SETUP_MEAS_SR_SHIFT 0
#define M98504_PCM_SR_SETUP_MEAS_SR_WIDTH 4
/* MAX98504_REG_28_PCM_TO_SPEAKER_MONOMIX*/
#define M98504_PCM_TO_SPK_MONOMIX_CFG_MASK (0x3<<6)
#define M98504_PCM_TO_SPK_MONOMIX_CFG_SHIFT 6
#define M98504_PCM_TO_SPK_MONOMIX_CFG_WIDTH 2
#define M98504_PCM_TO_SPK_MONOMIX_CH1_SRC_MASK (0x7<<3)
#define M98504_PCM_TO_SPK_MONOMIX_CH1_SRC_SHIFT 3
#define M98504_PCM_TO_SPK_MONOMIX_CH1_SRC_WIDTH 3
#define M98504_PCM_TO_SPK_MONOMIX_CH0_SRC_MASK (0x7<<0)
#define M98504_PCM_TO_SPK_MONOMIX_CH0_SRC_SHIFT 0
#define M98504_PCM_TO_SPK_MONOMIX_CH0_SRC_WIDTH 3
/* MAX98504_REG_30_PDM_TX_ENABLES*/
#define M98504_PDM_EX_EN_CH1_MASK (1<<1)
#define M98504_PDM_EX_EN_CH1_SHIFT 1
#define M98504_PDM_EX_EN_CH1_WIDTH 1
#define M98504_PDM_EX_EN_CH0_MASK (1<<0)
#define M98504_PDM_EX_EN_CH0_SHIFT 0
#define M98504_PDM_EX_EN_CH0_WIDTH 1
/* MAX98504_REG_31_PDM_TX_HIZ_CONTROL*/
#define M98504_PDM_EX_HIZ_CTRL_CH1_MASK (1<<1)
#define M98504_PDM_EX_HIZ_CTRL_CH1_SHIFT 1
#define M98504_PDM_EX_HIZ_CTRL_CH1_WIDTH 1
#define M98504_PDM_EX_HIZ_CTRL_CH0_MASK (1<<0)
#define M98504_PDM_EX_HIZ_CTRL_CH0_SHIFT 0
#define M98504_PDM_EX_HIZ_CTRL_CH0_WIDTH 1
/* MAX98504_REG_32_PDM_TX_CONTROL*/
#define M98504_PDM_EX_CTRL_CH1_SRC_MASK (1<<1)
#define M98504_PDM_EX_CTRL_CH1_SRC_SHIFT 1
#define M98504_PDM_EX_CTRL_CH1_SRC_WIDTH 1
#define M98504_PDM_EX_CTRL_CH0_SRC_MASK (1<<0)
#define M98504_PDM_EX_CTRL_CH0_SRC_SHIFT 0
#define M98504_PDM_EX_CTRL_CH0_SRC_WIDTH 1
/* MAX98504_REG_33_PDM_RX_ENABLE*/
#define M98504_PDM_RX_EN_MASK (1<<0)
#define M98504_PDM_RX_EN_SHIFT 0
#define M98504_PDM_RX_EN_WIDTH 1
/* MAX98504_REG_34_SPEAKER_ENABLE*/
#define M98504_SPK_EN_MASK (1<<0)
#define M98504_SPK_EN_SHIFT 0
#define M98504_SPK_EN_WIDTH 1
/* MAX98504_REG_35_SPEAKER_SOURCE_SELECT*/
#define M98504_SPK_SRC_SEL_MASK (0x3<<0)
#define M98504_SPK_SRC_SEL_SHIFT 0
#define M98504_SPK_SRC_SEL_WIDTH 2
/* MAX98504_REG_36_MEASUREMENT_ENABLES*/
#define M98504_MEAS_I_EN_MASK (1<<1)
#define M98504_MEAS_I_EN_SHIFT 1
#define M98504_MEAS_I_EN_WIDTH 1
#define M98504_MEAS_V_EN_MASK (1<<0)
#define M98504_MEAS_V_EN_SHIFT 0
#define M98504_MEAS_V_EN_WIDTH 1
/* MAX98504_REG_37_ANALOGUE_INPUT_GAIN*/
#define M98504_ANALOG_INPUT_GAIN_MASK (1<<0)
#define M98504_ANALOG_INPUT_GAIN_SHIFT 0
#define M98504_ANALOG_INPUT_GAIN_WIDTH 1
/* MAX98504_REG_38_TEMPERATURE_LIMIT_CONFIG*/
#define M98504_TEMP_LIMIT_CFG_TEMPWARN_SEL_MASK (0x2<<2)
#define M98504_TEMP_LIMIT_CFG_TEMPWARN_SEL_SHIFT 2
#define M98504_TEMP_LIMIT_CFG_TEMPWARN_SEL_WIDTH 2
#define M98504_TEMP_LIMIT_CFG_TEMP_SEL_MASK (0x2<<0)
#define M98504_TEMP_LIMIT_CFG_TEMP_SEL_SHIFT 0
#define M98504_TEMP_LIMIT_CFG_TEMP_SEL_WIDTH 2
/* MAX98504_REG_39_ANALOGUE_SPARE*/
#define M98504_ANALOG_SPARE_MASK (0xff<<0)
#define M98504_ANALOG_SPARE_SHIFT 0
#define M98504_ANALOG_SPARE_WIDTH 8
/* MAX98504_REG_40_GLOBAL_ENABLE*/
#define M98504_GLOBAL_EN_MASK (1<<0)
#define M98504_GLOBAL_EN_SHIFT 0
#define M98504_GLOBAL_EN_WIDTH 1
/* MAX98504_REG_41_SOFTWARE_RESET*/
#define M98504_SOFTWARE_RESET_MASK (1<<0)
#define M98504_SOFTWARE_RESET_SHIFT 0
#define M98504_SOFTWARE_RESET_WIDTH 1
enum max98504_type {
MAX98504,
};
struct max98504_cdata {
unsigned int rate;
unsigned int fmt;
};
struct max98504_priv {
struct snd_soc_codec *codec;
struct regmap *regmap;
enum max98504_type devtype;
void *control_data;
struct max98504_pdata *pdata;
unsigned int sysclk;
struct max98504_cdata dai[1];
#ifdef CONFIG_SND_SOC_MAXIM_DSM_A
struct class *dev_log_class;
struct device *dev_log;
#endif
};
#endif
|