wm8990.c (f6b415b6065041c0970426cc8ac81a980b2998f2) wm8990.c (d2fd5fe7ee3bc231e21aeb9ee120e0e61a79f8be)
1/*
2 * wm8990.c -- WM8990 ALSA Soc Audio driver
3 *
4 * Copyright 2008 Wolfson Microelectronics PLC.
5 * Author: Liam Girdwood <lrg@slimlogic.co.uk>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the

--- 362 unchanged lines hidden (view full) ---

371 WM8990_RI34MUTE_BIT, 1, 0),
372
373};
374
375/*
376 * _DAPM_ Controls
377 */
378
1/*
2 * wm8990.c -- WM8990 ALSA Soc Audio driver
3 *
4 * Copyright 2008 Wolfson Microelectronics PLC.
5 * Author: Liam Girdwood <lrg@slimlogic.co.uk>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the

--- 362 unchanged lines hidden (view full) ---

371 WM8990_RI34MUTE_BIT, 1, 0),
372
373};
374
375/*
376 * _DAPM_ Controls
377 */
378
379static int inmixer_event(struct snd_soc_dapm_widget *w,
380 struct snd_kcontrol *kcontrol, int event)
381{
382 u16 reg, fakepower;
383
384 reg = snd_soc_read(w->codec, WM8990_POWER_MANAGEMENT_2);
385 fakepower = snd_soc_read(w->codec, WM8990_INTDRIVBITS);
386
387 if (fakepower & ((1 << WM8990_INMIXL_PWR_BIT) |
388 (1 << WM8990_AINLMUX_PWR_BIT))) {
389 reg |= WM8990_AINL_ENA;
390 } else {
391 reg &= ~WM8990_AINL_ENA;
392 }
393
394 if (fakepower & ((1 << WM8990_INMIXR_PWR_BIT) |
395 (1 << WM8990_AINRMUX_PWR_BIT))) {
396 reg |= WM8990_AINR_ENA;
397 } else {
398 reg &= ~WM8990_AINR_ENA;
399 }
400 snd_soc_write(w->codec, WM8990_POWER_MANAGEMENT_2, reg);
401
402 return 0;
403}
404
405static int outmixer_event(struct snd_soc_dapm_widget *w,
406 struct snd_kcontrol *kcontrol, int event)
407{
408 u32 reg_shift = kcontrol->private_value & 0xfff;
409 int ret = 0;
410 u16 reg;
411
412 switch (reg_shift) {

--- 238 unchanged lines hidden (view full) ---

651SND_SOC_DAPM_INPUT("LIN3"),
652SND_SOC_DAPM_INPUT("LIN4/RXN"),
653SND_SOC_DAPM_INPUT("RIN3"),
654SND_SOC_DAPM_INPUT("RIN4/RXP"),
655SND_SOC_DAPM_INPUT("RIN1"),
656SND_SOC_DAPM_INPUT("RIN2"),
657SND_SOC_DAPM_INPUT("Internal ADC Source"),
658
379static int outmixer_event(struct snd_soc_dapm_widget *w,
380 struct snd_kcontrol *kcontrol, int event)
381{
382 u32 reg_shift = kcontrol->private_value & 0xfff;
383 int ret = 0;
384 u16 reg;
385
386 switch (reg_shift) {

--- 238 unchanged lines hidden (view full) ---

625SND_SOC_DAPM_INPUT("LIN3"),
626SND_SOC_DAPM_INPUT("LIN4/RXN"),
627SND_SOC_DAPM_INPUT("RIN3"),
628SND_SOC_DAPM_INPUT("RIN4/RXP"),
629SND_SOC_DAPM_INPUT("RIN1"),
630SND_SOC_DAPM_INPUT("RIN2"),
631SND_SOC_DAPM_INPUT("Internal ADC Source"),
632
633SND_SOC_DAPM_SUPPLY("INL", WM8990_POWER_MANAGEMENT_2, WM8990_AINL_ENA_BIT, 0,
634 NULL, 0),
635SND_SOC_DAPM_SUPPLY("INR", WM8990_POWER_MANAGEMENT_2, WM8990_AINR_ENA_BIT, 0,
636 NULL, 0),
637
659/* DACs */
660SND_SOC_DAPM_ADC("Left ADC", "Left Capture", WM8990_POWER_MANAGEMENT_2,
661 WM8990_ADCL_ENA_BIT, 0),
662SND_SOC_DAPM_ADC("Right ADC", "Right Capture", WM8990_POWER_MANAGEMENT_2,
663 WM8990_ADCR_ENA_BIT, 0),
664
665/* Input PGAs */
666SND_SOC_DAPM_MIXER("LIN12 PGA", WM8990_POWER_MANAGEMENT_2, WM8990_LIN12_ENA_BIT,

--- 5 unchanged lines hidden (view full) ---

672SND_SOC_DAPM_MIXER("RIN12 PGA", WM8990_POWER_MANAGEMENT_2, WM8990_RIN12_ENA_BIT,
673 0, &wm8990_dapm_rin12_pga_controls[0],
674 ARRAY_SIZE(wm8990_dapm_rin12_pga_controls)),
675SND_SOC_DAPM_MIXER("RIN34 PGA", WM8990_POWER_MANAGEMENT_2, WM8990_RIN34_ENA_BIT,
676 0, &wm8990_dapm_rin34_pga_controls[0],
677 ARRAY_SIZE(wm8990_dapm_rin34_pga_controls)),
678
679/* INMIXL */
638/* DACs */
639SND_SOC_DAPM_ADC("Left ADC", "Left Capture", WM8990_POWER_MANAGEMENT_2,
640 WM8990_ADCL_ENA_BIT, 0),
641SND_SOC_DAPM_ADC("Right ADC", "Right Capture", WM8990_POWER_MANAGEMENT_2,
642 WM8990_ADCR_ENA_BIT, 0),
643
644/* Input PGAs */
645SND_SOC_DAPM_MIXER("LIN12 PGA", WM8990_POWER_MANAGEMENT_2, WM8990_LIN12_ENA_BIT,

--- 5 unchanged lines hidden (view full) ---

651SND_SOC_DAPM_MIXER("RIN12 PGA", WM8990_POWER_MANAGEMENT_2, WM8990_RIN12_ENA_BIT,
652 0, &wm8990_dapm_rin12_pga_controls[0],
653 ARRAY_SIZE(wm8990_dapm_rin12_pga_controls)),
654SND_SOC_DAPM_MIXER("RIN34 PGA", WM8990_POWER_MANAGEMENT_2, WM8990_RIN34_ENA_BIT,
655 0, &wm8990_dapm_rin34_pga_controls[0],
656 ARRAY_SIZE(wm8990_dapm_rin34_pga_controls)),
657
658/* INMIXL */
680SND_SOC_DAPM_MIXER_E("INMIXL", WM8990_INTDRIVBITS, WM8990_INMIXL_PWR_BIT, 0,
659SND_SOC_DAPM_MIXER("INMIXL", SND_SOC_NOPM, 0, 0,
681 &wm8990_dapm_inmixl_controls[0],
660 &wm8990_dapm_inmixl_controls[0],
682 ARRAY_SIZE(wm8990_dapm_inmixl_controls),
683 inmixer_event, SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
661 ARRAY_SIZE(wm8990_dapm_inmixl_controls)),
684
685/* AINLMUX */
662
663/* AINLMUX */
686SND_SOC_DAPM_MUX_E("AINLMUX", WM8990_INTDRIVBITS, WM8990_AINLMUX_PWR_BIT, 0,
687 &wm8990_dapm_ainlmux_controls, inmixer_event,
688 SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
664SND_SOC_DAPM_MUX("AINLMUX", SND_SOC_NOPM, 0, 0, &wm8990_dapm_ainlmux_controls),
689
690/* INMIXR */
665
666/* INMIXR */
691SND_SOC_DAPM_MIXER_E("INMIXR", WM8990_INTDRIVBITS, WM8990_INMIXR_PWR_BIT, 0,
667SND_SOC_DAPM_MIXER("INMIXR", SND_SOC_NOPM, 0, 0,
692 &wm8990_dapm_inmixr_controls[0],
668 &wm8990_dapm_inmixr_controls[0],
693 ARRAY_SIZE(wm8990_dapm_inmixr_controls),
694 inmixer_event, SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
669 ARRAY_SIZE(wm8990_dapm_inmixr_controls)),
695
696/* AINRMUX */
670
671/* AINRMUX */
697SND_SOC_DAPM_MUX_E("AINRMUX", WM8990_INTDRIVBITS, WM8990_AINRMUX_PWR_BIT, 0,
698 &wm8990_dapm_ainrmux_controls, inmixer_event,
699 SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
672SND_SOC_DAPM_MUX("AINRMUX", SND_SOC_NOPM, 0, 0, &wm8990_dapm_ainrmux_controls),
700
701/* Output Side */
702/* DACs */
703SND_SOC_DAPM_DAC("Left DAC", "Left Playback", WM8990_POWER_MANAGEMENT_3,
704 WM8990_DACL_ENA_BIT, 0),
705SND_SOC_DAPM_DAC("Right DAC", "Right Playback", WM8990_POWER_MANAGEMENT_3,
706 WM8990_DACR_ENA_BIT, 0),
707

--- 83 unchanged lines hidden (view full) ---

791 /* Make DACs turn on when playing even if not mixed into any outputs */
792 {"Internal DAC Sink", NULL, "Left DAC"},
793 {"Internal DAC Sink", NULL, "Right DAC"},
794
795 /* Make ADCs turn on when recording even if not mixed from any inputs */
796 {"Left ADC", NULL, "Internal ADC Source"},
797 {"Right ADC", NULL, "Internal ADC Source"},
798
673
674/* Output Side */
675/* DACs */
676SND_SOC_DAPM_DAC("Left DAC", "Left Playback", WM8990_POWER_MANAGEMENT_3,
677 WM8990_DACL_ENA_BIT, 0),
678SND_SOC_DAPM_DAC("Right DAC", "Right Playback", WM8990_POWER_MANAGEMENT_3,
679 WM8990_DACR_ENA_BIT, 0),
680

--- 83 unchanged lines hidden (view full) ---

764 /* Make DACs turn on when playing even if not mixed into any outputs */
765 {"Internal DAC Sink", NULL, "Left DAC"},
766 {"Internal DAC Sink", NULL, "Right DAC"},
767
768 /* Make ADCs turn on when recording even if not mixed from any inputs */
769 {"Left ADC", NULL, "Internal ADC Source"},
770 {"Right ADC", NULL, "Internal ADC Source"},
771
772 {"AINLMUX", NULL, "INL"},
773 {"INMIXL", NULL, "INL"},
774 {"AINRMUX", NULL, "INR"},
775 {"INMIXR", NULL, "INR"},
776
799 /* Input Side */
800 /* LIN12 PGA */
801 {"LIN12 PGA", "LIN1 Switch", "LIN1"},
802 {"LIN12 PGA", "LIN2 Switch", "LIN2"},
803 /* LIN34 PGA */
804 {"LIN34 PGA", "LIN3 Switch", "LIN3"},
805 {"LIN34 PGA", "LIN4 Switch", "LIN4/RXN"},
806 /* INMIXL */

--- 611 unchanged lines hidden ---
777 /* Input Side */
778 /* LIN12 PGA */
779 {"LIN12 PGA", "LIN1 Switch", "LIN1"},
780 {"LIN12 PGA", "LIN2 Switch", "LIN2"},
781 /* LIN34 PGA */
782 {"LIN34 PGA", "LIN3 Switch", "LIN3"},
783 {"LIN34 PGA", "LIN4 Switch", "LIN4/RXN"},
784 /* INMIXL */

--- 611 unchanged lines hidden ---