xref: /linux/sound/soc/codecs/wm8997.c (revision 3a39d672e7f48b8d6b91a09afa4b55352773b4b5)
1d2912cb1SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only
240843aeaSCharles Keepax /*
340843aeaSCharles Keepax  * wm8997.c  --  WM8997 ALSA SoC Audio driver
440843aeaSCharles Keepax  *
540843aeaSCharles Keepax  * Copyright 2012 Wolfson Microelectronics plc
640843aeaSCharles Keepax  *
740843aeaSCharles Keepax  * Author: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
840843aeaSCharles Keepax  */
940843aeaSCharles Keepax 
1040843aeaSCharles Keepax #include <linux/module.h>
1140843aeaSCharles Keepax #include <linux/moduleparam.h>
1240843aeaSCharles Keepax #include <linux/init.h>
1340843aeaSCharles Keepax #include <linux/delay.h>
1440843aeaSCharles Keepax #include <linux/pm.h>
1540843aeaSCharles Keepax #include <linux/pm_runtime.h>
1640843aeaSCharles Keepax #include <linux/regmap.h>
1740843aeaSCharles Keepax #include <linux/slab.h>
1840843aeaSCharles Keepax #include <sound/core.h>
1940843aeaSCharles Keepax #include <sound/pcm.h>
2040843aeaSCharles Keepax #include <sound/pcm_params.h>
2140843aeaSCharles Keepax #include <sound/soc.h>
2240843aeaSCharles Keepax #include <sound/jack.h>
2340843aeaSCharles Keepax #include <sound/initval.h>
2440843aeaSCharles Keepax #include <sound/tlv.h>
2540843aeaSCharles Keepax 
2640843aeaSCharles Keepax #include <linux/mfd/arizona/core.h>
2740843aeaSCharles Keepax #include <linux/mfd/arizona/registers.h>
2840843aeaSCharles Keepax 
2940843aeaSCharles Keepax #include "arizona.h"
3040843aeaSCharles Keepax #include "wm8997.h"
3140843aeaSCharles Keepax 
3240843aeaSCharles Keepax struct wm8997_priv {
3340843aeaSCharles Keepax 	struct arizona_priv core;
3440843aeaSCharles Keepax 	struct arizona_fll fll[2];
3540843aeaSCharles Keepax };
3640843aeaSCharles Keepax 
3740843aeaSCharles Keepax static DECLARE_TLV_DB_SCALE(ana_tlv, 0, 100, 0);
3840843aeaSCharles Keepax static DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0);
3940843aeaSCharles Keepax static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0);
4015575ed5SRichard Fitzgerald static DECLARE_TLV_DB_SCALE(noise_tlv, -13200, 600, 0);
4140843aeaSCharles Keepax static DECLARE_TLV_DB_SCALE(ng_tlv, -10200, 600, 0);
4240843aeaSCharles Keepax 
4340843aeaSCharles Keepax static const struct reg_default wm8997_sysclk_reva_patch[] = {
4440843aeaSCharles Keepax 	{ 0x301D, 0x7B15 },
4540843aeaSCharles Keepax 	{ 0x301B, 0x0050 },
4640843aeaSCharles Keepax 	{ 0x305D, 0x7B17 },
4740843aeaSCharles Keepax 	{ 0x305B, 0x0050 },
4840843aeaSCharles Keepax 	{ 0x3001, 0x08FE },
4940843aeaSCharles Keepax 	{ 0x3003, 0x00F4 },
5040843aeaSCharles Keepax 	{ 0x3041, 0x08FF },
5140843aeaSCharles Keepax 	{ 0x3043, 0x0005 },
5240843aeaSCharles Keepax 	{ 0x3020, 0x0225 },
5340843aeaSCharles Keepax 	{ 0x3021, 0x0A00 },
5440843aeaSCharles Keepax 	{ 0x3022, 0xE24D },
5540843aeaSCharles Keepax 	{ 0x3023, 0x0800 },
5640843aeaSCharles Keepax 	{ 0x3024, 0xE24D },
5740843aeaSCharles Keepax 	{ 0x3025, 0xF000 },
5840843aeaSCharles Keepax 	{ 0x3060, 0x0226 },
5940843aeaSCharles Keepax 	{ 0x3061, 0x0A00 },
6040843aeaSCharles Keepax 	{ 0x3062, 0xE252 },
6140843aeaSCharles Keepax 	{ 0x3063, 0x0800 },
6240843aeaSCharles Keepax 	{ 0x3064, 0xE252 },
6340843aeaSCharles Keepax 	{ 0x3065, 0xF000 },
6440843aeaSCharles Keepax 	{ 0x3116, 0x022B },
6540843aeaSCharles Keepax 	{ 0x3117, 0xFA00 },
6640843aeaSCharles Keepax 	{ 0x3110, 0x246C },
6740843aeaSCharles Keepax 	{ 0x3111, 0x0A03 },
6840843aeaSCharles Keepax 	{ 0x3112, 0x246E },
6940843aeaSCharles Keepax 	{ 0x3113, 0x0A03 },
7040843aeaSCharles Keepax 	{ 0x3114, 0x2470 },
7140843aeaSCharles Keepax 	{ 0x3115, 0x0A03 },
7240843aeaSCharles Keepax 	{ 0x3126, 0x246C },
7340843aeaSCharles Keepax 	{ 0x3127, 0x0A02 },
7440843aeaSCharles Keepax 	{ 0x3128, 0x246E },
7540843aeaSCharles Keepax 	{ 0x3129, 0x0A02 },
7640843aeaSCharles Keepax 	{ 0x312A, 0x2470 },
7740843aeaSCharles Keepax 	{ 0x312B, 0xFA02 },
7840843aeaSCharles Keepax 	{ 0x3125, 0x0800 },
7940843aeaSCharles Keepax };
8040843aeaSCharles Keepax 
wm8997_sysclk_ev(struct snd_soc_dapm_widget * w,struct snd_kcontrol * kcontrol,int event)8140843aeaSCharles Keepax static int wm8997_sysclk_ev(struct snd_soc_dapm_widget *w,
8240843aeaSCharles Keepax 			    struct snd_kcontrol *kcontrol, int event)
8340843aeaSCharles Keepax {
840fe1daa6SKuninori Morimoto 	struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
850fe1daa6SKuninori Morimoto 	struct arizona *arizona = dev_get_drvdata(component->dev->parent);
86055bbe2dSLars-Peter Clausen 	struct regmap *regmap = arizona->regmap;
8740843aeaSCharles Keepax 	const struct reg_default *patch = NULL;
8840843aeaSCharles Keepax 	int i, patch_size;
8940843aeaSCharles Keepax 
9040843aeaSCharles Keepax 	switch (arizona->rev) {
9140843aeaSCharles Keepax 	case 0:
9240843aeaSCharles Keepax 		patch = wm8997_sysclk_reva_patch;
9340843aeaSCharles Keepax 		patch_size = ARRAY_SIZE(wm8997_sysclk_reva_patch);
9440843aeaSCharles Keepax 		break;
9540843aeaSCharles Keepax 	default:
9640843aeaSCharles Keepax 		break;
9740843aeaSCharles Keepax 	}
9840843aeaSCharles Keepax 
9940843aeaSCharles Keepax 	switch (event) {
10040843aeaSCharles Keepax 	case SND_SOC_DAPM_POST_PMU:
10140843aeaSCharles Keepax 		if (patch)
10240843aeaSCharles Keepax 			for (i = 0; i < patch_size; i++)
1031f4fe272SMark Brown 				regmap_write_async(regmap, patch[i].reg,
10440843aeaSCharles Keepax 						   patch[i].def);
10540843aeaSCharles Keepax 		break;
106346d9683SRichard Fitzgerald 	case SND_SOC_DAPM_PRE_PMD:
10740843aeaSCharles Keepax 		break;
1087a4413d0SCharles Keepax 	case SND_SOC_DAPM_PRE_PMU:
1097a4413d0SCharles Keepax 	case SND_SOC_DAPM_POST_PMD:
1107a4413d0SCharles Keepax 		return arizona_clk_ev(w, kcontrol, event);
111346d9683SRichard Fitzgerald 	default:
112346d9683SRichard Fitzgerald 		return 0;
11340843aeaSCharles Keepax 	}
11440843aeaSCharles Keepax 
115346d9683SRichard Fitzgerald 	return arizona_dvfs_sysclk_ev(w, kcontrol, event);
11640843aeaSCharles Keepax }
11740843aeaSCharles Keepax 
1187dd0f7caSCharles Keepax static const char * const wm8997_osr_text[] = {
11940843aeaSCharles Keepax 	"Low power", "Normal", "High performance",
12040843aeaSCharles Keepax };
12140843aeaSCharles Keepax 
12240843aeaSCharles Keepax static const unsigned int wm8997_osr_val[] = {
12340843aeaSCharles Keepax 	0x0, 0x3, 0x5,
12440843aeaSCharles Keepax };
12540843aeaSCharles Keepax 
12640843aeaSCharles Keepax static const struct soc_enum wm8997_hpout_osr[] = {
12740843aeaSCharles Keepax 	SOC_VALUE_ENUM_SINGLE(ARIZONA_OUTPUT_PATH_CONFIG_1L,
128347e5512STakashi Iwai 			      ARIZONA_OUT1_OSR_SHIFT, 0x7,
129347e5512STakashi Iwai 			      ARRAY_SIZE(wm8997_osr_text),
13040843aeaSCharles Keepax 			      wm8997_osr_text, wm8997_osr_val),
13140843aeaSCharles Keepax 	SOC_VALUE_ENUM_SINGLE(ARIZONA_OUTPUT_PATH_CONFIG_3L,
132347e5512STakashi Iwai 			      ARIZONA_OUT3_OSR_SHIFT, 0x7,
133347e5512STakashi Iwai 			      ARRAY_SIZE(wm8997_osr_text),
13440843aeaSCharles Keepax 			      wm8997_osr_text, wm8997_osr_val),
13540843aeaSCharles Keepax };
13640843aeaSCharles Keepax 
13740843aeaSCharles Keepax #define WM8997_NG_SRC(name, base) \
13840843aeaSCharles Keepax 	SOC_SINGLE(name " NG HPOUT1L Switch",  base, 0, 1, 0), \
13940843aeaSCharles Keepax 	SOC_SINGLE(name " NG HPOUT1R Switch",  base, 1, 1, 0), \
14040843aeaSCharles Keepax 	SOC_SINGLE(name " NG EPOUT Switch",    base, 4, 1, 0), \
14140843aeaSCharles Keepax 	SOC_SINGLE(name " NG SPKOUT Switch",   base, 6, 1, 0), \
14240843aeaSCharles Keepax 	SOC_SINGLE(name " NG SPKDAT1L Switch", base, 8, 1, 0), \
14340843aeaSCharles Keepax 	SOC_SINGLE(name " NG SPKDAT1R Switch", base, 9, 1, 0)
14440843aeaSCharles Keepax 
14540843aeaSCharles Keepax static const struct snd_kcontrol_new wm8997_snd_controls[] = {
14640843aeaSCharles Keepax SOC_SINGLE("IN1 High Performance Switch", ARIZONA_IN1L_CONTROL,
14740843aeaSCharles Keepax 	   ARIZONA_IN1_OSR_SHIFT, 1, 0),
14840843aeaSCharles Keepax SOC_SINGLE("IN2 High Performance Switch", ARIZONA_IN2L_CONTROL,
14940843aeaSCharles Keepax 	   ARIZONA_IN2_OSR_SHIFT, 1, 0),
15040843aeaSCharles Keepax 
15140843aeaSCharles Keepax SOC_SINGLE_RANGE_TLV("IN1L Volume", ARIZONA_IN1L_CONTROL,
15240843aeaSCharles Keepax 		     ARIZONA_IN1L_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv),
15340843aeaSCharles Keepax SOC_SINGLE_RANGE_TLV("IN1R Volume", ARIZONA_IN1R_CONTROL,
15440843aeaSCharles Keepax 		     ARIZONA_IN1R_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv),
15540843aeaSCharles Keepax SOC_SINGLE_RANGE_TLV("IN2L Volume", ARIZONA_IN2L_CONTROL,
15640843aeaSCharles Keepax 		     ARIZONA_IN2L_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv),
15740843aeaSCharles Keepax SOC_SINGLE_RANGE_TLV("IN2R Volume", ARIZONA_IN2R_CONTROL,
15840843aeaSCharles Keepax 		     ARIZONA_IN2R_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv),
15940843aeaSCharles Keepax 
16040843aeaSCharles Keepax SOC_SINGLE_TLV("IN1L Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_1L,
16140843aeaSCharles Keepax 	       ARIZONA_IN1L_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
16240843aeaSCharles Keepax SOC_SINGLE_TLV("IN1R Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_1R,
16340843aeaSCharles Keepax 	       ARIZONA_IN1R_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
16440843aeaSCharles Keepax SOC_SINGLE_TLV("IN2L Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_2L,
16540843aeaSCharles Keepax 	       ARIZONA_IN2L_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
16640843aeaSCharles Keepax SOC_SINGLE_TLV("IN2R Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_2R,
16740843aeaSCharles Keepax 	       ARIZONA_IN2R_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
16840843aeaSCharles Keepax 
16940843aeaSCharles Keepax SOC_ENUM("Input Ramp Up", arizona_in_vi_ramp),
17040843aeaSCharles Keepax SOC_ENUM("Input Ramp Down", arizona_in_vd_ramp),
17140843aeaSCharles Keepax 
17240843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("EQ1", ARIZONA_EQ1MIX_INPUT_1_SOURCE),
17340843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("EQ2", ARIZONA_EQ2MIX_INPUT_1_SOURCE),
17440843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("EQ3", ARIZONA_EQ3MIX_INPUT_1_SOURCE),
17540843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("EQ4", ARIZONA_EQ4MIX_INPUT_1_SOURCE),
17640843aeaSCharles Keepax 
177c05d9a8cSCharles Keepax ARIZONA_EQ_CONTROL("EQ1 Coefficients", ARIZONA_EQ1_2),
17840843aeaSCharles Keepax SOC_SINGLE_TLV("EQ1 B1 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B1_GAIN_SHIFT,
17940843aeaSCharles Keepax 	       24, 0, eq_tlv),
18040843aeaSCharles Keepax SOC_SINGLE_TLV("EQ1 B2 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B2_GAIN_SHIFT,
18140843aeaSCharles Keepax 	       24, 0, eq_tlv),
18240843aeaSCharles Keepax SOC_SINGLE_TLV("EQ1 B3 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B3_GAIN_SHIFT,
18340843aeaSCharles Keepax 	       24, 0, eq_tlv),
18440843aeaSCharles Keepax SOC_SINGLE_TLV("EQ1 B4 Volume", ARIZONA_EQ1_2, ARIZONA_EQ1_B4_GAIN_SHIFT,
18540843aeaSCharles Keepax 	       24, 0, eq_tlv),
18640843aeaSCharles Keepax SOC_SINGLE_TLV("EQ1 B5 Volume", ARIZONA_EQ1_2, ARIZONA_EQ1_B5_GAIN_SHIFT,
18740843aeaSCharles Keepax 	       24, 0, eq_tlv),
18840843aeaSCharles Keepax 
189c05d9a8cSCharles Keepax ARIZONA_EQ_CONTROL("EQ2 Coefficients", ARIZONA_EQ2_2),
19040843aeaSCharles Keepax SOC_SINGLE_TLV("EQ2 B1 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B1_GAIN_SHIFT,
19140843aeaSCharles Keepax 	       24, 0, eq_tlv),
19240843aeaSCharles Keepax SOC_SINGLE_TLV("EQ2 B2 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B2_GAIN_SHIFT,
19340843aeaSCharles Keepax 	       24, 0, eq_tlv),
19440843aeaSCharles Keepax SOC_SINGLE_TLV("EQ2 B3 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B3_GAIN_SHIFT,
19540843aeaSCharles Keepax 	       24, 0, eq_tlv),
19640843aeaSCharles Keepax SOC_SINGLE_TLV("EQ2 B4 Volume", ARIZONA_EQ2_2, ARIZONA_EQ2_B4_GAIN_SHIFT,
19740843aeaSCharles Keepax 	       24, 0, eq_tlv),
19840843aeaSCharles Keepax SOC_SINGLE_TLV("EQ2 B5 Volume", ARIZONA_EQ2_2, ARIZONA_EQ2_B5_GAIN_SHIFT,
19940843aeaSCharles Keepax 	       24, 0, eq_tlv),
20040843aeaSCharles Keepax 
201c05d9a8cSCharles Keepax ARIZONA_EQ_CONTROL("EQ3 Coefficients", ARIZONA_EQ3_2),
20240843aeaSCharles Keepax SOC_SINGLE_TLV("EQ3 B1 Volume", ARIZONA_EQ3_1, ARIZONA_EQ3_B1_GAIN_SHIFT,
20340843aeaSCharles Keepax 	       24, 0, eq_tlv),
20440843aeaSCharles Keepax SOC_SINGLE_TLV("EQ3 B2 Volume", ARIZONA_EQ3_1, ARIZONA_EQ3_B2_GAIN_SHIFT,
20540843aeaSCharles Keepax 	       24, 0, eq_tlv),
20640843aeaSCharles Keepax SOC_SINGLE_TLV("EQ3 B3 Volume", ARIZONA_EQ3_1, ARIZONA_EQ3_B3_GAIN_SHIFT,
20740843aeaSCharles Keepax 	       24, 0, eq_tlv),
20840843aeaSCharles Keepax SOC_SINGLE_TLV("EQ3 B4 Volume", ARIZONA_EQ3_2, ARIZONA_EQ3_B4_GAIN_SHIFT,
20940843aeaSCharles Keepax 	       24, 0, eq_tlv),
21040843aeaSCharles Keepax SOC_SINGLE_TLV("EQ3 B5 Volume", ARIZONA_EQ3_2, ARIZONA_EQ3_B5_GAIN_SHIFT,
21140843aeaSCharles Keepax 	       24, 0, eq_tlv),
21240843aeaSCharles Keepax 
213c05d9a8cSCharles Keepax ARIZONA_EQ_CONTROL("EQ4 Coefficients", ARIZONA_EQ4_2),
21440843aeaSCharles Keepax SOC_SINGLE_TLV("EQ4 B1 Volume", ARIZONA_EQ4_1, ARIZONA_EQ4_B1_GAIN_SHIFT,
21540843aeaSCharles Keepax 	       24, 0, eq_tlv),
21640843aeaSCharles Keepax SOC_SINGLE_TLV("EQ4 B2 Volume", ARIZONA_EQ4_1, ARIZONA_EQ4_B2_GAIN_SHIFT,
21740843aeaSCharles Keepax 	       24, 0, eq_tlv),
21840843aeaSCharles Keepax SOC_SINGLE_TLV("EQ4 B3 Volume", ARIZONA_EQ4_1, ARIZONA_EQ4_B3_GAIN_SHIFT,
21940843aeaSCharles Keepax 	       24, 0, eq_tlv),
22040843aeaSCharles Keepax SOC_SINGLE_TLV("EQ4 B4 Volume", ARIZONA_EQ4_2, ARIZONA_EQ4_B4_GAIN_SHIFT,
22140843aeaSCharles Keepax 	       24, 0, eq_tlv),
22240843aeaSCharles Keepax SOC_SINGLE_TLV("EQ4 B5 Volume", ARIZONA_EQ4_2, ARIZONA_EQ4_B5_GAIN_SHIFT,
22340843aeaSCharles Keepax 	       24, 0, eq_tlv),
22440843aeaSCharles Keepax 
22540843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("DRC1L", ARIZONA_DRC1LMIX_INPUT_1_SOURCE),
22640843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("DRC1R", ARIZONA_DRC1RMIX_INPUT_1_SOURCE),
22740843aeaSCharles Keepax 
22840843aeaSCharles Keepax SND_SOC_BYTES_MASK("DRC1", ARIZONA_DRC1_CTRL1, 5,
22940843aeaSCharles Keepax 		   ARIZONA_DRC1R_ENA | ARIZONA_DRC1L_ENA),
23040843aeaSCharles Keepax 
23140843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("LHPF1", ARIZONA_HPLP1MIX_INPUT_1_SOURCE),
23240843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("LHPF2", ARIZONA_HPLP2MIX_INPUT_1_SOURCE),
23340843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("LHPF3", ARIZONA_HPLP3MIX_INPUT_1_SOURCE),
23440843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("LHPF4", ARIZONA_HPLP4MIX_INPUT_1_SOURCE),
23540843aeaSCharles Keepax 
23640843aeaSCharles Keepax SOC_ENUM("LHPF1 Mode", arizona_lhpf1_mode),
23740843aeaSCharles Keepax SOC_ENUM("LHPF2 Mode", arizona_lhpf2_mode),
23840843aeaSCharles Keepax SOC_ENUM("LHPF3 Mode", arizona_lhpf3_mode),
23940843aeaSCharles Keepax SOC_ENUM("LHPF4 Mode", arizona_lhpf4_mode),
24040843aeaSCharles Keepax 
2415f8e671aSCharles Keepax ARIZONA_LHPF_CONTROL("LHPF1 Coefficients", ARIZONA_HPLPF1_2),
2425f8e671aSCharles Keepax ARIZONA_LHPF_CONTROL("LHPF2 Coefficients", ARIZONA_HPLPF2_2),
2435f8e671aSCharles Keepax ARIZONA_LHPF_CONTROL("LHPF3 Coefficients", ARIZONA_HPLPF3_2),
2445f8e671aSCharles Keepax ARIZONA_LHPF_CONTROL("LHPF4 Coefficients", ARIZONA_HPLPF4_2),
24540843aeaSCharles Keepax 
2469de98da2SLars-Peter Clausen SOC_ENUM("ISRC1 FSL", arizona_isrc_fsl[0]),
2479de98da2SLars-Peter Clausen SOC_ENUM("ISRC2 FSL", arizona_isrc_fsl[1]),
24840843aeaSCharles Keepax 
24940843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("Mic", ARIZONA_MICMIX_INPUT_1_SOURCE),
25040843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("Noise", ARIZONA_NOISEMIX_INPUT_1_SOURCE),
25140843aeaSCharles Keepax 
25240843aeaSCharles Keepax SOC_SINGLE_TLV("Noise Generator Volume", ARIZONA_COMFORT_NOISE_GENERATOR,
25340843aeaSCharles Keepax 	       ARIZONA_NOISE_GEN_GAIN_SHIFT, 0x16, 0, noise_tlv),
25440843aeaSCharles Keepax 
25540843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("HPOUT1L", ARIZONA_OUT1LMIX_INPUT_1_SOURCE),
25640843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("HPOUT1R", ARIZONA_OUT1RMIX_INPUT_1_SOURCE),
25740843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("EPOUT", ARIZONA_OUT3LMIX_INPUT_1_SOURCE),
25840843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("SPKOUT", ARIZONA_OUT4LMIX_INPUT_1_SOURCE),
25940843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("SPKDAT1L", ARIZONA_OUT5LMIX_INPUT_1_SOURCE),
26040843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("SPKDAT1R", ARIZONA_OUT5RMIX_INPUT_1_SOURCE),
26140843aeaSCharles Keepax 
26240843aeaSCharles Keepax SOC_SINGLE("Speaker High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_4L,
26340843aeaSCharles Keepax 	   ARIZONA_OUT4_OSR_SHIFT, 1, 0),
26440843aeaSCharles Keepax SOC_SINGLE("SPKDAT1 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_5L,
26540843aeaSCharles Keepax 	   ARIZONA_OUT5_OSR_SHIFT, 1, 0),
26640843aeaSCharles Keepax 
26740843aeaSCharles Keepax SOC_DOUBLE_R("HPOUT1 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_1L,
26840843aeaSCharles Keepax 	     ARIZONA_DAC_DIGITAL_VOLUME_1R, ARIZONA_OUT1L_MUTE_SHIFT, 1, 1),
26940843aeaSCharles Keepax SOC_SINGLE("EPOUT Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_3L,
27040843aeaSCharles Keepax 	   ARIZONA_OUT3L_MUTE_SHIFT, 1, 1),
27140843aeaSCharles Keepax SOC_SINGLE("Speaker Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_4L,
27240843aeaSCharles Keepax 	   ARIZONA_OUT4L_MUTE_SHIFT, 1, 1),
27340843aeaSCharles Keepax SOC_DOUBLE_R("SPKDAT1 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_5L,
27440843aeaSCharles Keepax 	     ARIZONA_DAC_DIGITAL_VOLUME_5R, ARIZONA_OUT5L_MUTE_SHIFT, 1, 1),
27540843aeaSCharles Keepax 
27640843aeaSCharles Keepax SOC_DOUBLE_R_TLV("HPOUT1 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_1L,
27740843aeaSCharles Keepax 		 ARIZONA_DAC_DIGITAL_VOLUME_1R, ARIZONA_OUT1L_VOL_SHIFT,
27840843aeaSCharles Keepax 		 0xbf, 0, digital_tlv),
27940843aeaSCharles Keepax SOC_SINGLE_TLV("EPOUT Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_3L,
28040843aeaSCharles Keepax 	       ARIZONA_OUT3L_VOL_SHIFT, 0xbf, 0, digital_tlv),
28140843aeaSCharles Keepax SOC_SINGLE_TLV("Speaker Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_4L,
28240843aeaSCharles Keepax 	       ARIZONA_OUT4L_VOL_SHIFT, 0xbf, 0, digital_tlv),
28340843aeaSCharles Keepax SOC_DOUBLE_R_TLV("SPKDAT1 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_5L,
28440843aeaSCharles Keepax 		 ARIZONA_DAC_DIGITAL_VOLUME_5R, ARIZONA_OUT5L_VOL_SHIFT,
28540843aeaSCharles Keepax 		 0xbf, 0, digital_tlv),
28640843aeaSCharles Keepax 
2879de98da2SLars-Peter Clausen SOC_ENUM("HPOUT1 OSR", wm8997_hpout_osr[0]),
2889de98da2SLars-Peter Clausen SOC_ENUM("EPOUT OSR", wm8997_hpout_osr[1]),
28940843aeaSCharles Keepax 
29040843aeaSCharles Keepax SOC_ENUM("Output Ramp Up", arizona_out_vi_ramp),
29140843aeaSCharles Keepax SOC_ENUM("Output Ramp Down", arizona_out_vd_ramp),
29240843aeaSCharles Keepax 
29340843aeaSCharles Keepax SOC_DOUBLE("SPKDAT1 Switch", ARIZONA_PDM_SPK1_CTRL_1, ARIZONA_SPK1L_MUTE_SHIFT,
29440843aeaSCharles Keepax 	   ARIZONA_SPK1R_MUTE_SHIFT, 1, 1),
29540843aeaSCharles Keepax 
29640843aeaSCharles Keepax SOC_SINGLE("Noise Gate Switch", ARIZONA_NOISE_GATE_CONTROL,
29740843aeaSCharles Keepax 	   ARIZONA_NGATE_ENA_SHIFT, 1, 0),
29840843aeaSCharles Keepax SOC_SINGLE_TLV("Noise Gate Threshold Volume", ARIZONA_NOISE_GATE_CONTROL,
29940843aeaSCharles Keepax 	       ARIZONA_NGATE_THR_SHIFT, 7, 1, ng_tlv),
30040843aeaSCharles Keepax SOC_ENUM("Noise Gate Hold", arizona_ng_hold),
30140843aeaSCharles Keepax 
30240843aeaSCharles Keepax WM8997_NG_SRC("HPOUT1L", ARIZONA_NOISE_GATE_SELECT_1L),
30340843aeaSCharles Keepax WM8997_NG_SRC("HPOUT1R", ARIZONA_NOISE_GATE_SELECT_1R),
30440843aeaSCharles Keepax WM8997_NG_SRC("EPOUT", ARIZONA_NOISE_GATE_SELECT_3L),
30540843aeaSCharles Keepax WM8997_NG_SRC("SPKOUT", ARIZONA_NOISE_GATE_SELECT_4L),
30640843aeaSCharles Keepax WM8997_NG_SRC("SPKDAT1L", ARIZONA_NOISE_GATE_SELECT_5L),
30740843aeaSCharles Keepax WM8997_NG_SRC("SPKDAT1R", ARIZONA_NOISE_GATE_SELECT_5R),
30840843aeaSCharles Keepax 
30940843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("AIF1TX1", ARIZONA_AIF1TX1MIX_INPUT_1_SOURCE),
31040843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("AIF1TX2", ARIZONA_AIF1TX2MIX_INPUT_1_SOURCE),
31140843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("AIF1TX3", ARIZONA_AIF1TX3MIX_INPUT_1_SOURCE),
31240843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("AIF1TX4", ARIZONA_AIF1TX4MIX_INPUT_1_SOURCE),
31340843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("AIF1TX5", ARIZONA_AIF1TX5MIX_INPUT_1_SOURCE),
31440843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("AIF1TX6", ARIZONA_AIF1TX6MIX_INPUT_1_SOURCE),
31540843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("AIF1TX7", ARIZONA_AIF1TX7MIX_INPUT_1_SOURCE),
31640843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("AIF1TX8", ARIZONA_AIF1TX8MIX_INPUT_1_SOURCE),
31740843aeaSCharles Keepax 
31840843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("AIF2TX1", ARIZONA_AIF2TX1MIX_INPUT_1_SOURCE),
31940843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("AIF2TX2", ARIZONA_AIF2TX2MIX_INPUT_1_SOURCE),
32040843aeaSCharles Keepax 
32140843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("SLIMTX1", ARIZONA_SLIMTX1MIX_INPUT_1_SOURCE),
32240843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("SLIMTX2", ARIZONA_SLIMTX2MIX_INPUT_1_SOURCE),
32340843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("SLIMTX3", ARIZONA_SLIMTX3MIX_INPUT_1_SOURCE),
32440843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("SLIMTX4", ARIZONA_SLIMTX4MIX_INPUT_1_SOURCE),
32540843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("SLIMTX5", ARIZONA_SLIMTX5MIX_INPUT_1_SOURCE),
32640843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("SLIMTX6", ARIZONA_SLIMTX6MIX_INPUT_1_SOURCE),
32740843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("SLIMTX7", ARIZONA_SLIMTX7MIX_INPUT_1_SOURCE),
32840843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("SLIMTX8", ARIZONA_SLIMTX8MIX_INPUT_1_SOURCE),
32940843aeaSCharles Keepax };
33040843aeaSCharles Keepax 
33140843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(EQ1, ARIZONA_EQ1MIX_INPUT_1_SOURCE);
33240843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(EQ2, ARIZONA_EQ2MIX_INPUT_1_SOURCE);
33340843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(EQ3, ARIZONA_EQ3MIX_INPUT_1_SOURCE);
33440843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(EQ4, ARIZONA_EQ4MIX_INPUT_1_SOURCE);
33540843aeaSCharles Keepax 
33640843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(DRC1L, ARIZONA_DRC1LMIX_INPUT_1_SOURCE);
33740843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(DRC1R, ARIZONA_DRC1RMIX_INPUT_1_SOURCE);
33840843aeaSCharles Keepax 
33940843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(LHPF1, ARIZONA_HPLP1MIX_INPUT_1_SOURCE);
34040843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(LHPF2, ARIZONA_HPLP2MIX_INPUT_1_SOURCE);
34140843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(LHPF3, ARIZONA_HPLP3MIX_INPUT_1_SOURCE);
34240843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(LHPF4, ARIZONA_HPLP4MIX_INPUT_1_SOURCE);
34340843aeaSCharles Keepax 
34440843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(Mic, ARIZONA_MICMIX_INPUT_1_SOURCE);
34540843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(Noise, ARIZONA_NOISEMIX_INPUT_1_SOURCE);
34640843aeaSCharles Keepax 
34740843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(PWM1, ARIZONA_PWM1MIX_INPUT_1_SOURCE);
34840843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(PWM2, ARIZONA_PWM2MIX_INPUT_1_SOURCE);
34940843aeaSCharles Keepax 
35040843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(OUT1L, ARIZONA_OUT1LMIX_INPUT_1_SOURCE);
35140843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(OUT1R, ARIZONA_OUT1RMIX_INPUT_1_SOURCE);
35240843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(OUT3, ARIZONA_OUT3LMIX_INPUT_1_SOURCE);
35340843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(SPKOUT, ARIZONA_OUT4LMIX_INPUT_1_SOURCE);
35440843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(SPKDAT1L, ARIZONA_OUT5LMIX_INPUT_1_SOURCE);
35540843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(SPKDAT1R, ARIZONA_OUT5RMIX_INPUT_1_SOURCE);
35640843aeaSCharles Keepax 
35740843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(AIF1TX1, ARIZONA_AIF1TX1MIX_INPUT_1_SOURCE);
35840843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(AIF1TX2, ARIZONA_AIF1TX2MIX_INPUT_1_SOURCE);
35940843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(AIF1TX3, ARIZONA_AIF1TX3MIX_INPUT_1_SOURCE);
36040843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(AIF1TX4, ARIZONA_AIF1TX4MIX_INPUT_1_SOURCE);
36140843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(AIF1TX5, ARIZONA_AIF1TX5MIX_INPUT_1_SOURCE);
36240843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(AIF1TX6, ARIZONA_AIF1TX6MIX_INPUT_1_SOURCE);
36340843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(AIF1TX7, ARIZONA_AIF1TX7MIX_INPUT_1_SOURCE);
36440843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(AIF1TX8, ARIZONA_AIF1TX8MIX_INPUT_1_SOURCE);
36540843aeaSCharles Keepax 
36640843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(AIF2TX1, ARIZONA_AIF2TX1MIX_INPUT_1_SOURCE);
36740843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(AIF2TX2, ARIZONA_AIF2TX2MIX_INPUT_1_SOURCE);
36840843aeaSCharles Keepax 
36940843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(SLIMTX1, ARIZONA_SLIMTX1MIX_INPUT_1_SOURCE);
37040843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(SLIMTX2, ARIZONA_SLIMTX2MIX_INPUT_1_SOURCE);
37140843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(SLIMTX3, ARIZONA_SLIMTX3MIX_INPUT_1_SOURCE);
37240843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(SLIMTX4, ARIZONA_SLIMTX4MIX_INPUT_1_SOURCE);
37340843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(SLIMTX5, ARIZONA_SLIMTX5MIX_INPUT_1_SOURCE);
37440843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(SLIMTX6, ARIZONA_SLIMTX6MIX_INPUT_1_SOURCE);
37540843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(SLIMTX7, ARIZONA_SLIMTX7MIX_INPUT_1_SOURCE);
37640843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(SLIMTX8, ARIZONA_SLIMTX8MIX_INPUT_1_SOURCE);
37740843aeaSCharles Keepax 
37840843aeaSCharles Keepax ARIZONA_MUX_ENUMS(ISRC1INT1, ARIZONA_ISRC1INT1MIX_INPUT_1_SOURCE);
37940843aeaSCharles Keepax ARIZONA_MUX_ENUMS(ISRC1INT2, ARIZONA_ISRC1INT2MIX_INPUT_1_SOURCE);
38040843aeaSCharles Keepax 
38140843aeaSCharles Keepax ARIZONA_MUX_ENUMS(ISRC1DEC1, ARIZONA_ISRC1DEC1MIX_INPUT_1_SOURCE);
38240843aeaSCharles Keepax ARIZONA_MUX_ENUMS(ISRC1DEC2, ARIZONA_ISRC1DEC2MIX_INPUT_1_SOURCE);
38340843aeaSCharles Keepax 
38440843aeaSCharles Keepax ARIZONA_MUX_ENUMS(ISRC2INT1, ARIZONA_ISRC2INT1MIX_INPUT_1_SOURCE);
38540843aeaSCharles Keepax ARIZONA_MUX_ENUMS(ISRC2INT2, ARIZONA_ISRC2INT2MIX_INPUT_1_SOURCE);
38640843aeaSCharles Keepax 
38740843aeaSCharles Keepax ARIZONA_MUX_ENUMS(ISRC2DEC1, ARIZONA_ISRC2DEC1MIX_INPUT_1_SOURCE);
38840843aeaSCharles Keepax ARIZONA_MUX_ENUMS(ISRC2DEC2, ARIZONA_ISRC2DEC2MIX_INPUT_1_SOURCE);
38940843aeaSCharles Keepax 
39040843aeaSCharles Keepax static const char *wm8997_aec_loopback_texts[] = {
39140843aeaSCharles Keepax 	"HPOUT1L", "HPOUT1R", "EPOUT", "SPKOUT", "SPKDAT1L", "SPKDAT1R",
39240843aeaSCharles Keepax };
39340843aeaSCharles Keepax 
39440843aeaSCharles Keepax static const unsigned int wm8997_aec_loopback_values[] = {
39540843aeaSCharles Keepax 	0, 1, 4, 6, 8, 9,
39640843aeaSCharles Keepax };
39740843aeaSCharles Keepax 
39840843aeaSCharles Keepax static const struct soc_enum wm8997_aec_loopback =
39940843aeaSCharles Keepax 	SOC_VALUE_ENUM_SINGLE(ARIZONA_DAC_AEC_CONTROL_1,
40040843aeaSCharles Keepax 			      ARIZONA_AEC_LOOPBACK_SRC_SHIFT, 0xf,
40140843aeaSCharles Keepax 			      ARRAY_SIZE(wm8997_aec_loopback_texts),
40240843aeaSCharles Keepax 			      wm8997_aec_loopback_texts,
40340843aeaSCharles Keepax 			      wm8997_aec_loopback_values);
40440843aeaSCharles Keepax 
40540843aeaSCharles Keepax static const struct snd_kcontrol_new wm8997_aec_loopback_mux =
406e13dd8ceSLars-Peter Clausen 	SOC_DAPM_ENUM("AEC Loopback", wm8997_aec_loopback);
40740843aeaSCharles Keepax 
40840843aeaSCharles Keepax static const struct snd_soc_dapm_widget wm8997_dapm_widgets[] = {
40940843aeaSCharles Keepax SND_SOC_DAPM_SUPPLY("SYSCLK", ARIZONA_SYSTEM_CLOCK_1, ARIZONA_SYSCLK_ENA_SHIFT,
410346d9683SRichard Fitzgerald 		    0, wm8997_sysclk_ev,
4117a4413d0SCharles Keepax 		    SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD |
4127a4413d0SCharles Keepax 		    SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
41340843aeaSCharles Keepax SND_SOC_DAPM_SUPPLY("ASYNCCLK", ARIZONA_ASYNC_CLOCK_1,
4147a4413d0SCharles Keepax 		    ARIZONA_ASYNC_CLK_ENA_SHIFT, 0, arizona_clk_ev,
4157a4413d0SCharles Keepax 		    SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
41640843aeaSCharles Keepax SND_SOC_DAPM_SUPPLY("OPCLK", ARIZONA_OUTPUT_SYSTEM_CLOCK,
41740843aeaSCharles Keepax 		    ARIZONA_OPCLK_ENA_SHIFT, 0, NULL, 0),
41840843aeaSCharles Keepax SND_SOC_DAPM_SUPPLY("ASYNCOPCLK", ARIZONA_OUTPUT_ASYNC_CLOCK,
41940843aeaSCharles Keepax 		    ARIZONA_OPCLK_ASYNC_ENA_SHIFT, 0, NULL, 0),
42040843aeaSCharles Keepax 
42140843aeaSCharles Keepax SND_SOC_DAPM_REGULATOR_SUPPLY("DBVDD2", 0, 0),
42240843aeaSCharles Keepax SND_SOC_DAPM_REGULATOR_SUPPLY("CPVDD", 20, 0),
42340843aeaSCharles Keepax SND_SOC_DAPM_REGULATOR_SUPPLY("MICVDD", 0, SND_SOC_DAPM_REGULATOR_BYPASS),
42440843aeaSCharles Keepax SND_SOC_DAPM_REGULATOR_SUPPLY("SPKVDD", 0, 0),
42540843aeaSCharles Keepax 
42640843aeaSCharles Keepax SND_SOC_DAPM_SIGGEN("TONE"),
42740843aeaSCharles Keepax SND_SOC_DAPM_SIGGEN("NOISE"),
42840843aeaSCharles Keepax SND_SOC_DAPM_SIGGEN("HAPTICS"),
42940843aeaSCharles Keepax 
43040843aeaSCharles Keepax SND_SOC_DAPM_INPUT("IN1L"),
43140843aeaSCharles Keepax SND_SOC_DAPM_INPUT("IN1R"),
43240843aeaSCharles Keepax SND_SOC_DAPM_INPUT("IN2L"),
43340843aeaSCharles Keepax SND_SOC_DAPM_INPUT("IN2R"),
43440843aeaSCharles Keepax 
43540843aeaSCharles Keepax SND_SOC_DAPM_PGA_E("IN1L PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN1L_ENA_SHIFT,
43640843aeaSCharles Keepax 		   0, NULL, 0, arizona_in_ev,
43740843aeaSCharles Keepax 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
43840843aeaSCharles Keepax 		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
43940843aeaSCharles Keepax SND_SOC_DAPM_PGA_E("IN1R PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN1R_ENA_SHIFT,
44040843aeaSCharles Keepax 		   0, NULL, 0, arizona_in_ev,
44140843aeaSCharles Keepax 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
44240843aeaSCharles Keepax 		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
44340843aeaSCharles Keepax SND_SOC_DAPM_PGA_E("IN2L PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN2L_ENA_SHIFT,
44440843aeaSCharles Keepax 		   0, NULL, 0, arizona_in_ev,
44540843aeaSCharles Keepax 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
44640843aeaSCharles Keepax 		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
44740843aeaSCharles Keepax SND_SOC_DAPM_PGA_E("IN2R PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN2R_ENA_SHIFT,
44840843aeaSCharles Keepax 		   0, NULL, 0, arizona_in_ev,
44940843aeaSCharles Keepax 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
45040843aeaSCharles Keepax 		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
45140843aeaSCharles Keepax 
45240843aeaSCharles Keepax SND_SOC_DAPM_SUPPLY("MICBIAS1", ARIZONA_MIC_BIAS_CTRL_1,
45340843aeaSCharles Keepax 		    ARIZONA_MICB1_ENA_SHIFT, 0, NULL, 0),
45440843aeaSCharles Keepax SND_SOC_DAPM_SUPPLY("MICBIAS2", ARIZONA_MIC_BIAS_CTRL_2,
45540843aeaSCharles Keepax 		    ARIZONA_MICB2_ENA_SHIFT, 0, NULL, 0),
45640843aeaSCharles Keepax SND_SOC_DAPM_SUPPLY("MICBIAS3", ARIZONA_MIC_BIAS_CTRL_3,
45740843aeaSCharles Keepax 		    ARIZONA_MICB3_ENA_SHIFT, 0, NULL, 0),
45840843aeaSCharles Keepax 
45940843aeaSCharles Keepax SND_SOC_DAPM_PGA("Noise Generator", ARIZONA_COMFORT_NOISE_GENERATOR,
46040843aeaSCharles Keepax 		 ARIZONA_NOISE_GEN_ENA_SHIFT, 0, NULL, 0),
46140843aeaSCharles Keepax 
46240843aeaSCharles Keepax SND_SOC_DAPM_PGA("Tone Generator 1", ARIZONA_TONE_GENERATOR_1,
46340843aeaSCharles Keepax 		 ARIZONA_TONE1_ENA_SHIFT, 0, NULL, 0),
46440843aeaSCharles Keepax SND_SOC_DAPM_PGA("Tone Generator 2", ARIZONA_TONE_GENERATOR_1,
46540843aeaSCharles Keepax 		 ARIZONA_TONE2_ENA_SHIFT, 0, NULL, 0),
46640843aeaSCharles Keepax 
46740843aeaSCharles Keepax SND_SOC_DAPM_PGA("Mic Mute Mixer", ARIZONA_MIC_NOISE_MIX_CONTROL_1,
46840843aeaSCharles Keepax 		 ARIZONA_MICMUTE_MIX_ENA_SHIFT, 0, NULL, 0),
46940843aeaSCharles Keepax 
47040843aeaSCharles Keepax SND_SOC_DAPM_PGA("EQ1", ARIZONA_EQ1_1, ARIZONA_EQ1_ENA_SHIFT, 0, NULL, 0),
47140843aeaSCharles Keepax SND_SOC_DAPM_PGA("EQ2", ARIZONA_EQ2_1, ARIZONA_EQ2_ENA_SHIFT, 0, NULL, 0),
47240843aeaSCharles Keepax SND_SOC_DAPM_PGA("EQ3", ARIZONA_EQ3_1, ARIZONA_EQ3_ENA_SHIFT, 0, NULL, 0),
47340843aeaSCharles Keepax SND_SOC_DAPM_PGA("EQ4", ARIZONA_EQ4_1, ARIZONA_EQ4_ENA_SHIFT, 0, NULL, 0),
47440843aeaSCharles Keepax 
47540843aeaSCharles Keepax SND_SOC_DAPM_PGA("DRC1L", ARIZONA_DRC1_CTRL1, ARIZONA_DRC1L_ENA_SHIFT, 0,
47640843aeaSCharles Keepax 		 NULL, 0),
47740843aeaSCharles Keepax SND_SOC_DAPM_PGA("DRC1R", ARIZONA_DRC1_CTRL1, ARIZONA_DRC1R_ENA_SHIFT, 0,
47840843aeaSCharles Keepax 		 NULL, 0),
47940843aeaSCharles Keepax 
48040843aeaSCharles Keepax SND_SOC_DAPM_PGA("LHPF1", ARIZONA_HPLPF1_1, ARIZONA_LHPF1_ENA_SHIFT, 0,
48140843aeaSCharles Keepax 		 NULL, 0),
48240843aeaSCharles Keepax SND_SOC_DAPM_PGA("LHPF2", ARIZONA_HPLPF2_1, ARIZONA_LHPF2_ENA_SHIFT, 0,
48340843aeaSCharles Keepax 		 NULL, 0),
48440843aeaSCharles Keepax SND_SOC_DAPM_PGA("LHPF3", ARIZONA_HPLPF3_1, ARIZONA_LHPF3_ENA_SHIFT, 0,
48540843aeaSCharles Keepax 		 NULL, 0),
48640843aeaSCharles Keepax SND_SOC_DAPM_PGA("LHPF4", ARIZONA_HPLPF4_1, ARIZONA_LHPF4_ENA_SHIFT, 0,
48740843aeaSCharles Keepax 		 NULL, 0),
48840843aeaSCharles Keepax 
48940843aeaSCharles Keepax SND_SOC_DAPM_PGA("PWM1 Driver", ARIZONA_PWM_DRIVE_1, ARIZONA_PWM1_ENA_SHIFT,
49040843aeaSCharles Keepax 		 0, NULL, 0),
49140843aeaSCharles Keepax SND_SOC_DAPM_PGA("PWM2 Driver", ARIZONA_PWM_DRIVE_1, ARIZONA_PWM2_ENA_SHIFT,
49240843aeaSCharles Keepax 		 0, NULL, 0),
49340843aeaSCharles Keepax 
49440843aeaSCharles Keepax SND_SOC_DAPM_PGA("ISRC1INT1", ARIZONA_ISRC_1_CTRL_3,
49540843aeaSCharles Keepax 		 ARIZONA_ISRC1_INT0_ENA_SHIFT, 0, NULL, 0),
49640843aeaSCharles Keepax SND_SOC_DAPM_PGA("ISRC1INT2", ARIZONA_ISRC_1_CTRL_3,
49740843aeaSCharles Keepax 		 ARIZONA_ISRC1_INT1_ENA_SHIFT, 0, NULL, 0),
49840843aeaSCharles Keepax 
49940843aeaSCharles Keepax SND_SOC_DAPM_PGA("ISRC1DEC1", ARIZONA_ISRC_1_CTRL_3,
50040843aeaSCharles Keepax 		 ARIZONA_ISRC1_DEC0_ENA_SHIFT, 0, NULL, 0),
50140843aeaSCharles Keepax SND_SOC_DAPM_PGA("ISRC1DEC2", ARIZONA_ISRC_1_CTRL_3,
50240843aeaSCharles Keepax 		 ARIZONA_ISRC1_DEC1_ENA_SHIFT, 0, NULL, 0),
50340843aeaSCharles Keepax 
50440843aeaSCharles Keepax SND_SOC_DAPM_PGA("ISRC2INT1", ARIZONA_ISRC_2_CTRL_3,
50540843aeaSCharles Keepax 		 ARIZONA_ISRC2_INT0_ENA_SHIFT, 0, NULL, 0),
50640843aeaSCharles Keepax SND_SOC_DAPM_PGA("ISRC2INT2", ARIZONA_ISRC_2_CTRL_3,
50740843aeaSCharles Keepax 		 ARIZONA_ISRC2_INT1_ENA_SHIFT, 0, NULL, 0),
50840843aeaSCharles Keepax 
50940843aeaSCharles Keepax SND_SOC_DAPM_PGA("ISRC2DEC1", ARIZONA_ISRC_2_CTRL_3,
51040843aeaSCharles Keepax 		 ARIZONA_ISRC2_DEC0_ENA_SHIFT, 0, NULL, 0),
51140843aeaSCharles Keepax SND_SOC_DAPM_PGA("ISRC2DEC2", ARIZONA_ISRC_2_CTRL_3,
51240843aeaSCharles Keepax 		 ARIZONA_ISRC2_DEC1_ENA_SHIFT, 0, NULL, 0),
51340843aeaSCharles Keepax 
51440843aeaSCharles Keepax SND_SOC_DAPM_AIF_OUT("AIF1TX1", NULL, 0,
51540843aeaSCharles Keepax 		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX1_ENA_SHIFT, 0),
516909d74e3SCharles Keepax SND_SOC_DAPM_AIF_OUT("AIF1TX2", NULL, 1,
51740843aeaSCharles Keepax 		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX2_ENA_SHIFT, 0),
518909d74e3SCharles Keepax SND_SOC_DAPM_AIF_OUT("AIF1TX3", NULL, 2,
51940843aeaSCharles Keepax 		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX3_ENA_SHIFT, 0),
520909d74e3SCharles Keepax SND_SOC_DAPM_AIF_OUT("AIF1TX4", NULL, 3,
52140843aeaSCharles Keepax 		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX4_ENA_SHIFT, 0),
522909d74e3SCharles Keepax SND_SOC_DAPM_AIF_OUT("AIF1TX5", NULL, 4,
52340843aeaSCharles Keepax 		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX5_ENA_SHIFT, 0),
524909d74e3SCharles Keepax SND_SOC_DAPM_AIF_OUT("AIF1TX6", NULL, 5,
52540843aeaSCharles Keepax 		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX6_ENA_SHIFT, 0),
526909d74e3SCharles Keepax SND_SOC_DAPM_AIF_OUT("AIF1TX7", NULL, 6,
52740843aeaSCharles Keepax 		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX7_ENA_SHIFT, 0),
528909d74e3SCharles Keepax SND_SOC_DAPM_AIF_OUT("AIF1TX8", NULL, 7,
52940843aeaSCharles Keepax 		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX8_ENA_SHIFT, 0),
53040843aeaSCharles Keepax 
53140843aeaSCharles Keepax SND_SOC_DAPM_AIF_IN("AIF1RX1", NULL, 0,
53240843aeaSCharles Keepax 		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX1_ENA_SHIFT, 0),
533909d74e3SCharles Keepax SND_SOC_DAPM_AIF_IN("AIF1RX2", NULL, 1,
53440843aeaSCharles Keepax 		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX2_ENA_SHIFT, 0),
535909d74e3SCharles Keepax SND_SOC_DAPM_AIF_IN("AIF1RX3", NULL, 2,
53640843aeaSCharles Keepax 		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX3_ENA_SHIFT, 0),
537909d74e3SCharles Keepax SND_SOC_DAPM_AIF_IN("AIF1RX4", NULL, 3,
53840843aeaSCharles Keepax 		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX4_ENA_SHIFT, 0),
539909d74e3SCharles Keepax SND_SOC_DAPM_AIF_IN("AIF1RX5", NULL, 4,
54040843aeaSCharles Keepax 		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX5_ENA_SHIFT, 0),
541909d74e3SCharles Keepax SND_SOC_DAPM_AIF_IN("AIF1RX6", NULL, 5,
54240843aeaSCharles Keepax 		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX6_ENA_SHIFT, 0),
543909d74e3SCharles Keepax SND_SOC_DAPM_AIF_IN("AIF1RX7", NULL, 6,
54440843aeaSCharles Keepax 		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX7_ENA_SHIFT, 0),
545909d74e3SCharles Keepax SND_SOC_DAPM_AIF_IN("AIF1RX8", NULL, 7,
54640843aeaSCharles Keepax 		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX8_ENA_SHIFT, 0),
54740843aeaSCharles Keepax 
54840843aeaSCharles Keepax SND_SOC_DAPM_AIF_OUT("AIF2TX1", NULL, 0,
54940843aeaSCharles Keepax 		     ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX1_ENA_SHIFT, 0),
550909d74e3SCharles Keepax SND_SOC_DAPM_AIF_OUT("AIF2TX2", NULL, 1,
55140843aeaSCharles Keepax 		     ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX2_ENA_SHIFT, 0),
55240843aeaSCharles Keepax 
55340843aeaSCharles Keepax SND_SOC_DAPM_AIF_IN("AIF2RX1", NULL, 0,
55440843aeaSCharles Keepax 		    ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX1_ENA_SHIFT, 0),
555909d74e3SCharles Keepax SND_SOC_DAPM_AIF_IN("AIF2RX2", NULL, 1,
55640843aeaSCharles Keepax 		    ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX2_ENA_SHIFT, 0),
55740843aeaSCharles Keepax 
55840843aeaSCharles Keepax SND_SOC_DAPM_AIF_OUT("SLIMTX1", NULL, 0,
55940843aeaSCharles Keepax 		     ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
56040843aeaSCharles Keepax 		     ARIZONA_SLIMTX1_ENA_SHIFT, 0),
561909d74e3SCharles Keepax SND_SOC_DAPM_AIF_OUT("SLIMTX2", NULL, 1,
56240843aeaSCharles Keepax 		     ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
56340843aeaSCharles Keepax 		     ARIZONA_SLIMTX2_ENA_SHIFT, 0),
564909d74e3SCharles Keepax SND_SOC_DAPM_AIF_OUT("SLIMTX3", NULL, 2,
56540843aeaSCharles Keepax 		     ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
56640843aeaSCharles Keepax 		     ARIZONA_SLIMTX3_ENA_SHIFT, 0),
567909d74e3SCharles Keepax SND_SOC_DAPM_AIF_OUT("SLIMTX4", NULL, 3,
56840843aeaSCharles Keepax 		     ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
56940843aeaSCharles Keepax 		     ARIZONA_SLIMTX4_ENA_SHIFT, 0),
570909d74e3SCharles Keepax SND_SOC_DAPM_AIF_OUT("SLIMTX5", NULL, 4,
57140843aeaSCharles Keepax 		     ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
57240843aeaSCharles Keepax 		     ARIZONA_SLIMTX5_ENA_SHIFT, 0),
573909d74e3SCharles Keepax SND_SOC_DAPM_AIF_OUT("SLIMTX6", NULL, 5,
57440843aeaSCharles Keepax 		     ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
57540843aeaSCharles Keepax 		     ARIZONA_SLIMTX6_ENA_SHIFT, 0),
576909d74e3SCharles Keepax SND_SOC_DAPM_AIF_OUT("SLIMTX7", NULL, 6,
57740843aeaSCharles Keepax 		     ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
57840843aeaSCharles Keepax 		     ARIZONA_SLIMTX7_ENA_SHIFT, 0),
579909d74e3SCharles Keepax SND_SOC_DAPM_AIF_OUT("SLIMTX8", NULL, 7,
58040843aeaSCharles Keepax 		     ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
58140843aeaSCharles Keepax 		     ARIZONA_SLIMTX8_ENA_SHIFT, 0),
58240843aeaSCharles Keepax 
58340843aeaSCharles Keepax SND_SOC_DAPM_AIF_IN("SLIMRX1", NULL, 0,
58440843aeaSCharles Keepax 		    ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
58540843aeaSCharles Keepax 		    ARIZONA_SLIMRX1_ENA_SHIFT, 0),
586909d74e3SCharles Keepax SND_SOC_DAPM_AIF_IN("SLIMRX2", NULL, 1,
58740843aeaSCharles Keepax 		    ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
58840843aeaSCharles Keepax 		    ARIZONA_SLIMRX2_ENA_SHIFT, 0),
589909d74e3SCharles Keepax SND_SOC_DAPM_AIF_IN("SLIMRX3", NULL, 2,
59040843aeaSCharles Keepax 		    ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
59140843aeaSCharles Keepax 		    ARIZONA_SLIMRX3_ENA_SHIFT, 0),
592909d74e3SCharles Keepax SND_SOC_DAPM_AIF_IN("SLIMRX4", NULL, 3,
59340843aeaSCharles Keepax 		    ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
59440843aeaSCharles Keepax 		    ARIZONA_SLIMRX4_ENA_SHIFT, 0),
595909d74e3SCharles Keepax SND_SOC_DAPM_AIF_IN("SLIMRX5", NULL, 4,
59640843aeaSCharles Keepax 		    ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
59740843aeaSCharles Keepax 		    ARIZONA_SLIMRX5_ENA_SHIFT, 0),
598909d74e3SCharles Keepax SND_SOC_DAPM_AIF_IN("SLIMRX6", NULL, 5,
59940843aeaSCharles Keepax 		    ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
60040843aeaSCharles Keepax 		    ARIZONA_SLIMRX6_ENA_SHIFT, 0),
601909d74e3SCharles Keepax SND_SOC_DAPM_AIF_IN("SLIMRX7", NULL, 6,
60240843aeaSCharles Keepax 		    ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
60340843aeaSCharles Keepax 		    ARIZONA_SLIMRX7_ENA_SHIFT, 0),
604909d74e3SCharles Keepax SND_SOC_DAPM_AIF_IN("SLIMRX8", NULL, 7,
60540843aeaSCharles Keepax 		    ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
60640843aeaSCharles Keepax 		    ARIZONA_SLIMRX8_ENA_SHIFT, 0),
60740843aeaSCharles Keepax 
608e13dd8ceSLars-Peter Clausen SND_SOC_DAPM_MUX("AEC Loopback", ARIZONA_DAC_AEC_CONTROL_1,
6097dd0f7caSCharles Keepax 		 ARIZONA_AEC_LOOPBACK_ENA_SHIFT, 0, &wm8997_aec_loopback_mux),
61040843aeaSCharles Keepax 
61140843aeaSCharles Keepax SND_SOC_DAPM_PGA_E("OUT1L", SND_SOC_NOPM,
61240843aeaSCharles Keepax 		   ARIZONA_OUT1L_ENA_SHIFT, 0, NULL, 0, arizona_hp_ev,
613054e1b48SCharles Keepax 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
614e1ae5fbaSCharles Keepax 		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
61540843aeaSCharles Keepax SND_SOC_DAPM_PGA_E("OUT1R", SND_SOC_NOPM,
61640843aeaSCharles Keepax 		   ARIZONA_OUT1R_ENA_SHIFT, 0, NULL, 0, arizona_hp_ev,
617054e1b48SCharles Keepax 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
618e1ae5fbaSCharles Keepax 		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
61940843aeaSCharles Keepax SND_SOC_DAPM_PGA_E("OUT3L", ARIZONA_OUTPUT_ENABLES_1,
62040843aeaSCharles Keepax 		   ARIZONA_OUT3L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
621054e1b48SCharles Keepax 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
622e1ae5fbaSCharles Keepax 		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
62340843aeaSCharles Keepax SND_SOC_DAPM_PGA_E("OUT5L", ARIZONA_OUTPUT_ENABLES_1,
62440843aeaSCharles Keepax 		   ARIZONA_OUT5L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
62540843aeaSCharles Keepax 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
62640843aeaSCharles Keepax SND_SOC_DAPM_PGA_E("OUT5R", ARIZONA_OUTPUT_ENABLES_1,
62740843aeaSCharles Keepax 		   ARIZONA_OUT5R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
62840843aeaSCharles Keepax 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
62940843aeaSCharles Keepax 
63040843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(EQ1, "EQ1"),
63140843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(EQ2, "EQ2"),
63240843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(EQ3, "EQ3"),
63340843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(EQ4, "EQ4"),
63440843aeaSCharles Keepax 
63540843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(DRC1L, "DRC1L"),
63640843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(DRC1R, "DRC1R"),
63740843aeaSCharles Keepax 
63840843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(LHPF1, "LHPF1"),
63940843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(LHPF2, "LHPF2"),
64040843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(LHPF3, "LHPF3"),
64140843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(LHPF4, "LHPF4"),
64240843aeaSCharles Keepax 
64340843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(Mic, "Mic"),
64440843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(Noise, "Noise"),
64540843aeaSCharles Keepax 
64640843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(PWM1, "PWM1"),
64740843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(PWM2, "PWM2"),
64840843aeaSCharles Keepax 
64940843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(OUT1L, "HPOUT1L"),
65040843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(OUT1R, "HPOUT1R"),
65140843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(OUT3, "EPOUT"),
65240843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(SPKOUT, "SPKOUT"),
65340843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(SPKDAT1L, "SPKDAT1L"),
65440843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(SPKDAT1R, "SPKDAT1R"),
65540843aeaSCharles Keepax 
65640843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(AIF1TX1, "AIF1TX1"),
65740843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(AIF1TX2, "AIF1TX2"),
65840843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(AIF1TX3, "AIF1TX3"),
65940843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(AIF1TX4, "AIF1TX4"),
66040843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(AIF1TX5, "AIF1TX5"),
66140843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(AIF1TX6, "AIF1TX6"),
66240843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(AIF1TX7, "AIF1TX7"),
66340843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(AIF1TX8, "AIF1TX8"),
66440843aeaSCharles Keepax 
66540843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(AIF2TX1, "AIF2TX1"),
66640843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(AIF2TX2, "AIF2TX2"),
66740843aeaSCharles Keepax 
66840843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(SLIMTX1, "SLIMTX1"),
66940843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(SLIMTX2, "SLIMTX2"),
67040843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(SLIMTX3, "SLIMTX3"),
67140843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(SLIMTX4, "SLIMTX4"),
67240843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(SLIMTX5, "SLIMTX5"),
67340843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(SLIMTX6, "SLIMTX6"),
67440843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(SLIMTX7, "SLIMTX7"),
67540843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(SLIMTX8, "SLIMTX8"),
67640843aeaSCharles Keepax 
67740843aeaSCharles Keepax ARIZONA_MUX_WIDGETS(ISRC1DEC1, "ISRC1DEC1"),
67840843aeaSCharles Keepax ARIZONA_MUX_WIDGETS(ISRC1DEC2, "ISRC1DEC2"),
67940843aeaSCharles Keepax 
68040843aeaSCharles Keepax ARIZONA_MUX_WIDGETS(ISRC1INT1, "ISRC1INT1"),
68140843aeaSCharles Keepax ARIZONA_MUX_WIDGETS(ISRC1INT2, "ISRC1INT2"),
68240843aeaSCharles Keepax 
68340843aeaSCharles Keepax ARIZONA_MUX_WIDGETS(ISRC2DEC1, "ISRC2DEC1"),
68440843aeaSCharles Keepax ARIZONA_MUX_WIDGETS(ISRC2DEC2, "ISRC2DEC2"),
68540843aeaSCharles Keepax 
68640843aeaSCharles Keepax ARIZONA_MUX_WIDGETS(ISRC2INT1, "ISRC2INT1"),
68740843aeaSCharles Keepax ARIZONA_MUX_WIDGETS(ISRC2INT2, "ISRC2INT2"),
68840843aeaSCharles Keepax 
68940843aeaSCharles Keepax SND_SOC_DAPM_OUTPUT("HPOUT1L"),
69040843aeaSCharles Keepax SND_SOC_DAPM_OUTPUT("HPOUT1R"),
69140843aeaSCharles Keepax SND_SOC_DAPM_OUTPUT("EPOUTN"),
69240843aeaSCharles Keepax SND_SOC_DAPM_OUTPUT("EPOUTP"),
69340843aeaSCharles Keepax SND_SOC_DAPM_OUTPUT("SPKOUTN"),
69440843aeaSCharles Keepax SND_SOC_DAPM_OUTPUT("SPKOUTP"),
69540843aeaSCharles Keepax SND_SOC_DAPM_OUTPUT("SPKDAT1L"),
69640843aeaSCharles Keepax SND_SOC_DAPM_OUTPUT("SPKDAT1R"),
69740843aeaSCharles Keepax 
69840843aeaSCharles Keepax SND_SOC_DAPM_OUTPUT("MICSUPP"),
69940843aeaSCharles Keepax };
70040843aeaSCharles Keepax 
70140843aeaSCharles Keepax #define ARIZONA_MIXER_INPUT_ROUTES(name)	\
70240843aeaSCharles Keepax 	{ name, "Noise Generator", "Noise Generator" }, \
70340843aeaSCharles Keepax 	{ name, "Tone Generator 1", "Tone Generator 1" }, \
70440843aeaSCharles Keepax 	{ name, "Tone Generator 2", "Tone Generator 2" }, \
70540843aeaSCharles Keepax 	{ name, "Haptics", "HAPTICS" }, \
70640843aeaSCharles Keepax 	{ name, "AEC", "AEC Loopback" }, \
70740843aeaSCharles Keepax 	{ name, "IN1L", "IN1L PGA" }, \
70840843aeaSCharles Keepax 	{ name, "IN1R", "IN1R PGA" }, \
70940843aeaSCharles Keepax 	{ name, "IN2L", "IN2L PGA" }, \
71040843aeaSCharles Keepax 	{ name, "IN2R", "IN2R PGA" }, \
71140843aeaSCharles Keepax 	{ name, "Mic Mute Mixer", "Mic Mute Mixer" }, \
71240843aeaSCharles Keepax 	{ name, "AIF1RX1", "AIF1RX1" }, \
71340843aeaSCharles Keepax 	{ name, "AIF1RX2", "AIF1RX2" }, \
71440843aeaSCharles Keepax 	{ name, "AIF1RX3", "AIF1RX3" }, \
71540843aeaSCharles Keepax 	{ name, "AIF1RX4", "AIF1RX4" }, \
71640843aeaSCharles Keepax 	{ name, "AIF1RX5", "AIF1RX5" }, \
71740843aeaSCharles Keepax 	{ name, "AIF1RX6", "AIF1RX6" }, \
71840843aeaSCharles Keepax 	{ name, "AIF1RX7", "AIF1RX7" }, \
71940843aeaSCharles Keepax 	{ name, "AIF1RX8", "AIF1RX8" }, \
72040843aeaSCharles Keepax 	{ name, "AIF2RX1", "AIF2RX1" }, \
72140843aeaSCharles Keepax 	{ name, "AIF2RX2", "AIF2RX2" }, \
72240843aeaSCharles Keepax 	{ name, "SLIMRX1", "SLIMRX1" }, \
72340843aeaSCharles Keepax 	{ name, "SLIMRX2", "SLIMRX2" }, \
72440843aeaSCharles Keepax 	{ name, "SLIMRX3", "SLIMRX3" }, \
72540843aeaSCharles Keepax 	{ name, "SLIMRX4", "SLIMRX4" }, \
72640843aeaSCharles Keepax 	{ name, "SLIMRX5", "SLIMRX5" }, \
72740843aeaSCharles Keepax 	{ name, "SLIMRX6", "SLIMRX6" }, \
72840843aeaSCharles Keepax 	{ name, "SLIMRX7", "SLIMRX7" }, \
72940843aeaSCharles Keepax 	{ name, "SLIMRX8", "SLIMRX8" }, \
73040843aeaSCharles Keepax 	{ name, "EQ1", "EQ1" }, \
73140843aeaSCharles Keepax 	{ name, "EQ2", "EQ2" }, \
73240843aeaSCharles Keepax 	{ name, "EQ3", "EQ3" }, \
73340843aeaSCharles Keepax 	{ name, "EQ4", "EQ4" }, \
73440843aeaSCharles Keepax 	{ name, "DRC1L", "DRC1L" }, \
73540843aeaSCharles Keepax 	{ name, "DRC1R", "DRC1R" }, \
73640843aeaSCharles Keepax 	{ name, "LHPF1", "LHPF1" }, \
73740843aeaSCharles Keepax 	{ name, "LHPF2", "LHPF2" }, \
73840843aeaSCharles Keepax 	{ name, "LHPF3", "LHPF3" }, \
73940843aeaSCharles Keepax 	{ name, "LHPF4", "LHPF4" }, \
74040843aeaSCharles Keepax 	{ name, "ISRC1DEC1", "ISRC1DEC1" }, \
74140843aeaSCharles Keepax 	{ name, "ISRC1DEC2", "ISRC1DEC2" }, \
74240843aeaSCharles Keepax 	{ name, "ISRC1INT1", "ISRC1INT1" }, \
74340843aeaSCharles Keepax 	{ name, "ISRC1INT2", "ISRC1INT2" }, \
74440843aeaSCharles Keepax 	{ name, "ISRC2DEC1", "ISRC2DEC1" }, \
74540843aeaSCharles Keepax 	{ name, "ISRC2DEC2", "ISRC2DEC2" }, \
74640843aeaSCharles Keepax 	{ name, "ISRC2INT1", "ISRC2INT1" }, \
74740843aeaSCharles Keepax 	{ name, "ISRC2INT2", "ISRC2INT2" }
74840843aeaSCharles Keepax 
74940843aeaSCharles Keepax static const struct snd_soc_dapm_route wm8997_dapm_routes[] = {
75040843aeaSCharles Keepax 	{ "AIF2 Capture", NULL, "DBVDD2" },
75140843aeaSCharles Keepax 	{ "AIF2 Playback", NULL, "DBVDD2" },
75240843aeaSCharles Keepax 
75340843aeaSCharles Keepax 	{ "OUT1L", NULL, "CPVDD" },
75440843aeaSCharles Keepax 	{ "OUT1R", NULL, "CPVDD" },
75540843aeaSCharles Keepax 	{ "OUT3L", NULL, "CPVDD" },
75640843aeaSCharles Keepax 
75740843aeaSCharles Keepax 	{ "OUT4L", NULL, "SPKVDD" },
75840843aeaSCharles Keepax 
75940843aeaSCharles Keepax 	{ "OUT1L", NULL, "SYSCLK" },
76040843aeaSCharles Keepax 	{ "OUT1R", NULL, "SYSCLK" },
76140843aeaSCharles Keepax 	{ "OUT3L", NULL, "SYSCLK" },
76240843aeaSCharles Keepax 	{ "OUT4L", NULL, "SYSCLK" },
76340843aeaSCharles Keepax 
76440843aeaSCharles Keepax 	{ "IN1L", NULL, "SYSCLK" },
76540843aeaSCharles Keepax 	{ "IN1R", NULL, "SYSCLK" },
76640843aeaSCharles Keepax 	{ "IN2L", NULL, "SYSCLK" },
76740843aeaSCharles Keepax 	{ "IN2R", NULL, "SYSCLK" },
76840843aeaSCharles Keepax 
76940843aeaSCharles Keepax 	{ "MICBIAS1", NULL, "MICVDD" },
77040843aeaSCharles Keepax 	{ "MICBIAS2", NULL, "MICVDD" },
77140843aeaSCharles Keepax 	{ "MICBIAS3", NULL, "MICVDD" },
77240843aeaSCharles Keepax 
77340843aeaSCharles Keepax 	{ "Noise Generator", NULL, "SYSCLK" },
77440843aeaSCharles Keepax 	{ "Tone Generator 1", NULL, "SYSCLK" },
77540843aeaSCharles Keepax 	{ "Tone Generator 2", NULL, "SYSCLK" },
77640843aeaSCharles Keepax 
77740843aeaSCharles Keepax 	{ "Noise Generator", NULL, "NOISE" },
77840843aeaSCharles Keepax 	{ "Tone Generator 1", NULL, "TONE" },
77940843aeaSCharles Keepax 	{ "Tone Generator 2", NULL, "TONE" },
78040843aeaSCharles Keepax 
78140843aeaSCharles Keepax 	{ "AIF1 Capture", NULL, "AIF1TX1" },
78240843aeaSCharles Keepax 	{ "AIF1 Capture", NULL, "AIF1TX2" },
78340843aeaSCharles Keepax 	{ "AIF1 Capture", NULL, "AIF1TX3" },
78440843aeaSCharles Keepax 	{ "AIF1 Capture", NULL, "AIF1TX4" },
78540843aeaSCharles Keepax 	{ "AIF1 Capture", NULL, "AIF1TX5" },
78640843aeaSCharles Keepax 	{ "AIF1 Capture", NULL, "AIF1TX6" },
78740843aeaSCharles Keepax 	{ "AIF1 Capture", NULL, "AIF1TX7" },
78840843aeaSCharles Keepax 	{ "AIF1 Capture", NULL, "AIF1TX8" },
78940843aeaSCharles Keepax 
79040843aeaSCharles Keepax 	{ "AIF1RX1", NULL, "AIF1 Playback" },
79140843aeaSCharles Keepax 	{ "AIF1RX2", NULL, "AIF1 Playback" },
79240843aeaSCharles Keepax 	{ "AIF1RX3", NULL, "AIF1 Playback" },
79340843aeaSCharles Keepax 	{ "AIF1RX4", NULL, "AIF1 Playback" },
79440843aeaSCharles Keepax 	{ "AIF1RX5", NULL, "AIF1 Playback" },
79540843aeaSCharles Keepax 	{ "AIF1RX6", NULL, "AIF1 Playback" },
79640843aeaSCharles Keepax 	{ "AIF1RX7", NULL, "AIF1 Playback" },
79740843aeaSCharles Keepax 	{ "AIF1RX8", NULL, "AIF1 Playback" },
79840843aeaSCharles Keepax 
79940843aeaSCharles Keepax 	{ "AIF2 Capture", NULL, "AIF2TX1" },
80040843aeaSCharles Keepax 	{ "AIF2 Capture", NULL, "AIF2TX2" },
80140843aeaSCharles Keepax 
80240843aeaSCharles Keepax 	{ "AIF2RX1", NULL, "AIF2 Playback" },
80340843aeaSCharles Keepax 	{ "AIF2RX2", NULL, "AIF2 Playback" },
80440843aeaSCharles Keepax 
80540843aeaSCharles Keepax 	{ "Slim1 Capture", NULL, "SLIMTX1" },
80640843aeaSCharles Keepax 	{ "Slim1 Capture", NULL, "SLIMTX2" },
80740843aeaSCharles Keepax 	{ "Slim1 Capture", NULL, "SLIMTX3" },
80840843aeaSCharles Keepax 	{ "Slim1 Capture", NULL, "SLIMTX4" },
80940843aeaSCharles Keepax 
81040843aeaSCharles Keepax 	{ "SLIMRX1", NULL, "Slim1 Playback" },
81140843aeaSCharles Keepax 	{ "SLIMRX2", NULL, "Slim1 Playback" },
81240843aeaSCharles Keepax 	{ "SLIMRX3", NULL, "Slim1 Playback" },
81340843aeaSCharles Keepax 	{ "SLIMRX4", NULL, "Slim1 Playback" },
81440843aeaSCharles Keepax 
81540843aeaSCharles Keepax 	{ "Slim2 Capture", NULL, "SLIMTX5" },
81640843aeaSCharles Keepax 	{ "Slim2 Capture", NULL, "SLIMTX6" },
81740843aeaSCharles Keepax 
81840843aeaSCharles Keepax 	{ "SLIMRX5", NULL, "Slim2 Playback" },
81940843aeaSCharles Keepax 	{ "SLIMRX6", NULL, "Slim2 Playback" },
82040843aeaSCharles Keepax 
82140843aeaSCharles Keepax 	{ "Slim3 Capture", NULL, "SLIMTX7" },
82240843aeaSCharles Keepax 	{ "Slim3 Capture", NULL, "SLIMTX8" },
82340843aeaSCharles Keepax 
82440843aeaSCharles Keepax 	{ "SLIMRX7", NULL, "Slim3 Playback" },
82540843aeaSCharles Keepax 	{ "SLIMRX8", NULL, "Slim3 Playback" },
82640843aeaSCharles Keepax 
82740843aeaSCharles Keepax 	{ "AIF1 Playback", NULL, "SYSCLK" },
82840843aeaSCharles Keepax 	{ "AIF2 Playback", NULL, "SYSCLK" },
82940843aeaSCharles Keepax 	{ "Slim1 Playback", NULL, "SYSCLK" },
83040843aeaSCharles Keepax 	{ "Slim2 Playback", NULL, "SYSCLK" },
83140843aeaSCharles Keepax 	{ "Slim3 Playback", NULL, "SYSCLK" },
83240843aeaSCharles Keepax 
83340843aeaSCharles Keepax 	{ "AIF1 Capture", NULL, "SYSCLK" },
83440843aeaSCharles Keepax 	{ "AIF2 Capture", NULL, "SYSCLK" },
83540843aeaSCharles Keepax 	{ "Slim1 Capture", NULL, "SYSCLK" },
83640843aeaSCharles Keepax 	{ "Slim2 Capture", NULL, "SYSCLK" },
83740843aeaSCharles Keepax 	{ "Slim3 Capture", NULL, "SYSCLK" },
83840843aeaSCharles Keepax 
83940843aeaSCharles Keepax 	{ "IN1L PGA", NULL, "IN1L" },
84040843aeaSCharles Keepax 	{ "IN1R PGA", NULL, "IN1R" },
84140843aeaSCharles Keepax 
84240843aeaSCharles Keepax 	{ "IN2L PGA", NULL, "IN2L" },
84340843aeaSCharles Keepax 	{ "IN2R PGA", NULL, "IN2R" },
84440843aeaSCharles Keepax 
84540843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("OUT1L", "HPOUT1L"),
84640843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("OUT1R", "HPOUT1R"),
84740843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("OUT3L", "EPOUT"),
84840843aeaSCharles Keepax 
84940843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("OUT4L", "SPKOUT"),
85040843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("OUT5L", "SPKDAT1L"),
85140843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("OUT5R", "SPKDAT1R"),
85240843aeaSCharles Keepax 
85340843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("PWM1 Driver", "PWM1"),
85440843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("PWM2 Driver", "PWM2"),
85540843aeaSCharles Keepax 
85640843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("AIF1TX1", "AIF1TX1"),
85740843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("AIF1TX2", "AIF1TX2"),
85840843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("AIF1TX3", "AIF1TX3"),
85940843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("AIF1TX4", "AIF1TX4"),
86040843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("AIF1TX5", "AIF1TX5"),
86140843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("AIF1TX6", "AIF1TX6"),
86240843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("AIF1TX7", "AIF1TX7"),
86340843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("AIF1TX8", "AIF1TX8"),
86440843aeaSCharles Keepax 
86540843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("AIF2TX1", "AIF2TX1"),
86640843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("AIF2TX2", "AIF2TX2"),
86740843aeaSCharles Keepax 
86840843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("SLIMTX1", "SLIMTX1"),
86940843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("SLIMTX2", "SLIMTX2"),
87040843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("SLIMTX3", "SLIMTX3"),
87140843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("SLIMTX4", "SLIMTX4"),
87240843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("SLIMTX5", "SLIMTX5"),
87340843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("SLIMTX6", "SLIMTX6"),
87440843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("SLIMTX7", "SLIMTX7"),
87540843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("SLIMTX8", "SLIMTX8"),
87640843aeaSCharles Keepax 
87740843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("EQ1", "EQ1"),
87840843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("EQ2", "EQ2"),
87940843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("EQ3", "EQ3"),
88040843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("EQ4", "EQ4"),
88140843aeaSCharles Keepax 
88240843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("DRC1L", "DRC1L"),
88340843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("DRC1R", "DRC1R"),
88440843aeaSCharles Keepax 
88540843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("LHPF1", "LHPF1"),
88640843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("LHPF2", "LHPF2"),
88740843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("LHPF3", "LHPF3"),
88840843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("LHPF4", "LHPF4"),
88940843aeaSCharles Keepax 
890c5efb38aSMark Brown 	ARIZONA_MIXER_ROUTES("Mic Mute Mixer", "Noise"),
891c5efb38aSMark Brown 	ARIZONA_MIXER_ROUTES("Mic Mute Mixer", "Mic"),
892c5efb38aSMark Brown 
89340843aeaSCharles Keepax 	ARIZONA_MUX_ROUTES("ISRC1INT1", "ISRC1INT1"),
894f4cdb6b4SCharles Keepax 	ARIZONA_MUX_ROUTES("ISRC1INT2", "ISRC1INT2"),
89540843aeaSCharles Keepax 
89640843aeaSCharles Keepax 	ARIZONA_MUX_ROUTES("ISRC1DEC1", "ISRC1DEC1"),
89740843aeaSCharles Keepax 	ARIZONA_MUX_ROUTES("ISRC1DEC2", "ISRC1DEC2"),
89840843aeaSCharles Keepax 
89940843aeaSCharles Keepax 	ARIZONA_MUX_ROUTES("ISRC2INT1", "ISRC2INT1"),
90040843aeaSCharles Keepax 	ARIZONA_MUX_ROUTES("ISRC2INT2", "ISRC2INT2"),
90140843aeaSCharles Keepax 
90240843aeaSCharles Keepax 	ARIZONA_MUX_ROUTES("ISRC2DEC1", "ISRC2DEC1"),
90340843aeaSCharles Keepax 	ARIZONA_MUX_ROUTES("ISRC2DEC2", "ISRC2DEC2"),
90440843aeaSCharles Keepax 
90540843aeaSCharles Keepax 	{ "AEC Loopback", "HPOUT1L", "OUT1L" },
90640843aeaSCharles Keepax 	{ "AEC Loopback", "HPOUT1R", "OUT1R" },
90740843aeaSCharles Keepax 	{ "HPOUT1L", NULL, "OUT1L" },
90840843aeaSCharles Keepax 	{ "HPOUT1R", NULL, "OUT1R" },
90940843aeaSCharles Keepax 
91040843aeaSCharles Keepax 	{ "AEC Loopback", "EPOUT", "OUT3L" },
91140843aeaSCharles Keepax 	{ "EPOUTN", NULL, "OUT3L" },
91240843aeaSCharles Keepax 	{ "EPOUTP", NULL, "OUT3L" },
91340843aeaSCharles Keepax 
91440843aeaSCharles Keepax 	{ "AEC Loopback", "SPKOUT", "OUT4L" },
91540843aeaSCharles Keepax 	{ "SPKOUTN", NULL, "OUT4L" },
91640843aeaSCharles Keepax 	{ "SPKOUTP", NULL, "OUT4L" },
91740843aeaSCharles Keepax 
91840843aeaSCharles Keepax 	{ "AEC Loopback", "SPKDAT1L", "OUT5L" },
91940843aeaSCharles Keepax 	{ "AEC Loopback", "SPKDAT1R", "OUT5R" },
92040843aeaSCharles Keepax 	{ "SPKDAT1L", NULL, "OUT5L" },
92140843aeaSCharles Keepax 	{ "SPKDAT1R", NULL, "OUT5R" },
92240843aeaSCharles Keepax 
92340843aeaSCharles Keepax 	{ "MICSUPP", NULL, "SYSCLK" },
92440843aeaSCharles Keepax };
92540843aeaSCharles Keepax 
wm8997_set_fll(struct snd_soc_component * component,int fll_id,int source,unsigned int Fref,unsigned int Fout)9267dd0f7caSCharles Keepax static int wm8997_set_fll(struct snd_soc_component *component, int fll_id,
9277dd0f7caSCharles Keepax 			  int source, unsigned int Fref, unsigned int Fout)
92840843aeaSCharles Keepax {
9290fe1daa6SKuninori Morimoto 	struct wm8997_priv *wm8997 = snd_soc_component_get_drvdata(component);
93040843aeaSCharles Keepax 
93140843aeaSCharles Keepax 	switch (fll_id) {
93240843aeaSCharles Keepax 	case WM8997_FLL1:
93340843aeaSCharles Keepax 		return arizona_set_fll(&wm8997->fll[0], source, Fref, Fout);
93440843aeaSCharles Keepax 	case WM8997_FLL2:
93540843aeaSCharles Keepax 		return arizona_set_fll(&wm8997->fll[1], source, Fref, Fout);
93640843aeaSCharles Keepax 	case WM8997_FLL1_REFCLK:
93740843aeaSCharles Keepax 		return arizona_set_fll_refclk(&wm8997->fll[0], source, Fref,
93840843aeaSCharles Keepax 					      Fout);
93940843aeaSCharles Keepax 	case WM8997_FLL2_REFCLK:
94040843aeaSCharles Keepax 		return arizona_set_fll_refclk(&wm8997->fll[1], source, Fref,
94140843aeaSCharles Keepax 					      Fout);
94240843aeaSCharles Keepax 	default:
94340843aeaSCharles Keepax 		return -EINVAL;
94440843aeaSCharles Keepax 	}
94540843aeaSCharles Keepax }
94640843aeaSCharles Keepax 
947d81221ffSCharles Keepax #define WM8997_RATES SNDRV_PCM_RATE_KNOT
94840843aeaSCharles Keepax 
94940843aeaSCharles Keepax #define WM8997_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
95040843aeaSCharles Keepax 			SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)
95140843aeaSCharles Keepax 
95240843aeaSCharles Keepax static struct snd_soc_dai_driver wm8997_dai[] = {
95340843aeaSCharles Keepax 	{
95440843aeaSCharles Keepax 		.name = "wm8997-aif1",
95540843aeaSCharles Keepax 		.id = 1,
95640843aeaSCharles Keepax 		.base = ARIZONA_AIF1_BCLK_CTRL,
95740843aeaSCharles Keepax 		.playback = {
95840843aeaSCharles Keepax 			.stream_name = "AIF1 Playback",
95940843aeaSCharles Keepax 			.channels_min = 1,
96040843aeaSCharles Keepax 			.channels_max = 8,
96140843aeaSCharles Keepax 			.rates = WM8997_RATES,
96240843aeaSCharles Keepax 			.formats = WM8997_FORMATS,
96340843aeaSCharles Keepax 		},
96440843aeaSCharles Keepax 		.capture = {
96540843aeaSCharles Keepax 			 .stream_name = "AIF1 Capture",
96640843aeaSCharles Keepax 			 .channels_min = 1,
96740843aeaSCharles Keepax 			 .channels_max = 8,
96840843aeaSCharles Keepax 			 .rates = WM8997_RATES,
96940843aeaSCharles Keepax 			 .formats = WM8997_FORMATS,
97040843aeaSCharles Keepax 		 },
97140843aeaSCharles Keepax 		.ops = &arizona_dai_ops,
97207695752SKuninori Morimoto 		.symmetric_rate = 1,
97307695752SKuninori Morimoto 		.symmetric_sample_bits = 1,
97440843aeaSCharles Keepax 	},
97540843aeaSCharles Keepax 	{
97640843aeaSCharles Keepax 		.name = "wm8997-aif2",
97740843aeaSCharles Keepax 		.id = 2,
97840843aeaSCharles Keepax 		.base = ARIZONA_AIF2_BCLK_CTRL,
97940843aeaSCharles Keepax 		.playback = {
98040843aeaSCharles Keepax 			.stream_name = "AIF2 Playback",
98140843aeaSCharles Keepax 			.channels_min = 1,
98240843aeaSCharles Keepax 			.channels_max = 2,
98340843aeaSCharles Keepax 			.rates = WM8997_RATES,
98440843aeaSCharles Keepax 			.formats = WM8997_FORMATS,
98540843aeaSCharles Keepax 		},
98640843aeaSCharles Keepax 		.capture = {
98740843aeaSCharles Keepax 			 .stream_name = "AIF2 Capture",
98840843aeaSCharles Keepax 			 .channels_min = 1,
98940843aeaSCharles Keepax 			 .channels_max = 2,
99040843aeaSCharles Keepax 			 .rates = WM8997_RATES,
99140843aeaSCharles Keepax 			 .formats = WM8997_FORMATS,
99240843aeaSCharles Keepax 		 },
99340843aeaSCharles Keepax 		.ops = &arizona_dai_ops,
99407695752SKuninori Morimoto 		.symmetric_rate = 1,
99507695752SKuninori Morimoto 		.symmetric_sample_bits = 1,
99640843aeaSCharles Keepax 	},
99740843aeaSCharles Keepax 	{
99840843aeaSCharles Keepax 		.name = "wm8997-slim1",
99940843aeaSCharles Keepax 		.id = 3,
100040843aeaSCharles Keepax 		.playback = {
100140843aeaSCharles Keepax 			.stream_name = "Slim1 Playback",
100240843aeaSCharles Keepax 			.channels_min = 1,
100340843aeaSCharles Keepax 			.channels_max = 4,
100440843aeaSCharles Keepax 			.rates = WM8997_RATES,
100540843aeaSCharles Keepax 			.formats = WM8997_FORMATS,
100640843aeaSCharles Keepax 		},
100740843aeaSCharles Keepax 		.capture = {
100840843aeaSCharles Keepax 			.stream_name = "Slim1 Capture",
100940843aeaSCharles Keepax 			.channels_min = 1,
101040843aeaSCharles Keepax 			.channels_max = 4,
101140843aeaSCharles Keepax 			.rates = WM8997_RATES,
101240843aeaSCharles Keepax 			.formats = WM8997_FORMATS,
101340843aeaSCharles Keepax 		},
101440843aeaSCharles Keepax 		.ops = &arizona_simple_dai_ops,
101540843aeaSCharles Keepax 	},
101640843aeaSCharles Keepax 	{
101740843aeaSCharles Keepax 		.name = "wm8997-slim2",
101840843aeaSCharles Keepax 		.id = 4,
101940843aeaSCharles Keepax 		.playback = {
102040843aeaSCharles Keepax 			.stream_name = "Slim2 Playback",
102140843aeaSCharles Keepax 			.channels_min = 1,
102240843aeaSCharles Keepax 			.channels_max = 2,
102340843aeaSCharles Keepax 			.rates = WM8997_RATES,
102440843aeaSCharles Keepax 			.formats = WM8997_FORMATS,
102540843aeaSCharles Keepax 		},
102640843aeaSCharles Keepax 		.capture = {
102740843aeaSCharles Keepax 			.stream_name = "Slim2 Capture",
102840843aeaSCharles Keepax 			.channels_min = 1,
102940843aeaSCharles Keepax 			.channels_max = 2,
103040843aeaSCharles Keepax 			.rates = WM8997_RATES,
103140843aeaSCharles Keepax 			.formats = WM8997_FORMATS,
103240843aeaSCharles Keepax 		},
103340843aeaSCharles Keepax 		.ops = &arizona_simple_dai_ops,
103440843aeaSCharles Keepax 	},
103540843aeaSCharles Keepax 	{
103640843aeaSCharles Keepax 		.name = "wm8997-slim3",
103740843aeaSCharles Keepax 		.id = 5,
103840843aeaSCharles Keepax 		.playback = {
103940843aeaSCharles Keepax 			.stream_name = "Slim3 Playback",
104040843aeaSCharles Keepax 			.channels_min = 1,
104140843aeaSCharles Keepax 			.channels_max = 2,
104240843aeaSCharles Keepax 			.rates = WM8997_RATES,
104340843aeaSCharles Keepax 			.formats = WM8997_FORMATS,
104440843aeaSCharles Keepax 		},
104540843aeaSCharles Keepax 		.capture = {
104640843aeaSCharles Keepax 			.stream_name = "Slim3 Capture",
104740843aeaSCharles Keepax 			.channels_min = 1,
104840843aeaSCharles Keepax 			.channels_max = 2,
104940843aeaSCharles Keepax 			.rates = WM8997_RATES,
105040843aeaSCharles Keepax 			.formats = WM8997_FORMATS,
105140843aeaSCharles Keepax 		},
105240843aeaSCharles Keepax 		.ops = &arizona_simple_dai_ops,
105340843aeaSCharles Keepax 	},
105440843aeaSCharles Keepax };
105540843aeaSCharles Keepax 
wm8997_component_probe(struct snd_soc_component * component)10560fe1daa6SKuninori Morimoto static int wm8997_component_probe(struct snd_soc_component *component)
105740843aeaSCharles Keepax {
10580fe1daa6SKuninori Morimoto 	struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
10590fe1daa6SKuninori Morimoto 	struct wm8997_priv *priv = snd_soc_component_get_drvdata(component);
10601e4a36afSKuninori Morimoto 	struct arizona *arizona = priv->core.arizona;
1061acff07d0SCharles Keepax 	int ret;
106240843aeaSCharles Keepax 
10630fe1daa6SKuninori Morimoto 	snd_soc_component_init_regmap(component, arizona->regmap);
10641e4a36afSKuninori Morimoto 
10650fe1daa6SKuninori Morimoto 	ret = arizona_init_spk(component);
1066acff07d0SCharles Keepax 	if (ret < 0)
1067acff07d0SCharles Keepax 		return ret;
1068acff07d0SCharles Keepax 
106935f4403eSRichard Fitzgerald 	snd_soc_component_disable_pin(component, "HAPTICS");
107040843aeaSCharles Keepax 
10718383dfd8SLars-Peter Clausen 	priv->core.arizona->dapm = dapm;
107240843aeaSCharles Keepax 
107340843aeaSCharles Keepax 	return 0;
107440843aeaSCharles Keepax }
107540843aeaSCharles Keepax 
wm8997_component_remove(struct snd_soc_component * component)10760fe1daa6SKuninori Morimoto static void wm8997_component_remove(struct snd_soc_component *component)
107740843aeaSCharles Keepax {
10780fe1daa6SKuninori Morimoto 	struct wm8997_priv *priv = snd_soc_component_get_drvdata(component);
107940843aeaSCharles Keepax 
108040843aeaSCharles Keepax 	priv->core.arizona->dapm = NULL;
108140843aeaSCharles Keepax }
108240843aeaSCharles Keepax 
108340843aeaSCharles Keepax #define WM8997_DIG_VU 0x0200
108440843aeaSCharles Keepax 
108540843aeaSCharles Keepax static unsigned int wm8997_digital_vu[] = {
108640843aeaSCharles Keepax 	ARIZONA_DAC_DIGITAL_VOLUME_1L,
108740843aeaSCharles Keepax 	ARIZONA_DAC_DIGITAL_VOLUME_1R,
108840843aeaSCharles Keepax 	ARIZONA_DAC_DIGITAL_VOLUME_3L,
108940843aeaSCharles Keepax 	ARIZONA_DAC_DIGITAL_VOLUME_4L,
109040843aeaSCharles Keepax 	ARIZONA_DAC_DIGITAL_VOLUME_5L,
109140843aeaSCharles Keepax 	ARIZONA_DAC_DIGITAL_VOLUME_5R,
109240843aeaSCharles Keepax };
109340843aeaSCharles Keepax 
10940fe1daa6SKuninori Morimoto static const struct snd_soc_component_driver soc_component_dev_wm8997 = {
10950fe1daa6SKuninori Morimoto 	.probe			= wm8997_component_probe,
10960fe1daa6SKuninori Morimoto 	.remove			= wm8997_component_remove,
109740843aeaSCharles Keepax 	.set_sysclk		= arizona_set_sysclk,
109840843aeaSCharles Keepax 	.set_pll		= wm8997_set_fll,
109937dbabf1SHans de Goede 	.set_jack		= arizona_jack_set_jack,
110040843aeaSCharles Keepax 	.controls		= wm8997_snd_controls,
110140843aeaSCharles Keepax 	.num_controls		= ARRAY_SIZE(wm8997_snd_controls),
110240843aeaSCharles Keepax 	.dapm_widgets		= wm8997_dapm_widgets,
110340843aeaSCharles Keepax 	.num_dapm_widgets	= ARRAY_SIZE(wm8997_dapm_widgets),
110440843aeaSCharles Keepax 	.dapm_routes		= wm8997_dapm_routes,
110540843aeaSCharles Keepax 	.num_dapm_routes	= ARRAY_SIZE(wm8997_dapm_routes),
11060fe1daa6SKuninori Morimoto 	.use_pmdown_time	= 1,
11070fe1daa6SKuninori Morimoto 	.endianness		= 1,
110840843aeaSCharles Keepax };
110940843aeaSCharles Keepax 
wm8997_probe(struct platform_device * pdev)111040843aeaSCharles Keepax static int wm8997_probe(struct platform_device *pdev)
111140843aeaSCharles Keepax {
111240843aeaSCharles Keepax 	struct arizona *arizona = dev_get_drvdata(pdev->dev.parent);
111340843aeaSCharles Keepax 	struct wm8997_priv *wm8997;
111431833eadSCharles Keepax 	int i, ret;
111540843aeaSCharles Keepax 
111640843aeaSCharles Keepax 	wm8997 = devm_kzalloc(&pdev->dev, sizeof(struct wm8997_priv),
111740843aeaSCharles Keepax 			      GFP_KERNEL);
111840843aeaSCharles Keepax 	if (wm8997 == NULL)
111940843aeaSCharles Keepax 		return -ENOMEM;
112040843aeaSCharles Keepax 	platform_set_drvdata(pdev, wm8997);
112140843aeaSCharles Keepax 
11220a229b15SCharles Keepax 	if (IS_ENABLED(CONFIG_OF)) {
11230a229b15SCharles Keepax 		if (!dev_get_platdata(arizona->dev)) {
11240a229b15SCharles Keepax 			ret = arizona_of_get_audio_pdata(arizona);
11250a229b15SCharles Keepax 			if (ret < 0)
11260a229b15SCharles Keepax 				return ret;
11270a229b15SCharles Keepax 		}
11280a229b15SCharles Keepax 	}
11290a229b15SCharles Keepax 
113040843aeaSCharles Keepax 	wm8997->core.arizona = arizona;
113140843aeaSCharles Keepax 	wm8997->core.num_inputs = 4;
113240843aeaSCharles Keepax 
1133346d9683SRichard Fitzgerald 	arizona_init_dvfs(&wm8997->core);
1134346d9683SRichard Fitzgerald 
113537dbabf1SHans de Goede 	/* This may return -EPROBE_DEFER, so do this early on */
113637dbabf1SHans de Goede 	ret = arizona_jack_codec_dev_probe(&wm8997->core, &pdev->dev);
113737dbabf1SHans de Goede 	if (ret)
113837dbabf1SHans de Goede 		return ret;
113937dbabf1SHans de Goede 
114040843aeaSCharles Keepax 	for (i = 0; i < ARRAY_SIZE(wm8997->fll); i++)
114140843aeaSCharles Keepax 		wm8997->fll[i].vco_mult = 1;
114240843aeaSCharles Keepax 
114340843aeaSCharles Keepax 	arizona_init_fll(arizona, 1, ARIZONA_FLL1_CONTROL_1 - 1,
114440843aeaSCharles Keepax 			 ARIZONA_IRQ_FLL1_LOCK, ARIZONA_IRQ_FLL1_CLOCK_OK,
114540843aeaSCharles Keepax 			 &wm8997->fll[0]);
114640843aeaSCharles Keepax 	arizona_init_fll(arizona, 2, ARIZONA_FLL2_CONTROL_1 - 1,
114740843aeaSCharles Keepax 			 ARIZONA_IRQ_FLL2_LOCK, ARIZONA_IRQ_FLL2_CLOCK_OK,
114840843aeaSCharles Keepax 			 &wm8997->fll[1]);
114940843aeaSCharles Keepax 
115040843aeaSCharles Keepax 	/* SR2 fixed at 8kHz, SR3 fixed at 16kHz */
115140843aeaSCharles Keepax 	regmap_update_bits(arizona->regmap, ARIZONA_SAMPLE_RATE_2,
115240843aeaSCharles Keepax 			   ARIZONA_SAMPLE_RATE_2_MASK, 0x11);
115340843aeaSCharles Keepax 	regmap_update_bits(arizona->regmap, ARIZONA_SAMPLE_RATE_3,
115440843aeaSCharles Keepax 			   ARIZONA_SAMPLE_RATE_3_MASK, 0x12);
115540843aeaSCharles Keepax 
115640843aeaSCharles Keepax 	for (i = 0; i < ARRAY_SIZE(wm8997_dai); i++)
115740843aeaSCharles Keepax 		arizona_init_dai(&wm8997->core, i);
115840843aeaSCharles Keepax 
115940843aeaSCharles Keepax 	/* Latch volume update bits */
116040843aeaSCharles Keepax 	for (i = 0; i < ARRAY_SIZE(wm8997_digital_vu); i++)
116140843aeaSCharles Keepax 		regmap_update_bits(arizona->regmap, wm8997_digital_vu[i],
116240843aeaSCharles Keepax 				   WM8997_DIG_VU, WM8997_DIG_VU);
116340843aeaSCharles Keepax 
116468ce83e3SZhang Qilong 	pm_runtime_enable(&pdev->dev);
116568ce83e3SZhang Qilong 	pm_runtime_idle(&pdev->dev);
116668ce83e3SZhang Qilong 
11679e3f9f36SCharles Keepax 	arizona_init_common(arizona);
11689e3f9f36SCharles Keepax 
116985e7dd3fSCharles Keepax 	ret = arizona_init_vol_limit(arizona);
117085e7dd3fSCharles Keepax 	if (ret < 0)
117137dbabf1SHans de Goede 		goto err_jack_codec_dev;
117231833eadSCharles Keepax 	ret = arizona_init_spk_irqs(arizona);
117331833eadSCharles Keepax 	if (ret < 0)
117437dbabf1SHans de Goede 		goto err_jack_codec_dev;
117531833eadSCharles Keepax 
11760fe1daa6SKuninori Morimoto 	ret = devm_snd_soc_register_component(&pdev->dev,
11770fe1daa6SKuninori Morimoto 					      &soc_component_dev_wm8997,
11787dd0f7caSCharles Keepax 					      wm8997_dai,
11797dd0f7caSCharles Keepax 					      ARRAY_SIZE(wm8997_dai));
118031833eadSCharles Keepax 	if (ret < 0) {
11810fe1daa6SKuninori Morimoto 		dev_err(&pdev->dev, "Failed to register component: %d\n", ret);
118231833eadSCharles Keepax 		goto err_spk_irqs;
118331833eadSCharles Keepax 	}
118431833eadSCharles Keepax 
11855e7aace1SZhang Qilong 	return ret;
11865e7aace1SZhang Qilong 
118731833eadSCharles Keepax err_spk_irqs:
118831833eadSCharles Keepax 	arizona_free_spk_irqs(arizona);
118937dbabf1SHans de Goede err_jack_codec_dev:
1190fdabc3f1SZhang Qilong 	pm_runtime_disable(&pdev->dev);
119137dbabf1SHans de Goede 	arizona_jack_codec_dev_remove(&wm8997->core);
119231833eadSCharles Keepax 
119331833eadSCharles Keepax 	return ret;
119440843aeaSCharles Keepax }
119540843aeaSCharles Keepax 
wm8997_remove(struct platform_device * pdev)1196e1df73dfSUwe Kleine-König static void wm8997_remove(struct platform_device *pdev)
119740843aeaSCharles Keepax {
119831833eadSCharles Keepax 	struct wm8997_priv *wm8997 = platform_get_drvdata(pdev);
119931833eadSCharles Keepax 	struct arizona *arizona = wm8997->core.arizona;
120031833eadSCharles Keepax 
120140843aeaSCharles Keepax 	pm_runtime_disable(&pdev->dev);
120240843aeaSCharles Keepax 
120331833eadSCharles Keepax 	arizona_free_spk_irqs(arizona);
120431833eadSCharles Keepax 
120537dbabf1SHans de Goede 	arizona_jack_codec_dev_remove(&wm8997->core);
120640843aeaSCharles Keepax }
120740843aeaSCharles Keepax 
120840843aeaSCharles Keepax static struct platform_driver wm8997_codec_driver = {
120940843aeaSCharles Keepax 	.driver = {
121040843aeaSCharles Keepax 		.name = "wm8997-codec",
121140843aeaSCharles Keepax 	},
121240843aeaSCharles Keepax 	.probe = wm8997_probe,
1213*130af75bSUwe Kleine-König 	.remove = wm8997_remove,
121440843aeaSCharles Keepax };
121540843aeaSCharles Keepax 
121640843aeaSCharles Keepax module_platform_driver(wm8997_codec_driver);
121740843aeaSCharles Keepax 
121840843aeaSCharles Keepax MODULE_DESCRIPTION("ASoC WM8997 driver");
121940843aeaSCharles Keepax MODULE_AUTHOR("Charles Keepax <ckeepax@opensource.wolfsonmicro.com>");
122040843aeaSCharles Keepax MODULE_LICENSE("GPL");
122140843aeaSCharles Keepax MODULE_ALIAS("platform:wm8997-codec");
1222