summaryrefslogtreecommitdiffstats
path: root/include/linux/mfd/wm8350/audio.h
blob: a95141eafce390d7586c17c4eb3f3777c20669db (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
/*
 * audio.h  --  Audio Driver for Wolfson WM8350 PMIC
 *
 * Copyright 2007, 2008 Wolfson Microelectronics PLC
 *
 *  This program is free software; you can redistribute  it and/or modify it
 *  under  the terms of  the GNU General  Public License as published by the
 *  Free Software Foundation;  either version 2 of the  License, or (at your
 *  option) any later version.
 *
 */

#ifndef __LINUX_MFD_WM8350_AUDIO_H_
#define __LINUX_MFD_WM8350_AUDIO_H_

#include <linux/platform_device.h>

#define WM8350_CLOCK_CONTROL_1                  0x28
#define WM8350_CLOCK_CONTROL_2                  0x29
#define WM8350_FLL_CONTROL_1                    0x2A
#define WM8350_FLL_CONTROL_2                    0x2B
#define WM8350_FLL_CONTROL_3                    0x2C
#define WM8350_FLL_CONTROL_4                    0x2D
#define WM8350_DAC_CONTROL                      0x30
#define WM8350_DAC_DIGITAL_VOLUME_L             0x32
#define WM8350_DAC_DIGITAL_VOLUME_R             0x33
#define WM8350_DAC_LR_RATE                      0x35
#define WM8350_DAC_CLOCK_CONTROL                0x36
#define WM8350_DAC_MUTE                         0x3A
#define WM8350_DAC_MUTE_VOLUME                  0x3B
#define WM8350_DAC_SIDE                         0x3C
#define WM8350_ADC_CONTROL                      0x40
#define WM8350_ADC_DIGITAL_VOLUME_L             0x42
#define WM8350_ADC_DIGITAL_VOLUME_R             0x43
#define WM8350_ADC_DIVIDER                      0x44
#define WM8350_ADC_LR_RATE                      0x46
#define WM8350_INPUT_CONTROL                    0x48
#define WM8350_IN3_INPUT_CONTROL                0x49
#define WM8350_MIC_BIAS_CONTROL                 0x4A
#define WM8350_OUTPUT_CONTROL                   0x4C
#define WM8350_JACK_DETECT                      0x4D
#define WM8350_ANTI_POP_CONTROL                 0x4E
#define WM8350_LEFT_INPUT_VOLUME                0x50
#define WM8350_RIGHT_INPUT_VOLUME               0x51
#define WM8350_LEFT_MIXER_CONTROL               0x58
#define WM8350_RIGHT_MIXER_CONTROL              0x59
#define WM8350_OUT3_MIXER_CONTROL               0x5C
#define WM8350_OUT4_MIXER_CONTROL               0x5D
#define WM8350_OUTPUT_LEFT_MIXER_VOLUME         0x60
#define WM8350_OUTPUT_RIGHT_MIXER_VOLUME        0x61
#define WM8350_INPUT_MIXER_VOLUME_L             0x62
#define WM8350_INPUT_MIXER_VOLUME_R             0x63
#define WM8350_INPUT_MIXER_VOLUME               0x64
#define WM8350_LOUT1_VOLUME                     0x68
#define WM8350_ROUT1_VOLUME                     0x69
#define WM8350_LOUT2_VOLUME                     0x6A
#define WM8350_ROUT2_VOLUME                     0x6B
#define WM8350_BEEP_VOLUME                      0x6F
#define WM8350_AI_FORMATING                     0x70
#define WM8350_ADC_DAC_COMP                     0x71
#define WM8350_AI_ADC_CONTROL                   0x72
#define WM8350_AI_DAC_CONTROL                   0x73
#define WM8350_AIF_TEST                         0x74
#define WM8350_JACK_PIN_STATUS                  0xE7

/* Bit values for R08 (0x08) */
#define WM8350_CODEC_ISEL_1_5                   0	/* x1.5 */
#define WM8350_CODEC_ISEL_1_0                   1	/* x1.0 */
#define WM8350_CODEC_ISEL_0_75                  2	/* x0.75 */
#define WM8350_CODEC_ISEL_0_5                   3	/* x0.5 */

#define WM8350_VMID_OFF                         0
#define WM8350_VMID_300K                        1
#define WM8350_VMID_50K                         2
#define WM8350_VMID_5K                          3

/*
 * R40 (0x28) - Clock Control 1
 */
#define WM8350_TOCLK_RATE                       0x4000
#define WM8350_MCLK_SEL                         0x0800
#define WM8350_MCLK_DIV_MASK                    0x0100
#define WM8350_BCLK_DIV_MASK                    0x00F0
#define WM8350_OPCLK_DIV_MASK                   0x0007

/*
 * R41 (0x29) - Clock Control 2
 */
#define WM8350_LRC_ADC_SEL                      0x8000
#define WM8350_MCLK_DIR                         0x0001

/*
 * R42 (0x2A) - FLL Control 1
 */
#define WM8350_FLL_DITHER_WIDTH_MASK            0x3000
#define WM8350_FLL_DITHER_HP                    0x0800
#define WM8350_FLL_OUTDIV_MASK                  0x0700
#define WM8350_FLL_RSP_RATE_MASK                0x00F0
#define WM8350_FLL_RATE_MASK                    0x0007

/*
 * R43 (0x2B) - FLL Control 2
 */
#define WM8350_FLL_RATIO_MASK                   0xF800
#define WM8350_FLL_N_MASK                       0x03FF

/*
 * R44 (0x2C) - FLL Control 3
 */
#define WM8350_FLL_K_MASK                       0xFFFF

/*
 * R45 (0x2D) - FLL Control 4
 */
#define WM8350_FLL_FRAC                         0x0020
#define WM8350_FLL_SLOW_LOCK_REF                0x0010
#define WM8350_FLL_CLK_SRC_MASK                 0x0003

/*
 * R48 (0x30) - DAC Control
 */
#define WM8350_DAC_MONO                         0x2000
#define WM8350_AIF_LRCLKRATE                    0x1000
#define WM8350_DEEMP_MASK                       0x0030
#define WM8350_DACL_DATINV                      0x0002
#define WM8350_DACR_DATINV                      0x0001

/*
 * R50 (0x32) - DAC Digital Volume L
 */
#define WM8350_DAC_VU                           0x0100
#define WM8350_DACL_VOL_MASK                    0x00FF

/*
 * R51 (0x33) - DAC Digital Volume R
 */
#define WM8350_DAC_VU                           0x0100
#define WM8350_DACR_VOL_MASK                    0x00FF

/*
 * R53 (0x35) - DAC LR Rate
 */
#define WM8350_DACLRC_ENA                       0x0800
#define WM8350_DACLRC_RATE_MASK                 0x07FF

/*
 * R54 (0x36) - DAC Clock Control
 */
#define WM8350_DACCLK_POL                       0x0010
#define WM8350_DAC_CLKDIV_MASK                  0x0007

/*
 * R58 (0x3A) - DAC Mute
 */
#define WM8350_DAC_MUTE_ENA                     0x4000

/*
 * R59 (0x3B) - DAC Mute Volume
 */
#define WM8350_DAC_MUTEMODE                     0x4000
#define WM8350_DAC_MUTERATE                     0x2000
#define WM8350_DAC_SB_FILT                      0x1000

/*
 * R60 (0x3C) - DAC Side
 */
#define WM8350_ADC_TO_DACL_MASK                 0x3000
#define WM8350_ADC_TO_DACR_MASK                 0x0C00

/*
 * R64 (0x40) - ADC Control
 */
#define WM8350_ADC_HPF_CUT_MASK                 0x0300
#define WM8350_ADCL_DATINV                      0x0002
#define WM8350_ADCR_DATINV                      0x0001

/*
 * R66 (0x42) - ADC Digital Volume L
 */
#define WM8350_ADC_VU                           0x0100
#define WM8350_ADCL_VOL_MASK                    0x00FF

/*
 * R67 (0x43) - ADC Digital Volume R
 */
#define WM8350_ADC_VU                           0x0100
#define WM8350_ADCR_VOL_MASK                    0x00FF

/*
 * R68 (0x44) - ADC Divider
 */
#define WM8350_ADCL_DAC_SVOL_MASK               0x0F00
#define WM8350_ADCR_DAC_SVOL_MASK               0x00F0
#define WM8350_ADCCLK_POL                       0x0008
#define WM8350_ADC_CLKDIV_MASK                  0x0007

/*
 * R70 (0x46) - ADC LR Rate
 */
#define WM8350_ADCLRC_ENA                       0x0800
#define WM8350_ADCLRC_RATE_MASK                 0x07FF

/*
 * R72 (0x48) - Input Control
 */
#define WM8350_IN2R_ENA                         0x0400
#define WM8350_IN1RN_ENA                        0x0200
#define WM8350_IN1RP_ENA                        0x0100
#define WM8350_IN2L_ENA                         0x0004
#define WM8350_IN1LN_ENA                        0x0002
#define WM8350_IN1LP_ENA                        0x0001

/*
 * R73 (0x49) - IN3 Input Control
 */
#define WM8350_IN3R_SHORT                       0x4000
#define WM8350_IN3L_SHORT                       0x0040

/*
 * R74 (0x4A) - Mic Bias Control
 */
#define WM8350_MICBSEL                          0x4000
#define WM8350_MCDTHR_MASK                      0x001C
#define WM8350_MCDSCTHR_MASK                    0x0003

/*
 * R76 (0x4C) - Output Control
 */
#define WM8350_OUT4_VROI                        0x0800
#define WM8350_OUT3_VROI                        0x0400
#define WM8350_OUT2_VROI                        0x0200
#define WM8350_OUT1_VROI                        0x0100
#define WM8350_OUT2_FB                          0x0004
#define WM8350_OUT1_FB                          0x0001

/*
 * R77 (0x4D) - Jack Detect
 */
#define WM8350_JDL_ENA                          0x8000
#define WM8350_JDR_ENA                          0x4000

/*
 * R78 (0x4E) - Anti Pop Control
 */
#define WM8350_ANTI_POP_MASK                    0x0300
#define WM8350_DIS_OP_LN4_MASK                  0x00C0
#define WM8350_DIS_OP_LN3_MASK                  0x0030
#define WM8350_DIS_OP_OUT2_MASK                 0x000C
#define WM8350_DIS_OP_OUT1_MASK                 0x0003

/*
 * R80 (0x50) - Left Input Volume
 */
#define WM8350_INL_MUTE                         0x4000
#define WM8350_INL_ZC                           0x2000
#define WM8350_IN_VU                            0x0100
#define WM8350_INL_VOL_MASK                     0x00FC

/*
 * R81 (0x51) - Right Input Volume
 */
#define WM8350_INR_MUTE                         0x4000
#define WM8350_INR_ZC                           0x2000
#define WM8350_IN_VU                            0x0100
#define WM8350_INR_VOL_MASK                     0x00FC

/*
 * R88 (0x58) - Left Mixer Control
 */
#define WM8350_DACR_TO_MIXOUTL                  0x1000
#define WM8350_DACL_TO_MIXOUTL                  0x0800
#define WM8350_IN3L_TO_MIXOUTL                  0x0004
#define WM8350_INR_TO_MIXOUTL                   0x0002
#define WM8350_INL_TO_MIXOUTL                   0x0001

/*
 * R89 (0x59) - Right Mixer Control
 */
#define WM8350_DACR_TO_MIXOUTR                  0x1000
#define WM8350_DACL_TO_MIXOUTR                  0x0800
#define WM8350_IN3R_TO_MIXOUTR                  0x0008
#define WM8350_INR_TO_MIXOUTR                   0x0002
#define WM8350_INL_TO_MIXOUTR                   0x0001

/*
 * R92 (0x5C) - OUT3 Mixer Control
 */
#define WM8350_DACL_TO_OUT3                     0x0800
#define WM8350_MIXINL_TO_OUT3                   0x0100
#define WM8350_OUT4_TO_OUT3                     0x0008
#define WM8350_MIXOUTL_TO_OUT3                  0x0001

/*
 * R93 (0x5D) - OUT4 Mixer Control
 */
#define WM8350_DACR_TO_OUT4                     0x1000
#define WM8350_DACL_TO_OUT4                     0x0800
#define WM8350_OUT4_ATTN                        0x0400
#define WM8350_MIXINR_TO_OUT4                   0x0200
#define WM8350_OUT3_TO_OUT4                     0x0004
#define WM8350_MIXOUTR_TO_OUT4                  0x0002
#define WM8350_MIXOUTL_TO_OUT4                  0x0001

/*
 * R96 (0x60) - Output Left Mixer Volume
 */
#define WM8350_IN3L_MIXOUTL_VOL_MASK            0x0E00
#define WM8350_IN3L_MIXOUTL_VOL_SHIFT                9
#define WM8350_INR_MIXOUTL_VOL_MASK             0x00E0
#define WM8350_INR_MIXOUTL_VOL_SHIFT                 5
#define WM8350_INL_MIXOUTL_VOL_MASK             0x000E
#define WM8350_INL_MIXOUTL_VOL_SHIFT                 1

/* Bit values for R96 (0x60) */
#define WM8350_IN3L_MIXOUTL_VOL_OFF                  0
#define WM8350_IN3L_MIXOUTL_VOL_M12DB                1
#define WM8350_IN3L_MIXOUTL_VOL_M9DB                 2
#define WM8350_IN3L_MIXOUTL_VOL_M6DB                 3
#define WM8350_IN3L_MIXOUTL_VOL_M3DB                 4
#define WM8350_IN3L_MIXOUTL_VOL_0DB                  5
#define WM8350_IN3L_MIXOUTL_VOL_3DB                  6
#define WM8350_IN3L_MIXOUTL_VOL_6DB                  7

#define WM8350_INR_MIXOUTL_VOL_OFF                   0
#define WM8350_INR_MIXOUTL_VOL_M12DB                 1
#define WM8350_INR_MIXOUTL_VOL_M9DB                  2
#define WM8350_INR_MIXOUTL_VOL_M6DB                  3
#define WM8350_INR_MIXOUTL_VOL_M3DB                  4
#define WM8350_INR_MIXOUTL_VOL_0DB                   5
#define WM8350_INR_MIXOUTL_VOL_3DB                   6
#define WM8350_INR_MIXOUTL_VOL_6DB                   7

#define WM8350_INL_MIXOUTL_VOL_OFF                   0
#define WM8350_INL_MIXOUTL_VOL_M12DB                 1
#define WM8350_INL_MIXOUTL_VOL_M9DB                  2
#define WM8350_INL_MIXOUTL_VOL_M6DB                  3
#define WM8350_INL_MIXOUTL_VOL_M3DB                  4
#define WM8350_INL_MIXOUTL_VOL_0DB                   5
#define WM8350_INL_MIXOUTL_VOL_3DB                   6
#define WM8350_INL_MIXOUTL_VOL_6DB                   7

/*
 * R97 (0x61) - Output Right Mixer Volume
 */
#define WM8350_IN3R_MIXOUTR_VOL_MASK            0xE000
#define WM8350_IN3R_MIXOUTR_VOL_SHIFT               13
#define WM8350_INR_MIXOUTR_VOL_MASK             0x00E0
#define WM8350_INR_MIXOUTR_VOL_SHIFT                 5
#define WM8350_INL_MIXOUTR_VOL_MASK             0x000E
#define WM8350_INL_MIXOUTR_VOL_SHIFT                 1

/* Bit values for R96 (0x60) */
#define WM8350_IN3R_MIXOUTR_VOL_OFF                  0
#define WM8350_IN3R_MIXOUTR_VOL_M12DB                1
#define WM8350_IN3R_MIXOUTR_VOL_M9DB                 2
#define WM8350_IN3R_MIXOUTR_VOL_M6DB                 3
#define WM8350_IN3R_MIXOUTR_VOL_M3DB                 4
#define WM8350_IN3R_MIXOUTR_VOL_0DB                  5
#define WM8350_IN3R_MIXOUTR_VOL_3DB                  6
#define WM8350_IN3R_MIXOUTR_VOL_6DB                  7

#define WM8350_INR_MIXOUTR_VOL_OFF                   0
#define WM8350_INR_MIXOUTR_VOL_M12DB                 1
#define WM8350_INR_MIXOUTR_VOL_M9DB                  2
#define WM8350_INR_MIXOUTR_VOL_M6DB                  3
#define WM8350_INR_MIXOUTR_VOL_M3DB                  4
#define WM8350_INR_MIXOUTR_VOL_0DB                   5
#define WM8350_INR_MIXOUTR_VOL_3DB                   6
#define WM8350_INR_MIXOUTR_VOL_6DB                   7

#define WM8350_INL_MIXOUTR_VOL_OFF                   0
#define WM8350_INL_MIXOUTR_VOL_M12DB                 1
#define WM8350_INL_MIXOUTR_VOL_M9DB                  2
#define WM8350_INL_MIXOUTR_VOL_M6DB                  3
#define WM8350_INL_MIXOUTR_VOL_M3DB                  4
#define WM8350_INL_MIXOUTR_VOL_0DB                   5
#define WM8350_INL_MIXOUTR_VOL_3DB                   6
#define WM8350_INL_MIXOUTR_VOL_6DB                   7

/*
 * R98 (0x62) - Input Mixer Volume L
 */
#define WM8350_IN3L_MIXINL_VOL_MASK             0x0E00
#define WM8350_IN2L_MIXINL_VOL_MASK             0x000E
#define WM8350_INL_MIXINL_VOL                   0x0001

/*
 * R99 (0x63) - Input Mixer Volume R
 */
#define WM8350_IN3R_MIXINR_VOL_MASK             0xE000
#define WM8350_IN2R_MIXINR_VOL_MASK             0x00E0
#define WM8350_INR_MIXINR_VOL                   0x0001

/*
 * R100 (0x64) - Input Mixer Volume
 */
#define WM8350_OUT4_MIXIN_DST                   0x8000
#define WM8350_OUT4_MIXIN_VOL_MASK              0x000E

/*
 * R104 (0x68) - LOUT1 Volume
 */
#define WM8350_OUT1L_MUTE                       0x4000
#define WM8350_OUT1L_ZC                         0x2000
#define WM8350_OUT1_VU                          0x0100
#define WM8350_OUT1L_VOL_MASK                   0x00FC
#define WM8350_OUT1L_VOL_SHIFT                       2

/*
 * R105 (0x69) - ROUT1 Volume
 */
#define WM8350_OUT1R_MUTE                       0x4000
#define WM8350_OUT1R_ZC                         0x2000
#define WM8350_OUT1_VU                          0x0100
#define WM8350_OUT1R_VOL_MASK                   0x00FC
#define WM8350_OUT1R_VOL_SHIFT                       2

/*
 * R106 (0x6A) - LOUT2 Volume
 */
#define WM8350_OUT2L_MUTE                       0x4000
#define WM8350_OUT2L_ZC                         0x2000
#define WM8350_OUT2_VU                          0x0100
#define WM8350_OUT2L_VOL_MASK                   0x00FC

/*
 * R107 (0x6B) - ROUT2 Volume
 */
#define WM8350_OUT2R_MUTE                       0x4000
#define WM8350_OUT2R_ZC                         0x2000
#define WM8350_OUT2R_INV                        0x0400
#define WM8350_OUT2R_INV_MUTE                   0x0200
#define WM8350_OUT2_VU                          0x0100
#define WM8350_OUT2R_VOL_MASK                   0x00FC

/*
 * R111 (0x6F) - BEEP Volume
 */
#define WM8350_IN3R_OUT2R_VOL_MASK              0x00E0

/*
 * R112 (0x70) - AI Formating
 */
#define WM8350_AIF_BCLK_INV                     0x8000
#define WM8350_AIF_TRI                          0x2000
#define WM8350_AIF_LRCLK_INV                    0x1000
#define WM8350_AIF_WL_MASK                      0x0C00
#define WM8350_AIF_FMT_MASK                     0x0300

/*
 * R113 (0x71) - ADC DAC COMP
 */
#define WM8350_DAC_COMP                         0x0080
#define WM8350_DAC_COMPMODE                     0x0040
#define WM8350_ADC_COMP                         0x0020
#define WM8350_ADC_COMPMODE                     0x0010
#define WM8350_LOOPBACK                         0x0001

/*
 * R114 (0x72) - AI ADC Control
 */
#define WM8350_AIFADC_PD                        0x0080
#define WM8350_AIFADCL_SRC                      0x0040
#define WM8350_AIFADCR_SRC                      0x0020
#define WM8350_AIFADC_TDM_CHAN                  0x0010
#define WM8350_AIFADC_TDM                       0x0008

/*
 * R115 (0x73) - AI DAC Control
 */
#define WM8350_BCLK_MSTR                        0x4000
#define WM8350_AIFDAC_PD                        0x0080
#define WM8350_DACL_SRC                         0x0040
#define WM8350_DACR_SRC                         0x0020
#define WM8350_AIFDAC_TDM_CHAN                  0x0010
#define WM8350_AIFDAC_TDM                       0x0008
#define WM8350_DAC_BOOST_MASK                   0x0003

/*
 * R116 (0x74) - AIF Test
 */
#define WM8350_CODEC_BYP                        0x4000
#define WM8350_AIFADC_WR_TST                    0x2000
#define WM8350_AIFADC_RD_TST                    0x1000
#define WM8350_AIFDAC_WR_TST                    0x0800
#define WM8350_AIFDAC_RD_TST                    0x0400
#define WM8350_AIFADC_ASYN                      0x0020
#define WM8350_AIFDAC_ASYN                      0x0010

/*
 * R231 (0xE7) - Jack Status
 */
#define WM8350_JACK_L_LVL			0x0800
#define WM8350_JACK_R_LVL                       0x0400
#define WM8350_JACK_MICSCD_LVL			0x0200
#define WM8350_JACK_MICSD_LVL			0x0100

/*
 * WM8350 Platform setup
 */
#define WM8350_S_CURVE_NONE			0x0
#define WM8350_S_CURVE_FAST			0x1
#define WM8350_S_CURVE_MEDIUM			0x2
#define WM8350_S_CURVE_SLOW			0x3

#define WM8350_DISCHARGE_OFF			0x0
#define WM8350_DISCHARGE_FAST			0x1
#define WM8350_DISCHARGE_MEDIUM			0x2
#define WM8350_DISCHARGE_SLOW			0x3

#define WM8350_TIE_OFF_500R			0x0
#define WM8350_TIE_OFF_30K			0x1

/*
 * Clock sources & directions
 */
#define WM8350_SYSCLK				0

#define WM8350_MCLK_SEL_PLL_MCLK		0
#define WM8350_MCLK_SEL_PLL_DAC			1
#define WM8350_MCLK_SEL_PLL_ADC			2
#define WM8350_MCLK_SEL_PLL_32K			3
#define WM8350_MCLK_SEL_MCLK			5

#define WM8350_MCLK_DIR_OUT			0
#define WM8350_MCLK_DIR_IN			1

/* clock divider id's */
#define WM8350_ADC_CLKDIV			0
#define WM8350_DAC_CLKDIV			1
#define WM8350_BCLK_CLKDIV			2
#define WM8350_OPCLK_CLKDIV			3
#define WM8350_TO_CLKDIV			4
#define WM8350_SYS_CLKDIV			5
#define WM8350_DACLR_CLKDIV			6
#define WM8350_ADCLR_CLKDIV			7

/* ADC clock dividers */
#define WM8350_ADCDIV_1				0x0
#define WM8350_ADCDIV_1_5			0x1
#define WM8350_ADCDIV_2				0x2
#define WM8350_ADCDIV_3				0x3
#define WM8350_ADCDIV_4				0x4
#define WM8350_ADCDIV_5_5			0x5
#define WM8350_ADCDIV_6				0x6

/* ADC clock dividers */
#define WM8350_DACDIV_1				0x0
#define WM8350_DACDIV_1_5			0x1
#define WM8350_DACDIV_2				0x2
#define WM8350_DACDIV_3				0x3
#define WM8350_DACDIV_4				0x4
#define WM8350_DACDIV_5_5			0x5
#define WM8350_DACDIV_6				0x6

/* BCLK clock dividers */
#define WM8350_BCLK_DIV_1			(0x0 << 4)
#define WM8350_BCLK_DIV_1_5			(0x1 << 4)
#define WM8350_BCLK_DIV_2			(0x2 << 4)
#define WM8350_BCLK_DIV_3			(0x3 << 4)
#define WM8350_BCLK_DIV_4			(0x4 << 4)
#define WM8350_BCLK_DIV_5_5			(0x5 << 4)
#define WM8350_BCLK_DIV_6			(0x6 << 4)
#define WM8350_BCLK_DIV_8			(0x7 << 4)
#define WM8350_BCLK_DIV_11			(0x8 << 4)
#define WM8350_BCLK_DIV_12			(0x9 << 4)
#define WM8350_BCLK_DIV_16			(0xa << 4)
#define WM8350_BCLK_DIV_22			(0xb << 4)
#define WM8350_BCLK_DIV_24			(0xc << 4)
#define WM8350_BCLK_DIV_32			(0xd << 4)
#define WM8350_BCLK_DIV_44			(0xe << 4)
#define WM8350_BCLK_DIV_48			(0xf << 4)

/* Sys (MCLK) clock dividers */
#define WM8350_MCLK_DIV_1			(0x0 << 8)
#define WM8350_MCLK_DIV_2			(0x1 << 8)

/* OP clock dividers */
#define WM8350_OPCLK_DIV_1			0x0
#define WM8350_OPCLK_DIV_2			0x1
#define WM8350_OPCLK_DIV_3			0x2
#define WM8350_OPCLK_DIV_4			0x3
#define WM8350_OPCLK_DIV_5_5			0x4
#define WM8350_OPCLK_DIV_6			0x5

/* DAI ID */
#define WM8350_HIFI_DAI				0

/*
 * Audio interrupts.
 */
#define WM8350_IRQ_CODEC_JCK_DET_L		39
#define WM8350_IRQ_CODEC_JCK_DET_R		40
#define WM8350_IRQ_CODEC_MICSCD			41
#define WM8350_IRQ_CODEC_MICD			42

/*
 * WM8350 Platform data.
 *
 * This must be initialised per platform for best audio performance.
 * Please see WM8350 datasheet for information.
 */
struct wm8350_audio_platform_data {
	int vmid_discharge_msecs;	/* VMID --> OFF discharge time */
	int drain_msecs;	/* OFF drain time */
	int cap_discharge_msecs;	/* Cap ON (from OFF) discharge time */
	int vmid_charge_msecs;	/* vmid power up time */
	u32 vmid_s_curve:2;	/* vmid enable s curve speed */
	u32 dis_out4:2;		/* out4 discharge speed */
	u32 dis_out3:2;		/* out3 discharge speed */
	u32 dis_out2:2;		/* out2 discharge speed */
	u32 dis_out1:2;		/* out1 discharge speed */
	u32 vroi_out4:1;	/* out4 tie off */
	u32 vroi_out3:1;	/* out3 tie off */
	u32 vroi_out2:1;	/* out2 tie off */
	u32 vroi_out1:1;	/* out1 tie off */
	u32 vroi_enable:1;	/* enable tie off */
	u32 codec_current_on:2;	/* current level ON */
	u32 codec_current_standby:2;	/* current level STANDBY */
	u32 codec_current_charge:2;	/* codec current @ vmid charge */
};

struct snd_soc_codec;

struct wm8350_codec {
	struct platform_device *pdev;
	struct snd_soc_codec *codec;
	struct wm8350_audio_platform_data *platform_data;
};

#endif