Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: wm8990: Use supplies to manage input power

Instead of using a fake register use a supply widget to manage the power
for the inputs, this is more idiomatic and supports regmap conversion.

Signed-off-by: Mark Brown <broonie@linaro.org>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>

+16 -47
+16 -38
sound/soc/codecs/wm8990.c
··· 376 376 * _DAPM_ Controls 377 377 */ 378 378 379 - static 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 - 405 379 static int outmixer_event(struct snd_soc_dapm_widget *w, 406 380 struct snd_kcontrol *kcontrol, int event) 407 381 { ··· 630 656 SND_SOC_DAPM_INPUT("RIN2"), 631 657 SND_SOC_DAPM_INPUT("Internal ADC Source"), 632 658 659 + SND_SOC_DAPM_SUPPLY("INL", WM8990_POWER_MANAGEMENT_2, WM8990_AINL_ENA_BIT, 0, 660 + NULL, 0), 661 + SND_SOC_DAPM_SUPPLY("INR", WM8990_POWER_MANAGEMENT_2, WM8990_AINR_ENA_BIT, 0, 662 + NULL, 0), 663 + 633 664 /* DACs */ 634 665 SND_SOC_DAPM_ADC("Left ADC", "Left Capture", WM8990_POWER_MANAGEMENT_2, 635 666 WM8990_ADCL_ENA_BIT, 0), ··· 656 677 ARRAY_SIZE(wm8990_dapm_rin34_pga_controls)), 657 678 658 679 /* INMIXL */ 659 - SND_SOC_DAPM_MIXER_E("INMIXL", WM8990_INTDRIVBITS, WM8990_INMIXL_PWR_BIT, 0, 680 + SND_SOC_DAPM_MIXER("INMIXL", SND_SOC_NOPM, 0, 0, 660 681 &wm8990_dapm_inmixl_controls[0], 661 - ARRAY_SIZE(wm8990_dapm_inmixl_controls), 662 - inmixer_event, SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), 682 + ARRAY_SIZE(wm8990_dapm_inmixl_controls)), 663 683 664 684 /* AINLMUX */ 665 - SND_SOC_DAPM_MUX_E("AINLMUX", WM8990_INTDRIVBITS, WM8990_AINLMUX_PWR_BIT, 0, 666 - &wm8990_dapm_ainlmux_controls, inmixer_event, 667 - SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), 685 + SND_SOC_DAPM_MUX("AINLMUX", SND_SOC_NOPM, 0, 0, &wm8990_dapm_ainlmux_controls), 668 686 669 687 /* INMIXR */ 670 - SND_SOC_DAPM_MIXER_E("INMIXR", WM8990_INTDRIVBITS, WM8990_INMIXR_PWR_BIT, 0, 688 + SND_SOC_DAPM_MIXER("INMIXR", SND_SOC_NOPM, 0, 0, 671 689 &wm8990_dapm_inmixr_controls[0], 672 - ARRAY_SIZE(wm8990_dapm_inmixr_controls), 673 - inmixer_event, SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), 690 + ARRAY_SIZE(wm8990_dapm_inmixr_controls)), 674 691 675 692 /* AINRMUX */ 676 - SND_SOC_DAPM_MUX_E("AINRMUX", WM8990_INTDRIVBITS, WM8990_AINRMUX_PWR_BIT, 0, 677 - &wm8990_dapm_ainrmux_controls, inmixer_event, 678 - SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), 693 + SND_SOC_DAPM_MUX("AINRMUX", SND_SOC_NOPM, 0, 0, &wm8990_dapm_ainrmux_controls), 679 694 680 695 /* Output Side */ 681 696 /* DACs */ ··· 768 795 /* Make ADCs turn on when recording even if not mixed from any inputs */ 769 796 {"Left ADC", NULL, "Internal ADC Source"}, 770 797 {"Right ADC", NULL, "Internal ADC Source"}, 798 + 799 + {"AINLMUX", NULL, "INL"}, 800 + {"INMIXL", NULL, "INL"}, 801 + {"AINRMUX", NULL, "INR"}, 802 + {"INMIXR", NULL, "INR"}, 771 803 772 804 /* Input Side */ 773 805 /* LIN12 PGA */
-9
sound/soc/codecs/wm8990.h
··· 78 78 #define WM8990_PLL1 0x3C 79 79 #define WM8990_PLL2 0x3D 80 80 #define WM8990_PLL3 0x3E 81 - #define WM8990_INTDRIVBITS 0x3F 82 81 83 82 #define WM8990_EXT_ACCESS_ENA 0x75 84 83 #define WM8990_EXT_CTL1 0x7a ··· 816 817 * R62 (0x3E) - PLL3 817 818 */ 818 819 #define WM8990_PLLK2_MASK 0x00FF /* PLLK2 - [7:0] */ 819 - 820 - /* 821 - * R63 (0x3F) - Internal Driver Bits 822 - */ 823 - #define WM8990_INMIXL_PWR_BIT 0 824 - #define WM8990_AINLMUX_PWR_BIT 1 825 - #define WM8990_INMIXR_PWR_BIT 2 826 - #define WM8990_AINRMUX_PWR_BIT 3 827 820 828 821 #define WM8990_MCLK_DIV 0 829 822 #define WM8990_DACCLK_DIV 1