Linux Audio

Check our new training course

Linux debugging, profiling, tracing and performance analysis training

Apr 14-17, 2025
Register
Loading...
v6.13.7
   1// SPDX-License-Identifier: GPL-2.0-only
   2/*
   3 * cs47l24.h  --  ALSA SoC Audio driver for Cirrus Logic CS47L24
   4 *
   5 * Copyright 2015 Cirrus Logic Inc.
   6 *
   7 * Author: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
 
 
 
 
   8 */
   9
  10#include <linux/module.h>
  11#include <linux/moduleparam.h>
  12#include <linux/init.h>
  13#include <linux/delay.h>
  14#include <linux/pm.h>
  15#include <linux/pm_runtime.h>
  16#include <linux/regmap.h>
  17#include <linux/slab.h>
  18#include <sound/core.h>
  19#include <sound/pcm.h>
  20#include <sound/pcm_params.h>
  21#include <sound/soc.h>
  22#include <sound/jack.h>
  23#include <sound/initval.h>
  24#include <sound/tlv.h>
  25
  26#include <linux/mfd/arizona/core.h>
  27#include <linux/mfd/arizona/registers.h>
  28
  29#include "arizona.h"
  30#include "wm_adsp.h"
  31#include "cs47l24.h"
  32
  33#define DRV_NAME "cs47l24-codec"
  34
  35struct cs47l24_priv {
  36	struct arizona_priv core;
  37	struct arizona_fll fll[2];
  38};
  39
  40static const struct cs_dsp_region cs47l24_dsp2_regions[] = {
  41	{ .type = WMFW_ADSP2_PM, .base = 0x200000 },
  42	{ .type = WMFW_ADSP2_ZM, .base = 0x280000 },
  43	{ .type = WMFW_ADSP2_XM, .base = 0x290000 },
  44	{ .type = WMFW_ADSP2_YM, .base = 0x2a8000 },
  45};
  46
  47static const struct cs_dsp_region cs47l24_dsp3_regions[] = {
  48	{ .type = WMFW_ADSP2_PM, .base = 0x300000 },
  49	{ .type = WMFW_ADSP2_ZM, .base = 0x380000 },
  50	{ .type = WMFW_ADSP2_XM, .base = 0x390000 },
  51	{ .type = WMFW_ADSP2_YM, .base = 0x3a8000 },
  52};
  53
  54static const struct cs_dsp_region *cs47l24_dsp_regions[] = {
  55	cs47l24_dsp2_regions,
  56	cs47l24_dsp3_regions,
  57};
  58
  59static int cs47l24_adsp_power_ev(struct snd_soc_dapm_widget *w,
  60				 struct snd_kcontrol *kcontrol, int event)
  61{
  62	struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
  63	struct arizona *arizona = dev_get_drvdata(component->dev->parent);
  64	unsigned int v;
  65	int ret;
  66
  67	ret = regmap_read(arizona->regmap, ARIZONA_SYSTEM_CLOCK_1, &v);
  68	if (ret != 0) {
  69		dev_err(component->dev, "Failed to read SYSCLK state: %d\n", ret);
  70		return ret;
  71	}
  72
  73	v = (v & ARIZONA_SYSCLK_FREQ_MASK) >> ARIZONA_SYSCLK_FREQ_SHIFT;
  74
  75	wm_adsp2_set_dspclk(w, v);
  76
  77	return wm_adsp_early_event(w, kcontrol, event);
  78}
  79
  80static DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0);
  81static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0);
  82static DECLARE_TLV_DB_SCALE(noise_tlv, -13200, 600, 0);
  83static DECLARE_TLV_DB_SCALE(ng_tlv, -10200, 600, 0);
  84
  85#define CS47L24_NG_SRC(name, base) \
  86	SOC_SINGLE(name " NG HPOUT1L Switch",  base,  0, 1, 0), \
  87	SOC_SINGLE(name " NG HPOUT1R Switch",  base,  1, 1, 0), \
  88	SOC_SINGLE(name " NG SPKOUT Switch",  base,  6, 1, 0)
  89
  90static const struct snd_kcontrol_new cs47l24_snd_controls[] = {
  91SOC_ENUM("IN1 OSR", arizona_in_dmic_osr[0]),
  92SOC_ENUM("IN2 OSR", arizona_in_dmic_osr[1]),
  93
  94SOC_ENUM("IN HPF Cutoff Frequency", arizona_in_hpf_cut_enum),
  95
  96SOC_SINGLE("IN1L HPF Switch", ARIZONA_IN1L_CONTROL,
  97	   ARIZONA_IN1L_HPF_SHIFT, 1, 0),
  98SOC_SINGLE("IN1R HPF Switch", ARIZONA_IN1R_CONTROL,
  99	   ARIZONA_IN1R_HPF_SHIFT, 1, 0),
 100SOC_SINGLE("IN2L HPF Switch", ARIZONA_IN2L_CONTROL,
 101	   ARIZONA_IN2L_HPF_SHIFT, 1, 0),
 102SOC_SINGLE("IN2R HPF Switch", ARIZONA_IN2R_CONTROL,
 103	   ARIZONA_IN2R_HPF_SHIFT, 1, 0),
 104
 105SOC_SINGLE_TLV("IN1L Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_1L,
 106	       ARIZONA_IN1L_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
 107SOC_SINGLE_TLV("IN1R Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_1R,
 108	       ARIZONA_IN1R_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
 109SOC_SINGLE_TLV("IN2L Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_2L,
 110	       ARIZONA_IN2L_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
 111SOC_SINGLE_TLV("IN2R Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_2R,
 112	       ARIZONA_IN2R_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
 113
 114SOC_ENUM("Input Ramp Up", arizona_in_vi_ramp),
 115SOC_ENUM("Input Ramp Down", arizona_in_vd_ramp),
 116
 117ARIZONA_MIXER_CONTROLS("EQ1", ARIZONA_EQ1MIX_INPUT_1_SOURCE),
 118ARIZONA_MIXER_CONTROLS("EQ2", ARIZONA_EQ2MIX_INPUT_1_SOURCE),
 119
 120ARIZONA_EQ_CONTROL("EQ1 Coefficients", ARIZONA_EQ1_2),
 121SOC_SINGLE_TLV("EQ1 B1 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B1_GAIN_SHIFT,
 122	       24, 0, eq_tlv),
 123SOC_SINGLE_TLV("EQ1 B2 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B2_GAIN_SHIFT,
 124	       24, 0, eq_tlv),
 125SOC_SINGLE_TLV("EQ1 B3 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B3_GAIN_SHIFT,
 126	       24, 0, eq_tlv),
 127SOC_SINGLE_TLV("EQ1 B4 Volume", ARIZONA_EQ1_2, ARIZONA_EQ1_B4_GAIN_SHIFT,
 128	       24, 0, eq_tlv),
 129SOC_SINGLE_TLV("EQ1 B5 Volume", ARIZONA_EQ1_2, ARIZONA_EQ1_B5_GAIN_SHIFT,
 130	       24, 0, eq_tlv),
 131
 132ARIZONA_EQ_CONTROL("EQ2 Coefficients", ARIZONA_EQ2_2),
 133SOC_SINGLE_TLV("EQ2 B1 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B1_GAIN_SHIFT,
 134	       24, 0, eq_tlv),
 135SOC_SINGLE_TLV("EQ2 B2 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B2_GAIN_SHIFT,
 136	       24, 0, eq_tlv),
 137SOC_SINGLE_TLV("EQ2 B3 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B3_GAIN_SHIFT,
 138	       24, 0, eq_tlv),
 139SOC_SINGLE_TLV("EQ2 B4 Volume", ARIZONA_EQ2_2, ARIZONA_EQ2_B4_GAIN_SHIFT,
 140	       24, 0, eq_tlv),
 141SOC_SINGLE_TLV("EQ2 B5 Volume", ARIZONA_EQ2_2, ARIZONA_EQ2_B5_GAIN_SHIFT,
 142	       24, 0, eq_tlv),
 143
 144ARIZONA_MIXER_CONTROLS("DRC1L", ARIZONA_DRC1LMIX_INPUT_1_SOURCE),
 145ARIZONA_MIXER_CONTROLS("DRC1R", ARIZONA_DRC1RMIX_INPUT_1_SOURCE),
 146ARIZONA_MIXER_CONTROLS("DRC2L", ARIZONA_DRC2LMIX_INPUT_1_SOURCE),
 147ARIZONA_MIXER_CONTROLS("DRC2R", ARIZONA_DRC2RMIX_INPUT_1_SOURCE),
 148
 149SND_SOC_BYTES_MASK("DRC1", ARIZONA_DRC1_CTRL1, 5,
 150		   ARIZONA_DRC1R_ENA | ARIZONA_DRC1L_ENA),
 151SND_SOC_BYTES_MASK("DRC2", ARIZONA_DRC2_CTRL1, 5,
 152		   ARIZONA_DRC2R_ENA | ARIZONA_DRC2L_ENA),
 153
 154ARIZONA_MIXER_CONTROLS("LHPF1", ARIZONA_HPLP1MIX_INPUT_1_SOURCE),
 155ARIZONA_MIXER_CONTROLS("LHPF2", ARIZONA_HPLP2MIX_INPUT_1_SOURCE),
 156ARIZONA_MIXER_CONTROLS("LHPF3", ARIZONA_HPLP3MIX_INPUT_1_SOURCE),
 157ARIZONA_MIXER_CONTROLS("LHPF4", ARIZONA_HPLP4MIX_INPUT_1_SOURCE),
 158
 159ARIZONA_LHPF_CONTROL("LHPF1 Coefficients", ARIZONA_HPLPF1_2),
 160ARIZONA_LHPF_CONTROL("LHPF2 Coefficients", ARIZONA_HPLPF2_2),
 161ARIZONA_LHPF_CONTROL("LHPF3 Coefficients", ARIZONA_HPLPF3_2),
 162ARIZONA_LHPF_CONTROL("LHPF4 Coefficients", ARIZONA_HPLPF4_2),
 163
 164SOC_ENUM("LHPF1 Mode", arizona_lhpf1_mode),
 165SOC_ENUM("LHPF2 Mode", arizona_lhpf2_mode),
 166SOC_ENUM("LHPF3 Mode", arizona_lhpf3_mode),
 167SOC_ENUM("LHPF4 Mode", arizona_lhpf4_mode),
 168
 169SOC_ENUM("ISRC1 FSL", arizona_isrc_fsl[0]),
 170SOC_ENUM("ISRC2 FSL", arizona_isrc_fsl[1]),
 171SOC_ENUM("ISRC3 FSL", arizona_isrc_fsl[2]),
 172SOC_ENUM("ISRC1 FSH", arizona_isrc_fsh[0]),
 173SOC_ENUM("ISRC2 FSH", arizona_isrc_fsh[1]),
 174SOC_ENUM("ISRC3 FSH", arizona_isrc_fsh[2]),
 175SOC_ENUM("ASRC RATE 1", arizona_asrc_rate1),
 176
 177WM_ADSP2_PRELOAD_SWITCH("DSP2", 2),
 178WM_ADSP2_PRELOAD_SWITCH("DSP3", 3),
 179
 180ARIZONA_MIXER_CONTROLS("DSP2L", ARIZONA_DSP2LMIX_INPUT_1_SOURCE),
 181ARIZONA_MIXER_CONTROLS("DSP2R", ARIZONA_DSP2RMIX_INPUT_1_SOURCE),
 182ARIZONA_MIXER_CONTROLS("DSP3L", ARIZONA_DSP3LMIX_INPUT_1_SOURCE),
 183ARIZONA_MIXER_CONTROLS("DSP3R", ARIZONA_DSP3RMIX_INPUT_1_SOURCE),
 184
 185SOC_SINGLE_TLV("Noise Generator Volume", ARIZONA_COMFORT_NOISE_GENERATOR,
 186	       ARIZONA_NOISE_GEN_GAIN_SHIFT, 0x16, 0, noise_tlv),
 187
 188ARIZONA_MIXER_CONTROLS("HPOUT1L", ARIZONA_OUT1LMIX_INPUT_1_SOURCE),
 189ARIZONA_MIXER_CONTROLS("HPOUT1R", ARIZONA_OUT1RMIX_INPUT_1_SOURCE),
 190ARIZONA_MIXER_CONTROLS("SPKOUT", ARIZONA_OUT4LMIX_INPUT_1_SOURCE),
 191
 192SOC_SINGLE("HPOUT1 SC Protect Switch", ARIZONA_HP1_SHORT_CIRCUIT_CTRL,
 193	   ARIZONA_HP1_SC_ENA_SHIFT, 1, 0),
 194
 195SOC_DOUBLE_R("HPOUT1 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_1L,
 196	     ARIZONA_DAC_DIGITAL_VOLUME_1R, ARIZONA_OUT1L_MUTE_SHIFT, 1, 1),
 197SOC_SINGLE("Speaker Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_4L,
 198	   ARIZONA_OUT4L_MUTE_SHIFT, 1, 1),
 199
 200SOC_DOUBLE_R_TLV("HPOUT1 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_1L,
 201		 ARIZONA_DAC_DIGITAL_VOLUME_1R, ARIZONA_OUT1L_VOL_SHIFT,
 202		 0xbf, 0, digital_tlv),
 203SOC_SINGLE_TLV("Speaker Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_4L,
 204	       ARIZONA_OUT4L_VOL_SHIFT, 0xbf, 0, digital_tlv),
 205
 206SOC_ENUM("Output Ramp Up", arizona_out_vi_ramp),
 207SOC_ENUM("Output Ramp Down", arizona_out_vd_ramp),
 208
 209SOC_SINGLE("Noise Gate Switch", ARIZONA_NOISE_GATE_CONTROL,
 210	   ARIZONA_NGATE_ENA_SHIFT, 1, 0),
 211SOC_SINGLE_TLV("Noise Gate Threshold Volume", ARIZONA_NOISE_GATE_CONTROL,
 212	       ARIZONA_NGATE_THR_SHIFT, 7, 1, ng_tlv),
 213SOC_ENUM("Noise Gate Hold", arizona_ng_hold),
 214
 215CS47L24_NG_SRC("HPOUT1L", ARIZONA_NOISE_GATE_SELECT_1L),
 216CS47L24_NG_SRC("HPOUT1R", ARIZONA_NOISE_GATE_SELECT_1R),
 217CS47L24_NG_SRC("SPKOUT", ARIZONA_NOISE_GATE_SELECT_4L),
 218
 219ARIZONA_MIXER_CONTROLS("AIF1TX1", ARIZONA_AIF1TX1MIX_INPUT_1_SOURCE),
 220ARIZONA_MIXER_CONTROLS("AIF1TX2", ARIZONA_AIF1TX2MIX_INPUT_1_SOURCE),
 221ARIZONA_MIXER_CONTROLS("AIF1TX3", ARIZONA_AIF1TX3MIX_INPUT_1_SOURCE),
 222ARIZONA_MIXER_CONTROLS("AIF1TX4", ARIZONA_AIF1TX4MIX_INPUT_1_SOURCE),
 223ARIZONA_MIXER_CONTROLS("AIF1TX5", ARIZONA_AIF1TX5MIX_INPUT_1_SOURCE),
 224ARIZONA_MIXER_CONTROLS("AIF1TX6", ARIZONA_AIF1TX6MIX_INPUT_1_SOURCE),
 225ARIZONA_MIXER_CONTROLS("AIF1TX7", ARIZONA_AIF1TX7MIX_INPUT_1_SOURCE),
 226ARIZONA_MIXER_CONTROLS("AIF1TX8", ARIZONA_AIF1TX8MIX_INPUT_1_SOURCE),
 227
 228ARIZONA_MIXER_CONTROLS("AIF2TX1", ARIZONA_AIF2TX1MIX_INPUT_1_SOURCE),
 229ARIZONA_MIXER_CONTROLS("AIF2TX2", ARIZONA_AIF2TX2MIX_INPUT_1_SOURCE),
 230ARIZONA_MIXER_CONTROLS("AIF2TX3", ARIZONA_AIF2TX3MIX_INPUT_1_SOURCE),
 231ARIZONA_MIXER_CONTROLS("AIF2TX4", ARIZONA_AIF2TX4MIX_INPUT_1_SOURCE),
 232ARIZONA_MIXER_CONTROLS("AIF2TX5", ARIZONA_AIF2TX5MIX_INPUT_1_SOURCE),
 233ARIZONA_MIXER_CONTROLS("AIF2TX6", ARIZONA_AIF2TX6MIX_INPUT_1_SOURCE),
 234
 235ARIZONA_MIXER_CONTROLS("AIF3TX1", ARIZONA_AIF3TX1MIX_INPUT_1_SOURCE),
 236ARIZONA_MIXER_CONTROLS("AIF3TX2", ARIZONA_AIF3TX2MIX_INPUT_1_SOURCE),
 237
 238WM_ADSP_FW_CONTROL("DSP2", 1),
 239WM_ADSP_FW_CONTROL("DSP3", 2),
 240};
 241
 242ARIZONA_MIXER_ENUMS(EQ1, ARIZONA_EQ1MIX_INPUT_1_SOURCE);
 243ARIZONA_MIXER_ENUMS(EQ2, ARIZONA_EQ2MIX_INPUT_1_SOURCE);
 244
 245ARIZONA_MIXER_ENUMS(DRC1L, ARIZONA_DRC1LMIX_INPUT_1_SOURCE);
 246ARIZONA_MIXER_ENUMS(DRC1R, ARIZONA_DRC1RMIX_INPUT_1_SOURCE);
 247ARIZONA_MIXER_ENUMS(DRC2L, ARIZONA_DRC2LMIX_INPUT_1_SOURCE);
 248ARIZONA_MIXER_ENUMS(DRC2R, ARIZONA_DRC2RMIX_INPUT_1_SOURCE);
 249
 250ARIZONA_MIXER_ENUMS(LHPF1, ARIZONA_HPLP1MIX_INPUT_1_SOURCE);
 251ARIZONA_MIXER_ENUMS(LHPF2, ARIZONA_HPLP2MIX_INPUT_1_SOURCE);
 252ARIZONA_MIXER_ENUMS(LHPF3, ARIZONA_HPLP3MIX_INPUT_1_SOURCE);
 253ARIZONA_MIXER_ENUMS(LHPF4, ARIZONA_HPLP4MIX_INPUT_1_SOURCE);
 254
 255ARIZONA_MIXER_ENUMS(DSP2L, ARIZONA_DSP2LMIX_INPUT_1_SOURCE);
 256ARIZONA_MIXER_ENUMS(DSP2R, ARIZONA_DSP2RMIX_INPUT_1_SOURCE);
 257ARIZONA_DSP_AUX_ENUMS(DSP2, ARIZONA_DSP2AUX1MIX_INPUT_1_SOURCE);
 258
 259ARIZONA_MIXER_ENUMS(DSP3L, ARIZONA_DSP3LMIX_INPUT_1_SOURCE);
 260ARIZONA_MIXER_ENUMS(DSP3R, ARIZONA_DSP3RMIX_INPUT_1_SOURCE);
 261ARIZONA_DSP_AUX_ENUMS(DSP3, ARIZONA_DSP3AUX1MIX_INPUT_1_SOURCE);
 262
 263ARIZONA_MIXER_ENUMS(PWM1, ARIZONA_PWM1MIX_INPUT_1_SOURCE);
 264ARIZONA_MIXER_ENUMS(PWM2, ARIZONA_PWM2MIX_INPUT_1_SOURCE);
 265
 266ARIZONA_MIXER_ENUMS(OUT1L, ARIZONA_OUT1LMIX_INPUT_1_SOURCE);
 267ARIZONA_MIXER_ENUMS(OUT1R, ARIZONA_OUT1RMIX_INPUT_1_SOURCE);
 268ARIZONA_MIXER_ENUMS(SPKOUT, ARIZONA_OUT4LMIX_INPUT_1_SOURCE);
 269
 270ARIZONA_MIXER_ENUMS(AIF1TX1, ARIZONA_AIF1TX1MIX_INPUT_1_SOURCE);
 271ARIZONA_MIXER_ENUMS(AIF1TX2, ARIZONA_AIF1TX2MIX_INPUT_1_SOURCE);
 272ARIZONA_MIXER_ENUMS(AIF1TX3, ARIZONA_AIF1TX3MIX_INPUT_1_SOURCE);
 273ARIZONA_MIXER_ENUMS(AIF1TX4, ARIZONA_AIF1TX4MIX_INPUT_1_SOURCE);
 274ARIZONA_MIXER_ENUMS(AIF1TX5, ARIZONA_AIF1TX5MIX_INPUT_1_SOURCE);
 275ARIZONA_MIXER_ENUMS(AIF1TX6, ARIZONA_AIF1TX6MIX_INPUT_1_SOURCE);
 276ARIZONA_MIXER_ENUMS(AIF1TX7, ARIZONA_AIF1TX7MIX_INPUT_1_SOURCE);
 277ARIZONA_MIXER_ENUMS(AIF1TX8, ARIZONA_AIF1TX8MIX_INPUT_1_SOURCE);
 278
 279ARIZONA_MIXER_ENUMS(AIF2TX1, ARIZONA_AIF2TX1MIX_INPUT_1_SOURCE);
 280ARIZONA_MIXER_ENUMS(AIF2TX2, ARIZONA_AIF2TX2MIX_INPUT_1_SOURCE);
 281ARIZONA_MIXER_ENUMS(AIF2TX3, ARIZONA_AIF2TX3MIX_INPUT_1_SOURCE);
 282ARIZONA_MIXER_ENUMS(AIF2TX4, ARIZONA_AIF2TX4MIX_INPUT_1_SOURCE);
 283ARIZONA_MIXER_ENUMS(AIF2TX5, ARIZONA_AIF2TX5MIX_INPUT_1_SOURCE);
 284ARIZONA_MIXER_ENUMS(AIF2TX6, ARIZONA_AIF2TX6MIX_INPUT_1_SOURCE);
 285
 286ARIZONA_MIXER_ENUMS(AIF3TX1, ARIZONA_AIF3TX1MIX_INPUT_1_SOURCE);
 287ARIZONA_MIXER_ENUMS(AIF3TX2, ARIZONA_AIF3TX2MIX_INPUT_1_SOURCE);
 288
 289ARIZONA_MUX_ENUMS(ASRC1L, ARIZONA_ASRC1LMIX_INPUT_1_SOURCE);
 290ARIZONA_MUX_ENUMS(ASRC1R, ARIZONA_ASRC1RMIX_INPUT_1_SOURCE);
 291ARIZONA_MUX_ENUMS(ASRC2L, ARIZONA_ASRC2LMIX_INPUT_1_SOURCE);
 292ARIZONA_MUX_ENUMS(ASRC2R, ARIZONA_ASRC2RMIX_INPUT_1_SOURCE);
 293
 294ARIZONA_MUX_ENUMS(ISRC1INT1, ARIZONA_ISRC1INT1MIX_INPUT_1_SOURCE);
 295ARIZONA_MUX_ENUMS(ISRC1INT2, ARIZONA_ISRC1INT2MIX_INPUT_1_SOURCE);
 296ARIZONA_MUX_ENUMS(ISRC1INT3, ARIZONA_ISRC1INT3MIX_INPUT_1_SOURCE);
 297ARIZONA_MUX_ENUMS(ISRC1INT4, ARIZONA_ISRC1INT4MIX_INPUT_1_SOURCE);
 298
 299ARIZONA_MUX_ENUMS(ISRC1DEC1, ARIZONA_ISRC1DEC1MIX_INPUT_1_SOURCE);
 300ARIZONA_MUX_ENUMS(ISRC1DEC2, ARIZONA_ISRC1DEC2MIX_INPUT_1_SOURCE);
 301ARIZONA_MUX_ENUMS(ISRC1DEC3, ARIZONA_ISRC1DEC3MIX_INPUT_1_SOURCE);
 302ARIZONA_MUX_ENUMS(ISRC1DEC4, ARIZONA_ISRC1DEC4MIX_INPUT_1_SOURCE);
 303
 304ARIZONA_MUX_ENUMS(ISRC2INT1, ARIZONA_ISRC2INT1MIX_INPUT_1_SOURCE);
 305ARIZONA_MUX_ENUMS(ISRC2INT2, ARIZONA_ISRC2INT2MIX_INPUT_1_SOURCE);
 306ARIZONA_MUX_ENUMS(ISRC2INT3, ARIZONA_ISRC2INT3MIX_INPUT_1_SOURCE);
 307ARIZONA_MUX_ENUMS(ISRC2INT4, ARIZONA_ISRC2INT4MIX_INPUT_1_SOURCE);
 308
 309ARIZONA_MUX_ENUMS(ISRC2DEC1, ARIZONA_ISRC2DEC1MIX_INPUT_1_SOURCE);
 310ARIZONA_MUX_ENUMS(ISRC2DEC2, ARIZONA_ISRC2DEC2MIX_INPUT_1_SOURCE);
 311ARIZONA_MUX_ENUMS(ISRC2DEC3, ARIZONA_ISRC2DEC3MIX_INPUT_1_SOURCE);
 312ARIZONA_MUX_ENUMS(ISRC2DEC4, ARIZONA_ISRC2DEC4MIX_INPUT_1_SOURCE);
 313
 314ARIZONA_MUX_ENUMS(ISRC3INT1, ARIZONA_ISRC3INT1MIX_INPUT_1_SOURCE);
 315ARIZONA_MUX_ENUMS(ISRC3INT2, ARIZONA_ISRC3INT2MIX_INPUT_1_SOURCE);
 316ARIZONA_MUX_ENUMS(ISRC3INT3, ARIZONA_ISRC3INT3MIX_INPUT_1_SOURCE);
 317ARIZONA_MUX_ENUMS(ISRC3INT4, ARIZONA_ISRC3INT4MIX_INPUT_1_SOURCE);
 318
 319ARIZONA_MUX_ENUMS(ISRC3DEC1, ARIZONA_ISRC3DEC1MIX_INPUT_1_SOURCE);
 320ARIZONA_MUX_ENUMS(ISRC3DEC2, ARIZONA_ISRC3DEC2MIX_INPUT_1_SOURCE);
 321ARIZONA_MUX_ENUMS(ISRC3DEC3, ARIZONA_ISRC3DEC3MIX_INPUT_1_SOURCE);
 322ARIZONA_MUX_ENUMS(ISRC3DEC4, ARIZONA_ISRC3DEC4MIX_INPUT_1_SOURCE);
 323
 324static const char * const cs47l24_aec_loopback_texts[] = {
 325	"HPOUT1L", "HPOUT1R", "SPKOUT",
 326};
 327
 328static const unsigned int cs47l24_aec_loopback_values[] = {
 329	0, 1, 6,
 330};
 331
 332static const struct soc_enum cs47l24_aec_loopback =
 333	SOC_VALUE_ENUM_SINGLE(ARIZONA_DAC_AEC_CONTROL_1,
 334			      ARIZONA_AEC_LOOPBACK_SRC_SHIFT, 0xf,
 335			      ARRAY_SIZE(cs47l24_aec_loopback_texts),
 336			      cs47l24_aec_loopback_texts,
 337			      cs47l24_aec_loopback_values);
 338
 339static const struct snd_kcontrol_new cs47l24_aec_loopback_mux =
 340	SOC_DAPM_ENUM("AEC Loopback", cs47l24_aec_loopback);
 341
 342static const struct snd_soc_dapm_widget cs47l24_dapm_widgets[] = {
 343SND_SOC_DAPM_SUPPLY("SYSCLK", ARIZONA_SYSTEM_CLOCK_1,
 344		    ARIZONA_SYSCLK_ENA_SHIFT, 0, arizona_clk_ev,
 345		    SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
 346SND_SOC_DAPM_SUPPLY("ASYNCCLK", ARIZONA_ASYNC_CLOCK_1,
 347		    ARIZONA_ASYNC_CLK_ENA_SHIFT, 0, arizona_clk_ev,
 348		    SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
 349SND_SOC_DAPM_SUPPLY("OPCLK", ARIZONA_OUTPUT_SYSTEM_CLOCK,
 350		    ARIZONA_OPCLK_ENA_SHIFT, 0, NULL, 0),
 351SND_SOC_DAPM_SUPPLY("ASYNCOPCLK", ARIZONA_OUTPUT_ASYNC_CLOCK,
 352		    ARIZONA_OPCLK_ASYNC_ENA_SHIFT, 0, NULL, 0),
 353
 354SND_SOC_DAPM_REGULATOR_SUPPLY("CPVDD", 20, 0),
 355SND_SOC_DAPM_REGULATOR_SUPPLY("MICVDD", 0, SND_SOC_DAPM_REGULATOR_BYPASS),
 356SND_SOC_DAPM_REGULATOR_SUPPLY("SPKVDD", 0, 0),
 357
 358SND_SOC_DAPM_SIGGEN("TONE"),
 359SND_SOC_DAPM_SIGGEN("NOISE"),
 360SND_SOC_DAPM_SIGGEN("HAPTICS"),
 361
 362SND_SOC_DAPM_INPUT("IN1L"),
 363SND_SOC_DAPM_INPUT("IN1R"),
 364SND_SOC_DAPM_INPUT("IN2L"),
 365SND_SOC_DAPM_INPUT("IN2R"),
 366
 367SND_SOC_DAPM_OUTPUT("DRC1 Signal Activity"),
 368SND_SOC_DAPM_OUTPUT("DRC2 Signal Activity"),
 369
 370SND_SOC_DAPM_OUTPUT("DSP Voice Trigger"),
 371
 372SND_SOC_DAPM_SWITCH("DSP3 Voice Trigger", SND_SOC_NOPM, 2, 0,
 373		    &arizona_voice_trigger_switch[2]),
 374
 375SND_SOC_DAPM_PGA_E("IN1L PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN1L_ENA_SHIFT,
 376		   0, NULL, 0, arizona_in_ev,
 377		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
 378		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
 379SND_SOC_DAPM_PGA_E("IN1R PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN1R_ENA_SHIFT,
 380		   0, NULL, 0, arizona_in_ev,
 381		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
 382		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
 383SND_SOC_DAPM_PGA_E("IN2L PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN2L_ENA_SHIFT,
 384		   0, NULL, 0, arizona_in_ev,
 385		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
 386		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
 387SND_SOC_DAPM_PGA_E("IN2R PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN2R_ENA_SHIFT,
 388		   0, NULL, 0, arizona_in_ev,
 389		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
 390		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
 391
 392SND_SOC_DAPM_SUPPLY("MICBIAS1", ARIZONA_MIC_BIAS_CTRL_1,
 393		    ARIZONA_MICB1_ENA_SHIFT, 0, NULL, 0),
 394SND_SOC_DAPM_SUPPLY("MICBIAS2", ARIZONA_MIC_BIAS_CTRL_2,
 395		    ARIZONA_MICB1_ENA_SHIFT, 0, NULL, 0),
 396
 397SND_SOC_DAPM_PGA("Noise Generator", ARIZONA_COMFORT_NOISE_GENERATOR,
 398		 ARIZONA_NOISE_GEN_ENA_SHIFT, 0, NULL, 0),
 399
 400SND_SOC_DAPM_PGA("Tone Generator 1", ARIZONA_TONE_GENERATOR_1,
 401		 ARIZONA_TONE1_ENA_SHIFT, 0, NULL, 0),
 402SND_SOC_DAPM_PGA("Tone Generator 2", ARIZONA_TONE_GENERATOR_1,
 403		 ARIZONA_TONE2_ENA_SHIFT, 0, NULL, 0),
 404
 405SND_SOC_DAPM_PGA("EQ1", ARIZONA_EQ1_1, ARIZONA_EQ1_ENA_SHIFT, 0, NULL, 0),
 406SND_SOC_DAPM_PGA("EQ2", ARIZONA_EQ2_1, ARIZONA_EQ2_ENA_SHIFT, 0, NULL, 0),
 407
 408SND_SOC_DAPM_PGA("DRC1L", ARIZONA_DRC1_CTRL1, ARIZONA_DRC1L_ENA_SHIFT, 0,
 409		 NULL, 0),
 410SND_SOC_DAPM_PGA("DRC1R", ARIZONA_DRC1_CTRL1, ARIZONA_DRC1R_ENA_SHIFT, 0,
 411		 NULL, 0),
 412SND_SOC_DAPM_PGA("DRC2L", ARIZONA_DRC2_CTRL1, ARIZONA_DRC2L_ENA_SHIFT, 0,
 413		 NULL, 0),
 414SND_SOC_DAPM_PGA("DRC2R", ARIZONA_DRC2_CTRL1, ARIZONA_DRC2R_ENA_SHIFT, 0,
 415		 NULL, 0),
 416
 417SND_SOC_DAPM_PGA("LHPF1", ARIZONA_HPLPF1_1, ARIZONA_LHPF1_ENA_SHIFT, 0,
 418		 NULL, 0),
 419SND_SOC_DAPM_PGA("LHPF2", ARIZONA_HPLPF2_1, ARIZONA_LHPF2_ENA_SHIFT, 0,
 420		 NULL, 0),
 421SND_SOC_DAPM_PGA("LHPF3", ARIZONA_HPLPF3_1, ARIZONA_LHPF3_ENA_SHIFT, 0,
 422		 NULL, 0),
 423SND_SOC_DAPM_PGA("LHPF4", ARIZONA_HPLPF4_1, ARIZONA_LHPF4_ENA_SHIFT, 0,
 424		 NULL, 0),
 425
 426SND_SOC_DAPM_PGA("PWM1 Driver", ARIZONA_PWM_DRIVE_1, ARIZONA_PWM1_ENA_SHIFT,
 427		 0, NULL, 0),
 428SND_SOC_DAPM_PGA("PWM2 Driver", ARIZONA_PWM_DRIVE_1, ARIZONA_PWM2_ENA_SHIFT,
 429		 0, NULL, 0),
 430
 431SND_SOC_DAPM_PGA("ASRC1L", ARIZONA_ASRC_ENABLE, ARIZONA_ASRC1L_ENA_SHIFT, 0,
 432		 NULL, 0),
 433SND_SOC_DAPM_PGA("ASRC1R", ARIZONA_ASRC_ENABLE, ARIZONA_ASRC1R_ENA_SHIFT, 0,
 434		 NULL, 0),
 435SND_SOC_DAPM_PGA("ASRC2L", ARIZONA_ASRC_ENABLE, ARIZONA_ASRC2L_ENA_SHIFT, 0,
 436		 NULL, 0),
 437SND_SOC_DAPM_PGA("ASRC2R", ARIZONA_ASRC_ENABLE, ARIZONA_ASRC2R_ENA_SHIFT, 0,
 438		 NULL, 0),
 439
 440WM_ADSP2("DSP2", 1, cs47l24_adsp_power_ev),
 441WM_ADSP2("DSP3", 2, cs47l24_adsp_power_ev),
 442
 443SND_SOC_DAPM_PGA("ISRC1INT1", ARIZONA_ISRC_1_CTRL_3,
 444		 ARIZONA_ISRC1_INT0_ENA_SHIFT, 0, NULL, 0),
 445SND_SOC_DAPM_PGA("ISRC1INT2", ARIZONA_ISRC_1_CTRL_3,
 446		 ARIZONA_ISRC1_INT1_ENA_SHIFT, 0, NULL, 0),
 447SND_SOC_DAPM_PGA("ISRC1INT3", ARIZONA_ISRC_1_CTRL_3,
 448		 ARIZONA_ISRC1_INT2_ENA_SHIFT, 0, NULL, 0),
 449SND_SOC_DAPM_PGA("ISRC1INT4", ARIZONA_ISRC_1_CTRL_3,
 450		 ARIZONA_ISRC1_INT3_ENA_SHIFT, 0, NULL, 0),
 451
 452SND_SOC_DAPM_PGA("ISRC1DEC1", ARIZONA_ISRC_1_CTRL_3,
 453		 ARIZONA_ISRC1_DEC0_ENA_SHIFT, 0, NULL, 0),
 454SND_SOC_DAPM_PGA("ISRC1DEC2", ARIZONA_ISRC_1_CTRL_3,
 455		 ARIZONA_ISRC1_DEC1_ENA_SHIFT, 0, NULL, 0),
 456SND_SOC_DAPM_PGA("ISRC1DEC3", ARIZONA_ISRC_1_CTRL_3,
 457		 ARIZONA_ISRC1_DEC2_ENA_SHIFT, 0, NULL, 0),
 458SND_SOC_DAPM_PGA("ISRC1DEC4", ARIZONA_ISRC_1_CTRL_3,
 459		 ARIZONA_ISRC1_DEC3_ENA_SHIFT, 0, NULL, 0),
 460
 461SND_SOC_DAPM_PGA("ISRC2INT1", ARIZONA_ISRC_2_CTRL_3,
 462		 ARIZONA_ISRC2_INT0_ENA_SHIFT, 0, NULL, 0),
 463SND_SOC_DAPM_PGA("ISRC2INT2", ARIZONA_ISRC_2_CTRL_3,
 464		 ARIZONA_ISRC2_INT1_ENA_SHIFT, 0, NULL, 0),
 465SND_SOC_DAPM_PGA("ISRC2INT3", ARIZONA_ISRC_2_CTRL_3,
 466		 ARIZONA_ISRC2_INT2_ENA_SHIFT, 0, NULL, 0),
 467SND_SOC_DAPM_PGA("ISRC2INT4", ARIZONA_ISRC_2_CTRL_3,
 468		 ARIZONA_ISRC2_INT3_ENA_SHIFT, 0, NULL, 0),
 469
 470SND_SOC_DAPM_PGA("ISRC2DEC1", ARIZONA_ISRC_2_CTRL_3,
 471		 ARIZONA_ISRC2_DEC0_ENA_SHIFT, 0, NULL, 0),
 472SND_SOC_DAPM_PGA("ISRC2DEC2", ARIZONA_ISRC_2_CTRL_3,
 473		 ARIZONA_ISRC2_DEC1_ENA_SHIFT, 0, NULL, 0),
 474SND_SOC_DAPM_PGA("ISRC2DEC3", ARIZONA_ISRC_2_CTRL_3,
 475		 ARIZONA_ISRC2_DEC2_ENA_SHIFT, 0, NULL, 0),
 476SND_SOC_DAPM_PGA("ISRC2DEC4", ARIZONA_ISRC_2_CTRL_3,
 477		 ARIZONA_ISRC2_DEC3_ENA_SHIFT, 0, NULL, 0),
 478
 479SND_SOC_DAPM_PGA("ISRC3INT1", ARIZONA_ISRC_3_CTRL_3,
 480		 ARIZONA_ISRC3_INT0_ENA_SHIFT, 0, NULL, 0),
 481SND_SOC_DAPM_PGA("ISRC3INT2", ARIZONA_ISRC_3_CTRL_3,
 482		 ARIZONA_ISRC3_INT1_ENA_SHIFT, 0, NULL, 0),
 483SND_SOC_DAPM_PGA("ISRC3INT3", ARIZONA_ISRC_3_CTRL_3,
 484		 ARIZONA_ISRC3_INT2_ENA_SHIFT, 0, NULL, 0),
 485SND_SOC_DAPM_PGA("ISRC3INT4", ARIZONA_ISRC_3_CTRL_3,
 486		 ARIZONA_ISRC3_INT3_ENA_SHIFT, 0, NULL, 0),
 487
 488SND_SOC_DAPM_PGA("ISRC3DEC1", ARIZONA_ISRC_3_CTRL_3,
 489		 ARIZONA_ISRC3_DEC0_ENA_SHIFT, 0, NULL, 0),
 490SND_SOC_DAPM_PGA("ISRC3DEC2", ARIZONA_ISRC_3_CTRL_3,
 491		 ARIZONA_ISRC3_DEC1_ENA_SHIFT, 0, NULL, 0),
 492SND_SOC_DAPM_PGA("ISRC3DEC3", ARIZONA_ISRC_3_CTRL_3,
 493		 ARIZONA_ISRC3_DEC2_ENA_SHIFT, 0, NULL, 0),
 494SND_SOC_DAPM_PGA("ISRC3DEC4", ARIZONA_ISRC_3_CTRL_3,
 495		 ARIZONA_ISRC3_DEC3_ENA_SHIFT, 0, NULL, 0),
 496
 497SND_SOC_DAPM_MUX("AEC Loopback", ARIZONA_DAC_AEC_CONTROL_1,
 498		 ARIZONA_AEC_LOOPBACK_ENA_SHIFT, 0, &cs47l24_aec_loopback_mux),
 499
 500SND_SOC_DAPM_AIF_OUT("AIF1TX1", NULL, 0,
 501		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX1_ENA_SHIFT, 0),
 502SND_SOC_DAPM_AIF_OUT("AIF1TX2", NULL, 1,
 503		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX2_ENA_SHIFT, 0),
 504SND_SOC_DAPM_AIF_OUT("AIF1TX3", NULL, 2,
 505		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX3_ENA_SHIFT, 0),
 506SND_SOC_DAPM_AIF_OUT("AIF1TX4", NULL, 3,
 507		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX4_ENA_SHIFT, 0),
 508SND_SOC_DAPM_AIF_OUT("AIF1TX5", NULL, 4,
 509		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX5_ENA_SHIFT, 0),
 510SND_SOC_DAPM_AIF_OUT("AIF1TX6", NULL, 5,
 511		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX6_ENA_SHIFT, 0),
 512SND_SOC_DAPM_AIF_OUT("AIF1TX7", NULL, 6,
 513		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX7_ENA_SHIFT, 0),
 514SND_SOC_DAPM_AIF_OUT("AIF1TX8", NULL, 7,
 515		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX8_ENA_SHIFT, 0),
 516
 517SND_SOC_DAPM_AIF_IN("AIF1RX1", NULL, 0,
 518		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX1_ENA_SHIFT, 0),
 519SND_SOC_DAPM_AIF_IN("AIF1RX2", NULL, 1,
 520		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX2_ENA_SHIFT, 0),
 521SND_SOC_DAPM_AIF_IN("AIF1RX3", NULL, 2,
 522		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX3_ENA_SHIFT, 0),
 523SND_SOC_DAPM_AIF_IN("AIF1RX4", NULL, 3,
 524		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX4_ENA_SHIFT, 0),
 525SND_SOC_DAPM_AIF_IN("AIF1RX5", NULL, 4,
 526		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX5_ENA_SHIFT, 0),
 527SND_SOC_DAPM_AIF_IN("AIF1RX6", NULL, 5,
 528		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX6_ENA_SHIFT, 0),
 529SND_SOC_DAPM_AIF_IN("AIF1RX7", NULL, 6,
 530		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX7_ENA_SHIFT, 0),
 531SND_SOC_DAPM_AIF_IN("AIF1RX8", NULL, 7,
 532		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX8_ENA_SHIFT, 0),
 533
 534SND_SOC_DAPM_AIF_OUT("AIF2TX1", NULL, 0,
 535		     ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX1_ENA_SHIFT, 0),
 536SND_SOC_DAPM_AIF_OUT("AIF2TX2", NULL, 1,
 537		     ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX2_ENA_SHIFT, 0),
 538SND_SOC_DAPM_AIF_OUT("AIF2TX3", NULL, 2,
 539		     ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX3_ENA_SHIFT, 0),
 540SND_SOC_DAPM_AIF_OUT("AIF2TX4", NULL, 3,
 541		     ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX4_ENA_SHIFT, 0),
 542SND_SOC_DAPM_AIF_OUT("AIF2TX5", NULL, 4,
 543		     ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX5_ENA_SHIFT, 0),
 544SND_SOC_DAPM_AIF_OUT("AIF2TX6", NULL, 5,
 545		     ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX6_ENA_SHIFT, 0),
 546
 547SND_SOC_DAPM_AIF_IN("AIF2RX1", NULL, 0,
 548		    ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX1_ENA_SHIFT, 0),
 549SND_SOC_DAPM_AIF_IN("AIF2RX2", NULL, 1,
 550		    ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX2_ENA_SHIFT, 0),
 551SND_SOC_DAPM_AIF_IN("AIF2RX3", NULL, 2,
 552		    ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX3_ENA_SHIFT, 0),
 553SND_SOC_DAPM_AIF_IN("AIF2RX4", NULL, 3,
 554		    ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX4_ENA_SHIFT, 0),
 555SND_SOC_DAPM_AIF_IN("AIF2RX5", NULL, 4,
 556		    ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX5_ENA_SHIFT, 0),
 557SND_SOC_DAPM_AIF_IN("AIF2RX6", NULL, 5,
 558		    ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX6_ENA_SHIFT, 0),
 559
 560SND_SOC_DAPM_AIF_OUT("AIF3TX1", NULL, 0,
 561		     ARIZONA_AIF3_TX_ENABLES, ARIZONA_AIF3TX1_ENA_SHIFT, 0),
 562SND_SOC_DAPM_AIF_OUT("AIF3TX2", NULL, 1,
 563		     ARIZONA_AIF3_TX_ENABLES, ARIZONA_AIF3TX2_ENA_SHIFT, 0),
 564
 565SND_SOC_DAPM_AIF_IN("AIF3RX1", NULL, 0,
 566		    ARIZONA_AIF3_RX_ENABLES, ARIZONA_AIF3RX1_ENA_SHIFT, 0),
 567SND_SOC_DAPM_AIF_IN("AIF3RX2", NULL, 1,
 568		    ARIZONA_AIF3_RX_ENABLES, ARIZONA_AIF3RX2_ENA_SHIFT, 0),
 569
 570SND_SOC_DAPM_PGA_E("OUT1L", SND_SOC_NOPM,
 571		   ARIZONA_OUT1L_ENA_SHIFT, 0, NULL, 0, arizona_hp_ev,
 572		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
 573		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
 574SND_SOC_DAPM_PGA_E("OUT1R", SND_SOC_NOPM,
 575		   ARIZONA_OUT1R_ENA_SHIFT, 0, NULL, 0, arizona_hp_ev,
 576		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
 577		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
 578
 579ARIZONA_MIXER_WIDGETS(EQ1, "EQ1"),
 580ARIZONA_MIXER_WIDGETS(EQ2, "EQ2"),
 581
 582ARIZONA_MIXER_WIDGETS(DRC1L, "DRC1L"),
 583ARIZONA_MIXER_WIDGETS(DRC1R, "DRC1R"),
 584ARIZONA_MIXER_WIDGETS(DRC2L, "DRC2L"),
 585ARIZONA_MIXER_WIDGETS(DRC2R, "DRC2R"),
 586
 587ARIZONA_MIXER_WIDGETS(LHPF1, "LHPF1"),
 588ARIZONA_MIXER_WIDGETS(LHPF2, "LHPF2"),
 589ARIZONA_MIXER_WIDGETS(LHPF3, "LHPF3"),
 590ARIZONA_MIXER_WIDGETS(LHPF4, "LHPF4"),
 591
 592ARIZONA_MIXER_WIDGETS(PWM1, "PWM1"),
 593ARIZONA_MIXER_WIDGETS(PWM2, "PWM2"),
 594
 595ARIZONA_MIXER_WIDGETS(OUT1L, "HPOUT1L"),
 596ARIZONA_MIXER_WIDGETS(OUT1R, "HPOUT1R"),
 597ARIZONA_MIXER_WIDGETS(SPKOUT, "SPKOUT"),
 598
 599ARIZONA_MIXER_WIDGETS(AIF1TX1, "AIF1TX1"),
 600ARIZONA_MIXER_WIDGETS(AIF1TX2, "AIF1TX2"),
 601ARIZONA_MIXER_WIDGETS(AIF1TX3, "AIF1TX3"),
 602ARIZONA_MIXER_WIDGETS(AIF1TX4, "AIF1TX4"),
 603ARIZONA_MIXER_WIDGETS(AIF1TX5, "AIF1TX5"),
 604ARIZONA_MIXER_WIDGETS(AIF1TX6, "AIF1TX6"),
 605ARIZONA_MIXER_WIDGETS(AIF1TX7, "AIF1TX7"),
 606ARIZONA_MIXER_WIDGETS(AIF1TX8, "AIF1TX8"),
 607
 608ARIZONA_MIXER_WIDGETS(AIF2TX1, "AIF2TX1"),
 609ARIZONA_MIXER_WIDGETS(AIF2TX2, "AIF2TX2"),
 610ARIZONA_MIXER_WIDGETS(AIF2TX3, "AIF2TX3"),
 611ARIZONA_MIXER_WIDGETS(AIF2TX4, "AIF2TX4"),
 612ARIZONA_MIXER_WIDGETS(AIF2TX5, "AIF2TX5"),
 613ARIZONA_MIXER_WIDGETS(AIF2TX6, "AIF2TX6"),
 614
 615ARIZONA_MIXER_WIDGETS(AIF3TX1, "AIF3TX1"),
 616ARIZONA_MIXER_WIDGETS(AIF3TX2, "AIF3TX2"),
 617
 618ARIZONA_MUX_WIDGETS(ASRC1L, "ASRC1L"),
 619ARIZONA_MUX_WIDGETS(ASRC1R, "ASRC1R"),
 620ARIZONA_MUX_WIDGETS(ASRC2L, "ASRC2L"),
 621ARIZONA_MUX_WIDGETS(ASRC2R, "ASRC2R"),
 622
 623ARIZONA_DSP_WIDGETS(DSP2, "DSP2"),
 624ARIZONA_DSP_WIDGETS(DSP3, "DSP3"),
 625
 626ARIZONA_MUX_WIDGETS(ISRC1DEC1, "ISRC1DEC1"),
 627ARIZONA_MUX_WIDGETS(ISRC1DEC2, "ISRC1DEC2"),
 628ARIZONA_MUX_WIDGETS(ISRC1DEC3, "ISRC1DEC3"),
 629ARIZONA_MUX_WIDGETS(ISRC1DEC4, "ISRC1DEC4"),
 630
 631ARIZONA_MUX_WIDGETS(ISRC1INT1, "ISRC1INT1"),
 632ARIZONA_MUX_WIDGETS(ISRC1INT2, "ISRC1INT2"),
 633ARIZONA_MUX_WIDGETS(ISRC1INT3, "ISRC1INT3"),
 634ARIZONA_MUX_WIDGETS(ISRC1INT4, "ISRC1INT4"),
 635
 636ARIZONA_MUX_WIDGETS(ISRC2DEC1, "ISRC2DEC1"),
 637ARIZONA_MUX_WIDGETS(ISRC2DEC2, "ISRC2DEC2"),
 638ARIZONA_MUX_WIDGETS(ISRC2DEC3, "ISRC2DEC3"),
 639ARIZONA_MUX_WIDGETS(ISRC2DEC4, "ISRC2DEC4"),
 640
 641ARIZONA_MUX_WIDGETS(ISRC2INT1, "ISRC2INT1"),
 642ARIZONA_MUX_WIDGETS(ISRC2INT2, "ISRC2INT2"),
 643ARIZONA_MUX_WIDGETS(ISRC2INT3, "ISRC2INT3"),
 644ARIZONA_MUX_WIDGETS(ISRC2INT4, "ISRC2INT4"),
 645
 646ARIZONA_MUX_WIDGETS(ISRC3DEC1, "ISRC3DEC1"),
 647ARIZONA_MUX_WIDGETS(ISRC3DEC2, "ISRC3DEC2"),
 648ARIZONA_MUX_WIDGETS(ISRC3DEC3, "ISRC3DEC3"),
 649ARIZONA_MUX_WIDGETS(ISRC3DEC4, "ISRC3DEC4"),
 650
 651ARIZONA_MUX_WIDGETS(ISRC3INT1, "ISRC3INT1"),
 652ARIZONA_MUX_WIDGETS(ISRC3INT2, "ISRC3INT2"),
 653ARIZONA_MUX_WIDGETS(ISRC3INT3, "ISRC3INT3"),
 654ARIZONA_MUX_WIDGETS(ISRC3INT4, "ISRC3INT4"),
 655
 656SND_SOC_DAPM_OUTPUT("HPOUT1L"),
 657SND_SOC_DAPM_OUTPUT("HPOUT1R"),
 658SND_SOC_DAPM_OUTPUT("SPKOUTN"),
 659SND_SOC_DAPM_OUTPUT("SPKOUTP"),
 660
 661SND_SOC_DAPM_OUTPUT("MICSUPP"),
 662};
 663
 664#define ARIZONA_MIXER_INPUT_ROUTES(name)	\
 665	{ name, "Noise Generator", "Noise Generator" }, \
 666	{ name, "Tone Generator 1", "Tone Generator 1" }, \
 667	{ name, "Tone Generator 2", "Tone Generator 2" }, \
 668	{ name, "Haptics", "HAPTICS" }, \
 669	{ name, "AEC", "AEC Loopback" }, \
 670	{ name, "IN1L", "IN1L PGA" }, \
 671	{ name, "IN1R", "IN1R PGA" }, \
 672	{ name, "IN2L", "IN2L PGA" }, \
 673	{ name, "IN2R", "IN2R PGA" }, \
 674	{ name, "AIF1RX1", "AIF1RX1" }, \
 675	{ name, "AIF1RX2", "AIF1RX2" }, \
 676	{ name, "AIF1RX3", "AIF1RX3" }, \
 677	{ name, "AIF1RX4", "AIF1RX4" }, \
 678	{ name, "AIF1RX5", "AIF1RX5" }, \
 679	{ name, "AIF1RX6", "AIF1RX6" }, \
 680	{ name, "AIF1RX7", "AIF1RX7" }, \
 681	{ name, "AIF1RX8", "AIF1RX8" }, \
 682	{ name, "AIF2RX1", "AIF2RX1" }, \
 683	{ name, "AIF2RX2", "AIF2RX2" }, \
 684	{ name, "AIF2RX3", "AIF2RX3" }, \
 685	{ name, "AIF2RX4", "AIF2RX4" }, \
 686	{ name, "AIF2RX5", "AIF2RX5" }, \
 687	{ name, "AIF2RX6", "AIF2RX6" }, \
 688	{ name, "AIF3RX1", "AIF3RX1" }, \
 689	{ name, "AIF3RX2", "AIF3RX2" }, \
 690	{ name, "EQ1", "EQ1" }, \
 691	{ name, "EQ2", "EQ2" }, \
 692	{ name, "DRC1L", "DRC1L" }, \
 693	{ name, "DRC1R", "DRC1R" }, \
 694	{ name, "DRC2L", "DRC2L" }, \
 695	{ name, "DRC2R", "DRC2R" }, \
 696	{ name, "LHPF1", "LHPF1" }, \
 697	{ name, "LHPF2", "LHPF2" }, \
 698	{ name, "LHPF3", "LHPF3" }, \
 699	{ name, "LHPF4", "LHPF4" }, \
 700	{ name, "ASRC1L", "ASRC1L" }, \
 701	{ name, "ASRC1R", "ASRC1R" }, \
 702	{ name, "ASRC2L", "ASRC2L" }, \
 703	{ name, "ASRC2R", "ASRC2R" }, \
 704	{ name, "ISRC1DEC1", "ISRC1DEC1" }, \
 705	{ name, "ISRC1DEC2", "ISRC1DEC2" }, \
 706	{ name, "ISRC1DEC3", "ISRC1DEC3" }, \
 707	{ name, "ISRC1DEC4", "ISRC1DEC4" }, \
 708	{ name, "ISRC1INT1", "ISRC1INT1" }, \
 709	{ name, "ISRC1INT2", "ISRC1INT2" }, \
 710	{ name, "ISRC1INT3", "ISRC1INT3" }, \
 711	{ name, "ISRC1INT4", "ISRC1INT4" }, \
 712	{ name, "ISRC2DEC1", "ISRC2DEC1" }, \
 713	{ name, "ISRC2DEC2", "ISRC2DEC2" }, \
 714	{ name, "ISRC2DEC3", "ISRC2DEC3" }, \
 715	{ name, "ISRC2DEC4", "ISRC2DEC4" }, \
 716	{ name, "ISRC2INT1", "ISRC2INT1" }, \
 717	{ name, "ISRC2INT2", "ISRC2INT2" }, \
 718	{ name, "ISRC2INT3", "ISRC2INT3" }, \
 719	{ name, "ISRC2INT4", "ISRC2INT4" }, \
 720	{ name, "ISRC3DEC1", "ISRC3DEC1" }, \
 721	{ name, "ISRC3DEC2", "ISRC3DEC2" }, \
 722	{ name, "ISRC3DEC3", "ISRC3DEC3" }, \
 723	{ name, "ISRC3DEC4", "ISRC3DEC4" }, \
 724	{ name, "ISRC3INT1", "ISRC3INT1" }, \
 725	{ name, "ISRC3INT2", "ISRC3INT2" }, \
 726	{ name, "ISRC3INT3", "ISRC3INT3" }, \
 727	{ name, "ISRC3INT4", "ISRC3INT4" }, \
 728	{ name, "DSP2.1", "DSP2" }, \
 729	{ name, "DSP2.2", "DSP2" }, \
 730	{ name, "DSP2.3", "DSP2" }, \
 731	{ name, "DSP2.4", "DSP2" }, \
 732	{ name, "DSP2.5", "DSP2" }, \
 733	{ name, "DSP2.6", "DSP2" }, \
 734	{ name, "DSP3.1", "DSP3" }, \
 735	{ name, "DSP3.2", "DSP3" }, \
 736	{ name, "DSP3.3", "DSP3" }, \
 737	{ name, "DSP3.4", "DSP3" }, \
 738	{ name, "DSP3.5", "DSP3" }, \
 739	{ name, "DSP3.6", "DSP3" }
 740
 741static const struct snd_soc_dapm_route cs47l24_dapm_routes[] = {
 742	{ "OUT1L", NULL, "CPVDD" },
 743	{ "OUT1R", NULL, "CPVDD" },
 744
 745	{ "OUT4L", NULL, "SPKVDD" },
 746
 747	{ "OUT1L", NULL, "SYSCLK" },
 748	{ "OUT1R", NULL, "SYSCLK" },
 749	{ "OUT4L", NULL, "SYSCLK" },
 750
 751	{ "IN1L", NULL, "SYSCLK" },
 752	{ "IN1R", NULL, "SYSCLK" },
 753	{ "IN2L", NULL, "SYSCLK" },
 754	{ "IN2R", NULL, "SYSCLK" },
 755
 756	{ "ASRC1L", NULL, "SYSCLK" },
 757	{ "ASRC1R", NULL, "SYSCLK" },
 758	{ "ASRC2L", NULL, "SYSCLK" },
 759	{ "ASRC2R", NULL, "SYSCLK" },
 760
 761	{ "ASRC1L", NULL, "ASYNCCLK" },
 762	{ "ASRC1R", NULL, "ASYNCCLK" },
 763	{ "ASRC2L", NULL, "ASYNCCLK" },
 764	{ "ASRC2R", NULL, "ASYNCCLK" },
 765
 766	{ "MICBIAS1", NULL, "MICVDD" },
 767	{ "MICBIAS2", NULL, "MICVDD" },
 768
 769	{ "Noise Generator", NULL, "SYSCLK" },
 770	{ "Tone Generator 1", NULL, "SYSCLK" },
 771	{ "Tone Generator 2", NULL, "SYSCLK" },
 772
 773	{ "Noise Generator", NULL, "NOISE" },
 774	{ "Tone Generator 1", NULL, "TONE" },
 775	{ "Tone Generator 2", NULL, "TONE" },
 776
 777	{ "AIF1 Capture", NULL, "AIF1TX1" },
 778	{ "AIF1 Capture", NULL, "AIF1TX2" },
 779	{ "AIF1 Capture", NULL, "AIF1TX3" },
 780	{ "AIF1 Capture", NULL, "AIF1TX4" },
 781	{ "AIF1 Capture", NULL, "AIF1TX5" },
 782	{ "AIF1 Capture", NULL, "AIF1TX6" },
 783	{ "AIF1 Capture", NULL, "AIF1TX7" },
 784	{ "AIF1 Capture", NULL, "AIF1TX8" },
 785
 786	{ "AIF1RX1", NULL, "AIF1 Playback" },
 787	{ "AIF1RX2", NULL, "AIF1 Playback" },
 788	{ "AIF1RX3", NULL, "AIF1 Playback" },
 789	{ "AIF1RX4", NULL, "AIF1 Playback" },
 790	{ "AIF1RX5", NULL, "AIF1 Playback" },
 791	{ "AIF1RX6", NULL, "AIF1 Playback" },
 792	{ "AIF1RX7", NULL, "AIF1 Playback" },
 793	{ "AIF1RX8", NULL, "AIF1 Playback" },
 794
 795	{ "AIF2 Capture", NULL, "AIF2TX1" },
 796	{ "AIF2 Capture", NULL, "AIF2TX2" },
 797	{ "AIF2 Capture", NULL, "AIF2TX3" },
 798	{ "AIF2 Capture", NULL, "AIF2TX4" },
 799	{ "AIF2 Capture", NULL, "AIF2TX5" },
 800	{ "AIF2 Capture", NULL, "AIF2TX6" },
 801
 802	{ "AIF2RX1", NULL, "AIF2 Playback" },
 803	{ "AIF2RX2", NULL, "AIF2 Playback" },
 804	{ "AIF2RX3", NULL, "AIF2 Playback" },
 805	{ "AIF2RX4", NULL, "AIF2 Playback" },
 806	{ "AIF2RX5", NULL, "AIF2 Playback" },
 807	{ "AIF2RX6", NULL, "AIF2 Playback" },
 808
 809	{ "AIF3 Capture", NULL, "AIF3TX1" },
 810	{ "AIF3 Capture", NULL, "AIF3TX2" },
 811
 812	{ "AIF3RX1", NULL, "AIF3 Playback" },
 813	{ "AIF3RX2", NULL, "AIF3 Playback" },
 814
 815	{ "AIF1 Playback", NULL, "SYSCLK" },
 816	{ "AIF2 Playback", NULL, "SYSCLK" },
 817	{ "AIF3 Playback", NULL, "SYSCLK" },
 818
 819	{ "AIF1 Capture", NULL, "SYSCLK" },
 820	{ "AIF2 Capture", NULL, "SYSCLK" },
 821	{ "AIF3 Capture", NULL, "SYSCLK" },
 822
 823	{ "Voice Control DSP", NULL, "DSP3" },
 824
 825	{ "IN1L PGA", NULL, "IN1L" },
 826	{ "IN1R PGA", NULL, "IN1R" },
 827
 828	{ "IN2L PGA", NULL, "IN2L" },
 829	{ "IN2R PGA", NULL, "IN2R" },
 830
 831	{ "Audio Trace DSP", NULL, "DSP2" },
 832
 833	ARIZONA_MIXER_ROUTES("OUT1L", "HPOUT1L"),
 834	ARIZONA_MIXER_ROUTES("OUT1R", "HPOUT1R"),
 835
 836	ARIZONA_MIXER_ROUTES("OUT4L", "SPKOUT"),
 837
 838	ARIZONA_MIXER_ROUTES("PWM1 Driver", "PWM1"),
 839	ARIZONA_MIXER_ROUTES("PWM2 Driver", "PWM2"),
 840
 841	ARIZONA_MIXER_ROUTES("AIF1TX1", "AIF1TX1"),
 842	ARIZONA_MIXER_ROUTES("AIF1TX2", "AIF1TX2"),
 843	ARIZONA_MIXER_ROUTES("AIF1TX3", "AIF1TX3"),
 844	ARIZONA_MIXER_ROUTES("AIF1TX4", "AIF1TX4"),
 845	ARIZONA_MIXER_ROUTES("AIF1TX5", "AIF1TX5"),
 846	ARIZONA_MIXER_ROUTES("AIF1TX6", "AIF1TX6"),
 847	ARIZONA_MIXER_ROUTES("AIF1TX7", "AIF1TX7"),
 848	ARIZONA_MIXER_ROUTES("AIF1TX8", "AIF1TX8"),
 849
 850	ARIZONA_MIXER_ROUTES("AIF2TX1", "AIF2TX1"),
 851	ARIZONA_MIXER_ROUTES("AIF2TX2", "AIF2TX2"),
 852	ARIZONA_MIXER_ROUTES("AIF2TX3", "AIF2TX3"),
 853	ARIZONA_MIXER_ROUTES("AIF2TX4", "AIF2TX4"),
 854	ARIZONA_MIXER_ROUTES("AIF2TX5", "AIF2TX5"),
 855	ARIZONA_MIXER_ROUTES("AIF2TX6", "AIF2TX6"),
 856
 857	ARIZONA_MIXER_ROUTES("AIF3TX1", "AIF3TX1"),
 858	ARIZONA_MIXER_ROUTES("AIF3TX2", "AIF3TX2"),
 859
 860	ARIZONA_MIXER_ROUTES("EQ1", "EQ1"),
 861	ARIZONA_MIXER_ROUTES("EQ2", "EQ2"),
 862
 863	ARIZONA_MIXER_ROUTES("DRC1L", "DRC1L"),
 864	ARIZONA_MIXER_ROUTES("DRC1R", "DRC1R"),
 865	ARIZONA_MIXER_ROUTES("DRC2L", "DRC2L"),
 866	ARIZONA_MIXER_ROUTES("DRC2R", "DRC2R"),
 867
 868	ARIZONA_MIXER_ROUTES("LHPF1", "LHPF1"),
 869	ARIZONA_MIXER_ROUTES("LHPF2", "LHPF2"),
 870	ARIZONA_MIXER_ROUTES("LHPF3", "LHPF3"),
 871	ARIZONA_MIXER_ROUTES("LHPF4", "LHPF4"),
 872
 873	ARIZONA_MUX_ROUTES("ASRC1L", "ASRC1L"),
 874	ARIZONA_MUX_ROUTES("ASRC1R", "ASRC1R"),
 875	ARIZONA_MUX_ROUTES("ASRC2L", "ASRC2L"),
 876	ARIZONA_MUX_ROUTES("ASRC2R", "ASRC2R"),
 877
 878	ARIZONA_DSP_ROUTES("DSP2"),
 879	ARIZONA_DSP_ROUTES("DSP3"),
 880
 881	ARIZONA_MUX_ROUTES("ISRC1INT1", "ISRC1INT1"),
 882	ARIZONA_MUX_ROUTES("ISRC1INT2", "ISRC1INT2"),
 883	ARIZONA_MUX_ROUTES("ISRC1INT3", "ISRC1INT3"),
 884	ARIZONA_MUX_ROUTES("ISRC1INT4", "ISRC1INT4"),
 885
 886	ARIZONA_MUX_ROUTES("ISRC1DEC1", "ISRC1DEC1"),
 887	ARIZONA_MUX_ROUTES("ISRC1DEC2", "ISRC1DEC2"),
 888	ARIZONA_MUX_ROUTES("ISRC1DEC3", "ISRC1DEC3"),
 889	ARIZONA_MUX_ROUTES("ISRC1DEC4", "ISRC1DEC4"),
 890
 891	ARIZONA_MUX_ROUTES("ISRC2INT1", "ISRC2INT1"),
 892	ARIZONA_MUX_ROUTES("ISRC2INT2", "ISRC2INT2"),
 893	ARIZONA_MUX_ROUTES("ISRC2INT3", "ISRC2INT3"),
 894	ARIZONA_MUX_ROUTES("ISRC2INT4", "ISRC2INT4"),
 895
 896	ARIZONA_MUX_ROUTES("ISRC2DEC1", "ISRC2DEC1"),
 897	ARIZONA_MUX_ROUTES("ISRC2DEC2", "ISRC2DEC2"),
 898	ARIZONA_MUX_ROUTES("ISRC2DEC3", "ISRC2DEC3"),
 899	ARIZONA_MUX_ROUTES("ISRC2DEC4", "ISRC2DEC4"),
 900
 901	ARIZONA_MUX_ROUTES("ISRC3INT1", "ISRC3INT1"),
 902	ARIZONA_MUX_ROUTES("ISRC3INT2", "ISRC3INT2"),
 903	ARIZONA_MUX_ROUTES("ISRC3INT3", "ISRC3INT3"),
 904	ARIZONA_MUX_ROUTES("ISRC3INT4", "ISRC3INT4"),
 905
 906	ARIZONA_MUX_ROUTES("ISRC3DEC1", "ISRC3DEC1"),
 907	ARIZONA_MUX_ROUTES("ISRC3DEC2", "ISRC3DEC2"),
 908	ARIZONA_MUX_ROUTES("ISRC3DEC3", "ISRC3DEC3"),
 909	ARIZONA_MUX_ROUTES("ISRC3DEC4", "ISRC3DEC4"),
 910
 911	{ "AEC Loopback", "HPOUT1L", "OUT1L" },
 912	{ "AEC Loopback", "HPOUT1R", "OUT1R" },
 913	{ "HPOUT1L", NULL, "OUT1L" },
 914	{ "HPOUT1R", NULL, "OUT1R" },
 915
 916	{ "AEC Loopback", "SPKOUT", "OUT4L" },
 917	{ "SPKOUTN", NULL, "OUT4L" },
 918	{ "SPKOUTP", NULL, "OUT4L" },
 919
 920	{ "MICSUPP", NULL, "SYSCLK" },
 921
 922	{ "DRC1 Signal Activity", NULL, "SYSCLK" },
 923	{ "DRC2 Signal Activity", NULL, "SYSCLK" },
 924	{ "DRC1 Signal Activity", NULL, "DRC1L" },
 925	{ "DRC1 Signal Activity", NULL, "DRC1R" },
 926	{ "DRC2 Signal Activity", NULL, "DRC2L" },
 927	{ "DRC2 Signal Activity", NULL, "DRC2R" },
 928
 929	{ "DSP Voice Trigger", NULL, "SYSCLK" },
 930	{ "DSP Voice Trigger", NULL, "DSP3 Voice Trigger" },
 931	{ "DSP3 Voice Trigger", "Switch", "DSP3" },
 932};
 933
 934static int cs47l24_set_fll(struct snd_soc_component *component, int fll_id,
 935			   int source, unsigned int Fref, unsigned int Fout)
 936{
 937	struct cs47l24_priv *cs47l24 = snd_soc_component_get_drvdata(component);
 938
 939	switch (fll_id) {
 940	case CS47L24_FLL1:
 941		return arizona_set_fll(&cs47l24->fll[0], source, Fref, Fout);
 942	case CS47L24_FLL2:
 943		return arizona_set_fll(&cs47l24->fll[1], source, Fref, Fout);
 944	case CS47L24_FLL1_REFCLK:
 945		return arizona_set_fll_refclk(&cs47l24->fll[0], source, Fref,
 946					      Fout);
 947	case CS47L24_FLL2_REFCLK:
 948		return arizona_set_fll_refclk(&cs47l24->fll[1], source, Fref,
 949					      Fout);
 950	default:
 951		return -EINVAL;
 952	}
 953}
 954
 955#define CS47L24_RATES SNDRV_PCM_RATE_KNOT
 956
 957#define CS47L24_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
 958			 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)
 959
 960static const struct snd_soc_dai_ops cs47l24_dai_ops = {
 961	.compress_new = snd_soc_new_compress,
 962};
 963
 964static struct snd_soc_dai_driver cs47l24_dai[] = {
 965	{
 966		.name = "cs47l24-aif1",
 967		.id = 1,
 968		.base = ARIZONA_AIF1_BCLK_CTRL,
 969		.playback = {
 970			.stream_name = "AIF1 Playback",
 971			.channels_min = 1,
 972			.channels_max = 8,
 973			.rates = CS47L24_RATES,
 974			.formats = CS47L24_FORMATS,
 975		},
 976		.capture = {
 977			 .stream_name = "AIF1 Capture",
 978			 .channels_min = 1,
 979			 .channels_max = 8,
 980			 .rates = CS47L24_RATES,
 981			 .formats = CS47L24_FORMATS,
 982		 },
 983		.ops = &arizona_dai_ops,
 984		.symmetric_rate = 1,
 985		.symmetric_sample_bits = 1,
 986	},
 987	{
 988		.name = "cs47l24-aif2",
 989		.id = 2,
 990		.base = ARIZONA_AIF2_BCLK_CTRL,
 991		.playback = {
 992			.stream_name = "AIF2 Playback",
 993			.channels_min = 1,
 994			.channels_max = 6,
 995			.rates = CS47L24_RATES,
 996			.formats = CS47L24_FORMATS,
 997		},
 998		.capture = {
 999			 .stream_name = "AIF2 Capture",
1000			 .channels_min = 1,
1001			 .channels_max = 6,
1002			 .rates = CS47L24_RATES,
1003			 .formats = CS47L24_FORMATS,
1004		 },
1005		.ops = &arizona_dai_ops,
1006		.symmetric_rate = 1,
1007		.symmetric_sample_bits = 1,
1008	},
1009	{
1010		.name = "cs47l24-aif3",
1011		.id = 3,
1012		.base = ARIZONA_AIF3_BCLK_CTRL,
1013		.playback = {
1014			.stream_name = "AIF3 Playback",
1015			.channels_min = 1,
1016			.channels_max = 2,
1017			.rates = CS47L24_RATES,
1018			.formats = CS47L24_FORMATS,
1019		},
1020		.capture = {
1021			 .stream_name = "AIF3 Capture",
1022			 .channels_min = 1,
1023			 .channels_max = 2,
1024			 .rates = CS47L24_RATES,
1025			 .formats = CS47L24_FORMATS,
1026		 },
1027		.ops = &arizona_dai_ops,
1028		.symmetric_rate = 1,
1029		.symmetric_sample_bits = 1,
1030	},
1031	{
1032		.name = "cs47l24-cpu-voicectrl",
1033		.capture = {
1034			.stream_name = "Voice Control CPU",
1035			.channels_min = 1,
1036			.channels_max = 1,
1037			.rates = CS47L24_RATES,
1038			.formats = CS47L24_FORMATS,
1039		},
1040		.ops = &cs47l24_dai_ops,
1041	},
1042	{
1043		.name = "cs47l24-dsp-voicectrl",
1044		.capture = {
1045			.stream_name = "Voice Control DSP",
1046			.channels_min = 1,
1047			.channels_max = 1,
1048			.rates = CS47L24_RATES,
1049			.formats = CS47L24_FORMATS,
1050		},
1051	},
1052	{
1053		.name = "cs47l24-cpu-trace",
1054		.capture = {
1055			.stream_name = "Audio Trace CPU",
1056			.channels_min = 1,
1057			.channels_max = 6,
1058			.rates = CS47L24_RATES,
1059			.formats = CS47L24_FORMATS,
1060		},
1061		.ops = &cs47l24_dai_ops,
1062	},
1063	{
1064		.name = "cs47l24-dsp-trace",
1065		.capture = {
1066			.stream_name = "Audio Trace DSP",
1067			.channels_min = 1,
1068			.channels_max = 6,
1069			.rates = CS47L24_RATES,
1070			.formats = CS47L24_FORMATS,
1071		},
1072	},
1073};
1074
1075static int cs47l24_open(struct snd_soc_component *component,
1076			struct snd_compr_stream *stream)
1077{
1078	struct snd_soc_pcm_runtime *rtd = stream->private_data;
 
1079	struct cs47l24_priv *priv = snd_soc_component_get_drvdata(component);
1080	struct arizona *arizona = priv->core.arizona;
1081	int n_adsp;
1082
1083	if (strcmp(snd_soc_rtd_to_codec(rtd, 0)->name, "cs47l24-dsp-voicectrl") == 0) {
1084		n_adsp = 2;
1085	} else if (strcmp(snd_soc_rtd_to_codec(rtd, 0)->name, "cs47l24-dsp-trace") == 0) {
1086		n_adsp = 1;
1087	} else {
1088		dev_err(arizona->dev,
1089			"No suitable compressed stream for DAI '%s'\n",
1090			snd_soc_rtd_to_codec(rtd, 0)->name);
1091		return -EINVAL;
1092	}
1093
1094	return wm_adsp_compr_open(&priv->core.adsp[n_adsp], stream);
1095}
1096
1097static irqreturn_t cs47l24_adsp2_irq(int irq, void *data)
1098{
1099	struct cs47l24_priv *priv = data;
1100	struct arizona *arizona = priv->core.arizona;
1101	struct arizona_voice_trigger_info info;
1102	int serviced = 0;
1103	int i, ret;
1104
1105	for (i = 1; i <= 2; ++i) {
1106		ret = wm_adsp_compr_handle_irq(&priv->core.adsp[i]);
1107		if (ret != -ENODEV)
1108			serviced++;
1109		if (ret == WM_ADSP_COMPR_VOICE_TRIGGER) {
1110			info.core = i;
1111			arizona_call_notifiers(arizona,
1112					       ARIZONA_NOTIFY_VOICE_TRIGGER,
1113					       &info);
1114		}
1115	}
1116
1117	if (!serviced) {
1118		dev_err(arizona->dev, "Spurious compressed data IRQ\n");
1119		return IRQ_NONE;
1120	}
1121
1122	return IRQ_HANDLED;
1123}
1124
1125static int cs47l24_component_probe(struct snd_soc_component *component)
1126{
1127	struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
1128	struct cs47l24_priv *priv = snd_soc_component_get_drvdata(component);
1129	struct arizona *arizona = priv->core.arizona;
1130	int ret;
1131
1132	arizona->dapm = dapm;
1133	snd_soc_component_init_regmap(component, arizona->regmap);
1134
1135	ret = arizona_init_spk(component);
1136	if (ret < 0)
1137		return ret;
1138
1139	arizona_init_gpio(component);
1140	arizona_init_mono(component);
1141
1142	ret = wm_adsp2_component_probe(&priv->core.adsp[1], component);
1143	if (ret)
1144		goto err_adsp2_codec_probe;
1145
1146	ret = wm_adsp2_component_probe(&priv->core.adsp[2], component);
1147	if (ret)
1148		goto err_adsp2_codec_probe;
1149
1150	ret = snd_soc_add_component_controls(component,
1151					     &arizona_adsp2_rate_controls[1],
1152					     2);
1153	if (ret)
1154		goto err_adsp2_codec_probe;
1155
1156	snd_soc_component_disable_pin(component, "HAPTICS");
1157
1158	return 0;
1159
1160err_adsp2_codec_probe:
1161	wm_adsp2_component_remove(&priv->core.adsp[1], component);
1162	wm_adsp2_component_remove(&priv->core.adsp[2], component);
1163
1164	return ret;
1165}
1166
1167static void cs47l24_component_remove(struct snd_soc_component *component)
1168{
1169	struct cs47l24_priv *priv = snd_soc_component_get_drvdata(component);
1170
1171	wm_adsp2_component_remove(&priv->core.adsp[1], component);
1172	wm_adsp2_component_remove(&priv->core.adsp[2], component);
1173
1174	priv->core.arizona->dapm = NULL;
1175}
1176
1177#define CS47L24_DIG_VU 0x0200
1178
1179static unsigned int cs47l24_digital_vu[] = {
1180	ARIZONA_DAC_DIGITAL_VOLUME_1L,
1181	ARIZONA_DAC_DIGITAL_VOLUME_1R,
1182	ARIZONA_DAC_DIGITAL_VOLUME_4L,
1183};
1184
1185static const struct snd_compress_ops cs47l24_compress_ops = {
1186	.open		= cs47l24_open,
1187	.free		= wm_adsp_compr_free,
1188	.set_params	= wm_adsp_compr_set_params,
1189	.get_caps	= wm_adsp_compr_get_caps,
1190	.trigger	= wm_adsp_compr_trigger,
1191	.pointer	= wm_adsp_compr_pointer,
1192	.copy		= wm_adsp_compr_copy,
1193};
1194
1195static const struct snd_soc_component_driver soc_component_dev_cs47l24 = {
1196	.probe			= cs47l24_component_probe,
1197	.remove			= cs47l24_component_remove,
1198	.set_sysclk		= arizona_set_sysclk,
1199	.set_pll		= cs47l24_set_fll,
1200	.name			= DRV_NAME,
1201	.compress_ops		= &cs47l24_compress_ops,
1202	.controls		= cs47l24_snd_controls,
1203	.num_controls		= ARRAY_SIZE(cs47l24_snd_controls),
1204	.dapm_widgets		= cs47l24_dapm_widgets,
1205	.num_dapm_widgets	= ARRAY_SIZE(cs47l24_dapm_widgets),
1206	.dapm_routes		= cs47l24_dapm_routes,
1207	.num_dapm_routes	= ARRAY_SIZE(cs47l24_dapm_routes),
1208	.use_pmdown_time	= 1,
1209	.endianness		= 1,
 
1210};
1211
1212static int cs47l24_probe(struct platform_device *pdev)
1213{
1214	struct arizona *arizona = dev_get_drvdata(pdev->dev.parent);
1215	struct cs47l24_priv *cs47l24;
1216	int i, ret;
1217
1218	BUILD_BUG_ON(ARRAY_SIZE(cs47l24_dai) > ARIZONA_MAX_DAI);
1219
1220	cs47l24 = devm_kzalloc(&pdev->dev, sizeof(struct cs47l24_priv),
1221			       GFP_KERNEL);
1222	if (!cs47l24)
1223		return -ENOMEM;
1224
1225	if (IS_ENABLED(CONFIG_OF)) {
1226		if (!dev_get_platdata(arizona->dev)) {
1227			ret = arizona_of_get_audio_pdata(arizona);
1228			if (ret < 0)
1229				return ret;
1230		}
1231	}
1232
1233	platform_set_drvdata(pdev, cs47l24);
1234
1235	cs47l24->core.arizona = arizona;
1236	cs47l24->core.num_inputs = 4;
1237
1238	for (i = 1; i <= 2; i++) {
1239		cs47l24->core.adsp[i].part = "cs47l24";
1240		cs47l24->core.adsp[i].cs_dsp.num = i + 1;
1241		cs47l24->core.adsp[i].cs_dsp.type = WMFW_ADSP2;
1242		cs47l24->core.adsp[i].cs_dsp.dev = arizona->dev;
1243		cs47l24->core.adsp[i].cs_dsp.regmap = arizona->regmap;
1244
1245		cs47l24->core.adsp[i].cs_dsp.base = ARIZONA_DSP1_CONTROL_1 +
1246					     (0x100 * i);
1247		cs47l24->core.adsp[i].cs_dsp.mem = cs47l24_dsp_regions[i - 1];
1248		cs47l24->core.adsp[i].cs_dsp.num_mems =
1249				ARRAY_SIZE(cs47l24_dsp2_regions);
1250
1251		ret = wm_adsp2_init(&cs47l24->core.adsp[i]);
1252		if (ret != 0)
1253			return ret;
1254	}
1255
1256	for (i = 0; i < ARRAY_SIZE(cs47l24->fll); i++)
1257		cs47l24->fll[i].vco_mult = 3;
1258
1259	arizona_init_fll(arizona, 1, ARIZONA_FLL1_CONTROL_1 - 1,
1260			 ARIZONA_IRQ_FLL1_LOCK, ARIZONA_IRQ_FLL1_CLOCK_OK,
1261			 &cs47l24->fll[0]);
1262	arizona_init_fll(arizona, 2, ARIZONA_FLL2_CONTROL_1 - 1,
1263			 ARIZONA_IRQ_FLL2_LOCK, ARIZONA_IRQ_FLL2_CLOCK_OK,
1264			 &cs47l24->fll[1]);
1265
1266	/* SR2 fixed at 8kHz, SR3 fixed at 16kHz */
1267	regmap_update_bits(arizona->regmap, ARIZONA_SAMPLE_RATE_2,
1268			   ARIZONA_SAMPLE_RATE_2_MASK, 0x11);
1269	regmap_update_bits(arizona->regmap, ARIZONA_SAMPLE_RATE_3,
1270			   ARIZONA_SAMPLE_RATE_3_MASK, 0x12);
1271
1272	for (i = 0; i < ARRAY_SIZE(cs47l24_dai); i++)
1273		arizona_init_dai(&cs47l24->core, i);
1274
1275	/* Latch volume update bits */
1276	for (i = 0; i < ARRAY_SIZE(cs47l24_digital_vu); i++)
1277		regmap_update_bits(arizona->regmap, cs47l24_digital_vu[i],
1278				   CS47L24_DIG_VU, CS47L24_DIG_VU);
1279
1280	pm_runtime_enable(&pdev->dev);
1281	pm_runtime_idle(&pdev->dev);
1282
1283	ret = arizona_request_irq(arizona, ARIZONA_IRQ_DSP_IRQ1,
1284				  "ADSP2 Compressed IRQ", cs47l24_adsp2_irq,
1285				  cs47l24);
1286	if (ret != 0) {
1287		dev_err(&pdev->dev, "Failed to request DSP IRQ: %d\n", ret);
1288		return ret;
1289	}
1290
1291	ret = arizona_set_irq_wake(arizona, ARIZONA_IRQ_DSP_IRQ1, 1);
1292	if (ret != 0)
1293		dev_warn(&pdev->dev,
1294			 "Failed to set compressed IRQ as a wake source: %d\n",
1295			 ret);
1296
1297	arizona_init_common(arizona);
1298
1299	ret = arizona_init_vol_limit(arizona);
1300	if (ret < 0)
1301		goto err_dsp_irq;
1302	ret = arizona_init_spk_irqs(arizona);
1303	if (ret < 0)
1304		goto err_dsp_irq;
1305
1306	ret = devm_snd_soc_register_component(&pdev->dev,
1307					      &soc_component_dev_cs47l24,
1308					      cs47l24_dai,
1309					      ARRAY_SIZE(cs47l24_dai));
1310	if (ret < 0) {
1311		dev_err(&pdev->dev, "Failed to register component: %d\n", ret);
1312		goto err_spk_irqs;
1313	}
1314
1315	return ret;
1316
1317err_spk_irqs:
1318	arizona_free_spk_irqs(arizona);
1319err_dsp_irq:
1320	arizona_set_irq_wake(arizona, ARIZONA_IRQ_DSP_IRQ1, 0);
1321	arizona_free_irq(arizona, ARIZONA_IRQ_DSP_IRQ1, cs47l24);
1322
1323	return ret;
1324}
1325
1326static void cs47l24_remove(struct platform_device *pdev)
1327{
1328	struct cs47l24_priv *cs47l24 = platform_get_drvdata(pdev);
1329	struct arizona *arizona = cs47l24->core.arizona;
1330
1331	pm_runtime_disable(&pdev->dev);
1332
1333	wm_adsp2_remove(&cs47l24->core.adsp[1]);
1334	wm_adsp2_remove(&cs47l24->core.adsp[2]);
1335
1336	arizona_free_spk_irqs(arizona);
1337
1338	arizona_set_irq_wake(arizona, ARIZONA_IRQ_DSP_IRQ1, 0);
1339	arizona_free_irq(arizona, ARIZONA_IRQ_DSP_IRQ1, cs47l24);
 
 
1340}
1341
1342static struct platform_driver cs47l24_codec_driver = {
1343	.driver = {
1344		.name = "cs47l24-codec",
1345	},
1346	.probe = cs47l24_probe,
1347	.remove = cs47l24_remove,
1348};
1349
1350module_platform_driver(cs47l24_codec_driver);
1351
1352MODULE_DESCRIPTION("ASoC CS47L24 driver");
1353MODULE_AUTHOR("Richard Fitzgerald <rf@opensource.wolfsonmicro.com>");
1354MODULE_LICENSE("GPL v2");
1355MODULE_ALIAS("platform:cs47l24-codec");
v4.17
 
   1/*
   2 * cs47l24.h  --  ALSA SoC Audio driver for Cirrus Logic CS47L24
   3 *
   4 * Copyright 2015 Cirrus Logic Inc.
   5 *
   6 * Author: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
   7 *
   8 * This program is free software; you can redistribute it and/or modify
   9 * it under the terms of the GNU General Public License version 2 as
  10 * published by the Free Software Foundation.
  11 */
  12
  13#include <linux/module.h>
  14#include <linux/moduleparam.h>
  15#include <linux/init.h>
  16#include <linux/delay.h>
  17#include <linux/pm.h>
  18#include <linux/pm_runtime.h>
  19#include <linux/regmap.h>
  20#include <linux/slab.h>
  21#include <sound/core.h>
  22#include <sound/pcm.h>
  23#include <sound/pcm_params.h>
  24#include <sound/soc.h>
  25#include <sound/jack.h>
  26#include <sound/initval.h>
  27#include <sound/tlv.h>
  28
  29#include <linux/mfd/arizona/core.h>
  30#include <linux/mfd/arizona/registers.h>
  31
  32#include "arizona.h"
  33#include "wm_adsp.h"
  34#include "cs47l24.h"
  35
  36#define DRV_NAME "cs47l24-codec"
  37
  38struct cs47l24_priv {
  39	struct arizona_priv core;
  40	struct arizona_fll fll[2];
  41};
  42
  43static const struct wm_adsp_region cs47l24_dsp2_regions[] = {
  44	{ .type = WMFW_ADSP2_PM, .base = 0x200000 },
  45	{ .type = WMFW_ADSP2_ZM, .base = 0x280000 },
  46	{ .type = WMFW_ADSP2_XM, .base = 0x290000 },
  47	{ .type = WMFW_ADSP2_YM, .base = 0x2a8000 },
  48};
  49
  50static const struct wm_adsp_region cs47l24_dsp3_regions[] = {
  51	{ .type = WMFW_ADSP2_PM, .base = 0x300000 },
  52	{ .type = WMFW_ADSP2_ZM, .base = 0x380000 },
  53	{ .type = WMFW_ADSP2_XM, .base = 0x390000 },
  54	{ .type = WMFW_ADSP2_YM, .base = 0x3a8000 },
  55};
  56
  57static const struct wm_adsp_region *cs47l24_dsp_regions[] = {
  58	cs47l24_dsp2_regions,
  59	cs47l24_dsp3_regions,
  60};
  61
  62static int cs47l24_adsp_power_ev(struct snd_soc_dapm_widget *w,
  63				 struct snd_kcontrol *kcontrol, int event)
  64{
  65	struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
  66	struct arizona *arizona = dev_get_drvdata(component->dev->parent);
  67	unsigned int v;
  68	int ret;
  69
  70	ret = regmap_read(arizona->regmap, ARIZONA_SYSTEM_CLOCK_1, &v);
  71	if (ret != 0) {
  72		dev_err(component->dev, "Failed to read SYSCLK state: %d\n", ret);
  73		return ret;
  74	}
  75
  76	v = (v & ARIZONA_SYSCLK_FREQ_MASK) >> ARIZONA_SYSCLK_FREQ_SHIFT;
  77
  78	return wm_adsp2_early_event(w, kcontrol, event, v);
 
 
  79}
  80
  81static DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0);
  82static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0);
  83static DECLARE_TLV_DB_SCALE(noise_tlv, -13200, 600, 0);
  84static DECLARE_TLV_DB_SCALE(ng_tlv, -10200, 600, 0);
  85
  86#define CS47L24_NG_SRC(name, base) \
  87	SOC_SINGLE(name " NG HPOUT1L Switch",  base,  0, 1, 0), \
  88	SOC_SINGLE(name " NG HPOUT1R Switch",  base,  1, 1, 0), \
  89	SOC_SINGLE(name " NG SPKOUT Switch",  base,  6, 1, 0)
  90
  91static const struct snd_kcontrol_new cs47l24_snd_controls[] = {
  92SOC_ENUM("IN1 OSR", arizona_in_dmic_osr[0]),
  93SOC_ENUM("IN2 OSR", arizona_in_dmic_osr[1]),
  94
  95SOC_ENUM("IN HPF Cutoff Frequency", arizona_in_hpf_cut_enum),
  96
  97SOC_SINGLE("IN1L HPF Switch", ARIZONA_IN1L_CONTROL,
  98	   ARIZONA_IN1L_HPF_SHIFT, 1, 0),
  99SOC_SINGLE("IN1R HPF Switch", ARIZONA_IN1R_CONTROL,
 100	   ARIZONA_IN1R_HPF_SHIFT, 1, 0),
 101SOC_SINGLE("IN2L HPF Switch", ARIZONA_IN2L_CONTROL,
 102	   ARIZONA_IN2L_HPF_SHIFT, 1, 0),
 103SOC_SINGLE("IN2R HPF Switch", ARIZONA_IN2R_CONTROL,
 104	   ARIZONA_IN2R_HPF_SHIFT, 1, 0),
 105
 106SOC_SINGLE_TLV("IN1L Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_1L,
 107	       ARIZONA_IN1L_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
 108SOC_SINGLE_TLV("IN1R Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_1R,
 109	       ARIZONA_IN1R_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
 110SOC_SINGLE_TLV("IN2L Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_2L,
 111	       ARIZONA_IN2L_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
 112SOC_SINGLE_TLV("IN2R Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_2R,
 113	       ARIZONA_IN2R_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
 114
 115SOC_ENUM("Input Ramp Up", arizona_in_vi_ramp),
 116SOC_ENUM("Input Ramp Down", arizona_in_vd_ramp),
 117
 118ARIZONA_MIXER_CONTROLS("EQ1", ARIZONA_EQ1MIX_INPUT_1_SOURCE),
 119ARIZONA_MIXER_CONTROLS("EQ2", ARIZONA_EQ2MIX_INPUT_1_SOURCE),
 120
 121ARIZONA_EQ_CONTROL("EQ1 Coefficients", ARIZONA_EQ1_2),
 122SOC_SINGLE_TLV("EQ1 B1 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B1_GAIN_SHIFT,
 123	       24, 0, eq_tlv),
 124SOC_SINGLE_TLV("EQ1 B2 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B2_GAIN_SHIFT,
 125	       24, 0, eq_tlv),
 126SOC_SINGLE_TLV("EQ1 B3 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B3_GAIN_SHIFT,
 127	       24, 0, eq_tlv),
 128SOC_SINGLE_TLV("EQ1 B4 Volume", ARIZONA_EQ1_2, ARIZONA_EQ1_B4_GAIN_SHIFT,
 129	       24, 0, eq_tlv),
 130SOC_SINGLE_TLV("EQ1 B5 Volume", ARIZONA_EQ1_2, ARIZONA_EQ1_B5_GAIN_SHIFT,
 131	       24, 0, eq_tlv),
 132
 133ARIZONA_EQ_CONTROL("EQ2 Coefficients", ARIZONA_EQ2_2),
 134SOC_SINGLE_TLV("EQ2 B1 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B1_GAIN_SHIFT,
 135	       24, 0, eq_tlv),
 136SOC_SINGLE_TLV("EQ2 B2 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B2_GAIN_SHIFT,
 137	       24, 0, eq_tlv),
 138SOC_SINGLE_TLV("EQ2 B3 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B3_GAIN_SHIFT,
 139	       24, 0, eq_tlv),
 140SOC_SINGLE_TLV("EQ2 B4 Volume", ARIZONA_EQ2_2, ARIZONA_EQ2_B4_GAIN_SHIFT,
 141	       24, 0, eq_tlv),
 142SOC_SINGLE_TLV("EQ2 B5 Volume", ARIZONA_EQ2_2, ARIZONA_EQ2_B5_GAIN_SHIFT,
 143	       24, 0, eq_tlv),
 144
 145ARIZONA_MIXER_CONTROLS("DRC1L", ARIZONA_DRC1LMIX_INPUT_1_SOURCE),
 146ARIZONA_MIXER_CONTROLS("DRC1R", ARIZONA_DRC1RMIX_INPUT_1_SOURCE),
 147ARIZONA_MIXER_CONTROLS("DRC2L", ARIZONA_DRC2LMIX_INPUT_1_SOURCE),
 148ARIZONA_MIXER_CONTROLS("DRC2R", ARIZONA_DRC2RMIX_INPUT_1_SOURCE),
 149
 150SND_SOC_BYTES_MASK("DRC1", ARIZONA_DRC1_CTRL1, 5,
 151		   ARIZONA_DRC1R_ENA | ARIZONA_DRC1L_ENA),
 152SND_SOC_BYTES_MASK("DRC2", ARIZONA_DRC2_CTRL1, 5,
 153		   ARIZONA_DRC2R_ENA | ARIZONA_DRC2L_ENA),
 154
 155ARIZONA_MIXER_CONTROLS("LHPF1", ARIZONA_HPLP1MIX_INPUT_1_SOURCE),
 156ARIZONA_MIXER_CONTROLS("LHPF2", ARIZONA_HPLP2MIX_INPUT_1_SOURCE),
 157ARIZONA_MIXER_CONTROLS("LHPF3", ARIZONA_HPLP3MIX_INPUT_1_SOURCE),
 158ARIZONA_MIXER_CONTROLS("LHPF4", ARIZONA_HPLP4MIX_INPUT_1_SOURCE),
 159
 160ARIZONA_LHPF_CONTROL("LHPF1 Coefficients", ARIZONA_HPLPF1_2),
 161ARIZONA_LHPF_CONTROL("LHPF2 Coefficients", ARIZONA_HPLPF2_2),
 162ARIZONA_LHPF_CONTROL("LHPF3 Coefficients", ARIZONA_HPLPF3_2),
 163ARIZONA_LHPF_CONTROL("LHPF4 Coefficients", ARIZONA_HPLPF4_2),
 164
 165SOC_ENUM("LHPF1 Mode", arizona_lhpf1_mode),
 166SOC_ENUM("LHPF2 Mode", arizona_lhpf2_mode),
 167SOC_ENUM("LHPF3 Mode", arizona_lhpf3_mode),
 168SOC_ENUM("LHPF4 Mode", arizona_lhpf4_mode),
 169
 170SOC_ENUM("ISRC1 FSL", arizona_isrc_fsl[0]),
 171SOC_ENUM("ISRC2 FSL", arizona_isrc_fsl[1]),
 172SOC_ENUM("ISRC3 FSL", arizona_isrc_fsl[2]),
 173SOC_ENUM("ISRC1 FSH", arizona_isrc_fsh[0]),
 174SOC_ENUM("ISRC2 FSH", arizona_isrc_fsh[1]),
 175SOC_ENUM("ISRC3 FSH", arizona_isrc_fsh[2]),
 176SOC_ENUM("ASRC RATE 1", arizona_asrc_rate1),
 177
 178WM_ADSP2_PRELOAD_SWITCH("DSP2", 2),
 179WM_ADSP2_PRELOAD_SWITCH("DSP3", 3),
 180
 181ARIZONA_MIXER_CONTROLS("DSP2L", ARIZONA_DSP2LMIX_INPUT_1_SOURCE),
 182ARIZONA_MIXER_CONTROLS("DSP2R", ARIZONA_DSP2RMIX_INPUT_1_SOURCE),
 183ARIZONA_MIXER_CONTROLS("DSP3L", ARIZONA_DSP3LMIX_INPUT_1_SOURCE),
 184ARIZONA_MIXER_CONTROLS("DSP3R", ARIZONA_DSP3RMIX_INPUT_1_SOURCE),
 185
 186SOC_SINGLE_TLV("Noise Generator Volume", ARIZONA_COMFORT_NOISE_GENERATOR,
 187	       ARIZONA_NOISE_GEN_GAIN_SHIFT, 0x16, 0, noise_tlv),
 188
 189ARIZONA_MIXER_CONTROLS("HPOUT1L", ARIZONA_OUT1LMIX_INPUT_1_SOURCE),
 190ARIZONA_MIXER_CONTROLS("HPOUT1R", ARIZONA_OUT1RMIX_INPUT_1_SOURCE),
 191ARIZONA_MIXER_CONTROLS("SPKOUT", ARIZONA_OUT4LMIX_INPUT_1_SOURCE),
 192
 193SOC_SINGLE("HPOUT1 SC Protect Switch", ARIZONA_HP1_SHORT_CIRCUIT_CTRL,
 194	   ARIZONA_HP1_SC_ENA_SHIFT, 1, 0),
 195
 196SOC_DOUBLE_R("HPOUT1 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_1L,
 197	     ARIZONA_DAC_DIGITAL_VOLUME_1R, ARIZONA_OUT1L_MUTE_SHIFT, 1, 1),
 198SOC_SINGLE("Speaker Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_4L,
 199	   ARIZONA_OUT4L_MUTE_SHIFT, 1, 1),
 200
 201SOC_DOUBLE_R_TLV("HPOUT1 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_1L,
 202		 ARIZONA_DAC_DIGITAL_VOLUME_1R, ARIZONA_OUT1L_VOL_SHIFT,
 203		 0xbf, 0, digital_tlv),
 204SOC_SINGLE_TLV("Speaker Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_4L,
 205	       ARIZONA_OUT4L_VOL_SHIFT, 0xbf, 0, digital_tlv),
 206
 207SOC_ENUM("Output Ramp Up", arizona_out_vi_ramp),
 208SOC_ENUM("Output Ramp Down", arizona_out_vd_ramp),
 209
 210SOC_SINGLE("Noise Gate Switch", ARIZONA_NOISE_GATE_CONTROL,
 211	   ARIZONA_NGATE_ENA_SHIFT, 1, 0),
 212SOC_SINGLE_TLV("Noise Gate Threshold Volume", ARIZONA_NOISE_GATE_CONTROL,
 213	       ARIZONA_NGATE_THR_SHIFT, 7, 1, ng_tlv),
 214SOC_ENUM("Noise Gate Hold", arizona_ng_hold),
 215
 216CS47L24_NG_SRC("HPOUT1L", ARIZONA_NOISE_GATE_SELECT_1L),
 217CS47L24_NG_SRC("HPOUT1R", ARIZONA_NOISE_GATE_SELECT_1R),
 218CS47L24_NG_SRC("SPKOUT", ARIZONA_NOISE_GATE_SELECT_4L),
 219
 220ARIZONA_MIXER_CONTROLS("AIF1TX1", ARIZONA_AIF1TX1MIX_INPUT_1_SOURCE),
 221ARIZONA_MIXER_CONTROLS("AIF1TX2", ARIZONA_AIF1TX2MIX_INPUT_1_SOURCE),
 222ARIZONA_MIXER_CONTROLS("AIF1TX3", ARIZONA_AIF1TX3MIX_INPUT_1_SOURCE),
 223ARIZONA_MIXER_CONTROLS("AIF1TX4", ARIZONA_AIF1TX4MIX_INPUT_1_SOURCE),
 224ARIZONA_MIXER_CONTROLS("AIF1TX5", ARIZONA_AIF1TX5MIX_INPUT_1_SOURCE),
 225ARIZONA_MIXER_CONTROLS("AIF1TX6", ARIZONA_AIF1TX6MIX_INPUT_1_SOURCE),
 226ARIZONA_MIXER_CONTROLS("AIF1TX7", ARIZONA_AIF1TX7MIX_INPUT_1_SOURCE),
 227ARIZONA_MIXER_CONTROLS("AIF1TX8", ARIZONA_AIF1TX8MIX_INPUT_1_SOURCE),
 228
 229ARIZONA_MIXER_CONTROLS("AIF2TX1", ARIZONA_AIF2TX1MIX_INPUT_1_SOURCE),
 230ARIZONA_MIXER_CONTROLS("AIF2TX2", ARIZONA_AIF2TX2MIX_INPUT_1_SOURCE),
 231ARIZONA_MIXER_CONTROLS("AIF2TX3", ARIZONA_AIF2TX3MIX_INPUT_1_SOURCE),
 232ARIZONA_MIXER_CONTROLS("AIF2TX4", ARIZONA_AIF2TX4MIX_INPUT_1_SOURCE),
 233ARIZONA_MIXER_CONTROLS("AIF2TX5", ARIZONA_AIF2TX5MIX_INPUT_1_SOURCE),
 234ARIZONA_MIXER_CONTROLS("AIF2TX6", ARIZONA_AIF2TX6MIX_INPUT_1_SOURCE),
 235
 236ARIZONA_MIXER_CONTROLS("AIF3TX1", ARIZONA_AIF3TX1MIX_INPUT_1_SOURCE),
 237ARIZONA_MIXER_CONTROLS("AIF3TX2", ARIZONA_AIF3TX2MIX_INPUT_1_SOURCE),
 
 
 
 238};
 239
 240ARIZONA_MIXER_ENUMS(EQ1, ARIZONA_EQ1MIX_INPUT_1_SOURCE);
 241ARIZONA_MIXER_ENUMS(EQ2, ARIZONA_EQ2MIX_INPUT_1_SOURCE);
 242
 243ARIZONA_MIXER_ENUMS(DRC1L, ARIZONA_DRC1LMIX_INPUT_1_SOURCE);
 244ARIZONA_MIXER_ENUMS(DRC1R, ARIZONA_DRC1RMIX_INPUT_1_SOURCE);
 245ARIZONA_MIXER_ENUMS(DRC2L, ARIZONA_DRC2LMIX_INPUT_1_SOURCE);
 246ARIZONA_MIXER_ENUMS(DRC2R, ARIZONA_DRC2RMIX_INPUT_1_SOURCE);
 247
 248ARIZONA_MIXER_ENUMS(LHPF1, ARIZONA_HPLP1MIX_INPUT_1_SOURCE);
 249ARIZONA_MIXER_ENUMS(LHPF2, ARIZONA_HPLP2MIX_INPUT_1_SOURCE);
 250ARIZONA_MIXER_ENUMS(LHPF3, ARIZONA_HPLP3MIX_INPUT_1_SOURCE);
 251ARIZONA_MIXER_ENUMS(LHPF4, ARIZONA_HPLP4MIX_INPUT_1_SOURCE);
 252
 253ARIZONA_MIXER_ENUMS(DSP2L, ARIZONA_DSP2LMIX_INPUT_1_SOURCE);
 254ARIZONA_MIXER_ENUMS(DSP2R, ARIZONA_DSP2RMIX_INPUT_1_SOURCE);
 255ARIZONA_DSP_AUX_ENUMS(DSP2, ARIZONA_DSP2AUX1MIX_INPUT_1_SOURCE);
 256
 257ARIZONA_MIXER_ENUMS(DSP3L, ARIZONA_DSP3LMIX_INPUT_1_SOURCE);
 258ARIZONA_MIXER_ENUMS(DSP3R, ARIZONA_DSP3RMIX_INPUT_1_SOURCE);
 259ARIZONA_DSP_AUX_ENUMS(DSP3, ARIZONA_DSP3AUX1MIX_INPUT_1_SOURCE);
 260
 261ARIZONA_MIXER_ENUMS(PWM1, ARIZONA_PWM1MIX_INPUT_1_SOURCE);
 262ARIZONA_MIXER_ENUMS(PWM2, ARIZONA_PWM2MIX_INPUT_1_SOURCE);
 263
 264ARIZONA_MIXER_ENUMS(OUT1L, ARIZONA_OUT1LMIX_INPUT_1_SOURCE);
 265ARIZONA_MIXER_ENUMS(OUT1R, ARIZONA_OUT1RMIX_INPUT_1_SOURCE);
 266ARIZONA_MIXER_ENUMS(SPKOUT, ARIZONA_OUT4LMIX_INPUT_1_SOURCE);
 267
 268ARIZONA_MIXER_ENUMS(AIF1TX1, ARIZONA_AIF1TX1MIX_INPUT_1_SOURCE);
 269ARIZONA_MIXER_ENUMS(AIF1TX2, ARIZONA_AIF1TX2MIX_INPUT_1_SOURCE);
 270ARIZONA_MIXER_ENUMS(AIF1TX3, ARIZONA_AIF1TX3MIX_INPUT_1_SOURCE);
 271ARIZONA_MIXER_ENUMS(AIF1TX4, ARIZONA_AIF1TX4MIX_INPUT_1_SOURCE);
 272ARIZONA_MIXER_ENUMS(AIF1TX5, ARIZONA_AIF1TX5MIX_INPUT_1_SOURCE);
 273ARIZONA_MIXER_ENUMS(AIF1TX6, ARIZONA_AIF1TX6MIX_INPUT_1_SOURCE);
 274ARIZONA_MIXER_ENUMS(AIF1TX7, ARIZONA_AIF1TX7MIX_INPUT_1_SOURCE);
 275ARIZONA_MIXER_ENUMS(AIF1TX8, ARIZONA_AIF1TX8MIX_INPUT_1_SOURCE);
 276
 277ARIZONA_MIXER_ENUMS(AIF2TX1, ARIZONA_AIF2TX1MIX_INPUT_1_SOURCE);
 278ARIZONA_MIXER_ENUMS(AIF2TX2, ARIZONA_AIF2TX2MIX_INPUT_1_SOURCE);
 279ARIZONA_MIXER_ENUMS(AIF2TX3, ARIZONA_AIF2TX3MIX_INPUT_1_SOURCE);
 280ARIZONA_MIXER_ENUMS(AIF2TX4, ARIZONA_AIF2TX4MIX_INPUT_1_SOURCE);
 281ARIZONA_MIXER_ENUMS(AIF2TX5, ARIZONA_AIF2TX5MIX_INPUT_1_SOURCE);
 282ARIZONA_MIXER_ENUMS(AIF2TX6, ARIZONA_AIF2TX6MIX_INPUT_1_SOURCE);
 283
 284ARIZONA_MIXER_ENUMS(AIF3TX1, ARIZONA_AIF3TX1MIX_INPUT_1_SOURCE);
 285ARIZONA_MIXER_ENUMS(AIF3TX2, ARIZONA_AIF3TX2MIX_INPUT_1_SOURCE);
 286
 287ARIZONA_MUX_ENUMS(ASRC1L, ARIZONA_ASRC1LMIX_INPUT_1_SOURCE);
 288ARIZONA_MUX_ENUMS(ASRC1R, ARIZONA_ASRC1RMIX_INPUT_1_SOURCE);
 289ARIZONA_MUX_ENUMS(ASRC2L, ARIZONA_ASRC2LMIX_INPUT_1_SOURCE);
 290ARIZONA_MUX_ENUMS(ASRC2R, ARIZONA_ASRC2RMIX_INPUT_1_SOURCE);
 291
 292ARIZONA_MUX_ENUMS(ISRC1INT1, ARIZONA_ISRC1INT1MIX_INPUT_1_SOURCE);
 293ARIZONA_MUX_ENUMS(ISRC1INT2, ARIZONA_ISRC1INT2MIX_INPUT_1_SOURCE);
 294ARIZONA_MUX_ENUMS(ISRC1INT3, ARIZONA_ISRC1INT3MIX_INPUT_1_SOURCE);
 295ARIZONA_MUX_ENUMS(ISRC1INT4, ARIZONA_ISRC1INT4MIX_INPUT_1_SOURCE);
 296
 297ARIZONA_MUX_ENUMS(ISRC1DEC1, ARIZONA_ISRC1DEC1MIX_INPUT_1_SOURCE);
 298ARIZONA_MUX_ENUMS(ISRC1DEC2, ARIZONA_ISRC1DEC2MIX_INPUT_1_SOURCE);
 299ARIZONA_MUX_ENUMS(ISRC1DEC3, ARIZONA_ISRC1DEC3MIX_INPUT_1_SOURCE);
 300ARIZONA_MUX_ENUMS(ISRC1DEC4, ARIZONA_ISRC1DEC4MIX_INPUT_1_SOURCE);
 301
 302ARIZONA_MUX_ENUMS(ISRC2INT1, ARIZONA_ISRC2INT1MIX_INPUT_1_SOURCE);
 303ARIZONA_MUX_ENUMS(ISRC2INT2, ARIZONA_ISRC2INT2MIX_INPUT_1_SOURCE);
 304ARIZONA_MUX_ENUMS(ISRC2INT3, ARIZONA_ISRC2INT3MIX_INPUT_1_SOURCE);
 305ARIZONA_MUX_ENUMS(ISRC2INT4, ARIZONA_ISRC2INT4MIX_INPUT_1_SOURCE);
 306
 307ARIZONA_MUX_ENUMS(ISRC2DEC1, ARIZONA_ISRC2DEC1MIX_INPUT_1_SOURCE);
 308ARIZONA_MUX_ENUMS(ISRC2DEC2, ARIZONA_ISRC2DEC2MIX_INPUT_1_SOURCE);
 309ARIZONA_MUX_ENUMS(ISRC2DEC3, ARIZONA_ISRC2DEC3MIX_INPUT_1_SOURCE);
 310ARIZONA_MUX_ENUMS(ISRC2DEC4, ARIZONA_ISRC2DEC4MIX_INPUT_1_SOURCE);
 311
 312ARIZONA_MUX_ENUMS(ISRC3INT1, ARIZONA_ISRC3INT1MIX_INPUT_1_SOURCE);
 313ARIZONA_MUX_ENUMS(ISRC3INT2, ARIZONA_ISRC3INT2MIX_INPUT_1_SOURCE);
 314ARIZONA_MUX_ENUMS(ISRC3INT3, ARIZONA_ISRC3INT3MIX_INPUT_1_SOURCE);
 315ARIZONA_MUX_ENUMS(ISRC3INT4, ARIZONA_ISRC3INT4MIX_INPUT_1_SOURCE);
 316
 317ARIZONA_MUX_ENUMS(ISRC3DEC1, ARIZONA_ISRC3DEC1MIX_INPUT_1_SOURCE);
 318ARIZONA_MUX_ENUMS(ISRC3DEC2, ARIZONA_ISRC3DEC2MIX_INPUT_1_SOURCE);
 319ARIZONA_MUX_ENUMS(ISRC3DEC3, ARIZONA_ISRC3DEC3MIX_INPUT_1_SOURCE);
 320ARIZONA_MUX_ENUMS(ISRC3DEC4, ARIZONA_ISRC3DEC4MIX_INPUT_1_SOURCE);
 321
 322static const char * const cs47l24_aec_loopback_texts[] = {
 323	"HPOUT1L", "HPOUT1R", "SPKOUT",
 324};
 325
 326static const unsigned int cs47l24_aec_loopback_values[] = {
 327	0, 1, 6,
 328};
 329
 330static const struct soc_enum cs47l24_aec_loopback =
 331	SOC_VALUE_ENUM_SINGLE(ARIZONA_DAC_AEC_CONTROL_1,
 332			      ARIZONA_AEC_LOOPBACK_SRC_SHIFT, 0xf,
 333			      ARRAY_SIZE(cs47l24_aec_loopback_texts),
 334			      cs47l24_aec_loopback_texts,
 335			      cs47l24_aec_loopback_values);
 336
 337static const struct snd_kcontrol_new cs47l24_aec_loopback_mux =
 338	SOC_DAPM_ENUM("AEC Loopback", cs47l24_aec_loopback);
 339
 340static const struct snd_soc_dapm_widget cs47l24_dapm_widgets[] = {
 341SND_SOC_DAPM_SUPPLY("SYSCLK", ARIZONA_SYSTEM_CLOCK_1,
 342		    ARIZONA_SYSCLK_ENA_SHIFT, 0, arizona_clk_ev,
 343		    SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
 344SND_SOC_DAPM_SUPPLY("ASYNCCLK", ARIZONA_ASYNC_CLOCK_1,
 345		    ARIZONA_ASYNC_CLK_ENA_SHIFT, 0, arizona_clk_ev,
 346		    SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
 347SND_SOC_DAPM_SUPPLY("OPCLK", ARIZONA_OUTPUT_SYSTEM_CLOCK,
 348		    ARIZONA_OPCLK_ENA_SHIFT, 0, NULL, 0),
 349SND_SOC_DAPM_SUPPLY("ASYNCOPCLK", ARIZONA_OUTPUT_ASYNC_CLOCK,
 350		    ARIZONA_OPCLK_ASYNC_ENA_SHIFT, 0, NULL, 0),
 351
 352SND_SOC_DAPM_REGULATOR_SUPPLY("CPVDD", 20, 0),
 353SND_SOC_DAPM_REGULATOR_SUPPLY("MICVDD", 0, SND_SOC_DAPM_REGULATOR_BYPASS),
 354SND_SOC_DAPM_REGULATOR_SUPPLY("SPKVDD", 0, 0),
 355
 356SND_SOC_DAPM_SIGGEN("TONE"),
 357SND_SOC_DAPM_SIGGEN("NOISE"),
 358SND_SOC_DAPM_SIGGEN("HAPTICS"),
 359
 360SND_SOC_DAPM_INPUT("IN1L"),
 361SND_SOC_DAPM_INPUT("IN1R"),
 362SND_SOC_DAPM_INPUT("IN2L"),
 363SND_SOC_DAPM_INPUT("IN2R"),
 364
 365SND_SOC_DAPM_OUTPUT("DRC1 Signal Activity"),
 366SND_SOC_DAPM_OUTPUT("DRC2 Signal Activity"),
 367
 368SND_SOC_DAPM_OUTPUT("DSP Voice Trigger"),
 369
 370SND_SOC_DAPM_SWITCH("DSP3 Voice Trigger", SND_SOC_NOPM, 2, 0,
 371		    &arizona_voice_trigger_switch[2]),
 372
 373SND_SOC_DAPM_PGA_E("IN1L PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN1L_ENA_SHIFT,
 374		   0, NULL, 0, arizona_in_ev,
 375		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
 376		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
 377SND_SOC_DAPM_PGA_E("IN1R PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN1R_ENA_SHIFT,
 378		   0, NULL, 0, arizona_in_ev,
 379		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
 380		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
 381SND_SOC_DAPM_PGA_E("IN2L PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN2L_ENA_SHIFT,
 382		   0, NULL, 0, arizona_in_ev,
 383		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
 384		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
 385SND_SOC_DAPM_PGA_E("IN2R PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN2R_ENA_SHIFT,
 386		   0, NULL, 0, arizona_in_ev,
 387		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
 388		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
 389
 390SND_SOC_DAPM_SUPPLY("MICBIAS1", ARIZONA_MIC_BIAS_CTRL_1,
 391		    ARIZONA_MICB1_ENA_SHIFT, 0, NULL, 0),
 392SND_SOC_DAPM_SUPPLY("MICBIAS2", ARIZONA_MIC_BIAS_CTRL_2,
 393		    ARIZONA_MICB1_ENA_SHIFT, 0, NULL, 0),
 394
 395SND_SOC_DAPM_PGA("Noise Generator", ARIZONA_COMFORT_NOISE_GENERATOR,
 396		 ARIZONA_NOISE_GEN_ENA_SHIFT, 0, NULL, 0),
 397
 398SND_SOC_DAPM_PGA("Tone Generator 1", ARIZONA_TONE_GENERATOR_1,
 399		 ARIZONA_TONE1_ENA_SHIFT, 0, NULL, 0),
 400SND_SOC_DAPM_PGA("Tone Generator 2", ARIZONA_TONE_GENERATOR_1,
 401		 ARIZONA_TONE2_ENA_SHIFT, 0, NULL, 0),
 402
 403SND_SOC_DAPM_PGA("EQ1", ARIZONA_EQ1_1, ARIZONA_EQ1_ENA_SHIFT, 0, NULL, 0),
 404SND_SOC_DAPM_PGA("EQ2", ARIZONA_EQ2_1, ARIZONA_EQ2_ENA_SHIFT, 0, NULL, 0),
 405
 406SND_SOC_DAPM_PGA("DRC1L", ARIZONA_DRC1_CTRL1, ARIZONA_DRC1L_ENA_SHIFT, 0,
 407		 NULL, 0),
 408SND_SOC_DAPM_PGA("DRC1R", ARIZONA_DRC1_CTRL1, ARIZONA_DRC1R_ENA_SHIFT, 0,
 409		 NULL, 0),
 410SND_SOC_DAPM_PGA("DRC2L", ARIZONA_DRC2_CTRL1, ARIZONA_DRC2L_ENA_SHIFT, 0,
 411		 NULL, 0),
 412SND_SOC_DAPM_PGA("DRC2R", ARIZONA_DRC2_CTRL1, ARIZONA_DRC2R_ENA_SHIFT, 0,
 413		 NULL, 0),
 414
 415SND_SOC_DAPM_PGA("LHPF1", ARIZONA_HPLPF1_1, ARIZONA_LHPF1_ENA_SHIFT, 0,
 416		 NULL, 0),
 417SND_SOC_DAPM_PGA("LHPF2", ARIZONA_HPLPF2_1, ARIZONA_LHPF2_ENA_SHIFT, 0,
 418		 NULL, 0),
 419SND_SOC_DAPM_PGA("LHPF3", ARIZONA_HPLPF3_1, ARIZONA_LHPF3_ENA_SHIFT, 0,
 420		 NULL, 0),
 421SND_SOC_DAPM_PGA("LHPF4", ARIZONA_HPLPF4_1, ARIZONA_LHPF4_ENA_SHIFT, 0,
 422		 NULL, 0),
 423
 424SND_SOC_DAPM_PGA("PWM1 Driver", ARIZONA_PWM_DRIVE_1, ARIZONA_PWM1_ENA_SHIFT,
 425		 0, NULL, 0),
 426SND_SOC_DAPM_PGA("PWM2 Driver", ARIZONA_PWM_DRIVE_1, ARIZONA_PWM2_ENA_SHIFT,
 427		 0, NULL, 0),
 428
 429SND_SOC_DAPM_PGA("ASRC1L", ARIZONA_ASRC_ENABLE, ARIZONA_ASRC1L_ENA_SHIFT, 0,
 430		 NULL, 0),
 431SND_SOC_DAPM_PGA("ASRC1R", ARIZONA_ASRC_ENABLE, ARIZONA_ASRC1R_ENA_SHIFT, 0,
 432		 NULL, 0),
 433SND_SOC_DAPM_PGA("ASRC2L", ARIZONA_ASRC_ENABLE, ARIZONA_ASRC2L_ENA_SHIFT, 0,
 434		 NULL, 0),
 435SND_SOC_DAPM_PGA("ASRC2R", ARIZONA_ASRC_ENABLE, ARIZONA_ASRC2R_ENA_SHIFT, 0,
 436		 NULL, 0),
 437
 438WM_ADSP2("DSP2", 1, cs47l24_adsp_power_ev),
 439WM_ADSP2("DSP3", 2, cs47l24_adsp_power_ev),
 440
 441SND_SOC_DAPM_PGA("ISRC1INT1", ARIZONA_ISRC_1_CTRL_3,
 442		 ARIZONA_ISRC1_INT0_ENA_SHIFT, 0, NULL, 0),
 443SND_SOC_DAPM_PGA("ISRC1INT2", ARIZONA_ISRC_1_CTRL_3,
 444		 ARIZONA_ISRC1_INT1_ENA_SHIFT, 0, NULL, 0),
 445SND_SOC_DAPM_PGA("ISRC1INT3", ARIZONA_ISRC_1_CTRL_3,
 446		 ARIZONA_ISRC1_INT2_ENA_SHIFT, 0, NULL, 0),
 447SND_SOC_DAPM_PGA("ISRC1INT4", ARIZONA_ISRC_1_CTRL_3,
 448		 ARIZONA_ISRC1_INT3_ENA_SHIFT, 0, NULL, 0),
 449
 450SND_SOC_DAPM_PGA("ISRC1DEC1", ARIZONA_ISRC_1_CTRL_3,
 451		 ARIZONA_ISRC1_DEC0_ENA_SHIFT, 0, NULL, 0),
 452SND_SOC_DAPM_PGA("ISRC1DEC2", ARIZONA_ISRC_1_CTRL_3,
 453		 ARIZONA_ISRC1_DEC1_ENA_SHIFT, 0, NULL, 0),
 454SND_SOC_DAPM_PGA("ISRC1DEC3", ARIZONA_ISRC_1_CTRL_3,
 455		 ARIZONA_ISRC1_DEC2_ENA_SHIFT, 0, NULL, 0),
 456SND_SOC_DAPM_PGA("ISRC1DEC4", ARIZONA_ISRC_1_CTRL_3,
 457		 ARIZONA_ISRC1_DEC3_ENA_SHIFT, 0, NULL, 0),
 458
 459SND_SOC_DAPM_PGA("ISRC2INT1", ARIZONA_ISRC_2_CTRL_3,
 460		 ARIZONA_ISRC2_INT0_ENA_SHIFT, 0, NULL, 0),
 461SND_SOC_DAPM_PGA("ISRC2INT2", ARIZONA_ISRC_2_CTRL_3,
 462		 ARIZONA_ISRC2_INT1_ENA_SHIFT, 0, NULL, 0),
 463SND_SOC_DAPM_PGA("ISRC2INT3", ARIZONA_ISRC_2_CTRL_3,
 464		 ARIZONA_ISRC2_INT2_ENA_SHIFT, 0, NULL, 0),
 465SND_SOC_DAPM_PGA("ISRC2INT4", ARIZONA_ISRC_2_CTRL_3,
 466		 ARIZONA_ISRC2_INT3_ENA_SHIFT, 0, NULL, 0),
 467
 468SND_SOC_DAPM_PGA("ISRC2DEC1", ARIZONA_ISRC_2_CTRL_3,
 469		 ARIZONA_ISRC2_DEC0_ENA_SHIFT, 0, NULL, 0),
 470SND_SOC_DAPM_PGA("ISRC2DEC2", ARIZONA_ISRC_2_CTRL_3,
 471		 ARIZONA_ISRC2_DEC1_ENA_SHIFT, 0, NULL, 0),
 472SND_SOC_DAPM_PGA("ISRC2DEC3", ARIZONA_ISRC_2_CTRL_3,
 473		 ARIZONA_ISRC2_DEC2_ENA_SHIFT, 0, NULL, 0),
 474SND_SOC_DAPM_PGA("ISRC2DEC4", ARIZONA_ISRC_2_CTRL_3,
 475		 ARIZONA_ISRC2_DEC3_ENA_SHIFT, 0, NULL, 0),
 476
 477SND_SOC_DAPM_PGA("ISRC3INT1", ARIZONA_ISRC_3_CTRL_3,
 478		 ARIZONA_ISRC3_INT0_ENA_SHIFT, 0, NULL, 0),
 479SND_SOC_DAPM_PGA("ISRC3INT2", ARIZONA_ISRC_3_CTRL_3,
 480		 ARIZONA_ISRC3_INT1_ENA_SHIFT, 0, NULL, 0),
 481SND_SOC_DAPM_PGA("ISRC3INT3", ARIZONA_ISRC_3_CTRL_3,
 482		 ARIZONA_ISRC3_INT2_ENA_SHIFT, 0, NULL, 0),
 483SND_SOC_DAPM_PGA("ISRC3INT4", ARIZONA_ISRC_3_CTRL_3,
 484		 ARIZONA_ISRC3_INT3_ENA_SHIFT, 0, NULL, 0),
 485
 486SND_SOC_DAPM_PGA("ISRC3DEC1", ARIZONA_ISRC_3_CTRL_3,
 487		 ARIZONA_ISRC3_DEC0_ENA_SHIFT, 0, NULL, 0),
 488SND_SOC_DAPM_PGA("ISRC3DEC2", ARIZONA_ISRC_3_CTRL_3,
 489		 ARIZONA_ISRC3_DEC1_ENA_SHIFT, 0, NULL, 0),
 490SND_SOC_DAPM_PGA("ISRC3DEC3", ARIZONA_ISRC_3_CTRL_3,
 491		 ARIZONA_ISRC3_DEC2_ENA_SHIFT, 0, NULL, 0),
 492SND_SOC_DAPM_PGA("ISRC3DEC4", ARIZONA_ISRC_3_CTRL_3,
 493		 ARIZONA_ISRC3_DEC3_ENA_SHIFT, 0, NULL, 0),
 494
 495SND_SOC_DAPM_MUX("AEC Loopback", ARIZONA_DAC_AEC_CONTROL_1,
 496		 ARIZONA_AEC_LOOPBACK_ENA_SHIFT, 0, &cs47l24_aec_loopback_mux),
 497
 498SND_SOC_DAPM_AIF_OUT("AIF1TX1", NULL, 0,
 499		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX1_ENA_SHIFT, 0),
 500SND_SOC_DAPM_AIF_OUT("AIF1TX2", NULL, 0,
 501		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX2_ENA_SHIFT, 0),
 502SND_SOC_DAPM_AIF_OUT("AIF1TX3", NULL, 0,
 503		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX3_ENA_SHIFT, 0),
 504SND_SOC_DAPM_AIF_OUT("AIF1TX4", NULL, 0,
 505		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX4_ENA_SHIFT, 0),
 506SND_SOC_DAPM_AIF_OUT("AIF1TX5", NULL, 0,
 507		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX5_ENA_SHIFT, 0),
 508SND_SOC_DAPM_AIF_OUT("AIF1TX6", NULL, 0,
 509		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX6_ENA_SHIFT, 0),
 510SND_SOC_DAPM_AIF_OUT("AIF1TX7", NULL, 0,
 511		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX7_ENA_SHIFT, 0),
 512SND_SOC_DAPM_AIF_OUT("AIF1TX8", NULL, 0,
 513		     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX8_ENA_SHIFT, 0),
 514
 515SND_SOC_DAPM_AIF_IN("AIF1RX1", NULL, 0,
 516		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX1_ENA_SHIFT, 0),
 517SND_SOC_DAPM_AIF_IN("AIF1RX2", NULL, 0,
 518		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX2_ENA_SHIFT, 0),
 519SND_SOC_DAPM_AIF_IN("AIF1RX3", NULL, 0,
 520		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX3_ENA_SHIFT, 0),
 521SND_SOC_DAPM_AIF_IN("AIF1RX4", NULL, 0,
 522		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX4_ENA_SHIFT, 0),
 523SND_SOC_DAPM_AIF_IN("AIF1RX5", NULL, 0,
 524		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX5_ENA_SHIFT, 0),
 525SND_SOC_DAPM_AIF_IN("AIF1RX6", NULL, 0,
 526		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX6_ENA_SHIFT, 0),
 527SND_SOC_DAPM_AIF_IN("AIF1RX7", NULL, 0,
 528		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX7_ENA_SHIFT, 0),
 529SND_SOC_DAPM_AIF_IN("AIF1RX8", NULL, 0,
 530		    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX8_ENA_SHIFT, 0),
 531
 532SND_SOC_DAPM_AIF_OUT("AIF2TX1", NULL, 0,
 533		     ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX1_ENA_SHIFT, 0),
 534SND_SOC_DAPM_AIF_OUT("AIF2TX2", NULL, 0,
 535		     ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX2_ENA_SHIFT, 0),
 536SND_SOC_DAPM_AIF_OUT("AIF2TX3", NULL, 0,
 537		     ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX3_ENA_SHIFT, 0),
 538SND_SOC_DAPM_AIF_OUT("AIF2TX4", NULL, 0,
 539		     ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX4_ENA_SHIFT, 0),
 540SND_SOC_DAPM_AIF_OUT("AIF2TX5", NULL, 0,
 541		     ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX5_ENA_SHIFT, 0),
 542SND_SOC_DAPM_AIF_OUT("AIF2TX6", NULL, 0,
 543		     ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX6_ENA_SHIFT, 0),
 544
 545SND_SOC_DAPM_AIF_IN("AIF2RX1", NULL, 0,
 546		    ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX1_ENA_SHIFT, 0),
 547SND_SOC_DAPM_AIF_IN("AIF2RX2", NULL, 0,
 548		    ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX2_ENA_SHIFT, 0),
 549SND_SOC_DAPM_AIF_IN("AIF2RX3", NULL, 0,
 550		    ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX3_ENA_SHIFT, 0),
 551SND_SOC_DAPM_AIF_IN("AIF2RX4", NULL, 0,
 552		    ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX4_ENA_SHIFT, 0),
 553SND_SOC_DAPM_AIF_IN("AIF2RX5", NULL, 0,
 554		    ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX5_ENA_SHIFT, 0),
 555SND_SOC_DAPM_AIF_IN("AIF2RX6", NULL, 0,
 556		    ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX6_ENA_SHIFT, 0),
 557
 558SND_SOC_DAPM_AIF_OUT("AIF3TX1", NULL, 0,
 559		     ARIZONA_AIF3_TX_ENABLES, ARIZONA_AIF3TX1_ENA_SHIFT, 0),
 560SND_SOC_DAPM_AIF_OUT("AIF3TX2", NULL, 0,
 561		     ARIZONA_AIF3_TX_ENABLES, ARIZONA_AIF3TX2_ENA_SHIFT, 0),
 562
 563SND_SOC_DAPM_AIF_IN("AIF3RX1", NULL, 0,
 564		    ARIZONA_AIF3_RX_ENABLES, ARIZONA_AIF3RX1_ENA_SHIFT, 0),
 565SND_SOC_DAPM_AIF_IN("AIF3RX2", NULL, 0,
 566		    ARIZONA_AIF3_RX_ENABLES, ARIZONA_AIF3RX2_ENA_SHIFT, 0),
 567
 568SND_SOC_DAPM_PGA_E("OUT1L", SND_SOC_NOPM,
 569		   ARIZONA_OUT1L_ENA_SHIFT, 0, NULL, 0, arizona_hp_ev,
 570		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
 571		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
 572SND_SOC_DAPM_PGA_E("OUT1R", SND_SOC_NOPM,
 573		   ARIZONA_OUT1R_ENA_SHIFT, 0, NULL, 0, arizona_hp_ev,
 574		   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
 575		   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
 576
 577ARIZONA_MIXER_WIDGETS(EQ1, "EQ1"),
 578ARIZONA_MIXER_WIDGETS(EQ2, "EQ2"),
 579
 580ARIZONA_MIXER_WIDGETS(DRC1L, "DRC1L"),
 581ARIZONA_MIXER_WIDGETS(DRC1R, "DRC1R"),
 582ARIZONA_MIXER_WIDGETS(DRC2L, "DRC2L"),
 583ARIZONA_MIXER_WIDGETS(DRC2R, "DRC2R"),
 584
 585ARIZONA_MIXER_WIDGETS(LHPF1, "LHPF1"),
 586ARIZONA_MIXER_WIDGETS(LHPF2, "LHPF2"),
 587ARIZONA_MIXER_WIDGETS(LHPF3, "LHPF3"),
 588ARIZONA_MIXER_WIDGETS(LHPF4, "LHPF4"),
 589
 590ARIZONA_MIXER_WIDGETS(PWM1, "PWM1"),
 591ARIZONA_MIXER_WIDGETS(PWM2, "PWM2"),
 592
 593ARIZONA_MIXER_WIDGETS(OUT1L, "HPOUT1L"),
 594ARIZONA_MIXER_WIDGETS(OUT1R, "HPOUT1R"),
 595ARIZONA_MIXER_WIDGETS(SPKOUT, "SPKOUT"),
 596
 597ARIZONA_MIXER_WIDGETS(AIF1TX1, "AIF1TX1"),
 598ARIZONA_MIXER_WIDGETS(AIF1TX2, "AIF1TX2"),
 599ARIZONA_MIXER_WIDGETS(AIF1TX3, "AIF1TX3"),
 600ARIZONA_MIXER_WIDGETS(AIF1TX4, "AIF1TX4"),
 601ARIZONA_MIXER_WIDGETS(AIF1TX5, "AIF1TX5"),
 602ARIZONA_MIXER_WIDGETS(AIF1TX6, "AIF1TX6"),
 603ARIZONA_MIXER_WIDGETS(AIF1TX7, "AIF1TX7"),
 604ARIZONA_MIXER_WIDGETS(AIF1TX8, "AIF1TX8"),
 605
 606ARIZONA_MIXER_WIDGETS(AIF2TX1, "AIF2TX1"),
 607ARIZONA_MIXER_WIDGETS(AIF2TX2, "AIF2TX2"),
 608ARIZONA_MIXER_WIDGETS(AIF2TX3, "AIF2TX3"),
 609ARIZONA_MIXER_WIDGETS(AIF2TX4, "AIF2TX4"),
 610ARIZONA_MIXER_WIDGETS(AIF2TX5, "AIF2TX5"),
 611ARIZONA_MIXER_WIDGETS(AIF2TX6, "AIF2TX6"),
 612
 613ARIZONA_MIXER_WIDGETS(AIF3TX1, "AIF3TX1"),
 614ARIZONA_MIXER_WIDGETS(AIF3TX2, "AIF3TX2"),
 615
 616ARIZONA_MUX_WIDGETS(ASRC1L, "ASRC1L"),
 617ARIZONA_MUX_WIDGETS(ASRC1R, "ASRC1R"),
 618ARIZONA_MUX_WIDGETS(ASRC2L, "ASRC2L"),
 619ARIZONA_MUX_WIDGETS(ASRC2R, "ASRC2R"),
 620
 621ARIZONA_DSP_WIDGETS(DSP2, "DSP2"),
 622ARIZONA_DSP_WIDGETS(DSP3, "DSP3"),
 623
 624ARIZONA_MUX_WIDGETS(ISRC1DEC1, "ISRC1DEC1"),
 625ARIZONA_MUX_WIDGETS(ISRC1DEC2, "ISRC1DEC2"),
 626ARIZONA_MUX_WIDGETS(ISRC1DEC3, "ISRC1DEC3"),
 627ARIZONA_MUX_WIDGETS(ISRC1DEC4, "ISRC1DEC4"),
 628
 629ARIZONA_MUX_WIDGETS(ISRC1INT1, "ISRC1INT1"),
 630ARIZONA_MUX_WIDGETS(ISRC1INT2, "ISRC1INT2"),
 631ARIZONA_MUX_WIDGETS(ISRC1INT3, "ISRC1INT3"),
 632ARIZONA_MUX_WIDGETS(ISRC1INT4, "ISRC1INT4"),
 633
 634ARIZONA_MUX_WIDGETS(ISRC2DEC1, "ISRC2DEC1"),
 635ARIZONA_MUX_WIDGETS(ISRC2DEC2, "ISRC2DEC2"),
 636ARIZONA_MUX_WIDGETS(ISRC2DEC3, "ISRC2DEC3"),
 637ARIZONA_MUX_WIDGETS(ISRC2DEC4, "ISRC2DEC4"),
 638
 639ARIZONA_MUX_WIDGETS(ISRC2INT1, "ISRC2INT1"),
 640ARIZONA_MUX_WIDGETS(ISRC2INT2, "ISRC2INT2"),
 641ARIZONA_MUX_WIDGETS(ISRC2INT3, "ISRC2INT3"),
 642ARIZONA_MUX_WIDGETS(ISRC2INT4, "ISRC2INT4"),
 643
 644ARIZONA_MUX_WIDGETS(ISRC3DEC1, "ISRC3DEC1"),
 645ARIZONA_MUX_WIDGETS(ISRC3DEC2, "ISRC3DEC2"),
 646ARIZONA_MUX_WIDGETS(ISRC3DEC3, "ISRC3DEC3"),
 647ARIZONA_MUX_WIDGETS(ISRC3DEC4, "ISRC3DEC4"),
 648
 649ARIZONA_MUX_WIDGETS(ISRC3INT1, "ISRC3INT1"),
 650ARIZONA_MUX_WIDGETS(ISRC3INT2, "ISRC3INT2"),
 651ARIZONA_MUX_WIDGETS(ISRC3INT3, "ISRC3INT3"),
 652ARIZONA_MUX_WIDGETS(ISRC3INT4, "ISRC3INT4"),
 653
 654SND_SOC_DAPM_OUTPUT("HPOUT1L"),
 655SND_SOC_DAPM_OUTPUT("HPOUT1R"),
 656SND_SOC_DAPM_OUTPUT("SPKOUTN"),
 657SND_SOC_DAPM_OUTPUT("SPKOUTP"),
 658
 659SND_SOC_DAPM_OUTPUT("MICSUPP"),
 660};
 661
 662#define ARIZONA_MIXER_INPUT_ROUTES(name)	\
 663	{ name, "Noise Generator", "Noise Generator" }, \
 664	{ name, "Tone Generator 1", "Tone Generator 1" }, \
 665	{ name, "Tone Generator 2", "Tone Generator 2" }, \
 666	{ name, "Haptics", "HAPTICS" }, \
 667	{ name, "AEC", "AEC Loopback" }, \
 668	{ name, "IN1L", "IN1L PGA" }, \
 669	{ name, "IN1R", "IN1R PGA" }, \
 670	{ name, "IN2L", "IN2L PGA" }, \
 671	{ name, "IN2R", "IN2R PGA" }, \
 672	{ name, "AIF1RX1", "AIF1RX1" }, \
 673	{ name, "AIF1RX2", "AIF1RX2" }, \
 674	{ name, "AIF1RX3", "AIF1RX3" }, \
 675	{ name, "AIF1RX4", "AIF1RX4" }, \
 676	{ name, "AIF1RX5", "AIF1RX5" }, \
 677	{ name, "AIF1RX6", "AIF1RX6" }, \
 678	{ name, "AIF1RX7", "AIF1RX7" }, \
 679	{ name, "AIF1RX8", "AIF1RX8" }, \
 680	{ name, "AIF2RX1", "AIF2RX1" }, \
 681	{ name, "AIF2RX2", "AIF2RX2" }, \
 682	{ name, "AIF2RX3", "AIF2RX3" }, \
 683	{ name, "AIF2RX4", "AIF2RX4" }, \
 684	{ name, "AIF2RX5", "AIF2RX5" }, \
 685	{ name, "AIF2RX6", "AIF2RX6" }, \
 686	{ name, "AIF3RX1", "AIF3RX1" }, \
 687	{ name, "AIF3RX2", "AIF3RX2" }, \
 688	{ name, "EQ1", "EQ1" }, \
 689	{ name, "EQ2", "EQ2" }, \
 690	{ name, "DRC1L", "DRC1L" }, \
 691	{ name, "DRC1R", "DRC1R" }, \
 692	{ name, "DRC2L", "DRC2L" }, \
 693	{ name, "DRC2R", "DRC2R" }, \
 694	{ name, "LHPF1", "LHPF1" }, \
 695	{ name, "LHPF2", "LHPF2" }, \
 696	{ name, "LHPF3", "LHPF3" }, \
 697	{ name, "LHPF4", "LHPF4" }, \
 698	{ name, "ASRC1L", "ASRC1L" }, \
 699	{ name, "ASRC1R", "ASRC1R" }, \
 700	{ name, "ASRC2L", "ASRC2L" }, \
 701	{ name, "ASRC2R", "ASRC2R" }, \
 702	{ name, "ISRC1DEC1", "ISRC1DEC1" }, \
 703	{ name, "ISRC1DEC2", "ISRC1DEC2" }, \
 704	{ name, "ISRC1DEC3", "ISRC1DEC3" }, \
 705	{ name, "ISRC1DEC4", "ISRC1DEC4" }, \
 706	{ name, "ISRC1INT1", "ISRC1INT1" }, \
 707	{ name, "ISRC1INT2", "ISRC1INT2" }, \
 708	{ name, "ISRC1INT3", "ISRC1INT3" }, \
 709	{ name, "ISRC1INT4", "ISRC1INT4" }, \
 710	{ name, "ISRC2DEC1", "ISRC2DEC1" }, \
 711	{ name, "ISRC2DEC2", "ISRC2DEC2" }, \
 712	{ name, "ISRC2DEC3", "ISRC2DEC3" }, \
 713	{ name, "ISRC2DEC4", "ISRC2DEC4" }, \
 714	{ name, "ISRC2INT1", "ISRC2INT1" }, \
 715	{ name, "ISRC2INT2", "ISRC2INT2" }, \
 716	{ name, "ISRC2INT3", "ISRC2INT3" }, \
 717	{ name, "ISRC2INT4", "ISRC2INT4" }, \
 718	{ name, "ISRC3DEC1", "ISRC3DEC1" }, \
 719	{ name, "ISRC3DEC2", "ISRC3DEC2" }, \
 720	{ name, "ISRC3DEC3", "ISRC3DEC3" }, \
 721	{ name, "ISRC3DEC4", "ISRC3DEC4" }, \
 722	{ name, "ISRC3INT1", "ISRC3INT1" }, \
 723	{ name, "ISRC3INT2", "ISRC3INT2" }, \
 724	{ name, "ISRC3INT3", "ISRC3INT3" }, \
 725	{ name, "ISRC3INT4", "ISRC3INT4" }, \
 726	{ name, "DSP2.1", "DSP2" }, \
 727	{ name, "DSP2.2", "DSP2" }, \
 728	{ name, "DSP2.3", "DSP2" }, \
 729	{ name, "DSP2.4", "DSP2" }, \
 730	{ name, "DSP2.5", "DSP2" }, \
 731	{ name, "DSP2.6", "DSP2" }, \
 732	{ name, "DSP3.1", "DSP3" }, \
 733	{ name, "DSP3.2", "DSP3" }, \
 734	{ name, "DSP3.3", "DSP3" }, \
 735	{ name, "DSP3.4", "DSP3" }, \
 736	{ name, "DSP3.5", "DSP3" }, \
 737	{ name, "DSP3.6", "DSP3" }
 738
 739static const struct snd_soc_dapm_route cs47l24_dapm_routes[] = {
 740	{ "OUT1L", NULL, "CPVDD" },
 741	{ "OUT1R", NULL, "CPVDD" },
 742
 743	{ "OUT4L", NULL, "SPKVDD" },
 744
 745	{ "OUT1L", NULL, "SYSCLK" },
 746	{ "OUT1R", NULL, "SYSCLK" },
 747	{ "OUT4L", NULL, "SYSCLK" },
 748
 749	{ "IN1L", NULL, "SYSCLK" },
 750	{ "IN1R", NULL, "SYSCLK" },
 751	{ "IN2L", NULL, "SYSCLK" },
 752	{ "IN2R", NULL, "SYSCLK" },
 753
 754	{ "ASRC1L", NULL, "SYSCLK" },
 755	{ "ASRC1R", NULL, "SYSCLK" },
 756	{ "ASRC2L", NULL, "SYSCLK" },
 757	{ "ASRC2R", NULL, "SYSCLK" },
 758
 759	{ "ASRC1L", NULL, "ASYNCCLK" },
 760	{ "ASRC1R", NULL, "ASYNCCLK" },
 761	{ "ASRC2L", NULL, "ASYNCCLK" },
 762	{ "ASRC2R", NULL, "ASYNCCLK" },
 763
 764	{ "MICBIAS1", NULL, "MICVDD" },
 765	{ "MICBIAS2", NULL, "MICVDD" },
 766
 767	{ "Noise Generator", NULL, "SYSCLK" },
 768	{ "Tone Generator 1", NULL, "SYSCLK" },
 769	{ "Tone Generator 2", NULL, "SYSCLK" },
 770
 771	{ "Noise Generator", NULL, "NOISE" },
 772	{ "Tone Generator 1", NULL, "TONE" },
 773	{ "Tone Generator 2", NULL, "TONE" },
 774
 775	{ "AIF1 Capture", NULL, "AIF1TX1" },
 776	{ "AIF1 Capture", NULL, "AIF1TX2" },
 777	{ "AIF1 Capture", NULL, "AIF1TX3" },
 778	{ "AIF1 Capture", NULL, "AIF1TX4" },
 779	{ "AIF1 Capture", NULL, "AIF1TX5" },
 780	{ "AIF1 Capture", NULL, "AIF1TX6" },
 781	{ "AIF1 Capture", NULL, "AIF1TX7" },
 782	{ "AIF1 Capture", NULL, "AIF1TX8" },
 783
 784	{ "AIF1RX1", NULL, "AIF1 Playback" },
 785	{ "AIF1RX2", NULL, "AIF1 Playback" },
 786	{ "AIF1RX3", NULL, "AIF1 Playback" },
 787	{ "AIF1RX4", NULL, "AIF1 Playback" },
 788	{ "AIF1RX5", NULL, "AIF1 Playback" },
 789	{ "AIF1RX6", NULL, "AIF1 Playback" },
 790	{ "AIF1RX7", NULL, "AIF1 Playback" },
 791	{ "AIF1RX8", NULL, "AIF1 Playback" },
 792
 793	{ "AIF2 Capture", NULL, "AIF2TX1" },
 794	{ "AIF2 Capture", NULL, "AIF2TX2" },
 795	{ "AIF2 Capture", NULL, "AIF2TX3" },
 796	{ "AIF2 Capture", NULL, "AIF2TX4" },
 797	{ "AIF2 Capture", NULL, "AIF2TX5" },
 798	{ "AIF2 Capture", NULL, "AIF2TX6" },
 799
 800	{ "AIF2RX1", NULL, "AIF2 Playback" },
 801	{ "AIF2RX2", NULL, "AIF2 Playback" },
 802	{ "AIF2RX3", NULL, "AIF2 Playback" },
 803	{ "AIF2RX4", NULL, "AIF2 Playback" },
 804	{ "AIF2RX5", NULL, "AIF2 Playback" },
 805	{ "AIF2RX6", NULL, "AIF2 Playback" },
 806
 807	{ "AIF3 Capture", NULL, "AIF3TX1" },
 808	{ "AIF3 Capture", NULL, "AIF3TX2" },
 809
 810	{ "AIF3RX1", NULL, "AIF3 Playback" },
 811	{ "AIF3RX2", NULL, "AIF3 Playback" },
 812
 813	{ "AIF1 Playback", NULL, "SYSCLK" },
 814	{ "AIF2 Playback", NULL, "SYSCLK" },
 815	{ "AIF3 Playback", NULL, "SYSCLK" },
 816
 817	{ "AIF1 Capture", NULL, "SYSCLK" },
 818	{ "AIF2 Capture", NULL, "SYSCLK" },
 819	{ "AIF3 Capture", NULL, "SYSCLK" },
 820
 821	{ "Voice Control DSP", NULL, "DSP3" },
 822
 823	{ "IN1L PGA", NULL, "IN1L" },
 824	{ "IN1R PGA", NULL, "IN1R" },
 825
 826	{ "IN2L PGA", NULL, "IN2L" },
 827	{ "IN2R PGA", NULL, "IN2R" },
 828
 829	{ "Audio Trace DSP", NULL, "DSP2" },
 830
 831	ARIZONA_MIXER_ROUTES("OUT1L", "HPOUT1L"),
 832	ARIZONA_MIXER_ROUTES("OUT1R", "HPOUT1R"),
 833
 834	ARIZONA_MIXER_ROUTES("OUT4L", "SPKOUT"),
 835
 836	ARIZONA_MIXER_ROUTES("PWM1 Driver", "PWM1"),
 837	ARIZONA_MIXER_ROUTES("PWM2 Driver", "PWM2"),
 838
 839	ARIZONA_MIXER_ROUTES("AIF1TX1", "AIF1TX1"),
 840	ARIZONA_MIXER_ROUTES("AIF1TX2", "AIF1TX2"),
 841	ARIZONA_MIXER_ROUTES("AIF1TX3", "AIF1TX3"),
 842	ARIZONA_MIXER_ROUTES("AIF1TX4", "AIF1TX4"),
 843	ARIZONA_MIXER_ROUTES("AIF1TX5", "AIF1TX5"),
 844	ARIZONA_MIXER_ROUTES("AIF1TX6", "AIF1TX6"),
 845	ARIZONA_MIXER_ROUTES("AIF1TX7", "AIF1TX7"),
 846	ARIZONA_MIXER_ROUTES("AIF1TX8", "AIF1TX8"),
 847
 848	ARIZONA_MIXER_ROUTES("AIF2TX1", "AIF2TX1"),
 849	ARIZONA_MIXER_ROUTES("AIF2TX2", "AIF2TX2"),
 850	ARIZONA_MIXER_ROUTES("AIF2TX3", "AIF2TX3"),
 851	ARIZONA_MIXER_ROUTES("AIF2TX4", "AIF2TX4"),
 852	ARIZONA_MIXER_ROUTES("AIF2TX5", "AIF2TX5"),
 853	ARIZONA_MIXER_ROUTES("AIF2TX6", "AIF2TX6"),
 854
 855	ARIZONA_MIXER_ROUTES("AIF3TX1", "AIF3TX1"),
 856	ARIZONA_MIXER_ROUTES("AIF3TX2", "AIF3TX2"),
 857
 858	ARIZONA_MIXER_ROUTES("EQ1", "EQ1"),
 859	ARIZONA_MIXER_ROUTES("EQ2", "EQ2"),
 860
 861	ARIZONA_MIXER_ROUTES("DRC1L", "DRC1L"),
 862	ARIZONA_MIXER_ROUTES("DRC1R", "DRC1R"),
 863	ARIZONA_MIXER_ROUTES("DRC2L", "DRC2L"),
 864	ARIZONA_MIXER_ROUTES("DRC2R", "DRC2R"),
 865
 866	ARIZONA_MIXER_ROUTES("LHPF1", "LHPF1"),
 867	ARIZONA_MIXER_ROUTES("LHPF2", "LHPF2"),
 868	ARIZONA_MIXER_ROUTES("LHPF3", "LHPF3"),
 869	ARIZONA_MIXER_ROUTES("LHPF4", "LHPF4"),
 870
 871	ARIZONA_MUX_ROUTES("ASRC1L", "ASRC1L"),
 872	ARIZONA_MUX_ROUTES("ASRC1R", "ASRC1R"),
 873	ARIZONA_MUX_ROUTES("ASRC2L", "ASRC2L"),
 874	ARIZONA_MUX_ROUTES("ASRC2R", "ASRC2R"),
 875
 876	ARIZONA_DSP_ROUTES("DSP2"),
 877	ARIZONA_DSP_ROUTES("DSP3"),
 878
 879	ARIZONA_MUX_ROUTES("ISRC1INT1", "ISRC1INT1"),
 880	ARIZONA_MUX_ROUTES("ISRC1INT2", "ISRC1INT2"),
 881	ARIZONA_MUX_ROUTES("ISRC1INT3", "ISRC1INT3"),
 882	ARIZONA_MUX_ROUTES("ISRC1INT4", "ISRC1INT4"),
 883
 884	ARIZONA_MUX_ROUTES("ISRC1DEC1", "ISRC1DEC1"),
 885	ARIZONA_MUX_ROUTES("ISRC1DEC2", "ISRC1DEC2"),
 886	ARIZONA_MUX_ROUTES("ISRC1DEC3", "ISRC1DEC3"),
 887	ARIZONA_MUX_ROUTES("ISRC1DEC4", "ISRC1DEC4"),
 888
 889	ARIZONA_MUX_ROUTES("ISRC2INT1", "ISRC2INT1"),
 890	ARIZONA_MUX_ROUTES("ISRC2INT2", "ISRC2INT2"),
 891	ARIZONA_MUX_ROUTES("ISRC2INT3", "ISRC2INT3"),
 892	ARIZONA_MUX_ROUTES("ISRC2INT4", "ISRC2INT4"),
 893
 894	ARIZONA_MUX_ROUTES("ISRC2DEC1", "ISRC2DEC1"),
 895	ARIZONA_MUX_ROUTES("ISRC2DEC2", "ISRC2DEC2"),
 896	ARIZONA_MUX_ROUTES("ISRC2DEC3", "ISRC2DEC3"),
 897	ARIZONA_MUX_ROUTES("ISRC2DEC4", "ISRC2DEC4"),
 898
 899	ARIZONA_MUX_ROUTES("ISRC3INT1", "ISRC3INT1"),
 900	ARIZONA_MUX_ROUTES("ISRC3INT2", "ISRC3INT2"),
 901	ARIZONA_MUX_ROUTES("ISRC3INT3", "ISRC3INT3"),
 902	ARIZONA_MUX_ROUTES("ISRC3INT4", "ISRC3INT4"),
 903
 904	ARIZONA_MUX_ROUTES("ISRC3DEC1", "ISRC3DEC1"),
 905	ARIZONA_MUX_ROUTES("ISRC3DEC2", "ISRC3DEC2"),
 906	ARIZONA_MUX_ROUTES("ISRC3DEC3", "ISRC3DEC3"),
 907	ARIZONA_MUX_ROUTES("ISRC3DEC4", "ISRC3DEC4"),
 908
 909	{ "AEC Loopback", "HPOUT1L", "OUT1L" },
 910	{ "AEC Loopback", "HPOUT1R", "OUT1R" },
 911	{ "HPOUT1L", NULL, "OUT1L" },
 912	{ "HPOUT1R", NULL, "OUT1R" },
 913
 914	{ "AEC Loopback", "SPKOUT", "OUT4L" },
 915	{ "SPKOUTN", NULL, "OUT4L" },
 916	{ "SPKOUTP", NULL, "OUT4L" },
 917
 918	{ "MICSUPP", NULL, "SYSCLK" },
 919
 920	{ "DRC1 Signal Activity", NULL, "SYSCLK" },
 921	{ "DRC2 Signal Activity", NULL, "SYSCLK" },
 922	{ "DRC1 Signal Activity", NULL, "DRC1L" },
 923	{ "DRC1 Signal Activity", NULL, "DRC1R" },
 924	{ "DRC2 Signal Activity", NULL, "DRC2L" },
 925	{ "DRC2 Signal Activity", NULL, "DRC2R" },
 926
 927	{ "DSP Voice Trigger", NULL, "SYSCLK" },
 928	{ "DSP Voice Trigger", NULL, "DSP3 Voice Trigger" },
 929	{ "DSP3 Voice Trigger", "Switch", "DSP3" },
 930};
 931
 932static int cs47l24_set_fll(struct snd_soc_component *component, int fll_id,
 933			   int source, unsigned int Fref, unsigned int Fout)
 934{
 935	struct cs47l24_priv *cs47l24 = snd_soc_component_get_drvdata(component);
 936
 937	switch (fll_id) {
 938	case CS47L24_FLL1:
 939		return arizona_set_fll(&cs47l24->fll[0], source, Fref, Fout);
 940	case CS47L24_FLL2:
 941		return arizona_set_fll(&cs47l24->fll[1], source, Fref, Fout);
 942	case CS47L24_FLL1_REFCLK:
 943		return arizona_set_fll_refclk(&cs47l24->fll[0], source, Fref,
 944					      Fout);
 945	case CS47L24_FLL2_REFCLK:
 946		return arizona_set_fll_refclk(&cs47l24->fll[1], source, Fref,
 947					      Fout);
 948	default:
 949		return -EINVAL;
 950	}
 951}
 952
 953#define CS47L24_RATES SNDRV_PCM_RATE_KNOT
 954
 955#define CS47L24_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
 956			 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)
 957
 
 
 
 
 958static struct snd_soc_dai_driver cs47l24_dai[] = {
 959	{
 960		.name = "cs47l24-aif1",
 961		.id = 1,
 962		.base = ARIZONA_AIF1_BCLK_CTRL,
 963		.playback = {
 964			.stream_name = "AIF1 Playback",
 965			.channels_min = 1,
 966			.channels_max = 8,
 967			.rates = CS47L24_RATES,
 968			.formats = CS47L24_FORMATS,
 969		},
 970		.capture = {
 971			 .stream_name = "AIF1 Capture",
 972			 .channels_min = 1,
 973			 .channels_max = 8,
 974			 .rates = CS47L24_RATES,
 975			 .formats = CS47L24_FORMATS,
 976		 },
 977		.ops = &arizona_dai_ops,
 978		.symmetric_rates = 1,
 979		.symmetric_samplebits = 1,
 980	},
 981	{
 982		.name = "cs47l24-aif2",
 983		.id = 2,
 984		.base = ARIZONA_AIF2_BCLK_CTRL,
 985		.playback = {
 986			.stream_name = "AIF2 Playback",
 987			.channels_min = 1,
 988			.channels_max = 6,
 989			.rates = CS47L24_RATES,
 990			.formats = CS47L24_FORMATS,
 991		},
 992		.capture = {
 993			 .stream_name = "AIF2 Capture",
 994			 .channels_min = 1,
 995			 .channels_max = 6,
 996			 .rates = CS47L24_RATES,
 997			 .formats = CS47L24_FORMATS,
 998		 },
 999		.ops = &arizona_dai_ops,
1000		.symmetric_rates = 1,
1001		.symmetric_samplebits = 1,
1002	},
1003	{
1004		.name = "cs47l24-aif3",
1005		.id = 3,
1006		.base = ARIZONA_AIF3_BCLK_CTRL,
1007		.playback = {
1008			.stream_name = "AIF3 Playback",
1009			.channels_min = 1,
1010			.channels_max = 2,
1011			.rates = CS47L24_RATES,
1012			.formats = CS47L24_FORMATS,
1013		},
1014		.capture = {
1015			 .stream_name = "AIF3 Capture",
1016			 .channels_min = 1,
1017			 .channels_max = 2,
1018			 .rates = CS47L24_RATES,
1019			 .formats = CS47L24_FORMATS,
1020		 },
1021		.ops = &arizona_dai_ops,
1022		.symmetric_rates = 1,
1023		.symmetric_samplebits = 1,
1024	},
1025	{
1026		.name = "cs47l24-cpu-voicectrl",
1027		.capture = {
1028			.stream_name = "Voice Control CPU",
1029			.channels_min = 1,
1030			.channels_max = 1,
1031			.rates = CS47L24_RATES,
1032			.formats = CS47L24_FORMATS,
1033		},
1034		.compress_new = snd_soc_new_compress,
1035	},
1036	{
1037		.name = "cs47l24-dsp-voicectrl",
1038		.capture = {
1039			.stream_name = "Voice Control DSP",
1040			.channels_min = 1,
1041			.channels_max = 1,
1042			.rates = CS47L24_RATES,
1043			.formats = CS47L24_FORMATS,
1044		},
1045	},
1046	{
1047		.name = "cs47l24-cpu-trace",
1048		.capture = {
1049			.stream_name = "Audio Trace CPU",
1050			.channels_min = 1,
1051			.channels_max = 6,
1052			.rates = CS47L24_RATES,
1053			.formats = CS47L24_FORMATS,
1054		},
1055		.compress_new = snd_soc_new_compress,
1056	},
1057	{
1058		.name = "cs47l24-dsp-trace",
1059		.capture = {
1060			.stream_name = "Audio Trace DSP",
1061			.channels_min = 1,
1062			.channels_max = 6,
1063			.rates = CS47L24_RATES,
1064			.formats = CS47L24_FORMATS,
1065		},
1066	},
1067};
1068
1069static int cs47l24_open(struct snd_compr_stream *stream)
 
1070{
1071	struct snd_soc_pcm_runtime *rtd = stream->private_data;
1072	struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
1073	struct cs47l24_priv *priv = snd_soc_component_get_drvdata(component);
1074	struct arizona *arizona = priv->core.arizona;
1075	int n_adsp;
1076
1077	if (strcmp(rtd->codec_dai->name, "cs47l24-dsp-voicectrl") == 0) {
1078		n_adsp = 2;
1079	} else if (strcmp(rtd->codec_dai->name, "cs47l24-dsp-trace") == 0) {
1080		n_adsp = 1;
1081	} else {
1082		dev_err(arizona->dev,
1083			"No suitable compressed stream for DAI '%s'\n",
1084			rtd->codec_dai->name);
1085		return -EINVAL;
1086	}
1087
1088	return wm_adsp_compr_open(&priv->core.adsp[n_adsp], stream);
1089}
1090
1091static irqreturn_t cs47l24_adsp2_irq(int irq, void *data)
1092{
1093	struct cs47l24_priv *priv = data;
1094	struct arizona *arizona = priv->core.arizona;
1095	struct arizona_voice_trigger_info info;
1096	int serviced = 0;
1097	int i, ret;
1098
1099	for (i = 1; i <= 2; ++i) {
1100		ret = wm_adsp_compr_handle_irq(&priv->core.adsp[i]);
1101		if (ret != -ENODEV)
1102			serviced++;
1103		if (ret == WM_ADSP_COMPR_VOICE_TRIGGER) {
1104			info.core = i;
1105			arizona_call_notifiers(arizona,
1106					       ARIZONA_NOTIFY_VOICE_TRIGGER,
1107					       &info);
1108		}
1109	}
1110
1111	if (!serviced) {
1112		dev_err(arizona->dev, "Spurious compressed data IRQ\n");
1113		return IRQ_NONE;
1114	}
1115
1116	return IRQ_HANDLED;
1117}
1118
1119static int cs47l24_component_probe(struct snd_soc_component *component)
1120{
1121	struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
1122	struct cs47l24_priv *priv = snd_soc_component_get_drvdata(component);
1123	struct arizona *arizona = priv->core.arizona;
1124	int ret;
1125
1126	arizona->dapm = dapm;
1127	snd_soc_component_init_regmap(component, arizona->regmap);
1128
1129	ret = arizona_init_spk(component);
1130	if (ret < 0)
1131		return ret;
1132
1133	arizona_init_gpio(component);
1134	arizona_init_mono(component);
1135
1136	ret = wm_adsp2_component_probe(&priv->core.adsp[1], component);
1137	if (ret)
1138		goto err_adsp2_codec_probe;
1139
1140	ret = wm_adsp2_component_probe(&priv->core.adsp[2], component);
1141	if (ret)
1142		goto err_adsp2_codec_probe;
1143
1144	ret = snd_soc_add_component_controls(component,
1145					     &arizona_adsp2_rate_controls[1],
1146					     2);
1147	if (ret)
1148		goto err_adsp2_codec_probe;
1149
1150	snd_soc_component_disable_pin(component, "HAPTICS");
1151
1152	return 0;
1153
1154err_adsp2_codec_probe:
1155	wm_adsp2_component_remove(&priv->core.adsp[1], component);
1156	wm_adsp2_component_remove(&priv->core.adsp[2], component);
1157
1158	return ret;
1159}
1160
1161static void cs47l24_component_remove(struct snd_soc_component *component)
1162{
1163	struct cs47l24_priv *priv = snd_soc_component_get_drvdata(component);
1164
1165	wm_adsp2_component_remove(&priv->core.adsp[1], component);
1166	wm_adsp2_component_remove(&priv->core.adsp[2], component);
1167
1168	priv->core.arizona->dapm = NULL;
1169}
1170
1171#define CS47L24_DIG_VU 0x0200
1172
1173static unsigned int cs47l24_digital_vu[] = {
1174	ARIZONA_DAC_DIGITAL_VOLUME_1L,
1175	ARIZONA_DAC_DIGITAL_VOLUME_1R,
1176	ARIZONA_DAC_DIGITAL_VOLUME_4L,
1177};
1178
1179static struct snd_compr_ops cs47l24_compr_ops = {
1180	.open		= cs47l24_open,
1181	.free		= wm_adsp_compr_free,
1182	.set_params	= wm_adsp_compr_set_params,
1183	.get_caps	= wm_adsp_compr_get_caps,
1184	.trigger	= wm_adsp_compr_trigger,
1185	.pointer	= wm_adsp_compr_pointer,
1186	.copy		= wm_adsp_compr_copy,
1187};
1188
1189static const struct snd_soc_component_driver soc_component_dev_cs47l24 = {
1190	.probe			= cs47l24_component_probe,
1191	.remove			= cs47l24_component_remove,
1192	.set_sysclk		= arizona_set_sysclk,
1193	.set_pll		= cs47l24_set_fll,
1194	.name			= DRV_NAME,
1195	.compr_ops		= &cs47l24_compr_ops,
1196	.controls		= cs47l24_snd_controls,
1197	.num_controls		= ARRAY_SIZE(cs47l24_snd_controls),
1198	.dapm_widgets		= cs47l24_dapm_widgets,
1199	.num_dapm_widgets	= ARRAY_SIZE(cs47l24_dapm_widgets),
1200	.dapm_routes		= cs47l24_dapm_routes,
1201	.num_dapm_routes	= ARRAY_SIZE(cs47l24_dapm_routes),
1202	.use_pmdown_time	= 1,
1203	.endianness		= 1,
1204	.non_legacy_dai_naming	= 1,
1205};
1206
1207static int cs47l24_probe(struct platform_device *pdev)
1208{
1209	struct arizona *arizona = dev_get_drvdata(pdev->dev.parent);
1210	struct cs47l24_priv *cs47l24;
1211	int i, ret;
1212
1213	BUILD_BUG_ON(ARRAY_SIZE(cs47l24_dai) > ARIZONA_MAX_DAI);
1214
1215	cs47l24 = devm_kzalloc(&pdev->dev, sizeof(struct cs47l24_priv),
1216			       GFP_KERNEL);
1217	if (!cs47l24)
1218		return -ENOMEM;
1219
1220	if (IS_ENABLED(CONFIG_OF)) {
1221		if (!dev_get_platdata(arizona->dev)) {
1222			ret = arizona_of_get_audio_pdata(arizona);
1223			if (ret < 0)
1224				return ret;
1225		}
1226	}
1227
1228	platform_set_drvdata(pdev, cs47l24);
1229
1230	cs47l24->core.arizona = arizona;
1231	cs47l24->core.num_inputs = 4;
1232
1233	for (i = 1; i <= 2; i++) {
1234		cs47l24->core.adsp[i].part = "cs47l24";
1235		cs47l24->core.adsp[i].num = i + 1;
1236		cs47l24->core.adsp[i].type = WMFW_ADSP2;
1237		cs47l24->core.adsp[i].dev = arizona->dev;
1238		cs47l24->core.adsp[i].regmap = arizona->regmap;
1239
1240		cs47l24->core.adsp[i].base = ARIZONA_DSP1_CONTROL_1 +
1241					     (0x100 * i);
1242		cs47l24->core.adsp[i].mem = cs47l24_dsp_regions[i - 1];
1243		cs47l24->core.adsp[i].num_mems =
1244				ARRAY_SIZE(cs47l24_dsp2_regions);
1245
1246		ret = wm_adsp2_init(&cs47l24->core.adsp[i]);
1247		if (ret != 0)
1248			return ret;
1249	}
1250
1251	for (i = 0; i < ARRAY_SIZE(cs47l24->fll); i++)
1252		cs47l24->fll[i].vco_mult = 3;
1253
1254	arizona_init_fll(arizona, 1, ARIZONA_FLL1_CONTROL_1 - 1,
1255			 ARIZONA_IRQ_FLL1_LOCK, ARIZONA_IRQ_FLL1_CLOCK_OK,
1256			 &cs47l24->fll[0]);
1257	arizona_init_fll(arizona, 2, ARIZONA_FLL2_CONTROL_1 - 1,
1258			 ARIZONA_IRQ_FLL2_LOCK, ARIZONA_IRQ_FLL2_CLOCK_OK,
1259			 &cs47l24->fll[1]);
1260
1261	/* SR2 fixed at 8kHz, SR3 fixed at 16kHz */
1262	regmap_update_bits(arizona->regmap, ARIZONA_SAMPLE_RATE_2,
1263			   ARIZONA_SAMPLE_RATE_2_MASK, 0x11);
1264	regmap_update_bits(arizona->regmap, ARIZONA_SAMPLE_RATE_3,
1265			   ARIZONA_SAMPLE_RATE_3_MASK, 0x12);
1266
1267	for (i = 0; i < ARRAY_SIZE(cs47l24_dai); i++)
1268		arizona_init_dai(&cs47l24->core, i);
1269
1270	/* Latch volume update bits */
1271	for (i = 0; i < ARRAY_SIZE(cs47l24_digital_vu); i++)
1272		regmap_update_bits(arizona->regmap, cs47l24_digital_vu[i],
1273				   CS47L24_DIG_VU, CS47L24_DIG_VU);
1274
1275	pm_runtime_enable(&pdev->dev);
1276	pm_runtime_idle(&pdev->dev);
1277
1278	ret = arizona_request_irq(arizona, ARIZONA_IRQ_DSP_IRQ1,
1279				  "ADSP2 Compressed IRQ", cs47l24_adsp2_irq,
1280				  cs47l24);
1281	if (ret != 0) {
1282		dev_err(&pdev->dev, "Failed to request DSP IRQ: %d\n", ret);
1283		return ret;
1284	}
1285
 
 
 
 
 
 
1286	arizona_init_common(arizona);
1287
1288	ret = arizona_init_vol_limit(arizona);
1289	if (ret < 0)
1290		goto err_dsp_irq;
1291	ret = arizona_init_spk_irqs(arizona);
1292	if (ret < 0)
1293		goto err_dsp_irq;
1294
1295	ret = devm_snd_soc_register_component(&pdev->dev,
1296					      &soc_component_dev_cs47l24,
1297					      cs47l24_dai,
1298					      ARRAY_SIZE(cs47l24_dai));
1299	if (ret < 0) {
1300		dev_err(&pdev->dev, "Failed to register component: %d\n", ret);
1301		goto err_spk_irqs;
1302	}
1303
1304	return ret;
1305
1306err_spk_irqs:
1307	arizona_free_spk_irqs(arizona);
1308err_dsp_irq:
 
1309	arizona_free_irq(arizona, ARIZONA_IRQ_DSP_IRQ1, cs47l24);
1310
1311	return ret;
1312}
1313
1314static int cs47l24_remove(struct platform_device *pdev)
1315{
1316	struct cs47l24_priv *cs47l24 = platform_get_drvdata(pdev);
1317	struct arizona *arizona = cs47l24->core.arizona;
1318
1319	pm_runtime_disable(&pdev->dev);
1320
1321	wm_adsp2_remove(&cs47l24->core.adsp[1]);
1322	wm_adsp2_remove(&cs47l24->core.adsp[2]);
1323
1324	arizona_free_spk_irqs(arizona);
1325
 
1326	arizona_free_irq(arizona, ARIZONA_IRQ_DSP_IRQ1, cs47l24);
1327
1328	return 0;
1329}
1330
1331static struct platform_driver cs47l24_codec_driver = {
1332	.driver = {
1333		.name = "cs47l24-codec",
1334	},
1335	.probe = cs47l24_probe,
1336	.remove = cs47l24_remove,
1337};
1338
1339module_platform_driver(cs47l24_codec_driver);
1340
1341MODULE_DESCRIPTION("ASoC CS47L24 driver");
1342MODULE_AUTHOR("Richard Fitzgerald <rf@opensource.wolfsonmicro.com>");
1343MODULE_LICENSE("GPL v2");
1344MODULE_ALIAS("platform:cs47l24-codec");