ASoC: pcm512x: Implement paging support
[deliverable/linux.git] / sound / soc / codecs / pcm512x.h
CommitLineData
5a3af129
MB
1/*
2 * Driver for the PCM512x CODECs
3 *
4 * Author: Mark Brown <broonie@linaro.org>
5 * Copyright 2014 Linaro Ltd
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * version 2 as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 */
16
17#ifndef _SND_SOC_PCM512X
18#define _SND_SOC_PCM512X
19
806d6466
MB
20#define PCM512x_VIRT_BASE 0x100
21#define PCM512x_PAGE_LEN 0x100
22#define PCM512x_PAGE_BASE(n) (PCM512x_VIRT_BASE + (PCM512x_PAGE_LEN * n))
5a3af129
MB
23
24#define PCM512x_PAGE 0
25
806d6466
MB
26#define PCM512x_RESET (PCM512x_PAGE_BASE(0) + 1)
27#define PCM512x_POWER (PCM512x_PAGE_BASE(0) + 2)
28#define PCM512x_MUTE (PCM512x_PAGE_BASE(0) + 3)
29#define PCM512x_PLL_EN (PCM512x_PAGE_BASE(0) + 4)
30#define PCM512x_SPI_MISO_FUNCTION (PCM512x_PAGE_BASE(0) + 6)
31#define PCM512x_DSP (PCM512x_PAGE_BASE(0) + 7)
32#define PCM512x_GPIO_EN (PCM512x_PAGE_BASE(0) + 8)
33#define PCM512x_BCLK_LRCLK_CFG (PCM512x_PAGE_BASE(0) + 9)
34#define PCM512x_DSP_GPIO_INPUT (PCM512x_PAGE_BASE(0) + 10)
35#define PCM512x_MASTER_MODE (PCM512x_PAGE_BASE(0) + 12)
36#define PCM512x_PLL_REF (PCM512x_PAGE_BASE(0) + 13)
37#define PCM512x_PLL_COEFF_0 (PCM512x_PAGE_BASE(0) + 20)
38#define PCM512x_PLL_COEFF_1 (PCM512x_PAGE_BASE(0) + 21)
39#define PCM512x_PLL_COEFF_2 (PCM512x_PAGE_BASE(0) + 22)
40#define PCM512x_PLL_COEFF_3 (PCM512x_PAGE_BASE(0) + 23)
41#define PCM512x_PLL_COEFF_4 (PCM512x_PAGE_BASE(0) + 24)
42#define PCM512x_DSP_CLKDIV (PCM512x_PAGE_BASE(0) + 27)
43#define PCM512x_DAC_CLKDIV (PCM512x_PAGE_BASE(0) + 28)
44#define PCM512x_NCP_CLKDIV (PCM512x_PAGE_BASE(0) + 29)
45#define PCM512x_OSR_CLKDIV (PCM512x_PAGE_BASE(0) + 30)
46#define PCM512x_MASTER_CLKDIV_1 (PCM512x_PAGE_BASE(0) + 32)
47#define PCM512x_MASTER_CLKDIV_2 (PCM512x_PAGE_BASE(0) + 33)
48#define PCM512x_FS_SPEED_MODE (PCM512x_PAGE_BASE(0) + 34)
49#define PCM512x_IDAC_1 (PCM512x_PAGE_BASE(0) + 35)
50#define PCM512x_IDAC_2 (PCM512x_PAGE_BASE(0) + 36)
51#define PCM512x_ERROR_DETECT (PCM512x_PAGE_BASE(0) + 37)
52#define PCM512x_I2S_1 (PCM512x_PAGE_BASE(0) + 40)
53#define PCM512x_I2S_2 (PCM512x_PAGE_BASE(0) + 41)
54#define PCM512x_DAC_ROUTING (PCM512x_PAGE_BASE(0) + 42)
55#define PCM512x_DSP_PROGRAM (PCM512x_PAGE_BASE(0) + 43)
56#define PCM512x_CLKDET (PCM512x_PAGE_BASE(0) + 44)
57#define PCM512x_AUTO_MUTE (PCM512x_PAGE_BASE(0) + 59)
58#define PCM512x_DIGITAL_VOLUME_1 (PCM512x_PAGE_BASE(0) + 60)
59#define PCM512x_DIGITAL_VOLUME_2 (PCM512x_PAGE_BASE(0) + 61)
60#define PCM512x_DIGITAL_VOLUME_3 (PCM512x_PAGE_BASE(0) + 62)
61#define PCM512x_DIGITAL_MUTE_1 (PCM512x_PAGE_BASE(0) + 63)
62#define PCM512x_DIGITAL_MUTE_2 (PCM512x_PAGE_BASE(0) + 64)
63#define PCM512x_DIGITAL_MUTE_3 (PCM512x_PAGE_BASE(0) + 65)
64#define PCM512x_GPIO_OUTPUT_1 (PCM512x_PAGE_BASE(0) + 80)
65#define PCM512x_GPIO_OUTPUT_2 (PCM512x_PAGE_BASE(0) + 81)
66#define PCM512x_GPIO_OUTPUT_3 (PCM512x_PAGE_BASE(0) + 82)
67#define PCM512x_GPIO_OUTPUT_4 (PCM512x_PAGE_BASE(0) + 83)
68#define PCM512x_GPIO_OUTPUT_5 (PCM512x_PAGE_BASE(0) + 84)
69#define PCM512x_GPIO_OUTPUT_6 (PCM512x_PAGE_BASE(0) + 85)
70#define PCM512x_GPIO_CONTROL_1 (PCM512x_PAGE_BASE(0) + 86)
71#define PCM512x_GPIO_CONTROL_2 (PCM512x_PAGE_BASE(0) + 87)
72#define PCM512x_OVERFLOW (PCM512x_PAGE_BASE(0) + 90)
73#define PCM512x_RATE_DET_1 (PCM512x_PAGE_BASE(0) + 91)
74#define PCM512x_RATE_DET_2 (PCM512x_PAGE_BASE(0) + 92)
75#define PCM512x_RATE_DET_3 (PCM512x_PAGE_BASE(0) + 93)
76#define PCM512x_RATE_DET_4 (PCM512x_PAGE_BASE(0) + 94)
77#define PCM512x_ANALOG_MUTE_DET (PCM512x_PAGE_BASE(0) + 108)
78#define PCM512x_GPIN (PCM512x_PAGE_BASE(0) + 119)
79#define PCM512x_DIGITAL_MUTE_DET (PCM512x_PAGE_BASE(0) + 120)
5a3af129 80
806d6466
MB
81#define PCM512x_OUTPUT_AMPLITUDE (PCM512x_PAGE_BASE(1) + 1)
82#define PCM512x_ANALOG_GAIN_CTRL (PCM512x_PAGE_BASE(1) + 2)
83#define PCM512x_UNDERVOLTAGE_PROT (PCM512x_PAGE_BASE(1) + 5)
84#define PCM512x_ANALOG_MUTE_CTRL (PCM512x_PAGE_BASE(1) + 6)
85#define PCM512x_ANALOG_GAIN_BOOST (PCM512x_PAGE_BASE(1) + 7)
86#define PCM512x_VCOM_CTRL_1 (PCM512x_PAGE_BASE(1) + 8)
87#define PCM512x_VCOM_CTRL_2 (PCM512x_PAGE_BASE(1) + 9)
88
89#define PCM512x_CRAM_CTRL (PCM512x_PAGE_BASE(44) + 1)
90
91#define PCM512x_MAX_REGISTER (PCM512x_PAGE_BASE(44) + 1)
5a3af129
MB
92
93/* Page 0, Register 1 - reset */
94#define PCM512x_RSTR (1 << 0)
95#define PCM512x_RSTM (1 << 4)
96
97/* Page 0, Register 2 - power */
98#define PCM512x_RQPD (1 << 0)
99#define PCM512x_RQPD_SHIFT 0
100#define PCM512x_RQST (1 << 4)
101#define PCM512x_RQST_SHIFT 4
102
103/* Page 0, Register 3 - mute */
104#define PCM512x_RQMR_SHIFT 0
105#define PCM512x_RQML_SHIFT 4
106
107/* Page 0, Register 4 - PLL */
108#define PCM512x_PLCE (1 << 0)
109#define PCM512x_RLCE_SHIFT 0
110#define PCM512x_PLCK (1 << 4)
111#define PCM512x_PLCK_SHIFT 4
112
113/* Page 0, Register 7 - DSP */
114#define PCM512x_SDSL (1 << 0)
115#define PCM512x_SDSL_SHIFT 0
116#define PCM512x_DEMP (1 << 4)
117#define PCM512x_DEMP_SHIFT 4
118
119/* Page 0, Register 13 - PLL reference */
120#define PCM512x_SREF (1 << 4)
121
122/* Page 0, Register 37 - Error detection */
123#define PCM512x_IPLK (1 << 0)
124#define PCM512x_DCAS (1 << 1)
125#define PCM512x_IDCM (1 << 2)
126#define PCM512x_IDCH (1 << 3)
127#define PCM512x_IDSK (1 << 4)
128#define PCM512x_IDBK (1 << 5)
129#define PCM512x_IDFS (1 << 6)
130
131/* Page 0, Register 42 - DAC routing */
132#define PCM512x_AUPR_SHIFT 0
133#define PCM512x_AUPL_SHIFT 4
134
135/* Page 0, Register 59 - auto mute */
136#define PCM512x_ATMR_SHIFT 0
137#define PCM512x_ATML_SHIFT 4
138
139/* Page 0, Register 63 - ramp rates */
140#define PCM512x_VNDF_SHIFT 6
141#define PCM512x_VNDS_SHIFT 4
142#define PCM512x_VNUF_SHIFT 2
143#define PCM512x_VNUS_SHIFT 0
144
145/* Page 0, Register 64 - emergency ramp rates */
146#define PCM512x_VEDF_SHIFT 6
147#define PCM512x_VEDS_SHIFT 4
148
149/* Page 0, Register 65 - Digital mute enables */
150#define PCM512x_ACTL_SHIFT 2
151#define PCM512x_AMLE_SHIFT 1
152#define PCM512x_AMLR_SHIFT 0
153
154#endif
This page took 0.030951 seconds and 5 git commands to generate.