xref: /linux/sound/soc/codecs/wm8997.c (revision 85e7dd3f871b988702973c80d9ef128e10dd3dad)
140843aeaSCharles Keepax /*
240843aeaSCharles Keepax  * wm8997.c  --  WM8997 ALSA SoC Audio driver
340843aeaSCharles Keepax  *
440843aeaSCharles Keepax  * Copyright 2012 Wolfson Microelectronics plc
540843aeaSCharles Keepax  *
640843aeaSCharles Keepax  * Author: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
740843aeaSCharles Keepax  *
840843aeaSCharles Keepax  * This program is free software; you can redistribute it and/or modify
940843aeaSCharles Keepax  * it under the terms of the GNU General Public License version 2 as
1040843aeaSCharles Keepax  * published by the Free Software Foundation.
1140843aeaSCharles Keepax  */
1240843aeaSCharles Keepax 
1340843aeaSCharles Keepax #include <linux/module.h>
1440843aeaSCharles Keepax #include <linux/moduleparam.h>
1540843aeaSCharles Keepax #include <linux/init.h>
1640843aeaSCharles Keepax #include <linux/delay.h>
1740843aeaSCharles Keepax #include <linux/pm.h>
1840843aeaSCharles Keepax #include <linux/pm_runtime.h>
1940843aeaSCharles Keepax #include <linux/regmap.h>
2040843aeaSCharles Keepax #include <linux/slab.h>
2140843aeaSCharles Keepax #include <sound/core.h>
2240843aeaSCharles Keepax #include <sound/pcm.h>
2340843aeaSCharles Keepax #include <sound/pcm_params.h>
2440843aeaSCharles Keepax #include <sound/soc.h>
2540843aeaSCharles Keepax #include <sound/jack.h>
2640843aeaSCharles Keepax #include <sound/initval.h>
2740843aeaSCharles Keepax #include <sound/tlv.h>
2840843aeaSCharles Keepax 
2940843aeaSCharles Keepax #include <linux/mfd/arizona/core.h>
3040843aeaSCharles Keepax #include <linux/mfd/arizona/registers.h>
3140843aeaSCharles Keepax 
3240843aeaSCharles Keepax #include "arizona.h"
3340843aeaSCharles Keepax #include "wm8997.h"
3440843aeaSCharles Keepax 
3540843aeaSCharles Keepax struct wm8997_priv {
3640843aeaSCharles Keepax 	struct arizona_priv core;
3740843aeaSCharles Keepax 	struct arizona_fll fll[2];
3840843aeaSCharles Keepax };
3940843aeaSCharles Keepax 
4040843aeaSCharles Keepax static DECLARE_TLV_DB_SCALE(ana_tlv, 0, 100, 0);
4140843aeaSCharles Keepax static DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0);
4240843aeaSCharles Keepax static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0);
4315575ed5SRichard Fitzgerald static DECLARE_TLV_DB_SCALE(noise_tlv, -13200, 600, 0);
4440843aeaSCharles Keepax static DECLARE_TLV_DB_SCALE(ng_tlv, -10200, 600, 0);
4540843aeaSCharles Keepax 
4640843aeaSCharles Keepax static const struct reg_default wm8997_sysclk_reva_patch[] = {
4740843aeaSCharles Keepax 	{ 0x301D, 0x7B15 },
4840843aeaSCharles Keepax 	{ 0x301B, 0x0050 },
4940843aeaSCharles Keepax 	{ 0x305D, 0x7B17 },
5040843aeaSCharles Keepax 	{ 0x305B, 0x0050 },
5140843aeaSCharles Keepax 	{ 0x3001, 0x08FE },
5240843aeaSCharles Keepax 	{ 0x3003, 0x00F4 },
5340843aeaSCharles Keepax 	{ 0x3041, 0x08FF },
5440843aeaSCharles Keepax 	{ 0x3043, 0x0005 },
5540843aeaSCharles Keepax 	{ 0x3020, 0x0225 },
5640843aeaSCharles Keepax 	{ 0x3021, 0x0A00 },
5740843aeaSCharles Keepax 	{ 0x3022, 0xE24D },
5840843aeaSCharles Keepax 	{ 0x3023, 0x0800 },
5940843aeaSCharles Keepax 	{ 0x3024, 0xE24D },
6040843aeaSCharles Keepax 	{ 0x3025, 0xF000 },
6140843aeaSCharles Keepax 	{ 0x3060, 0x0226 },
6240843aeaSCharles Keepax 	{ 0x3061, 0x0A00 },
6340843aeaSCharles Keepax 	{ 0x3062, 0xE252 },
6440843aeaSCharles Keepax 	{ 0x3063, 0x0800 },
6540843aeaSCharles Keepax 	{ 0x3064, 0xE252 },
6640843aeaSCharles Keepax 	{ 0x3065, 0xF000 },
6740843aeaSCharles Keepax 	{ 0x3116, 0x022B },
6840843aeaSCharles Keepax 	{ 0x3117, 0xFA00 },
6940843aeaSCharles Keepax 	{ 0x3110, 0x246C },
7040843aeaSCharles Keepax 	{ 0x3111, 0x0A03 },
7140843aeaSCharles Keepax 	{ 0x3112, 0x246E },
7240843aeaSCharles Keepax 	{ 0x3113, 0x0A03 },
7340843aeaSCharles Keepax 	{ 0x3114, 0x2470 },
7440843aeaSCharles Keepax 	{ 0x3115, 0x0A03 },
7540843aeaSCharles Keepax 	{ 0x3126, 0x246C },
7640843aeaSCharles Keepax 	{ 0x3127, 0x0A02 },
7740843aeaSCharles Keepax 	{ 0x3128, 0x246E },
7840843aeaSCharles Keepax 	{ 0x3129, 0x0A02 },
7940843aeaSCharles Keepax 	{ 0x312A, 0x2470 },
8040843aeaSCharles Keepax 	{ 0x312B, 0xFA02 },
8140843aeaSCharles Keepax 	{ 0x3125, 0x0800 },
8240843aeaSCharles Keepax };
8340843aeaSCharles Keepax 
8440843aeaSCharles Keepax static int wm8997_sysclk_ev(struct snd_soc_dapm_widget *w,
8540843aeaSCharles Keepax 			    struct snd_kcontrol *kcontrol, int event)
8640843aeaSCharles Keepax {
878643707fSLars-Peter Clausen 	struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
8840843aeaSCharles Keepax 	struct arizona *arizona = dev_get_drvdata(codec->dev->parent);
89055bbe2dSLars-Peter Clausen 	struct regmap *regmap = arizona->regmap;
9040843aeaSCharles Keepax 	const struct reg_default *patch = NULL;
9140843aeaSCharles Keepax 	int i, patch_size;
9240843aeaSCharles Keepax 
9340843aeaSCharles Keepax 	switch (arizona->rev) {
9440843aeaSCharles Keepax 	case 0:
9540843aeaSCharles Keepax 		patch = wm8997_sysclk_reva_patch;
9640843aeaSCharles Keepax 		patch_size = ARRAY_SIZE(wm8997_sysclk_reva_patch);
9740843aeaSCharles Keepax 		break;
9840843aeaSCharles Keepax 	default:
9940843aeaSCharles Keepax 		break;
10040843aeaSCharles Keepax 	}
10140843aeaSCharles Keepax 
10240843aeaSCharles Keepax 	switch (event) {
10340843aeaSCharles Keepax 	case SND_SOC_DAPM_POST_PMU:
10440843aeaSCharles Keepax 		if (patch)
10540843aeaSCharles Keepax 			for (i = 0; i < patch_size; i++)
1061f4fe272SMark Brown 				regmap_write_async(regmap, patch[i].reg,
10740843aeaSCharles Keepax 						   patch[i].def);
10840843aeaSCharles Keepax 		break;
109346d9683SRichard Fitzgerald 	case SND_SOC_DAPM_PRE_PMD:
11040843aeaSCharles Keepax 		break;
1117a4413d0SCharles Keepax 	case SND_SOC_DAPM_PRE_PMU:
1127a4413d0SCharles Keepax 	case SND_SOC_DAPM_POST_PMD:
1137a4413d0SCharles Keepax 		return arizona_clk_ev(w, kcontrol, event);
114346d9683SRichard Fitzgerald 	default:
115346d9683SRichard Fitzgerald 		return 0;
11640843aeaSCharles Keepax 	}
11740843aeaSCharles Keepax 
118346d9683SRichard Fitzgerald 	return arizona_dvfs_sysclk_ev(w, kcontrol, event);
11940843aeaSCharles Keepax }
12040843aeaSCharles Keepax 
12140843aeaSCharles Keepax static const char *wm8997_osr_text[] = {
12240843aeaSCharles Keepax 	"Low power", "Normal", "High performance",
12340843aeaSCharles Keepax };
12440843aeaSCharles Keepax 
12540843aeaSCharles Keepax static const unsigned int wm8997_osr_val[] = {
12640843aeaSCharles Keepax 	0x0, 0x3, 0x5,
12740843aeaSCharles Keepax };
12840843aeaSCharles Keepax 
12940843aeaSCharles Keepax static const struct soc_enum wm8997_hpout_osr[] = {
13040843aeaSCharles Keepax 	SOC_VALUE_ENUM_SINGLE(ARIZONA_OUTPUT_PATH_CONFIG_1L,
131347e5512STakashi Iwai 			      ARIZONA_OUT1_OSR_SHIFT, 0x7,
132347e5512STakashi Iwai 			      ARRAY_SIZE(wm8997_osr_text),
13340843aeaSCharles Keepax 			      wm8997_osr_text, wm8997_osr_val),
13440843aeaSCharles Keepax 	SOC_VALUE_ENUM_SINGLE(ARIZONA_OUTPUT_PATH_CONFIG_3L,
135347e5512STakashi Iwai 			      ARIZONA_OUT3_OSR_SHIFT, 0x7,
136347e5512STakashi Iwai 			      ARRAY_SIZE(wm8997_osr_text),
13740843aeaSCharles Keepax 			      wm8997_osr_text, wm8997_osr_val),
13840843aeaSCharles Keepax };
13940843aeaSCharles Keepax 
14040843aeaSCharles Keepax #define WM8997_NG_SRC(name, base) \
14140843aeaSCharles Keepax 	SOC_SINGLE(name " NG HPOUT1L Switch",  base, 0, 1, 0), \
14240843aeaSCharles Keepax 	SOC_SINGLE(name " NG HPOUT1R Switch",  base, 1, 1, 0), \
14340843aeaSCharles Keepax 	SOC_SINGLE(name " NG EPOUT Switch",    base, 4, 1, 0), \
14440843aeaSCharles Keepax 	SOC_SINGLE(name " NG SPKOUT Switch",   base, 6, 1, 0), \
14540843aeaSCharles Keepax 	SOC_SINGLE(name " NG SPKDAT1L Switch", base, 8, 1, 0), \
14640843aeaSCharles Keepax 	SOC_SINGLE(name " NG SPKDAT1R Switch", base, 9, 1, 0)
14740843aeaSCharles Keepax 
14840843aeaSCharles Keepax static const struct snd_kcontrol_new wm8997_snd_controls[] = {
14940843aeaSCharles Keepax SOC_SINGLE("IN1 High Performance Switch", ARIZONA_IN1L_CONTROL,
15040843aeaSCharles Keepax 	   ARIZONA_IN1_OSR_SHIFT, 1, 0),
15140843aeaSCharles Keepax SOC_SINGLE("IN2 High Performance Switch", ARIZONA_IN2L_CONTROL,
15240843aeaSCharles Keepax 	   ARIZONA_IN2_OSR_SHIFT, 1, 0),
15340843aeaSCharles Keepax 
15440843aeaSCharles Keepax SOC_SINGLE_RANGE_TLV("IN1L Volume", ARIZONA_IN1L_CONTROL,
15540843aeaSCharles Keepax 		     ARIZONA_IN1L_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv),
15640843aeaSCharles Keepax SOC_SINGLE_RANGE_TLV("IN1R Volume", ARIZONA_IN1R_CONTROL,
15740843aeaSCharles Keepax 		     ARIZONA_IN1R_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv),
15840843aeaSCharles Keepax SOC_SINGLE_RANGE_TLV("IN2L Volume", ARIZONA_IN2L_CONTROL,
15940843aeaSCharles Keepax 		     ARIZONA_IN2L_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv),
16040843aeaSCharles Keepax SOC_SINGLE_RANGE_TLV("IN2R Volume", ARIZONA_IN2R_CONTROL,
16140843aeaSCharles Keepax 		     ARIZONA_IN2R_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv),
16240843aeaSCharles Keepax 
16340843aeaSCharles Keepax SOC_SINGLE_TLV("IN1L Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_1L,
16440843aeaSCharles Keepax 	       ARIZONA_IN1L_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
16540843aeaSCharles Keepax SOC_SINGLE_TLV("IN1R Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_1R,
16640843aeaSCharles Keepax 	       ARIZONA_IN1R_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
16740843aeaSCharles Keepax SOC_SINGLE_TLV("IN2L Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_2L,
16840843aeaSCharles Keepax 	       ARIZONA_IN2L_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
16940843aeaSCharles Keepax SOC_SINGLE_TLV("IN2R Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_2R,
17040843aeaSCharles Keepax 	       ARIZONA_IN2R_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
17140843aeaSCharles Keepax 
17240843aeaSCharles Keepax SOC_ENUM("Input Ramp Up", arizona_in_vi_ramp),
17340843aeaSCharles Keepax SOC_ENUM("Input Ramp Down", arizona_in_vd_ramp),
17440843aeaSCharles Keepax 
17540843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("EQ1", ARIZONA_EQ1MIX_INPUT_1_SOURCE),
17640843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("EQ2", ARIZONA_EQ2MIX_INPUT_1_SOURCE),
17740843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("EQ3", ARIZONA_EQ3MIX_INPUT_1_SOURCE),
17840843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("EQ4", ARIZONA_EQ4MIX_INPUT_1_SOURCE),
17940843aeaSCharles Keepax 
180c05d9a8cSCharles Keepax ARIZONA_EQ_CONTROL("EQ1 Coefficients", ARIZONA_EQ1_2),
18140843aeaSCharles Keepax SOC_SINGLE_TLV("EQ1 B1 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B1_GAIN_SHIFT,
18240843aeaSCharles Keepax 	       24, 0, eq_tlv),
18340843aeaSCharles Keepax SOC_SINGLE_TLV("EQ1 B2 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B2_GAIN_SHIFT,
18440843aeaSCharles Keepax 	       24, 0, eq_tlv),
18540843aeaSCharles Keepax SOC_SINGLE_TLV("EQ1 B3 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B3_GAIN_SHIFT,
18640843aeaSCharles Keepax 	       24, 0, eq_tlv),
18740843aeaSCharles Keepax SOC_SINGLE_TLV("EQ1 B4 Volume", ARIZONA_EQ1_2, ARIZONA_EQ1_B4_GAIN_SHIFT,
18840843aeaSCharles Keepax 	       24, 0, eq_tlv),
18940843aeaSCharles Keepax SOC_SINGLE_TLV("EQ1 B5 Volume", ARIZONA_EQ1_2, ARIZONA_EQ1_B5_GAIN_SHIFT,
19040843aeaSCharles Keepax 	       24, 0, eq_tlv),
19140843aeaSCharles Keepax 
192c05d9a8cSCharles Keepax ARIZONA_EQ_CONTROL("EQ2 Coefficients", ARIZONA_EQ2_2),
19340843aeaSCharles Keepax SOC_SINGLE_TLV("EQ2 B1 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B1_GAIN_SHIFT,
19440843aeaSCharles Keepax 	       24, 0, eq_tlv),
19540843aeaSCharles Keepax SOC_SINGLE_TLV("EQ2 B2 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B2_GAIN_SHIFT,
19640843aeaSCharles Keepax 	       24, 0, eq_tlv),
19740843aeaSCharles Keepax SOC_SINGLE_TLV("EQ2 B3 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B3_GAIN_SHIFT,
19840843aeaSCharles Keepax 	       24, 0, eq_tlv),
19940843aeaSCharles Keepax SOC_SINGLE_TLV("EQ2 B4 Volume", ARIZONA_EQ2_2, ARIZONA_EQ2_B4_GAIN_SHIFT,
20040843aeaSCharles Keepax 	       24, 0, eq_tlv),
20140843aeaSCharles Keepax SOC_SINGLE_TLV("EQ2 B5 Volume", ARIZONA_EQ2_2, ARIZONA_EQ2_B5_GAIN_SHIFT,
20240843aeaSCharles Keepax 	       24, 0, eq_tlv),
20340843aeaSCharles Keepax 
204c05d9a8cSCharles Keepax ARIZONA_EQ_CONTROL("EQ3 Coefficients", ARIZONA_EQ3_2),
20540843aeaSCharles Keepax SOC_SINGLE_TLV("EQ3 B1 Volume", ARIZONA_EQ3_1, ARIZONA_EQ3_B1_GAIN_SHIFT,
20640843aeaSCharles Keepax 	       24, 0, eq_tlv),
20740843aeaSCharles Keepax SOC_SINGLE_TLV("EQ3 B2 Volume", ARIZONA_EQ3_1, ARIZONA_EQ3_B2_GAIN_SHIFT,
20840843aeaSCharles Keepax 	       24, 0, eq_tlv),
20940843aeaSCharles Keepax SOC_SINGLE_TLV("EQ3 B3 Volume", ARIZONA_EQ3_1, ARIZONA_EQ3_B3_GAIN_SHIFT,
21040843aeaSCharles Keepax 	       24, 0, eq_tlv),
21140843aeaSCharles Keepax SOC_SINGLE_TLV("EQ3 B4 Volume", ARIZONA_EQ3_2, ARIZONA_EQ3_B4_GAIN_SHIFT,
21240843aeaSCharles Keepax 	       24, 0, eq_tlv),
21340843aeaSCharles Keepax SOC_SINGLE_TLV("EQ3 B5 Volume", ARIZONA_EQ3_2, ARIZONA_EQ3_B5_GAIN_SHIFT,
21440843aeaSCharles Keepax 	       24, 0, eq_tlv),
21540843aeaSCharles Keepax 
216c05d9a8cSCharles Keepax ARIZONA_EQ_CONTROL("EQ4 Coefficients", ARIZONA_EQ4_2),
21740843aeaSCharles Keepax SOC_SINGLE_TLV("EQ4 B1 Volume", ARIZONA_EQ4_1, ARIZONA_EQ4_B1_GAIN_SHIFT,
21840843aeaSCharles Keepax 	       24, 0, eq_tlv),
21940843aeaSCharles Keepax SOC_SINGLE_TLV("EQ4 B2 Volume", ARIZONA_EQ4_1, ARIZONA_EQ4_B2_GAIN_SHIFT,
22040843aeaSCharles Keepax 	       24, 0, eq_tlv),
22140843aeaSCharles Keepax SOC_SINGLE_TLV("EQ4 B3 Volume", ARIZONA_EQ4_1, ARIZONA_EQ4_B3_GAIN_SHIFT,
22240843aeaSCharles Keepax 	       24, 0, eq_tlv),
22340843aeaSCharles Keepax SOC_SINGLE_TLV("EQ4 B4 Volume", ARIZONA_EQ4_2, ARIZONA_EQ4_B4_GAIN_SHIFT,
22440843aeaSCharles Keepax 	       24, 0, eq_tlv),
22540843aeaSCharles Keepax SOC_SINGLE_TLV("EQ4 B5 Volume", ARIZONA_EQ4_2, ARIZONA_EQ4_B5_GAIN_SHIFT,
22640843aeaSCharles Keepax 	       24, 0, eq_tlv),
22740843aeaSCharles Keepax 
22840843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("DRC1L", ARIZONA_DRC1LMIX_INPUT_1_SOURCE),
22940843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("DRC1R", ARIZONA_DRC1RMIX_INPUT_1_SOURCE),
23040843aeaSCharles Keepax 
23140843aeaSCharles Keepax SND_SOC_BYTES_MASK("DRC1", ARIZONA_DRC1_CTRL1, 5,
23240843aeaSCharles Keepax 		   ARIZONA_DRC1R_ENA | ARIZONA_DRC1L_ENA),
23340843aeaSCharles Keepax 
23440843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("LHPF1", ARIZONA_HPLP1MIX_INPUT_1_SOURCE),
23540843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("LHPF2", ARIZONA_HPLP2MIX_INPUT_1_SOURCE),
23640843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("LHPF3", ARIZONA_HPLP3MIX_INPUT_1_SOURCE),
23740843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("LHPF4", ARIZONA_HPLP4MIX_INPUT_1_SOURCE),
23840843aeaSCharles Keepax 
23940843aeaSCharles Keepax SOC_ENUM("LHPF1 Mode", arizona_lhpf1_mode),
24040843aeaSCharles Keepax SOC_ENUM("LHPF2 Mode", arizona_lhpf2_mode),
24140843aeaSCharles Keepax SOC_ENUM("LHPF3 Mode", arizona_lhpf3_mode),
24240843aeaSCharles Keepax SOC_ENUM("LHPF4 Mode", arizona_lhpf4_mode),
24340843aeaSCharles Keepax 
2445f8e671aSCharles Keepax ARIZONA_LHPF_CONTROL("LHPF1 Coefficients", ARIZONA_HPLPF1_2),
2455f8e671aSCharles Keepax ARIZONA_LHPF_CONTROL("LHPF2 Coefficients", ARIZONA_HPLPF2_2),
2465f8e671aSCharles Keepax ARIZONA_LHPF_CONTROL("LHPF3 Coefficients", ARIZONA_HPLPF3_2),
2475f8e671aSCharles Keepax ARIZONA_LHPF_CONTROL("LHPF4 Coefficients", ARIZONA_HPLPF4_2),
24840843aeaSCharles Keepax 
2499de98da2SLars-Peter Clausen SOC_ENUM("ISRC1 FSL", arizona_isrc_fsl[0]),
2509de98da2SLars-Peter Clausen SOC_ENUM("ISRC2 FSL", arizona_isrc_fsl[1]),
25140843aeaSCharles Keepax 
25240843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("Mic", ARIZONA_MICMIX_INPUT_1_SOURCE),
25340843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("Noise", ARIZONA_NOISEMIX_INPUT_1_SOURCE),
25440843aeaSCharles Keepax 
25540843aeaSCharles Keepax SOC_SINGLE_TLV("Noise Generator Volume", ARIZONA_COMFORT_NOISE_GENERATOR,
25640843aeaSCharles Keepax 	       ARIZONA_NOISE_GEN_GAIN_SHIFT, 0x16, 0, noise_tlv),
25740843aeaSCharles Keepax 
25840843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("HPOUT1L", ARIZONA_OUT1LMIX_INPUT_1_SOURCE),
25940843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("HPOUT1R", ARIZONA_OUT1RMIX_INPUT_1_SOURCE),
26040843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("EPOUT", ARIZONA_OUT3LMIX_INPUT_1_SOURCE),
26140843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("SPKOUT", ARIZONA_OUT4LMIX_INPUT_1_SOURCE),
26240843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("SPKDAT1L", ARIZONA_OUT5LMIX_INPUT_1_SOURCE),
26340843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("SPKDAT1R", ARIZONA_OUT5RMIX_INPUT_1_SOURCE),
26440843aeaSCharles Keepax 
26540843aeaSCharles Keepax SOC_SINGLE("Speaker High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_4L,
26640843aeaSCharles Keepax 	   ARIZONA_OUT4_OSR_SHIFT, 1, 0),
26740843aeaSCharles Keepax SOC_SINGLE("SPKDAT1 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_5L,
26840843aeaSCharles Keepax 	   ARIZONA_OUT5_OSR_SHIFT, 1, 0),
26940843aeaSCharles Keepax 
27040843aeaSCharles Keepax SOC_DOUBLE_R("HPOUT1 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_1L,
27140843aeaSCharles Keepax 	     ARIZONA_DAC_DIGITAL_VOLUME_1R, ARIZONA_OUT1L_MUTE_SHIFT, 1, 1),
27240843aeaSCharles Keepax SOC_SINGLE("EPOUT Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_3L,
27340843aeaSCharles Keepax 	   ARIZONA_OUT3L_MUTE_SHIFT, 1, 1),
27440843aeaSCharles Keepax SOC_SINGLE("Speaker Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_4L,
27540843aeaSCharles Keepax 	   ARIZONA_OUT4L_MUTE_SHIFT, 1, 1),
27640843aeaSCharles Keepax SOC_DOUBLE_R("SPKDAT1 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_5L,
27740843aeaSCharles Keepax 	     ARIZONA_DAC_DIGITAL_VOLUME_5R, ARIZONA_OUT5L_MUTE_SHIFT, 1, 1),
27840843aeaSCharles Keepax 
27940843aeaSCharles Keepax SOC_DOUBLE_R_TLV("HPOUT1 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_1L,
28040843aeaSCharles Keepax 		 ARIZONA_DAC_DIGITAL_VOLUME_1R, ARIZONA_OUT1L_VOL_SHIFT,
28140843aeaSCharles Keepax 		 0xbf, 0, digital_tlv),
28240843aeaSCharles Keepax SOC_SINGLE_TLV("EPOUT Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_3L,
28340843aeaSCharles Keepax 	       ARIZONA_OUT3L_VOL_SHIFT, 0xbf, 0, digital_tlv),
28440843aeaSCharles Keepax SOC_SINGLE_TLV("Speaker Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_4L,
28540843aeaSCharles Keepax 	       ARIZONA_OUT4L_VOL_SHIFT, 0xbf, 0, digital_tlv),
28640843aeaSCharles Keepax SOC_DOUBLE_R_TLV("SPKDAT1 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_5L,
28740843aeaSCharles Keepax 		 ARIZONA_DAC_DIGITAL_VOLUME_5R, ARIZONA_OUT5L_VOL_SHIFT,
28840843aeaSCharles Keepax 		 0xbf, 0, digital_tlv),
28940843aeaSCharles Keepax 
2909de98da2SLars-Peter Clausen SOC_ENUM("HPOUT1 OSR", wm8997_hpout_osr[0]),
2919de98da2SLars-Peter Clausen SOC_ENUM("EPOUT OSR", wm8997_hpout_osr[1]),
29240843aeaSCharles Keepax 
29340843aeaSCharles Keepax SOC_ENUM("Output Ramp Up", arizona_out_vi_ramp),
29440843aeaSCharles Keepax SOC_ENUM("Output Ramp Down", arizona_out_vd_ramp),
29540843aeaSCharles Keepax 
29640843aeaSCharles Keepax SOC_DOUBLE("SPKDAT1 Switch", ARIZONA_PDM_SPK1_CTRL_1, ARIZONA_SPK1L_MUTE_SHIFT,
29740843aeaSCharles Keepax 	   ARIZONA_SPK1R_MUTE_SHIFT, 1, 1),
29840843aeaSCharles Keepax 
29940843aeaSCharles Keepax SOC_SINGLE("Noise Gate Switch", ARIZONA_NOISE_GATE_CONTROL,
30040843aeaSCharles Keepax 	   ARIZONA_NGATE_ENA_SHIFT, 1, 0),
30140843aeaSCharles Keepax SOC_SINGLE_TLV("Noise Gate Threshold Volume", ARIZONA_NOISE_GATE_CONTROL,
30240843aeaSCharles Keepax 	       ARIZONA_NGATE_THR_SHIFT, 7, 1, ng_tlv),
30340843aeaSCharles Keepax SOC_ENUM("Noise Gate Hold", arizona_ng_hold),
30440843aeaSCharles Keepax 
30540843aeaSCharles Keepax WM8997_NG_SRC("HPOUT1L", ARIZONA_NOISE_GATE_SELECT_1L),
30640843aeaSCharles Keepax WM8997_NG_SRC("HPOUT1R", ARIZONA_NOISE_GATE_SELECT_1R),
30740843aeaSCharles Keepax WM8997_NG_SRC("EPOUT", ARIZONA_NOISE_GATE_SELECT_3L),
30840843aeaSCharles Keepax WM8997_NG_SRC("SPKOUT", ARIZONA_NOISE_GATE_SELECT_4L),
30940843aeaSCharles Keepax WM8997_NG_SRC("SPKDAT1L", ARIZONA_NOISE_GATE_SELECT_5L),
31040843aeaSCharles Keepax WM8997_NG_SRC("SPKDAT1R", ARIZONA_NOISE_GATE_SELECT_5R),
31140843aeaSCharles Keepax 
31240843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("AIF1TX1", ARIZONA_AIF1TX1MIX_INPUT_1_SOURCE),
31340843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("AIF1TX2", ARIZONA_AIF1TX2MIX_INPUT_1_SOURCE),
31440843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("AIF1TX3", ARIZONA_AIF1TX3MIX_INPUT_1_SOURCE),
31540843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("AIF1TX4", ARIZONA_AIF1TX4MIX_INPUT_1_SOURCE),
31640843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("AIF1TX5", ARIZONA_AIF1TX5MIX_INPUT_1_SOURCE),
31740843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("AIF1TX6", ARIZONA_AIF1TX6MIX_INPUT_1_SOURCE),
31840843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("AIF1TX7", ARIZONA_AIF1TX7MIX_INPUT_1_SOURCE),
31940843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("AIF1TX8", ARIZONA_AIF1TX8MIX_INPUT_1_SOURCE),
32040843aeaSCharles Keepax 
32140843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("AIF2TX1", ARIZONA_AIF2TX1MIX_INPUT_1_SOURCE),
32240843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("AIF2TX2", ARIZONA_AIF2TX2MIX_INPUT_1_SOURCE),
32340843aeaSCharles Keepax 
32440843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("SLIMTX1", ARIZONA_SLIMTX1MIX_INPUT_1_SOURCE),
32540843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("SLIMTX2", ARIZONA_SLIMTX2MIX_INPUT_1_SOURCE),
32640843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("SLIMTX3", ARIZONA_SLIMTX3MIX_INPUT_1_SOURCE),
32740843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("SLIMTX4", ARIZONA_SLIMTX4MIX_INPUT_1_SOURCE),
32840843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("SLIMTX5", ARIZONA_SLIMTX5MIX_INPUT_1_SOURCE),
32940843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("SLIMTX6", ARIZONA_SLIMTX6MIX_INPUT_1_SOURCE),
33040843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("SLIMTX7", ARIZONA_SLIMTX7MIX_INPUT_1_SOURCE),
33140843aeaSCharles Keepax ARIZONA_MIXER_CONTROLS("SLIMTX8", ARIZONA_SLIMTX8MIX_INPUT_1_SOURCE),
33240843aeaSCharles Keepax };
33340843aeaSCharles Keepax 
33440843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(EQ1, ARIZONA_EQ1MIX_INPUT_1_SOURCE);
33540843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(EQ2, ARIZONA_EQ2MIX_INPUT_1_SOURCE);
33640843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(EQ3, ARIZONA_EQ3MIX_INPUT_1_SOURCE);
33740843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(EQ4, ARIZONA_EQ4MIX_INPUT_1_SOURCE);
33840843aeaSCharles Keepax 
33940843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(DRC1L, ARIZONA_DRC1LMIX_INPUT_1_SOURCE);
34040843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(DRC1R, ARIZONA_DRC1RMIX_INPUT_1_SOURCE);
34140843aeaSCharles Keepax 
34240843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(LHPF1, ARIZONA_HPLP1MIX_INPUT_1_SOURCE);
34340843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(LHPF2, ARIZONA_HPLP2MIX_INPUT_1_SOURCE);
34440843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(LHPF3, ARIZONA_HPLP3MIX_INPUT_1_SOURCE);
34540843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(LHPF4, ARIZONA_HPLP4MIX_INPUT_1_SOURCE);
34640843aeaSCharles Keepax 
34740843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(Mic, ARIZONA_MICMIX_INPUT_1_SOURCE);
34840843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(Noise, ARIZONA_NOISEMIX_INPUT_1_SOURCE);
34940843aeaSCharles Keepax 
35040843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(PWM1, ARIZONA_PWM1MIX_INPUT_1_SOURCE);
35140843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(PWM2, ARIZONA_PWM2MIX_INPUT_1_SOURCE);
35240843aeaSCharles Keepax 
35340843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(OUT1L, ARIZONA_OUT1LMIX_INPUT_1_SOURCE);
35440843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(OUT1R, ARIZONA_OUT1RMIX_INPUT_1_SOURCE);
35540843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(OUT3, ARIZONA_OUT3LMIX_INPUT_1_SOURCE);
35640843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(SPKOUT, ARIZONA_OUT4LMIX_INPUT_1_SOURCE);
35740843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(SPKDAT1L, ARIZONA_OUT5LMIX_INPUT_1_SOURCE);
35840843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(SPKDAT1R, ARIZONA_OUT5RMIX_INPUT_1_SOURCE);
35940843aeaSCharles Keepax 
36040843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(AIF1TX1, ARIZONA_AIF1TX1MIX_INPUT_1_SOURCE);
36140843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(AIF1TX2, ARIZONA_AIF1TX2MIX_INPUT_1_SOURCE);
36240843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(AIF1TX3, ARIZONA_AIF1TX3MIX_INPUT_1_SOURCE);
36340843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(AIF1TX4, ARIZONA_AIF1TX4MIX_INPUT_1_SOURCE);
36440843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(AIF1TX5, ARIZONA_AIF1TX5MIX_INPUT_1_SOURCE);
36540843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(AIF1TX6, ARIZONA_AIF1TX6MIX_INPUT_1_SOURCE);
36640843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(AIF1TX7, ARIZONA_AIF1TX7MIX_INPUT_1_SOURCE);
36740843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(AIF1TX8, ARIZONA_AIF1TX8MIX_INPUT_1_SOURCE);
36840843aeaSCharles Keepax 
36940843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(AIF2TX1, ARIZONA_AIF2TX1MIX_INPUT_1_SOURCE);
37040843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(AIF2TX2, ARIZONA_AIF2TX2MIX_INPUT_1_SOURCE);
37140843aeaSCharles Keepax 
37240843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(SLIMTX1, ARIZONA_SLIMTX1MIX_INPUT_1_SOURCE);
37340843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(SLIMTX2, ARIZONA_SLIMTX2MIX_INPUT_1_SOURCE);
37440843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(SLIMTX3, ARIZONA_SLIMTX3MIX_INPUT_1_SOURCE);
37540843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(SLIMTX4, ARIZONA_SLIMTX4MIX_INPUT_1_SOURCE);
37640843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(SLIMTX5, ARIZONA_SLIMTX5MIX_INPUT_1_SOURCE);
37740843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(SLIMTX6, ARIZONA_SLIMTX6MIX_INPUT_1_SOURCE);
37840843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(SLIMTX7, ARIZONA_SLIMTX7MIX_INPUT_1_SOURCE);
37940843aeaSCharles Keepax ARIZONA_MIXER_ENUMS(SLIMTX8, ARIZONA_SLIMTX8MIX_INPUT_1_SOURCE);
38040843aeaSCharles Keepax 
38140843aeaSCharles Keepax ARIZONA_MUX_ENUMS(ISRC1INT1, ARIZONA_ISRC1INT1MIX_INPUT_1_SOURCE);
38240843aeaSCharles Keepax ARIZONA_MUX_ENUMS(ISRC1INT2, ARIZONA_ISRC1INT2MIX_INPUT_1_SOURCE);
38340843aeaSCharles Keepax 
38440843aeaSCharles Keepax ARIZONA_MUX_ENUMS(ISRC1DEC1, ARIZONA_ISRC1DEC1MIX_INPUT_1_SOURCE);
38540843aeaSCharles Keepax ARIZONA_MUX_ENUMS(ISRC1DEC2, ARIZONA_ISRC1DEC2MIX_INPUT_1_SOURCE);
38640843aeaSCharles Keepax 
38740843aeaSCharles Keepax ARIZONA_MUX_ENUMS(ISRC2INT1, ARIZONA_ISRC2INT1MIX_INPUT_1_SOURCE);
38840843aeaSCharles Keepax ARIZONA_MUX_ENUMS(ISRC2INT2, ARIZONA_ISRC2INT2MIX_INPUT_1_SOURCE);
38940843aeaSCharles Keepax 
39040843aeaSCharles Keepax ARIZONA_MUX_ENUMS(ISRC2DEC1, ARIZONA_ISRC2DEC1MIX_INPUT_1_SOURCE);
39140843aeaSCharles Keepax ARIZONA_MUX_ENUMS(ISRC2DEC2, ARIZONA_ISRC2DEC2MIX_INPUT_1_SOURCE);
39240843aeaSCharles Keepax 
39340843aeaSCharles Keepax static const char *wm8997_aec_loopback_texts[] = {
39440843aeaSCharles Keepax 	"HPOUT1L", "HPOUT1R", "EPOUT", "SPKOUT", "SPKDAT1L", "SPKDAT1R",
39540843aeaSCharles Keepax };
39640843aeaSCharles Keepax 
39740843aeaSCharles Keepax static const unsigned int wm8997_aec_loopback_values[] = {
39840843aeaSCharles Keepax 	0, 1, 4, 6, 8, 9,
39940843aeaSCharles Keepax };
40040843aeaSCharles Keepax 
40140843aeaSCharles Keepax static const struct soc_enum wm8997_aec_loopback =
40240843aeaSCharles Keepax 	SOC_VALUE_ENUM_SINGLE(ARIZONA_DAC_AEC_CONTROL_1,
40340843aeaSCharles Keepax 			      ARIZONA_AEC_LOOPBACK_SRC_SHIFT, 0xf,
40440843aeaSCharles Keepax 			      ARRAY_SIZE(wm8997_aec_loopback_texts),
40540843aeaSCharles Keepax 			      wm8997_aec_loopback_texts,
40640843aeaSCharles Keepax 			      wm8997_aec_loopback_values);
40740843aeaSCharles Keepax 
40840843aeaSCharles Keepax static const struct snd_kcontrol_new wm8997_aec_loopback_mux =
409e13dd8ceSLars-Peter Clausen 	SOC_DAPM_ENUM("AEC Loopback", wm8997_aec_loopback);
41040843aeaSCharles Keepax 
41140843aeaSCharles Keepax static const struct snd_soc_dapm_widget wm8997_dapm_widgets[] = {
41240843aeaSCharles Keepax SND_SOC_DAPM_SUPPLY("SYSCLK", ARIZONA_SYSTEM_CLOCK_1, ARIZONA_SYSCLK_ENA_SHIFT,
413346d9683SRichard Fitzgerald 		    0, wm8997_sysclk_ev,
4147a4413d0SCharles Keepax 		    SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD |
4157a4413d0SCharles Keepax 		    SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
41640843aeaSCharles Keepax SND_SOC_DAPM_SUPPLY("ASYNCCLK", ARIZONA_ASYNC_CLOCK_1,
4177a4413d0SCharles Keepax 		    ARIZONA_ASYNC_CLK_ENA_SHIFT, 0, arizona_clk_ev,
4187a4413d0SCharles Keepax 		    SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
41940843aeaSCharles Keepax SND_SOC_DAPM_SUPPLY("OPCLK", ARIZONA_OUTPUT_SYSTEM_CLOCK,
42040843aeaSCharles Keepax 		    ARIZONA_OPCLK_ENA_SHIFT, 0, NULL, 0),
42140843aeaSCharles Keepax SND_SOC_DAPM_SUPPLY("ASYNCOPCLK", ARIZONA_OUTPUT_ASYNC_CLOCK,
42240843aeaSCharles Keepax 		    ARIZONA_OPCLK_ASYNC_ENA_SHIFT, 0, NULL, 0),
42340843aeaSCharles Keepax 
42440843aeaSCharles Keepax SND_SOC_DAPM_REGULATOR_SUPPLY("DBVDD2", 0, 0),
42540843aeaSCharles Keepax SND_SOC_DAPM_REGULATOR_SUPPLY("CPVDD", 20, 0),
42640843aeaSCharles Keepax SND_SOC_DAPM_REGULATOR_SUPPLY("MICVDD", 0, SND_SOC_DAPM_REGULATOR_BYPASS),
42740843aeaSCharles Keepax SND_SOC_DAPM_REGULATOR_SUPPLY("SPKVDD", 0, 0),
42840843aeaSCharles Keepax 
42940843aeaSCharles Keepax SND_SOC_DAPM_SIGGEN("TONE"),
43040843aeaSCharles Keepax SND_SOC_DAPM_SIGGEN("NOISE"),
43140843aeaSCharles Keepax SND_SOC_DAPM_SIGGEN("HAPTICS"),
43240843aeaSCharles Keepax 
43340843aeaSCharles Keepax SND_SOC_DAPM_INPUT("IN1L"),
43440843aeaSCharles Keepax SND_SOC_DAPM_INPUT("IN1R"),
43540843aeaSCharles Keepax SND_SOC_DAPM_INPUT("IN2L"),
43640843aeaSCharles Keepax SND_SOC_DAPM_INPUT("IN2R"),
43740843aeaSCharles Keepax 
43840843aeaSCharles Keepax SND_SOC_DAPM_PGA_E("IN1L PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN1L_ENA_SHIFT,
43940843aeaSCharles Keepax 		   0, NULL, 0, arizona_in_ev,
44040843aeaSCharles Keepax 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
44140843aeaSCharles Keepax 		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
44240843aeaSCharles Keepax SND_SOC_DAPM_PGA_E("IN1R PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN1R_ENA_SHIFT,
44340843aeaSCharles Keepax 		   0, NULL, 0, arizona_in_ev,
44440843aeaSCharles Keepax 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
44540843aeaSCharles Keepax 		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
44640843aeaSCharles Keepax SND_SOC_DAPM_PGA_E("IN2L PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN2L_ENA_SHIFT,
44740843aeaSCharles Keepax 		   0, NULL, 0, arizona_in_ev,
44840843aeaSCharles Keepax 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
44940843aeaSCharles Keepax 		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
45040843aeaSCharles Keepax SND_SOC_DAPM_PGA_E("IN2R PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN2R_ENA_SHIFT,
45140843aeaSCharles Keepax 		   0, NULL, 0, arizona_in_ev,
45240843aeaSCharles Keepax 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
45340843aeaSCharles Keepax 		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
45440843aeaSCharles Keepax 
45540843aeaSCharles Keepax SND_SOC_DAPM_SUPPLY("MICBIAS1", ARIZONA_MIC_BIAS_CTRL_1,
45640843aeaSCharles Keepax 		    ARIZONA_MICB1_ENA_SHIFT, 0, NULL, 0),
45740843aeaSCharles Keepax SND_SOC_DAPM_SUPPLY("MICBIAS2", ARIZONA_MIC_BIAS_CTRL_2,
45840843aeaSCharles Keepax 		    ARIZONA_MICB2_ENA_SHIFT, 0, NULL, 0),
45940843aeaSCharles Keepax SND_SOC_DAPM_SUPPLY("MICBIAS3", ARIZONA_MIC_BIAS_CTRL_3,
46040843aeaSCharles Keepax 		    ARIZONA_MICB3_ENA_SHIFT, 0, NULL, 0),
46140843aeaSCharles Keepax 
46240843aeaSCharles Keepax SND_SOC_DAPM_PGA("Noise Generator", ARIZONA_COMFORT_NOISE_GENERATOR,
46340843aeaSCharles Keepax 		 ARIZONA_NOISE_GEN_ENA_SHIFT, 0, NULL, 0),
46440843aeaSCharles Keepax 
46540843aeaSCharles Keepax SND_SOC_DAPM_PGA("Tone Generator 1", ARIZONA_TONE_GENERATOR_1,
46640843aeaSCharles Keepax 		 ARIZONA_TONE1_ENA_SHIFT, 0, NULL, 0),
46740843aeaSCharles Keepax SND_SOC_DAPM_PGA("Tone Generator 2", ARIZONA_TONE_GENERATOR_1,
46840843aeaSCharles Keepax 		 ARIZONA_TONE2_ENA_SHIFT, 0, NULL, 0),
46940843aeaSCharles Keepax 
47040843aeaSCharles Keepax SND_SOC_DAPM_PGA("Mic Mute Mixer", ARIZONA_MIC_NOISE_MIX_CONTROL_1,
47140843aeaSCharles Keepax 		 ARIZONA_MICMUTE_MIX_ENA_SHIFT, 0, NULL, 0),
47240843aeaSCharles Keepax 
47340843aeaSCharles Keepax SND_SOC_DAPM_PGA("EQ1", ARIZONA_EQ1_1, ARIZONA_EQ1_ENA_SHIFT, 0, NULL, 0),
47440843aeaSCharles Keepax SND_SOC_DAPM_PGA("EQ2", ARIZONA_EQ2_1, ARIZONA_EQ2_ENA_SHIFT, 0, NULL, 0),
47540843aeaSCharles Keepax SND_SOC_DAPM_PGA("EQ3", ARIZONA_EQ3_1, ARIZONA_EQ3_ENA_SHIFT, 0, NULL, 0),
47640843aeaSCharles Keepax SND_SOC_DAPM_PGA("EQ4", ARIZONA_EQ4_1, ARIZONA_EQ4_ENA_SHIFT, 0, NULL, 0),
47740843aeaSCharles Keepax 
47840843aeaSCharles Keepax SND_SOC_DAPM_PGA("DRC1L", ARIZONA_DRC1_CTRL1, ARIZONA_DRC1L_ENA_SHIFT, 0,
47940843aeaSCharles Keepax 		 NULL, 0),
48040843aeaSCharles Keepax SND_SOC_DAPM_PGA("DRC1R", ARIZONA_DRC1_CTRL1, ARIZONA_DRC1R_ENA_SHIFT, 0,
48140843aeaSCharles Keepax 		 NULL, 0),
48240843aeaSCharles Keepax 
48340843aeaSCharles Keepax SND_SOC_DAPM_PGA("LHPF1", ARIZONA_HPLPF1_1, ARIZONA_LHPF1_ENA_SHIFT, 0,
48440843aeaSCharles Keepax 		 NULL, 0),
48540843aeaSCharles Keepax SND_SOC_DAPM_PGA("LHPF2", ARIZONA_HPLPF2_1, ARIZONA_LHPF2_ENA_SHIFT, 0,
48640843aeaSCharles Keepax 		 NULL, 0),
48740843aeaSCharles Keepax SND_SOC_DAPM_PGA("LHPF3", ARIZONA_HPLPF3_1, ARIZONA_LHPF3_ENA_SHIFT, 0,
48840843aeaSCharles Keepax 		 NULL, 0),
48940843aeaSCharles Keepax SND_SOC_DAPM_PGA("LHPF4", ARIZONA_HPLPF4_1, ARIZONA_LHPF4_ENA_SHIFT, 0,
49040843aeaSCharles Keepax 		 NULL, 0),
49140843aeaSCharles Keepax 
49240843aeaSCharles Keepax SND_SOC_DAPM_PGA("PWM1 Driver", ARIZONA_PWM_DRIVE_1, ARIZONA_PWM1_ENA_SHIFT,
49340843aeaSCharles Keepax 		 0, NULL, 0),
49440843aeaSCharles Keepax SND_SOC_DAPM_PGA("PWM2 Driver", ARIZONA_PWM_DRIVE_1, ARIZONA_PWM2_ENA_SHIFT,
49540843aeaSCharles Keepax 		 0, NULL, 0),
49640843aeaSCharles Keepax 
49740843aeaSCharles Keepax SND_SOC_DAPM_PGA("ISRC1INT1", ARIZONA_ISRC_1_CTRL_3,
49840843aeaSCharles Keepax 		 ARIZONA_ISRC1_INT0_ENA_SHIFT, 0, NULL, 0),
49940843aeaSCharles Keepax SND_SOC_DAPM_PGA("ISRC1INT2", ARIZONA_ISRC_1_CTRL_3,
50040843aeaSCharles Keepax 		 ARIZONA_ISRC1_INT1_ENA_SHIFT, 0, NULL, 0),
50140843aeaSCharles Keepax 
50240843aeaSCharles Keepax SND_SOC_DAPM_PGA("ISRC1DEC1", ARIZONA_ISRC_1_CTRL_3,
50340843aeaSCharles Keepax 		 ARIZONA_ISRC1_DEC0_ENA_SHIFT, 0, NULL, 0),
50440843aeaSCharles Keepax SND_SOC_DAPM_PGA("ISRC1DEC2", ARIZONA_ISRC_1_CTRL_3,
50540843aeaSCharles Keepax 		 ARIZONA_ISRC1_DEC1_ENA_SHIFT, 0, NULL, 0),
50640843aeaSCharles Keepax 
50740843aeaSCharles Keepax SND_SOC_DAPM_PGA("ISRC2INT1", ARIZONA_ISRC_2_CTRL_3,
50840843aeaSCharles Keepax 		 ARIZONA_ISRC2_INT0_ENA_SHIFT, 0, NULL, 0),
50940843aeaSCharles Keepax SND_SOC_DAPM_PGA("ISRC2INT2", ARIZONA_ISRC_2_CTRL_3,
51040843aeaSCharles Keepax 		 ARIZONA_ISRC2_INT1_ENA_SHIFT, 0, NULL, 0),
51140843aeaSCharles Keepax 
51240843aeaSCharles Keepax SND_SOC_DAPM_PGA("ISRC2DEC1", ARIZONA_ISRC_2_CTRL_3,
51340843aeaSCharles Keepax 		 ARIZONA_ISRC2_DEC0_ENA_SHIFT, 0, NULL, 0),
51440843aeaSCharles Keepax SND_SOC_DAPM_PGA("ISRC2DEC2", ARIZONA_ISRC_2_CTRL_3,
51540843aeaSCharles Keepax 		 ARIZONA_ISRC2_DEC1_ENA_SHIFT, 0, NULL, 0),
51640843aeaSCharles Keepax 
51740843aeaSCharles Keepax SND_SOC_DAPM_AIF_OUT("AIF1TX1", NULL, 0,
51840843aeaSCharles Keepax 		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX1_ENA_SHIFT, 0),
51940843aeaSCharles Keepax SND_SOC_DAPM_AIF_OUT("AIF1TX2", NULL, 0,
52040843aeaSCharles Keepax 		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX2_ENA_SHIFT, 0),
52140843aeaSCharles Keepax SND_SOC_DAPM_AIF_OUT("AIF1TX3", NULL, 0,
52240843aeaSCharles Keepax 		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX3_ENA_SHIFT, 0),
52340843aeaSCharles Keepax SND_SOC_DAPM_AIF_OUT("AIF1TX4", NULL, 0,
52440843aeaSCharles Keepax 		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX4_ENA_SHIFT, 0),
52540843aeaSCharles Keepax SND_SOC_DAPM_AIF_OUT("AIF1TX5", NULL, 0,
52640843aeaSCharles Keepax 		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX5_ENA_SHIFT, 0),
52740843aeaSCharles Keepax SND_SOC_DAPM_AIF_OUT("AIF1TX6", NULL, 0,
52840843aeaSCharles Keepax 		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX6_ENA_SHIFT, 0),
52940843aeaSCharles Keepax SND_SOC_DAPM_AIF_OUT("AIF1TX7", NULL, 0,
53040843aeaSCharles Keepax 		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX7_ENA_SHIFT, 0),
53140843aeaSCharles Keepax SND_SOC_DAPM_AIF_OUT("AIF1TX8", NULL, 0,
53240843aeaSCharles Keepax 		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX8_ENA_SHIFT, 0),
53340843aeaSCharles Keepax 
53440843aeaSCharles Keepax SND_SOC_DAPM_AIF_IN("AIF1RX1", NULL, 0,
53540843aeaSCharles Keepax 		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX1_ENA_SHIFT, 0),
53640843aeaSCharles Keepax SND_SOC_DAPM_AIF_IN("AIF1RX2", NULL, 0,
53740843aeaSCharles Keepax 		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX2_ENA_SHIFT, 0),
53840843aeaSCharles Keepax SND_SOC_DAPM_AIF_IN("AIF1RX3", NULL, 0,
53940843aeaSCharles Keepax 		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX3_ENA_SHIFT, 0),
54040843aeaSCharles Keepax SND_SOC_DAPM_AIF_IN("AIF1RX4", NULL, 0,
54140843aeaSCharles Keepax 		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX4_ENA_SHIFT, 0),
54240843aeaSCharles Keepax SND_SOC_DAPM_AIF_IN("AIF1RX5", NULL, 0,
54340843aeaSCharles Keepax 		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX5_ENA_SHIFT, 0),
54440843aeaSCharles Keepax SND_SOC_DAPM_AIF_IN("AIF1RX6", NULL, 0,
54540843aeaSCharles Keepax 		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX6_ENA_SHIFT, 0),
54640843aeaSCharles Keepax SND_SOC_DAPM_AIF_IN("AIF1RX7", NULL, 0,
54740843aeaSCharles Keepax 		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX7_ENA_SHIFT, 0),
54840843aeaSCharles Keepax SND_SOC_DAPM_AIF_IN("AIF1RX8", NULL, 0,
54940843aeaSCharles Keepax 		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX8_ENA_SHIFT, 0),
55040843aeaSCharles Keepax 
55140843aeaSCharles Keepax SND_SOC_DAPM_AIF_OUT("AIF2TX1", NULL, 0,
55240843aeaSCharles Keepax 		     ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX1_ENA_SHIFT, 0),
55340843aeaSCharles Keepax SND_SOC_DAPM_AIF_OUT("AIF2TX2", NULL, 0,
55440843aeaSCharles Keepax 		     ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX2_ENA_SHIFT, 0),
55540843aeaSCharles Keepax 
55640843aeaSCharles Keepax SND_SOC_DAPM_AIF_IN("AIF2RX1", NULL, 0,
55740843aeaSCharles Keepax 		    ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX1_ENA_SHIFT, 0),
55840843aeaSCharles Keepax SND_SOC_DAPM_AIF_IN("AIF2RX2", NULL, 0,
55940843aeaSCharles Keepax 		    ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX2_ENA_SHIFT, 0),
56040843aeaSCharles Keepax 
56140843aeaSCharles Keepax SND_SOC_DAPM_AIF_OUT("SLIMTX1", NULL, 0,
56240843aeaSCharles Keepax 		     ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
56340843aeaSCharles Keepax 		     ARIZONA_SLIMTX1_ENA_SHIFT, 0),
56440843aeaSCharles Keepax SND_SOC_DAPM_AIF_OUT("SLIMTX2", NULL, 0,
56540843aeaSCharles Keepax 		     ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
56640843aeaSCharles Keepax 		     ARIZONA_SLIMTX2_ENA_SHIFT, 0),
56740843aeaSCharles Keepax SND_SOC_DAPM_AIF_OUT("SLIMTX3", NULL, 0,
56840843aeaSCharles Keepax 		     ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
56940843aeaSCharles Keepax 		     ARIZONA_SLIMTX3_ENA_SHIFT, 0),
57040843aeaSCharles Keepax SND_SOC_DAPM_AIF_OUT("SLIMTX4", NULL, 0,
57140843aeaSCharles Keepax 		     ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
57240843aeaSCharles Keepax 		     ARIZONA_SLIMTX4_ENA_SHIFT, 0),
57340843aeaSCharles Keepax SND_SOC_DAPM_AIF_OUT("SLIMTX5", NULL, 0,
57440843aeaSCharles Keepax 		     ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
57540843aeaSCharles Keepax 		     ARIZONA_SLIMTX5_ENA_SHIFT, 0),
57640843aeaSCharles Keepax SND_SOC_DAPM_AIF_OUT("SLIMTX6", NULL, 0,
57740843aeaSCharles Keepax 		     ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
57840843aeaSCharles Keepax 		     ARIZONA_SLIMTX6_ENA_SHIFT, 0),
57940843aeaSCharles Keepax SND_SOC_DAPM_AIF_OUT("SLIMTX7", NULL, 0,
58040843aeaSCharles Keepax 		     ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
58140843aeaSCharles Keepax 		     ARIZONA_SLIMTX7_ENA_SHIFT, 0),
58240843aeaSCharles Keepax SND_SOC_DAPM_AIF_OUT("SLIMTX8", NULL, 0,
58340843aeaSCharles Keepax 		     ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
58440843aeaSCharles Keepax 		     ARIZONA_SLIMTX8_ENA_SHIFT, 0),
58540843aeaSCharles Keepax 
58640843aeaSCharles Keepax SND_SOC_DAPM_AIF_IN("SLIMRX1", NULL, 0,
58740843aeaSCharles Keepax 		    ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
58840843aeaSCharles Keepax 		    ARIZONA_SLIMRX1_ENA_SHIFT, 0),
58940843aeaSCharles Keepax SND_SOC_DAPM_AIF_IN("SLIMRX2", NULL, 0,
59040843aeaSCharles Keepax 		    ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
59140843aeaSCharles Keepax 		    ARIZONA_SLIMRX2_ENA_SHIFT, 0),
59240843aeaSCharles Keepax SND_SOC_DAPM_AIF_IN("SLIMRX3", NULL, 0,
59340843aeaSCharles Keepax 		    ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
59440843aeaSCharles Keepax 		    ARIZONA_SLIMRX3_ENA_SHIFT, 0),
59540843aeaSCharles Keepax SND_SOC_DAPM_AIF_IN("SLIMRX4", NULL, 0,
59640843aeaSCharles Keepax 		    ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
59740843aeaSCharles Keepax 		    ARIZONA_SLIMRX4_ENA_SHIFT, 0),
59840843aeaSCharles Keepax SND_SOC_DAPM_AIF_IN("SLIMRX5", NULL, 0,
59940843aeaSCharles Keepax 		    ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
60040843aeaSCharles Keepax 		    ARIZONA_SLIMRX5_ENA_SHIFT, 0),
60140843aeaSCharles Keepax SND_SOC_DAPM_AIF_IN("SLIMRX6", NULL, 0,
60240843aeaSCharles Keepax 		    ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
60340843aeaSCharles Keepax 		    ARIZONA_SLIMRX6_ENA_SHIFT, 0),
60440843aeaSCharles Keepax SND_SOC_DAPM_AIF_IN("SLIMRX7", NULL, 0,
60540843aeaSCharles Keepax 		    ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
60640843aeaSCharles Keepax 		    ARIZONA_SLIMRX7_ENA_SHIFT, 0),
60740843aeaSCharles Keepax SND_SOC_DAPM_AIF_IN("SLIMRX8", NULL, 0,
60840843aeaSCharles Keepax 		    ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
60940843aeaSCharles Keepax 		    ARIZONA_SLIMRX8_ENA_SHIFT, 0),
61040843aeaSCharles Keepax 
611e13dd8ceSLars-Peter Clausen SND_SOC_DAPM_MUX("AEC Loopback", ARIZONA_DAC_AEC_CONTROL_1,
61240843aeaSCharles Keepax 		       ARIZONA_AEC_LOOPBACK_ENA_SHIFT, 0,
61340843aeaSCharles Keepax 		       &wm8997_aec_loopback_mux),
61440843aeaSCharles Keepax 
61540843aeaSCharles Keepax SND_SOC_DAPM_PGA_E("OUT1L", SND_SOC_NOPM,
61640843aeaSCharles Keepax 		   ARIZONA_OUT1L_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("OUT1R", SND_SOC_NOPM,
62040843aeaSCharles Keepax 		   ARIZONA_OUT1R_ENA_SHIFT, 0, NULL, 0, arizona_hp_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("OUT3L", ARIZONA_OUTPUT_ENABLES_1,
62440843aeaSCharles Keepax 		   ARIZONA_OUT3L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
625054e1b48SCharles Keepax 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
626e1ae5fbaSCharles Keepax 		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
62740843aeaSCharles Keepax SND_SOC_DAPM_PGA_E("OUT5L", ARIZONA_OUTPUT_ENABLES_1,
62840843aeaSCharles Keepax 		   ARIZONA_OUT5L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
62940843aeaSCharles Keepax 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
63040843aeaSCharles Keepax SND_SOC_DAPM_PGA_E("OUT5R", ARIZONA_OUTPUT_ENABLES_1,
63140843aeaSCharles Keepax 		   ARIZONA_OUT5R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
63240843aeaSCharles Keepax 		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
63340843aeaSCharles Keepax 
63440843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(EQ1, "EQ1"),
63540843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(EQ2, "EQ2"),
63640843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(EQ3, "EQ3"),
63740843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(EQ4, "EQ4"),
63840843aeaSCharles Keepax 
63940843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(DRC1L, "DRC1L"),
64040843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(DRC1R, "DRC1R"),
64140843aeaSCharles Keepax 
64240843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(LHPF1, "LHPF1"),
64340843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(LHPF2, "LHPF2"),
64440843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(LHPF3, "LHPF3"),
64540843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(LHPF4, "LHPF4"),
64640843aeaSCharles Keepax 
64740843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(Mic, "Mic"),
64840843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(Noise, "Noise"),
64940843aeaSCharles Keepax 
65040843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(PWM1, "PWM1"),
65140843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(PWM2, "PWM2"),
65240843aeaSCharles Keepax 
65340843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(OUT1L, "HPOUT1L"),
65440843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(OUT1R, "HPOUT1R"),
65540843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(OUT3, "EPOUT"),
65640843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(SPKOUT, "SPKOUT"),
65740843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(SPKDAT1L, "SPKDAT1L"),
65840843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(SPKDAT1R, "SPKDAT1R"),
65940843aeaSCharles Keepax 
66040843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(AIF1TX1, "AIF1TX1"),
66140843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(AIF1TX2, "AIF1TX2"),
66240843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(AIF1TX3, "AIF1TX3"),
66340843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(AIF1TX4, "AIF1TX4"),
66440843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(AIF1TX5, "AIF1TX5"),
66540843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(AIF1TX6, "AIF1TX6"),
66640843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(AIF1TX7, "AIF1TX7"),
66740843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(AIF1TX8, "AIF1TX8"),
66840843aeaSCharles Keepax 
66940843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(AIF2TX1, "AIF2TX1"),
67040843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(AIF2TX2, "AIF2TX2"),
67140843aeaSCharles Keepax 
67240843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(SLIMTX1, "SLIMTX1"),
67340843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(SLIMTX2, "SLIMTX2"),
67440843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(SLIMTX3, "SLIMTX3"),
67540843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(SLIMTX4, "SLIMTX4"),
67640843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(SLIMTX5, "SLIMTX5"),
67740843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(SLIMTX6, "SLIMTX6"),
67840843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(SLIMTX7, "SLIMTX7"),
67940843aeaSCharles Keepax ARIZONA_MIXER_WIDGETS(SLIMTX8, "SLIMTX8"),
68040843aeaSCharles Keepax 
68140843aeaSCharles Keepax ARIZONA_MUX_WIDGETS(ISRC1DEC1, "ISRC1DEC1"),
68240843aeaSCharles Keepax ARIZONA_MUX_WIDGETS(ISRC1DEC2, "ISRC1DEC2"),
68340843aeaSCharles Keepax 
68440843aeaSCharles Keepax ARIZONA_MUX_WIDGETS(ISRC1INT1, "ISRC1INT1"),
68540843aeaSCharles Keepax ARIZONA_MUX_WIDGETS(ISRC1INT2, "ISRC1INT2"),
68640843aeaSCharles Keepax 
68740843aeaSCharles Keepax ARIZONA_MUX_WIDGETS(ISRC2DEC1, "ISRC2DEC1"),
68840843aeaSCharles Keepax ARIZONA_MUX_WIDGETS(ISRC2DEC2, "ISRC2DEC2"),
68940843aeaSCharles Keepax 
69040843aeaSCharles Keepax ARIZONA_MUX_WIDGETS(ISRC2INT1, "ISRC2INT1"),
69140843aeaSCharles Keepax ARIZONA_MUX_WIDGETS(ISRC2INT2, "ISRC2INT2"),
69240843aeaSCharles Keepax 
69340843aeaSCharles Keepax SND_SOC_DAPM_OUTPUT("HPOUT1L"),
69440843aeaSCharles Keepax SND_SOC_DAPM_OUTPUT("HPOUT1R"),
69540843aeaSCharles Keepax SND_SOC_DAPM_OUTPUT("EPOUTN"),
69640843aeaSCharles Keepax SND_SOC_DAPM_OUTPUT("EPOUTP"),
69740843aeaSCharles Keepax SND_SOC_DAPM_OUTPUT("SPKOUTN"),
69840843aeaSCharles Keepax SND_SOC_DAPM_OUTPUT("SPKOUTP"),
69940843aeaSCharles Keepax SND_SOC_DAPM_OUTPUT("SPKDAT1L"),
70040843aeaSCharles Keepax SND_SOC_DAPM_OUTPUT("SPKDAT1R"),
70140843aeaSCharles Keepax 
70240843aeaSCharles Keepax SND_SOC_DAPM_OUTPUT("MICSUPP"),
70340843aeaSCharles Keepax };
70440843aeaSCharles Keepax 
70540843aeaSCharles Keepax #define ARIZONA_MIXER_INPUT_ROUTES(name)	\
70640843aeaSCharles Keepax 	{ name, "Noise Generator", "Noise Generator" }, \
70740843aeaSCharles Keepax 	{ name, "Tone Generator 1", "Tone Generator 1" }, \
70840843aeaSCharles Keepax 	{ name, "Tone Generator 2", "Tone Generator 2" }, \
70940843aeaSCharles Keepax 	{ name, "Haptics", "HAPTICS" }, \
71040843aeaSCharles Keepax 	{ name, "AEC", "AEC Loopback" }, \
71140843aeaSCharles Keepax 	{ name, "IN1L", "IN1L PGA" }, \
71240843aeaSCharles Keepax 	{ name, "IN1R", "IN1R PGA" }, \
71340843aeaSCharles Keepax 	{ name, "IN2L", "IN2L PGA" }, \
71440843aeaSCharles Keepax 	{ name, "IN2R", "IN2R PGA" }, \
71540843aeaSCharles Keepax 	{ name, "Mic Mute Mixer", "Mic Mute Mixer" }, \
71640843aeaSCharles Keepax 	{ name, "AIF1RX1", "AIF1RX1" }, \
71740843aeaSCharles Keepax 	{ name, "AIF1RX2", "AIF1RX2" }, \
71840843aeaSCharles Keepax 	{ name, "AIF1RX3", "AIF1RX3" }, \
71940843aeaSCharles Keepax 	{ name, "AIF1RX4", "AIF1RX4" }, \
72040843aeaSCharles Keepax 	{ name, "AIF1RX5", "AIF1RX5" }, \
72140843aeaSCharles Keepax 	{ name, "AIF1RX6", "AIF1RX6" }, \
72240843aeaSCharles Keepax 	{ name, "AIF1RX7", "AIF1RX7" }, \
72340843aeaSCharles Keepax 	{ name, "AIF1RX8", "AIF1RX8" }, \
72440843aeaSCharles Keepax 	{ name, "AIF2RX1", "AIF2RX1" }, \
72540843aeaSCharles Keepax 	{ name, "AIF2RX2", "AIF2RX2" }, \
72640843aeaSCharles Keepax 	{ name, "SLIMRX1", "SLIMRX1" }, \
72740843aeaSCharles Keepax 	{ name, "SLIMRX2", "SLIMRX2" }, \
72840843aeaSCharles Keepax 	{ name, "SLIMRX3", "SLIMRX3" }, \
72940843aeaSCharles Keepax 	{ name, "SLIMRX4", "SLIMRX4" }, \
73040843aeaSCharles Keepax 	{ name, "SLIMRX5", "SLIMRX5" }, \
73140843aeaSCharles Keepax 	{ name, "SLIMRX6", "SLIMRX6" }, \
73240843aeaSCharles Keepax 	{ name, "SLIMRX7", "SLIMRX7" }, \
73340843aeaSCharles Keepax 	{ name, "SLIMRX8", "SLIMRX8" }, \
73440843aeaSCharles Keepax 	{ name, "EQ1", "EQ1" }, \
73540843aeaSCharles Keepax 	{ name, "EQ2", "EQ2" }, \
73640843aeaSCharles Keepax 	{ name, "EQ3", "EQ3" }, \
73740843aeaSCharles Keepax 	{ name, "EQ4", "EQ4" }, \
73840843aeaSCharles Keepax 	{ name, "DRC1L", "DRC1L" }, \
73940843aeaSCharles Keepax 	{ name, "DRC1R", "DRC1R" }, \
74040843aeaSCharles Keepax 	{ name, "LHPF1", "LHPF1" }, \
74140843aeaSCharles Keepax 	{ name, "LHPF2", "LHPF2" }, \
74240843aeaSCharles Keepax 	{ name, "LHPF3", "LHPF3" }, \
74340843aeaSCharles Keepax 	{ name, "LHPF4", "LHPF4" }, \
74440843aeaSCharles Keepax 	{ name, "ISRC1DEC1", "ISRC1DEC1" }, \
74540843aeaSCharles Keepax 	{ name, "ISRC1DEC2", "ISRC1DEC2" }, \
74640843aeaSCharles Keepax 	{ name, "ISRC1INT1", "ISRC1INT1" }, \
74740843aeaSCharles Keepax 	{ name, "ISRC1INT2", "ISRC1INT2" }, \
74840843aeaSCharles Keepax 	{ name, "ISRC2DEC1", "ISRC2DEC1" }, \
74940843aeaSCharles Keepax 	{ name, "ISRC2DEC2", "ISRC2DEC2" }, \
75040843aeaSCharles Keepax 	{ name, "ISRC2INT1", "ISRC2INT1" }, \
75140843aeaSCharles Keepax 	{ name, "ISRC2INT2", "ISRC2INT2" }
75240843aeaSCharles Keepax 
75340843aeaSCharles Keepax static const struct snd_soc_dapm_route wm8997_dapm_routes[] = {
75440843aeaSCharles Keepax 	{ "AIF2 Capture", NULL, "DBVDD2" },
75540843aeaSCharles Keepax 	{ "AIF2 Playback", NULL, "DBVDD2" },
75640843aeaSCharles Keepax 
75740843aeaSCharles Keepax 	{ "OUT1L", NULL, "CPVDD" },
75840843aeaSCharles Keepax 	{ "OUT1R", NULL, "CPVDD" },
75940843aeaSCharles Keepax 	{ "OUT3L", NULL, "CPVDD" },
76040843aeaSCharles Keepax 
76140843aeaSCharles Keepax 	{ "OUT4L", NULL, "SPKVDD" },
76240843aeaSCharles Keepax 
76340843aeaSCharles Keepax 	{ "OUT1L", NULL, "SYSCLK" },
76440843aeaSCharles Keepax 	{ "OUT1R", NULL, "SYSCLK" },
76540843aeaSCharles Keepax 	{ "OUT3L", NULL, "SYSCLK" },
76640843aeaSCharles Keepax 	{ "OUT4L", NULL, "SYSCLK" },
76740843aeaSCharles Keepax 
76840843aeaSCharles Keepax 	{ "IN1L", NULL, "SYSCLK" },
76940843aeaSCharles Keepax 	{ "IN1R", NULL, "SYSCLK" },
77040843aeaSCharles Keepax 	{ "IN2L", NULL, "SYSCLK" },
77140843aeaSCharles Keepax 	{ "IN2R", NULL, "SYSCLK" },
77240843aeaSCharles Keepax 
77340843aeaSCharles Keepax 	{ "MICBIAS1", NULL, "MICVDD" },
77440843aeaSCharles Keepax 	{ "MICBIAS2", NULL, "MICVDD" },
77540843aeaSCharles Keepax 	{ "MICBIAS3", NULL, "MICVDD" },
77640843aeaSCharles Keepax 
77740843aeaSCharles Keepax 	{ "Noise Generator", NULL, "SYSCLK" },
77840843aeaSCharles Keepax 	{ "Tone Generator 1", NULL, "SYSCLK" },
77940843aeaSCharles Keepax 	{ "Tone Generator 2", NULL, "SYSCLK" },
78040843aeaSCharles Keepax 
78140843aeaSCharles Keepax 	{ "Noise Generator", NULL, "NOISE" },
78240843aeaSCharles Keepax 	{ "Tone Generator 1", NULL, "TONE" },
78340843aeaSCharles Keepax 	{ "Tone Generator 2", NULL, "TONE" },
78440843aeaSCharles Keepax 
78540843aeaSCharles Keepax 	{ "AIF1 Capture", NULL, "AIF1TX1" },
78640843aeaSCharles Keepax 	{ "AIF1 Capture", NULL, "AIF1TX2" },
78740843aeaSCharles Keepax 	{ "AIF1 Capture", NULL, "AIF1TX3" },
78840843aeaSCharles Keepax 	{ "AIF1 Capture", NULL, "AIF1TX4" },
78940843aeaSCharles Keepax 	{ "AIF1 Capture", NULL, "AIF1TX5" },
79040843aeaSCharles Keepax 	{ "AIF1 Capture", NULL, "AIF1TX6" },
79140843aeaSCharles Keepax 	{ "AIF1 Capture", NULL, "AIF1TX7" },
79240843aeaSCharles Keepax 	{ "AIF1 Capture", NULL, "AIF1TX8" },
79340843aeaSCharles Keepax 
79440843aeaSCharles Keepax 	{ "AIF1RX1", NULL, "AIF1 Playback" },
79540843aeaSCharles Keepax 	{ "AIF1RX2", NULL, "AIF1 Playback" },
79640843aeaSCharles Keepax 	{ "AIF1RX3", NULL, "AIF1 Playback" },
79740843aeaSCharles Keepax 	{ "AIF1RX4", NULL, "AIF1 Playback" },
79840843aeaSCharles Keepax 	{ "AIF1RX5", NULL, "AIF1 Playback" },
79940843aeaSCharles Keepax 	{ "AIF1RX6", NULL, "AIF1 Playback" },
80040843aeaSCharles Keepax 	{ "AIF1RX7", NULL, "AIF1 Playback" },
80140843aeaSCharles Keepax 	{ "AIF1RX8", NULL, "AIF1 Playback" },
80240843aeaSCharles Keepax 
80340843aeaSCharles Keepax 	{ "AIF2 Capture", NULL, "AIF2TX1" },
80440843aeaSCharles Keepax 	{ "AIF2 Capture", NULL, "AIF2TX2" },
80540843aeaSCharles Keepax 
80640843aeaSCharles Keepax 	{ "AIF2RX1", NULL, "AIF2 Playback" },
80740843aeaSCharles Keepax 	{ "AIF2RX2", NULL, "AIF2 Playback" },
80840843aeaSCharles Keepax 
80940843aeaSCharles Keepax 	{ "Slim1 Capture", NULL, "SLIMTX1" },
81040843aeaSCharles Keepax 	{ "Slim1 Capture", NULL, "SLIMTX2" },
81140843aeaSCharles Keepax 	{ "Slim1 Capture", NULL, "SLIMTX3" },
81240843aeaSCharles Keepax 	{ "Slim1 Capture", NULL, "SLIMTX4" },
81340843aeaSCharles Keepax 
81440843aeaSCharles Keepax 	{ "SLIMRX1", NULL, "Slim1 Playback" },
81540843aeaSCharles Keepax 	{ "SLIMRX2", NULL, "Slim1 Playback" },
81640843aeaSCharles Keepax 	{ "SLIMRX3", NULL, "Slim1 Playback" },
81740843aeaSCharles Keepax 	{ "SLIMRX4", NULL, "Slim1 Playback" },
81840843aeaSCharles Keepax 
81940843aeaSCharles Keepax 	{ "Slim2 Capture", NULL, "SLIMTX5" },
82040843aeaSCharles Keepax 	{ "Slim2 Capture", NULL, "SLIMTX6" },
82140843aeaSCharles Keepax 
82240843aeaSCharles Keepax 	{ "SLIMRX5", NULL, "Slim2 Playback" },
82340843aeaSCharles Keepax 	{ "SLIMRX6", NULL, "Slim2 Playback" },
82440843aeaSCharles Keepax 
82540843aeaSCharles Keepax 	{ "Slim3 Capture", NULL, "SLIMTX7" },
82640843aeaSCharles Keepax 	{ "Slim3 Capture", NULL, "SLIMTX8" },
82740843aeaSCharles Keepax 
82840843aeaSCharles Keepax 	{ "SLIMRX7", NULL, "Slim3 Playback" },
82940843aeaSCharles Keepax 	{ "SLIMRX8", NULL, "Slim3 Playback" },
83040843aeaSCharles Keepax 
83140843aeaSCharles Keepax 	{ "AIF1 Playback", NULL, "SYSCLK" },
83240843aeaSCharles Keepax 	{ "AIF2 Playback", NULL, "SYSCLK" },
83340843aeaSCharles Keepax 	{ "Slim1 Playback", NULL, "SYSCLK" },
83440843aeaSCharles Keepax 	{ "Slim2 Playback", NULL, "SYSCLK" },
83540843aeaSCharles Keepax 	{ "Slim3 Playback", NULL, "SYSCLK" },
83640843aeaSCharles Keepax 
83740843aeaSCharles Keepax 	{ "AIF1 Capture", NULL, "SYSCLK" },
83840843aeaSCharles Keepax 	{ "AIF2 Capture", NULL, "SYSCLK" },
83940843aeaSCharles Keepax 	{ "Slim1 Capture", NULL, "SYSCLK" },
84040843aeaSCharles Keepax 	{ "Slim2 Capture", NULL, "SYSCLK" },
84140843aeaSCharles Keepax 	{ "Slim3 Capture", NULL, "SYSCLK" },
84240843aeaSCharles Keepax 
84340843aeaSCharles Keepax 	{ "IN1L PGA", NULL, "IN1L" },
84440843aeaSCharles Keepax 	{ "IN1R PGA", NULL, "IN1R" },
84540843aeaSCharles Keepax 
84640843aeaSCharles Keepax 	{ "IN2L PGA", NULL, "IN2L" },
84740843aeaSCharles Keepax 	{ "IN2R PGA", NULL, "IN2R" },
84840843aeaSCharles Keepax 
84940843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("OUT1L", "HPOUT1L"),
85040843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("OUT1R", "HPOUT1R"),
85140843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("OUT3L", "EPOUT"),
85240843aeaSCharles Keepax 
85340843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("OUT4L", "SPKOUT"),
85440843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("OUT5L", "SPKDAT1L"),
85540843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("OUT5R", "SPKDAT1R"),
85640843aeaSCharles Keepax 
85740843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("PWM1 Driver", "PWM1"),
85840843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("PWM2 Driver", "PWM2"),
85940843aeaSCharles Keepax 
86040843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("AIF1TX1", "AIF1TX1"),
86140843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("AIF1TX2", "AIF1TX2"),
86240843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("AIF1TX3", "AIF1TX3"),
86340843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("AIF1TX4", "AIF1TX4"),
86440843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("AIF1TX5", "AIF1TX5"),
86540843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("AIF1TX6", "AIF1TX6"),
86640843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("AIF1TX7", "AIF1TX7"),
86740843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("AIF1TX8", "AIF1TX8"),
86840843aeaSCharles Keepax 
86940843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("AIF2TX1", "AIF2TX1"),
87040843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("AIF2TX2", "AIF2TX2"),
87140843aeaSCharles Keepax 
87240843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("SLIMTX1", "SLIMTX1"),
87340843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("SLIMTX2", "SLIMTX2"),
87440843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("SLIMTX3", "SLIMTX3"),
87540843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("SLIMTX4", "SLIMTX4"),
87640843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("SLIMTX5", "SLIMTX5"),
87740843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("SLIMTX6", "SLIMTX6"),
87840843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("SLIMTX7", "SLIMTX7"),
87940843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("SLIMTX8", "SLIMTX8"),
88040843aeaSCharles Keepax 
88140843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("EQ1", "EQ1"),
88240843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("EQ2", "EQ2"),
88340843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("EQ3", "EQ3"),
88440843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("EQ4", "EQ4"),
88540843aeaSCharles Keepax 
88640843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("DRC1L", "DRC1L"),
88740843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("DRC1R", "DRC1R"),
88840843aeaSCharles Keepax 
88940843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("LHPF1", "LHPF1"),
89040843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("LHPF2", "LHPF2"),
89140843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("LHPF3", "LHPF3"),
89240843aeaSCharles Keepax 	ARIZONA_MIXER_ROUTES("LHPF4", "LHPF4"),
89340843aeaSCharles Keepax 
894c5efb38aSMark Brown 	ARIZONA_MIXER_ROUTES("Mic Mute Mixer", "Noise"),
895c5efb38aSMark Brown 	ARIZONA_MIXER_ROUTES("Mic Mute Mixer", "Mic"),
896c5efb38aSMark Brown 
89740843aeaSCharles Keepax 	ARIZONA_MUX_ROUTES("ISRC1INT1", "ISRC1INT1"),
898f4cdb6b4SCharles Keepax 	ARIZONA_MUX_ROUTES("ISRC1INT2", "ISRC1INT2"),
89940843aeaSCharles Keepax 
90040843aeaSCharles Keepax 	ARIZONA_MUX_ROUTES("ISRC1DEC1", "ISRC1DEC1"),
90140843aeaSCharles Keepax 	ARIZONA_MUX_ROUTES("ISRC1DEC2", "ISRC1DEC2"),
90240843aeaSCharles Keepax 
90340843aeaSCharles Keepax 	ARIZONA_MUX_ROUTES("ISRC2INT1", "ISRC2INT1"),
90440843aeaSCharles Keepax 	ARIZONA_MUX_ROUTES("ISRC2INT2", "ISRC2INT2"),
90540843aeaSCharles Keepax 
90640843aeaSCharles Keepax 	ARIZONA_MUX_ROUTES("ISRC2DEC1", "ISRC2DEC1"),
90740843aeaSCharles Keepax 	ARIZONA_MUX_ROUTES("ISRC2DEC2", "ISRC2DEC2"),
90840843aeaSCharles Keepax 
90940843aeaSCharles Keepax 	{ "AEC Loopback", "HPOUT1L", "OUT1L" },
91040843aeaSCharles Keepax 	{ "AEC Loopback", "HPOUT1R", "OUT1R" },
91140843aeaSCharles Keepax 	{ "HPOUT1L", NULL, "OUT1L" },
91240843aeaSCharles Keepax 	{ "HPOUT1R", NULL, "OUT1R" },
91340843aeaSCharles Keepax 
91440843aeaSCharles Keepax 	{ "AEC Loopback", "EPOUT", "OUT3L" },
91540843aeaSCharles Keepax 	{ "EPOUTN", NULL, "OUT3L" },
91640843aeaSCharles Keepax 	{ "EPOUTP", NULL, "OUT3L" },
91740843aeaSCharles Keepax 
91840843aeaSCharles Keepax 	{ "AEC Loopback", "SPKOUT", "OUT4L" },
91940843aeaSCharles Keepax 	{ "SPKOUTN", NULL, "OUT4L" },
92040843aeaSCharles Keepax 	{ "SPKOUTP", NULL, "OUT4L" },
92140843aeaSCharles Keepax 
92240843aeaSCharles Keepax 	{ "AEC Loopback", "SPKDAT1L", "OUT5L" },
92340843aeaSCharles Keepax 	{ "AEC Loopback", "SPKDAT1R", "OUT5R" },
92440843aeaSCharles Keepax 	{ "SPKDAT1L", NULL, "OUT5L" },
92540843aeaSCharles Keepax 	{ "SPKDAT1R", NULL, "OUT5R" },
92640843aeaSCharles Keepax 
92740843aeaSCharles Keepax 	{ "MICSUPP", NULL, "SYSCLK" },
92840843aeaSCharles Keepax };
92940843aeaSCharles Keepax 
93040843aeaSCharles Keepax static int wm8997_set_fll(struct snd_soc_codec *codec, int fll_id, int source,
93140843aeaSCharles Keepax 			  unsigned int Fref, unsigned int Fout)
93240843aeaSCharles Keepax {
93340843aeaSCharles Keepax 	struct wm8997_priv *wm8997 = snd_soc_codec_get_drvdata(codec);
93440843aeaSCharles Keepax 
93540843aeaSCharles Keepax 	switch (fll_id) {
93640843aeaSCharles Keepax 	case WM8997_FLL1:
93740843aeaSCharles Keepax 		return arizona_set_fll(&wm8997->fll[0], source, Fref, Fout);
93840843aeaSCharles Keepax 	case WM8997_FLL2:
93940843aeaSCharles Keepax 		return arizona_set_fll(&wm8997->fll[1], source, Fref, Fout);
94040843aeaSCharles Keepax 	case WM8997_FLL1_REFCLK:
94140843aeaSCharles Keepax 		return arizona_set_fll_refclk(&wm8997->fll[0], source, Fref,
94240843aeaSCharles Keepax 					      Fout);
94340843aeaSCharles Keepax 	case WM8997_FLL2_REFCLK:
94440843aeaSCharles Keepax 		return arizona_set_fll_refclk(&wm8997->fll[1], source, Fref,
94540843aeaSCharles Keepax 					      Fout);
94640843aeaSCharles Keepax 	default:
94740843aeaSCharles Keepax 		return -EINVAL;
94840843aeaSCharles Keepax 	}
94940843aeaSCharles Keepax }
95040843aeaSCharles Keepax 
951d81221ffSCharles Keepax #define WM8997_RATES SNDRV_PCM_RATE_KNOT
95240843aeaSCharles Keepax 
95340843aeaSCharles Keepax #define WM8997_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
95440843aeaSCharles Keepax 			SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)
95540843aeaSCharles Keepax 
95640843aeaSCharles Keepax static struct snd_soc_dai_driver wm8997_dai[] = {
95740843aeaSCharles Keepax 	{
95840843aeaSCharles Keepax 		.name = "wm8997-aif1",
95940843aeaSCharles Keepax 		.id = 1,
96040843aeaSCharles Keepax 		.base = ARIZONA_AIF1_BCLK_CTRL,
96140843aeaSCharles Keepax 		.playback = {
96240843aeaSCharles Keepax 			.stream_name = "AIF1 Playback",
96340843aeaSCharles Keepax 			.channels_min = 1,
96440843aeaSCharles Keepax 			.channels_max = 8,
96540843aeaSCharles Keepax 			.rates = WM8997_RATES,
96640843aeaSCharles Keepax 			.formats = WM8997_FORMATS,
96740843aeaSCharles Keepax 		},
96840843aeaSCharles Keepax 		.capture = {
96940843aeaSCharles Keepax 			 .stream_name = "AIF1 Capture",
97040843aeaSCharles Keepax 			 .channels_min = 1,
97140843aeaSCharles Keepax 			 .channels_max = 8,
97240843aeaSCharles Keepax 			 .rates = WM8997_RATES,
97340843aeaSCharles Keepax 			 .formats = WM8997_FORMATS,
97440843aeaSCharles Keepax 		 },
97540843aeaSCharles Keepax 		.ops = &arizona_dai_ops,
97640843aeaSCharles Keepax 		.symmetric_rates = 1,
9778a349451SRichard Fitzgerald 		.symmetric_samplebits = 1,
97840843aeaSCharles Keepax 	},
97940843aeaSCharles Keepax 	{
98040843aeaSCharles Keepax 		.name = "wm8997-aif2",
98140843aeaSCharles Keepax 		.id = 2,
98240843aeaSCharles Keepax 		.base = ARIZONA_AIF2_BCLK_CTRL,
98340843aeaSCharles Keepax 		.playback = {
98440843aeaSCharles Keepax 			.stream_name = "AIF2 Playback",
98540843aeaSCharles Keepax 			.channels_min = 1,
98640843aeaSCharles Keepax 			.channels_max = 2,
98740843aeaSCharles Keepax 			.rates = WM8997_RATES,
98840843aeaSCharles Keepax 			.formats = WM8997_FORMATS,
98940843aeaSCharles Keepax 		},
99040843aeaSCharles Keepax 		.capture = {
99140843aeaSCharles Keepax 			 .stream_name = "AIF2 Capture",
99240843aeaSCharles Keepax 			 .channels_min = 1,
99340843aeaSCharles Keepax 			 .channels_max = 2,
99440843aeaSCharles Keepax 			 .rates = WM8997_RATES,
99540843aeaSCharles Keepax 			 .formats = WM8997_FORMATS,
99640843aeaSCharles Keepax 		 },
99740843aeaSCharles Keepax 		.ops = &arizona_dai_ops,
99840843aeaSCharles Keepax 		.symmetric_rates = 1,
9998a349451SRichard Fitzgerald 		.symmetric_samplebits = 1,
100040843aeaSCharles Keepax 	},
100140843aeaSCharles Keepax 	{
100240843aeaSCharles Keepax 		.name = "wm8997-slim1",
100340843aeaSCharles Keepax 		.id = 3,
100440843aeaSCharles Keepax 		.playback = {
100540843aeaSCharles Keepax 			.stream_name = "Slim1 Playback",
100640843aeaSCharles Keepax 			.channels_min = 1,
100740843aeaSCharles Keepax 			.channels_max = 4,
100840843aeaSCharles Keepax 			.rates = WM8997_RATES,
100940843aeaSCharles Keepax 			.formats = WM8997_FORMATS,
101040843aeaSCharles Keepax 		},
101140843aeaSCharles Keepax 		.capture = {
101240843aeaSCharles Keepax 			.stream_name = "Slim1 Capture",
101340843aeaSCharles Keepax 			.channels_min = 1,
101440843aeaSCharles Keepax 			.channels_max = 4,
101540843aeaSCharles Keepax 			.rates = WM8997_RATES,
101640843aeaSCharles Keepax 			.formats = WM8997_FORMATS,
101740843aeaSCharles Keepax 		},
101840843aeaSCharles Keepax 		.ops = &arizona_simple_dai_ops,
101940843aeaSCharles Keepax 	},
102040843aeaSCharles Keepax 	{
102140843aeaSCharles Keepax 		.name = "wm8997-slim2",
102240843aeaSCharles Keepax 		.id = 4,
102340843aeaSCharles Keepax 		.playback = {
102440843aeaSCharles Keepax 			.stream_name = "Slim2 Playback",
102540843aeaSCharles Keepax 			.channels_min = 1,
102640843aeaSCharles Keepax 			.channels_max = 2,
102740843aeaSCharles Keepax 			.rates = WM8997_RATES,
102840843aeaSCharles Keepax 			.formats = WM8997_FORMATS,
102940843aeaSCharles Keepax 		},
103040843aeaSCharles Keepax 		.capture = {
103140843aeaSCharles Keepax 			.stream_name = "Slim2 Capture",
103240843aeaSCharles Keepax 			.channels_min = 1,
103340843aeaSCharles Keepax 			.channels_max = 2,
103440843aeaSCharles Keepax 			.rates = WM8997_RATES,
103540843aeaSCharles Keepax 			.formats = WM8997_FORMATS,
103640843aeaSCharles Keepax 		},
103740843aeaSCharles Keepax 		.ops = &arizona_simple_dai_ops,
103840843aeaSCharles Keepax 	},
103940843aeaSCharles Keepax 	{
104040843aeaSCharles Keepax 		.name = "wm8997-slim3",
104140843aeaSCharles Keepax 		.id = 5,
104240843aeaSCharles Keepax 		.playback = {
104340843aeaSCharles Keepax 			.stream_name = "Slim3 Playback",
104440843aeaSCharles Keepax 			.channels_min = 1,
104540843aeaSCharles Keepax 			.channels_max = 2,
104640843aeaSCharles Keepax 			.rates = WM8997_RATES,
104740843aeaSCharles Keepax 			.formats = WM8997_FORMATS,
104840843aeaSCharles Keepax 		},
104940843aeaSCharles Keepax 		.capture = {
105040843aeaSCharles Keepax 			.stream_name = "Slim3 Capture",
105140843aeaSCharles Keepax 			.channels_min = 1,
105240843aeaSCharles Keepax 			.channels_max = 2,
105340843aeaSCharles Keepax 			.rates = WM8997_RATES,
105440843aeaSCharles Keepax 			.formats = WM8997_FORMATS,
105540843aeaSCharles Keepax 		},
105640843aeaSCharles Keepax 		.ops = &arizona_simple_dai_ops,
105740843aeaSCharles Keepax 	},
105840843aeaSCharles Keepax };
105940843aeaSCharles Keepax 
106040843aeaSCharles Keepax static int wm8997_codec_probe(struct snd_soc_codec *codec)
106140843aeaSCharles Keepax {
10628383dfd8SLars-Peter Clausen 	struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec);
106335f4403eSRichard Fitzgerald 	struct snd_soc_component *component = snd_soc_dapm_to_component(dapm);
106440843aeaSCharles Keepax 	struct wm8997_priv *priv = snd_soc_codec_get_drvdata(codec);
1065acff07d0SCharles Keepax 	int ret;
106640843aeaSCharles Keepax 
1067acff07d0SCharles Keepax 	ret = arizona_init_spk(codec);
1068acff07d0SCharles Keepax 	if (ret < 0)
1069acff07d0SCharles Keepax 		return ret;
1070acff07d0SCharles Keepax 
107135f4403eSRichard Fitzgerald 	snd_soc_component_disable_pin(component, "HAPTICS");
107240843aeaSCharles Keepax 
10738383dfd8SLars-Peter Clausen 	priv->core.arizona->dapm = dapm;
107440843aeaSCharles Keepax 
107540843aeaSCharles Keepax 	return 0;
107640843aeaSCharles Keepax }
107740843aeaSCharles Keepax 
107840843aeaSCharles Keepax static int wm8997_codec_remove(struct snd_soc_codec *codec)
107940843aeaSCharles Keepax {
108040843aeaSCharles Keepax 	struct wm8997_priv *priv = snd_soc_codec_get_drvdata(codec);
108140843aeaSCharles Keepax 
108240843aeaSCharles Keepax 	priv->core.arizona->dapm = NULL;
108340843aeaSCharles Keepax 
108440843aeaSCharles Keepax 	return 0;
108540843aeaSCharles Keepax }
108640843aeaSCharles Keepax 
108740843aeaSCharles Keepax #define WM8997_DIG_VU 0x0200
108840843aeaSCharles Keepax 
108940843aeaSCharles Keepax static unsigned int wm8997_digital_vu[] = {
109040843aeaSCharles Keepax 	ARIZONA_DAC_DIGITAL_VOLUME_1L,
109140843aeaSCharles Keepax 	ARIZONA_DAC_DIGITAL_VOLUME_1R,
109240843aeaSCharles Keepax 	ARIZONA_DAC_DIGITAL_VOLUME_3L,
109340843aeaSCharles Keepax 	ARIZONA_DAC_DIGITAL_VOLUME_4L,
109440843aeaSCharles Keepax 	ARIZONA_DAC_DIGITAL_VOLUME_5L,
109540843aeaSCharles Keepax 	ARIZONA_DAC_DIGITAL_VOLUME_5R,
109640843aeaSCharles Keepax };
109740843aeaSCharles Keepax 
10987a34b1c1SXiubo Li static struct regmap *wm8997_get_regmap(struct device *dev)
1099964eafb1SXiubo Li {
1100964eafb1SXiubo Li 	struct wm8997_priv *priv = dev_get_drvdata(dev);
1101964eafb1SXiubo Li 
1102964eafb1SXiubo Li 	return priv->core.arizona->regmap;
1103964eafb1SXiubo Li }
1104964eafb1SXiubo Li 
1105f802d6c0SJulia Lawall static const struct snd_soc_codec_driver soc_codec_dev_wm8997 = {
110640843aeaSCharles Keepax 	.probe = wm8997_codec_probe,
110740843aeaSCharles Keepax 	.remove = wm8997_codec_remove,
1108964eafb1SXiubo Li 	.get_regmap =   wm8997_get_regmap,
110940843aeaSCharles Keepax 
111040843aeaSCharles Keepax 	.idle_bias_off = true,
111140843aeaSCharles Keepax 
111240843aeaSCharles Keepax 	.set_sysclk = arizona_set_sysclk,
111340843aeaSCharles Keepax 	.set_pll = wm8997_set_fll,
111440843aeaSCharles Keepax 
11154df0f620SKuninori Morimoto 	.component_driver = {
111640843aeaSCharles Keepax 		.controls		= wm8997_snd_controls,
111740843aeaSCharles Keepax 		.num_controls		= ARRAY_SIZE(wm8997_snd_controls),
111840843aeaSCharles Keepax 		.dapm_widgets		= wm8997_dapm_widgets,
111940843aeaSCharles Keepax 		.num_dapm_widgets	= ARRAY_SIZE(wm8997_dapm_widgets),
112040843aeaSCharles Keepax 		.dapm_routes		= wm8997_dapm_routes,
112140843aeaSCharles Keepax 		.num_dapm_routes	= ARRAY_SIZE(wm8997_dapm_routes),
11224df0f620SKuninori Morimoto 	},
112340843aeaSCharles Keepax };
112440843aeaSCharles Keepax 
112540843aeaSCharles Keepax static int wm8997_probe(struct platform_device *pdev)
112640843aeaSCharles Keepax {
112740843aeaSCharles Keepax 	struct arizona *arizona = dev_get_drvdata(pdev->dev.parent);
112840843aeaSCharles Keepax 	struct wm8997_priv *wm8997;
112931833eadSCharles Keepax 	int i, ret;
113040843aeaSCharles Keepax 
113140843aeaSCharles Keepax 	wm8997 = devm_kzalloc(&pdev->dev, sizeof(struct wm8997_priv),
113240843aeaSCharles Keepax 			      GFP_KERNEL);
113340843aeaSCharles Keepax 	if (wm8997 == NULL)
113440843aeaSCharles Keepax 		return -ENOMEM;
113540843aeaSCharles Keepax 	platform_set_drvdata(pdev, wm8997);
113640843aeaSCharles Keepax 
11370a229b15SCharles Keepax 	if (IS_ENABLED(CONFIG_OF)) {
11380a229b15SCharles Keepax 		if (!dev_get_platdata(arizona->dev)) {
11390a229b15SCharles Keepax 			ret = arizona_of_get_audio_pdata(arizona);
11400a229b15SCharles Keepax 			if (ret < 0)
11410a229b15SCharles Keepax 				return ret;
11420a229b15SCharles Keepax 		}
11430a229b15SCharles Keepax 	}
11440a229b15SCharles Keepax 
114540843aeaSCharles Keepax 	wm8997->core.arizona = arizona;
114640843aeaSCharles Keepax 	wm8997->core.num_inputs = 4;
114740843aeaSCharles Keepax 
1148346d9683SRichard Fitzgerald 	arizona_init_dvfs(&wm8997->core);
1149346d9683SRichard Fitzgerald 
115040843aeaSCharles Keepax 	for (i = 0; i < ARRAY_SIZE(wm8997->fll); i++)
115140843aeaSCharles Keepax 		wm8997->fll[i].vco_mult = 1;
115240843aeaSCharles Keepax 
115340843aeaSCharles Keepax 	arizona_init_fll(arizona, 1, ARIZONA_FLL1_CONTROL_1 - 1,
115440843aeaSCharles Keepax 			 ARIZONA_IRQ_FLL1_LOCK, ARIZONA_IRQ_FLL1_CLOCK_OK,
115540843aeaSCharles Keepax 			 &wm8997->fll[0]);
115640843aeaSCharles Keepax 	arizona_init_fll(arizona, 2, ARIZONA_FLL2_CONTROL_1 - 1,
115740843aeaSCharles Keepax 			 ARIZONA_IRQ_FLL2_LOCK, ARIZONA_IRQ_FLL2_CLOCK_OK,
115840843aeaSCharles Keepax 			 &wm8997->fll[1]);
115940843aeaSCharles Keepax 
116040843aeaSCharles Keepax 	/* SR2 fixed at 8kHz, SR3 fixed at 16kHz */
116140843aeaSCharles Keepax 	regmap_update_bits(arizona->regmap, ARIZONA_SAMPLE_RATE_2,
116240843aeaSCharles Keepax 			   ARIZONA_SAMPLE_RATE_2_MASK, 0x11);
116340843aeaSCharles Keepax 	regmap_update_bits(arizona->regmap, ARIZONA_SAMPLE_RATE_3,
116440843aeaSCharles Keepax 			   ARIZONA_SAMPLE_RATE_3_MASK, 0x12);
116540843aeaSCharles Keepax 
116640843aeaSCharles Keepax 	for (i = 0; i < ARRAY_SIZE(wm8997_dai); i++)
116740843aeaSCharles Keepax 		arizona_init_dai(&wm8997->core, i);
116840843aeaSCharles Keepax 
116940843aeaSCharles Keepax 	/* Latch volume update bits */
117040843aeaSCharles Keepax 	for (i = 0; i < ARRAY_SIZE(wm8997_digital_vu); i++)
117140843aeaSCharles Keepax 		regmap_update_bits(arizona->regmap, wm8997_digital_vu[i],
117240843aeaSCharles Keepax 				   WM8997_DIG_VU, WM8997_DIG_VU);
117340843aeaSCharles Keepax 
117440843aeaSCharles Keepax 	pm_runtime_enable(&pdev->dev);
117540843aeaSCharles Keepax 	pm_runtime_idle(&pdev->dev);
117640843aeaSCharles Keepax 
11779e3f9f36SCharles Keepax 	arizona_init_common(arizona);
11789e3f9f36SCharles Keepax 
1179*85e7dd3fSCharles Keepax 	ret = arizona_init_vol_limit(arizona);
1180*85e7dd3fSCharles Keepax 	if (ret < 0)
1181*85e7dd3fSCharles Keepax 		return ret;
118231833eadSCharles Keepax 	ret = arizona_init_spk_irqs(arizona);
118331833eadSCharles Keepax 	if (ret < 0)
118431833eadSCharles Keepax 		return ret;
118531833eadSCharles Keepax 
118631833eadSCharles Keepax 	ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wm8997,
118740843aeaSCharles Keepax 				     wm8997_dai, ARRAY_SIZE(wm8997_dai));
118831833eadSCharles Keepax 	if (ret < 0) {
118931833eadSCharles Keepax 		dev_err(&pdev->dev, "Failed to register codec: %d\n", ret);
119031833eadSCharles Keepax 		goto err_spk_irqs;
119131833eadSCharles Keepax 	}
119231833eadSCharles Keepax 
119331833eadSCharles Keepax err_spk_irqs:
119431833eadSCharles Keepax 	arizona_free_spk_irqs(arizona);
119531833eadSCharles Keepax 
119631833eadSCharles Keepax 	return ret;
119740843aeaSCharles Keepax }
119840843aeaSCharles Keepax 
119940843aeaSCharles Keepax static int wm8997_remove(struct platform_device *pdev)
120040843aeaSCharles Keepax {
120131833eadSCharles Keepax 	struct wm8997_priv *wm8997 = platform_get_drvdata(pdev);
120231833eadSCharles Keepax 	struct arizona *arizona = wm8997->core.arizona;
120331833eadSCharles Keepax 
120440843aeaSCharles Keepax 	snd_soc_unregister_codec(&pdev->dev);
120540843aeaSCharles Keepax 	pm_runtime_disable(&pdev->dev);
120640843aeaSCharles Keepax 
120731833eadSCharles Keepax 	arizona_free_spk_irqs(arizona);
120831833eadSCharles Keepax 
120940843aeaSCharles Keepax 	return 0;
121040843aeaSCharles Keepax }
121140843aeaSCharles Keepax 
121240843aeaSCharles Keepax static struct platform_driver wm8997_codec_driver = {
121340843aeaSCharles Keepax 	.driver = {
121440843aeaSCharles Keepax 		.name = "wm8997-codec",
121540843aeaSCharles Keepax 	},
121640843aeaSCharles Keepax 	.probe = wm8997_probe,
121740843aeaSCharles Keepax 	.remove = wm8997_remove,
121840843aeaSCharles Keepax };
121940843aeaSCharles Keepax 
122040843aeaSCharles Keepax module_platform_driver(wm8997_codec_driver);
122140843aeaSCharles Keepax 
122240843aeaSCharles Keepax MODULE_DESCRIPTION("ASoC WM8997 driver");
122340843aeaSCharles Keepax MODULE_AUTHOR("Charles Keepax <ckeepax@opensource.wolfsonmicro.com>");
122440843aeaSCharles Keepax MODULE_LICENSE("GPL");
122540843aeaSCharles Keepax MODULE_ALIAS("platform:wm8997-codec");
1226