ASoC: wm8991: Use a supply to manage input power
Instead of using a fake register and events to manage input power use a supply to do the job, saving code and preparing for regmap conversion of the driver. Signed-off-by: Mark Brown <broonie@linaro.org> Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
This commit is contained in:
parent
6ce4eac1f6
commit
6a07733686
|
@ -374,30 +374,6 @@ static const struct snd_kcontrol_new wm8991_snd_controls[] = {
|
||||||
/*
|
/*
|
||||||
* _DAPM_ Controls
|
* _DAPM_ Controls
|
||||||
*/
|
*/
|
||||||
static int inmixer_event(struct snd_soc_dapm_widget *w,
|
|
||||||
struct snd_kcontrol *kcontrol, int event)
|
|
||||||
{
|
|
||||||
u16 reg, fakepower;
|
|
||||||
|
|
||||||
reg = snd_soc_read(w->codec, WM8991_POWER_MANAGEMENT_2);
|
|
||||||
fakepower = snd_soc_read(w->codec, WM8991_INTDRIVBITS);
|
|
||||||
|
|
||||||
if (fakepower & ((1 << WM8991_INMIXL_PWR_BIT) |
|
|
||||||
(1 << WM8991_AINLMUX_PWR_BIT)))
|
|
||||||
reg |= WM8991_AINL_ENA;
|
|
||||||
else
|
|
||||||
reg &= ~WM8991_AINL_ENA;
|
|
||||||
|
|
||||||
if (fakepower & ((1 << WM8991_INMIXR_PWR_BIT) |
|
|
||||||
(1 << WM8991_AINRMUX_PWR_BIT)))
|
|
||||||
reg |= WM8991_AINR_ENA;
|
|
||||||
else
|
|
||||||
reg &= ~WM8991_AINR_ENA;
|
|
||||||
|
|
||||||
snd_soc_write(w->codec, WM8991_POWER_MANAGEMENT_2, reg);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int outmixer_event(struct snd_soc_dapm_widget *w,
|
static int outmixer_event(struct snd_soc_dapm_widget *w,
|
||||||
struct snd_kcontrol *kcontrol, int event)
|
struct snd_kcontrol *kcontrol, int event)
|
||||||
{
|
{
|
||||||
|
@ -655,6 +631,11 @@ static const struct snd_soc_dapm_widget wm8991_dapm_widgets[] = {
|
||||||
SND_SOC_DAPM_INPUT("RIN2"),
|
SND_SOC_DAPM_INPUT("RIN2"),
|
||||||
SND_SOC_DAPM_INPUT("Internal ADC Source"),
|
SND_SOC_DAPM_INPUT("Internal ADC Source"),
|
||||||
|
|
||||||
|
SND_SOC_DAPM_SUPPLY("INL", WM8991_POWER_MANAGEMENT_2,
|
||||||
|
WM8991_AINL_ENA_BIT, 0, NULL, 0),
|
||||||
|
SND_SOC_DAPM_SUPPLY("INR", WM8991_POWER_MANAGEMENT_2,
|
||||||
|
WM8991_AINR_ENA_BIT, 0, NULL, 0),
|
||||||
|
|
||||||
/* DACs */
|
/* DACs */
|
||||||
SND_SOC_DAPM_ADC("Left ADC", "Left Capture", WM8991_POWER_MANAGEMENT_2,
|
SND_SOC_DAPM_ADC("Left ADC", "Left Capture", WM8991_POWER_MANAGEMENT_2,
|
||||||
WM8991_ADCL_ENA_BIT, 0),
|
WM8991_ADCL_ENA_BIT, 0),
|
||||||
|
@ -676,26 +657,22 @@ static const struct snd_soc_dapm_widget wm8991_dapm_widgets[] = {
|
||||||
ARRAY_SIZE(wm8991_dapm_rin34_pga_controls)),
|
ARRAY_SIZE(wm8991_dapm_rin34_pga_controls)),
|
||||||
|
|
||||||
/* INMIXL */
|
/* INMIXL */
|
||||||
SND_SOC_DAPM_MIXER_E("INMIXL", WM8991_INTDRIVBITS, WM8991_INMIXL_PWR_BIT, 0,
|
SND_SOC_DAPM_MIXER("INMIXL", SND_SOC_NOPM, 0, 0,
|
||||||
&wm8991_dapm_inmixl_controls[0],
|
&wm8991_dapm_inmixl_controls[0],
|
||||||
ARRAY_SIZE(wm8991_dapm_inmixl_controls),
|
ARRAY_SIZE(wm8991_dapm_inmixl_controls)),
|
||||||
inmixer_event, SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
|
|
||||||
|
|
||||||
/* AINLMUX */
|
/* AINLMUX */
|
||||||
SND_SOC_DAPM_MUX_E("AINLMUX", WM8991_INTDRIVBITS, WM8991_AINLMUX_PWR_BIT, 0,
|
SND_SOC_DAPM_MUX("AINLMUX", SND_SOC_NOPM, 0, 0,
|
||||||
&wm8991_dapm_ainlmux_controls, inmixer_event,
|
&wm8991_dapm_ainlmux_controls),
|
||||||
SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
|
|
||||||
|
|
||||||
/* INMIXR */
|
/* INMIXR */
|
||||||
SND_SOC_DAPM_MIXER_E("INMIXR", WM8991_INTDRIVBITS, WM8991_INMIXR_PWR_BIT, 0,
|
SND_SOC_DAPM_MIXER("INMIXR", SND_SOC_NOPM, 0, 0,
|
||||||
&wm8991_dapm_inmixr_controls[0],
|
&wm8991_dapm_inmixr_controls[0],
|
||||||
ARRAY_SIZE(wm8991_dapm_inmixr_controls),
|
ARRAY_SIZE(wm8991_dapm_inmixr_controls)),
|
||||||
inmixer_event, SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
|
|
||||||
|
|
||||||
/* AINRMUX */
|
/* AINRMUX */
|
||||||
SND_SOC_DAPM_MUX_E("AINRMUX", WM8991_INTDRIVBITS, WM8991_AINRMUX_PWR_BIT, 0,
|
SND_SOC_DAPM_MUX("AINRMUX", SND_SOC_NOPM, 0, 0,
|
||||||
&wm8991_dapm_ainrmux_controls, inmixer_event,
|
&wm8991_dapm_ainrmux_controls),
|
||||||
SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
|
|
||||||
|
|
||||||
/* Output Side */
|
/* Output Side */
|
||||||
/* DACs */
|
/* DACs */
|
||||||
|
@ -797,6 +774,10 @@ static const struct snd_soc_dapm_route audio_map[] = {
|
||||||
{"Right ADC", NULL, "Internal ADC Source"},
|
{"Right ADC", NULL, "Internal ADC Source"},
|
||||||
|
|
||||||
/* Input Side */
|
/* Input Side */
|
||||||
|
{"INMIXL", NULL, "INL"},
|
||||||
|
{"AINLMUX", NULL, "INL"},
|
||||||
|
{"INMIXR", NULL, "INR"},
|
||||||
|
{"AINRMUX", NULL, "INR"},
|
||||||
/* LIN12 PGA */
|
/* LIN12 PGA */
|
||||||
{"LIN12 PGA", "LIN1 Switch", "LIN1"},
|
{"LIN12 PGA", "LIN1 Switch", "LIN1"},
|
||||||
{"LIN12 PGA", "LIN2 Switch", "LIN2"},
|
{"LIN12 PGA", "LIN2 Switch", "LIN2"},
|
||||||
|
|
|
@ -76,7 +76,6 @@
|
||||||
#define WM8991_PLL1 0x3C
|
#define WM8991_PLL1 0x3C
|
||||||
#define WM8991_PLL2 0x3D
|
#define WM8991_PLL2 0x3D
|
||||||
#define WM8991_PLL3 0x3E
|
#define WM8991_PLL3 0x3E
|
||||||
#define WM8991_INTDRIVBITS 0x3F
|
|
||||||
|
|
||||||
#define WM8991_REGISTER_COUNT 60
|
#define WM8991_REGISTER_COUNT 60
|
||||||
#define WM8991_MAX_REGISTER 0x3F
|
#define WM8991_MAX_REGISTER 0x3F
|
||||||
|
@ -807,14 +806,6 @@
|
||||||
*/
|
*/
|
||||||
#define WM8991_PLLK2_MASK 0x00FF /* PLLK2 - [7:0] */
|
#define WM8991_PLLK2_MASK 0x00FF /* PLLK2 - [7:0] */
|
||||||
|
|
||||||
/*
|
|
||||||
* R63 (0x3F) - Internal Driver Bits
|
|
||||||
*/
|
|
||||||
#define WM8991_INMIXL_PWR_BIT 0
|
|
||||||
#define WM8991_AINLMUX_PWR_BIT 1
|
|
||||||
#define WM8991_INMIXR_PWR_BIT 2
|
|
||||||
#define WM8991_AINRMUX_PWR_BIT 3
|
|
||||||
|
|
||||||
#define WM8991_MCLK_DIV 0
|
#define WM8991_MCLK_DIV 0
|
||||||
#define WM8991_DACCLK_DIV 1
|
#define WM8991_DACCLK_DIV 1
|
||||||
#define WM8991_ADCCLK_DIV 2
|
#define WM8991_ADCCLK_DIV 2
|
||||||
|
|
Loading…
Reference in New Issue