25 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
28 #include <linux/device.h>
29 #include <linux/slab.h>
31 #include <linux/module.h>
36 #include "../codecs/sn95031.h"
41 #define MFLD_JACK_INSERT 0x04
54 static unsigned int hs_switch;
55 static unsigned int lo_dac;
83 static const char *headset_switch_text[] = {
"Earpiece",
"Headset"};
85 static const char *lo_text[] = {
"Vibra",
"Headset",
"IHF",
"None"};
87 static const struct soc_enum headset_enum =
90 static const struct soc_enum lo_enum =
93 static int headset_get_switch(
struct snd_kcontrol *kcontrol,
96 ucontrol->
value.integer.value[0] = hs_switch;
100 static int headset_set_switch(
struct snd_kcontrol *kcontrol,
105 if (ucontrol->
value.integer.value[0] == hs_switch)
108 if (ucontrol->
value.integer.value[0]) {
118 hs_switch = ucontrol->
value.integer.value[0];
143 ucontrol->
value.integer.value[0] = lo_dac;
152 if (ucontrol->
value.integer.value[0] == lo_dac)
158 lo_enable_out_pins(codec);
159 switch (ucontrol->
value.integer.value[0]) {
189 lo_dac = ucontrol->
value.integer.value[0];
195 headset_get_switch, headset_set_switch),
197 lo_get_switch, lo_set_switch),
206 {
"Headphones",
NULL,
"HPOUTR"},
207 {
"Headphones",
NULL,
"HPOUTL"},
208 {
"Mic",
NULL,
"AMIC1"},
211 static void mfld_jack_check(
unsigned int intr_status)
216 jack_data.intr_id = intr_status;
241 pr_err(
"soc_add_controls failed %d", ret_val);
260 pr_err(
"jack creation failed\n");
267 pr_err(
"adding jack pins failed\n");
273 pr_err(
"adding jack zones failed\n");
286 .name =
"Medfield Headset",
287 .stream_name =
"Headset",
288 .cpu_dai_name =
"Headset-cpu-dai",
289 .codec_dai_name =
"SN95031 Headset",
290 .codec_name =
"sn95031",
291 .platform_name =
"sst-platform",
295 .name =
"Medfield Speaker",
296 .stream_name =
"Speaker",
297 .cpu_dai_name =
"Speaker-cpu-dai",
298 .codec_dai_name =
"SN95031 Speaker",
299 .codec_name =
"sn95031",
300 .platform_name =
"sst-platform",
304 .name =
"Medfield Vibra",
305 .stream_name =
"Vibra1",
306 .cpu_dai_name =
"Vibra1-cpu-dai",
307 .codec_dai_name =
"SN95031 Vibra1",
308 .codec_name =
"sn95031",
309 .platform_name =
"sst-platform",
313 .name =
"Medfield Haptics",
314 .stream_name =
"Vibra2",
315 .cpu_dai_name =
"Vibra2-cpu-dai",
316 .codec_dai_name =
"SN95031 Vibra2",
317 .codec_name =
"sn95031",
318 .platform_name =
"sst-platform",
322 .name =
"Medfield Compress",
323 .stream_name =
"Speaker",
324 .cpu_dai_name =
"Compress-cpu-dai",
325 .codec_dai_name =
"SN95031 Speaker",
326 .codec_name =
"sn95031",
327 .platform_name =
"sst-platform",
334 .name =
"medfield_audio",
336 .dai_link = mfld_msic_dailink,
363 int ret_val = 0, irq;
367 pr_debug(
"snd_mfld_mc_probe called\n");
374 mc_drv_ctx = kzalloc(
sizeof(*mc_drv_ctx),
GFP_ATOMIC);
376 pr_err(
"allocation failed\n");
383 pr_err(
"no mem resource given\n");
388 resource_size(irq_mem));
390 pr_err(
"Mapping of cache failed\n");
396 snd_mfld_jack_detection,
399 pr_err(
"cannot register IRQ\n");
403 snd_soc_card_mfld.
dev = &pdev->
dev;
406 pr_debug(
"snd_soc_register_card failed %d\n", ret_val);
409 platform_set_drvdata(pdev, mc_drv_ctx);
410 pr_debug(
"successfully exited probe\n");
424 pr_debug(
"snd_mfld_mc_remove called\n");
428 platform_set_drvdata(pdev,
NULL);
435 .name =
"msic_audio",
437 .probe = snd_mfld_mc_probe,