1 /*
2  * 88pm860x-codec.h -- 88PM860x ALSA SoC Audio Driver
3  *
4  * Copyright 2010 Marvell International Ltd.
5  *	Haojian Zhuang <haojian.zhuang@marvell.com>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License version 2 as
9  * published by the Free Software Foundation.
10  */
11 
12 #ifndef __88PM860X_H
13 #define __88PM860X_H
14 
15 #define PM860X_PCM_IFACE_1		0xb0
16 #define PM860X_PCM_IFACE_2		0xb1
17 #define PM860X_PCM_IFACE_3		0xb2
18 #define PM860X_PCM_RATE			0xb3
19 #define PM860X_EC_PATH			0xb4
20 #define PM860X_SIDETONE_L_GAIN		0xb5
21 #define PM860X_SIDETONE_R_GAIN		0xb6
22 #define PM860X_SIDETONE_SHIFT		0xb7
23 #define PM860X_ADC_OFFSET_1		0xb8
24 #define PM860X_ADC_OFFSET_2		0xb9
25 #define PM860X_DMIC_DELAY		0xba
26 
27 #define PM860X_I2S_IFACE_1		0xbb
28 #define PM860X_I2S_IFACE_2		0xbc
29 #define PM860X_I2S_IFACE_3		0xbd
30 #define PM860X_I2S_IFACE_4		0xbe
31 #define PM860X_EQUALIZER_N0_1		0xbf
32 #define PM860X_EQUALIZER_N0_2		0xc0
33 #define PM860X_EQUALIZER_N1_1		0xc1
34 #define PM860X_EQUALIZER_N1_2		0xc2
35 #define PM860X_EQUALIZER_D1_1		0xc3
36 #define PM860X_EQUALIZER_D1_2		0xc4
37 #define PM860X_LOFI_GAIN_LEFT		0xc5
38 #define PM860X_LOFI_GAIN_RIGHT		0xc6
39 #define PM860X_HIFIL_GAIN_LEFT		0xc7
40 #define PM860X_HIFIL_GAIN_RIGHT		0xc8
41 #define PM860X_HIFIR_GAIN_LEFT		0xc9
42 #define PM860X_HIFIR_GAIN_RIGHT		0xca
43 #define PM860X_DAC_OFFSET		0xcb
44 #define PM860X_OFFSET_LEFT_1		0xcc
45 #define PM860X_OFFSET_LEFT_2		0xcd
46 #define PM860X_OFFSET_RIGHT_1		0xce
47 #define PM860X_OFFSET_RIGHT_2		0xcf
48 #define PM860X_ADC_ANA_1		0xd0
49 #define PM860X_ADC_ANA_2		0xd1
50 #define PM860X_ADC_ANA_3		0xd2
51 #define PM860X_ADC_ANA_4		0xd3
52 #define PM860X_ANA_TO_ANA		0xd4
53 #define PM860X_HS1_CTRL			0xd5
54 #define PM860X_HS2_CTRL			0xd6
55 #define PM860X_LO1_CTRL			0xd7
56 #define PM860X_LO2_CTRL			0xd8
57 #define PM860X_EAR_CTRL_1		0xd9
58 #define PM860X_EAR_CTRL_2		0xda
59 #define PM860X_AUDIO_SUPPLIES_1		0xdb
60 #define PM860X_AUDIO_SUPPLIES_2		0xdc
61 #define PM860X_ADC_EN_1			0xdd
62 #define PM860X_ADC_EN_2			0xde
63 #define PM860X_DAC_EN_1			0xdf
64 #define PM860X_DAC_EN_2			0xe1
65 #define PM860X_AUDIO_CAL_1		0xe2
66 #define PM860X_AUDIO_CAL_2		0xe3
67 #define PM860X_AUDIO_CAL_3		0xe4
68 #define PM860X_AUDIO_CAL_4		0xe5
69 #define PM860X_AUDIO_CAL_5		0xe6
70 #define PM860X_ANA_INPUT_SEL_1		0xe7
71 #define PM860X_ANA_INPUT_SEL_2		0xe8
72 
73 #define PM860X_PCM_IFACE_4		0xe9
74 #define PM860X_I2S_IFACE_5		0xea
75 
76 #define PM860X_SHORTS			0x3b
77 #define PM860X_PLL_ADJ_1		0x3c
78 #define PM860X_PLL_ADJ_2		0x3d
79 
80 /* bits definition */
81 #define PM860X_CLK_DIR_IN		0
82 #define PM860X_CLK_DIR_OUT		1
83 
84 #define PM860X_DET_HEADSET		(1 << 0)
85 #define PM860X_DET_MIC			(1 << 1)
86 #define PM860X_DET_HOOK			(1 << 2)
87 #define PM860X_SHORT_HEADSET		(1 << 3)
88 #define PM860X_SHORT_LINEOUT		(1 << 4)
89 #define PM860X_DET_MASK			0x1F
90 
91 extern int pm860x_hs_jack_detect(struct snd_soc_component *, struct snd_soc_jack *,
92 				 int, int, int, int);
93 extern int pm860x_mic_jack_detect(struct snd_soc_component *, struct snd_soc_jack *,
94 				  int);
95 
96 #endif	/* __88PM860X_H */
97