linux/sound/soc/codecs/wm5110.c
<<
>>
Prefs
   1/*
   2 * wm5110.c  --  WM5110 ALSA SoC Audio driver
   3 *
   4 * Copyright 2012 Wolfson Microelectronics plc
   5 *
   6 * Author: Mark Brown <broonie@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 "wm5110.h"
  34
  35struct wm5110_priv {
  36        struct arizona_priv core;
  37        struct arizona_fll fll[2];
  38};
  39
  40static DECLARE_TLV_DB_SCALE(ana_tlv, 0, 100, 0);
  41static DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0);
  42static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0);
  43static DECLARE_TLV_DB_SCALE(noise_tlv, 0, 600, 0);
  44static DECLARE_TLV_DB_SCALE(ng_tlv, -10200, 600, 0);
  45
  46#define WM5110_NG_SRC(name, base) \
  47        SOC_SINGLE(name " NG HPOUT1L Switch",  base,  0, 1, 0), \
  48        SOC_SINGLE(name " NG HPOUT1R Switch",  base,  1, 1, 0), \
  49        SOC_SINGLE(name " NG HPOUT2L Switch",  base,  2, 1, 0), \
  50        SOC_SINGLE(name " NG HPOUT2R Switch",  base,  3, 1, 0), \
  51        SOC_SINGLE(name " NG HPOUT3L Switch",  base,  4, 1, 0), \
  52        SOC_SINGLE(name " NG HPOUT3R Switch",  base,  5, 1, 0), \
  53        SOC_SINGLE(name " NG SPKOUTL Switch",  base,  6, 1, 0), \
  54        SOC_SINGLE(name " NG SPKOUTR Switch",  base,  7, 1, 0), \
  55        SOC_SINGLE(name " NG SPKDAT1L Switch", base,  8, 1, 0), \
  56        SOC_SINGLE(name " NG SPKDAT1R Switch", base,  9, 1, 0), \
  57        SOC_SINGLE(name " NG SPKDAT2L Switch", base, 10, 1, 0), \
  58        SOC_SINGLE(name " NG SPKDAT2R Switch", base, 11, 1, 0)
  59
  60static const struct snd_kcontrol_new wm5110_snd_controls[] = {
  61SOC_SINGLE("IN1 High Performance Switch", ARIZONA_IN1L_CONTROL,
  62           ARIZONA_IN1_OSR_SHIFT, 1, 0),
  63SOC_SINGLE("IN2 High Performance Switch", ARIZONA_IN2L_CONTROL,
  64           ARIZONA_IN2_OSR_SHIFT, 1, 0),
  65SOC_SINGLE("IN3 High Performance Switch", ARIZONA_IN3L_CONTROL,
  66           ARIZONA_IN3_OSR_SHIFT, 1, 0),
  67SOC_SINGLE("IN4 High Performance Switch", ARIZONA_IN4L_CONTROL,
  68           ARIZONA_IN4_OSR_SHIFT, 1, 0),
  69
  70SOC_SINGLE_RANGE_TLV("IN1L Volume", ARIZONA_IN1L_CONTROL,
  71                     ARIZONA_IN1L_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv),
  72SOC_SINGLE_RANGE_TLV("IN1R Volume", ARIZONA_IN1R_CONTROL,
  73                     ARIZONA_IN1R_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv),
  74SOC_SINGLE_RANGE_TLV("IN2L Volume", ARIZONA_IN2L_CONTROL,
  75                     ARIZONA_IN2L_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv),
  76SOC_SINGLE_RANGE_TLV("IN2R Volume", ARIZONA_IN2R_CONTROL,
  77                     ARIZONA_IN2R_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv),
  78SOC_SINGLE_RANGE_TLV("IN3L Volume", ARIZONA_IN3L_CONTROL,
  79                     ARIZONA_IN3L_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv),
  80SOC_SINGLE_RANGE_TLV("IN3R Volume", ARIZONA_IN3R_CONTROL,
  81                     ARIZONA_IN3R_PGA_VOL_SHIFT, 0x40, 0x5f, 0, ana_tlv),
  82
  83SOC_SINGLE_TLV("IN1L Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_1L,
  84               ARIZONA_IN1L_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
  85SOC_SINGLE_TLV("IN1R Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_1R,
  86               ARIZONA_IN1R_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
  87SOC_SINGLE_TLV("IN2L Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_2L,
  88               ARIZONA_IN2L_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
  89SOC_SINGLE_TLV("IN2R Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_2R,
  90               ARIZONA_IN2R_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
  91SOC_SINGLE_TLV("IN3L Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_3L,
  92               ARIZONA_IN3L_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
  93SOC_SINGLE_TLV("IN3R Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_3R,
  94               ARIZONA_IN3R_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
  95SOC_SINGLE_TLV("IN4L Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_4L,
  96               ARIZONA_IN4L_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
  97SOC_SINGLE_TLV("IN4R Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_4R,
  98               ARIZONA_IN4R_DIG_VOL_SHIFT, 0xbf, 0, digital_tlv),
  99
 100SOC_ENUM("Input Ramp Up", arizona_in_vi_ramp),
 101SOC_ENUM("Input Ramp Down", arizona_in_vd_ramp),
 102
 103ARIZONA_MIXER_CONTROLS("EQ1", ARIZONA_EQ1MIX_INPUT_1_SOURCE),
 104ARIZONA_MIXER_CONTROLS("EQ2", ARIZONA_EQ2MIX_INPUT_1_SOURCE),
 105ARIZONA_MIXER_CONTROLS("EQ3", ARIZONA_EQ3MIX_INPUT_1_SOURCE),
 106ARIZONA_MIXER_CONTROLS("EQ4", ARIZONA_EQ4MIX_INPUT_1_SOURCE),
 107
 108SND_SOC_BYTES_MASK("EQ1 Coefficeints", ARIZONA_EQ1_1, 21,
 109                   ARIZONA_EQ1_ENA_MASK),
 110SND_SOC_BYTES_MASK("EQ2 Coefficeints", ARIZONA_EQ2_1, 21,
 111                   ARIZONA_EQ2_ENA_MASK),
 112SND_SOC_BYTES_MASK("EQ3 Coefficeints", ARIZONA_EQ3_1, 21,
 113                   ARIZONA_EQ3_ENA_MASK),
 114SND_SOC_BYTES_MASK("EQ4 Coefficeints", ARIZONA_EQ4_1, 21,
 115                   ARIZONA_EQ4_ENA_MASK),
 116
 117SOC_SINGLE_TLV("EQ1 B1 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B1_GAIN_SHIFT,
 118               24, 0, eq_tlv),
 119SOC_SINGLE_TLV("EQ1 B2 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B2_GAIN_SHIFT,
 120               24, 0, eq_tlv),
 121SOC_SINGLE_TLV("EQ1 B3 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B3_GAIN_SHIFT,
 122               24, 0, eq_tlv),
 123SOC_SINGLE_TLV("EQ1 B4 Volume", ARIZONA_EQ1_2, ARIZONA_EQ1_B4_GAIN_SHIFT,
 124               24, 0, eq_tlv),
 125SOC_SINGLE_TLV("EQ1 B5 Volume", ARIZONA_EQ1_2, ARIZONA_EQ1_B5_GAIN_SHIFT,
 126               24, 0, eq_tlv),
 127
 128SOC_SINGLE_TLV("EQ2 B1 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B1_GAIN_SHIFT,
 129               24, 0, eq_tlv),
 130SOC_SINGLE_TLV("EQ2 B2 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B2_GAIN_SHIFT,
 131               24, 0, eq_tlv),
 132SOC_SINGLE_TLV("EQ2 B3 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B3_GAIN_SHIFT,
 133               24, 0, eq_tlv),
 134SOC_SINGLE_TLV("EQ2 B4 Volume", ARIZONA_EQ2_2, ARIZONA_EQ2_B4_GAIN_SHIFT,
 135               24, 0, eq_tlv),
 136SOC_SINGLE_TLV("EQ2 B5 Volume", ARIZONA_EQ2_2, ARIZONA_EQ2_B5_GAIN_SHIFT,
 137               24, 0, eq_tlv),
 138
 139SOC_SINGLE_TLV("EQ3 B1 Volume", ARIZONA_EQ3_1, ARIZONA_EQ3_B1_GAIN_SHIFT,
 140               24, 0, eq_tlv),
 141SOC_SINGLE_TLV("EQ3 B2 Volume", ARIZONA_EQ3_1, ARIZONA_EQ3_B2_GAIN_SHIFT,
 142               24, 0, eq_tlv),
 143SOC_SINGLE_TLV("EQ3 B3 Volume", ARIZONA_EQ3_1, ARIZONA_EQ3_B3_GAIN_SHIFT,
 144               24, 0, eq_tlv),
 145SOC_SINGLE_TLV("EQ3 B4 Volume", ARIZONA_EQ3_2, ARIZONA_EQ3_B4_GAIN_SHIFT,
 146               24, 0, eq_tlv),
 147SOC_SINGLE_TLV("EQ3 B5 Volume", ARIZONA_EQ3_2, ARIZONA_EQ3_B5_GAIN_SHIFT,
 148               24, 0, eq_tlv),
 149
 150SOC_SINGLE_TLV("EQ4 B1 Volume", ARIZONA_EQ4_1, ARIZONA_EQ4_B1_GAIN_SHIFT,
 151               24, 0, eq_tlv),
 152SOC_SINGLE_TLV("EQ4 B2 Volume", ARIZONA_EQ4_1, ARIZONA_EQ4_B2_GAIN_SHIFT,
 153               24, 0, eq_tlv),
 154SOC_SINGLE_TLV("EQ4 B3 Volume", ARIZONA_EQ4_1, ARIZONA_EQ4_B3_GAIN_SHIFT,
 155               24, 0, eq_tlv),
 156SOC_SINGLE_TLV("EQ4 B4 Volume", ARIZONA_EQ4_2, ARIZONA_EQ4_B4_GAIN_SHIFT,
 157               24, 0, eq_tlv),
 158SOC_SINGLE_TLV("EQ4 B5 Volume", ARIZONA_EQ4_2, ARIZONA_EQ4_B5_GAIN_SHIFT,
 159               24, 0, eq_tlv),
 160
 161ARIZONA_MIXER_CONTROLS("DRC1L", ARIZONA_DRC1LMIX_INPUT_1_SOURCE),
 162ARIZONA_MIXER_CONTROLS("DRC1R", ARIZONA_DRC1RMIX_INPUT_1_SOURCE),
 163ARIZONA_MIXER_CONTROLS("DRC2L", ARIZONA_DRC2LMIX_INPUT_1_SOURCE),
 164ARIZONA_MIXER_CONTROLS("DRC2R", ARIZONA_DRC2RMIX_INPUT_1_SOURCE),
 165
 166SND_SOC_BYTES_MASK("DRC1", ARIZONA_DRC1_CTRL1, 5,
 167                   ARIZONA_DRC1R_ENA | ARIZONA_DRC1L_ENA),
 168SND_SOC_BYTES_MASK("DRC2", ARIZONA_DRC2_CTRL1, 5,
 169                   ARIZONA_DRC2R_ENA | ARIZONA_DRC2L_ENA),
 170
 171ARIZONA_MIXER_CONTROLS("LHPF1", ARIZONA_HPLP1MIX_INPUT_1_SOURCE),
 172ARIZONA_MIXER_CONTROLS("LHPF2", ARIZONA_HPLP2MIX_INPUT_1_SOURCE),
 173ARIZONA_MIXER_CONTROLS("LHPF3", ARIZONA_HPLP3MIX_INPUT_1_SOURCE),
 174ARIZONA_MIXER_CONTROLS("LHPF4", ARIZONA_HPLP4MIX_INPUT_1_SOURCE),
 175
 176SND_SOC_BYTES("LHPF1 Coefficients", ARIZONA_HPLPF1_2, 1),
 177SND_SOC_BYTES("LHPF2 Coefficients", ARIZONA_HPLPF2_2, 1),
 178SND_SOC_BYTES("LHPF3 Coefficients", ARIZONA_HPLPF3_2, 1),
 179SND_SOC_BYTES("LHPF4 Coefficients", ARIZONA_HPLPF4_2, 1),
 180
 181SOC_ENUM("LHPF1 Mode", arizona_lhpf1_mode),
 182SOC_ENUM("LHPF2 Mode", arizona_lhpf2_mode),
 183SOC_ENUM("LHPF3 Mode", arizona_lhpf3_mode),
 184SOC_ENUM("LHPF4 Mode", arizona_lhpf4_mode),
 185
 186ARIZONA_MIXER_CONTROLS("DSP1L", ARIZONA_DSP1LMIX_INPUT_1_SOURCE),
 187ARIZONA_MIXER_CONTROLS("DSP1R", ARIZONA_DSP1RMIX_INPUT_1_SOURCE),
 188ARIZONA_MIXER_CONTROLS("DSP2L", ARIZONA_DSP2LMIX_INPUT_1_SOURCE),
 189ARIZONA_MIXER_CONTROLS("DSP2R", ARIZONA_DSP2RMIX_INPUT_1_SOURCE),
 190ARIZONA_MIXER_CONTROLS("DSP3L", ARIZONA_DSP3LMIX_INPUT_1_SOURCE),
 191ARIZONA_MIXER_CONTROLS("DSP3R", ARIZONA_DSP3RMIX_INPUT_1_SOURCE),
 192ARIZONA_MIXER_CONTROLS("DSP4L", ARIZONA_DSP4LMIX_INPUT_1_SOURCE),
 193ARIZONA_MIXER_CONTROLS("DSP4R", ARIZONA_DSP4RMIX_INPUT_1_SOURCE),
 194
 195ARIZONA_MIXER_CONTROLS("Mic", ARIZONA_MICMIX_INPUT_1_SOURCE),
 196ARIZONA_MIXER_CONTROLS("Noise", ARIZONA_NOISEMIX_INPUT_1_SOURCE),
 197
 198SOC_SINGLE_TLV("Noise Generator Volume", ARIZONA_COMFORT_NOISE_GENERATOR,
 199               ARIZONA_NOISE_GEN_GAIN_SHIFT, 0x16, 0, noise_tlv),
 200
 201ARIZONA_MIXER_CONTROLS("HPOUT1L", ARIZONA_OUT1LMIX_INPUT_1_SOURCE),
 202ARIZONA_MIXER_CONTROLS("HPOUT1R", ARIZONA_OUT1RMIX_INPUT_1_SOURCE),
 203ARIZONA_MIXER_CONTROLS("HPOUT2L", ARIZONA_OUT2LMIX_INPUT_1_SOURCE),
 204ARIZONA_MIXER_CONTROLS("HPOUT2R", ARIZONA_OUT2RMIX_INPUT_1_SOURCE),
 205ARIZONA_MIXER_CONTROLS("HPOUT3L", ARIZONA_OUT3LMIX_INPUT_1_SOURCE),
 206ARIZONA_MIXER_CONTROLS("HPOUT3R", ARIZONA_OUT3RMIX_INPUT_1_SOURCE),
 207ARIZONA_MIXER_CONTROLS("SPKOUTL", ARIZONA_OUT4LMIX_INPUT_1_SOURCE),
 208ARIZONA_MIXER_CONTROLS("SPKOUTR", ARIZONA_OUT4RMIX_INPUT_1_SOURCE),
 209ARIZONA_MIXER_CONTROLS("SPKDAT1L", ARIZONA_OUT5LMIX_INPUT_1_SOURCE),
 210ARIZONA_MIXER_CONTROLS("SPKDAT1R", ARIZONA_OUT5RMIX_INPUT_1_SOURCE),
 211ARIZONA_MIXER_CONTROLS("SPKDAT2L", ARIZONA_OUT6LMIX_INPUT_1_SOURCE),
 212ARIZONA_MIXER_CONTROLS("SPKDAT2R", ARIZONA_OUT6RMIX_INPUT_1_SOURCE),
 213
 214SOC_SINGLE("HPOUT1 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_1L,
 215           ARIZONA_OUT1_OSR_SHIFT, 1, 0),
 216SOC_SINGLE("HPOUT2 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_2L,
 217           ARIZONA_OUT2_OSR_SHIFT, 1, 0),
 218SOC_SINGLE("HPOUT3 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_3L,
 219           ARIZONA_OUT3_OSR_SHIFT, 1, 0),
 220SOC_SINGLE("Speaker High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_4L,
 221           ARIZONA_OUT4_OSR_SHIFT, 1, 0),
 222SOC_SINGLE("SPKDAT1 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_5L,
 223           ARIZONA_OUT5_OSR_SHIFT, 1, 0),
 224SOC_SINGLE("SPKDAT2 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_6L,
 225           ARIZONA_OUT6_OSR_SHIFT, 1, 0),
 226
 227SOC_DOUBLE_R("HPOUT1 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_1L,
 228             ARIZONA_DAC_DIGITAL_VOLUME_1R, ARIZONA_OUT1L_MUTE_SHIFT, 1, 1),
 229SOC_DOUBLE_R("HPOUT2 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_2L,
 230             ARIZONA_DAC_DIGITAL_VOLUME_2R, ARIZONA_OUT2L_MUTE_SHIFT, 1, 1),
 231SOC_DOUBLE_R("HPOUT3 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_3L,
 232             ARIZONA_DAC_DIGITAL_VOLUME_3R, ARIZONA_OUT3L_MUTE_SHIFT, 1, 1),
 233SOC_DOUBLE_R("Speaker Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_4L,
 234             ARIZONA_DAC_DIGITAL_VOLUME_4R, ARIZONA_OUT4L_MUTE_SHIFT, 1, 1),
 235SOC_DOUBLE_R("SPKDAT1 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_5L,
 236             ARIZONA_DAC_DIGITAL_VOLUME_5R, ARIZONA_OUT5L_MUTE_SHIFT, 1, 1),
 237SOC_DOUBLE_R("SPKDAT2 Digital Switch", ARIZONA_DAC_DIGITAL_VOLUME_6L,
 238             ARIZONA_DAC_DIGITAL_VOLUME_6R, ARIZONA_OUT6L_MUTE_SHIFT, 1, 1),
 239
 240SOC_DOUBLE_R_TLV("HPOUT1 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_1L,
 241                 ARIZONA_DAC_DIGITAL_VOLUME_1R, ARIZONA_OUT1L_VOL_SHIFT,
 242                 0xbf, 0, digital_tlv),
 243SOC_DOUBLE_R_TLV("HPOUT2 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_2L,
 244                 ARIZONA_DAC_DIGITAL_VOLUME_2R, ARIZONA_OUT2L_VOL_SHIFT,
 245                 0xbf, 0, digital_tlv),
 246SOC_DOUBLE_R_TLV("HPOUT3 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_3L,
 247                 ARIZONA_DAC_DIGITAL_VOLUME_3R, ARIZONA_OUT3L_VOL_SHIFT,
 248                 0xbf, 0, digital_tlv),
 249SOC_DOUBLE_R_TLV("Speaker Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_4L,
 250                 ARIZONA_DAC_DIGITAL_VOLUME_4R, ARIZONA_OUT4L_VOL_SHIFT,
 251                 0xbf, 0, digital_tlv),
 252SOC_DOUBLE_R_TLV("SPKDAT1 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_5L,
 253                 ARIZONA_DAC_DIGITAL_VOLUME_5R, ARIZONA_OUT5L_VOL_SHIFT,
 254                 0xbf, 0, digital_tlv),
 255SOC_DOUBLE_R_TLV("SPKDAT2 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_6L,
 256                 ARIZONA_DAC_DIGITAL_VOLUME_6R, ARIZONA_OUT6L_VOL_SHIFT,
 257                 0xbf, 0, digital_tlv),
 258
 259SOC_DOUBLE_R_RANGE_TLV("HPOUT1 Volume", ARIZONA_OUTPUT_PATH_CONFIG_1L,
 260                       ARIZONA_OUTPUT_PATH_CONFIG_1R,
 261                       ARIZONA_OUT1L_PGA_VOL_SHIFT,
 262                       0x34, 0x40, 0, ana_tlv),
 263SOC_DOUBLE_R_RANGE_TLV("HPOUT2 Volume", ARIZONA_OUTPUT_PATH_CONFIG_2L,
 264                       ARIZONA_OUTPUT_PATH_CONFIG_2R,
 265                       ARIZONA_OUT2L_PGA_VOL_SHIFT,
 266                       0x34, 0x40, 0, ana_tlv),
 267SOC_DOUBLE_R_RANGE_TLV("HPOUT3 Volume", ARIZONA_OUTPUT_PATH_CONFIG_3L,
 268                       ARIZONA_OUTPUT_PATH_CONFIG_3R,
 269                       ARIZONA_OUT3L_PGA_VOL_SHIFT, 0x34, 0x40, 0, ana_tlv),
 270
 271SOC_DOUBLE("SPKDAT1 Switch", ARIZONA_PDM_SPK1_CTRL_1, ARIZONA_SPK1L_MUTE_SHIFT,
 272           ARIZONA_SPK1R_MUTE_SHIFT, 1, 1),
 273SOC_DOUBLE("SPKDAT2 Switch", ARIZONA_PDM_SPK2_CTRL_1, ARIZONA_SPK2L_MUTE_SHIFT,
 274           ARIZONA_SPK2R_MUTE_SHIFT, 1, 1),
 275
 276SOC_ENUM("Output Ramp Up", arizona_out_vi_ramp),
 277SOC_ENUM("Output Ramp Down", arizona_out_vd_ramp),
 278
 279SOC_SINGLE("Noise Gate Switch", ARIZONA_NOISE_GATE_CONTROL,
 280           ARIZONA_NGATE_ENA_SHIFT, 1, 0),
 281SOC_SINGLE_TLV("Noise Gate Threshold Volume", ARIZONA_NOISE_GATE_CONTROL,
 282               ARIZONA_NGATE_THR_SHIFT, 7, 1, ng_tlv),
 283SOC_ENUM("Noise Gate Hold", arizona_ng_hold),
 284
 285WM5110_NG_SRC("HPOUT1L", ARIZONA_NOISE_GATE_SELECT_1L),
 286WM5110_NG_SRC("HPOUT1R", ARIZONA_NOISE_GATE_SELECT_1R),
 287WM5110_NG_SRC("HPOUT2L", ARIZONA_NOISE_GATE_SELECT_2L),
 288WM5110_NG_SRC("HPOUT2R", ARIZONA_NOISE_GATE_SELECT_2R),
 289WM5110_NG_SRC("HPOUT3L", ARIZONA_NOISE_GATE_SELECT_3L),
 290WM5110_NG_SRC("HPOUT3R", ARIZONA_NOISE_GATE_SELECT_3R),
 291WM5110_NG_SRC("SPKOUTL", ARIZONA_NOISE_GATE_SELECT_4L),
 292WM5110_NG_SRC("SPKOUTR", ARIZONA_NOISE_GATE_SELECT_4R),
 293WM5110_NG_SRC("SPKDAT1L", ARIZONA_NOISE_GATE_SELECT_5L),
 294WM5110_NG_SRC("SPKDAT1R", ARIZONA_NOISE_GATE_SELECT_5R),
 295WM5110_NG_SRC("SPKDAT2L", ARIZONA_NOISE_GATE_SELECT_6L),
 296WM5110_NG_SRC("SPKDAT2R", ARIZONA_NOISE_GATE_SELECT_6R),
 297
 298ARIZONA_MIXER_CONTROLS("AIF1TX1", ARIZONA_AIF1TX1MIX_INPUT_1_SOURCE),
 299ARIZONA_MIXER_CONTROLS("AIF1TX2", ARIZONA_AIF1TX2MIX_INPUT_1_SOURCE),
 300ARIZONA_MIXER_CONTROLS("AIF1TX3", ARIZONA_AIF1TX3MIX_INPUT_1_SOURCE),
 301ARIZONA_MIXER_CONTROLS("AIF1TX4", ARIZONA_AIF1TX4MIX_INPUT_1_SOURCE),
 302ARIZONA_MIXER_CONTROLS("AIF1TX5", ARIZONA_AIF1TX5MIX_INPUT_1_SOURCE),
 303ARIZONA_MIXER_CONTROLS("AIF1TX6", ARIZONA_AIF1TX6MIX_INPUT_1_SOURCE),
 304ARIZONA_MIXER_CONTROLS("AIF1TX7", ARIZONA_AIF1TX7MIX_INPUT_1_SOURCE),
 305ARIZONA_MIXER_CONTROLS("AIF1TX8", ARIZONA_AIF1TX8MIX_INPUT_1_SOURCE),
 306
 307ARIZONA_MIXER_CONTROLS("AIF2TX1", ARIZONA_AIF2TX1MIX_INPUT_1_SOURCE),
 308ARIZONA_MIXER_CONTROLS("AIF2TX2", ARIZONA_AIF2TX2MIX_INPUT_1_SOURCE),
 309
 310ARIZONA_MIXER_CONTROLS("AIF3TX1", ARIZONA_AIF3TX1MIX_INPUT_1_SOURCE),
 311ARIZONA_MIXER_CONTROLS("AIF3TX2", ARIZONA_AIF3TX2MIX_INPUT_1_SOURCE),
 312
 313ARIZONA_MIXER_CONTROLS("SLIMTX1", ARIZONA_SLIMTX1MIX_INPUT_1_SOURCE),
 314ARIZONA_MIXER_CONTROLS("SLIMTX2", ARIZONA_SLIMTX2MIX_INPUT_1_SOURCE),
 315ARIZONA_MIXER_CONTROLS("SLIMTX3", ARIZONA_SLIMTX3MIX_INPUT_1_SOURCE),
 316ARIZONA_MIXER_CONTROLS("SLIMTX4", ARIZONA_SLIMTX4MIX_INPUT_1_SOURCE),
 317ARIZONA_MIXER_CONTROLS("SLIMTX5", ARIZONA_SLIMTX5MIX_INPUT_1_SOURCE),
 318ARIZONA_MIXER_CONTROLS("SLIMTX6", ARIZONA_SLIMTX6MIX_INPUT_1_SOURCE),
 319ARIZONA_MIXER_CONTROLS("SLIMTX7", ARIZONA_SLIMTX7MIX_INPUT_1_SOURCE),
 320ARIZONA_MIXER_CONTROLS("SLIMTX8", ARIZONA_SLIMTX8MIX_INPUT_1_SOURCE),
 321};
 322
 323ARIZONA_MIXER_ENUMS(EQ1, ARIZONA_EQ1MIX_INPUT_1_SOURCE);
 324ARIZONA_MIXER_ENUMS(EQ2, ARIZONA_EQ2MIX_INPUT_1_SOURCE);
 325ARIZONA_MIXER_ENUMS(EQ3, ARIZONA_EQ3MIX_INPUT_1_SOURCE);
 326ARIZONA_MIXER_ENUMS(EQ4, ARIZONA_EQ4MIX_INPUT_1_SOURCE);
 327
 328ARIZONA_MIXER_ENUMS(DRC1L, ARIZONA_DRC1LMIX_INPUT_1_SOURCE);
 329ARIZONA_MIXER_ENUMS(DRC1R, ARIZONA_DRC1RMIX_INPUT_1_SOURCE);
 330ARIZONA_MIXER_ENUMS(DRC2L, ARIZONA_DRC2LMIX_INPUT_1_SOURCE);
 331ARIZONA_MIXER_ENUMS(DRC2R, ARIZONA_DRC2RMIX_INPUT_1_SOURCE);
 332
 333ARIZONA_MIXER_ENUMS(LHPF1, ARIZONA_HPLP1MIX_INPUT_1_SOURCE);
 334ARIZONA_MIXER_ENUMS(LHPF2, ARIZONA_HPLP2MIX_INPUT_1_SOURCE);
 335ARIZONA_MIXER_ENUMS(LHPF3, ARIZONA_HPLP3MIX_INPUT_1_SOURCE);
 336ARIZONA_MIXER_ENUMS(LHPF4, ARIZONA_HPLP4MIX_INPUT_1_SOURCE);
 337
 338ARIZONA_MIXER_ENUMS(Mic, ARIZONA_MICMIX_INPUT_1_SOURCE);
 339ARIZONA_MIXER_ENUMS(Noise, ARIZONA_NOISEMIX_INPUT_1_SOURCE);
 340
 341ARIZONA_MIXER_ENUMS(PWM1, ARIZONA_PWM1MIX_INPUT_1_SOURCE);
 342ARIZONA_MIXER_ENUMS(PWM2, ARIZONA_PWM2MIX_INPUT_1_SOURCE);
 343
 344ARIZONA_MIXER_ENUMS(OUT1L, ARIZONA_OUT1LMIX_INPUT_1_SOURCE);
 345ARIZONA_MIXER_ENUMS(OUT1R, ARIZONA_OUT1RMIX_INPUT_1_SOURCE);
 346ARIZONA_MIXER_ENUMS(OUT2L, ARIZONA_OUT2LMIX_INPUT_1_SOURCE);
 347ARIZONA_MIXER_ENUMS(OUT2R, ARIZONA_OUT2RMIX_INPUT_1_SOURCE);
 348ARIZONA_MIXER_ENUMS(OUT3L, ARIZONA_OUT3LMIX_INPUT_1_SOURCE);
 349ARIZONA_MIXER_ENUMS(OUT3R, ARIZONA_OUT3RMIX_INPUT_1_SOURCE);
 350ARIZONA_MIXER_ENUMS(SPKOUTL, ARIZONA_OUT4LMIX_INPUT_1_SOURCE);
 351ARIZONA_MIXER_ENUMS(SPKOUTR, ARIZONA_OUT4RMIX_INPUT_1_SOURCE);
 352ARIZONA_MIXER_ENUMS(SPKDAT1L, ARIZONA_OUT5LMIX_INPUT_1_SOURCE);
 353ARIZONA_MIXER_ENUMS(SPKDAT1R, ARIZONA_OUT5RMIX_INPUT_1_SOURCE);
 354ARIZONA_MIXER_ENUMS(SPKDAT2L, ARIZONA_OUT6LMIX_INPUT_1_SOURCE);
 355ARIZONA_MIXER_ENUMS(SPKDAT2R, ARIZONA_OUT6RMIX_INPUT_1_SOURCE);
 356
 357ARIZONA_MIXER_ENUMS(AIF1TX1, ARIZONA_AIF1TX1MIX_INPUT_1_SOURCE);
 358ARIZONA_MIXER_ENUMS(AIF1TX2, ARIZONA_AIF1TX2MIX_INPUT_1_SOURCE);
 359ARIZONA_MIXER_ENUMS(AIF1TX3, ARIZONA_AIF1TX3MIX_INPUT_1_SOURCE);
 360ARIZONA_MIXER_ENUMS(AIF1TX4, ARIZONA_AIF1TX4MIX_INPUT_1_SOURCE);
 361ARIZONA_MIXER_ENUMS(AIF1TX5, ARIZONA_AIF1TX5MIX_INPUT_1_SOURCE);
 362ARIZONA_MIXER_ENUMS(AIF1TX6, ARIZONA_AIF1TX6MIX_INPUT_1_SOURCE);
 363ARIZONA_MIXER_ENUMS(AIF1TX7, ARIZONA_AIF1TX7MIX_INPUT_1_SOURCE);
 364ARIZONA_MIXER_ENUMS(AIF1TX8, ARIZONA_AIF1TX8MIX_INPUT_1_SOURCE);
 365
 366ARIZONA_MIXER_ENUMS(AIF2TX1, ARIZONA_AIF2TX1MIX_INPUT_1_SOURCE);
 367ARIZONA_MIXER_ENUMS(AIF2TX2, ARIZONA_AIF2TX2MIX_INPUT_1_SOURCE);
 368
 369ARIZONA_MIXER_ENUMS(AIF3TX1, ARIZONA_AIF3TX1MIX_INPUT_1_SOURCE);
 370ARIZONA_MIXER_ENUMS(AIF3TX2, ARIZONA_AIF3TX2MIX_INPUT_1_SOURCE);
 371
 372ARIZONA_MIXER_ENUMS(SLIMTX1, ARIZONA_SLIMTX1MIX_INPUT_1_SOURCE);
 373ARIZONA_MIXER_ENUMS(SLIMTX2, ARIZONA_SLIMTX2MIX_INPUT_1_SOURCE);
 374ARIZONA_MIXER_ENUMS(SLIMTX3, ARIZONA_SLIMTX3MIX_INPUT_1_SOURCE);
 375ARIZONA_MIXER_ENUMS(SLIMTX4, ARIZONA_SLIMTX4MIX_INPUT_1_SOURCE);
 376ARIZONA_MIXER_ENUMS(SLIMTX5, ARIZONA_SLIMTX5MIX_INPUT_1_SOURCE);
 377ARIZONA_MIXER_ENUMS(SLIMTX6, ARIZONA_SLIMTX6MIX_INPUT_1_SOURCE);
 378ARIZONA_MIXER_ENUMS(SLIMTX7, ARIZONA_SLIMTX7MIX_INPUT_1_SOURCE);
 379ARIZONA_MIXER_ENUMS(SLIMTX8, ARIZONA_SLIMTX8MIX_INPUT_1_SOURCE);
 380
 381ARIZONA_MUX_ENUMS(ASRC1L, ARIZONA_ASRC1LMIX_INPUT_1_SOURCE);
 382ARIZONA_MUX_ENUMS(ASRC1R, ARIZONA_ASRC1RMIX_INPUT_1_SOURCE);
 383ARIZONA_MUX_ENUMS(ASRC2L, ARIZONA_ASRC2LMIX_INPUT_1_SOURCE);
 384ARIZONA_MUX_ENUMS(ASRC2R, ARIZONA_ASRC2RMIX_INPUT_1_SOURCE);
 385
 386static const char *wm5110_aec_loopback_texts[] = {
 387        "HPOUT1L", "HPOUT1R", "HPOUT2L", "HPOUT2R", "HPOUT3L", "HPOUT3R",
 388        "SPKOUTL", "SPKOUTR", "SPKDAT1L", "SPKDAT1R", "SPKDAT2L", "SPKDAT2R",
 389};
 390
 391static const unsigned int wm5110_aec_loopback_values[] = {
 392        0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
 393};
 394
 395static const struct soc_enum wm5110_aec_loopback =
 396        SOC_VALUE_ENUM_SINGLE(ARIZONA_DAC_AEC_CONTROL_1,
 397                              ARIZONA_AEC_LOOPBACK_SRC_SHIFT, 0xf,
 398                              ARRAY_SIZE(wm5110_aec_loopback_texts),
 399                              wm5110_aec_loopback_texts,
 400                              wm5110_aec_loopback_values);
 401
 402static const struct snd_kcontrol_new wm5110_aec_loopback_mux =
 403        SOC_DAPM_VALUE_ENUM("AEC Loopback", wm5110_aec_loopback);
 404
 405static const struct snd_soc_dapm_widget wm5110_dapm_widgets[] = {
 406SND_SOC_DAPM_SUPPLY("SYSCLK", ARIZONA_SYSTEM_CLOCK_1, ARIZONA_SYSCLK_ENA_SHIFT,
 407                    0, NULL, 0),
 408SND_SOC_DAPM_SUPPLY("ASYNCCLK", ARIZONA_ASYNC_CLOCK_1,
 409                    ARIZONA_ASYNC_CLK_ENA_SHIFT, 0, NULL, 0),
 410SND_SOC_DAPM_SUPPLY("OPCLK", ARIZONA_OUTPUT_SYSTEM_CLOCK,
 411                    ARIZONA_OPCLK_ENA_SHIFT, 0, NULL, 0),
 412SND_SOC_DAPM_SUPPLY("ASYNCOPCLK", ARIZONA_OUTPUT_ASYNC_CLOCK,
 413                    ARIZONA_OPCLK_ASYNC_ENA_SHIFT, 0, NULL, 0),
 414
 415SND_SOC_DAPM_REGULATOR_SUPPLY("DBVDD2", 0, 0),
 416SND_SOC_DAPM_REGULATOR_SUPPLY("DBVDD3", 0, 0),
 417SND_SOC_DAPM_REGULATOR_SUPPLY("CPVDD", 20, 0),
 418SND_SOC_DAPM_REGULATOR_SUPPLY("MICVDD", 0, SND_SOC_DAPM_REGULATOR_BYPASS),
 419SND_SOC_DAPM_REGULATOR_SUPPLY("SPKVDDL", 0, 0),
 420SND_SOC_DAPM_REGULATOR_SUPPLY("SPKVDDR", 0, 0),
 421
 422SND_SOC_DAPM_SIGGEN("TONE"),
 423SND_SOC_DAPM_SIGGEN("NOISE"),
 424SND_SOC_DAPM_SIGGEN("HAPTICS"),
 425
 426SND_SOC_DAPM_INPUT("IN1L"),
 427SND_SOC_DAPM_INPUT("IN1R"),
 428SND_SOC_DAPM_INPUT("IN2L"),
 429SND_SOC_DAPM_INPUT("IN2R"),
 430SND_SOC_DAPM_INPUT("IN3L"),
 431SND_SOC_DAPM_INPUT("IN3R"),
 432SND_SOC_DAPM_INPUT("IN4L"),
 433SND_SOC_DAPM_INPUT("IN4R"),
 434
 435SND_SOC_DAPM_PGA_E("IN1L PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN1L_ENA_SHIFT,
 436                   0, NULL, 0, arizona_in_ev,
 437                   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
 438                   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
 439SND_SOC_DAPM_PGA_E("IN1R PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN1R_ENA_SHIFT,
 440                   0, NULL, 0, arizona_in_ev,
 441                   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
 442                   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
 443SND_SOC_DAPM_PGA_E("IN2L PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN2L_ENA_SHIFT,
 444                   0, NULL, 0, arizona_in_ev,
 445                   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
 446                   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
 447SND_SOC_DAPM_PGA_E("IN2R PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN2R_ENA_SHIFT,
 448                   0, NULL, 0, arizona_in_ev,
 449                   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
 450                   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
 451SND_SOC_DAPM_PGA_E("IN3L PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN3L_ENA_SHIFT,
 452                   0, NULL, 0, arizona_in_ev,
 453                   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
 454                   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
 455SND_SOC_DAPM_PGA_E("IN3R PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN3R_ENA_SHIFT,
 456                   0, NULL, 0, arizona_in_ev,
 457                   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
 458                   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
 459SND_SOC_DAPM_PGA_E("IN4L PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN4L_ENA_SHIFT,
 460                   0, NULL, 0, arizona_in_ev,
 461                   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
 462                   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
 463SND_SOC_DAPM_PGA_E("IN4R PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN4R_ENA_SHIFT,
 464                   0, NULL, 0, arizona_in_ev,
 465                   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD |
 466                   SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU),
 467
 468SND_SOC_DAPM_SUPPLY("MICBIAS1", ARIZONA_MIC_BIAS_CTRL_1,
 469                    ARIZONA_MICB1_ENA_SHIFT, 0, NULL, 0),
 470SND_SOC_DAPM_SUPPLY("MICBIAS2", ARIZONA_MIC_BIAS_CTRL_2,
 471                    ARIZONA_MICB1_ENA_SHIFT, 0, NULL, 0),
 472SND_SOC_DAPM_SUPPLY("MICBIAS3", ARIZONA_MIC_BIAS_CTRL_3,
 473                    ARIZONA_MICB1_ENA_SHIFT, 0, NULL, 0),
 474
 475SND_SOC_DAPM_PGA("Noise Generator", ARIZONA_COMFORT_NOISE_GENERATOR,
 476                 ARIZONA_NOISE_GEN_ENA_SHIFT, 0, NULL, 0),
 477
 478SND_SOC_DAPM_PGA("Tone Generator 1", ARIZONA_TONE_GENERATOR_1,
 479                 ARIZONA_TONE1_ENA_SHIFT, 0, NULL, 0),
 480SND_SOC_DAPM_PGA("Tone Generator 2", ARIZONA_TONE_GENERATOR_1,
 481                 ARIZONA_TONE2_ENA_SHIFT, 0, NULL, 0),
 482
 483SND_SOC_DAPM_PGA("Mic Mute Mixer", ARIZONA_MIC_NOISE_MIX_CONTROL_1,
 484                 ARIZONA_MICMUTE_MIX_ENA_SHIFT, 0, NULL, 0),
 485
 486SND_SOC_DAPM_PGA("EQ1", ARIZONA_EQ1_1, ARIZONA_EQ1_ENA_SHIFT, 0, NULL, 0),
 487SND_SOC_DAPM_PGA("EQ2", ARIZONA_EQ2_1, ARIZONA_EQ2_ENA_SHIFT, 0, NULL, 0),
 488SND_SOC_DAPM_PGA("EQ3", ARIZONA_EQ3_1, ARIZONA_EQ3_ENA_SHIFT, 0, NULL, 0),
 489SND_SOC_DAPM_PGA("EQ4", ARIZONA_EQ4_1, ARIZONA_EQ4_ENA_SHIFT, 0, NULL, 0),
 490
 491SND_SOC_DAPM_PGA("DRC1L", ARIZONA_DRC1_CTRL1, ARIZONA_DRC1L_ENA_SHIFT, 0,
 492                 NULL, 0),
 493SND_SOC_DAPM_PGA("DRC1R", ARIZONA_DRC1_CTRL1, ARIZONA_DRC1R_ENA_SHIFT, 0,
 494                 NULL, 0),
 495SND_SOC_DAPM_PGA("DRC2L", ARIZONA_DRC2_CTRL1, ARIZONA_DRC2L_ENA_SHIFT, 0,
 496                 NULL, 0),
 497SND_SOC_DAPM_PGA("DRC2R", ARIZONA_DRC2_CTRL1, ARIZONA_DRC2R_ENA_SHIFT, 0,
 498                 NULL, 0),
 499
 500SND_SOC_DAPM_PGA("LHPF1", ARIZONA_HPLPF1_1, ARIZONA_LHPF1_ENA_SHIFT, 0,
 501                 NULL, 0),
 502SND_SOC_DAPM_PGA("LHPF2", ARIZONA_HPLPF2_1, ARIZONA_LHPF2_ENA_SHIFT, 0,
 503                 NULL, 0),
 504SND_SOC_DAPM_PGA("LHPF3", ARIZONA_HPLPF3_1, ARIZONA_LHPF3_ENA_SHIFT, 0,
 505                 NULL, 0),
 506SND_SOC_DAPM_PGA("LHPF4", ARIZONA_HPLPF4_1, ARIZONA_LHPF4_ENA_SHIFT, 0,
 507                 NULL, 0),
 508
 509SND_SOC_DAPM_PGA("PWM1 Driver", ARIZONA_PWM_DRIVE_1, ARIZONA_PWM1_ENA_SHIFT,
 510                 0, NULL, 0),
 511SND_SOC_DAPM_PGA("PWM2 Driver", ARIZONA_PWM_DRIVE_1, ARIZONA_PWM2_ENA_SHIFT,
 512                 0, NULL, 0),
 513
 514SND_SOC_DAPM_PGA("ASRC1L", ARIZONA_ASRC_ENABLE, ARIZONA_ASRC1L_ENA_SHIFT, 0,
 515                 NULL, 0),
 516SND_SOC_DAPM_PGA("ASRC1R", ARIZONA_ASRC_ENABLE, ARIZONA_ASRC1R_ENA_SHIFT, 0,
 517                 NULL, 0),
 518SND_SOC_DAPM_PGA("ASRC2L", ARIZONA_ASRC_ENABLE, ARIZONA_ASRC2L_ENA_SHIFT, 0,
 519                 NULL, 0),
 520SND_SOC_DAPM_PGA("ASRC2R", ARIZONA_ASRC_ENABLE, ARIZONA_ASRC2R_ENA_SHIFT, 0,
 521                 NULL, 0),
 522
 523SND_SOC_DAPM_VALUE_MUX("AEC Loopback", ARIZONA_DAC_AEC_CONTROL_1,
 524                       ARIZONA_AEC_LOOPBACK_ENA_SHIFT, 0,
 525                       &wm5110_aec_loopback_mux),
 526
 527SND_SOC_DAPM_AIF_OUT("AIF1TX1", NULL, 0,
 528                     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX1_ENA_SHIFT, 0),
 529SND_SOC_DAPM_AIF_OUT("AIF1TX2", NULL, 0,
 530                     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX2_ENA_SHIFT, 0),
 531SND_SOC_DAPM_AIF_OUT("AIF1TX3", NULL, 0,
 532                     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX3_ENA_SHIFT, 0),
 533SND_SOC_DAPM_AIF_OUT("AIF1TX4", NULL, 0,
 534                     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX4_ENA_SHIFT, 0),
 535SND_SOC_DAPM_AIF_OUT("AIF1TX5", NULL, 0,
 536                     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX5_ENA_SHIFT, 0),
 537SND_SOC_DAPM_AIF_OUT("AIF1TX6", NULL, 0,
 538                     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX6_ENA_SHIFT, 0),
 539SND_SOC_DAPM_AIF_OUT("AIF1TX7", NULL, 0,
 540                     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX7_ENA_SHIFT, 0),
 541SND_SOC_DAPM_AIF_OUT("AIF1TX8", NULL, 0,
 542                     ARIZONA_AIF1_TX_ENABLES, ARIZONA_AIF1TX8_ENA_SHIFT, 0),
 543
 544SND_SOC_DAPM_AIF_IN("AIF1RX1", NULL, 0,
 545                    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX1_ENA_SHIFT, 0),
 546SND_SOC_DAPM_AIF_IN("AIF1RX2", NULL, 0,
 547                    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX2_ENA_SHIFT, 0),
 548SND_SOC_DAPM_AIF_IN("AIF1RX3", NULL, 0,
 549                    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX3_ENA_SHIFT, 0),
 550SND_SOC_DAPM_AIF_IN("AIF1RX4", NULL, 0,
 551                    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX4_ENA_SHIFT, 0),
 552SND_SOC_DAPM_AIF_IN("AIF1RX5", NULL, 0,
 553                    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX5_ENA_SHIFT, 0),
 554SND_SOC_DAPM_AIF_IN("AIF1RX6", NULL, 0,
 555                    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX6_ENA_SHIFT, 0),
 556SND_SOC_DAPM_AIF_IN("AIF1RX7", NULL, 0,
 557                    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX7_ENA_SHIFT, 0),
 558SND_SOC_DAPM_AIF_IN("AIF1RX8", NULL, 0,
 559                    ARIZONA_AIF1_RX_ENABLES, ARIZONA_AIF1RX8_ENA_SHIFT, 0),
 560
 561SND_SOC_DAPM_AIF_OUT("AIF2TX1", NULL, 0,
 562                     ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX1_ENA_SHIFT, 0),
 563SND_SOC_DAPM_AIF_OUT("AIF2TX2", NULL, 0,
 564                     ARIZONA_AIF2_TX_ENABLES, ARIZONA_AIF2TX2_ENA_SHIFT, 0),
 565
 566SND_SOC_DAPM_AIF_IN("AIF2RX1", NULL, 0,
 567                    ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX1_ENA_SHIFT, 0),
 568SND_SOC_DAPM_AIF_IN("AIF2RX2", NULL, 0,
 569                    ARIZONA_AIF2_RX_ENABLES, ARIZONA_AIF2RX2_ENA_SHIFT, 0),
 570
 571SND_SOC_DAPM_AIF_IN("SLIMRX1", NULL, 0,
 572                    ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
 573                    ARIZONA_SLIMRX1_ENA_SHIFT, 0),
 574SND_SOC_DAPM_AIF_IN("SLIMRX2", NULL, 0,
 575                    ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
 576                    ARIZONA_SLIMRX2_ENA_SHIFT, 0),
 577SND_SOC_DAPM_AIF_IN("SLIMRX3", NULL, 0,
 578                    ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
 579                    ARIZONA_SLIMRX3_ENA_SHIFT, 0),
 580SND_SOC_DAPM_AIF_IN("SLIMRX4", NULL, 0,
 581                    ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
 582                    ARIZONA_SLIMRX4_ENA_SHIFT, 0),
 583SND_SOC_DAPM_AIF_IN("SLIMRX5", NULL, 0,
 584                    ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
 585                    ARIZONA_SLIMRX5_ENA_SHIFT, 0),
 586SND_SOC_DAPM_AIF_IN("SLIMRX6", NULL, 0,
 587                    ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
 588                    ARIZONA_SLIMRX6_ENA_SHIFT, 0),
 589SND_SOC_DAPM_AIF_IN("SLIMRX7", NULL, 0,
 590                    ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
 591                    ARIZONA_SLIMRX7_ENA_SHIFT, 0),
 592SND_SOC_DAPM_AIF_IN("SLIMRX8", NULL, 0,
 593                    ARIZONA_SLIMBUS_RX_CHANNEL_ENABLE,
 594                    ARIZONA_SLIMRX8_ENA_SHIFT, 0),
 595
 596SND_SOC_DAPM_AIF_OUT("SLIMTX1", NULL, 0,
 597                     ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
 598                     ARIZONA_SLIMTX1_ENA_SHIFT, 0),
 599SND_SOC_DAPM_AIF_OUT("SLIMTX2", NULL, 0,
 600                     ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
 601                     ARIZONA_SLIMTX2_ENA_SHIFT, 0),
 602SND_SOC_DAPM_AIF_OUT("SLIMTX3", NULL, 0,
 603                     ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
 604                     ARIZONA_SLIMTX3_ENA_SHIFT, 0),
 605SND_SOC_DAPM_AIF_OUT("SLIMTX4", NULL, 0,
 606                     ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
 607                     ARIZONA_SLIMTX4_ENA_SHIFT, 0),
 608SND_SOC_DAPM_AIF_OUT("SLIMTX5", NULL, 0,
 609                     ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
 610                     ARIZONA_SLIMTX5_ENA_SHIFT, 0),
 611SND_SOC_DAPM_AIF_OUT("SLIMTX6", NULL, 0,
 612                     ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
 613                     ARIZONA_SLIMTX6_ENA_SHIFT, 0),
 614SND_SOC_DAPM_AIF_OUT("SLIMTX7", NULL, 0,
 615                     ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
 616                     ARIZONA_SLIMTX7_ENA_SHIFT, 0),
 617SND_SOC_DAPM_AIF_OUT("SLIMTX8", NULL, 0,
 618                     ARIZONA_SLIMBUS_TX_CHANNEL_ENABLE,
 619                     ARIZONA_SLIMTX8_ENA_SHIFT, 0),
 620
 621SND_SOC_DAPM_AIF_OUT("AIF3TX1", NULL, 0,
 622                     ARIZONA_AIF3_TX_ENABLES, ARIZONA_AIF3TX1_ENA_SHIFT, 0),
 623SND_SOC_DAPM_AIF_OUT("AIF3TX2", NULL, 0,
 624                     ARIZONA_AIF3_TX_ENABLES, ARIZONA_AIF3TX2_ENA_SHIFT, 0),
 625
 626SND_SOC_DAPM_AIF_IN("AIF3RX1", NULL, 0,
 627                    ARIZONA_AIF3_RX_ENABLES, ARIZONA_AIF3RX1_ENA_SHIFT, 0),
 628SND_SOC_DAPM_AIF_IN("AIF3RX2", NULL, 0,
 629                    ARIZONA_AIF3_RX_ENABLES, ARIZONA_AIF3RX2_ENA_SHIFT, 0),
 630
 631SND_SOC_DAPM_PGA_E("OUT1L", SND_SOC_NOPM,
 632                   ARIZONA_OUT1L_ENA_SHIFT, 0, NULL, 0, arizona_hp_ev,
 633                   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
 634SND_SOC_DAPM_PGA_E("OUT1R", SND_SOC_NOPM,
 635                   ARIZONA_OUT1R_ENA_SHIFT, 0, NULL, 0, arizona_hp_ev,
 636                   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
 637SND_SOC_DAPM_PGA_E("OUT2L", ARIZONA_OUTPUT_ENABLES_1,
 638                   ARIZONA_OUT2L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
 639                   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
 640SND_SOC_DAPM_PGA_E("OUT2R", ARIZONA_OUTPUT_ENABLES_1,
 641                   ARIZONA_OUT2R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
 642                   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
 643SND_SOC_DAPM_PGA_E("OUT3L", ARIZONA_OUTPUT_ENABLES_1,
 644                   ARIZONA_OUT3L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
 645                   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
 646SND_SOC_DAPM_PGA_E("OUT3R", ARIZONA_OUTPUT_ENABLES_1,
 647                   ARIZONA_OUT3R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
 648                   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
 649SND_SOC_DAPM_PGA_E("OUT5L", ARIZONA_OUTPUT_ENABLES_1,
 650                   ARIZONA_OUT5L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
 651                   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
 652SND_SOC_DAPM_PGA_E("OUT5R", ARIZONA_OUTPUT_ENABLES_1,
 653                   ARIZONA_OUT5R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
 654                   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
 655SND_SOC_DAPM_PGA_E("OUT6L", ARIZONA_OUTPUT_ENABLES_1,
 656                   ARIZONA_OUT6L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
 657                   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
 658SND_SOC_DAPM_PGA_E("OUT6R", ARIZONA_OUTPUT_ENABLES_1,
 659                   ARIZONA_OUT6R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
 660                   SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
 661
 662ARIZONA_MIXER_WIDGETS(EQ1, "EQ1"),
 663ARIZONA_MIXER_WIDGETS(EQ2, "EQ2"),
 664ARIZONA_MIXER_WIDGETS(EQ3, "EQ3"),
 665ARIZONA_MIXER_WIDGETS(EQ4, "EQ4"),
 666
 667ARIZONA_MIXER_WIDGETS(DRC1L, "DRC1L"),
 668ARIZONA_MIXER_WIDGETS(DRC1R, "DRC1R"),
 669ARIZONA_MIXER_WIDGETS(DRC2L, "DRC2L"),
 670ARIZONA_MIXER_WIDGETS(DRC2R, "DRC2R"),
 671
 672ARIZONA_MIXER_WIDGETS(LHPF1, "LHPF1"),
 673ARIZONA_MIXER_WIDGETS(LHPF2, "LHPF2"),
 674ARIZONA_MIXER_WIDGETS(LHPF3, "LHPF3"),
 675ARIZONA_MIXER_WIDGETS(LHPF4, "LHPF4"),
 676
 677ARIZONA_MIXER_WIDGETS(Mic, "Mic"),
 678ARIZONA_MIXER_WIDGETS(Noise, "Noise"),
 679
 680ARIZONA_MIXER_WIDGETS(PWM1, "PWM1"),
 681ARIZONA_MIXER_WIDGETS(PWM2, "PWM2"),
 682
 683ARIZONA_MIXER_WIDGETS(OUT1L, "HPOUT1L"),
 684ARIZONA_MIXER_WIDGETS(OUT1R, "HPOUT1R"),
 685ARIZONA_MIXER_WIDGETS(OUT2L, "HPOUT2L"),
 686ARIZONA_MIXER_WIDGETS(OUT2R, "HPOUT2R"),
 687ARIZONA_MIXER_WIDGETS(OUT3L, "HPOUT3L"),
 688ARIZONA_MIXER_WIDGETS(OUT3R, "HPOUT3R"),
 689ARIZONA_MIXER_WIDGETS(SPKOUTL, "SPKOUTL"),
 690ARIZONA_MIXER_WIDGETS(SPKOUTR, "SPKOUTR"),
 691ARIZONA_MIXER_WIDGETS(SPKDAT1L, "SPKDAT1L"),
 692ARIZONA_MIXER_WIDGETS(SPKDAT1R, "SPKDAT1R"),
 693ARIZONA_MIXER_WIDGETS(SPKDAT2L, "SPKDAT2L"),
 694ARIZONA_MIXER_WIDGETS(SPKDAT2R, "SPKDAT2R"),
 695
 696ARIZONA_MIXER_WIDGETS(AIF1TX1, "AIF1TX1"),
 697ARIZONA_MIXER_WIDGETS(AIF1TX2, "AIF1TX2"),
 698ARIZONA_MIXER_WIDGETS(AIF1TX3, "AIF1TX3"),
 699ARIZONA_MIXER_WIDGETS(AIF1TX4, "AIF1TX4"),
 700ARIZONA_MIXER_WIDGETS(AIF1TX5, "AIF1TX5"),
 701ARIZONA_MIXER_WIDGETS(AIF1TX6, "AIF1TX6"),
 702ARIZONA_MIXER_WIDGETS(AIF1TX7, "AIF1TX7"),
 703ARIZONA_MIXER_WIDGETS(AIF1TX8, "AIF1TX8"),
 704
 705ARIZONA_MIXER_WIDGETS(AIF2TX1, "AIF2TX1"),
 706ARIZONA_MIXER_WIDGETS(AIF2TX2, "AIF2TX2"),
 707
 708ARIZONA_MIXER_WIDGETS(AIF3TX1, "AIF3TX1"),
 709ARIZONA_MIXER_WIDGETS(AIF3TX2, "AIF3TX2"),
 710
 711ARIZONA_MIXER_WIDGETS(SLIMTX1, "SLIMTX1"),
 712ARIZONA_MIXER_WIDGETS(SLIMTX2, "SLIMTX2"),
 713ARIZONA_MIXER_WIDGETS(SLIMTX3, "SLIMTX3"),
 714ARIZONA_MIXER_WIDGETS(SLIMTX4, "SLIMTX4"),
 715ARIZONA_MIXER_WIDGETS(SLIMTX5, "SLIMTX5"),
 716ARIZONA_MIXER_WIDGETS(SLIMTX6, "SLIMTX6"),
 717ARIZONA_MIXER_WIDGETS(SLIMTX7, "SLIMTX7"),
 718ARIZONA_MIXER_WIDGETS(SLIMTX8, "SLIMTX8"),
 719
 720ARIZONA_MUX_WIDGETS(ASRC1L, "ASRC1L"),
 721ARIZONA_MUX_WIDGETS(ASRC1R, "ASRC1R"),
 722ARIZONA_MUX_WIDGETS(ASRC2L, "ASRC2L"),
 723ARIZONA_MUX_WIDGETS(ASRC2R, "ASRC2R"),
 724
 725SND_SOC_DAPM_OUTPUT("HPOUT1L"),
 726SND_SOC_DAPM_OUTPUT("HPOUT1R"),
 727SND_SOC_DAPM_OUTPUT("HPOUT2L"),
 728SND_SOC_DAPM_OUTPUT("HPOUT2R"),
 729SND_SOC_DAPM_OUTPUT("HPOUT3L"),
 730SND_SOC_DAPM_OUTPUT("HPOUT3R"),
 731SND_SOC_DAPM_OUTPUT("SPKOUTLN"),
 732SND_SOC_DAPM_OUTPUT("SPKOUTLP"),
 733SND_SOC_DAPM_OUTPUT("SPKOUTRN"),
 734SND_SOC_DAPM_OUTPUT("SPKOUTRP"),
 735SND_SOC_DAPM_OUTPUT("SPKDAT1L"),
 736SND_SOC_DAPM_OUTPUT("SPKDAT1R"),
 737SND_SOC_DAPM_OUTPUT("SPKDAT2L"),
 738SND_SOC_DAPM_OUTPUT("SPKDAT2R"),
 739
 740SND_SOC_DAPM_OUTPUT("MICSUPP"),
 741};
 742
 743#define ARIZONA_MIXER_INPUT_ROUTES(name)        \
 744        { name, "Noise Generator", "Noise Generator" }, \
 745        { name, "Tone Generator 1", "Tone Generator 1" }, \
 746        { name, "Tone Generator 2", "Tone Generator 2" }, \
 747        { name, "Haptics", "HAPTICS" }, \
 748        { name, "AEC", "AEC Loopback" }, \
 749        { name, "IN1L", "IN1L PGA" }, \
 750        { name, "IN1R", "IN1R PGA" }, \
 751        { name, "IN2L", "IN2L PGA" }, \
 752        { name, "IN2R", "IN2R PGA" }, \
 753        { name, "IN3L", "IN3L PGA" }, \
 754        { name, "IN3R", "IN3R PGA" }, \
 755        { name, "IN4L", "IN4L PGA" }, \
 756        { name, "IN4R", "IN4R PGA" }, \
 757        { name, "Mic Mute Mixer", "Mic Mute Mixer" }, \
 758        { name, "AIF1RX1", "AIF1RX1" }, \
 759        { name, "AIF1RX2", "AIF1RX2" }, \
 760        { name, "AIF1RX3", "AIF1RX3" }, \
 761        { name, "AIF1RX4", "AIF1RX4" }, \
 762        { name, "AIF1RX5", "AIF1RX5" }, \
 763        { name, "AIF1RX6", "AIF1RX6" }, \
 764        { name, "AIF1RX7", "AIF1RX7" }, \
 765        { name, "AIF1RX8", "AIF1RX8" }, \
 766        { name, "AIF2RX1", "AIF2RX1" }, \
 767        { name, "AIF2RX2", "AIF2RX2" }, \
 768        { name, "AIF3RX1", "AIF3RX1" }, \
 769        { name, "AIF3RX2", "AIF3RX2" }, \
 770        { name, "SLIMRX1", "SLIMRX1" }, \
 771        { name, "SLIMRX2", "SLIMRX2" }, \
 772        { name, "SLIMRX3", "SLIMRX3" }, \
 773        { name, "SLIMRX4", "SLIMRX4" }, \
 774        { name, "SLIMRX5", "SLIMRX5" }, \
 775        { name, "SLIMRX6", "SLIMRX6" }, \
 776        { name, "SLIMRX7", "SLIMRX7" }, \
 777        { name, "SLIMRX8", "SLIMRX8" }, \
 778        { name, "EQ1", "EQ1" }, \
 779        { name, "EQ2", "EQ2" }, \
 780        { name, "EQ3", "EQ3" }, \
 781        { name, "EQ4", "EQ4" }, \
 782        { name, "DRC1L", "DRC1L" }, \
 783        { name, "DRC1R", "DRC1R" }, \
 784        { name, "DRC2L", "DRC2L" }, \
 785        { name, "DRC2R", "DRC2R" }, \
 786        { name, "LHPF1", "LHPF1" }, \
 787        { name, "LHPF2", "LHPF2" }, \
 788        { name, "LHPF3", "LHPF3" }, \
 789        { name, "LHPF4", "LHPF4" }, \
 790        { name, "ASRC1L", "ASRC1L" }, \
 791        { name, "ASRC1R", "ASRC1R" }, \
 792        { name, "ASRC2L", "ASRC2L" }, \
 793        { name, "ASRC2R", "ASRC2R" }
 794
 795static const struct snd_soc_dapm_route wm5110_dapm_routes[] = {
 796        { "AIF2 Capture", NULL, "DBVDD2" },
 797        { "AIF2 Playback", NULL, "DBVDD2" },
 798
 799        { "AIF3 Capture", NULL, "DBVDD3" },
 800        { "AIF3 Playback", NULL, "DBVDD3" },
 801
 802        { "OUT1L", NULL, "CPVDD" },
 803        { "OUT1R", NULL, "CPVDD" },
 804        { "OUT2L", NULL, "CPVDD" },
 805        { "OUT2R", NULL, "CPVDD" },
 806        { "OUT3L", NULL, "CPVDD" },
 807        { "OUT3R", NULL, "CPVDD" },
 808
 809        { "OUT4L", NULL, "SPKVDDL" },
 810        { "OUT4R", NULL, "SPKVDDR" },
 811
 812        { "OUT1L", NULL, "SYSCLK" },
 813        { "OUT1R", NULL, "SYSCLK" },
 814        { "OUT2L", NULL, "SYSCLK" },
 815        { "OUT2R", NULL, "SYSCLK" },
 816        { "OUT3L", NULL, "SYSCLK" },
 817        { "OUT4L", NULL, "SYSCLK" },
 818        { "OUT4R", NULL, "SYSCLK" },
 819        { "OUT5L", NULL, "SYSCLK" },
 820        { "OUT5R", NULL, "SYSCLK" },
 821        { "OUT6L", NULL, "SYSCLK" },
 822        { "OUT6R", NULL, "SYSCLK" },
 823
 824        { "IN1L", NULL, "SYSCLK" },
 825        { "IN1R", NULL, "SYSCLK" },
 826        { "IN2L", NULL, "SYSCLK" },
 827        { "IN2R", NULL, "SYSCLK" },
 828        { "IN3L", NULL, "SYSCLK" },
 829        { "IN3R", NULL, "SYSCLK" },
 830        { "IN4L", NULL, "SYSCLK" },
 831        { "IN4R", NULL, "SYSCLK" },
 832
 833        { "MICBIAS1", NULL, "MICVDD" },
 834        { "MICBIAS2", NULL, "MICVDD" },
 835        { "MICBIAS3", NULL, "MICVDD" },
 836
 837        { "Noise Generator", NULL, "SYSCLK" },
 838        { "Tone Generator 1", NULL, "SYSCLK" },
 839        { "Tone Generator 2", NULL, "SYSCLK" },
 840
 841        { "Noise Generator", NULL, "NOISE" },
 842        { "Tone Generator 1", NULL, "TONE" },
 843        { "Tone Generator 2", NULL, "TONE" },
 844
 845        { "Mic Mute Mixer", NULL, "Noise Mixer" },
 846        { "Mic Mute Mixer", NULL, "Mic Mixer" },
 847
 848        { "AIF1 Capture", NULL, "AIF1TX1" },
 849        { "AIF1 Capture", NULL, "AIF1TX2" },
 850        { "AIF1 Capture", NULL, "AIF1TX3" },
 851        { "AIF1 Capture", NULL, "AIF1TX4" },
 852        { "AIF1 Capture", NULL, "AIF1TX5" },
 853        { "AIF1 Capture", NULL, "AIF1TX6" },
 854        { "AIF1 Capture", NULL, "AIF1TX7" },
 855        { "AIF1 Capture", NULL, "AIF1TX8" },
 856
 857        { "AIF1RX1", NULL, "AIF1 Playback" },
 858        { "AIF1RX2", NULL, "AIF1 Playback" },
 859        { "AIF1RX3", NULL, "AIF1 Playback" },
 860        { "AIF1RX4", NULL, "AIF1 Playback" },
 861        { "AIF1RX5", NULL, "AIF1 Playback" },
 862        { "AIF1RX6", NULL, "AIF1 Playback" },
 863        { "AIF1RX7", NULL, "AIF1 Playback" },
 864        { "AIF1RX8", NULL, "AIF1 Playback" },
 865
 866        { "AIF2 Capture", NULL, "AIF2TX1" },
 867        { "AIF2 Capture", NULL, "AIF2TX2" },
 868
 869        { "AIF2RX1", NULL, "AIF2 Playback" },
 870        { "AIF2RX2", NULL, "AIF2 Playback" },
 871
 872        { "AIF3 Capture", NULL, "AIF3TX1" },
 873        { "AIF3 Capture", NULL, "AIF3TX2" },
 874
 875        { "AIF3RX1", NULL, "AIF3 Playback" },
 876        { "AIF3RX2", NULL, "AIF3 Playback" },
 877
 878        { "Slim1 Capture", NULL, "SLIMTX1" },
 879        { "Slim1 Capture", NULL, "SLIMTX2" },
 880        { "Slim1 Capture", NULL, "SLIMTX3" },
 881        { "Slim1 Capture", NULL, "SLIMTX4" },
 882
 883        { "SLIMRX1", NULL, "Slim1 Playback" },
 884        { "SLIMRX2", NULL, "Slim1 Playback" },
 885        { "SLIMRX3", NULL, "Slim1 Playback" },
 886        { "SLIMRX4", NULL, "Slim1 Playback" },
 887
 888        { "Slim2 Capture", NULL, "SLIMTX5" },
 889        { "Slim2 Capture", NULL, "SLIMTX6" },
 890
 891        { "SLIMRX5", NULL, "Slim2 Playback" },
 892        { "SLIMRX6", NULL, "Slim2 Playback" },
 893
 894        { "Slim3 Capture", NULL, "SLIMTX7" },
 895        { "Slim3 Capture", NULL, "SLIMTX8" },
 896
 897        { "SLIMRX7", NULL, "Slim3 Playback" },
 898        { "SLIMRX8", NULL, "Slim3 Playback" },
 899
 900        { "AIF1 Playback", NULL, "SYSCLK" },
 901        { "AIF2 Playback", NULL, "SYSCLK" },
 902        { "AIF3 Playback", NULL, "SYSCLK" },
 903        { "Slim1 Playback", NULL, "SYSCLK" },
 904        { "Slim2 Playback", NULL, "SYSCLK" },
 905        { "Slim3 Playback", NULL, "SYSCLK" },
 906
 907        { "AIF1 Capture", NULL, "SYSCLK" },
 908        { "AIF2 Capture", NULL, "SYSCLK" },
 909        { "AIF3 Capture", NULL, "SYSCLK" },
 910        { "Slim1 Capture", NULL, "SYSCLK" },
 911        { "Slim2 Capture", NULL, "SYSCLK" },
 912        { "Slim3 Capture", NULL, "SYSCLK" },
 913
 914        { "IN1L PGA", NULL, "IN1L" },
 915        { "IN1R PGA", NULL, "IN1R" },
 916
 917        { "IN2L PGA", NULL, "IN2L" },
 918        { "IN2R PGA", NULL, "IN2R" },
 919
 920        { "IN3L PGA", NULL, "IN3L" },
 921        { "IN3R PGA", NULL, "IN3R" },
 922
 923        { "IN4L PGA", NULL, "IN4L" },
 924        { "IN4R PGA", NULL, "IN4R" },
 925
 926        ARIZONA_MIXER_ROUTES("OUT1L", "HPOUT1L"),
 927        ARIZONA_MIXER_ROUTES("OUT1R", "HPOUT1R"),
 928        ARIZONA_MIXER_ROUTES("OUT2L", "HPOUT2L"),
 929        ARIZONA_MIXER_ROUTES("OUT2R", "HPOUT2R"),
 930        ARIZONA_MIXER_ROUTES("OUT3L", "HPOUT3L"),
 931        ARIZONA_MIXER_ROUTES("OUT3R", "HPOUT3R"),
 932
 933        ARIZONA_MIXER_ROUTES("OUT4L", "SPKOUTL"),
 934        ARIZONA_MIXER_ROUTES("OUT4R", "SPKOUTR"),
 935        ARIZONA_MIXER_ROUTES("OUT5L", "SPKDAT1L"),
 936        ARIZONA_MIXER_ROUTES("OUT5R", "SPKDAT1R"),
 937        ARIZONA_MIXER_ROUTES("OUT6L", "SPKDAT2L"),
 938        ARIZONA_MIXER_ROUTES("OUT6R", "SPKDAT2R"),
 939
 940        ARIZONA_MIXER_ROUTES("PWM1 Driver", "PWM1"),
 941        ARIZONA_MIXER_ROUTES("PWM2 Driver", "PWM2"),
 942
 943        ARIZONA_MIXER_ROUTES("AIF1TX1", "AIF1TX1"),
 944        ARIZONA_MIXER_ROUTES("AIF1TX2", "AIF1TX2"),
 945        ARIZONA_MIXER_ROUTES("AIF1TX3", "AIF1TX3"),
 946        ARIZONA_MIXER_ROUTES("AIF1TX4", "AIF1TX4"),
 947        ARIZONA_MIXER_ROUTES("AIF1TX5", "AIF1TX5"),
 948        ARIZONA_MIXER_ROUTES("AIF1TX6", "AIF1TX6"),
 949        ARIZONA_MIXER_ROUTES("AIF1TX7", "AIF1TX7"),
 950        ARIZONA_MIXER_ROUTES("AIF1TX8", "AIF1TX8"),
 951
 952        ARIZONA_MIXER_ROUTES("AIF2TX1", "AIF2TX1"),
 953        ARIZONA_MIXER_ROUTES("AIF2TX2", "AIF2TX2"),
 954
 955        ARIZONA_MIXER_ROUTES("AIF3TX1", "AIF3TX1"),
 956        ARIZONA_MIXER_ROUTES("AIF3TX2", "AIF3TX2"),
 957
 958        ARIZONA_MIXER_ROUTES("SLIMTX1", "SLIMTX1"),
 959        ARIZONA_MIXER_ROUTES("SLIMTX2", "SLIMTX2"),
 960        ARIZONA_MIXER_ROUTES("SLIMTX3", "SLIMTX3"),
 961        ARIZONA_MIXER_ROUTES("SLIMTX4", "SLIMTX4"),
 962        ARIZONA_MIXER_ROUTES("SLIMTX5", "SLIMTX5"),
 963        ARIZONA_MIXER_ROUTES("SLIMTX6", "SLIMTX6"),
 964        ARIZONA_MIXER_ROUTES("SLIMTX7", "SLIMTX7"),
 965        ARIZONA_MIXER_ROUTES("SLIMTX8", "SLIMTX8"),
 966
 967        ARIZONA_MIXER_ROUTES("EQ1", "EQ1"),
 968        ARIZONA_MIXER_ROUTES("EQ2", "EQ2"),
 969        ARIZONA_MIXER_ROUTES("EQ3", "EQ3"),
 970        ARIZONA_MIXER_ROUTES("EQ4", "EQ4"),
 971
 972        ARIZONA_MIXER_ROUTES("DRC1L", "DRC1L"),
 973        ARIZONA_MIXER_ROUTES("DRC1R", "DRC1R"),
 974        ARIZONA_MIXER_ROUTES("DRC2L", "DRC2L"),
 975        ARIZONA_MIXER_ROUTES("DRC2R", "DRC2R"),
 976
 977        ARIZONA_MIXER_ROUTES("LHPF1", "LHPF1"),
 978        ARIZONA_MIXER_ROUTES("LHPF2", "LHPF2"),
 979        ARIZONA_MIXER_ROUTES("LHPF3", "LHPF3"),
 980        ARIZONA_MIXER_ROUTES("LHPF4", "LHPF4"),
 981
 982        ARIZONA_MUX_ROUTES("ASRC1L"),
 983        ARIZONA_MUX_ROUTES("ASRC1R"),
 984        ARIZONA_MUX_ROUTES("ASRC2L"),
 985        ARIZONA_MUX_ROUTES("ASRC2R"),
 986
 987        { "HPOUT1L", NULL, "OUT1L" },
 988        { "HPOUT1R", NULL, "OUT1R" },
 989
 990        { "HPOUT2L", NULL, "OUT2L" },
 991        { "HPOUT2R", NULL, "OUT2R" },
 992
 993        { "HPOUT3L", NULL, "OUT3L" },
 994        { "HPOUT3R", NULL, "OUT3L" },
 995
 996        { "SPKOUTLN", NULL, "OUT4L" },
 997        { "SPKOUTLP", NULL, "OUT4L" },
 998
 999        { "SPKOUTRN", NULL, "OUT4R" },
1000        { "SPKOUTRP", NULL, "OUT4R" },
1001
1002        { "SPKDAT1L", NULL, "OUT5L" },
1003        { "SPKDAT1R", NULL, "OUT5R" },
1004
1005        { "SPKDAT2L", NULL, "OUT6L" },
1006        { "SPKDAT2R", NULL, "OUT6R" },
1007
1008        { "MICSUPP", NULL, "SYSCLK" },
1009};
1010
1011static int wm5110_set_fll(struct snd_soc_codec *codec, int fll_id, int source,
1012                          unsigned int Fref, unsigned int Fout)
1013{
1014        struct wm5110_priv *wm5110 = snd_soc_codec_get_drvdata(codec);
1015
1016        switch (fll_id) {
1017        case WM5110_FLL1:
1018                return arizona_set_fll(&wm5110->fll[0], source, Fref, Fout);
1019        case WM5110_FLL2:
1020                return arizona_set_fll(&wm5110->fll[1], source, Fref, Fout);
1021        case WM5110_FLL1_REFCLK:
1022                return arizona_set_fll_refclk(&wm5110->fll[0], source, Fref,
1023                                              Fout);
1024        case WM5110_FLL2_REFCLK:
1025                return arizona_set_fll_refclk(&wm5110->fll[1], source, Fref,
1026                                              Fout);
1027        default:
1028                return -EINVAL;
1029        }
1030}
1031
1032#define WM5110_RATES SNDRV_PCM_RATE_8000_192000
1033
1034#define WM5110_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
1035                        SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)
1036
1037static struct snd_soc_dai_driver wm5110_dai[] = {
1038        {
1039                .name = "wm5110-aif1",
1040                .id = 1,
1041                .base = ARIZONA_AIF1_BCLK_CTRL,
1042                .playback = {
1043                        .stream_name = "AIF1 Playback",
1044                        .channels_min = 1,
1045                        .channels_max = 8,
1046                        .rates = WM5110_RATES,
1047                        .formats = WM5110_FORMATS,
1048                },
1049                .capture = {
1050                         .stream_name = "AIF1 Capture",
1051                         .channels_min = 1,
1052                         .channels_max = 8,
1053                         .rates = WM5110_RATES,
1054                         .formats = WM5110_FORMATS,
1055                 },
1056                .ops = &arizona_dai_ops,
1057                .symmetric_rates = 1,
1058        },
1059        {
1060                .name = "wm5110-aif2",
1061                .id = 2,
1062                .base = ARIZONA_AIF2_BCLK_CTRL,
1063                .playback = {
1064                        .stream_name = "AIF2 Playback",
1065                        .channels_min = 1,
1066                        .channels_max = 2,
1067                        .rates = WM5110_RATES,
1068                        .formats = WM5110_FORMATS,
1069                },
1070                .capture = {
1071                         .stream_name = "AIF2 Capture",
1072                         .channels_min = 1,
1073                         .channels_max = 2,
1074                         .rates = WM5110_RATES,
1075                         .formats = WM5110_FORMATS,
1076                 },
1077                .ops = &arizona_dai_ops,
1078                .symmetric_rates = 1,
1079        },
1080        {
1081                .name = "wm5110-aif3",
1082                .id = 3,
1083                .base = ARIZONA_AIF3_BCLK_CTRL,
1084                .playback = {
1085                        .stream_name = "AIF3 Playback",
1086                        .channels_min = 1,
1087                        .channels_max = 2,
1088                        .rates = WM5110_RATES,
1089                        .formats = WM5110_FORMATS,
1090                },
1091                .capture = {
1092                         .stream_name = "AIF3 Capture",
1093                         .channels_min = 1,
1094                         .channels_max = 2,
1095                         .rates = WM5110_RATES,
1096                         .formats = WM5110_FORMATS,
1097                 },
1098                .ops = &arizona_dai_ops,
1099                .symmetric_rates = 1,
1100        },
1101        {
1102                .name = "wm5110-slim1",
1103                .id = 4,
1104                .playback = {
1105                        .stream_name = "Slim1 Playback",
1106                        .channels_min = 1,
1107                        .channels_max = 4,
1108                        .rates = WM5110_RATES,
1109                        .formats = WM5110_FORMATS,
1110                },
1111                .capture = {
1112                         .stream_name = "Slim1 Capture",
1113                         .channels_min = 1,
1114                         .channels_max = 4,
1115                         .rates = WM5110_RATES,
1116                         .formats = WM5110_FORMATS,
1117                 },
1118                .ops = &arizona_simple_dai_ops,
1119        },
1120        {
1121                .name = "wm5110-slim2",
1122                .id = 5,
1123                .playback = {
1124                        .stream_name = "Slim2 Playback",
1125                        .channels_min = 1,
1126                        .channels_max = 2,
1127                        .rates = WM5110_RATES,
1128                        .formats = WM5110_FORMATS,
1129                },
1130                .capture = {
1131                         .stream_name = "Slim2 Capture",
1132                         .channels_min = 1,
1133                         .channels_max = 2,
1134                         .rates = WM5110_RATES,
1135                         .formats = WM5110_FORMATS,
1136                 },
1137                .ops = &arizona_simple_dai_ops,
1138        },
1139        {
1140                .name = "wm5110-slim3",
1141                .id = 6,
1142                .playback = {
1143                        .stream_name = "Slim3 Playback",
1144                        .channels_min = 1,
1145                        .channels_max = 2,
1146                        .rates = WM5110_RATES,
1147                        .formats = WM5110_FORMATS,
1148                },
1149                .capture = {
1150                         .stream_name = "Slim3 Capture",
1151                         .channels_min = 1,
1152                         .channels_max = 2,
1153                         .rates = WM5110_RATES,
1154                         .formats = WM5110_FORMATS,
1155                 },
1156                .ops = &arizona_simple_dai_ops,
1157        },
1158};
1159
1160static int wm5110_codec_probe(struct snd_soc_codec *codec)
1161{
1162        struct wm5110_priv *priv = snd_soc_codec_get_drvdata(codec);
1163        int ret;
1164
1165        codec->control_data = priv->core.arizona->regmap;
1166        priv->core.arizona->dapm = &codec->dapm;
1167
1168        ret = snd_soc_codec_set_cache_io(codec, 32, 16, SND_SOC_REGMAP);
1169        if (ret != 0)
1170                return ret;
1171
1172        arizona_init_spk(codec);
1173
1174        snd_soc_dapm_disable_pin(&codec->dapm, "HAPTICS");
1175
1176        priv->core.arizona->dapm = &codec->dapm;
1177
1178        return 0;
1179}
1180
1181static int wm5110_codec_remove(struct snd_soc_codec *codec)
1182{
1183        struct wm5110_priv *priv = snd_soc_codec_get_drvdata(codec);
1184
1185        priv->core.arizona->dapm = NULL;
1186
1187        return 0;
1188}
1189
1190#define WM5110_DIG_VU 0x0200
1191
1192static unsigned int wm5110_digital_vu[] = {
1193        ARIZONA_DAC_DIGITAL_VOLUME_1L,
1194        ARIZONA_DAC_DIGITAL_VOLUME_1R,
1195        ARIZONA_DAC_DIGITAL_VOLUME_2L,
1196        ARIZONA_DAC_DIGITAL_VOLUME_2R,
1197        ARIZONA_DAC_DIGITAL_VOLUME_3L,
1198        ARIZONA_DAC_DIGITAL_VOLUME_3R,
1199        ARIZONA_DAC_DIGITAL_VOLUME_4L,
1200        ARIZONA_DAC_DIGITAL_VOLUME_4R,
1201        ARIZONA_DAC_DIGITAL_VOLUME_5L,
1202        ARIZONA_DAC_DIGITAL_VOLUME_5R,
1203        ARIZONA_DAC_DIGITAL_VOLUME_6L,
1204        ARIZONA_DAC_DIGITAL_VOLUME_6R,
1205};
1206
1207static struct snd_soc_codec_driver soc_codec_dev_wm5110 = {
1208        .probe = wm5110_codec_probe,
1209        .remove = wm5110_codec_remove,
1210
1211        .idle_bias_off = true,
1212
1213        .set_sysclk = arizona_set_sysclk,
1214        .set_pll = wm5110_set_fll,
1215
1216        .controls = wm5110_snd_controls,
1217        .num_controls = ARRAY_SIZE(wm5110_snd_controls),
1218        .dapm_widgets = wm5110_dapm_widgets,
1219        .num_dapm_widgets = ARRAY_SIZE(wm5110_dapm_widgets),
1220        .dapm_routes = wm5110_dapm_routes,
1221        .num_dapm_routes = ARRAY_SIZE(wm5110_dapm_routes),
1222};
1223
1224static int wm5110_probe(struct platform_device *pdev)
1225{
1226        struct arizona *arizona = dev_get_drvdata(pdev->dev.parent);
1227        struct wm5110_priv *wm5110;
1228        int i;
1229
1230        wm5110 = devm_kzalloc(&pdev->dev, sizeof(struct wm5110_priv),
1231                              GFP_KERNEL);
1232        if (wm5110 == NULL)
1233                return -ENOMEM;
1234        platform_set_drvdata(pdev, wm5110);
1235
1236        wm5110->core.arizona = arizona;
1237        wm5110->core.num_inputs = 8;
1238
1239        for (i = 0; i < ARRAY_SIZE(wm5110->fll); i++)
1240                wm5110->fll[i].vco_mult = 3;
1241
1242        arizona_init_fll(arizona, 1, ARIZONA_FLL1_CONTROL_1 - 1,
1243                         ARIZONA_IRQ_FLL1_LOCK, ARIZONA_IRQ_FLL1_CLOCK_OK,
1244                         &wm5110->fll[0]);
1245        arizona_init_fll(arizona, 2, ARIZONA_FLL2_CONTROL_1 - 1,
1246                         ARIZONA_IRQ_FLL2_LOCK, ARIZONA_IRQ_FLL2_CLOCK_OK,
1247                         &wm5110->fll[1]);
1248
1249        for (i = 0; i < ARRAY_SIZE(wm5110_dai); i++)
1250                arizona_init_dai(&wm5110->core, i);
1251
1252        /* Latch volume update bits */
1253        for (i = 0; i < ARRAY_SIZE(wm5110_digital_vu); i++)
1254                regmap_update_bits(arizona->regmap, wm5110_digital_vu[i],
1255                                   WM5110_DIG_VU, WM5110_DIG_VU);
1256
1257        pm_runtime_enable(&pdev->dev);
1258        pm_runtime_idle(&pdev->dev);
1259
1260        return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wm5110,
1261                                      wm5110_dai, ARRAY_SIZE(wm5110_dai));
1262}
1263
1264static int wm5110_remove(struct platform_device *pdev)
1265{
1266        snd_soc_unregister_codec(&pdev->dev);
1267        pm_runtime_disable(&pdev->dev);
1268
1269        return 0;
1270}
1271
1272static struct platform_driver wm5110_codec_driver = {
1273        .driver = {
1274                .name = "wm5110-codec",
1275                .owner = THIS_MODULE,
1276        },
1277        .probe = wm5110_probe,
1278        .remove = wm5110_remove,
1279};
1280
1281module_platform_driver(wm5110_codec_driver);
1282
1283MODULE_DESCRIPTION("ASoC WM5110 driver");
1284MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>");
1285MODULE_LICENSE("GPL");
1286MODULE_ALIAS("platform:wm5110-codec");
1287