xref: /openbmc/linux/sound/soc/codecs/da732x.h (revision f1575595)
1 /*
2  * da732x.h -- Dialog DA732X ALSA SoC Audio Driver Header File
3  *
4  * Copyright (C) 2012 Dialog Semiconductor GmbH
5  *
6  * Author: Michal Hajduk <Michal.Hajduk@diasemi.com>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 as
10  * published by the Free Software Foundation.
11  */
12 
13 #ifndef __DA732X_H_
14 #define __DA732X_H_
15 
16 #include <sound/soc.h>
17 
18 /* General */
19 #define	DA732X_U8_MASK			0xFF
20 #define	DA732X_4BYTES			4
21 #define	DA732X_3BYTES			3
22 #define	DA732X_2BYTES			2
23 #define	DA732X_1BYTE			1
24 #define	DA732X_1BYTE_SHIFT		8
25 #define	DA732X_2BYTES_SHIFT		16
26 #define	DA732X_3BYTES_SHIFT		24
27 #define	DA732X_4BYTES_SHIFT		32
28 
29 #define	DA732X_DACS_DIS			0x0
30 #define	DA732X_HP_DIS			0x0
31 #define	DA732X_CLEAR_REG		0x0
32 
33 /* Calibration */
34 #define	DA732X_DAC_OFFSET_STEP		0x20
35 #define	DA732X_OUTPUT_OFFSET_STEP	0x80
36 #define	DA732X_HP_OUT_TRIM_VAL		0x0
37 #define	DA732X_WAIT_FOR_STABILIZATION	1
38 #define	DA732X_HPL_DAC			0
39 #define	DA732X_HPR_DAC			1
40 #define	DA732X_HP_DACS			2
41 #define	DA732X_HPL_AMP			0
42 #define	DA732X_HPR_AMP			1
43 #define	DA732X_HP_AMPS			2
44 
45 /* Clock settings */
46 #define DA732X_STARTUP_DELAY		100
47 #define	DA732X_PLL_OUT_196608		196608000
48 #define	DA732X_PLL_OUT_180634		180633600
49 #define	DA732X_PLL_OUT_SRM		188620800
50 #define	DA732X_MCLK_10MHZ		10000000
51 #define	DA732X_MCLK_20MHZ		20000000
52 #define	DA732X_MCLK_40MHZ		40000000
53 #define	DA732X_MCLK_54MHZ		54000000
54 #define	DA732X_MCLK_RET_0_10MHZ		0
55 #define	DA732X_MCLK_VAL_0_10MHZ		1
56 #define	DA732X_MCLK_RET_10_20MHZ	1
57 #define	DA732X_MCLK_VAL_10_20MHZ	2
58 #define	DA732X_MCLK_RET_20_40MHZ	2
59 #define	DA732X_MCLK_VAL_20_40MHZ	4
60 #define	DA732X_MCLK_RET_40_54MHZ	3
61 #define	DA732X_MCLK_VAL_40_54MHZ	8
62 #define	DA732X_DAI_ID1			0
63 #define	DA732X_DAI_ID2			1
64 #define	DA732X_SRCCLK_PLL		0
65 #define	DA732X_SRCCLK_MCLK		1
66 
67 #define	DA732X_LIN_LP_VOL		0x4F
68 #define	DA732X_LP_VOL			0x40
69 
70 /* Kcontrols */
71 #define	DA732X_DAC_EN_MAX		2
72 #define	DA732X_ADCL_MUX_MAX		2
73 #define	DA732X_ADCR_MUX_MAX		3
74 #define	DA732X_HPF_MODE_MAX		3
75 #define	DA732X_HPF_MODE_SHIFT		4
76 #define	DA732X_HPF_MUSIC_SHIFT		0
77 #define	DA732X_HPF_MUSIC_MAX		4
78 #define	DA732X_HPF_VOICE_SHIFT		4
79 #define	DA732X_HPF_VOICE_MAX		8
80 #define	DA732X_EQ_EN_MAX		1
81 #define	DA732X_HPF_VOICE		1
82 #define	DA732X_HPF_MUSIC		2
83 #define	DA732X_HPF_DISABLED		0
84 #define	DA732X_NO_INVERT		0
85 #define	DA732X_INVERT			1
86 #define	DA732X_SWITCH_MAX		1
87 #define	DA732X_ENABLE_CP		1
88 #define	DA732X_DISABLE_CP		0
89 #define	DA732X_DISABLE_ALL_CLKS		0
90 #define	DA732X_RESET_ADCS		0
91 
92 /* dB values */
93 #define DA732X_MIC_VOL_DB_MIN		0
94 #define DA732X_MIC_VOL_DB_INC		50
95 #define DA732X_MIC_PRE_VOL_DB_MIN	0
96 #define DA732X_MIC_PRE_VOL_DB_INC	600
97 #define DA732X_AUX_VOL_DB_MIN		-6000
98 #define DA732X_AUX_VOL_DB_INC		150
99 #define DA732X_HP_VOL_DB_MIN		-2250
100 #define DA732X_HP_VOL_DB_INC		150
101 #define	DA732X_LIN2_VOL_DB_MIN		-1650
102 #define	DA732X_LIN2_VOL_DB_INC		150
103 #define	DA732X_LIN3_VOL_DB_MIN		-1650
104 #define DA732X_LIN3_VOL_DB_INC		150
105 #define	DA732X_LIN4_VOL_DB_MIN		-2250
106 #define DA732X_LIN4_VOL_DB_INC		150
107 #define	DA732X_EQ_BAND_VOL_DB_MIN	-1050
108 #define	DA732X_EQ_BAND_VOL_DB_INC	150
109 #define DA732X_DAC_VOL_DB_MIN		-7725
110 #define DA732X_DAC_VOL_DB_INC		75
111 #define DA732X_ADC_VOL_DB_MIN		0
112 #define DA732X_ADC_VOL_DB_INC		-1
113 #define	DA732X_EQ_OVERALL_VOL_DB_MIN	-1800
114 #define	DA732X_EQ_OVERALL_VOL_DB_INC	600
115 
116 enum da732x_sysctl {
117 	DA732X_SR_8KHZ		= 0x1,
118 	DA732X_SR_11_025KHZ	= 0x2,
119 	DA732X_SR_12KHZ		= 0x3,
120 	DA732X_SR_16KHZ		= 0x5,
121 	DA732X_SR_22_05KHZ	= 0x6,
122 	DA732X_SR_24KHZ		= 0x7,
123 	DA732X_SR_32KHZ		= 0x9,
124 	DA732X_SR_44_1KHZ	= 0xA,
125 	DA732X_SR_48KHZ		= 0xB,
126 	DA732X_SR_88_1KHZ	= 0xE,
127 	DA732X_SR_96KHZ		= 0xF,
128 };
129 
130 #endif /* __DA732X_H_ */
131