iwl3945: do not print RFKILL message
[linux/fpc-iii.git] / sound / soc / codecs / arizona.h
blob9e81b6392692cbd78e7e9ad7b263fcd00c214a1d
1 /*
2 * arizona.h - Wolfson Arizona class device shared support
4 * Copyright 2012 Wolfson Microelectronics plc
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
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.
13 #ifndef _ASOC_ARIZONA_H
14 #define _ASOC_ARIZONA_H
16 #include <linux/completion.h>
18 #include <sound/soc.h>
20 #include "wm_adsp.h"
22 #define ARIZONA_CLK_SYSCLK 1
23 #define ARIZONA_CLK_ASYNCCLK 2
24 #define ARIZONA_CLK_OPCLK 3
25 #define ARIZONA_CLK_ASYNC_OPCLK 4
27 #define ARIZONA_CLK_SRC_MCLK1 0x0
28 #define ARIZONA_CLK_SRC_MCLK2 0x1
29 #define ARIZONA_CLK_SRC_FLL1 0x4
30 #define ARIZONA_CLK_SRC_FLL2 0x5
31 #define ARIZONA_CLK_SRC_AIF1BCLK 0x8
32 #define ARIZONA_CLK_SRC_AIF2BCLK 0x9
33 #define ARIZONA_CLK_SRC_AIF3BCLK 0xa
35 #define ARIZONA_FLL_SRC_NONE -1
36 #define ARIZONA_FLL_SRC_MCLK1 0
37 #define ARIZONA_FLL_SRC_MCLK2 1
38 #define ARIZONA_FLL_SRC_SLIMCLK 3
39 #define ARIZONA_FLL_SRC_FLL1 4
40 #define ARIZONA_FLL_SRC_FLL2 5
41 #define ARIZONA_FLL_SRC_AIF1BCLK 8
42 #define ARIZONA_FLL_SRC_AIF2BCLK 9
43 #define ARIZONA_FLL_SRC_AIF3BCLK 10
44 #define ARIZONA_FLL_SRC_AIF1LRCLK 12
45 #define ARIZONA_FLL_SRC_AIF2LRCLK 13
46 #define ARIZONA_FLL_SRC_AIF3LRCLK 14
48 #define ARIZONA_MIXER_VOL_MASK 0x00FE
49 #define ARIZONA_MIXER_VOL_SHIFT 1
50 #define ARIZONA_MIXER_VOL_WIDTH 7
52 #define ARIZONA_CLK_6MHZ 0
53 #define ARIZONA_CLK_12MHZ 1
54 #define ARIZONA_CLK_24MHZ 2
55 #define ARIZONA_CLK_49MHZ 3
56 #define ARIZONA_CLK_73MHZ 4
57 #define ARIZONA_CLK_98MHZ 5
58 #define ARIZONA_CLK_147MHZ 6
60 #define ARIZONA_MAX_DAI 6
61 #define ARIZONA_MAX_ADSP 4
63 struct arizona;
64 struct wm_adsp;
66 struct arizona_dai_priv {
67 int clk;
70 struct arizona_priv {
71 struct wm_adsp adsp[ARIZONA_MAX_ADSP];
72 struct arizona *arizona;
73 int sysclk;
74 int asyncclk;
75 struct arizona_dai_priv dai[ARIZONA_MAX_DAI];
77 int num_inputs;
78 unsigned int in_pending;
80 unsigned int spk_ena:2;
81 unsigned int spk_ena_pending:1;
84 #define ARIZONA_NUM_MIXER_INPUTS 99
86 extern const unsigned int arizona_mixer_tlv[];
87 extern const char *arizona_mixer_texts[ARIZONA_NUM_MIXER_INPUTS];
88 extern int arizona_mixer_values[ARIZONA_NUM_MIXER_INPUTS];
90 #define ARIZONA_MIXER_CONTROLS(name, base) \
91 SOC_SINGLE_RANGE_TLV(name " Input 1 Volume", base + 1, \
92 ARIZONA_MIXER_VOL_SHIFT, 0x20, 0x50, 0, \
93 arizona_mixer_tlv), \
94 SOC_SINGLE_RANGE_TLV(name " Input 2 Volume", base + 3, \
95 ARIZONA_MIXER_VOL_SHIFT, 0x20, 0x50, 0, \
96 arizona_mixer_tlv), \
97 SOC_SINGLE_RANGE_TLV(name " Input 3 Volume", base + 5, \
98 ARIZONA_MIXER_VOL_SHIFT, 0x20, 0x50, 0, \
99 arizona_mixer_tlv), \
100 SOC_SINGLE_RANGE_TLV(name " Input 4 Volume", base + 7, \
101 ARIZONA_MIXER_VOL_SHIFT, 0x20, 0x50, 0, \
102 arizona_mixer_tlv)
104 #define ARIZONA_MUX_ENUM_DECL(name, reg) \
105 SOC_VALUE_ENUM_SINGLE_DECL(name, reg, 0, 0xff, \
106 arizona_mixer_texts, arizona_mixer_values)
108 #define ARIZONA_MUX_CTL_DECL(name) \
109 const struct snd_kcontrol_new name##_mux = \
110 SOC_DAPM_VALUE_ENUM("Route", name##_enum)
112 #define ARIZONA_MUX_ENUMS(name, base_reg) \
113 static ARIZONA_MUX_ENUM_DECL(name##_enum, base_reg); \
114 static ARIZONA_MUX_CTL_DECL(name)
116 #define ARIZONA_MIXER_ENUMS(name, base_reg) \
117 ARIZONA_MUX_ENUMS(name##_in1, base_reg); \
118 ARIZONA_MUX_ENUMS(name##_in2, base_reg + 2); \
119 ARIZONA_MUX_ENUMS(name##_in3, base_reg + 4); \
120 ARIZONA_MUX_ENUMS(name##_in4, base_reg + 6)
122 #define ARIZONA_DSP_AUX_ENUMS(name, base_reg) \
123 ARIZONA_MUX_ENUMS(name##_aux1, base_reg); \
124 ARIZONA_MUX_ENUMS(name##_aux2, base_reg + 8); \
125 ARIZONA_MUX_ENUMS(name##_aux3, base_reg + 16); \
126 ARIZONA_MUX_ENUMS(name##_aux4, base_reg + 24); \
127 ARIZONA_MUX_ENUMS(name##_aux5, base_reg + 32); \
128 ARIZONA_MUX_ENUMS(name##_aux6, base_reg + 40)
130 #define ARIZONA_MUX(name, ctrl) \
131 SND_SOC_DAPM_VALUE_MUX(name, SND_SOC_NOPM, 0, 0, ctrl)
133 #define ARIZONA_MUX_WIDGETS(name, name_str) \
134 ARIZONA_MUX(name_str " Input", &name##_mux)
136 #define ARIZONA_MIXER_WIDGETS(name, name_str) \
137 ARIZONA_MUX(name_str " Input 1", &name##_in1_mux), \
138 ARIZONA_MUX(name_str " Input 2", &name##_in2_mux), \
139 ARIZONA_MUX(name_str " Input 3", &name##_in3_mux), \
140 ARIZONA_MUX(name_str " Input 4", &name##_in4_mux), \
141 SND_SOC_DAPM_MIXER(name_str " Mixer", SND_SOC_NOPM, 0, 0, NULL, 0)
143 #define ARIZONA_DSP_WIDGETS(name, name_str) \
144 ARIZONA_MIXER_WIDGETS(name##L, name_str "L"), \
145 ARIZONA_MIXER_WIDGETS(name##R, name_str "R"), \
146 ARIZONA_MUX(name_str " Aux 1", &name##_aux1_mux), \
147 ARIZONA_MUX(name_str " Aux 2", &name##_aux2_mux), \
148 ARIZONA_MUX(name_str " Aux 3", &name##_aux3_mux), \
149 ARIZONA_MUX(name_str " Aux 4", &name##_aux4_mux), \
150 ARIZONA_MUX(name_str " Aux 5", &name##_aux5_mux), \
151 ARIZONA_MUX(name_str " Aux 6", &name##_aux6_mux)
153 #define ARIZONA_MUX_ROUTES(widget, name) \
154 { widget, NULL, name " Input" }, \
155 ARIZONA_MIXER_INPUT_ROUTES(name " Input")
157 #define ARIZONA_MIXER_ROUTES(widget, name) \
158 { widget, NULL, name " Mixer" }, \
159 { name " Mixer", NULL, name " Input 1" }, \
160 { name " Mixer", NULL, name " Input 2" }, \
161 { name " Mixer", NULL, name " Input 3" }, \
162 { name " Mixer", NULL, name " Input 4" }, \
163 ARIZONA_MIXER_INPUT_ROUTES(name " Input 1"), \
164 ARIZONA_MIXER_INPUT_ROUTES(name " Input 2"), \
165 ARIZONA_MIXER_INPUT_ROUTES(name " Input 3"), \
166 ARIZONA_MIXER_INPUT_ROUTES(name " Input 4")
168 #define ARIZONA_DSP_ROUTES(name) \
169 { name, NULL, name " Aux 1" }, \
170 { name, NULL, name " Aux 2" }, \
171 { name, NULL, name " Aux 3" }, \
172 { name, NULL, name " Aux 4" }, \
173 { name, NULL, name " Aux 5" }, \
174 { name, NULL, name " Aux 6" }, \
175 ARIZONA_MIXER_INPUT_ROUTES(name " Aux 1"), \
176 ARIZONA_MIXER_INPUT_ROUTES(name " Aux 2"), \
177 ARIZONA_MIXER_INPUT_ROUTES(name " Aux 3"), \
178 ARIZONA_MIXER_INPUT_ROUTES(name " Aux 4"), \
179 ARIZONA_MIXER_INPUT_ROUTES(name " Aux 5"), \
180 ARIZONA_MIXER_INPUT_ROUTES(name " Aux 6"), \
181 ARIZONA_MIXER_ROUTES(name, name "L"), \
182 ARIZONA_MIXER_ROUTES(name, name "R")
184 #define ARIZONA_RATE_ENUM_SIZE 4
185 extern const char *arizona_rate_text[ARIZONA_RATE_ENUM_SIZE];
186 extern const int arizona_rate_val[ARIZONA_RATE_ENUM_SIZE];
188 extern const struct soc_enum arizona_isrc_fsl[];
190 extern const struct soc_enum arizona_in_vi_ramp;
191 extern const struct soc_enum arizona_in_vd_ramp;
193 extern const struct soc_enum arizona_out_vi_ramp;
194 extern const struct soc_enum arizona_out_vd_ramp;
196 extern const struct soc_enum arizona_lhpf1_mode;
197 extern const struct soc_enum arizona_lhpf2_mode;
198 extern const struct soc_enum arizona_lhpf3_mode;
199 extern const struct soc_enum arizona_lhpf4_mode;
201 extern const struct soc_enum arizona_ng_hold;
202 extern const struct soc_enum arizona_in_dmic_osr[];
204 extern int arizona_in_ev(struct snd_soc_dapm_widget *w,
205 struct snd_kcontrol *kcontrol,
206 int event);
207 extern int arizona_out_ev(struct snd_soc_dapm_widget *w,
208 struct snd_kcontrol *kcontrol,
209 int event);
210 extern int arizona_hp_ev(struct snd_soc_dapm_widget *w,
211 struct snd_kcontrol *kcontrol,
212 int event);
214 extern int arizona_set_sysclk(struct snd_soc_codec *codec, int clk_id,
215 int source, unsigned int freq, int dir);
217 extern const struct snd_soc_dai_ops arizona_dai_ops;
218 extern const struct snd_soc_dai_ops arizona_simple_dai_ops;
220 #define ARIZONA_FLL_NAME_LEN 20
222 struct arizona_fll {
223 struct arizona *arizona;
224 int id;
225 unsigned int base;
226 unsigned int vco_mult;
227 struct completion ok;
229 unsigned int fout;
230 int sync_src;
231 unsigned int sync_freq;
232 int ref_src;
233 unsigned int ref_freq;
235 char lock_name[ARIZONA_FLL_NAME_LEN];
236 char clock_ok_name[ARIZONA_FLL_NAME_LEN];
239 extern int arizona_init_fll(struct arizona *arizona, int id, int base,
240 int lock_irq, int ok_irq, struct arizona_fll *fll);
241 extern int arizona_set_fll_refclk(struct arizona_fll *fll, int source,
242 unsigned int Fref, unsigned int Fout);
243 extern int arizona_set_fll(struct arizona_fll *fll, int source,
244 unsigned int Fref, unsigned int Fout);
246 extern int arizona_init_spk(struct snd_soc_codec *codec);
247 extern int arizona_init_gpio(struct snd_soc_codec *codec);
249 extern int arizona_init_dai(struct arizona_priv *priv, int dai);
251 int arizona_set_output_mode(struct snd_soc_codec *codec, int output,
252 bool diff);
254 #endif