14 #include <linux/module.h>
16 #include <linux/i2c.h>
18 #include <linux/slab.h>
242 static const char *ak4671_lin_mux_texts[] =
243 {
"LIN1",
"LIN2",
"LIN3",
"LIN4"};
244 static const struct soc_enum ak4671_lin_mux_enum =
247 ak4671_lin_mux_texts);
251 static const char *ak4671_rin_mux_texts[] =
252 {
"RIN1",
"RIN2",
"RIN3",
"RIN4"};
253 static const struct soc_enum ak4671_rin_mux_enum =
256 ak4671_rin_mux_texts);
316 &ak4671_lout1_mixer_controls[0],
319 &ak4671_rout1_mixer_controls[0],
322 0, 0, &ak4671_lout2_mixer_controls[0],
327 1, 0, &ak4671_rout2_mixer_controls[0],
332 &ak4671_lout3_mixer_controls[0],
335 &ak4671_rout3_mixer_controls[0],
340 &ak4671_lin_mux_control),
342 &ak4671_rin_mux_control),
352 {
"DAC Left",
"NULL",
"PMPLL"},
353 {
"DAC Right",
"NULL",
"PMPLL"},
354 {
"ADC Left",
"NULL",
"PMPLL"},
355 {
"ADC Right",
"NULL",
"PMPLL"},
358 {
"LOUT1",
"NULL",
"LOUT1 Mixer"},
359 {
"ROUT1",
"NULL",
"ROUT1 Mixer"},
360 {
"LOUT2",
"NULL",
"LOUT2 Mix Amp"},
361 {
"ROUT2",
"NULL",
"ROUT2 Mix Amp"},
362 {
"LOUT3",
"NULL",
"LOUT3 Mixer"},
363 {
"ROUT3",
"NULL",
"ROUT3 Mixer"},
365 {
"LOUT1 Mixer",
"DACL",
"DAC Left"},
366 {
"ROUT1 Mixer",
"DACR",
"DAC Right"},
367 {
"LOUT2 Mixer",
"DACHL",
"DAC Left"},
368 {
"ROUT2 Mixer",
"DACHR",
"DAC Right"},
369 {
"LOUT2 Mix Amp",
"NULL",
"LOUT2 Mixer"},
370 {
"ROUT2 Mix Amp",
"NULL",
"ROUT2 Mixer"},
371 {
"LOUT3 Mixer",
"DACSL",
"DAC Left"},
372 {
"ROUT3 Mixer",
"DACSR",
"DAC Right"},
375 {
"LIN MUX",
"LIN1",
"LIN1"},
376 {
"LIN MUX",
"LIN2",
"LIN2"},
377 {
"LIN MUX",
"LIN3",
"LIN3"},
378 {
"LIN MUX",
"LIN4",
"LIN4"},
380 {
"RIN MUX",
"RIN1",
"RIN1"},
381 {
"RIN MUX",
"RIN2",
"RIN2"},
382 {
"RIN MUX",
"RIN3",
"RIN3"},
383 {
"RIN MUX",
"RIN4",
"RIN4"},
385 {
"LIN1",
NULL,
"Mic Bias"},
386 {
"RIN1",
NULL,
"Mic Bias"},
387 {
"LIN2",
NULL,
"Mic Bias"},
388 {
"RIN2",
NULL,
"Mic Bias"},
390 {
"ADC Left",
"NULL",
"LIN MUX"},
391 {
"ADC Right",
"NULL",
"RIN MUX"},
394 {
"LIN1 Mixing Circuit",
"NULL",
"LIN1"},
395 {
"RIN1 Mixing Circuit",
"NULL",
"RIN1"},
396 {
"LIN2 Mixing Circuit",
"NULL",
"LIN2"},
397 {
"RIN2 Mixing Circuit",
"NULL",
"RIN2"},
398 {
"LIN3 Mixing Circuit",
"NULL",
"LIN3"},
399 {
"RIN3 Mixing Circuit",
"NULL",
"RIN3"},
400 {
"LIN4 Mixing Circuit",
"NULL",
"LIN4"},
401 {
"RIN4 Mixing Circuit",
"NULL",
"RIN4"},
403 {
"LOUT1 Mixer",
"LINL1",
"LIN1 Mixing Circuit"},
404 {
"ROUT1 Mixer",
"RINR1",
"RIN1 Mixing Circuit"},
405 {
"LOUT2 Mixer",
"LINH1",
"LIN1 Mixing Circuit"},
406 {
"ROUT2 Mixer",
"RINH1",
"RIN1 Mixing Circuit"},
407 {
"LOUT3 Mixer",
"LINS1",
"LIN1 Mixing Circuit"},
408 {
"ROUT3 Mixer",
"RINS1",
"RIN1 Mixing Circuit"},
410 {
"LOUT1 Mixer",
"LINL2",
"LIN2 Mixing Circuit"},
411 {
"ROUT1 Mixer",
"RINR2",
"RIN2 Mixing Circuit"},
412 {
"LOUT2 Mixer",
"LINH2",
"LIN2 Mixing Circuit"},
413 {
"ROUT2 Mixer",
"RINH2",
"RIN2 Mixing Circuit"},
414 {
"LOUT3 Mixer",
"LINS2",
"LIN2 Mixing Circuit"},
415 {
"ROUT3 Mixer",
"RINS2",
"RIN2 Mixing Circuit"},
417 {
"LOUT1 Mixer",
"LINL3",
"LIN3 Mixing Circuit"},
418 {
"ROUT1 Mixer",
"RINR3",
"RIN3 Mixing Circuit"},
419 {
"LOUT2 Mixer",
"LINH3",
"LIN3 Mixing Circuit"},
420 {
"ROUT2 Mixer",
"RINH3",
"RIN3 Mixing Circuit"},
421 {
"LOUT3 Mixer",
"LINS3",
"LIN3 Mixing Circuit"},
422 {
"ROUT3 Mixer",
"RINS3",
"RIN3 Mixing Circuit"},
424 {
"LOUT1 Mixer",
"LINL4",
"LIN4 Mixing Circuit"},
425 {
"ROUT1 Mixer",
"RINR4",
"RIN4 Mixing Circuit"},
426 {
"LOUT2 Mixer",
"LINH4",
"LIN4 Mixing Circuit"},
427 {
"ROUT2 Mixer",
"RINH4",
"RIN4 Mixing Circuit"},
428 {
"LOUT3 Mixer",
"LINS4",
"LIN4 Mixing Circuit"},
429 {
"ROUT3 Mixer",
"RINS4",
"RIN4 Mixing Circuit"},
479 static int ak4671_set_dai_sysclk(
struct snd_soc_dai *dai,
int clk_id,
480 unsigned int freq,
int dir)
525 static int ak4671_set_dai_fmt(
struct snd_soc_dai *dai,
unsigned int fmt)
572 static int ak4671_set_bias_level(
struct snd_soc_codec *codec,
590 #define AK4671_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 |\
591 SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 |\
592 SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 |\
593 SNDRV_PCM_RATE_48000)
595 #define AK4671_FORMATS SNDRV_PCM_FMTBIT_S16_LE
598 .hw_params = ak4671_hw_params,
599 .set_sysclk = ak4671_set_dai_sysclk,
600 .set_fmt = ak4671_set_dai_fmt,
604 .name =
"ak4671-hifi",
606 .stream_name =
"Playback",
612 .stream_name =
"Capture",
617 .ops = &ak4671_dai_ops,
622 struct ak4671_priv *ak4671 = snd_soc_codec_get_drvdata(codec);
627 dev_err(codec->
dev,
"Failed to set cache I/O: %d\n", ret);
646 .probe = ak4671_probe,
647 .remove = ak4671_remove,
648 .set_bias_level = ak4671_set_bias_level,
650 .reg_word_size =
sizeof(
u8),
654 .dapm_routes = ak4671_intercon,
655 .num_dapm_routes =
ARRAY_SIZE(ak4671_intercon),
669 i2c_set_clientdata(client, ak4671);
673 &soc_codec_dev_ak4671, &ak4671_dai, 1);
689 static struct i2c_driver ak4671_i2c_driver = {
691 .name =
"ak4671-codec",
694 .probe = ak4671_i2c_probe,
696 .id_table = ak4671_i2c_id,