aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Mack <zonque@gmail.com>2013-06-24 10:25:31 -0400
committerMark Brown <broonie@linaro.org>2013-06-25 05:26:48 -0400
commit18710acdeea02777ef70013465f6f7fced411096 (patch)
treed6ce2c0e2955c8a213dfabf9b3bf43583410fe21
parent8892d479f1ba505c835e31bb66fcf3994f5127aa (diff)
ASoC: tas5086: add DAPM mux controls
The TAS5086 has two muxes, one for connecting I2S inputs to internal channels, and another one for selecting which internal channel should be routed to which PWM output pin. This patch adds DAPM widgets and routes for this driver. Signed-off-by: Daniel Mack <zonque@gmail.com> Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r--sound/soc/codecs/tas5086.c200
1 files changed, 200 insertions, 0 deletions
diff --git a/sound/soc/codecs/tas5086.c b/sound/soc/codecs/tas5086.c
index 8130ab5d9848..bcbbec1399b8 100644
--- a/sound/soc/codecs/tas5086.c
+++ b/sound/soc/codecs/tas5086.c
@@ -471,6 +471,202 @@ static const struct snd_kcontrol_new tas5086_controls[] = {
471 tas5086_get_deemph, tas5086_put_deemph), 471 tas5086_get_deemph, tas5086_put_deemph),
472}; 472};
473 473
474/* Input mux controls */
475static const char *tas5086_dapm_sdin_texts[] =
476{
477 "SDIN1-L", "SDIN1-R", "SDIN2-L", "SDIN2-R",
478 "SDIN3-L", "SDIN3-R", "Ground (0)", "nc"
479};
480
481static const struct soc_enum tas5086_dapm_input_mux_enum[] = {
482 SOC_ENUM_SINGLE(TAS5086_INPUT_MUX, 20, 8, tas5086_dapm_sdin_texts),
483 SOC_ENUM_SINGLE(TAS5086_INPUT_MUX, 16, 8, tas5086_dapm_sdin_texts),
484 SOC_ENUM_SINGLE(TAS5086_INPUT_MUX, 12, 8, tas5086_dapm_sdin_texts),
485 SOC_ENUM_SINGLE(TAS5086_INPUT_MUX, 8, 8, tas5086_dapm_sdin_texts),
486 SOC_ENUM_SINGLE(TAS5086_INPUT_MUX, 4, 8, tas5086_dapm_sdin_texts),
487 SOC_ENUM_SINGLE(TAS5086_INPUT_MUX, 0, 8, tas5086_dapm_sdin_texts),
488};
489
490static const struct snd_kcontrol_new tas5086_dapm_input_mux_controls[] = {
491 SOC_DAPM_ENUM("Channel 1 input", tas5086_dapm_input_mux_enum[0]),
492 SOC_DAPM_ENUM("Channel 2 input", tas5086_dapm_input_mux_enum[1]),
493 SOC_DAPM_ENUM("Channel 3 input", tas5086_dapm_input_mux_enum[2]),
494 SOC_DAPM_ENUM("Channel 4 input", tas5086_dapm_input_mux_enum[3]),
495 SOC_DAPM_ENUM("Channel 5 input", tas5086_dapm_input_mux_enum[4]),
496 SOC_DAPM_ENUM("Channel 6 input", tas5086_dapm_input_mux_enum[5]),
497};
498
499/* Output mux controls */
500static const char *tas5086_dapm_channel_texts[] =
501 { "Channel 1 Mux", "Channel 2 Mux", "Channel 3 Mux",
502 "Channel 4 Mux", "Channel 5 Mux", "Channel 6 Mux" };
503
504static const struct soc_enum tas5086_dapm_output_mux_enum[] = {
505 SOC_ENUM_SINGLE(TAS5086_PWM_OUTPUT_MUX, 20, 6, tas5086_dapm_channel_texts),
506 SOC_ENUM_SINGLE(TAS5086_PWM_OUTPUT_MUX, 16, 6, tas5086_dapm_channel_texts),
507 SOC_ENUM_SINGLE(TAS5086_PWM_OUTPUT_MUX, 12, 6, tas5086_dapm_channel_texts),
508 SOC_ENUM_SINGLE(TAS5086_PWM_OUTPUT_MUX, 8, 6, tas5086_dapm_channel_texts),
509 SOC_ENUM_SINGLE(TAS5086_PWM_OUTPUT_MUX, 4, 6, tas5086_dapm_channel_texts),
510 SOC_ENUM_SINGLE(TAS5086_PWM_OUTPUT_MUX, 0, 6, tas5086_dapm_channel_texts),
511};
512
513static const struct snd_kcontrol_new tas5086_dapm_output_mux_controls[] = {
514 SOC_DAPM_ENUM("PWM1 Output", tas5086_dapm_output_mux_enum[0]),
515 SOC_DAPM_ENUM("PWM2 Output", tas5086_dapm_output_mux_enum[1]),
516 SOC_DAPM_ENUM("PWM3 Output", tas5086_dapm_output_mux_enum[2]),
517 SOC_DAPM_ENUM("PWM4 Output", tas5086_dapm_output_mux_enum[3]),
518 SOC_DAPM_ENUM("PWM5 Output", tas5086_dapm_output_mux_enum[4]),
519 SOC_DAPM_ENUM("PWM6 Output", tas5086_dapm_output_mux_enum[5]),
520};
521
522static const struct snd_soc_dapm_widget tas5086_dapm_widgets[] = {
523 SND_SOC_DAPM_INPUT("SDIN1-L"),
524 SND_SOC_DAPM_INPUT("SDIN1-R"),
525 SND_SOC_DAPM_INPUT("SDIN2-L"),
526 SND_SOC_DAPM_INPUT("SDIN2-R"),
527 SND_SOC_DAPM_INPUT("SDIN3-L"),
528 SND_SOC_DAPM_INPUT("SDIN3-R"),
529 SND_SOC_DAPM_INPUT("SDIN4-L"),
530 SND_SOC_DAPM_INPUT("SDIN4-R"),
531
532 SND_SOC_DAPM_OUTPUT("PWM1"),
533 SND_SOC_DAPM_OUTPUT("PWM2"),
534 SND_SOC_DAPM_OUTPUT("PWM3"),
535 SND_SOC_DAPM_OUTPUT("PWM4"),
536 SND_SOC_DAPM_OUTPUT("PWM5"),
537 SND_SOC_DAPM_OUTPUT("PWM6"),
538
539 SND_SOC_DAPM_MUX("Channel 1 Mux", SND_SOC_NOPM, 0, 0,
540 &tas5086_dapm_input_mux_controls[0]),
541 SND_SOC_DAPM_MUX("Channel 2 Mux", SND_SOC_NOPM, 0, 0,
542 &tas5086_dapm_input_mux_controls[1]),
543 SND_SOC_DAPM_MUX("Channel 3 Mux", SND_SOC_NOPM, 0, 0,
544 &tas5086_dapm_input_mux_controls[2]),
545 SND_SOC_DAPM_MUX("Channel 4 Mux", SND_SOC_NOPM, 0, 0,
546 &tas5086_dapm_input_mux_controls[3]),
547 SND_SOC_DAPM_MUX("Channel 5 Mux", SND_SOC_NOPM, 0, 0,
548 &tas5086_dapm_input_mux_controls[4]),
549 SND_SOC_DAPM_MUX("Channel 6 Mux", SND_SOC_NOPM, 0, 0,
550 &tas5086_dapm_input_mux_controls[5]),
551
552 SND_SOC_DAPM_MUX("PWM1 Mux", SND_SOC_NOPM, 0, 0,
553 &tas5086_dapm_output_mux_controls[0]),
554 SND_SOC_DAPM_MUX("PWM2 Mux", SND_SOC_NOPM, 0, 0,
555 &tas5086_dapm_output_mux_controls[1]),
556 SND_SOC_DAPM_MUX("PWM3 Mux", SND_SOC_NOPM, 0, 0,
557 &tas5086_dapm_output_mux_controls[2]),
558 SND_SOC_DAPM_MUX("PWM4 Mux", SND_SOC_NOPM, 0, 0,
559 &tas5086_dapm_output_mux_controls[3]),
560 SND_SOC_DAPM_MUX("PWM5 Mux", SND_SOC_NOPM, 0, 0,
561 &tas5086_dapm_output_mux_controls[4]),
562 SND_SOC_DAPM_MUX("PWM6 Mux", SND_SOC_NOPM, 0, 0,
563 &tas5086_dapm_output_mux_controls[5]),
564};
565
566static const struct snd_soc_dapm_route tas5086_dapm_routes[] = {
567 /* SDIN inputs -> channel muxes */
568 { "Channel 1 Mux", "SDIN1-L", "SDIN1-L" },
569 { "Channel 1 Mux", "SDIN1-R", "SDIN1-R" },
570 { "Channel 1 Mux", "SDIN2-L", "SDIN2-L" },
571 { "Channel 1 Mux", "SDIN2-R", "SDIN2-R" },
572 { "Channel 1 Mux", "SDIN3-L", "SDIN3-L" },
573 { "Channel 1 Mux", "SDIN3-R", "SDIN3-R" },
574
575 { "Channel 2 Mux", "SDIN1-L", "SDIN1-L" },
576 { "Channel 2 Mux", "SDIN1-R", "SDIN1-R" },
577 { "Channel 2 Mux", "SDIN2-L", "SDIN2-L" },
578 { "Channel 2 Mux", "SDIN2-R", "SDIN2-R" },
579 { "Channel 2 Mux", "SDIN3-L", "SDIN3-L" },
580 { "Channel 2 Mux", "SDIN3-R", "SDIN3-R" },
581
582 { "Channel 2 Mux", "SDIN1-L", "SDIN1-L" },
583 { "Channel 2 Mux", "SDIN1-R", "SDIN1-R" },
584 { "Channel 2 Mux", "SDIN2-L", "SDIN2-L" },
585 { "Channel 2 Mux", "SDIN2-R", "SDIN2-R" },
586 { "Channel 2 Mux", "SDIN3-L", "SDIN3-L" },
587 { "Channel 2 Mux", "SDIN3-R", "SDIN3-R" },
588
589 { "Channel 3 Mux", "SDIN1-L", "SDIN1-L" },
590 { "Channel 3 Mux", "SDIN1-R", "SDIN1-R" },
591 { "Channel 3 Mux", "SDIN2-L", "SDIN2-L" },
592 { "Channel 3 Mux", "SDIN2-R", "SDIN2-R" },
593 { "Channel 3 Mux", "SDIN3-L", "SDIN3-L" },
594 { "Channel 3 Mux", "SDIN3-R", "SDIN3-R" },
595
596 { "Channel 4 Mux", "SDIN1-L", "SDIN1-L" },
597 { "Channel 4 Mux", "SDIN1-R", "SDIN1-R" },
598 { "Channel 4 Mux", "SDIN2-L", "SDIN2-L" },
599 { "Channel 4 Mux", "SDIN2-R", "SDIN2-R" },
600 { "Channel 4 Mux", "SDIN3-L", "SDIN3-L" },
601 { "Channel 4 Mux", "SDIN3-R", "SDIN3-R" },
602
603 { "Channel 5 Mux", "SDIN1-L", "SDIN1-L" },
604 { "Channel 5 Mux", "SDIN1-R", "SDIN1-R" },
605 { "Channel 5 Mux", "SDIN2-L", "SDIN2-L" },
606 { "Channel 5 Mux", "SDIN2-R", "SDIN2-R" },
607 { "Channel 5 Mux", "SDIN3-L", "SDIN3-L" },
608 { "Channel 5 Mux", "SDIN3-R", "SDIN3-R" },
609
610 { "Channel 6 Mux", "SDIN1-L", "SDIN1-L" },
611 { "Channel 6 Mux", "SDIN1-R", "SDIN1-R" },
612 { "Channel 6 Mux", "SDIN2-L", "SDIN2-L" },
613 { "Channel 6 Mux", "SDIN2-R", "SDIN2-R" },
614 { "Channel 6 Mux", "SDIN3-L", "SDIN3-L" },
615 { "Channel 6 Mux", "SDIN3-R", "SDIN3-R" },
616
617 /* Channel muxes -> PWM muxes */
618 { "PWM1 Mux", "Channel 1 Mux", "Channel 1 Mux" },
619 { "PWM2 Mux", "Channel 1 Mux", "Channel 1 Mux" },
620 { "PWM3 Mux", "Channel 1 Mux", "Channel 1 Mux" },
621 { "PWM4 Mux", "Channel 1 Mux", "Channel 1 Mux" },
622 { "PWM5 Mux", "Channel 1 Mux", "Channel 1 Mux" },
623 { "PWM6 Mux", "Channel 1 Mux", "Channel 1 Mux" },
624
625 { "PWM1 Mux", "Channel 2 Mux", "Channel 2 Mux" },
626 { "PWM2 Mux", "Channel 2 Mux", "Channel 2 Mux" },
627 { "PWM3 Mux", "Channel 2 Mux", "Channel 2 Mux" },
628 { "PWM4 Mux", "Channel 2 Mux", "Channel 2 Mux" },
629 { "PWM5 Mux", "Channel 2 Mux", "Channel 2 Mux" },
630 { "PWM6 Mux", "Channel 2 Mux", "Channel 2 Mux" },
631
632 { "PWM1 Mux", "Channel 3 Mux", "Channel 3 Mux" },
633 { "PWM2 Mux", "Channel 3 Mux", "Channel 3 Mux" },
634 { "PWM3 Mux", "Channel 3 Mux", "Channel 3 Mux" },
635 { "PWM4 Mux", "Channel 3 Mux", "Channel 3 Mux" },
636 { "PWM5 Mux", "Channel 3 Mux", "Channel 3 Mux" },
637 { "PWM6 Mux", "Channel 3 Mux", "Channel 3 Mux" },
638
639 { "PWM1 Mux", "Channel 4 Mux", "Channel 4 Mux" },
640 { "PWM2 Mux", "Channel 4 Mux", "Channel 4 Mux" },
641 { "PWM3 Mux", "Channel 4 Mux", "Channel 4 Mux" },
642 { "PWM4 Mux", "Channel 4 Mux", "Channel 4 Mux" },
643 { "PWM5 Mux", "Channel 4 Mux", "Channel 4 Mux" },
644 { "PWM6 Mux", "Channel 4 Mux", "Channel 4 Mux" },
645
646 { "PWM1 Mux", "Channel 5 Mux", "Channel 5 Mux" },
647 { "PWM2 Mux", "Channel 5 Mux", "Channel 5 Mux" },
648 { "PWM3 Mux", "Channel 5 Mux", "Channel 5 Mux" },
649 { "PWM4 Mux", "Channel 5 Mux", "Channel 5 Mux" },
650 { "PWM5 Mux", "Channel 5 Mux", "Channel 5 Mux" },
651 { "PWM6 Mux", "Channel 5 Mux", "Channel 5 Mux" },
652
653 { "PWM1 Mux", "Channel 6 Mux", "Channel 6 Mux" },
654 { "PWM2 Mux", "Channel 6 Mux", "Channel 6 Mux" },
655 { "PWM3 Mux", "Channel 6 Mux", "Channel 6 Mux" },
656 { "PWM4 Mux", "Channel 6 Mux", "Channel 6 Mux" },
657 { "PWM5 Mux", "Channel 6 Mux", "Channel 6 Mux" },
658 { "PWM6 Mux", "Channel 6 Mux", "Channel 6 Mux" },
659
660 /* The PWM muxes are directly connected to the PWM outputs */
661 { "PWM1", NULL, "PWM1 Mux" },
662 { "PWM2", NULL, "PWM2 Mux" },
663 { "PWM3", NULL, "PWM3 Mux" },
664 { "PWM4", NULL, "PWM4 Mux" },
665 { "PWM5", NULL, "PWM5 Mux" },
666 { "PWM6", NULL, "PWM6 Mux" },
667
668};
669
474static const struct snd_soc_dai_ops tas5086_dai_ops = { 670static const struct snd_soc_dai_ops tas5086_dai_ops = {
475 .hw_params = tas5086_hw_params, 671 .hw_params = tas5086_hw_params,
476 .set_sysclk = tas5086_set_dai_sysclk, 672 .set_sysclk = tas5086_set_dai_sysclk,
@@ -585,6 +781,10 @@ static struct snd_soc_codec_driver soc_codec_dev_tas5086 = {
585 .resume = tas5086_soc_resume, 781 .resume = tas5086_soc_resume,
586 .controls = tas5086_controls, 782 .controls = tas5086_controls,
587 .num_controls = ARRAY_SIZE(tas5086_controls), 783 .num_controls = ARRAY_SIZE(tas5086_controls),
784 .dapm_widgets = tas5086_dapm_widgets,
785 .num_dapm_widgets = ARRAY_SIZE(tas5086_dapm_widgets),
786 .dapm_routes = tas5086_dapm_routes,
787 .num_dapm_routes = ARRAY_SIZE(tas5086_dapm_routes),
588}; 788};
589 789
590static const struct i2c_device_id tas5086_i2c_id[] = { 790static const struct i2c_device_id tas5086_i2c_id[] = {