xref: /openbmc/linux/sound/soc/codecs/wm8960.h (revision f2644a2c)
1f2644a2cSMark Brown /*
2f2644a2cSMark Brown  * wm8960.h  --  WM8960 Soc Audio driver
3f2644a2cSMark Brown  *
4f2644a2cSMark Brown  * This program is free software; you can redistribute it and/or modify
5f2644a2cSMark Brown  * it under the terms of the GNU General Public License version 2 as
6f2644a2cSMark Brown  * published by the Free Software Foundation.
7f2644a2cSMark Brown  */
8f2644a2cSMark Brown 
9f2644a2cSMark Brown #ifndef _WM8960_H
10f2644a2cSMark Brown #define _WM8960_H
11f2644a2cSMark Brown 
12f2644a2cSMark Brown /* WM8960 register space */
13f2644a2cSMark Brown 
14f2644a2cSMark Brown 
15f2644a2cSMark Brown #define WM8960_CACHEREGNUM 	56
16f2644a2cSMark Brown 
17f2644a2cSMark Brown #define WM8960_LINVOL		0x0
18f2644a2cSMark Brown #define WM8960_RINVOL		0x1
19f2644a2cSMark Brown #define WM8960_LOUT1		0x2
20f2644a2cSMark Brown #define WM8960_ROUT1		0x3
21f2644a2cSMark Brown #define WM8960_CLOCK1		0x4
22f2644a2cSMark Brown #define WM8960_DACCTL1		0x5
23f2644a2cSMark Brown #define WM8960_DACCTL2		0x6
24f2644a2cSMark Brown #define WM8960_IFACE1		0x7
25f2644a2cSMark Brown #define WM8960_CLOCK2		0x8
26f2644a2cSMark Brown #define WM8960_IFACE2		0x9
27f2644a2cSMark Brown #define WM8960_LDAC		0xa
28f2644a2cSMark Brown #define WM8960_RDAC		0xb
29f2644a2cSMark Brown 
30f2644a2cSMark Brown #define WM8960_RESET		0xf
31f2644a2cSMark Brown #define WM8960_3D		0x10
32f2644a2cSMark Brown #define WM8960_ALC1		0x11
33f2644a2cSMark Brown #define WM8960_ALC2		0x12
34f2644a2cSMark Brown #define WM8960_ALC3		0x13
35f2644a2cSMark Brown #define WM8960_NOISEG		0x14
36f2644a2cSMark Brown #define WM8960_LADC		0x15
37f2644a2cSMark Brown #define WM8960_RADC		0x16
38f2644a2cSMark Brown #define WM8960_ADDCTL1		0x17
39f2644a2cSMark Brown #define WM8960_ADDCTL2		0x18
40f2644a2cSMark Brown #define WM8960_POWER1		0x19
41f2644a2cSMark Brown #define WM8960_POWER2		0x1a
42f2644a2cSMark Brown #define WM8960_ADDCTL3		0x1b
43f2644a2cSMark Brown #define WM8960_APOP1		0x1c
44f2644a2cSMark Brown #define WM8960_APOP2		0x1d
45f2644a2cSMark Brown 
46f2644a2cSMark Brown #define WM8960_LINPATH		0x20
47f2644a2cSMark Brown #define WM8960_RINPATH		0x21
48f2644a2cSMark Brown #define WM8960_LOUTMIX		0x22
49f2644a2cSMark Brown 
50f2644a2cSMark Brown #define WM8960_ROUTMIX		0x25
51f2644a2cSMark Brown #define WM8960_MONOMIX1		0x26
52f2644a2cSMark Brown #define WM8960_MONOMIX2		0x27
53f2644a2cSMark Brown #define WM8960_LOUT2		0x28
54f2644a2cSMark Brown #define WM8960_ROUT2		0x29
55f2644a2cSMark Brown #define WM8960_MONO		0x2a
56f2644a2cSMark Brown #define WM8960_INBMIX1		0x2b
57f2644a2cSMark Brown #define WM8960_INBMIX2		0x2c
58f2644a2cSMark Brown #define WM8960_BYPASS1		0x2d
59f2644a2cSMark Brown #define WM8960_BYPASS2		0x2e
60f2644a2cSMark Brown #define WM8960_POWER3		0x2f
61f2644a2cSMark Brown #define WM8960_ADDCTL4		0x30
62f2644a2cSMark Brown #define WM8960_CLASSD1		0x31
63f2644a2cSMark Brown 
64f2644a2cSMark Brown #define WM8960_CLASSD3		0x33
65f2644a2cSMark Brown #define WM8960_PLL1		0x34
66f2644a2cSMark Brown #define WM8960_PLL2		0x35
67f2644a2cSMark Brown #define WM8960_PLL3		0x36
68f2644a2cSMark Brown #define WM8960_PLL4		0x37
69f2644a2cSMark Brown 
70f2644a2cSMark Brown 
71f2644a2cSMark Brown /*
72f2644a2cSMark Brown  * WM8960 Clock dividers
73f2644a2cSMark Brown  */
74f2644a2cSMark Brown #define WM8960_SYSCLKDIV 		0
75f2644a2cSMark Brown #define WM8960_DACDIV			1
76f2644a2cSMark Brown #define WM8960_OPCLKDIV			2
77f2644a2cSMark Brown #define WM8960_DCLKDIV			3
78f2644a2cSMark Brown #define WM8960_TOCLKSEL			4
79f2644a2cSMark Brown #define WM8960_SYSCLKSEL		5
80f2644a2cSMark Brown 
81f2644a2cSMark Brown #define WM8960_SYSCLK_DIV_1		(0 << 1)
82f2644a2cSMark Brown #define WM8960_SYSCLK_DIV_2		(2 << 1)
83f2644a2cSMark Brown 
84f2644a2cSMark Brown #define WM8960_SYSCLK_MCLK		(0 << 0)
85f2644a2cSMark Brown #define WM8960_SYSCLK_PLL		(1 << 0)
86f2644a2cSMark Brown 
87f2644a2cSMark Brown #define WM8960_DAC_DIV_1		(0 << 3)
88f2644a2cSMark Brown #define WM8960_DAC_DIV_1_5		(1 << 3)
89f2644a2cSMark Brown #define WM8960_DAC_DIV_2		(2 << 3)
90f2644a2cSMark Brown #define WM8960_DAC_DIV_3		(3 << 3)
91f2644a2cSMark Brown #define WM8960_DAC_DIV_4		(4 << 3)
92f2644a2cSMark Brown #define WM8960_DAC_DIV_5_5		(5 << 3)
93f2644a2cSMark Brown #define WM8960_DAC_DIV_6		(6 << 3)
94f2644a2cSMark Brown 
95f2644a2cSMark Brown #define WM8960_DCLK_DIV_1_5		(0 << 6)
96f2644a2cSMark Brown #define WM8960_DCLK_DIV_2		(1 << 6)
97f2644a2cSMark Brown #define WM8960_DCLK_DIV_3		(2 << 6)
98f2644a2cSMark Brown #define WM8960_DCLK_DIV_4		(3 << 6)
99f2644a2cSMark Brown #define WM8960_DCLK_DIV_6		(4 << 6)
100f2644a2cSMark Brown #define WM8960_DCLK_DIV_8		(5 << 6)
101f2644a2cSMark Brown #define WM8960_DCLK_DIV_12		(6 << 6)
102f2644a2cSMark Brown #define WM8960_DCLK_DIV_16		(7 << 6)
103f2644a2cSMark Brown 
104f2644a2cSMark Brown #define WM8960_TOCLK_F19		(0 << 1)
105f2644a2cSMark Brown #define WM8960_TOCLK_F21		(1 << 1)
106f2644a2cSMark Brown 
107f2644a2cSMark Brown #define WM8960_OPCLK_DIV_1		(0 << 0)
108f2644a2cSMark Brown #define WM8960_OPCLK_DIV_2		(1 << 0)
109f2644a2cSMark Brown #define WM8960_OPCLK_DIV_3		(2 << 0)
110f2644a2cSMark Brown #define WM8960_OPCLK_DIV_4		(3 << 0)
111f2644a2cSMark Brown #define WM8960_OPCLK_DIV_5_5		(4 << 0)
112f2644a2cSMark Brown #define WM8960_OPCLK_DIV_6		(5 << 0)
113f2644a2cSMark Brown 
114f2644a2cSMark Brown extern struct snd_soc_dai wm8960_dai;
115f2644a2cSMark Brown extern struct snd_soc_codec_device soc_codec_dev_wm8960;
116f2644a2cSMark Brown 
117f2644a2cSMark Brown #define WM8960_DRES_400R 0
118f2644a2cSMark Brown #define WM8960_DRES_200R 1
119f2644a2cSMark Brown #define WM8960_DRES_600R 2
120f2644a2cSMark Brown #define WM8960_DRES_150R 3
121f2644a2cSMark Brown #define WM8960_DRES_MAX  3
122f2644a2cSMark Brown 
123f2644a2cSMark Brown struct wm8960_data {
124f2644a2cSMark Brown 	int dres;
125f2644a2cSMark Brown };
126f2644a2cSMark Brown 
127f2644a2cSMark Brown #endif
128