Merge branch 'fix/rt5645' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie...
[deliverable/linux.git] / sound / soc / codecs / cs4349.h
1 /*
2 * ALSA SoC CS4349 codec driver
3 *
4 * Copyright 2015 Cirrus Logic, Inc.
5 *
6 * Author: Tim Howe <Tim.Howe@cirrus.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 */
18
19 #ifndef __CS4349_H__
20 #define __CS4349_H__
21
22 /* CS4349 registers addresses */
23 #define CS4349_CHIPID 0x01 /* Device and Rev ID, Read Only */
24 #define CS4349_MODE 0x02 /* Mode Control */
25 #define CS4349_VMI 0x03 /* Volume, Mixing, Inversion Control */
26 #define CS4349_MUTE 0x04 /* Mute Control */
27 #define CS4349_VOLA 0x05 /* DAC Channel A Volume Control */
28 #define CS4349_VOLB 0x06 /* DAC Channel B Volume Control */
29 #define CS4349_RMPFLT 0x07 /* Ramp and Filter Control */
30 #define CS4349_MISC 0x08 /* Power Down,Freeze Control,Pop Stop*/
31
32 #define CS4349_I2C_INCR 0x80
33
34
35 /* Device and Revision ID */
36 #define CS4349_REVA 0xF0 /* Rev A */
37 #define CS4349_REVB 0xF1 /* Rev B */
38 #define CS4349_REVC2 0xFF /* Rev C2 */
39
40
41 /* PDN_DONE Poll Maximum
42 * If soft ramp is set it will take much longer to power down
43 * the system.
44 */
45 #define PDN_POLL_MAX 900
46
47
48 /* Bitfield Definitions */
49
50 /* CS4349_MODE */
51 /* (Digital Interface Format, De-Emphasis Control, Functional Mode */
52 #define DIF2 (1 << 6)
53 #define DIF1 (1 << 5)
54 #define DIF0 (1 << 4)
55 #define DEM1 (1 << 3)
56 #define DEM0 (1 << 2)
57 #define FM1 (1 << 1)
58 #define DIF_LEFT_JST 0x00
59 #define DIF_I2S 0x01
60 #define DIF_RGHT_JST16 0x02
61 #define DIF_RGHT_JST24 0x03
62 #define DIF_TDM0 0x04
63 #define DIF_TDM1 0x05
64 #define DIF_TDM2 0x06
65 #define DIF_TDM3 0x07
66 #define DIF_MASK 0x70
67 #define MODE_FORMAT(x) (((x)&7)<<4)
68 #define DEM_MASK 0x0C
69 #define NO_DEM 0x00
70 #define DEM_441 0x04
71 #define DEM_48K 0x08
72 #define DEM_32K 0x0C
73 #define FM_AUTO 0x00
74 #define FM_SNGL 0x01
75 #define FM_DBL 0x02
76 #define FM_QUAD 0x03
77 #define FM_SNGL_MIN 30000
78 #define FM_SNGL_MAX 54000
79 #define FM_DBL_MAX 108000
80 #define FM_QUAD_MAX 216000
81 #define FM_MASK 0x03
82
83 /* CS4349_VMI (VMI = Volume, Mixing and Inversion Controls) */
84 #define VOLBISA (1 << 7)
85 #define VOLAISB (1 << 7)
86 /* INVERT_A only available for Left Jstfd, Right Jstfd16 and Right Jstfd24 */
87 #define INVERT_A (1 << 6)
88 /* INVERT_B only available for Left Jstfd, Right Jstfd16 and Right Jstfd24 */
89 #define INVERT_B (1 << 5)
90 #define ATAPI3 (1 << 3)
91 #define ATAPI2 (1 << 2)
92 #define ATAPI1 (1 << 1)
93 #define ATAPI0 (1 << 0)
94 #define MUTEAB 0x00
95 #define MUTEA_RIGHTB 0x01
96 #define MUTEA_LEFTB 0x02
97 #define MUTEA_SUMLRDIV2B 0x03
98 #define RIGHTA_MUTEB 0x04
99 #define RIGHTA_RIGHTB 0x05
100 #define RIGHTA_LEFTB 0x06
101 #define RIGHTA_SUMLRDIV2B 0x07
102 #define LEFTA_MUTEB 0x08
103 #define LEFTA_RIGHTB 0x09 /* Default */
104 #define LEFTA_LEFTB 0x0A
105 #define LEFTA_SUMLRDIV2B 0x0B
106 #define SUMLRDIV2A_MUTEB 0x0C
107 #define SUMLRDIV2A_RIGHTB 0x0D
108 #define SUMLRDIV2A_LEFTB 0x0E
109 #define SUMLRDIV2_AB 0x0F
110 #define CHMIX_MASK 0x0F
111
112 /* CS4349_MUTE */
113 #define AUTOMUTE (1 << 7)
114 #define MUTEC_AB (1 << 5)
115 #define MUTE_A (1 << 4)
116 #define MUTE_B (1 << 3)
117 #define MUTE_AB_MASK 0x18
118
119 /* CS4349_RMPFLT (Ramp and Filter Control) */
120 #define SCZ1 (1 << 7)
121 #define SCZ0 (1 << 6)
122 #define RMP_UP (1 << 5)
123 #define RMP_DN (1 << 4)
124 #define FILT_SEL (1 << 2)
125 #define IMMDT_CHNG 0x31
126 #define ZEROCRSS 0x71
127 #define SOFT_RMP 0xB1
128 #define SFTRMP_ZEROCRSS 0xF1
129 #define SR_ZC_MASK 0xC0
130
131 /* CS4349_MISC */
132 #define PWR_DWN (1 << 7)
133 #define FREEZE (1 << 5)
134 #define POPG_EN (1 << 4)
135
136 #endif /* __CS4349_H__ */
This page took 0.032956 seconds and 5 git commands to generate.