25 #include <linux/i2c.h>
32 #include <mach/hardware.h>
34 #include <linux/module.h>
40 #define N810_HEADSET_AMP_GPIO 10
41 #define N810_SPEAKER_AMP_GPIO 101
50 static struct clk *sys_clkout2;
51 static struct clk *sys_clkout2_src;
52 static struct clk *func96m_clk;
54 static int n810_spk_func;
55 static int n810_jack_func;
56 static int n810_dmic_func;
60 int hp = 0, line1l = 0;
62 switch (n810_jack_func) {
104 n810_ext_control(&codec->
dapm);
128 .startup = n810_startup,
129 .hw_params = n810_hw_params,
130 .shutdown = n810_shutdown,
136 ucontrol->
value.integer.value[0] = n810_spk_func;
146 if (n810_spk_func == ucontrol->
value.integer.value[0])
149 n810_spk_func = ucontrol->
value.integer.value[0];
150 n810_ext_control(&card->
dapm);
158 ucontrol->
value.integer.value[0] = n810_jack_func;
168 if (n810_jack_func == ucontrol->
value.integer.value[0])
171 n810_jack_func = ucontrol->
value.integer.value[0];
172 n810_ext_control(&card->
dapm);
177 static int n810_get_input(
struct snd_kcontrol *kcontrol,
180 ucontrol->
value.integer.value[0] = n810_dmic_func;
185 static int n810_set_input(
struct snd_kcontrol *kcontrol,
190 if (n810_dmic_func == ucontrol->
value.integer.value[0])
193 n810_dmic_func = ucontrol->
value.integer.value[0];
194 n810_ext_control(&card->
dapm);
228 {
"Headphone Jack",
NULL,
"HPLOUT"},
229 {
"Headphone Jack",
NULL,
"HPROUT"},
231 {
"Ext Spk",
NULL,
"LLOUT"},
232 {
"Ext Spk",
NULL,
"RLOUT"},
234 {
"DMic Rate 64",
NULL,
"Mic Bias 2V"},
235 {
"Mic Bias 2V",
NULL,
"DMic"},
238 static const char *spk_function[] = {
"Off",
"On"};
239 static const char *jack_function[] = {
"Off",
"Headphone",
"Headset",
"Mic"};
240 static const char *input_function[] = {
"ADC",
"Digital Mic"};
241 static const struct soc_enum n810_enum[] = {
249 n810_get_spk, n810_set_spk),
251 n810_get_jack, n810_set_jack),
253 n810_get_input, n810_set_input),
276 .name =
"TLV320AIC33",
277 .stream_name =
"AIC33",
278 .cpu_dai_name =
"omap-mcbsp.2",
279 .platform_name =
"omap-pcm-audio",
280 .codec_name =
"tlv320aic3x-codec.2-0018",
281 .codec_dai_name =
"tlv320aic3x-hifi",
284 .init = n810_aic33_init,
292 .dai_link = &n810_dai,
295 .controls = aic33_n810_controls,
296 .num_controls =
ARRAY_SIZE(aic33_n810_controls),
297 .dapm_widgets = aic33_dapm_widgets,
298 .num_dapm_widgets =
ARRAY_SIZE(aic33_dapm_widgets),
299 .dapm_routes = audio_map,
305 static int __init n810_soc_init(
void)
310 if (!(machine_is_nokia_n810() || machine_is_nokia_n810_wimax()))
314 if (!n810_snd_device)
317 platform_set_drvdata(n810_snd_device, &snd_soc_n810);
322 dev = &n810_snd_device->
dev;
324 sys_clkout2_src =
clk_get(dev,
"sys_clkout2_src");
325 if (IS_ERR(sys_clkout2_src)) {
326 dev_err(dev,
"Could not get sys_clkout2_src clock\n");
327 err = PTR_ERR(sys_clkout2_src);
330 sys_clkout2 =
clk_get(dev,
"sys_clkout2");
331 if (IS_ERR(sys_clkout2)) {
332 dev_err(dev,
"Could not get sys_clkout2\n");
333 err = PTR_ERR(sys_clkout2);
340 func96m_clk =
clk_get(dev,
"func_96m_ck");
341 if (IS_ERR(func96m_clk)) {
342 dev_err(dev,
"Could not get func 96M clock\n");
343 err = PTR_ERR(func96m_clk);
368 static void __exit n810_soc_exit(
void)