Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 1 | /* |
| 2 | * rt5677.c -- RT5677 ALSA SoC audio codec driver |
| 3 | * |
| 4 | * Copyright 2013 Realtek Semiconductor Corp. |
| 5 | * Author: Oder Chiou <oder_chiou@realtek.com> |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License version 2 as |
| 9 | * published by the Free Software Foundation. |
| 10 | */ |
| 11 | |
| 12 | #include <linux/fs.h> |
| 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> |
Anatol Pomozov | f9f6a59 | 2014-09-17 13:14:20 -0700 | [diff] [blame] | 18 | #include <linux/of_gpio.h> |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 19 | #include <linux/regmap.h> |
| 20 | #include <linux/i2c.h> |
| 21 | #include <linux/platform_device.h> |
| 22 | #include <linux/spi/spi.h> |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 23 | #include <linux/firmware.h> |
Oder Chiou | 44caf76 | 2014-09-16 11:37:39 +0800 | [diff] [blame] | 24 | #include <linux/gpio.h> |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 25 | #include <sound/core.h> |
| 26 | #include <sound/pcm.h> |
| 27 | #include <sound/pcm_params.h> |
| 28 | #include <sound/soc.h> |
| 29 | #include <sound/soc-dapm.h> |
| 30 | #include <sound/initval.h> |
| 31 | #include <sound/tlv.h> |
| 32 | |
Axel Lin | 30f14b4 | 2014-06-10 08:57:36 +0800 | [diff] [blame] | 33 | #include "rl6231.h" |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 34 | #include "rt5677.h" |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 35 | #include "rt5677-spi.h" |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 36 | |
| 37 | #define RT5677_DEVICE_ID 0x6327 |
| 38 | |
| 39 | #define RT5677_PR_RANGE_BASE (0xff + 1) |
| 40 | #define RT5677_PR_SPACING 0x100 |
| 41 | |
| 42 | #define RT5677_PR_BASE (RT5677_PR_RANGE_BASE + (0 * RT5677_PR_SPACING)) |
| 43 | |
| 44 | static const struct regmap_range_cfg rt5677_ranges[] = { |
| 45 | { |
| 46 | .name = "PR", |
| 47 | .range_min = RT5677_PR_BASE, |
| 48 | .range_max = RT5677_PR_BASE + 0xfd, |
| 49 | .selector_reg = RT5677_PRIV_INDEX, |
| 50 | .selector_mask = 0xff, |
| 51 | .selector_shift = 0x0, |
| 52 | .window_start = RT5677_PRIV_DATA, |
| 53 | .window_len = 0x1, |
| 54 | }, |
| 55 | }; |
| 56 | |
| 57 | static const struct reg_default init_list[] = { |
Oder Chiou | 2dfe2b0 | 2014-11-19 13:52:18 +0800 | [diff] [blame] | 58 | {RT5677_ASRC_12, 0x0018}, |
| 59 | {RT5677_PR_BASE + 0x3d, 0x364d}, |
| 60 | {RT5677_PR_BASE + 0x17, 0x4fc0}, |
| 61 | {RT5677_PR_BASE + 0x13, 0x0312}, |
| 62 | {RT5677_PR_BASE + 0x1e, 0x0000}, |
| 63 | {RT5677_PR_BASE + 0x12, 0x0eaa}, |
| 64 | {RT5677_PR_BASE + 0x14, 0x018a}, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 65 | }; |
| 66 | #define RT5677_INIT_REG_LEN ARRAY_SIZE(init_list) |
| 67 | |
| 68 | static const struct reg_default rt5677_reg[] = { |
| 69 | {RT5677_RESET , 0x0000}, |
| 70 | {RT5677_LOUT1 , 0xa800}, |
| 71 | {RT5677_IN1 , 0x0000}, |
| 72 | {RT5677_MICBIAS , 0x0000}, |
| 73 | {RT5677_SLIMBUS_PARAM , 0x0000}, |
| 74 | {RT5677_SLIMBUS_RX , 0x0000}, |
| 75 | {RT5677_SLIMBUS_CTRL , 0x0000}, |
| 76 | {RT5677_SIDETONE_CTRL , 0x000b}, |
| 77 | {RT5677_ANA_DAC1_2_3_SRC , 0x0000}, |
| 78 | {RT5677_IF_DSP_DAC3_4_MIXER , 0x1111}, |
| 79 | {RT5677_DAC4_DIG_VOL , 0xafaf}, |
| 80 | {RT5677_DAC3_DIG_VOL , 0xafaf}, |
| 81 | {RT5677_DAC1_DIG_VOL , 0xafaf}, |
| 82 | {RT5677_DAC2_DIG_VOL , 0xafaf}, |
| 83 | {RT5677_IF_DSP_DAC2_MIXER , 0x0011}, |
| 84 | {RT5677_STO1_ADC_DIG_VOL , 0x2f2f}, |
| 85 | {RT5677_MONO_ADC_DIG_VOL , 0x2f2f}, |
| 86 | {RT5677_STO1_2_ADC_BST , 0x0000}, |
| 87 | {RT5677_STO2_ADC_DIG_VOL , 0x2f2f}, |
| 88 | {RT5677_ADC_BST_CTRL2 , 0x0000}, |
| 89 | {RT5677_STO3_4_ADC_BST , 0x0000}, |
| 90 | {RT5677_STO3_ADC_DIG_VOL , 0x2f2f}, |
| 91 | {RT5677_STO4_ADC_DIG_VOL , 0x2f2f}, |
| 92 | {RT5677_STO4_ADC_MIXER , 0xd4c0}, |
| 93 | {RT5677_STO3_ADC_MIXER , 0xd4c0}, |
| 94 | {RT5677_STO2_ADC_MIXER , 0xd4c0}, |
| 95 | {RT5677_STO1_ADC_MIXER , 0xd4c0}, |
| 96 | {RT5677_MONO_ADC_MIXER , 0xd4d1}, |
| 97 | {RT5677_ADC_IF_DSP_DAC1_MIXER , 0x8080}, |
| 98 | {RT5677_STO1_DAC_MIXER , 0xaaaa}, |
| 99 | {RT5677_MONO_DAC_MIXER , 0xaaaa}, |
| 100 | {RT5677_DD1_MIXER , 0xaaaa}, |
| 101 | {RT5677_DD2_MIXER , 0xaaaa}, |
| 102 | {RT5677_IF3_DATA , 0x0000}, |
| 103 | {RT5677_IF4_DATA , 0x0000}, |
| 104 | {RT5677_PDM_OUT_CTRL , 0x8888}, |
| 105 | {RT5677_PDM_DATA_CTRL1 , 0x0000}, |
| 106 | {RT5677_PDM_DATA_CTRL2 , 0x0000}, |
| 107 | {RT5677_PDM1_DATA_CTRL2 , 0x0000}, |
| 108 | {RT5677_PDM1_DATA_CTRL3 , 0x0000}, |
| 109 | {RT5677_PDM1_DATA_CTRL4 , 0x0000}, |
| 110 | {RT5677_PDM2_DATA_CTRL2 , 0x0000}, |
| 111 | {RT5677_PDM2_DATA_CTRL3 , 0x0000}, |
| 112 | {RT5677_PDM2_DATA_CTRL4 , 0x0000}, |
| 113 | {RT5677_TDM1_CTRL1 , 0x0300}, |
| 114 | {RT5677_TDM1_CTRL2 , 0x0000}, |
| 115 | {RT5677_TDM1_CTRL3 , 0x4000}, |
| 116 | {RT5677_TDM1_CTRL4 , 0x0123}, |
| 117 | {RT5677_TDM1_CTRL5 , 0x4567}, |
| 118 | {RT5677_TDM2_CTRL1 , 0x0300}, |
| 119 | {RT5677_TDM2_CTRL2 , 0x0000}, |
| 120 | {RT5677_TDM2_CTRL3 , 0x4000}, |
| 121 | {RT5677_TDM2_CTRL4 , 0x0123}, |
| 122 | {RT5677_TDM2_CTRL5 , 0x4567}, |
| 123 | {RT5677_I2C_MASTER_CTRL1 , 0x0001}, |
| 124 | {RT5677_I2C_MASTER_CTRL2 , 0x0000}, |
| 125 | {RT5677_I2C_MASTER_CTRL3 , 0x0000}, |
| 126 | {RT5677_I2C_MASTER_CTRL4 , 0x0000}, |
| 127 | {RT5677_I2C_MASTER_CTRL5 , 0x0000}, |
| 128 | {RT5677_I2C_MASTER_CTRL6 , 0x0000}, |
| 129 | {RT5677_I2C_MASTER_CTRL7 , 0x0000}, |
| 130 | {RT5677_I2C_MASTER_CTRL8 , 0x0000}, |
| 131 | {RT5677_DMIC_CTRL1 , 0x1505}, |
| 132 | {RT5677_DMIC_CTRL2 , 0x0055}, |
| 133 | {RT5677_HAP_GENE_CTRL1 , 0x0111}, |
| 134 | {RT5677_HAP_GENE_CTRL2 , 0x0064}, |
| 135 | {RT5677_HAP_GENE_CTRL3 , 0xef0e}, |
| 136 | {RT5677_HAP_GENE_CTRL4 , 0xf0f0}, |
| 137 | {RT5677_HAP_GENE_CTRL5 , 0xef0e}, |
| 138 | {RT5677_HAP_GENE_CTRL6 , 0xf0f0}, |
| 139 | {RT5677_HAP_GENE_CTRL7 , 0xef0e}, |
| 140 | {RT5677_HAP_GENE_CTRL8 , 0xf0f0}, |
| 141 | {RT5677_HAP_GENE_CTRL9 , 0xf000}, |
| 142 | {RT5677_HAP_GENE_CTRL10 , 0x0000}, |
| 143 | {RT5677_PWR_DIG1 , 0x0000}, |
| 144 | {RT5677_PWR_DIG2 , 0x0000}, |
| 145 | {RT5677_PWR_ANLG1 , 0x0055}, |
| 146 | {RT5677_PWR_ANLG2 , 0x0000}, |
| 147 | {RT5677_PWR_DSP1 , 0x0001}, |
| 148 | {RT5677_PWR_DSP_ST , 0x0000}, |
| 149 | {RT5677_PWR_DSP2 , 0x0000}, |
| 150 | {RT5677_ADC_DAC_HPF_CTRL1 , 0x0e00}, |
| 151 | {RT5677_PRIV_INDEX , 0x0000}, |
| 152 | {RT5677_PRIV_DATA , 0x0000}, |
| 153 | {RT5677_I2S4_SDP , 0x8000}, |
| 154 | {RT5677_I2S1_SDP , 0x8000}, |
| 155 | {RT5677_I2S2_SDP , 0x8000}, |
| 156 | {RT5677_I2S3_SDP , 0x8000}, |
| 157 | {RT5677_CLK_TREE_CTRL1 , 0x1111}, |
| 158 | {RT5677_CLK_TREE_CTRL2 , 0x1111}, |
| 159 | {RT5677_CLK_TREE_CTRL3 , 0x0000}, |
| 160 | {RT5677_PLL1_CTRL1 , 0x0000}, |
| 161 | {RT5677_PLL1_CTRL2 , 0x0000}, |
| 162 | {RT5677_PLL2_CTRL1 , 0x0c60}, |
| 163 | {RT5677_PLL2_CTRL2 , 0x2000}, |
| 164 | {RT5677_GLB_CLK1 , 0x0000}, |
| 165 | {RT5677_GLB_CLK2 , 0x0000}, |
| 166 | {RT5677_ASRC_1 , 0x0000}, |
| 167 | {RT5677_ASRC_2 , 0x0000}, |
| 168 | {RT5677_ASRC_3 , 0x0000}, |
| 169 | {RT5677_ASRC_4 , 0x0000}, |
| 170 | {RT5677_ASRC_5 , 0x0000}, |
| 171 | {RT5677_ASRC_6 , 0x0000}, |
| 172 | {RT5677_ASRC_7 , 0x0000}, |
| 173 | {RT5677_ASRC_8 , 0x0000}, |
| 174 | {RT5677_ASRC_9 , 0x0000}, |
| 175 | {RT5677_ASRC_10 , 0x0000}, |
| 176 | {RT5677_ASRC_11 , 0x0000}, |
Oder Chiou | 86ae04b | 2014-11-17 10:18:11 +0800 | [diff] [blame] | 177 | {RT5677_ASRC_12 , 0x0018}, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 178 | {RT5677_ASRC_13 , 0x0000}, |
| 179 | {RT5677_ASRC_14 , 0x0000}, |
| 180 | {RT5677_ASRC_15 , 0x0000}, |
| 181 | {RT5677_ASRC_16 , 0x0000}, |
| 182 | {RT5677_ASRC_17 , 0x0000}, |
| 183 | {RT5677_ASRC_18 , 0x0000}, |
| 184 | {RT5677_ASRC_19 , 0x0000}, |
| 185 | {RT5677_ASRC_20 , 0x0000}, |
| 186 | {RT5677_ASRC_21 , 0x000c}, |
| 187 | {RT5677_ASRC_22 , 0x0000}, |
| 188 | {RT5677_ASRC_23 , 0x0000}, |
| 189 | {RT5677_VAD_CTRL1 , 0x2184}, |
| 190 | {RT5677_VAD_CTRL2 , 0x010a}, |
| 191 | {RT5677_VAD_CTRL3 , 0x0aea}, |
| 192 | {RT5677_VAD_CTRL4 , 0x000c}, |
| 193 | {RT5677_VAD_CTRL5 , 0x0000}, |
| 194 | {RT5677_DSP_INB_CTRL1 , 0x0000}, |
| 195 | {RT5677_DSP_INB_CTRL2 , 0x0000}, |
| 196 | {RT5677_DSP_IN_OUTB_CTRL , 0x0000}, |
| 197 | {RT5677_DSP_OUTB0_1_DIG_VOL , 0x2f2f}, |
| 198 | {RT5677_DSP_OUTB2_3_DIG_VOL , 0x2f2f}, |
| 199 | {RT5677_DSP_OUTB4_5_DIG_VOL , 0x2f2f}, |
| 200 | {RT5677_DSP_OUTB6_7_DIG_VOL , 0x2f2f}, |
| 201 | {RT5677_ADC_EQ_CTRL1 , 0x6000}, |
| 202 | {RT5677_ADC_EQ_CTRL2 , 0x0000}, |
| 203 | {RT5677_EQ_CTRL1 , 0xc000}, |
| 204 | {RT5677_EQ_CTRL2 , 0x0000}, |
| 205 | {RT5677_EQ_CTRL3 , 0x0000}, |
| 206 | {RT5677_SOFT_VOL_ZERO_CROSS1 , 0x0009}, |
| 207 | {RT5677_JD_CTRL1 , 0x0000}, |
| 208 | {RT5677_JD_CTRL2 , 0x0000}, |
| 209 | {RT5677_JD_CTRL3 , 0x0000}, |
| 210 | {RT5677_IRQ_CTRL1 , 0x0000}, |
| 211 | {RT5677_IRQ_CTRL2 , 0x0000}, |
| 212 | {RT5677_GPIO_ST , 0x0000}, |
| 213 | {RT5677_GPIO_CTRL1 , 0x0000}, |
| 214 | {RT5677_GPIO_CTRL2 , 0x0000}, |
| 215 | {RT5677_GPIO_CTRL3 , 0x0000}, |
| 216 | {RT5677_STO1_ADC_HI_FILTER1 , 0xb320}, |
| 217 | {RT5677_STO1_ADC_HI_FILTER2 , 0x0000}, |
| 218 | {RT5677_MONO_ADC_HI_FILTER1 , 0xb300}, |
| 219 | {RT5677_MONO_ADC_HI_FILTER2 , 0x0000}, |
| 220 | {RT5677_STO2_ADC_HI_FILTER1 , 0xb300}, |
| 221 | {RT5677_STO2_ADC_HI_FILTER2 , 0x0000}, |
| 222 | {RT5677_STO3_ADC_HI_FILTER1 , 0xb300}, |
| 223 | {RT5677_STO3_ADC_HI_FILTER2 , 0x0000}, |
| 224 | {RT5677_STO4_ADC_HI_FILTER1 , 0xb300}, |
| 225 | {RT5677_STO4_ADC_HI_FILTER2 , 0x0000}, |
| 226 | {RT5677_MB_DRC_CTRL1 , 0x0f20}, |
| 227 | {RT5677_DRC1_CTRL1 , 0x001f}, |
| 228 | {RT5677_DRC1_CTRL2 , 0x020c}, |
| 229 | {RT5677_DRC1_CTRL3 , 0x1f00}, |
| 230 | {RT5677_DRC1_CTRL4 , 0x0000}, |
| 231 | {RT5677_DRC1_CTRL5 , 0x0000}, |
| 232 | {RT5677_DRC1_CTRL6 , 0x0029}, |
| 233 | {RT5677_DRC2_CTRL1 , 0x001f}, |
| 234 | {RT5677_DRC2_CTRL2 , 0x020c}, |
| 235 | {RT5677_DRC2_CTRL3 , 0x1f00}, |
| 236 | {RT5677_DRC2_CTRL4 , 0x0000}, |
| 237 | {RT5677_DRC2_CTRL5 , 0x0000}, |
| 238 | {RT5677_DRC2_CTRL6 , 0x0029}, |
| 239 | {RT5677_DRC1_HL_CTRL1 , 0x8000}, |
| 240 | {RT5677_DRC1_HL_CTRL2 , 0x0200}, |
| 241 | {RT5677_DRC2_HL_CTRL1 , 0x8000}, |
| 242 | {RT5677_DRC2_HL_CTRL2 , 0x0200}, |
| 243 | {RT5677_DSP_INB1_SRC_CTRL1 , 0x5800}, |
| 244 | {RT5677_DSP_INB1_SRC_CTRL2 , 0x0000}, |
| 245 | {RT5677_DSP_INB1_SRC_CTRL3 , 0x0000}, |
| 246 | {RT5677_DSP_INB1_SRC_CTRL4 , 0x0800}, |
| 247 | {RT5677_DSP_INB2_SRC_CTRL1 , 0x5800}, |
| 248 | {RT5677_DSP_INB2_SRC_CTRL2 , 0x0000}, |
| 249 | {RT5677_DSP_INB2_SRC_CTRL3 , 0x0000}, |
| 250 | {RT5677_DSP_INB2_SRC_CTRL4 , 0x0800}, |
| 251 | {RT5677_DSP_INB3_SRC_CTRL1 , 0x5800}, |
| 252 | {RT5677_DSP_INB3_SRC_CTRL2 , 0x0000}, |
| 253 | {RT5677_DSP_INB3_SRC_CTRL3 , 0x0000}, |
| 254 | {RT5677_DSP_INB3_SRC_CTRL4 , 0x0800}, |
| 255 | {RT5677_DSP_OUTB1_SRC_CTRL1 , 0x5800}, |
| 256 | {RT5677_DSP_OUTB1_SRC_CTRL2 , 0x0000}, |
| 257 | {RT5677_DSP_OUTB1_SRC_CTRL3 , 0x0000}, |
| 258 | {RT5677_DSP_OUTB1_SRC_CTRL4 , 0x0800}, |
| 259 | {RT5677_DSP_OUTB2_SRC_CTRL1 , 0x5800}, |
| 260 | {RT5677_DSP_OUTB2_SRC_CTRL2 , 0x0000}, |
| 261 | {RT5677_DSP_OUTB2_SRC_CTRL3 , 0x0000}, |
| 262 | {RT5677_DSP_OUTB2_SRC_CTRL4 , 0x0800}, |
| 263 | {RT5677_DSP_OUTB_0123_MIXER_CTRL, 0xfefe}, |
| 264 | {RT5677_DSP_OUTB_45_MIXER_CTRL , 0xfefe}, |
| 265 | {RT5677_DSP_OUTB_67_MIXER_CTRL , 0xfefe}, |
| 266 | {RT5677_DIG_MISC , 0x0000}, |
| 267 | {RT5677_GEN_CTRL1 , 0x0000}, |
| 268 | {RT5677_GEN_CTRL2 , 0x0000}, |
| 269 | {RT5677_VENDOR_ID , 0x0000}, |
| 270 | {RT5677_VENDOR_ID1 , 0x10ec}, |
| 271 | {RT5677_VENDOR_ID2 , 0x6327}, |
| 272 | }; |
| 273 | |
| 274 | static bool rt5677_volatile_register(struct device *dev, unsigned int reg) |
| 275 | { |
| 276 | int i; |
| 277 | |
| 278 | for (i = 0; i < ARRAY_SIZE(rt5677_ranges); i++) { |
| 279 | if (reg >= rt5677_ranges[i].range_min && |
| 280 | reg <= rt5677_ranges[i].range_max) { |
| 281 | return true; |
| 282 | } |
| 283 | } |
| 284 | |
| 285 | switch (reg) { |
| 286 | case RT5677_RESET: |
| 287 | case RT5677_SLIMBUS_PARAM: |
| 288 | case RT5677_PDM_DATA_CTRL1: |
| 289 | case RT5677_PDM_DATA_CTRL2: |
| 290 | case RT5677_PDM1_DATA_CTRL4: |
| 291 | case RT5677_PDM2_DATA_CTRL4: |
| 292 | case RT5677_I2C_MASTER_CTRL1: |
| 293 | case RT5677_I2C_MASTER_CTRL7: |
| 294 | case RT5677_I2C_MASTER_CTRL8: |
| 295 | case RT5677_HAP_GENE_CTRL2: |
| 296 | case RT5677_PWR_DSP_ST: |
| 297 | case RT5677_PRIV_DATA: |
| 298 | case RT5677_PLL1_CTRL2: |
| 299 | case RT5677_PLL2_CTRL2: |
| 300 | case RT5677_ASRC_22: |
| 301 | case RT5677_ASRC_23: |
| 302 | case RT5677_VAD_CTRL5: |
| 303 | case RT5677_ADC_EQ_CTRL1: |
| 304 | case RT5677_EQ_CTRL1: |
| 305 | case RT5677_IRQ_CTRL1: |
| 306 | case RT5677_IRQ_CTRL2: |
| 307 | case RT5677_GPIO_ST: |
| 308 | case RT5677_DSP_INB1_SRC_CTRL4: |
| 309 | case RT5677_DSP_INB2_SRC_CTRL4: |
| 310 | case RT5677_DSP_INB3_SRC_CTRL4: |
| 311 | case RT5677_DSP_OUTB1_SRC_CTRL4: |
| 312 | case RT5677_DSP_OUTB2_SRC_CTRL4: |
| 313 | case RT5677_VENDOR_ID: |
| 314 | case RT5677_VENDOR_ID1: |
| 315 | case RT5677_VENDOR_ID2: |
| 316 | return true; |
| 317 | default: |
| 318 | return false; |
| 319 | } |
| 320 | } |
| 321 | |
| 322 | static bool rt5677_readable_register(struct device *dev, unsigned int reg) |
| 323 | { |
| 324 | int i; |
| 325 | |
| 326 | for (i = 0; i < ARRAY_SIZE(rt5677_ranges); i++) { |
| 327 | if (reg >= rt5677_ranges[i].range_min && |
| 328 | reg <= rt5677_ranges[i].range_max) { |
| 329 | return true; |
| 330 | } |
| 331 | } |
| 332 | |
| 333 | switch (reg) { |
| 334 | case RT5677_RESET: |
| 335 | case RT5677_LOUT1: |
| 336 | case RT5677_IN1: |
| 337 | case RT5677_MICBIAS: |
| 338 | case RT5677_SLIMBUS_PARAM: |
| 339 | case RT5677_SLIMBUS_RX: |
| 340 | case RT5677_SLIMBUS_CTRL: |
| 341 | case RT5677_SIDETONE_CTRL: |
| 342 | case RT5677_ANA_DAC1_2_3_SRC: |
| 343 | case RT5677_IF_DSP_DAC3_4_MIXER: |
| 344 | case RT5677_DAC4_DIG_VOL: |
| 345 | case RT5677_DAC3_DIG_VOL: |
| 346 | case RT5677_DAC1_DIG_VOL: |
| 347 | case RT5677_DAC2_DIG_VOL: |
| 348 | case RT5677_IF_DSP_DAC2_MIXER: |
| 349 | case RT5677_STO1_ADC_DIG_VOL: |
| 350 | case RT5677_MONO_ADC_DIG_VOL: |
| 351 | case RT5677_STO1_2_ADC_BST: |
| 352 | case RT5677_STO2_ADC_DIG_VOL: |
| 353 | case RT5677_ADC_BST_CTRL2: |
| 354 | case RT5677_STO3_4_ADC_BST: |
| 355 | case RT5677_STO3_ADC_DIG_VOL: |
| 356 | case RT5677_STO4_ADC_DIG_VOL: |
| 357 | case RT5677_STO4_ADC_MIXER: |
| 358 | case RT5677_STO3_ADC_MIXER: |
| 359 | case RT5677_STO2_ADC_MIXER: |
| 360 | case RT5677_STO1_ADC_MIXER: |
| 361 | case RT5677_MONO_ADC_MIXER: |
| 362 | case RT5677_ADC_IF_DSP_DAC1_MIXER: |
| 363 | case RT5677_STO1_DAC_MIXER: |
| 364 | case RT5677_MONO_DAC_MIXER: |
| 365 | case RT5677_DD1_MIXER: |
| 366 | case RT5677_DD2_MIXER: |
| 367 | case RT5677_IF3_DATA: |
| 368 | case RT5677_IF4_DATA: |
| 369 | case RT5677_PDM_OUT_CTRL: |
| 370 | case RT5677_PDM_DATA_CTRL1: |
| 371 | case RT5677_PDM_DATA_CTRL2: |
| 372 | case RT5677_PDM1_DATA_CTRL2: |
| 373 | case RT5677_PDM1_DATA_CTRL3: |
| 374 | case RT5677_PDM1_DATA_CTRL4: |
| 375 | case RT5677_PDM2_DATA_CTRL2: |
| 376 | case RT5677_PDM2_DATA_CTRL3: |
| 377 | case RT5677_PDM2_DATA_CTRL4: |
| 378 | case RT5677_TDM1_CTRL1: |
| 379 | case RT5677_TDM1_CTRL2: |
| 380 | case RT5677_TDM1_CTRL3: |
| 381 | case RT5677_TDM1_CTRL4: |
| 382 | case RT5677_TDM1_CTRL5: |
| 383 | case RT5677_TDM2_CTRL1: |
| 384 | case RT5677_TDM2_CTRL2: |
| 385 | case RT5677_TDM2_CTRL3: |
| 386 | case RT5677_TDM2_CTRL4: |
| 387 | case RT5677_TDM2_CTRL5: |
| 388 | case RT5677_I2C_MASTER_CTRL1: |
| 389 | case RT5677_I2C_MASTER_CTRL2: |
| 390 | case RT5677_I2C_MASTER_CTRL3: |
| 391 | case RT5677_I2C_MASTER_CTRL4: |
| 392 | case RT5677_I2C_MASTER_CTRL5: |
| 393 | case RT5677_I2C_MASTER_CTRL6: |
| 394 | case RT5677_I2C_MASTER_CTRL7: |
| 395 | case RT5677_I2C_MASTER_CTRL8: |
| 396 | case RT5677_DMIC_CTRL1: |
| 397 | case RT5677_DMIC_CTRL2: |
| 398 | case RT5677_HAP_GENE_CTRL1: |
| 399 | case RT5677_HAP_GENE_CTRL2: |
| 400 | case RT5677_HAP_GENE_CTRL3: |
| 401 | case RT5677_HAP_GENE_CTRL4: |
| 402 | case RT5677_HAP_GENE_CTRL5: |
| 403 | case RT5677_HAP_GENE_CTRL6: |
| 404 | case RT5677_HAP_GENE_CTRL7: |
| 405 | case RT5677_HAP_GENE_CTRL8: |
| 406 | case RT5677_HAP_GENE_CTRL9: |
| 407 | case RT5677_HAP_GENE_CTRL10: |
| 408 | case RT5677_PWR_DIG1: |
| 409 | case RT5677_PWR_DIG2: |
| 410 | case RT5677_PWR_ANLG1: |
| 411 | case RT5677_PWR_ANLG2: |
| 412 | case RT5677_PWR_DSP1: |
| 413 | case RT5677_PWR_DSP_ST: |
| 414 | case RT5677_PWR_DSP2: |
| 415 | case RT5677_ADC_DAC_HPF_CTRL1: |
| 416 | case RT5677_PRIV_INDEX: |
| 417 | case RT5677_PRIV_DATA: |
| 418 | case RT5677_I2S4_SDP: |
| 419 | case RT5677_I2S1_SDP: |
| 420 | case RT5677_I2S2_SDP: |
| 421 | case RT5677_I2S3_SDP: |
| 422 | case RT5677_CLK_TREE_CTRL1: |
| 423 | case RT5677_CLK_TREE_CTRL2: |
| 424 | case RT5677_CLK_TREE_CTRL3: |
| 425 | case RT5677_PLL1_CTRL1: |
| 426 | case RT5677_PLL1_CTRL2: |
| 427 | case RT5677_PLL2_CTRL1: |
| 428 | case RT5677_PLL2_CTRL2: |
| 429 | case RT5677_GLB_CLK1: |
| 430 | case RT5677_GLB_CLK2: |
| 431 | case RT5677_ASRC_1: |
| 432 | case RT5677_ASRC_2: |
| 433 | case RT5677_ASRC_3: |
| 434 | case RT5677_ASRC_4: |
| 435 | case RT5677_ASRC_5: |
| 436 | case RT5677_ASRC_6: |
| 437 | case RT5677_ASRC_7: |
| 438 | case RT5677_ASRC_8: |
| 439 | case RT5677_ASRC_9: |
| 440 | case RT5677_ASRC_10: |
| 441 | case RT5677_ASRC_11: |
| 442 | case RT5677_ASRC_12: |
| 443 | case RT5677_ASRC_13: |
| 444 | case RT5677_ASRC_14: |
| 445 | case RT5677_ASRC_15: |
| 446 | case RT5677_ASRC_16: |
| 447 | case RT5677_ASRC_17: |
| 448 | case RT5677_ASRC_18: |
| 449 | case RT5677_ASRC_19: |
| 450 | case RT5677_ASRC_20: |
| 451 | case RT5677_ASRC_21: |
| 452 | case RT5677_ASRC_22: |
| 453 | case RT5677_ASRC_23: |
| 454 | case RT5677_VAD_CTRL1: |
| 455 | case RT5677_VAD_CTRL2: |
| 456 | case RT5677_VAD_CTRL3: |
| 457 | case RT5677_VAD_CTRL4: |
| 458 | case RT5677_VAD_CTRL5: |
| 459 | case RT5677_DSP_INB_CTRL1: |
| 460 | case RT5677_DSP_INB_CTRL2: |
| 461 | case RT5677_DSP_IN_OUTB_CTRL: |
| 462 | case RT5677_DSP_OUTB0_1_DIG_VOL: |
| 463 | case RT5677_DSP_OUTB2_3_DIG_VOL: |
| 464 | case RT5677_DSP_OUTB4_5_DIG_VOL: |
| 465 | case RT5677_DSP_OUTB6_7_DIG_VOL: |
| 466 | case RT5677_ADC_EQ_CTRL1: |
| 467 | case RT5677_ADC_EQ_CTRL2: |
| 468 | case RT5677_EQ_CTRL1: |
| 469 | case RT5677_EQ_CTRL2: |
| 470 | case RT5677_EQ_CTRL3: |
| 471 | case RT5677_SOFT_VOL_ZERO_CROSS1: |
| 472 | case RT5677_JD_CTRL1: |
| 473 | case RT5677_JD_CTRL2: |
| 474 | case RT5677_JD_CTRL3: |
| 475 | case RT5677_IRQ_CTRL1: |
| 476 | case RT5677_IRQ_CTRL2: |
| 477 | case RT5677_GPIO_ST: |
| 478 | case RT5677_GPIO_CTRL1: |
| 479 | case RT5677_GPIO_CTRL2: |
| 480 | case RT5677_GPIO_CTRL3: |
| 481 | case RT5677_STO1_ADC_HI_FILTER1: |
| 482 | case RT5677_STO1_ADC_HI_FILTER2: |
| 483 | case RT5677_MONO_ADC_HI_FILTER1: |
| 484 | case RT5677_MONO_ADC_HI_FILTER2: |
| 485 | case RT5677_STO2_ADC_HI_FILTER1: |
| 486 | case RT5677_STO2_ADC_HI_FILTER2: |
| 487 | case RT5677_STO3_ADC_HI_FILTER1: |
| 488 | case RT5677_STO3_ADC_HI_FILTER2: |
| 489 | case RT5677_STO4_ADC_HI_FILTER1: |
| 490 | case RT5677_STO4_ADC_HI_FILTER2: |
| 491 | case RT5677_MB_DRC_CTRL1: |
| 492 | case RT5677_DRC1_CTRL1: |
| 493 | case RT5677_DRC1_CTRL2: |
| 494 | case RT5677_DRC1_CTRL3: |
| 495 | case RT5677_DRC1_CTRL4: |
| 496 | case RT5677_DRC1_CTRL5: |
| 497 | case RT5677_DRC1_CTRL6: |
| 498 | case RT5677_DRC2_CTRL1: |
| 499 | case RT5677_DRC2_CTRL2: |
| 500 | case RT5677_DRC2_CTRL3: |
| 501 | case RT5677_DRC2_CTRL4: |
| 502 | case RT5677_DRC2_CTRL5: |
| 503 | case RT5677_DRC2_CTRL6: |
| 504 | case RT5677_DRC1_HL_CTRL1: |
| 505 | case RT5677_DRC1_HL_CTRL2: |
| 506 | case RT5677_DRC2_HL_CTRL1: |
| 507 | case RT5677_DRC2_HL_CTRL2: |
| 508 | case RT5677_DSP_INB1_SRC_CTRL1: |
| 509 | case RT5677_DSP_INB1_SRC_CTRL2: |
| 510 | case RT5677_DSP_INB1_SRC_CTRL3: |
| 511 | case RT5677_DSP_INB1_SRC_CTRL4: |
| 512 | case RT5677_DSP_INB2_SRC_CTRL1: |
| 513 | case RT5677_DSP_INB2_SRC_CTRL2: |
| 514 | case RT5677_DSP_INB2_SRC_CTRL3: |
| 515 | case RT5677_DSP_INB2_SRC_CTRL4: |
| 516 | case RT5677_DSP_INB3_SRC_CTRL1: |
| 517 | case RT5677_DSP_INB3_SRC_CTRL2: |
| 518 | case RT5677_DSP_INB3_SRC_CTRL3: |
| 519 | case RT5677_DSP_INB3_SRC_CTRL4: |
| 520 | case RT5677_DSP_OUTB1_SRC_CTRL1: |
| 521 | case RT5677_DSP_OUTB1_SRC_CTRL2: |
| 522 | case RT5677_DSP_OUTB1_SRC_CTRL3: |
| 523 | case RT5677_DSP_OUTB1_SRC_CTRL4: |
| 524 | case RT5677_DSP_OUTB2_SRC_CTRL1: |
| 525 | case RT5677_DSP_OUTB2_SRC_CTRL2: |
| 526 | case RT5677_DSP_OUTB2_SRC_CTRL3: |
| 527 | case RT5677_DSP_OUTB2_SRC_CTRL4: |
| 528 | case RT5677_DSP_OUTB_0123_MIXER_CTRL: |
| 529 | case RT5677_DSP_OUTB_45_MIXER_CTRL: |
| 530 | case RT5677_DSP_OUTB_67_MIXER_CTRL: |
| 531 | case RT5677_DIG_MISC: |
| 532 | case RT5677_GEN_CTRL1: |
| 533 | case RT5677_GEN_CTRL2: |
| 534 | case RT5677_VENDOR_ID: |
| 535 | case RT5677_VENDOR_ID1: |
| 536 | case RT5677_VENDOR_ID2: |
| 537 | return true; |
| 538 | default: |
| 539 | return false; |
| 540 | } |
| 541 | } |
| 542 | |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 543 | /** |
| 544 | * rt5677_dsp_mode_i2c_write_addr - Write value to address on DSP mode. |
Oder Chiou | 19ba484 | 2014-11-05 13:42:53 +0800 | [diff] [blame] | 545 | * @rt5677: Private Data. |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 546 | * @addr: Address index. |
| 547 | * @value: Address data. |
| 548 | * |
| 549 | * |
| 550 | * Returns 0 for success or negative error code. |
| 551 | */ |
Oder Chiou | 19ba484 | 2014-11-05 13:42:53 +0800 | [diff] [blame] | 552 | static int rt5677_dsp_mode_i2c_write_addr(struct rt5677_priv *rt5677, |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 553 | unsigned int addr, unsigned int value, unsigned int opcode) |
| 554 | { |
Oder Chiou | 19ba484 | 2014-11-05 13:42:53 +0800 | [diff] [blame] | 555 | struct snd_soc_codec *codec = rt5677->codec; |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 556 | int ret; |
| 557 | |
| 558 | mutex_lock(&rt5677->dsp_cmd_lock); |
| 559 | |
Oder Chiou | 19ba484 | 2014-11-05 13:42:53 +0800 | [diff] [blame] | 560 | ret = regmap_write(rt5677->regmap_physical, RT5677_DSP_I2C_ADDR_MSB, |
| 561 | addr >> 16); |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 562 | if (ret < 0) { |
| 563 | dev_err(codec->dev, "Failed to set addr msb value: %d\n", ret); |
| 564 | goto err; |
| 565 | } |
| 566 | |
Oder Chiou | 19ba484 | 2014-11-05 13:42:53 +0800 | [diff] [blame] | 567 | ret = regmap_write(rt5677->regmap_physical, RT5677_DSP_I2C_ADDR_LSB, |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 568 | addr & 0xffff); |
| 569 | if (ret < 0) { |
| 570 | dev_err(codec->dev, "Failed to set addr lsb value: %d\n", ret); |
| 571 | goto err; |
| 572 | } |
| 573 | |
Oder Chiou | 19ba484 | 2014-11-05 13:42:53 +0800 | [diff] [blame] | 574 | ret = regmap_write(rt5677->regmap_physical, RT5677_DSP_I2C_DATA_MSB, |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 575 | value >> 16); |
| 576 | if (ret < 0) { |
| 577 | dev_err(codec->dev, "Failed to set data msb value: %d\n", ret); |
| 578 | goto err; |
| 579 | } |
| 580 | |
Oder Chiou | 19ba484 | 2014-11-05 13:42:53 +0800 | [diff] [blame] | 581 | ret = regmap_write(rt5677->regmap_physical, RT5677_DSP_I2C_DATA_LSB, |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 582 | value & 0xffff); |
| 583 | if (ret < 0) { |
| 584 | dev_err(codec->dev, "Failed to set data lsb value: %d\n", ret); |
| 585 | goto err; |
| 586 | } |
| 587 | |
Oder Chiou | 19ba484 | 2014-11-05 13:42:53 +0800 | [diff] [blame] | 588 | ret = regmap_write(rt5677->regmap_physical, RT5677_DSP_I2C_OP_CODE, |
| 589 | opcode); |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 590 | if (ret < 0) { |
| 591 | dev_err(codec->dev, "Failed to set op code value: %d\n", ret); |
| 592 | goto err; |
| 593 | } |
| 594 | |
| 595 | err: |
| 596 | mutex_unlock(&rt5677->dsp_cmd_lock); |
| 597 | |
| 598 | return ret; |
| 599 | } |
| 600 | |
| 601 | /** |
| 602 | * rt5677_dsp_mode_i2c_read_addr - Read value from address on DSP mode. |
Oder Chiou | 19ba484 | 2014-11-05 13:42:53 +0800 | [diff] [blame] | 603 | * rt5677: Private Data. |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 604 | * @addr: Address index. |
| 605 | * @value: Address data. |
| 606 | * |
Oder Chiou | 19ba484 | 2014-11-05 13:42:53 +0800 | [diff] [blame] | 607 | * |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 608 | * Returns 0 for success or negative error code. |
| 609 | */ |
| 610 | static int rt5677_dsp_mode_i2c_read_addr( |
Oder Chiou | 19ba484 | 2014-11-05 13:42:53 +0800 | [diff] [blame] | 611 | struct rt5677_priv *rt5677, unsigned int addr, unsigned int *value) |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 612 | { |
Oder Chiou | 19ba484 | 2014-11-05 13:42:53 +0800 | [diff] [blame] | 613 | struct snd_soc_codec *codec = rt5677->codec; |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 614 | int ret; |
| 615 | unsigned int msb, lsb; |
| 616 | |
| 617 | mutex_lock(&rt5677->dsp_cmd_lock); |
| 618 | |
Oder Chiou | 19ba484 | 2014-11-05 13:42:53 +0800 | [diff] [blame] | 619 | ret = regmap_write(rt5677->regmap_physical, RT5677_DSP_I2C_ADDR_MSB, |
| 620 | addr >> 16); |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 621 | if (ret < 0) { |
| 622 | dev_err(codec->dev, "Failed to set addr msb value: %d\n", ret); |
| 623 | goto err; |
| 624 | } |
| 625 | |
Oder Chiou | 19ba484 | 2014-11-05 13:42:53 +0800 | [diff] [blame] | 626 | ret = regmap_write(rt5677->regmap_physical, RT5677_DSP_I2C_ADDR_LSB, |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 627 | addr & 0xffff); |
| 628 | if (ret < 0) { |
| 629 | dev_err(codec->dev, "Failed to set addr lsb value: %d\n", ret); |
| 630 | goto err; |
| 631 | } |
| 632 | |
Oder Chiou | 19ba484 | 2014-11-05 13:42:53 +0800 | [diff] [blame] | 633 | ret = regmap_write(rt5677->regmap_physical, RT5677_DSP_I2C_OP_CODE, |
| 634 | 0x0002); |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 635 | if (ret < 0) { |
| 636 | dev_err(codec->dev, "Failed to set op code value: %d\n", ret); |
| 637 | goto err; |
| 638 | } |
| 639 | |
Oder Chiou | 19ba484 | 2014-11-05 13:42:53 +0800 | [diff] [blame] | 640 | regmap_read(rt5677->regmap_physical, RT5677_DSP_I2C_DATA_MSB, &msb); |
| 641 | regmap_read(rt5677->regmap_physical, RT5677_DSP_I2C_DATA_LSB, &lsb); |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 642 | *value = (msb << 16) | lsb; |
| 643 | |
| 644 | err: |
| 645 | mutex_unlock(&rt5677->dsp_cmd_lock); |
| 646 | |
| 647 | return ret; |
| 648 | } |
| 649 | |
| 650 | /** |
| 651 | * rt5677_dsp_mode_i2c_write - Write register on DSP mode. |
Oder Chiou | 19ba484 | 2014-11-05 13:42:53 +0800 | [diff] [blame] | 652 | * rt5677: Private Data. |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 653 | * @reg: Register index. |
| 654 | * @value: Register data. |
| 655 | * |
| 656 | * |
| 657 | * Returns 0 for success or negative error code. |
| 658 | */ |
Oder Chiou | 19ba484 | 2014-11-05 13:42:53 +0800 | [diff] [blame] | 659 | static int rt5677_dsp_mode_i2c_write(struct rt5677_priv *rt5677, |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 660 | unsigned int reg, unsigned int value) |
| 661 | { |
Oder Chiou | 19ba484 | 2014-11-05 13:42:53 +0800 | [diff] [blame] | 662 | return rt5677_dsp_mode_i2c_write_addr(rt5677, 0x18020000 + reg * 2, |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 663 | value, 0x0001); |
| 664 | } |
| 665 | |
| 666 | /** |
| 667 | * rt5677_dsp_mode_i2c_read - Read register on DSP mode. |
| 668 | * @codec: SoC audio codec device. |
| 669 | * @reg: Register index. |
Oder Chiou | 19ba484 | 2014-11-05 13:42:53 +0800 | [diff] [blame] | 670 | * @value: Register data. |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 671 | * |
| 672 | * |
Oder Chiou | 19ba484 | 2014-11-05 13:42:53 +0800 | [diff] [blame] | 673 | * Returns 0 for success or negative error code. |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 674 | */ |
Oder Chiou | 19ba484 | 2014-11-05 13:42:53 +0800 | [diff] [blame] | 675 | static int rt5677_dsp_mode_i2c_read( |
| 676 | struct rt5677_priv *rt5677, unsigned int reg, unsigned int *value) |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 677 | { |
Oder Chiou | 19ba484 | 2014-11-05 13:42:53 +0800 | [diff] [blame] | 678 | int ret = rt5677_dsp_mode_i2c_read_addr(rt5677, 0x18020000 + reg * 2, |
| 679 | value); |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 680 | |
Oder Chiou | 19ba484 | 2014-11-05 13:42:53 +0800 | [diff] [blame] | 681 | *value &= 0xffff; |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 682 | |
Oder Chiou | 19ba484 | 2014-11-05 13:42:53 +0800 | [diff] [blame] | 683 | return ret; |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 684 | } |
| 685 | |
Oder Chiou | 19ba484 | 2014-11-05 13:42:53 +0800 | [diff] [blame] | 686 | static void rt5677_set_dsp_mode(struct snd_soc_codec *codec, bool on) |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 687 | { |
Oder Chiou | 19ba484 | 2014-11-05 13:42:53 +0800 | [diff] [blame] | 688 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 689 | |
Oder Chiou | 19ba484 | 2014-11-05 13:42:53 +0800 | [diff] [blame] | 690 | if (on) { |
| 691 | regmap_update_bits(rt5677->regmap, RT5677_PWR_DSP1, 0x2, 0x2); |
| 692 | rt5677->is_dsp_mode = true; |
| 693 | } else { |
| 694 | regmap_update_bits(rt5677->regmap, RT5677_PWR_DSP1, 0x2, 0x0); |
| 695 | rt5677->is_dsp_mode = false; |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 696 | } |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 697 | } |
| 698 | |
| 699 | static int rt5677_set_dsp_vad(struct snd_soc_codec *codec, bool on) |
| 700 | { |
| 701 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); |
| 702 | static bool activity; |
| 703 | int ret; |
| 704 | |
Arnd Bergmann | 4c12112 | 2015-01-28 22:31:30 +0100 | [diff] [blame] | 705 | if (!IS_ENABLED(CONFIG_SND_SOC_RT5677_SPI)) |
| 706 | return -ENXIO; |
| 707 | |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 708 | if (on && !activity) { |
| 709 | activity = true; |
| 710 | |
| 711 | regcache_cache_only(rt5677->regmap, false); |
| 712 | regcache_cache_bypass(rt5677->regmap, true); |
| 713 | |
| 714 | regmap_update_bits(rt5677->regmap, RT5677_DIG_MISC, 0x1, 0x1); |
| 715 | regmap_update_bits(rt5677->regmap, |
| 716 | RT5677_PR_BASE + RT5677_BIAS_CUR4, 0x0f00, 0x0f00); |
| 717 | regmap_update_bits(rt5677->regmap, RT5677_PWR_ANLG1, |
| 718 | RT5677_LDO1_SEL_MASK, 0x0); |
| 719 | regmap_update_bits(rt5677->regmap, RT5677_PWR_ANLG2, |
| 720 | RT5677_PWR_LDO1, RT5677_PWR_LDO1); |
Oder Chiou | ab1f709 | 2015-02-11 19:18:51 +0800 | [diff] [blame] | 721 | switch (rt5677->type) { |
| 722 | case RT5677: |
| 723 | regmap_update_bits(rt5677->regmap, RT5677_GLB_CLK1, |
| 724 | RT5677_MCLK_SRC_MASK, RT5677_MCLK2_SRC); |
| 725 | regmap_update_bits(rt5677->regmap, RT5677_GLB_CLK2, |
| 726 | RT5677_PLL2_PR_SRC_MASK | |
| 727 | RT5677_DSP_CLK_SRC_MASK, |
| 728 | RT5677_PLL2_PR_SRC_MCLK2 | |
| 729 | RT5677_DSP_CLK_SRC_BYPASS); |
| 730 | break; |
| 731 | case RT5676: |
| 732 | regmap_update_bits(rt5677->regmap, RT5677_GLB_CLK2, |
| 733 | RT5677_DSP_CLK_SRC_MASK, |
| 734 | RT5677_DSP_CLK_SRC_BYPASS); |
| 735 | break; |
| 736 | default: |
| 737 | break; |
| 738 | } |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 739 | regmap_write(rt5677->regmap, RT5677_PWR_DSP2, 0x07ff); |
Oder Chiou | 19ba484 | 2014-11-05 13:42:53 +0800 | [diff] [blame] | 740 | regmap_write(rt5677->regmap, RT5677_PWR_DSP1, 0x07fd); |
| 741 | rt5677_set_dsp_mode(codec, true); |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 742 | |
| 743 | ret = request_firmware(&rt5677->fw1, RT5677_FIRMWARE1, |
| 744 | codec->dev); |
| 745 | if (ret == 0) { |
| 746 | rt5677_spi_burst_write(0x50000000, rt5677->fw1); |
| 747 | release_firmware(rt5677->fw1); |
| 748 | } |
| 749 | |
| 750 | ret = request_firmware(&rt5677->fw2, RT5677_FIRMWARE2, |
| 751 | codec->dev); |
| 752 | if (ret == 0) { |
| 753 | rt5677_spi_burst_write(0x60000000, rt5677->fw2); |
| 754 | release_firmware(rt5677->fw2); |
| 755 | } |
| 756 | |
Oder Chiou | 19ba484 | 2014-11-05 13:42:53 +0800 | [diff] [blame] | 757 | regmap_update_bits(rt5677->regmap, RT5677_PWR_DSP1, 0x1, 0x0); |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 758 | |
| 759 | regcache_cache_bypass(rt5677->regmap, false); |
| 760 | regcache_cache_only(rt5677->regmap, true); |
| 761 | } else if (!on && activity) { |
| 762 | activity = false; |
| 763 | |
| 764 | regcache_cache_only(rt5677->regmap, false); |
| 765 | regcache_cache_bypass(rt5677->regmap, true); |
| 766 | |
Oder Chiou | 19ba484 | 2014-11-05 13:42:53 +0800 | [diff] [blame] | 767 | regmap_update_bits(rt5677->regmap, RT5677_PWR_DSP1, 0x1, 0x1); |
| 768 | rt5677_set_dsp_mode(codec, false); |
| 769 | regmap_write(rt5677->regmap, RT5677_PWR_DSP1, 0x0001); |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 770 | |
| 771 | regmap_write(rt5677->regmap, RT5677_RESET, 0x10ec); |
| 772 | |
| 773 | regcache_cache_bypass(rt5677->regmap, false); |
| 774 | regcache_mark_dirty(rt5677->regmap); |
| 775 | regcache_sync(rt5677->regmap); |
| 776 | } |
| 777 | |
| 778 | return 0; |
| 779 | } |
| 780 | |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 781 | static const DECLARE_TLV_DB_SCALE(out_vol_tlv, -4650, 150, 0); |
Dylan Reid | 40e3262 | 2014-12-04 17:00:13 -0800 | [diff] [blame] | 782 | static const DECLARE_TLV_DB_SCALE(dac_vol_tlv, -6525, 75, 0); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 783 | static const DECLARE_TLV_DB_SCALE(in_vol_tlv, -3450, 150, 0); |
Dylan Reid | 40e3262 | 2014-12-04 17:00:13 -0800 | [diff] [blame] | 784 | static const DECLARE_TLV_DB_SCALE(adc_vol_tlv, -1725, 75, 0); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 785 | static const DECLARE_TLV_DB_SCALE(adc_bst_tlv, 0, 1200, 0); |
Oder Chiou | 90bdbb4 | 2014-09-18 14:45:59 +0800 | [diff] [blame] | 786 | static const DECLARE_TLV_DB_SCALE(st_vol_tlv, -4650, 150, 0); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 787 | |
| 788 | /* {0, +20, +24, +30, +35, +40, +44, +50, +52} dB */ |
| 789 | static unsigned int bst_tlv[] = { |
| 790 | TLV_DB_RANGE_HEAD(7), |
| 791 | 0, 0, TLV_DB_SCALE_ITEM(0, 0, 0), |
| 792 | 1, 1, TLV_DB_SCALE_ITEM(2000, 0, 0), |
| 793 | 2, 2, TLV_DB_SCALE_ITEM(2400, 0, 0), |
| 794 | 3, 5, TLV_DB_SCALE_ITEM(3000, 500, 0), |
| 795 | 6, 6, TLV_DB_SCALE_ITEM(4400, 0, 0), |
| 796 | 7, 7, TLV_DB_SCALE_ITEM(5000, 0, 0), |
| 797 | 8, 8, TLV_DB_SCALE_ITEM(5200, 0, 0), |
| 798 | }; |
| 799 | |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 800 | static int rt5677_dsp_vad_get(struct snd_kcontrol *kcontrol, |
| 801 | struct snd_ctl_elem_value *ucontrol) |
| 802 | { |
Fang, Yang A | 6087fca | 2014-12-23 23:49:05 -0400 | [diff] [blame] | 803 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 804 | struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component); |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 805 | |
| 806 | ucontrol->value.integer.value[0] = rt5677->dsp_vad_en; |
| 807 | |
| 808 | return 0; |
| 809 | } |
| 810 | |
| 811 | static int rt5677_dsp_vad_put(struct snd_kcontrol *kcontrol, |
| 812 | struct snd_ctl_elem_value *ucontrol) |
| 813 | { |
Fang, Yang A | 6087fca | 2014-12-23 23:49:05 -0400 | [diff] [blame] | 814 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 815 | struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component); |
| 816 | struct snd_soc_codec *codec = snd_soc_component_to_codec(component); |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 817 | |
| 818 | rt5677->dsp_vad_en = !!ucontrol->value.integer.value[0]; |
| 819 | |
| 820 | if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) |
| 821 | rt5677_set_dsp_vad(codec, rt5677->dsp_vad_en); |
| 822 | |
| 823 | return 0; |
| 824 | } |
| 825 | |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 826 | static const struct snd_kcontrol_new rt5677_snd_controls[] = { |
| 827 | /* OUTPUT Control */ |
| 828 | SOC_SINGLE("OUT1 Playback Switch", RT5677_LOUT1, |
| 829 | RT5677_LOUT1_L_MUTE_SFT, 1, 1), |
| 830 | SOC_SINGLE("OUT2 Playback Switch", RT5677_LOUT1, |
| 831 | RT5677_LOUT2_L_MUTE_SFT, 1, 1), |
| 832 | SOC_SINGLE("OUT3 Playback Switch", RT5677_LOUT1, |
| 833 | RT5677_LOUT3_L_MUTE_SFT, 1, 1), |
| 834 | |
| 835 | /* DAC Digital Volume */ |
| 836 | SOC_DOUBLE_TLV("DAC1 Playback Volume", RT5677_DAC1_DIG_VOL, |
Dylan Reid | 40e3262 | 2014-12-04 17:00:13 -0800 | [diff] [blame] | 837 | RT5677_L_VOL_SFT, RT5677_R_VOL_SFT, 87, 0, dac_vol_tlv), |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 838 | SOC_DOUBLE_TLV("DAC2 Playback Volume", RT5677_DAC2_DIG_VOL, |
Dylan Reid | 40e3262 | 2014-12-04 17:00:13 -0800 | [diff] [blame] | 839 | RT5677_L_VOL_SFT, RT5677_R_VOL_SFT, 87, 0, dac_vol_tlv), |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 840 | SOC_DOUBLE_TLV("DAC3 Playback Volume", RT5677_DAC3_DIG_VOL, |
Dylan Reid | 40e3262 | 2014-12-04 17:00:13 -0800 | [diff] [blame] | 841 | RT5677_L_VOL_SFT, RT5677_R_VOL_SFT, 87, 0, dac_vol_tlv), |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 842 | SOC_DOUBLE_TLV("DAC4 Playback Volume", RT5677_DAC4_DIG_VOL, |
Dylan Reid | 40e3262 | 2014-12-04 17:00:13 -0800 | [diff] [blame] | 843 | RT5677_L_VOL_SFT, RT5677_R_VOL_SFT, 87, 0, dac_vol_tlv), |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 844 | |
| 845 | /* IN1/IN2 Control */ |
| 846 | SOC_SINGLE_TLV("IN1 Boost", RT5677_IN1, RT5677_BST_SFT1, 8, 0, bst_tlv), |
| 847 | SOC_SINGLE_TLV("IN2 Boost", RT5677_IN1, RT5677_BST_SFT2, 8, 0, bst_tlv), |
| 848 | |
| 849 | /* ADC Digital Volume Control */ |
| 850 | SOC_DOUBLE("ADC1 Capture Switch", RT5677_STO1_ADC_DIG_VOL, |
| 851 | RT5677_L_MUTE_SFT, RT5677_R_MUTE_SFT, 1, 1), |
| 852 | SOC_DOUBLE("ADC2 Capture Switch", RT5677_STO2_ADC_DIG_VOL, |
| 853 | RT5677_L_MUTE_SFT, RT5677_R_MUTE_SFT, 1, 1), |
| 854 | SOC_DOUBLE("ADC3 Capture Switch", RT5677_STO3_ADC_DIG_VOL, |
| 855 | RT5677_L_MUTE_SFT, RT5677_R_MUTE_SFT, 1, 1), |
| 856 | SOC_DOUBLE("ADC4 Capture Switch", RT5677_STO4_ADC_DIG_VOL, |
| 857 | RT5677_L_MUTE_SFT, RT5677_R_MUTE_SFT, 1, 1), |
| 858 | SOC_DOUBLE("Mono ADC Capture Switch", RT5677_MONO_ADC_DIG_VOL, |
| 859 | RT5677_L_MUTE_SFT, RT5677_R_MUTE_SFT, 1, 1), |
| 860 | |
| 861 | SOC_DOUBLE_TLV("ADC1 Capture Volume", RT5677_STO1_ADC_DIG_VOL, |
Dylan Reid | 40e3262 | 2014-12-04 17:00:13 -0800 | [diff] [blame] | 862 | RT5677_STO1_ADC_L_VOL_SFT, RT5677_STO1_ADC_R_VOL_SFT, 63, 0, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 863 | adc_vol_tlv), |
| 864 | SOC_DOUBLE_TLV("ADC2 Capture Volume", RT5677_STO2_ADC_DIG_VOL, |
Dylan Reid | 40e3262 | 2014-12-04 17:00:13 -0800 | [diff] [blame] | 865 | RT5677_STO1_ADC_L_VOL_SFT, RT5677_STO1_ADC_R_VOL_SFT, 63, 0, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 866 | adc_vol_tlv), |
| 867 | SOC_DOUBLE_TLV("ADC3 Capture Volume", RT5677_STO3_ADC_DIG_VOL, |
Dylan Reid | 40e3262 | 2014-12-04 17:00:13 -0800 | [diff] [blame] | 868 | RT5677_STO1_ADC_L_VOL_SFT, RT5677_STO1_ADC_R_VOL_SFT, 63, 0, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 869 | adc_vol_tlv), |
| 870 | SOC_DOUBLE_TLV("ADC4 Capture Volume", RT5677_STO4_ADC_DIG_VOL, |
Dylan Reid | 40e3262 | 2014-12-04 17:00:13 -0800 | [diff] [blame] | 871 | RT5677_STO1_ADC_L_VOL_SFT, RT5677_STO1_ADC_R_VOL_SFT, 63, 0, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 872 | adc_vol_tlv), |
| 873 | SOC_DOUBLE_TLV("Mono ADC Capture Volume", RT5677_MONO_ADC_DIG_VOL, |
Dylan Reid | 40e3262 | 2014-12-04 17:00:13 -0800 | [diff] [blame] | 874 | RT5677_MONO_ADC_L_VOL_SFT, RT5677_MONO_ADC_R_VOL_SFT, 63, 0, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 875 | adc_vol_tlv), |
| 876 | |
Oder Chiou | 90bdbb4 | 2014-09-18 14:45:59 +0800 | [diff] [blame] | 877 | /* Sidetone Control */ |
| 878 | SOC_SINGLE_TLV("Sidetone Volume", RT5677_SIDETONE_CTRL, |
| 879 | RT5677_ST_VOL_SFT, 31, 0, st_vol_tlv), |
| 880 | |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 881 | /* ADC Boost Volume Control */ |
Oder Chiou | 80220f2 | 2014-06-10 14:35:25 +0800 | [diff] [blame] | 882 | SOC_DOUBLE_TLV("STO1 ADC Boost Volume", RT5677_STO1_2_ADC_BST, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 883 | RT5677_STO1_ADC_L_BST_SFT, RT5677_STO1_ADC_R_BST_SFT, 3, 0, |
| 884 | adc_bst_tlv), |
Oder Chiou | 80220f2 | 2014-06-10 14:35:25 +0800 | [diff] [blame] | 885 | SOC_DOUBLE_TLV("STO2 ADC Boost Volume", RT5677_STO1_2_ADC_BST, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 886 | RT5677_STO2_ADC_L_BST_SFT, RT5677_STO2_ADC_R_BST_SFT, 3, 0, |
| 887 | adc_bst_tlv), |
Oder Chiou | 80220f2 | 2014-06-10 14:35:25 +0800 | [diff] [blame] | 888 | SOC_DOUBLE_TLV("STO3 ADC Boost Volume", RT5677_STO3_4_ADC_BST, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 889 | RT5677_STO3_ADC_L_BST_SFT, RT5677_STO3_ADC_R_BST_SFT, 3, 0, |
| 890 | adc_bst_tlv), |
Oder Chiou | 80220f2 | 2014-06-10 14:35:25 +0800 | [diff] [blame] | 891 | SOC_DOUBLE_TLV("STO4 ADC Boost Volume", RT5677_STO3_4_ADC_BST, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 892 | RT5677_STO4_ADC_L_BST_SFT, RT5677_STO4_ADC_R_BST_SFT, 3, 0, |
| 893 | adc_bst_tlv), |
Oder Chiou | 80220f2 | 2014-06-10 14:35:25 +0800 | [diff] [blame] | 894 | SOC_DOUBLE_TLV("Mono ADC Boost Volume", RT5677_ADC_BST_CTRL2, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 895 | RT5677_MONO_ADC_L_BST_SFT, RT5677_MONO_ADC_R_BST_SFT, 3, 0, |
| 896 | adc_bst_tlv), |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 897 | |
| 898 | SOC_SINGLE_EXT("DSP VAD Switch", SND_SOC_NOPM, 0, 1, 0, |
| 899 | rt5677_dsp_vad_get, rt5677_dsp_vad_put), |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 900 | }; |
| 901 | |
| 902 | /** |
| 903 | * set_dmic_clk - Set parameter of dmic. |
| 904 | * |
| 905 | * @w: DAPM widget. |
| 906 | * @kcontrol: The kcontrol of this widget. |
| 907 | * @event: Event id. |
| 908 | * |
| 909 | * Choose dmic clock between 1MHz and 3MHz. |
| 910 | * It is better for clock to approximate 3MHz. |
| 911 | */ |
| 912 | static int set_dmic_clk(struct snd_soc_dapm_widget *w, |
| 913 | struct snd_kcontrol *kcontrol, int event) |
| 914 | { |
Lars-Peter Clausen | 46f2087 | 2015-01-15 12:52:16 +0100 | [diff] [blame] | 915 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 916 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); |
Axel Lin | 9a53581 | 2014-06-03 10:58:58 +0800 | [diff] [blame] | 917 | int idx = rl6231_calc_dmic_clk(rt5677->sysclk); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 918 | |
| 919 | if (idx < 0) |
| 920 | dev_err(codec->dev, "Failed to set DMIC clock\n"); |
| 921 | else |
| 922 | regmap_update_bits(rt5677->regmap, RT5677_DMIC_CTRL1, |
| 923 | RT5677_DMIC_CLK_MASK, idx << RT5677_DMIC_CLK_SFT); |
| 924 | return idx; |
| 925 | } |
| 926 | |
| 927 | static int is_sys_clk_from_pll(struct snd_soc_dapm_widget *source, |
| 928 | struct snd_soc_dapm_widget *sink) |
| 929 | { |
Lars-Peter Clausen | 46f2087 | 2015-01-15 12:52:16 +0100 | [diff] [blame] | 930 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm); |
| 931 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 932 | unsigned int val; |
| 933 | |
| 934 | regmap_read(rt5677->regmap, RT5677_GLB_CLK1, &val); |
| 935 | val &= RT5677_SCLK_SRC_MASK; |
| 936 | if (val == RT5677_SCLK_SRC_PLL1) |
| 937 | return 1; |
| 938 | else |
| 939 | return 0; |
| 940 | } |
| 941 | |
Oder Chiou | 5a8c7c2 | 2014-12-23 10:27:55 +0800 | [diff] [blame] | 942 | static int is_using_asrc(struct snd_soc_dapm_widget *source, |
| 943 | struct snd_soc_dapm_widget *sink) |
| 944 | { |
Lars-Peter Clausen | 46f2087 | 2015-01-15 12:52:16 +0100 | [diff] [blame] | 945 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm); |
Oder Chiou | e4b7e6a | 2015-01-13 11:13:14 +0800 | [diff] [blame] | 946 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); |
Oder Chiou | 5a8c7c2 | 2014-12-23 10:27:55 +0800 | [diff] [blame] | 947 | unsigned int reg, shift, val; |
| 948 | |
| 949 | if (source->reg == RT5677_ASRC_1) { |
| 950 | switch (source->shift) { |
| 951 | case 12: |
| 952 | reg = RT5677_ASRC_4; |
| 953 | shift = 0; |
| 954 | break; |
| 955 | case 13: |
| 956 | reg = RT5677_ASRC_4; |
| 957 | shift = 4; |
| 958 | break; |
| 959 | case 14: |
| 960 | reg = RT5677_ASRC_4; |
| 961 | shift = 8; |
| 962 | break; |
| 963 | case 15: |
| 964 | reg = RT5677_ASRC_4; |
| 965 | shift = 12; |
| 966 | break; |
| 967 | default: |
| 968 | return 0; |
| 969 | } |
| 970 | } else { |
| 971 | switch (source->shift) { |
| 972 | case 0: |
| 973 | reg = RT5677_ASRC_6; |
| 974 | shift = 8; |
| 975 | break; |
| 976 | case 1: |
| 977 | reg = RT5677_ASRC_6; |
| 978 | shift = 12; |
| 979 | break; |
| 980 | case 2: |
| 981 | reg = RT5677_ASRC_5; |
| 982 | shift = 0; |
| 983 | break; |
| 984 | case 3: |
| 985 | reg = RT5677_ASRC_5; |
| 986 | shift = 4; |
| 987 | break; |
| 988 | case 4: |
| 989 | reg = RT5677_ASRC_5; |
| 990 | shift = 8; |
| 991 | break; |
| 992 | case 5: |
| 993 | reg = RT5677_ASRC_5; |
| 994 | shift = 12; |
| 995 | break; |
| 996 | case 12: |
| 997 | reg = RT5677_ASRC_3; |
| 998 | shift = 0; |
| 999 | break; |
| 1000 | case 13: |
| 1001 | reg = RT5677_ASRC_3; |
| 1002 | shift = 4; |
| 1003 | break; |
| 1004 | case 14: |
| 1005 | reg = RT5677_ASRC_3; |
| 1006 | shift = 12; |
| 1007 | break; |
| 1008 | default: |
| 1009 | return 0; |
| 1010 | } |
| 1011 | } |
| 1012 | |
Oder Chiou | e4b7e6a | 2015-01-13 11:13:14 +0800 | [diff] [blame] | 1013 | regmap_read(rt5677->regmap, reg, &val); |
| 1014 | val = (val >> shift) & 0xf; |
| 1015 | |
Oder Chiou | 5a8c7c2 | 2014-12-23 10:27:55 +0800 | [diff] [blame] | 1016 | switch (val) { |
| 1017 | case 1 ... 6: |
| 1018 | return 1; |
| 1019 | default: |
| 1020 | return 0; |
| 1021 | } |
| 1022 | |
| 1023 | } |
| 1024 | |
| 1025 | static int can_use_asrc(struct snd_soc_dapm_widget *source, |
| 1026 | struct snd_soc_dapm_widget *sink) |
| 1027 | { |
| 1028 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm); |
| 1029 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); |
| 1030 | |
| 1031 | if (rt5677->sysclk > rt5677->lrck[RT5677_AIF1] * 384) |
| 1032 | return 1; |
| 1033 | |
| 1034 | return 0; |
| 1035 | } |
| 1036 | |
Oder Chiou | c36aa0a | 2015-03-16 14:39:57 +0800 | [diff] [blame] | 1037 | /** |
| 1038 | * rt5677_sel_asrc_clk_src - select ASRC clock source for a set of filters |
| 1039 | * @codec: SoC audio codec device. |
| 1040 | * @filter_mask: mask of filters. |
| 1041 | * @clk_src: clock source |
| 1042 | * |
| 1043 | * The ASRC function is for asynchronous MCLK and LRCK. Also, since RT5677 can |
| 1044 | * only support standard 32fs or 64fs i2s format, ASRC should be enabled to |
| 1045 | * support special i2s clock format such as Intel's 100fs(100 * sampling rate). |
| 1046 | * ASRC function will track i2s clock and generate a corresponding system clock |
| 1047 | * for codec. This function provides an API to select the clock source for a |
| 1048 | * set of filters specified by the mask. And the codec driver will turn on ASRC |
| 1049 | * for these filters if ASRC is selected as their clock source. |
| 1050 | */ |
| 1051 | int rt5677_sel_asrc_clk_src(struct snd_soc_codec *codec, |
| 1052 | unsigned int filter_mask, unsigned int clk_src) |
| 1053 | { |
| 1054 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); |
| 1055 | unsigned int asrc3_mask = 0, asrc3_value = 0; |
| 1056 | unsigned int asrc4_mask = 0, asrc4_value = 0; |
| 1057 | unsigned int asrc5_mask = 0, asrc5_value = 0; |
| 1058 | unsigned int asrc6_mask = 0, asrc6_value = 0; |
| 1059 | unsigned int asrc7_mask = 0, asrc7_value = 0; |
Bard Liao | 16ab6e1 | 2015-04-28 11:27:40 +0800 | [diff] [blame] | 1060 | unsigned int asrc8_mask = 0, asrc8_value = 0; |
Oder Chiou | c36aa0a | 2015-03-16 14:39:57 +0800 | [diff] [blame] | 1061 | |
| 1062 | switch (clk_src) { |
| 1063 | case RT5677_CLK_SEL_SYS: |
| 1064 | case RT5677_CLK_SEL_I2S1_ASRC: |
| 1065 | case RT5677_CLK_SEL_I2S2_ASRC: |
| 1066 | case RT5677_CLK_SEL_I2S3_ASRC: |
| 1067 | case RT5677_CLK_SEL_I2S4_ASRC: |
| 1068 | case RT5677_CLK_SEL_I2S5_ASRC: |
| 1069 | case RT5677_CLK_SEL_I2S6_ASRC: |
| 1070 | case RT5677_CLK_SEL_SYS2: |
| 1071 | case RT5677_CLK_SEL_SYS3: |
| 1072 | case RT5677_CLK_SEL_SYS4: |
| 1073 | case RT5677_CLK_SEL_SYS5: |
| 1074 | case RT5677_CLK_SEL_SYS6: |
| 1075 | case RT5677_CLK_SEL_SYS7: |
| 1076 | break; |
| 1077 | |
| 1078 | default: |
| 1079 | return -EINVAL; |
| 1080 | } |
| 1081 | |
| 1082 | /* ASRC 3 */ |
| 1083 | if (filter_mask & RT5677_DA_STEREO_FILTER) { |
| 1084 | asrc3_mask |= RT5677_DA_STO_CLK_SEL_MASK; |
| 1085 | asrc3_value = (asrc3_value & ~RT5677_DA_STO_CLK_SEL_MASK) |
| 1086 | | (clk_src << RT5677_DA_STO_CLK_SEL_SFT); |
| 1087 | } |
| 1088 | |
| 1089 | if (filter_mask & RT5677_DA_MONO2_L_FILTER) { |
| 1090 | asrc3_mask |= RT5677_DA_MONO2L_CLK_SEL_MASK; |
| 1091 | asrc3_value = (asrc3_value & ~RT5677_DA_MONO2L_CLK_SEL_MASK) |
| 1092 | | (clk_src << RT5677_DA_MONO2L_CLK_SEL_SFT); |
| 1093 | } |
| 1094 | |
| 1095 | if (filter_mask & RT5677_DA_MONO2_R_FILTER) { |
| 1096 | asrc3_mask |= RT5677_DA_MONO2R_CLK_SEL_MASK; |
| 1097 | asrc3_value = (asrc3_value & ~RT5677_DA_MONO2R_CLK_SEL_MASK) |
| 1098 | | (clk_src << RT5677_DA_MONO2R_CLK_SEL_SFT); |
| 1099 | } |
| 1100 | |
| 1101 | if (asrc3_mask) |
| 1102 | regmap_update_bits(rt5677->regmap, RT5677_ASRC_3, asrc3_mask, |
| 1103 | asrc3_value); |
| 1104 | |
| 1105 | /* ASRC 4 */ |
| 1106 | if (filter_mask & RT5677_DA_MONO3_L_FILTER) { |
| 1107 | asrc4_mask |= RT5677_DA_MONO3L_CLK_SEL_MASK; |
| 1108 | asrc4_value = (asrc4_value & ~RT5677_DA_MONO3L_CLK_SEL_MASK) |
| 1109 | | (clk_src << RT5677_DA_MONO3L_CLK_SEL_SFT); |
| 1110 | } |
| 1111 | |
| 1112 | if (filter_mask & RT5677_DA_MONO3_R_FILTER) { |
| 1113 | asrc4_mask |= RT5677_DA_MONO3R_CLK_SEL_MASK; |
| 1114 | asrc4_value = (asrc4_value & ~RT5677_DA_MONO3R_CLK_SEL_MASK) |
| 1115 | | (clk_src << RT5677_DA_MONO3R_CLK_SEL_SFT); |
| 1116 | } |
| 1117 | |
| 1118 | if (filter_mask & RT5677_DA_MONO4_L_FILTER) { |
| 1119 | asrc4_mask |= RT5677_DA_MONO4L_CLK_SEL_MASK; |
| 1120 | asrc4_value = (asrc4_value & ~RT5677_DA_MONO4L_CLK_SEL_MASK) |
| 1121 | | (clk_src << RT5677_DA_MONO4L_CLK_SEL_SFT); |
| 1122 | } |
| 1123 | |
| 1124 | if (filter_mask & RT5677_DA_MONO4_R_FILTER) { |
| 1125 | asrc4_mask |= RT5677_DA_MONO4R_CLK_SEL_MASK; |
| 1126 | asrc4_value = (asrc4_value & ~RT5677_DA_MONO4R_CLK_SEL_MASK) |
| 1127 | | (clk_src << RT5677_DA_MONO4R_CLK_SEL_SFT); |
| 1128 | } |
| 1129 | |
| 1130 | if (asrc4_mask) |
| 1131 | regmap_update_bits(rt5677->regmap, RT5677_ASRC_4, asrc4_mask, |
| 1132 | asrc4_value); |
| 1133 | |
| 1134 | /* ASRC 5 */ |
| 1135 | if (filter_mask & RT5677_AD_STEREO1_FILTER) { |
| 1136 | asrc5_mask |= RT5677_AD_STO1_CLK_SEL_MASK; |
| 1137 | asrc5_value = (asrc5_value & ~RT5677_AD_STO1_CLK_SEL_MASK) |
| 1138 | | (clk_src << RT5677_AD_STO1_CLK_SEL_SFT); |
| 1139 | } |
| 1140 | |
| 1141 | if (filter_mask & RT5677_AD_STEREO2_FILTER) { |
| 1142 | asrc5_mask |= RT5677_AD_STO2_CLK_SEL_MASK; |
| 1143 | asrc5_value = (asrc5_value & ~RT5677_AD_STO2_CLK_SEL_MASK) |
| 1144 | | (clk_src << RT5677_AD_STO2_CLK_SEL_SFT); |
| 1145 | } |
| 1146 | |
| 1147 | if (filter_mask & RT5677_AD_STEREO3_FILTER) { |
| 1148 | asrc5_mask |= RT5677_AD_STO3_CLK_SEL_MASK; |
| 1149 | asrc5_value = (asrc5_value & ~RT5677_AD_STO3_CLK_SEL_MASK) |
| 1150 | | (clk_src << RT5677_AD_STO3_CLK_SEL_SFT); |
| 1151 | } |
| 1152 | |
| 1153 | if (filter_mask & RT5677_AD_STEREO4_FILTER) { |
| 1154 | asrc5_mask |= RT5677_AD_STO4_CLK_SEL_MASK; |
| 1155 | asrc5_value = (asrc5_value & ~RT5677_AD_STO4_CLK_SEL_MASK) |
| 1156 | | (clk_src << RT5677_AD_STO4_CLK_SEL_SFT); |
| 1157 | } |
| 1158 | |
| 1159 | if (asrc5_mask) |
| 1160 | regmap_update_bits(rt5677->regmap, RT5677_ASRC_5, asrc5_mask, |
| 1161 | asrc5_value); |
| 1162 | |
| 1163 | /* ASRC 6 */ |
| 1164 | if (filter_mask & RT5677_AD_MONO_L_FILTER) { |
| 1165 | asrc6_mask |= RT5677_AD_MONOL_CLK_SEL_MASK; |
| 1166 | asrc6_value = (asrc6_value & ~RT5677_AD_MONOL_CLK_SEL_MASK) |
| 1167 | | (clk_src << RT5677_AD_MONOL_CLK_SEL_SFT); |
| 1168 | } |
| 1169 | |
| 1170 | if (filter_mask & RT5677_AD_MONO_R_FILTER) { |
| 1171 | asrc6_mask |= RT5677_AD_MONOR_CLK_SEL_MASK; |
| 1172 | asrc6_value = (asrc6_value & ~RT5677_AD_MONOR_CLK_SEL_MASK) |
| 1173 | | (clk_src << RT5677_AD_MONOR_CLK_SEL_SFT); |
| 1174 | } |
| 1175 | |
| 1176 | if (asrc6_mask) |
| 1177 | regmap_update_bits(rt5677->regmap, RT5677_ASRC_6, asrc6_mask, |
| 1178 | asrc6_value); |
| 1179 | |
| 1180 | /* ASRC 7 */ |
| 1181 | if (filter_mask & RT5677_DSP_OB_0_3_FILTER) { |
| 1182 | asrc7_mask |= RT5677_DSP_OB_0_3_CLK_SEL_MASK; |
| 1183 | asrc7_value = (asrc7_value & ~RT5677_DSP_OB_0_3_CLK_SEL_MASK) |
| 1184 | | (clk_src << RT5677_DSP_OB_0_3_CLK_SEL_SFT); |
| 1185 | } |
| 1186 | |
| 1187 | if (filter_mask & RT5677_DSP_OB_4_7_FILTER) { |
| 1188 | asrc7_mask |= RT5677_DSP_OB_4_7_CLK_SEL_MASK; |
| 1189 | asrc7_value = (asrc7_value & ~RT5677_DSP_OB_4_7_CLK_SEL_MASK) |
| 1190 | | (clk_src << RT5677_DSP_OB_4_7_CLK_SEL_SFT); |
| 1191 | } |
| 1192 | |
| 1193 | if (asrc7_mask) |
| 1194 | regmap_update_bits(rt5677->regmap, RT5677_ASRC_7, asrc7_mask, |
| 1195 | asrc7_value); |
| 1196 | |
Bard Liao | 16ab6e1 | 2015-04-28 11:27:40 +0800 | [diff] [blame] | 1197 | /* ASRC 8 */ |
| 1198 | if (filter_mask & RT5677_I2S1_SOURCE) { |
| 1199 | asrc8_mask |= RT5677_I2S1_CLK_SEL_MASK; |
| 1200 | asrc8_value = (asrc8_value & ~RT5677_I2S1_CLK_SEL_MASK) |
| 1201 | | ((clk_src - 1) << RT5677_I2S1_CLK_SEL_SFT); |
| 1202 | } |
| 1203 | |
| 1204 | if (filter_mask & RT5677_I2S2_SOURCE) { |
| 1205 | asrc8_mask |= RT5677_I2S2_CLK_SEL_MASK; |
| 1206 | asrc8_value = (asrc8_value & ~RT5677_I2S2_CLK_SEL_MASK) |
| 1207 | | ((clk_src - 1) << RT5677_I2S2_CLK_SEL_SFT); |
| 1208 | } |
| 1209 | |
| 1210 | if (filter_mask & RT5677_I2S3_SOURCE) { |
| 1211 | asrc8_mask |= RT5677_I2S3_CLK_SEL_MASK; |
| 1212 | asrc8_value = (asrc8_value & ~RT5677_I2S3_CLK_SEL_MASK) |
| 1213 | | ((clk_src - 1) << RT5677_I2S3_CLK_SEL_SFT); |
| 1214 | } |
| 1215 | |
| 1216 | if (filter_mask & RT5677_I2S4_SOURCE) { |
| 1217 | asrc8_mask |= RT5677_I2S4_CLK_SEL_MASK; |
| 1218 | asrc8_value = (asrc8_value & ~RT5677_I2S4_CLK_SEL_MASK) |
| 1219 | | ((clk_src - 1) << RT5677_I2S4_CLK_SEL_SFT); |
| 1220 | } |
| 1221 | |
| 1222 | if (asrc8_mask) |
| 1223 | regmap_update_bits(rt5677->regmap, RT5677_ASRC_8, asrc8_mask, |
| 1224 | asrc8_value); |
| 1225 | |
Oder Chiou | c36aa0a | 2015-03-16 14:39:57 +0800 | [diff] [blame] | 1226 | return 0; |
| 1227 | } |
| 1228 | EXPORT_SYMBOL_GPL(rt5677_sel_asrc_clk_src); |
| 1229 | |
Oder Chiou | 5220f7f | 2015-05-08 13:24:02 +0800 | [diff] [blame^] | 1230 | static int rt5677_dmic_use_asrc(struct snd_soc_dapm_widget *source, |
| 1231 | struct snd_soc_dapm_widget *sink) |
| 1232 | { |
| 1233 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm); |
| 1234 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); |
| 1235 | unsigned int asrc_setting; |
| 1236 | |
| 1237 | switch (source->shift) { |
| 1238 | case 11: |
| 1239 | regmap_read(rt5677->regmap, RT5677_ASRC_5, &asrc_setting); |
| 1240 | asrc_setting = (asrc_setting & RT5677_AD_STO1_CLK_SEL_MASK) >> |
| 1241 | RT5677_AD_STO1_CLK_SEL_SFT; |
| 1242 | if (asrc_setting >= RT5677_CLK_SEL_I2S1_ASRC && |
| 1243 | asrc_setting <= RT5677_CLK_SEL_I2S6_ASRC) |
| 1244 | return 1; |
| 1245 | break; |
| 1246 | |
| 1247 | case 10: |
| 1248 | regmap_read(rt5677->regmap, RT5677_ASRC_5, &asrc_setting); |
| 1249 | asrc_setting = (asrc_setting & RT5677_AD_STO2_CLK_SEL_MASK) >> |
| 1250 | RT5677_AD_STO2_CLK_SEL_SFT; |
| 1251 | if (asrc_setting >= RT5677_CLK_SEL_I2S1_ASRC && |
| 1252 | asrc_setting <= RT5677_CLK_SEL_I2S6_ASRC) |
| 1253 | return 1; |
| 1254 | break; |
| 1255 | |
| 1256 | case 9: |
| 1257 | regmap_read(rt5677->regmap, RT5677_ASRC_5, &asrc_setting); |
| 1258 | asrc_setting = (asrc_setting & RT5677_AD_STO3_CLK_SEL_MASK) >> |
| 1259 | RT5677_AD_STO3_CLK_SEL_SFT; |
| 1260 | if (asrc_setting >= RT5677_CLK_SEL_I2S1_ASRC && |
| 1261 | asrc_setting <= RT5677_CLK_SEL_I2S6_ASRC) |
| 1262 | return 1; |
| 1263 | break; |
| 1264 | |
| 1265 | case 8: |
| 1266 | regmap_read(rt5677->regmap, RT5677_ASRC_5, &asrc_setting); |
| 1267 | asrc_setting = (asrc_setting & RT5677_AD_STO4_CLK_SEL_MASK) >> |
| 1268 | RT5677_AD_STO4_CLK_SEL_SFT; |
| 1269 | if (asrc_setting >= RT5677_CLK_SEL_I2S1_ASRC && |
| 1270 | asrc_setting <= RT5677_CLK_SEL_I2S6_ASRC) |
| 1271 | return 1; |
| 1272 | break; |
| 1273 | |
| 1274 | case 7: |
| 1275 | regmap_read(rt5677->regmap, RT5677_ASRC_6, &asrc_setting); |
| 1276 | asrc_setting = (asrc_setting & RT5677_AD_MONOL_CLK_SEL_MASK) >> |
| 1277 | RT5677_AD_MONOL_CLK_SEL_SFT; |
| 1278 | if (asrc_setting >= RT5677_CLK_SEL_I2S1_ASRC && |
| 1279 | asrc_setting <= RT5677_CLK_SEL_I2S6_ASRC) |
| 1280 | return 1; |
| 1281 | break; |
| 1282 | |
| 1283 | case 6: |
| 1284 | regmap_read(rt5677->regmap, RT5677_ASRC_6, &asrc_setting); |
| 1285 | asrc_setting = (asrc_setting & RT5677_AD_MONOR_CLK_SEL_MASK) >> |
| 1286 | RT5677_AD_MONOR_CLK_SEL_SFT; |
| 1287 | if (asrc_setting >= RT5677_CLK_SEL_I2S1_ASRC && |
| 1288 | asrc_setting <= RT5677_CLK_SEL_I2S6_ASRC) |
| 1289 | return 1; |
| 1290 | break; |
| 1291 | |
| 1292 | default: |
| 1293 | break; |
| 1294 | } |
| 1295 | |
| 1296 | return 0; |
| 1297 | } |
| 1298 | |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 1299 | /* Digital Mixer */ |
| 1300 | static const struct snd_kcontrol_new rt5677_sto1_adc_l_mix[] = { |
| 1301 | SOC_DAPM_SINGLE("ADC1 Switch", RT5677_STO1_ADC_MIXER, |
| 1302 | RT5677_M_STO1_ADC_L1_SFT, 1, 1), |
| 1303 | SOC_DAPM_SINGLE("ADC2 Switch", RT5677_STO1_ADC_MIXER, |
| 1304 | RT5677_M_STO1_ADC_L2_SFT, 1, 1), |
| 1305 | }; |
| 1306 | |
| 1307 | static const struct snd_kcontrol_new rt5677_sto1_adc_r_mix[] = { |
| 1308 | SOC_DAPM_SINGLE("ADC1 Switch", RT5677_STO1_ADC_MIXER, |
| 1309 | RT5677_M_STO1_ADC_R1_SFT, 1, 1), |
| 1310 | SOC_DAPM_SINGLE("ADC2 Switch", RT5677_STO1_ADC_MIXER, |
| 1311 | RT5677_M_STO1_ADC_R2_SFT, 1, 1), |
| 1312 | }; |
| 1313 | |
| 1314 | static const struct snd_kcontrol_new rt5677_sto2_adc_l_mix[] = { |
| 1315 | SOC_DAPM_SINGLE("ADC1 Switch", RT5677_STO2_ADC_MIXER, |
| 1316 | RT5677_M_STO2_ADC_L1_SFT, 1, 1), |
| 1317 | SOC_DAPM_SINGLE("ADC2 Switch", RT5677_STO2_ADC_MIXER, |
| 1318 | RT5677_M_STO2_ADC_L2_SFT, 1, 1), |
| 1319 | }; |
| 1320 | |
| 1321 | static const struct snd_kcontrol_new rt5677_sto2_adc_r_mix[] = { |
| 1322 | SOC_DAPM_SINGLE("ADC1 Switch", RT5677_STO2_ADC_MIXER, |
| 1323 | RT5677_M_STO2_ADC_R1_SFT, 1, 1), |
| 1324 | SOC_DAPM_SINGLE("ADC2 Switch", RT5677_STO2_ADC_MIXER, |
| 1325 | RT5677_M_STO2_ADC_R2_SFT, 1, 1), |
| 1326 | }; |
| 1327 | |
| 1328 | static const struct snd_kcontrol_new rt5677_sto3_adc_l_mix[] = { |
| 1329 | SOC_DAPM_SINGLE("ADC1 Switch", RT5677_STO3_ADC_MIXER, |
| 1330 | RT5677_M_STO3_ADC_L1_SFT, 1, 1), |
| 1331 | SOC_DAPM_SINGLE("ADC2 Switch", RT5677_STO3_ADC_MIXER, |
| 1332 | RT5677_M_STO3_ADC_L2_SFT, 1, 1), |
| 1333 | }; |
| 1334 | |
| 1335 | static const struct snd_kcontrol_new rt5677_sto3_adc_r_mix[] = { |
| 1336 | SOC_DAPM_SINGLE("ADC1 Switch", RT5677_STO3_ADC_MIXER, |
| 1337 | RT5677_M_STO3_ADC_R1_SFT, 1, 1), |
| 1338 | SOC_DAPM_SINGLE("ADC2 Switch", RT5677_STO3_ADC_MIXER, |
| 1339 | RT5677_M_STO3_ADC_R2_SFT, 1, 1), |
| 1340 | }; |
| 1341 | |
| 1342 | static const struct snd_kcontrol_new rt5677_sto4_adc_l_mix[] = { |
| 1343 | SOC_DAPM_SINGLE("ADC1 Switch", RT5677_STO4_ADC_MIXER, |
| 1344 | RT5677_M_STO4_ADC_L1_SFT, 1, 1), |
| 1345 | SOC_DAPM_SINGLE("ADC2 Switch", RT5677_STO4_ADC_MIXER, |
| 1346 | RT5677_M_STO4_ADC_L2_SFT, 1, 1), |
| 1347 | }; |
| 1348 | |
| 1349 | static const struct snd_kcontrol_new rt5677_sto4_adc_r_mix[] = { |
| 1350 | SOC_DAPM_SINGLE("ADC1 Switch", RT5677_STO4_ADC_MIXER, |
| 1351 | RT5677_M_STO4_ADC_R1_SFT, 1, 1), |
| 1352 | SOC_DAPM_SINGLE("ADC2 Switch", RT5677_STO4_ADC_MIXER, |
| 1353 | RT5677_M_STO4_ADC_R2_SFT, 1, 1), |
| 1354 | }; |
| 1355 | |
| 1356 | static const struct snd_kcontrol_new rt5677_mono_adc_l_mix[] = { |
| 1357 | SOC_DAPM_SINGLE("ADC1 Switch", RT5677_MONO_ADC_MIXER, |
| 1358 | RT5677_M_MONO_ADC_L1_SFT, 1, 1), |
| 1359 | SOC_DAPM_SINGLE("ADC2 Switch", RT5677_MONO_ADC_MIXER, |
| 1360 | RT5677_M_MONO_ADC_L2_SFT, 1, 1), |
| 1361 | }; |
| 1362 | |
| 1363 | static const struct snd_kcontrol_new rt5677_mono_adc_r_mix[] = { |
| 1364 | SOC_DAPM_SINGLE("ADC1 Switch", RT5677_MONO_ADC_MIXER, |
| 1365 | RT5677_M_MONO_ADC_R1_SFT, 1, 1), |
| 1366 | SOC_DAPM_SINGLE("ADC2 Switch", RT5677_MONO_ADC_MIXER, |
| 1367 | RT5677_M_MONO_ADC_R2_SFT, 1, 1), |
| 1368 | }; |
| 1369 | |
| 1370 | static const struct snd_kcontrol_new rt5677_dac_l_mix[] = { |
| 1371 | SOC_DAPM_SINGLE("Stereo ADC Switch", RT5677_ADC_IF_DSP_DAC1_MIXER, |
| 1372 | RT5677_M_ADDA_MIXER1_L_SFT, 1, 1), |
| 1373 | SOC_DAPM_SINGLE("DAC1 Switch", RT5677_ADC_IF_DSP_DAC1_MIXER, |
| 1374 | RT5677_M_DAC1_L_SFT, 1, 1), |
| 1375 | }; |
| 1376 | |
| 1377 | static const struct snd_kcontrol_new rt5677_dac_r_mix[] = { |
| 1378 | SOC_DAPM_SINGLE("Stereo ADC Switch", RT5677_ADC_IF_DSP_DAC1_MIXER, |
| 1379 | RT5677_M_ADDA_MIXER1_R_SFT, 1, 1), |
| 1380 | SOC_DAPM_SINGLE("DAC1 Switch", RT5677_ADC_IF_DSP_DAC1_MIXER, |
| 1381 | RT5677_M_DAC1_R_SFT, 1, 1), |
| 1382 | }; |
| 1383 | |
| 1384 | static const struct snd_kcontrol_new rt5677_sto1_dac_l_mix[] = { |
| 1385 | SOC_DAPM_SINGLE("ST L Switch", RT5677_STO1_DAC_MIXER, |
| 1386 | RT5677_M_ST_DAC1_L_SFT, 1, 1), |
| 1387 | SOC_DAPM_SINGLE("DAC1 L Switch", RT5677_STO1_DAC_MIXER, |
| 1388 | RT5677_M_DAC1_L_STO_L_SFT, 1, 1), |
| 1389 | SOC_DAPM_SINGLE("DAC2 L Switch", RT5677_STO1_DAC_MIXER, |
| 1390 | RT5677_M_DAC2_L_STO_L_SFT, 1, 1), |
| 1391 | SOC_DAPM_SINGLE("DAC1 R Switch", RT5677_STO1_DAC_MIXER, |
| 1392 | RT5677_M_DAC1_R_STO_L_SFT, 1, 1), |
| 1393 | }; |
| 1394 | |
| 1395 | static const struct snd_kcontrol_new rt5677_sto1_dac_r_mix[] = { |
| 1396 | SOC_DAPM_SINGLE("ST R Switch", RT5677_STO1_DAC_MIXER, |
| 1397 | RT5677_M_ST_DAC1_R_SFT, 1, 1), |
| 1398 | SOC_DAPM_SINGLE("DAC1 R Switch", RT5677_STO1_DAC_MIXER, |
| 1399 | RT5677_M_DAC1_R_STO_R_SFT, 1, 1), |
| 1400 | SOC_DAPM_SINGLE("DAC2 R Switch", RT5677_STO1_DAC_MIXER, |
| 1401 | RT5677_M_DAC2_R_STO_R_SFT, 1, 1), |
| 1402 | SOC_DAPM_SINGLE("DAC1 L Switch", RT5677_STO1_DAC_MIXER, |
| 1403 | RT5677_M_DAC1_L_STO_R_SFT, 1, 1), |
| 1404 | }; |
| 1405 | |
| 1406 | static const struct snd_kcontrol_new rt5677_mono_dac_l_mix[] = { |
| 1407 | SOC_DAPM_SINGLE("ST L Switch", RT5677_MONO_DAC_MIXER, |
| 1408 | RT5677_M_ST_DAC2_L_SFT, 1, 1), |
| 1409 | SOC_DAPM_SINGLE("DAC1 L Switch", RT5677_MONO_DAC_MIXER, |
| 1410 | RT5677_M_DAC1_L_MONO_L_SFT, 1, 1), |
| 1411 | SOC_DAPM_SINGLE("DAC2 L Switch", RT5677_MONO_DAC_MIXER, |
| 1412 | RT5677_M_DAC2_L_MONO_L_SFT, 1, 1), |
| 1413 | SOC_DAPM_SINGLE("DAC2 R Switch", RT5677_MONO_DAC_MIXER, |
| 1414 | RT5677_M_DAC2_R_MONO_L_SFT, 1, 1), |
| 1415 | }; |
| 1416 | |
| 1417 | static const struct snd_kcontrol_new rt5677_mono_dac_r_mix[] = { |
| 1418 | SOC_DAPM_SINGLE("ST R Switch", RT5677_MONO_DAC_MIXER, |
| 1419 | RT5677_M_ST_DAC2_R_SFT, 1, 1), |
| 1420 | SOC_DAPM_SINGLE("DAC1 R Switch", RT5677_MONO_DAC_MIXER, |
| 1421 | RT5677_M_DAC1_R_MONO_R_SFT, 1, 1), |
| 1422 | SOC_DAPM_SINGLE("DAC2 R Switch", RT5677_MONO_DAC_MIXER, |
| 1423 | RT5677_M_DAC2_R_MONO_R_SFT, 1, 1), |
| 1424 | SOC_DAPM_SINGLE("DAC2 L Switch", RT5677_MONO_DAC_MIXER, |
| 1425 | RT5677_M_DAC2_L_MONO_R_SFT, 1, 1), |
| 1426 | }; |
| 1427 | |
| 1428 | static const struct snd_kcontrol_new rt5677_dd1_l_mix[] = { |
| 1429 | SOC_DAPM_SINGLE("Sto DAC Mix L Switch", RT5677_DD1_MIXER, |
| 1430 | RT5677_M_STO_L_DD1_L_SFT, 1, 1), |
| 1431 | SOC_DAPM_SINGLE("Mono DAC Mix L Switch", RT5677_DD1_MIXER, |
| 1432 | RT5677_M_MONO_L_DD1_L_SFT, 1, 1), |
| 1433 | SOC_DAPM_SINGLE("DAC3 L Switch", RT5677_DD1_MIXER, |
| 1434 | RT5677_M_DAC3_L_DD1_L_SFT, 1, 1), |
| 1435 | SOC_DAPM_SINGLE("DAC3 R Switch", RT5677_DD1_MIXER, |
| 1436 | RT5677_M_DAC3_R_DD1_L_SFT, 1, 1), |
| 1437 | }; |
| 1438 | |
| 1439 | static const struct snd_kcontrol_new rt5677_dd1_r_mix[] = { |
| 1440 | SOC_DAPM_SINGLE("Sto DAC Mix R Switch", RT5677_DD1_MIXER, |
| 1441 | RT5677_M_STO_R_DD1_R_SFT, 1, 1), |
| 1442 | SOC_DAPM_SINGLE("Mono DAC Mix R Switch", RT5677_DD1_MIXER, |
| 1443 | RT5677_M_MONO_R_DD1_R_SFT, 1, 1), |
| 1444 | SOC_DAPM_SINGLE("DAC3 R Switch", RT5677_DD1_MIXER, |
| 1445 | RT5677_M_DAC3_R_DD1_R_SFT, 1, 1), |
| 1446 | SOC_DAPM_SINGLE("DAC3 L Switch", RT5677_DD1_MIXER, |
| 1447 | RT5677_M_DAC3_L_DD1_R_SFT, 1, 1), |
| 1448 | }; |
| 1449 | |
| 1450 | static const struct snd_kcontrol_new rt5677_dd2_l_mix[] = { |
| 1451 | SOC_DAPM_SINGLE("Sto DAC Mix L Switch", RT5677_DD2_MIXER, |
| 1452 | RT5677_M_STO_L_DD2_L_SFT, 1, 1), |
| 1453 | SOC_DAPM_SINGLE("Mono DAC Mix L Switch", RT5677_DD2_MIXER, |
| 1454 | RT5677_M_MONO_L_DD2_L_SFT, 1, 1), |
| 1455 | SOC_DAPM_SINGLE("DAC4 L Switch", RT5677_DD2_MIXER, |
| 1456 | RT5677_M_DAC4_L_DD2_L_SFT, 1, 1), |
| 1457 | SOC_DAPM_SINGLE("DAC4 R Switch", RT5677_DD2_MIXER, |
| 1458 | RT5677_M_DAC4_R_DD2_L_SFT, 1, 1), |
| 1459 | }; |
| 1460 | |
| 1461 | static const struct snd_kcontrol_new rt5677_dd2_r_mix[] = { |
| 1462 | SOC_DAPM_SINGLE("Sto DAC Mix R Switch", RT5677_DD2_MIXER, |
| 1463 | RT5677_M_STO_R_DD2_R_SFT, 1, 1), |
| 1464 | SOC_DAPM_SINGLE("Mono DAC Mix R Switch", RT5677_DD2_MIXER, |
| 1465 | RT5677_M_MONO_R_DD2_R_SFT, 1, 1), |
| 1466 | SOC_DAPM_SINGLE("DAC4 R Switch", RT5677_DD2_MIXER, |
| 1467 | RT5677_M_DAC4_R_DD2_R_SFT, 1, 1), |
| 1468 | SOC_DAPM_SINGLE("DAC4 L Switch", RT5677_DD2_MIXER, |
| 1469 | RT5677_M_DAC4_L_DD2_R_SFT, 1, 1), |
| 1470 | }; |
| 1471 | |
| 1472 | static const struct snd_kcontrol_new rt5677_ob_01_mix[] = { |
| 1473 | SOC_DAPM_SINGLE("IB01 Switch", RT5677_DSP_OUTB_0123_MIXER_CTRL, |
| 1474 | RT5677_DSP_IB_01_H_SFT, 1, 1), |
| 1475 | SOC_DAPM_SINGLE("IB23 Switch", RT5677_DSP_OUTB_0123_MIXER_CTRL, |
| 1476 | RT5677_DSP_IB_23_H_SFT, 1, 1), |
| 1477 | SOC_DAPM_SINGLE("IB45 Switch", RT5677_DSP_OUTB_0123_MIXER_CTRL, |
| 1478 | RT5677_DSP_IB_45_H_SFT, 1, 1), |
| 1479 | SOC_DAPM_SINGLE("IB6 Switch", RT5677_DSP_OUTB_0123_MIXER_CTRL, |
| 1480 | RT5677_DSP_IB_6_H_SFT, 1, 1), |
| 1481 | SOC_DAPM_SINGLE("IB7 Switch", RT5677_DSP_OUTB_0123_MIXER_CTRL, |
| 1482 | RT5677_DSP_IB_7_H_SFT, 1, 1), |
| 1483 | SOC_DAPM_SINGLE("IB8 Switch", RT5677_DSP_OUTB_0123_MIXER_CTRL, |
| 1484 | RT5677_DSP_IB_8_H_SFT, 1, 1), |
| 1485 | SOC_DAPM_SINGLE("IB9 Switch", RT5677_DSP_OUTB_0123_MIXER_CTRL, |
| 1486 | RT5677_DSP_IB_9_H_SFT, 1, 1), |
| 1487 | }; |
| 1488 | |
| 1489 | static const struct snd_kcontrol_new rt5677_ob_23_mix[] = { |
| 1490 | SOC_DAPM_SINGLE("IB01 Switch", RT5677_DSP_OUTB_0123_MIXER_CTRL, |
| 1491 | RT5677_DSP_IB_01_L_SFT, 1, 1), |
| 1492 | SOC_DAPM_SINGLE("IB23 Switch", RT5677_DSP_OUTB_0123_MIXER_CTRL, |
| 1493 | RT5677_DSP_IB_23_L_SFT, 1, 1), |
| 1494 | SOC_DAPM_SINGLE("IB45 Switch", RT5677_DSP_OUTB_0123_MIXER_CTRL, |
| 1495 | RT5677_DSP_IB_45_L_SFT, 1, 1), |
| 1496 | SOC_DAPM_SINGLE("IB6 Switch", RT5677_DSP_OUTB_0123_MIXER_CTRL, |
| 1497 | RT5677_DSP_IB_6_L_SFT, 1, 1), |
| 1498 | SOC_DAPM_SINGLE("IB7 Switch", RT5677_DSP_OUTB_0123_MIXER_CTRL, |
| 1499 | RT5677_DSP_IB_7_L_SFT, 1, 1), |
| 1500 | SOC_DAPM_SINGLE("IB8 Switch", RT5677_DSP_OUTB_0123_MIXER_CTRL, |
| 1501 | RT5677_DSP_IB_8_L_SFT, 1, 1), |
| 1502 | SOC_DAPM_SINGLE("IB9 Switch", RT5677_DSP_OUTB_0123_MIXER_CTRL, |
| 1503 | RT5677_DSP_IB_9_L_SFT, 1, 1), |
| 1504 | }; |
| 1505 | |
| 1506 | static const struct snd_kcontrol_new rt5677_ob_4_mix[] = { |
| 1507 | SOC_DAPM_SINGLE("IB01 Switch", RT5677_DSP_OUTB_45_MIXER_CTRL, |
| 1508 | RT5677_DSP_IB_01_H_SFT, 1, 1), |
| 1509 | SOC_DAPM_SINGLE("IB23 Switch", RT5677_DSP_OUTB_45_MIXER_CTRL, |
| 1510 | RT5677_DSP_IB_23_H_SFT, 1, 1), |
| 1511 | SOC_DAPM_SINGLE("IB45 Switch", RT5677_DSP_OUTB_45_MIXER_CTRL, |
| 1512 | RT5677_DSP_IB_45_H_SFT, 1, 1), |
| 1513 | SOC_DAPM_SINGLE("IB6 Switch", RT5677_DSP_OUTB_45_MIXER_CTRL, |
| 1514 | RT5677_DSP_IB_6_H_SFT, 1, 1), |
| 1515 | SOC_DAPM_SINGLE("IB7 Switch", RT5677_DSP_OUTB_45_MIXER_CTRL, |
| 1516 | RT5677_DSP_IB_7_H_SFT, 1, 1), |
| 1517 | SOC_DAPM_SINGLE("IB8 Switch", RT5677_DSP_OUTB_45_MIXER_CTRL, |
| 1518 | RT5677_DSP_IB_8_H_SFT, 1, 1), |
| 1519 | SOC_DAPM_SINGLE("IB9 Switch", RT5677_DSP_OUTB_45_MIXER_CTRL, |
| 1520 | RT5677_DSP_IB_9_H_SFT, 1, 1), |
| 1521 | }; |
| 1522 | |
| 1523 | static const struct snd_kcontrol_new rt5677_ob_5_mix[] = { |
| 1524 | SOC_DAPM_SINGLE("IB01 Switch", RT5677_DSP_OUTB_45_MIXER_CTRL, |
| 1525 | RT5677_DSP_IB_01_L_SFT, 1, 1), |
| 1526 | SOC_DAPM_SINGLE("IB23 Switch", RT5677_DSP_OUTB_45_MIXER_CTRL, |
| 1527 | RT5677_DSP_IB_23_L_SFT, 1, 1), |
| 1528 | SOC_DAPM_SINGLE("IB45 Switch", RT5677_DSP_OUTB_45_MIXER_CTRL, |
| 1529 | RT5677_DSP_IB_45_L_SFT, 1, 1), |
| 1530 | SOC_DAPM_SINGLE("IB6 Switch", RT5677_DSP_OUTB_45_MIXER_CTRL, |
| 1531 | RT5677_DSP_IB_6_L_SFT, 1, 1), |
| 1532 | SOC_DAPM_SINGLE("IB7 Switch", RT5677_DSP_OUTB_45_MIXER_CTRL, |
| 1533 | RT5677_DSP_IB_7_L_SFT, 1, 1), |
| 1534 | SOC_DAPM_SINGLE("IB8 Switch", RT5677_DSP_OUTB_45_MIXER_CTRL, |
| 1535 | RT5677_DSP_IB_8_L_SFT, 1, 1), |
| 1536 | SOC_DAPM_SINGLE("IB9 Switch", RT5677_DSP_OUTB_45_MIXER_CTRL, |
| 1537 | RT5677_DSP_IB_9_L_SFT, 1, 1), |
| 1538 | }; |
| 1539 | |
| 1540 | static const struct snd_kcontrol_new rt5677_ob_6_mix[] = { |
| 1541 | SOC_DAPM_SINGLE("IB01 Switch", RT5677_DSP_OUTB_67_MIXER_CTRL, |
| 1542 | RT5677_DSP_IB_01_H_SFT, 1, 1), |
| 1543 | SOC_DAPM_SINGLE("IB23 Switch", RT5677_DSP_OUTB_67_MIXER_CTRL, |
| 1544 | RT5677_DSP_IB_23_H_SFT, 1, 1), |
| 1545 | SOC_DAPM_SINGLE("IB45 Switch", RT5677_DSP_OUTB_67_MIXER_CTRL, |
| 1546 | RT5677_DSP_IB_45_H_SFT, 1, 1), |
| 1547 | SOC_DAPM_SINGLE("IB6 Switch", RT5677_DSP_OUTB_67_MIXER_CTRL, |
| 1548 | RT5677_DSP_IB_6_H_SFT, 1, 1), |
| 1549 | SOC_DAPM_SINGLE("IB7 Switch", RT5677_DSP_OUTB_67_MIXER_CTRL, |
| 1550 | RT5677_DSP_IB_7_H_SFT, 1, 1), |
| 1551 | SOC_DAPM_SINGLE("IB8 Switch", RT5677_DSP_OUTB_67_MIXER_CTRL, |
| 1552 | RT5677_DSP_IB_8_H_SFT, 1, 1), |
| 1553 | SOC_DAPM_SINGLE("IB9 Switch", RT5677_DSP_OUTB_67_MIXER_CTRL, |
| 1554 | RT5677_DSP_IB_9_H_SFT, 1, 1), |
| 1555 | }; |
| 1556 | |
| 1557 | static const struct snd_kcontrol_new rt5677_ob_7_mix[] = { |
| 1558 | SOC_DAPM_SINGLE("IB01 Switch", RT5677_DSP_OUTB_67_MIXER_CTRL, |
| 1559 | RT5677_DSP_IB_01_L_SFT, 1, 1), |
| 1560 | SOC_DAPM_SINGLE("IB23 Switch", RT5677_DSP_OUTB_67_MIXER_CTRL, |
| 1561 | RT5677_DSP_IB_23_L_SFT, 1, 1), |
| 1562 | SOC_DAPM_SINGLE("IB45 Switch", RT5677_DSP_OUTB_67_MIXER_CTRL, |
| 1563 | RT5677_DSP_IB_45_L_SFT, 1, 1), |
| 1564 | SOC_DAPM_SINGLE("IB6 Switch", RT5677_DSP_OUTB_67_MIXER_CTRL, |
| 1565 | RT5677_DSP_IB_6_L_SFT, 1, 1), |
| 1566 | SOC_DAPM_SINGLE("IB7 Switch", RT5677_DSP_OUTB_67_MIXER_CTRL, |
| 1567 | RT5677_DSP_IB_7_L_SFT, 1, 1), |
| 1568 | SOC_DAPM_SINGLE("IB8 Switch", RT5677_DSP_OUTB_67_MIXER_CTRL, |
| 1569 | RT5677_DSP_IB_8_L_SFT, 1, 1), |
| 1570 | SOC_DAPM_SINGLE("IB9 Switch", RT5677_DSP_OUTB_67_MIXER_CTRL, |
| 1571 | RT5677_DSP_IB_9_L_SFT, 1, 1), |
| 1572 | }; |
| 1573 | |
| 1574 | |
| 1575 | /* Mux */ |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 1576 | /* DAC1 L/R Source */ /* MX-29 [10:8] */ |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 1577 | static const char * const rt5677_dac1_src[] = { |
| 1578 | "IF1 DAC 01", "IF2 DAC 01", "IF3 DAC LR", "IF4 DAC LR", "SLB DAC 01", |
| 1579 | "OB 01" |
| 1580 | }; |
| 1581 | |
| 1582 | static SOC_ENUM_SINGLE_DECL( |
| 1583 | rt5677_dac1_enum, RT5677_ADC_IF_DSP_DAC1_MIXER, |
| 1584 | RT5677_DAC1_L_SEL_SFT, rt5677_dac1_src); |
| 1585 | |
| 1586 | static const struct snd_kcontrol_new rt5677_dac1_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 1587 | SOC_DAPM_ENUM("DAC1 Source", rt5677_dac1_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 1588 | |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 1589 | /* ADDA1 L/R Source */ /* MX-29 [1:0] */ |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 1590 | static const char * const rt5677_adda1_src[] = { |
| 1591 | "STO1 ADC MIX", "STO2 ADC MIX", "OB 67", |
| 1592 | }; |
| 1593 | |
| 1594 | static SOC_ENUM_SINGLE_DECL( |
| 1595 | rt5677_adda1_enum, RT5677_ADC_IF_DSP_DAC1_MIXER, |
| 1596 | RT5677_ADDA1_SEL_SFT, rt5677_adda1_src); |
| 1597 | |
| 1598 | static const struct snd_kcontrol_new rt5677_adda1_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 1599 | SOC_DAPM_ENUM("ADDA1 Source", rt5677_adda1_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 1600 | |
| 1601 | |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 1602 | /*DAC2 L/R Source*/ /* MX-1B [6:4] [2:0] */ |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 1603 | static const char * const rt5677_dac2l_src[] = { |
| 1604 | "IF1 DAC 2", "IF2 DAC 2", "IF3 DAC L", "IF4 DAC L", "SLB DAC 2", |
| 1605 | "OB 2", |
| 1606 | }; |
| 1607 | |
| 1608 | static SOC_ENUM_SINGLE_DECL( |
| 1609 | rt5677_dac2l_enum, RT5677_IF_DSP_DAC2_MIXER, |
| 1610 | RT5677_SEL_DAC2_L_SRC_SFT, rt5677_dac2l_src); |
| 1611 | |
| 1612 | static const struct snd_kcontrol_new rt5677_dac2_l_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 1613 | SOC_DAPM_ENUM("DAC2 L Source", rt5677_dac2l_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 1614 | |
| 1615 | static const char * const rt5677_dac2r_src[] = { |
| 1616 | "IF1 DAC 3", "IF2 DAC 3", "IF3 DAC R", "IF4 DAC R", "SLB DAC 3", |
| 1617 | "OB 3", "Haptic Generator", "VAD ADC" |
| 1618 | }; |
| 1619 | |
| 1620 | static SOC_ENUM_SINGLE_DECL( |
| 1621 | rt5677_dac2r_enum, RT5677_IF_DSP_DAC2_MIXER, |
| 1622 | RT5677_SEL_DAC2_R_SRC_SFT, rt5677_dac2r_src); |
| 1623 | |
| 1624 | static const struct snd_kcontrol_new rt5677_dac2_r_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 1625 | SOC_DAPM_ENUM("DAC2 R Source", rt5677_dac2r_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 1626 | |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 1627 | /*DAC3 L/R Source*/ /* MX-16 [6:4] [2:0] */ |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 1628 | static const char * const rt5677_dac3l_src[] = { |
| 1629 | "IF1 DAC 4", "IF2 DAC 4", "IF3 DAC L", "IF4 DAC L", |
| 1630 | "SLB DAC 4", "OB 4" |
| 1631 | }; |
| 1632 | |
| 1633 | static SOC_ENUM_SINGLE_DECL( |
| 1634 | rt5677_dac3l_enum, RT5677_IF_DSP_DAC3_4_MIXER, |
| 1635 | RT5677_SEL_DAC3_L_SRC_SFT, rt5677_dac3l_src); |
| 1636 | |
| 1637 | static const struct snd_kcontrol_new rt5677_dac3_l_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 1638 | SOC_DAPM_ENUM("DAC3 L Source", rt5677_dac3l_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 1639 | |
| 1640 | static const char * const rt5677_dac3r_src[] = { |
| 1641 | "IF1 DAC 5", "IF2 DAC 5", "IF3 DAC R", "IF4 DAC R", |
| 1642 | "SLB DAC 5", "OB 5" |
| 1643 | }; |
| 1644 | |
| 1645 | static SOC_ENUM_SINGLE_DECL( |
| 1646 | rt5677_dac3r_enum, RT5677_IF_DSP_DAC3_4_MIXER, |
| 1647 | RT5677_SEL_DAC3_R_SRC_SFT, rt5677_dac3r_src); |
| 1648 | |
| 1649 | static const struct snd_kcontrol_new rt5677_dac3_r_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 1650 | SOC_DAPM_ENUM("DAC3 R Source", rt5677_dac3r_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 1651 | |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 1652 | /*DAC4 L/R Source*/ /* MX-16 [14:12] [10:8] */ |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 1653 | static const char * const rt5677_dac4l_src[] = { |
| 1654 | "IF1 DAC 6", "IF2 DAC 6", "IF3 DAC L", "IF4 DAC L", |
| 1655 | "SLB DAC 6", "OB 6" |
| 1656 | }; |
| 1657 | |
| 1658 | static SOC_ENUM_SINGLE_DECL( |
| 1659 | rt5677_dac4l_enum, RT5677_IF_DSP_DAC3_4_MIXER, |
| 1660 | RT5677_SEL_DAC4_L_SRC_SFT, rt5677_dac4l_src); |
| 1661 | |
| 1662 | static const struct snd_kcontrol_new rt5677_dac4_l_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 1663 | SOC_DAPM_ENUM("DAC4 L Source", rt5677_dac4l_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 1664 | |
| 1665 | static const char * const rt5677_dac4r_src[] = { |
| 1666 | "IF1 DAC 7", "IF2 DAC 7", "IF3 DAC R", "IF4 DAC R", |
| 1667 | "SLB DAC 7", "OB 7" |
| 1668 | }; |
| 1669 | |
| 1670 | static SOC_ENUM_SINGLE_DECL( |
| 1671 | rt5677_dac4r_enum, RT5677_IF_DSP_DAC3_4_MIXER, |
| 1672 | RT5677_SEL_DAC4_R_SRC_SFT, rt5677_dac4r_src); |
| 1673 | |
| 1674 | static const struct snd_kcontrol_new rt5677_dac4_r_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 1675 | SOC_DAPM_ENUM("DAC4 R Source", rt5677_dac4r_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 1676 | |
| 1677 | /* In/OutBound Source Pass SRC */ /* MX-A5 [3] [4] [0] [1] [2] */ |
| 1678 | static const char * const rt5677_iob_bypass_src[] = { |
| 1679 | "Bypass", "Pass SRC" |
| 1680 | }; |
| 1681 | |
| 1682 | static SOC_ENUM_SINGLE_DECL( |
| 1683 | rt5677_ob01_bypass_src_enum, RT5677_DSP_IN_OUTB_CTRL, |
| 1684 | RT5677_SEL_SRC_OB01_SFT, rt5677_iob_bypass_src); |
| 1685 | |
| 1686 | static const struct snd_kcontrol_new rt5677_ob01_bypass_src_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 1687 | SOC_DAPM_ENUM("OB01 Bypass Source", rt5677_ob01_bypass_src_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 1688 | |
| 1689 | static SOC_ENUM_SINGLE_DECL( |
| 1690 | rt5677_ob23_bypass_src_enum, RT5677_DSP_IN_OUTB_CTRL, |
| 1691 | RT5677_SEL_SRC_OB23_SFT, rt5677_iob_bypass_src); |
| 1692 | |
| 1693 | static const struct snd_kcontrol_new rt5677_ob23_bypass_src_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 1694 | SOC_DAPM_ENUM("OB23 Bypass Source", rt5677_ob23_bypass_src_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 1695 | |
| 1696 | static SOC_ENUM_SINGLE_DECL( |
| 1697 | rt5677_ib01_bypass_src_enum, RT5677_DSP_IN_OUTB_CTRL, |
| 1698 | RT5677_SEL_SRC_IB01_SFT, rt5677_iob_bypass_src); |
| 1699 | |
| 1700 | static const struct snd_kcontrol_new rt5677_ib01_bypass_src_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 1701 | SOC_DAPM_ENUM("IB01 Bypass Source", rt5677_ib01_bypass_src_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 1702 | |
| 1703 | static SOC_ENUM_SINGLE_DECL( |
| 1704 | rt5677_ib23_bypass_src_enum, RT5677_DSP_IN_OUTB_CTRL, |
| 1705 | RT5677_SEL_SRC_IB23_SFT, rt5677_iob_bypass_src); |
| 1706 | |
| 1707 | static const struct snd_kcontrol_new rt5677_ib23_bypass_src_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 1708 | SOC_DAPM_ENUM("IB23 Bypass Source", rt5677_ib23_bypass_src_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 1709 | |
| 1710 | static SOC_ENUM_SINGLE_DECL( |
| 1711 | rt5677_ib45_bypass_src_enum, RT5677_DSP_IN_OUTB_CTRL, |
| 1712 | RT5677_SEL_SRC_IB45_SFT, rt5677_iob_bypass_src); |
| 1713 | |
| 1714 | static const struct snd_kcontrol_new rt5677_ib45_bypass_src_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 1715 | SOC_DAPM_ENUM("IB45 Bypass Source", rt5677_ib45_bypass_src_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 1716 | |
Oder Chiou | d65fd3a | 2014-11-05 13:42:52 +0800 | [diff] [blame] | 1717 | /* Stereo ADC Source 2 */ /* MX-27 MX26 MX25 [11:10] */ |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 1718 | static const char * const rt5677_stereo_adc2_src[] = { |
| 1719 | "DD MIX1", "DMIC", "Stereo DAC MIX" |
| 1720 | }; |
| 1721 | |
| 1722 | static SOC_ENUM_SINGLE_DECL( |
| 1723 | rt5677_stereo1_adc2_enum, RT5677_STO1_ADC_MIXER, |
| 1724 | RT5677_SEL_STO1_ADC2_SFT, rt5677_stereo_adc2_src); |
| 1725 | |
| 1726 | static const struct snd_kcontrol_new rt5677_sto1_adc2_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 1727 | SOC_DAPM_ENUM("Stereo1 ADC2 Source", rt5677_stereo1_adc2_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 1728 | |
| 1729 | static SOC_ENUM_SINGLE_DECL( |
| 1730 | rt5677_stereo2_adc2_enum, RT5677_STO2_ADC_MIXER, |
| 1731 | RT5677_SEL_STO2_ADC2_SFT, rt5677_stereo_adc2_src); |
| 1732 | |
| 1733 | static const struct snd_kcontrol_new rt5677_sto2_adc2_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 1734 | SOC_DAPM_ENUM("Stereo2 ADC2 Source", rt5677_stereo2_adc2_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 1735 | |
| 1736 | static SOC_ENUM_SINGLE_DECL( |
| 1737 | rt5677_stereo3_adc2_enum, RT5677_STO3_ADC_MIXER, |
| 1738 | RT5677_SEL_STO3_ADC2_SFT, rt5677_stereo_adc2_src); |
| 1739 | |
| 1740 | static const struct snd_kcontrol_new rt5677_sto3_adc2_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 1741 | SOC_DAPM_ENUM("Stereo3 ADC2 Source", rt5677_stereo3_adc2_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 1742 | |
| 1743 | /* DMIC Source */ /* MX-28 [9:8][1:0] MX-27 MX-26 MX-25 MX-24 [9:8] */ |
| 1744 | static const char * const rt5677_dmic_src[] = { |
| 1745 | "DMIC1", "DMIC2", "DMIC3", "DMIC4" |
| 1746 | }; |
| 1747 | |
| 1748 | static SOC_ENUM_SINGLE_DECL( |
| 1749 | rt5677_mono_dmic_l_enum, RT5677_MONO_ADC_MIXER, |
| 1750 | RT5677_SEL_MONO_DMIC_L_SFT, rt5677_dmic_src); |
| 1751 | |
| 1752 | static const struct snd_kcontrol_new rt5677_mono_dmic_l_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 1753 | SOC_DAPM_ENUM("Mono DMIC L Source", rt5677_mono_dmic_l_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 1754 | |
| 1755 | static SOC_ENUM_SINGLE_DECL( |
| 1756 | rt5677_mono_dmic_r_enum, RT5677_MONO_ADC_MIXER, |
| 1757 | RT5677_SEL_MONO_DMIC_R_SFT, rt5677_dmic_src); |
| 1758 | |
| 1759 | static const struct snd_kcontrol_new rt5677_mono_dmic_r_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 1760 | SOC_DAPM_ENUM("Mono DMIC R Source", rt5677_mono_dmic_r_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 1761 | |
| 1762 | static SOC_ENUM_SINGLE_DECL( |
| 1763 | rt5677_stereo1_dmic_enum, RT5677_STO1_ADC_MIXER, |
| 1764 | RT5677_SEL_STO1_DMIC_SFT, rt5677_dmic_src); |
| 1765 | |
| 1766 | static const struct snd_kcontrol_new rt5677_sto1_dmic_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 1767 | SOC_DAPM_ENUM("Stereo1 DMIC Source", rt5677_stereo1_dmic_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 1768 | |
| 1769 | static SOC_ENUM_SINGLE_DECL( |
| 1770 | rt5677_stereo2_dmic_enum, RT5677_STO2_ADC_MIXER, |
| 1771 | RT5677_SEL_STO2_DMIC_SFT, rt5677_dmic_src); |
| 1772 | |
| 1773 | static const struct snd_kcontrol_new rt5677_sto2_dmic_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 1774 | SOC_DAPM_ENUM("Stereo2 DMIC Source", rt5677_stereo2_dmic_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 1775 | |
| 1776 | static SOC_ENUM_SINGLE_DECL( |
| 1777 | rt5677_stereo3_dmic_enum, RT5677_STO3_ADC_MIXER, |
| 1778 | RT5677_SEL_STO3_DMIC_SFT, rt5677_dmic_src); |
| 1779 | |
| 1780 | static const struct snd_kcontrol_new rt5677_sto3_dmic_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 1781 | SOC_DAPM_ENUM("Stereo3 DMIC Source", rt5677_stereo3_dmic_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 1782 | |
| 1783 | static SOC_ENUM_SINGLE_DECL( |
| 1784 | rt5677_stereo4_dmic_enum, RT5677_STO4_ADC_MIXER, |
| 1785 | RT5677_SEL_STO4_DMIC_SFT, rt5677_dmic_src); |
| 1786 | |
| 1787 | static const struct snd_kcontrol_new rt5677_sto4_dmic_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 1788 | SOC_DAPM_ENUM("Stereo4 DMIC Source", rt5677_stereo4_dmic_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 1789 | |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 1790 | /* Stereo2 ADC Source */ /* MX-26 [0] */ |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 1791 | static const char * const rt5677_stereo2_adc_lr_src[] = { |
| 1792 | "L", "LR" |
| 1793 | }; |
| 1794 | |
| 1795 | static SOC_ENUM_SINGLE_DECL( |
| 1796 | rt5677_stereo2_adc_lr_enum, RT5677_STO2_ADC_MIXER, |
| 1797 | RT5677_SEL_STO2_LR_MIX_SFT, rt5677_stereo2_adc_lr_src); |
| 1798 | |
| 1799 | static const struct snd_kcontrol_new rt5677_sto2_adc_lr_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 1800 | SOC_DAPM_ENUM("Stereo2 ADC LR Source", rt5677_stereo2_adc_lr_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 1801 | |
Oder Chiou | d65fd3a | 2014-11-05 13:42:52 +0800 | [diff] [blame] | 1802 | /* Stereo1 ADC Source 1 */ /* MX-27 MX26 MX25 [13:12] */ |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 1803 | static const char * const rt5677_stereo_adc1_src[] = { |
| 1804 | "DD MIX1", "ADC1/2", "Stereo DAC MIX" |
| 1805 | }; |
| 1806 | |
| 1807 | static SOC_ENUM_SINGLE_DECL( |
| 1808 | rt5677_stereo1_adc1_enum, RT5677_STO1_ADC_MIXER, |
| 1809 | RT5677_SEL_STO1_ADC1_SFT, rt5677_stereo_adc1_src); |
| 1810 | |
| 1811 | static const struct snd_kcontrol_new rt5677_sto1_adc1_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 1812 | SOC_DAPM_ENUM("Stereo1 ADC1 Source", rt5677_stereo1_adc1_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 1813 | |
| 1814 | static SOC_ENUM_SINGLE_DECL( |
| 1815 | rt5677_stereo2_adc1_enum, RT5677_STO2_ADC_MIXER, |
| 1816 | RT5677_SEL_STO2_ADC1_SFT, rt5677_stereo_adc1_src); |
| 1817 | |
| 1818 | static const struct snd_kcontrol_new rt5677_sto2_adc1_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 1819 | SOC_DAPM_ENUM("Stereo2 ADC1 Source", rt5677_stereo2_adc1_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 1820 | |
| 1821 | static SOC_ENUM_SINGLE_DECL( |
| 1822 | rt5677_stereo3_adc1_enum, RT5677_STO3_ADC_MIXER, |
| 1823 | RT5677_SEL_STO3_ADC1_SFT, rt5677_stereo_adc1_src); |
| 1824 | |
| 1825 | static const struct snd_kcontrol_new rt5677_sto3_adc1_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 1826 | SOC_DAPM_ENUM("Stereo3 ADC1 Source", rt5677_stereo3_adc1_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 1827 | |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 1828 | /* Mono ADC Left Source 2 */ /* MX-28 [11:10] */ |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 1829 | static const char * const rt5677_mono_adc2_l_src[] = { |
| 1830 | "DD MIX1L", "DMIC", "MONO DAC MIXL" |
| 1831 | }; |
| 1832 | |
| 1833 | static SOC_ENUM_SINGLE_DECL( |
| 1834 | rt5677_mono_adc2_l_enum, RT5677_MONO_ADC_MIXER, |
| 1835 | RT5677_SEL_MONO_ADC_L2_SFT, rt5677_mono_adc2_l_src); |
| 1836 | |
| 1837 | static const struct snd_kcontrol_new rt5677_mono_adc2_l_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 1838 | SOC_DAPM_ENUM("Mono ADC2 L Source", rt5677_mono_adc2_l_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 1839 | |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 1840 | /* Mono ADC Left Source 1 */ /* MX-28 [13:12] */ |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 1841 | static const char * const rt5677_mono_adc1_l_src[] = { |
| 1842 | "DD MIX1L", "ADC1", "MONO DAC MIXL" |
| 1843 | }; |
| 1844 | |
| 1845 | static SOC_ENUM_SINGLE_DECL( |
| 1846 | rt5677_mono_adc1_l_enum, RT5677_MONO_ADC_MIXER, |
| 1847 | RT5677_SEL_MONO_ADC_L1_SFT, rt5677_mono_adc1_l_src); |
| 1848 | |
| 1849 | static const struct snd_kcontrol_new rt5677_mono_adc1_l_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 1850 | SOC_DAPM_ENUM("Mono ADC1 L Source", rt5677_mono_adc1_l_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 1851 | |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 1852 | /* Mono ADC Right Source 2 */ /* MX-28 [3:2] */ |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 1853 | static const char * const rt5677_mono_adc2_r_src[] = { |
| 1854 | "DD MIX1R", "DMIC", "MONO DAC MIXR" |
| 1855 | }; |
| 1856 | |
| 1857 | static SOC_ENUM_SINGLE_DECL( |
| 1858 | rt5677_mono_adc2_r_enum, RT5677_MONO_ADC_MIXER, |
| 1859 | RT5677_SEL_MONO_ADC_R2_SFT, rt5677_mono_adc2_r_src); |
| 1860 | |
| 1861 | static const struct snd_kcontrol_new rt5677_mono_adc2_r_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 1862 | SOC_DAPM_ENUM("Mono ADC2 R Source", rt5677_mono_adc2_r_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 1863 | |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 1864 | /* Mono ADC Right Source 1 */ /* MX-28 [5:4] */ |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 1865 | static const char * const rt5677_mono_adc1_r_src[] = { |
| 1866 | "DD MIX1R", "ADC2", "MONO DAC MIXR" |
| 1867 | }; |
| 1868 | |
| 1869 | static SOC_ENUM_SINGLE_DECL( |
| 1870 | rt5677_mono_adc1_r_enum, RT5677_MONO_ADC_MIXER, |
| 1871 | RT5677_SEL_MONO_ADC_R1_SFT, rt5677_mono_adc1_r_src); |
| 1872 | |
| 1873 | static const struct snd_kcontrol_new rt5677_mono_adc1_r_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 1874 | SOC_DAPM_ENUM("Mono ADC1 R Source", rt5677_mono_adc1_r_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 1875 | |
| 1876 | /* Stereo4 ADC Source 2 */ /* MX-24 [11:10] */ |
| 1877 | static const char * const rt5677_stereo4_adc2_src[] = { |
| 1878 | "DD MIX1", "DMIC", "DD MIX2" |
| 1879 | }; |
| 1880 | |
| 1881 | static SOC_ENUM_SINGLE_DECL( |
| 1882 | rt5677_stereo4_adc2_enum, RT5677_STO4_ADC_MIXER, |
| 1883 | RT5677_SEL_STO4_ADC2_SFT, rt5677_stereo4_adc2_src); |
| 1884 | |
| 1885 | static const struct snd_kcontrol_new rt5677_sto4_adc2_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 1886 | SOC_DAPM_ENUM("Stereo4 ADC2 Source", rt5677_stereo4_adc2_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 1887 | |
| 1888 | |
| 1889 | /* Stereo4 ADC Source 1 */ /* MX-24 [13:12] */ |
| 1890 | static const char * const rt5677_stereo4_adc1_src[] = { |
| 1891 | "DD MIX1", "ADC1/2", "DD MIX2" |
| 1892 | }; |
| 1893 | |
| 1894 | static SOC_ENUM_SINGLE_DECL( |
| 1895 | rt5677_stereo4_adc1_enum, RT5677_STO4_ADC_MIXER, |
| 1896 | RT5677_SEL_STO4_ADC1_SFT, rt5677_stereo4_adc1_src); |
| 1897 | |
| 1898 | static const struct snd_kcontrol_new rt5677_sto4_adc1_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 1899 | SOC_DAPM_ENUM("Stereo4 ADC1 Source", rt5677_stereo4_adc1_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 1900 | |
| 1901 | /* InBound0/1 Source */ /* MX-A3 [14:12] */ |
| 1902 | static const char * const rt5677_inbound01_src[] = { |
| 1903 | "IF1 DAC 01", "IF2 DAC 01", "SLB DAC 01", "STO1 ADC MIX", |
| 1904 | "VAD ADC/DAC1 FS" |
| 1905 | }; |
| 1906 | |
| 1907 | static SOC_ENUM_SINGLE_DECL( |
| 1908 | rt5677_inbound01_enum, RT5677_DSP_INB_CTRL1, |
| 1909 | RT5677_IB01_SRC_SFT, rt5677_inbound01_src); |
| 1910 | |
| 1911 | static const struct snd_kcontrol_new rt5677_ib01_src_mux = |
| 1912 | SOC_DAPM_ENUM("InBound0/1 Source", rt5677_inbound01_enum); |
| 1913 | |
| 1914 | /* InBound2/3 Source */ /* MX-A3 [10:8] */ |
| 1915 | static const char * const rt5677_inbound23_src[] = { |
| 1916 | "IF1 DAC 23", "IF2 DAC 23", "SLB DAC 23", "STO2 ADC MIX", |
| 1917 | "DAC1 FS", "IF4 DAC" |
| 1918 | }; |
| 1919 | |
| 1920 | static SOC_ENUM_SINGLE_DECL( |
| 1921 | rt5677_inbound23_enum, RT5677_DSP_INB_CTRL1, |
| 1922 | RT5677_IB23_SRC_SFT, rt5677_inbound23_src); |
| 1923 | |
| 1924 | static const struct snd_kcontrol_new rt5677_ib23_src_mux = |
| 1925 | SOC_DAPM_ENUM("InBound2/3 Source", rt5677_inbound23_enum); |
| 1926 | |
| 1927 | /* InBound4/5 Source */ /* MX-A3 [6:4] */ |
| 1928 | static const char * const rt5677_inbound45_src[] = { |
| 1929 | "IF1 DAC 45", "IF2 DAC 45", "SLB DAC 45", "STO3 ADC MIX", |
| 1930 | "IF3 DAC" |
| 1931 | }; |
| 1932 | |
| 1933 | static SOC_ENUM_SINGLE_DECL( |
| 1934 | rt5677_inbound45_enum, RT5677_DSP_INB_CTRL1, |
| 1935 | RT5677_IB45_SRC_SFT, rt5677_inbound45_src); |
| 1936 | |
| 1937 | static const struct snd_kcontrol_new rt5677_ib45_src_mux = |
| 1938 | SOC_DAPM_ENUM("InBound4/5 Source", rt5677_inbound45_enum); |
| 1939 | |
| 1940 | /* InBound6 Source */ /* MX-A3 [2:0] */ |
| 1941 | static const char * const rt5677_inbound6_src[] = { |
| 1942 | "IF1 DAC 6", "IF2 DAC 6", "SLB DAC 6", "STO4 ADC MIX L", |
| 1943 | "IF4 DAC L", "STO1 ADC MIX L", "STO2 ADC MIX L", "STO3 ADC MIX L" |
| 1944 | }; |
| 1945 | |
| 1946 | static SOC_ENUM_SINGLE_DECL( |
| 1947 | rt5677_inbound6_enum, RT5677_DSP_INB_CTRL1, |
| 1948 | RT5677_IB6_SRC_SFT, rt5677_inbound6_src); |
| 1949 | |
| 1950 | static const struct snd_kcontrol_new rt5677_ib6_src_mux = |
| 1951 | SOC_DAPM_ENUM("InBound6 Source", rt5677_inbound6_enum); |
| 1952 | |
| 1953 | /* InBound7 Source */ /* MX-A4 [14:12] */ |
| 1954 | static const char * const rt5677_inbound7_src[] = { |
| 1955 | "IF1 DAC 7", "IF2 DAC 7", "SLB DAC 7", "STO4 ADC MIX R", |
| 1956 | "IF4 DAC R", "STO1 ADC MIX R", "STO2 ADC MIX R", "STO3 ADC MIX R" |
| 1957 | }; |
| 1958 | |
| 1959 | static SOC_ENUM_SINGLE_DECL( |
| 1960 | rt5677_inbound7_enum, RT5677_DSP_INB_CTRL2, |
| 1961 | RT5677_IB7_SRC_SFT, rt5677_inbound7_src); |
| 1962 | |
| 1963 | static const struct snd_kcontrol_new rt5677_ib7_src_mux = |
| 1964 | SOC_DAPM_ENUM("InBound7 Source", rt5677_inbound7_enum); |
| 1965 | |
| 1966 | /* InBound8 Source */ /* MX-A4 [10:8] */ |
| 1967 | static const char * const rt5677_inbound8_src[] = { |
| 1968 | "STO1 ADC MIX L", "STO2 ADC MIX L", "STO3 ADC MIX L", "STO4 ADC MIX L", |
| 1969 | "MONO ADC MIX L", "DACL1 FS" |
| 1970 | }; |
| 1971 | |
| 1972 | static SOC_ENUM_SINGLE_DECL( |
| 1973 | rt5677_inbound8_enum, RT5677_DSP_INB_CTRL2, |
| 1974 | RT5677_IB8_SRC_SFT, rt5677_inbound8_src); |
| 1975 | |
| 1976 | static const struct snd_kcontrol_new rt5677_ib8_src_mux = |
| 1977 | SOC_DAPM_ENUM("InBound8 Source", rt5677_inbound8_enum); |
| 1978 | |
| 1979 | /* InBound9 Source */ /* MX-A4 [6:4] */ |
| 1980 | static const char * const rt5677_inbound9_src[] = { |
| 1981 | "STO1 ADC MIX R", "STO2 ADC MIX R", "STO3 ADC MIX R", "STO4 ADC MIX R", |
| 1982 | "MONO ADC MIX R", "DACR1 FS", "DAC1 FS" |
| 1983 | }; |
| 1984 | |
| 1985 | static SOC_ENUM_SINGLE_DECL( |
| 1986 | rt5677_inbound9_enum, RT5677_DSP_INB_CTRL2, |
| 1987 | RT5677_IB9_SRC_SFT, rt5677_inbound9_src); |
| 1988 | |
| 1989 | static const struct snd_kcontrol_new rt5677_ib9_src_mux = |
| 1990 | SOC_DAPM_ENUM("InBound9 Source", rt5677_inbound9_enum); |
| 1991 | |
| 1992 | /* VAD Source */ /* MX-9F [6:4] */ |
| 1993 | static const char * const rt5677_vad_src[] = { |
| 1994 | "STO1 ADC MIX L", "MONO ADC MIX L", "MONO ADC MIX R", "STO2 ADC MIX L", |
| 1995 | "STO3 ADC MIX L" |
| 1996 | }; |
| 1997 | |
| 1998 | static SOC_ENUM_SINGLE_DECL( |
| 1999 | rt5677_vad_enum, RT5677_VAD_CTRL4, |
| 2000 | RT5677_VAD_SRC_SFT, rt5677_vad_src); |
| 2001 | |
| 2002 | static const struct snd_kcontrol_new rt5677_vad_src_mux = |
| 2003 | SOC_DAPM_ENUM("VAD Source", rt5677_vad_enum); |
| 2004 | |
| 2005 | /* Sidetone Source */ /* MX-13 [11:9] */ |
| 2006 | static const char * const rt5677_sidetone_src[] = { |
| 2007 | "DMIC1 L", "DMIC2 L", "DMIC3 L", "DMIC4 L", "ADC1", "ADC2" |
| 2008 | }; |
| 2009 | |
| 2010 | static SOC_ENUM_SINGLE_DECL( |
| 2011 | rt5677_sidetone_enum, RT5677_SIDETONE_CTRL, |
| 2012 | RT5677_ST_SEL_SFT, rt5677_sidetone_src); |
| 2013 | |
| 2014 | static const struct snd_kcontrol_new rt5677_sidetone_mux = |
| 2015 | SOC_DAPM_ENUM("Sidetone Source", rt5677_sidetone_enum); |
| 2016 | |
| 2017 | /* DAC1/2 Source */ /* MX-15 [1:0] */ |
| 2018 | static const char * const rt5677_dac12_src[] = { |
| 2019 | "STO1 DAC MIX", "MONO DAC MIX", "DD MIX1", "DD MIX2" |
| 2020 | }; |
| 2021 | |
| 2022 | static SOC_ENUM_SINGLE_DECL( |
| 2023 | rt5677_dac12_enum, RT5677_ANA_DAC1_2_3_SRC, |
| 2024 | RT5677_ANA_DAC1_2_SRC_SEL_SFT, rt5677_dac12_src); |
| 2025 | |
| 2026 | static const struct snd_kcontrol_new rt5677_dac12_mux = |
| 2027 | SOC_DAPM_ENUM("Analog DAC1/2 Source", rt5677_dac12_enum); |
| 2028 | |
| 2029 | /* DAC3 Source */ /* MX-15 [5:4] */ |
| 2030 | static const char * const rt5677_dac3_src[] = { |
| 2031 | "MONO DAC MIXL", "MONO DAC MIXR", "DD MIX1L", "DD MIX2L" |
| 2032 | }; |
| 2033 | |
| 2034 | static SOC_ENUM_SINGLE_DECL( |
| 2035 | rt5677_dac3_enum, RT5677_ANA_DAC1_2_3_SRC, |
| 2036 | RT5677_ANA_DAC3_SRC_SEL_SFT, rt5677_dac3_src); |
| 2037 | |
| 2038 | static const struct snd_kcontrol_new rt5677_dac3_mux = |
| 2039 | SOC_DAPM_ENUM("Analog DAC3 Source", rt5677_dac3_enum); |
| 2040 | |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 2041 | /* PDM channel Source */ /* MX-31 [13:12][9:8][5:4][1:0] */ |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 2042 | static const char * const rt5677_pdm_src[] = { |
| 2043 | "STO1 DAC MIX", "MONO DAC MIX", "DD MIX1", "DD MIX2" |
| 2044 | }; |
| 2045 | |
| 2046 | static SOC_ENUM_SINGLE_DECL( |
| 2047 | rt5677_pdm1_l_enum, RT5677_PDM_OUT_CTRL, |
| 2048 | RT5677_SEL_PDM1_L_SFT, rt5677_pdm_src); |
| 2049 | |
| 2050 | static const struct snd_kcontrol_new rt5677_pdm1_l_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 2051 | SOC_DAPM_ENUM("PDM1 Source", rt5677_pdm1_l_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 2052 | |
| 2053 | static SOC_ENUM_SINGLE_DECL( |
| 2054 | rt5677_pdm2_l_enum, RT5677_PDM_OUT_CTRL, |
| 2055 | RT5677_SEL_PDM2_L_SFT, rt5677_pdm_src); |
| 2056 | |
| 2057 | static const struct snd_kcontrol_new rt5677_pdm2_l_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 2058 | SOC_DAPM_ENUM("PDM2 Source", rt5677_pdm2_l_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 2059 | |
| 2060 | static SOC_ENUM_SINGLE_DECL( |
| 2061 | rt5677_pdm1_r_enum, RT5677_PDM_OUT_CTRL, |
| 2062 | RT5677_SEL_PDM1_R_SFT, rt5677_pdm_src); |
| 2063 | |
| 2064 | static const struct snd_kcontrol_new rt5677_pdm1_r_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 2065 | SOC_DAPM_ENUM("PDM1 Source", rt5677_pdm1_r_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 2066 | |
| 2067 | static SOC_ENUM_SINGLE_DECL( |
| 2068 | rt5677_pdm2_r_enum, RT5677_PDM_OUT_CTRL, |
| 2069 | RT5677_SEL_PDM2_R_SFT, rt5677_pdm_src); |
| 2070 | |
| 2071 | static const struct snd_kcontrol_new rt5677_pdm2_r_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 2072 | SOC_DAPM_ENUM("PDM2 Source", rt5677_pdm2_r_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 2073 | |
Oder Chiou | d65fd3a | 2014-11-05 13:42:52 +0800 | [diff] [blame] | 2074 | /* TDM IF1/2 SLB ADC1 Data Selection */ /* MX-3C MX-41 [5:4] MX-08 [1:0] */ |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 2075 | static const char * const rt5677_if12_adc1_src[] = { |
| 2076 | "STO1 ADC MIX", "OB01", "VAD ADC" |
| 2077 | }; |
| 2078 | |
| 2079 | static SOC_ENUM_SINGLE_DECL( |
| 2080 | rt5677_if1_adc1_enum, RT5677_TDM1_CTRL2, |
| 2081 | RT5677_IF1_ADC1_SFT, rt5677_if12_adc1_src); |
| 2082 | |
| 2083 | static const struct snd_kcontrol_new rt5677_if1_adc1_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 2084 | SOC_DAPM_ENUM("IF1 ADC1 Source", rt5677_if1_adc1_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 2085 | |
| 2086 | static SOC_ENUM_SINGLE_DECL( |
| 2087 | rt5677_if2_adc1_enum, RT5677_TDM2_CTRL2, |
| 2088 | RT5677_IF2_ADC1_SFT, rt5677_if12_adc1_src); |
| 2089 | |
| 2090 | static const struct snd_kcontrol_new rt5677_if2_adc1_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 2091 | SOC_DAPM_ENUM("IF2 ADC1 Source", rt5677_if2_adc1_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 2092 | |
| 2093 | static SOC_ENUM_SINGLE_DECL( |
| 2094 | rt5677_slb_adc1_enum, RT5677_SLIMBUS_RX, |
| 2095 | RT5677_SLB_ADC1_SFT, rt5677_if12_adc1_src); |
| 2096 | |
| 2097 | static const struct snd_kcontrol_new rt5677_slb_adc1_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 2098 | SOC_DAPM_ENUM("SLB ADC1 Source", rt5677_slb_adc1_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 2099 | |
| 2100 | /* TDM IF1/2 SLB ADC2 Data Selection */ /* MX-3C MX-41 [7:6] MX-08 [3:2] */ |
| 2101 | static const char * const rt5677_if12_adc2_src[] = { |
| 2102 | "STO2 ADC MIX", "OB23" |
| 2103 | }; |
| 2104 | |
| 2105 | static SOC_ENUM_SINGLE_DECL( |
| 2106 | rt5677_if1_adc2_enum, RT5677_TDM1_CTRL2, |
| 2107 | RT5677_IF1_ADC2_SFT, rt5677_if12_adc2_src); |
| 2108 | |
| 2109 | static const struct snd_kcontrol_new rt5677_if1_adc2_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 2110 | SOC_DAPM_ENUM("IF1 ADC2 Source", rt5677_if1_adc2_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 2111 | |
| 2112 | static SOC_ENUM_SINGLE_DECL( |
| 2113 | rt5677_if2_adc2_enum, RT5677_TDM2_CTRL2, |
| 2114 | RT5677_IF2_ADC2_SFT, rt5677_if12_adc2_src); |
| 2115 | |
| 2116 | static const struct snd_kcontrol_new rt5677_if2_adc2_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 2117 | SOC_DAPM_ENUM("IF2 ADC2 Source", rt5677_if2_adc2_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 2118 | |
| 2119 | static SOC_ENUM_SINGLE_DECL( |
| 2120 | rt5677_slb_adc2_enum, RT5677_SLIMBUS_RX, |
| 2121 | RT5677_SLB_ADC2_SFT, rt5677_if12_adc2_src); |
| 2122 | |
| 2123 | static const struct snd_kcontrol_new rt5677_slb_adc2_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 2124 | SOC_DAPM_ENUM("SLB ADC2 Source", rt5677_slb_adc2_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 2125 | |
| 2126 | /* TDM IF1/2 SLB ADC3 Data Selection */ /* MX-3C MX-41 [9:8] MX-08 [5:4] */ |
| 2127 | static const char * const rt5677_if12_adc3_src[] = { |
| 2128 | "STO3 ADC MIX", "MONO ADC MIX", "OB45" |
| 2129 | }; |
| 2130 | |
| 2131 | static SOC_ENUM_SINGLE_DECL( |
| 2132 | rt5677_if1_adc3_enum, RT5677_TDM1_CTRL2, |
| 2133 | RT5677_IF1_ADC3_SFT, rt5677_if12_adc3_src); |
| 2134 | |
| 2135 | static const struct snd_kcontrol_new rt5677_if1_adc3_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 2136 | SOC_DAPM_ENUM("IF1 ADC3 Source", rt5677_if1_adc3_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 2137 | |
| 2138 | static SOC_ENUM_SINGLE_DECL( |
| 2139 | rt5677_if2_adc3_enum, RT5677_TDM2_CTRL2, |
| 2140 | RT5677_IF2_ADC3_SFT, rt5677_if12_adc3_src); |
| 2141 | |
| 2142 | static const struct snd_kcontrol_new rt5677_if2_adc3_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 2143 | SOC_DAPM_ENUM("IF2 ADC3 Source", rt5677_if2_adc3_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 2144 | |
| 2145 | static SOC_ENUM_SINGLE_DECL( |
| 2146 | rt5677_slb_adc3_enum, RT5677_SLIMBUS_RX, |
| 2147 | RT5677_SLB_ADC3_SFT, rt5677_if12_adc3_src); |
| 2148 | |
| 2149 | static const struct snd_kcontrol_new rt5677_slb_adc3_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 2150 | SOC_DAPM_ENUM("SLB ADC3 Source", rt5677_slb_adc3_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 2151 | |
Oder Chiou | d65fd3a | 2014-11-05 13:42:52 +0800 | [diff] [blame] | 2152 | /* TDM IF1/2 SLB ADC4 Data Selection */ /* MX-3C MX-41 [11:10] MX-08 [7:6] */ |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 2153 | static const char * const rt5677_if12_adc4_src[] = { |
| 2154 | "STO4 ADC MIX", "OB67", "OB01" |
| 2155 | }; |
| 2156 | |
| 2157 | static SOC_ENUM_SINGLE_DECL( |
| 2158 | rt5677_if1_adc4_enum, RT5677_TDM1_CTRL2, |
| 2159 | RT5677_IF1_ADC4_SFT, rt5677_if12_adc4_src); |
| 2160 | |
| 2161 | static const struct snd_kcontrol_new rt5677_if1_adc4_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 2162 | SOC_DAPM_ENUM("IF1 ADC4 Source", rt5677_if1_adc4_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 2163 | |
| 2164 | static SOC_ENUM_SINGLE_DECL( |
| 2165 | rt5677_if2_adc4_enum, RT5677_TDM2_CTRL2, |
| 2166 | RT5677_IF2_ADC4_SFT, rt5677_if12_adc4_src); |
| 2167 | |
| 2168 | static const struct snd_kcontrol_new rt5677_if2_adc4_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 2169 | SOC_DAPM_ENUM("IF2 ADC4 Source", rt5677_if2_adc4_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 2170 | |
| 2171 | static SOC_ENUM_SINGLE_DECL( |
| 2172 | rt5677_slb_adc4_enum, RT5677_SLIMBUS_RX, |
| 2173 | RT5677_SLB_ADC4_SFT, rt5677_if12_adc4_src); |
| 2174 | |
| 2175 | static const struct snd_kcontrol_new rt5677_slb_adc4_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 2176 | SOC_DAPM_ENUM("SLB ADC4 Source", rt5677_slb_adc4_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 2177 | |
Oder Chiou | d65fd3a | 2014-11-05 13:42:52 +0800 | [diff] [blame] | 2178 | /* Interface3/4 ADC Data Input */ /* MX-2F [3:0] MX-30 [7:4] */ |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 2179 | static const char * const rt5677_if34_adc_src[] = { |
| 2180 | "STO1 ADC MIX", "STO2 ADC MIX", "STO3 ADC MIX", "STO4 ADC MIX", |
| 2181 | "MONO ADC MIX", "OB01", "OB23", "VAD ADC" |
| 2182 | }; |
| 2183 | |
| 2184 | static SOC_ENUM_SINGLE_DECL( |
| 2185 | rt5677_if3_adc_enum, RT5677_IF3_DATA, |
| 2186 | RT5677_IF3_ADC_IN_SFT, rt5677_if34_adc_src); |
| 2187 | |
| 2188 | static const struct snd_kcontrol_new rt5677_if3_adc_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 2189 | SOC_DAPM_ENUM("IF3 ADC Source", rt5677_if3_adc_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 2190 | |
| 2191 | static SOC_ENUM_SINGLE_DECL( |
| 2192 | rt5677_if4_adc_enum, RT5677_IF4_DATA, |
| 2193 | RT5677_IF4_ADC_IN_SFT, rt5677_if34_adc_src); |
| 2194 | |
| 2195 | static const struct snd_kcontrol_new rt5677_if4_adc_mux = |
Oder Chiou | 1b7fd76 | 2014-06-10 14:35:24 +0800 | [diff] [blame] | 2196 | SOC_DAPM_ENUM("IF4 ADC Source", rt5677_if4_adc_enum); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 2197 | |
Oder Chiou | e6f6ebc | 2014-10-22 16:11:39 +0800 | [diff] [blame] | 2198 | /* TDM IF1/2 ADC Data Selection */ /* MX-3B MX-40 [7:6][5:4][3:2][1:0] */ |
| 2199 | static const char * const rt5677_if12_adc_swap_src[] = { |
| 2200 | "L/R", "R/L", "L/L", "R/R" |
| 2201 | }; |
| 2202 | |
| 2203 | static SOC_ENUM_SINGLE_DECL( |
| 2204 | rt5677_if1_adc1_swap_enum, RT5677_TDM1_CTRL1, |
| 2205 | RT5677_IF1_ADC1_SWAP_SFT, rt5677_if12_adc_swap_src); |
| 2206 | |
| 2207 | static const struct snd_kcontrol_new rt5677_if1_adc1_swap_mux = |
| 2208 | SOC_DAPM_ENUM("IF1 ADC1 Swap Source", rt5677_if1_adc1_swap_enum); |
| 2209 | |
| 2210 | static SOC_ENUM_SINGLE_DECL( |
| 2211 | rt5677_if1_adc2_swap_enum, RT5677_TDM1_CTRL1, |
| 2212 | RT5677_IF1_ADC2_SWAP_SFT, rt5677_if12_adc_swap_src); |
| 2213 | |
| 2214 | static const struct snd_kcontrol_new rt5677_if1_adc2_swap_mux = |
| 2215 | SOC_DAPM_ENUM("IF1 ADC2 Swap Source", rt5677_if1_adc2_swap_enum); |
| 2216 | |
| 2217 | static SOC_ENUM_SINGLE_DECL( |
| 2218 | rt5677_if1_adc3_swap_enum, RT5677_TDM1_CTRL1, |
| 2219 | RT5677_IF1_ADC3_SWAP_SFT, rt5677_if12_adc_swap_src); |
| 2220 | |
| 2221 | static const struct snd_kcontrol_new rt5677_if1_adc3_swap_mux = |
| 2222 | SOC_DAPM_ENUM("IF1 ADC3 Swap Source", rt5677_if1_adc3_swap_enum); |
| 2223 | |
| 2224 | static SOC_ENUM_SINGLE_DECL( |
| 2225 | rt5677_if1_adc4_swap_enum, RT5677_TDM1_CTRL1, |
| 2226 | RT5677_IF1_ADC4_SWAP_SFT, rt5677_if12_adc_swap_src); |
| 2227 | |
| 2228 | static const struct snd_kcontrol_new rt5677_if1_adc4_swap_mux = |
| 2229 | SOC_DAPM_ENUM("IF1 ADC4 Swap Source", rt5677_if1_adc4_swap_enum); |
| 2230 | |
| 2231 | static SOC_ENUM_SINGLE_DECL( |
| 2232 | rt5677_if2_adc1_swap_enum, RT5677_TDM2_CTRL1, |
| 2233 | RT5677_IF1_ADC2_SWAP_SFT, rt5677_if12_adc_swap_src); |
| 2234 | |
| 2235 | static const struct snd_kcontrol_new rt5677_if2_adc1_swap_mux = |
| 2236 | SOC_DAPM_ENUM("IF1 ADC2 Swap Source", rt5677_if2_adc1_swap_enum); |
| 2237 | |
| 2238 | static SOC_ENUM_SINGLE_DECL( |
| 2239 | rt5677_if2_adc2_swap_enum, RT5677_TDM2_CTRL1, |
| 2240 | RT5677_IF2_ADC2_SWAP_SFT, rt5677_if12_adc_swap_src); |
| 2241 | |
| 2242 | static const struct snd_kcontrol_new rt5677_if2_adc2_swap_mux = |
| 2243 | SOC_DAPM_ENUM("IF2 ADC2 Swap Source", rt5677_if2_adc2_swap_enum); |
| 2244 | |
| 2245 | static SOC_ENUM_SINGLE_DECL( |
| 2246 | rt5677_if2_adc3_swap_enum, RT5677_TDM2_CTRL1, |
| 2247 | RT5677_IF2_ADC3_SWAP_SFT, rt5677_if12_adc_swap_src); |
| 2248 | |
| 2249 | static const struct snd_kcontrol_new rt5677_if2_adc3_swap_mux = |
| 2250 | SOC_DAPM_ENUM("IF2 ADC3 Swap Source", rt5677_if2_adc3_swap_enum); |
| 2251 | |
| 2252 | static SOC_ENUM_SINGLE_DECL( |
| 2253 | rt5677_if2_adc4_swap_enum, RT5677_TDM2_CTRL1, |
| 2254 | RT5677_IF2_ADC4_SWAP_SFT, rt5677_if12_adc_swap_src); |
| 2255 | |
| 2256 | static const struct snd_kcontrol_new rt5677_if2_adc4_swap_mux = |
| 2257 | SOC_DAPM_ENUM("IF2 ADC4 Swap Source", rt5677_if2_adc4_swap_enum); |
| 2258 | |
Oder Chiou | d65fd3a | 2014-11-05 13:42:52 +0800 | [diff] [blame] | 2259 | /* TDM IF1 ADC Data Selection */ /* MX-3C [2:0] */ |
Oder Chiou | e6f6ebc | 2014-10-22 16:11:39 +0800 | [diff] [blame] | 2260 | static const char * const rt5677_if1_adc_tdm_swap_src[] = { |
| 2261 | "1/2/3/4", "2/1/3/4", "2/3/1/4", "4/1/2/3", "1/3/2/4", "1/4/2/3", |
| 2262 | "3/1/2/4", "3/4/1/2" |
| 2263 | }; |
| 2264 | |
| 2265 | static SOC_ENUM_SINGLE_DECL( |
| 2266 | rt5677_if1_adc_tdm_swap_enum, RT5677_TDM1_CTRL2, |
| 2267 | RT5677_IF1_ADC_CTRL_SFT, rt5677_if1_adc_tdm_swap_src); |
| 2268 | |
| 2269 | static const struct snd_kcontrol_new rt5677_if1_adc_tdm_swap_mux = |
| 2270 | SOC_DAPM_ENUM("IF1 ADC TDM Swap Source", rt5677_if1_adc_tdm_swap_enum); |
| 2271 | |
| 2272 | /* TDM IF2 ADC Data Selection */ /* MX-41[2:0] */ |
| 2273 | static const char * const rt5677_if2_adc_tdm_swap_src[] = { |
| 2274 | "1/2/3/4", "2/1/3/4", "3/1/2/4", "4/1/2/3", "1/3/2/4", "1/4/2/3", |
| 2275 | "2/3/1/4", "3/4/1/2" |
| 2276 | }; |
| 2277 | |
| 2278 | static SOC_ENUM_SINGLE_DECL( |
| 2279 | rt5677_if2_adc_tdm_swap_enum, RT5677_TDM2_CTRL2, |
| 2280 | RT5677_IF2_ADC_CTRL_SFT, rt5677_if2_adc_tdm_swap_src); |
| 2281 | |
| 2282 | static const struct snd_kcontrol_new rt5677_if2_adc_tdm_swap_mux = |
| 2283 | SOC_DAPM_ENUM("IF2 ADC TDM Swap Source", rt5677_if2_adc_tdm_swap_enum); |
| 2284 | |
Oder Chiou | 91159ec | 2014-11-11 15:31:19 +0800 | [diff] [blame] | 2285 | /* TDM IF1/2 DAC Data Selection */ /* MX-3E[14:12][10:8][6:4][2:0] |
| 2286 | MX-3F[14:12][10:8][6:4][2:0] |
| 2287 | MX-43[14:12][10:8][6:4][2:0] |
| 2288 | MX-44[14:12][10:8][6:4][2:0] */ |
| 2289 | static const char * const rt5677_if12_dac_tdm_sel_src[] = { |
| 2290 | "Slot0", "Slot1", "Slot2", "Slot3", "Slot4", "Slot5", "Slot6", "Slot7" |
| 2291 | }; |
| 2292 | |
| 2293 | static SOC_ENUM_SINGLE_DECL( |
| 2294 | rt5677_if1_dac0_tdm_sel_enum, RT5677_TDM1_CTRL4, |
| 2295 | RT5677_IF1_DAC0_SFT, rt5677_if12_dac_tdm_sel_src); |
| 2296 | |
| 2297 | static const struct snd_kcontrol_new rt5677_if1_dac0_tdm_sel_mux = |
| 2298 | SOC_DAPM_ENUM("IF1 DAC0 TDM Source", rt5677_if1_dac0_tdm_sel_enum); |
| 2299 | |
| 2300 | static SOC_ENUM_SINGLE_DECL( |
| 2301 | rt5677_if1_dac1_tdm_sel_enum, RT5677_TDM1_CTRL4, |
| 2302 | RT5677_IF1_DAC1_SFT, rt5677_if12_dac_tdm_sel_src); |
| 2303 | |
| 2304 | static const struct snd_kcontrol_new rt5677_if1_dac1_tdm_sel_mux = |
| 2305 | SOC_DAPM_ENUM("IF1 DAC1 TDM Source", rt5677_if1_dac1_tdm_sel_enum); |
| 2306 | |
| 2307 | static SOC_ENUM_SINGLE_DECL( |
| 2308 | rt5677_if1_dac2_tdm_sel_enum, RT5677_TDM1_CTRL4, |
| 2309 | RT5677_IF1_DAC2_SFT, rt5677_if12_dac_tdm_sel_src); |
| 2310 | |
| 2311 | static const struct snd_kcontrol_new rt5677_if1_dac2_tdm_sel_mux = |
| 2312 | SOC_DAPM_ENUM("IF1 DAC2 TDM Source", rt5677_if1_dac2_tdm_sel_enum); |
| 2313 | |
| 2314 | static SOC_ENUM_SINGLE_DECL( |
| 2315 | rt5677_if1_dac3_tdm_sel_enum, RT5677_TDM1_CTRL4, |
| 2316 | RT5677_IF1_DAC3_SFT, rt5677_if12_dac_tdm_sel_src); |
| 2317 | |
| 2318 | static const struct snd_kcontrol_new rt5677_if1_dac3_tdm_sel_mux = |
| 2319 | SOC_DAPM_ENUM("IF1 DAC3 TDM Source", rt5677_if1_dac3_tdm_sel_enum); |
| 2320 | |
| 2321 | static SOC_ENUM_SINGLE_DECL( |
| 2322 | rt5677_if1_dac4_tdm_sel_enum, RT5677_TDM1_CTRL5, |
| 2323 | RT5677_IF1_DAC4_SFT, rt5677_if12_dac_tdm_sel_src); |
| 2324 | |
| 2325 | static const struct snd_kcontrol_new rt5677_if1_dac4_tdm_sel_mux = |
| 2326 | SOC_DAPM_ENUM("IF1 DAC4 TDM Source", rt5677_if1_dac4_tdm_sel_enum); |
| 2327 | |
| 2328 | static SOC_ENUM_SINGLE_DECL( |
| 2329 | rt5677_if1_dac5_tdm_sel_enum, RT5677_TDM1_CTRL5, |
| 2330 | RT5677_IF1_DAC5_SFT, rt5677_if12_dac_tdm_sel_src); |
| 2331 | |
| 2332 | static const struct snd_kcontrol_new rt5677_if1_dac5_tdm_sel_mux = |
| 2333 | SOC_DAPM_ENUM("IF1 DAC5 TDM Source", rt5677_if1_dac5_tdm_sel_enum); |
| 2334 | |
| 2335 | static SOC_ENUM_SINGLE_DECL( |
| 2336 | rt5677_if1_dac6_tdm_sel_enum, RT5677_TDM1_CTRL5, |
| 2337 | RT5677_IF1_DAC6_SFT, rt5677_if12_dac_tdm_sel_src); |
| 2338 | |
| 2339 | static const struct snd_kcontrol_new rt5677_if1_dac6_tdm_sel_mux = |
| 2340 | SOC_DAPM_ENUM("IF1 DAC6 TDM Source", rt5677_if1_dac6_tdm_sel_enum); |
| 2341 | |
| 2342 | static SOC_ENUM_SINGLE_DECL( |
| 2343 | rt5677_if1_dac7_tdm_sel_enum, RT5677_TDM1_CTRL5, |
| 2344 | RT5677_IF1_DAC7_SFT, rt5677_if12_dac_tdm_sel_src); |
| 2345 | |
| 2346 | static const struct snd_kcontrol_new rt5677_if1_dac7_tdm_sel_mux = |
| 2347 | SOC_DAPM_ENUM("IF1 DAC7 TDM Source", rt5677_if1_dac7_tdm_sel_enum); |
| 2348 | |
| 2349 | static SOC_ENUM_SINGLE_DECL( |
| 2350 | rt5677_if2_dac0_tdm_sel_enum, RT5677_TDM2_CTRL4, |
| 2351 | RT5677_IF2_DAC0_SFT, rt5677_if12_dac_tdm_sel_src); |
| 2352 | |
| 2353 | static const struct snd_kcontrol_new rt5677_if2_dac0_tdm_sel_mux = |
| 2354 | SOC_DAPM_ENUM("IF2 DAC0 TDM Source", rt5677_if2_dac0_tdm_sel_enum); |
| 2355 | |
| 2356 | static SOC_ENUM_SINGLE_DECL( |
| 2357 | rt5677_if2_dac1_tdm_sel_enum, RT5677_TDM2_CTRL4, |
| 2358 | RT5677_IF2_DAC1_SFT, rt5677_if12_dac_tdm_sel_src); |
| 2359 | |
| 2360 | static const struct snd_kcontrol_new rt5677_if2_dac1_tdm_sel_mux = |
| 2361 | SOC_DAPM_ENUM("IF2 DAC1 TDM Source", rt5677_if2_dac1_tdm_sel_enum); |
| 2362 | |
| 2363 | static SOC_ENUM_SINGLE_DECL( |
| 2364 | rt5677_if2_dac2_tdm_sel_enum, RT5677_TDM2_CTRL4, |
| 2365 | RT5677_IF2_DAC2_SFT, rt5677_if12_dac_tdm_sel_src); |
| 2366 | |
| 2367 | static const struct snd_kcontrol_new rt5677_if2_dac2_tdm_sel_mux = |
| 2368 | SOC_DAPM_ENUM("IF2 DAC2 TDM Source", rt5677_if2_dac2_tdm_sel_enum); |
| 2369 | |
| 2370 | static SOC_ENUM_SINGLE_DECL( |
| 2371 | rt5677_if2_dac3_tdm_sel_enum, RT5677_TDM2_CTRL4, |
| 2372 | RT5677_IF2_DAC3_SFT, rt5677_if12_dac_tdm_sel_src); |
| 2373 | |
| 2374 | static const struct snd_kcontrol_new rt5677_if2_dac3_tdm_sel_mux = |
| 2375 | SOC_DAPM_ENUM("IF2 DAC3 TDM Source", rt5677_if2_dac3_tdm_sel_enum); |
| 2376 | |
| 2377 | static SOC_ENUM_SINGLE_DECL( |
| 2378 | rt5677_if2_dac4_tdm_sel_enum, RT5677_TDM2_CTRL5, |
| 2379 | RT5677_IF2_DAC4_SFT, rt5677_if12_dac_tdm_sel_src); |
| 2380 | |
| 2381 | static const struct snd_kcontrol_new rt5677_if2_dac4_tdm_sel_mux = |
| 2382 | SOC_DAPM_ENUM("IF2 DAC4 TDM Source", rt5677_if2_dac4_tdm_sel_enum); |
| 2383 | |
| 2384 | static SOC_ENUM_SINGLE_DECL( |
| 2385 | rt5677_if2_dac5_tdm_sel_enum, RT5677_TDM2_CTRL5, |
| 2386 | RT5677_IF2_DAC5_SFT, rt5677_if12_dac_tdm_sel_src); |
| 2387 | |
| 2388 | static const struct snd_kcontrol_new rt5677_if2_dac5_tdm_sel_mux = |
| 2389 | SOC_DAPM_ENUM("IF2 DAC5 TDM Source", rt5677_if2_dac5_tdm_sel_enum); |
| 2390 | |
| 2391 | static SOC_ENUM_SINGLE_DECL( |
| 2392 | rt5677_if2_dac6_tdm_sel_enum, RT5677_TDM2_CTRL5, |
| 2393 | RT5677_IF2_DAC6_SFT, rt5677_if12_dac_tdm_sel_src); |
| 2394 | |
| 2395 | static const struct snd_kcontrol_new rt5677_if2_dac6_tdm_sel_mux = |
| 2396 | SOC_DAPM_ENUM("IF2 DAC6 TDM Source", rt5677_if2_dac6_tdm_sel_enum); |
| 2397 | |
| 2398 | static SOC_ENUM_SINGLE_DECL( |
| 2399 | rt5677_if2_dac7_tdm_sel_enum, RT5677_TDM2_CTRL5, |
| 2400 | RT5677_IF2_DAC7_SFT, rt5677_if12_dac_tdm_sel_src); |
| 2401 | |
| 2402 | static const struct snd_kcontrol_new rt5677_if2_dac7_tdm_sel_mux = |
| 2403 | SOC_DAPM_ENUM("IF2 DAC7 TDM Source", rt5677_if2_dac7_tdm_sel_enum); |
| 2404 | |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 2405 | static int rt5677_bst1_event(struct snd_soc_dapm_widget *w, |
| 2406 | struct snd_kcontrol *kcontrol, int event) |
| 2407 | { |
Lars-Peter Clausen | 46f2087 | 2015-01-15 12:52:16 +0100 | [diff] [blame] | 2408 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 2409 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); |
| 2410 | |
| 2411 | switch (event) { |
| 2412 | case SND_SOC_DAPM_POST_PMU: |
| 2413 | regmap_update_bits(rt5677->regmap, RT5677_PWR_ANLG2, |
| 2414 | RT5677_PWR_BST1_P, RT5677_PWR_BST1_P); |
| 2415 | break; |
| 2416 | |
| 2417 | case SND_SOC_DAPM_PRE_PMD: |
| 2418 | regmap_update_bits(rt5677->regmap, RT5677_PWR_ANLG2, |
| 2419 | RT5677_PWR_BST1_P, 0); |
| 2420 | break; |
| 2421 | |
| 2422 | default: |
| 2423 | return 0; |
| 2424 | } |
| 2425 | |
| 2426 | return 0; |
| 2427 | } |
| 2428 | |
| 2429 | static int rt5677_bst2_event(struct snd_soc_dapm_widget *w, |
| 2430 | struct snd_kcontrol *kcontrol, int event) |
| 2431 | { |
Lars-Peter Clausen | 46f2087 | 2015-01-15 12:52:16 +0100 | [diff] [blame] | 2432 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 2433 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); |
| 2434 | |
| 2435 | switch (event) { |
| 2436 | case SND_SOC_DAPM_POST_PMU: |
| 2437 | regmap_update_bits(rt5677->regmap, RT5677_PWR_ANLG2, |
| 2438 | RT5677_PWR_BST2_P, RT5677_PWR_BST2_P); |
| 2439 | break; |
| 2440 | |
| 2441 | case SND_SOC_DAPM_PRE_PMD: |
| 2442 | regmap_update_bits(rt5677->regmap, RT5677_PWR_ANLG2, |
| 2443 | RT5677_PWR_BST2_P, 0); |
| 2444 | break; |
| 2445 | |
| 2446 | default: |
| 2447 | return 0; |
| 2448 | } |
| 2449 | |
| 2450 | return 0; |
| 2451 | } |
| 2452 | |
| 2453 | static int rt5677_set_pll1_event(struct snd_soc_dapm_widget *w, |
| 2454 | struct snd_kcontrol *kcontrol, int event) |
| 2455 | { |
Lars-Peter Clausen | 46f2087 | 2015-01-15 12:52:16 +0100 | [diff] [blame] | 2456 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 2457 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); |
| 2458 | |
| 2459 | switch (event) { |
Oder Chiou | bdfbf25 | 2015-01-08 10:31:05 +0800 | [diff] [blame] | 2460 | case SND_SOC_DAPM_PRE_PMU: |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 2461 | regmap_update_bits(rt5677->regmap, RT5677_PLL1_CTRL2, 0x2, 0x2); |
Oder Chiou | bdfbf25 | 2015-01-08 10:31:05 +0800 | [diff] [blame] | 2462 | break; |
| 2463 | |
| 2464 | case SND_SOC_DAPM_POST_PMU: |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 2465 | regmap_update_bits(rt5677->regmap, RT5677_PLL1_CTRL2, 0x2, 0x0); |
| 2466 | break; |
Oder Chiou | bdfbf25 | 2015-01-08 10:31:05 +0800 | [diff] [blame] | 2467 | |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 2468 | default: |
| 2469 | return 0; |
| 2470 | } |
| 2471 | |
| 2472 | return 0; |
| 2473 | } |
| 2474 | |
| 2475 | static int rt5677_set_pll2_event(struct snd_soc_dapm_widget *w, |
| 2476 | struct snd_kcontrol *kcontrol, int event) |
| 2477 | { |
Lars-Peter Clausen | 46f2087 | 2015-01-15 12:52:16 +0100 | [diff] [blame] | 2478 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 2479 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); |
| 2480 | |
| 2481 | switch (event) { |
Oder Chiou | bdfbf25 | 2015-01-08 10:31:05 +0800 | [diff] [blame] | 2482 | case SND_SOC_DAPM_PRE_PMU: |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 2483 | regmap_update_bits(rt5677->regmap, RT5677_PLL2_CTRL2, 0x2, 0x2); |
Oder Chiou | bdfbf25 | 2015-01-08 10:31:05 +0800 | [diff] [blame] | 2484 | break; |
| 2485 | |
| 2486 | case SND_SOC_DAPM_POST_PMU: |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 2487 | regmap_update_bits(rt5677->regmap, RT5677_PLL2_CTRL2, 0x2, 0x0); |
| 2488 | break; |
Oder Chiou | bdfbf25 | 2015-01-08 10:31:05 +0800 | [diff] [blame] | 2489 | |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 2490 | default: |
| 2491 | return 0; |
| 2492 | } |
| 2493 | |
| 2494 | return 0; |
| 2495 | } |
| 2496 | |
| 2497 | static int rt5677_set_micbias1_event(struct snd_soc_dapm_widget *w, |
| 2498 | struct snd_kcontrol *kcontrol, int event) |
| 2499 | { |
Lars-Peter Clausen | 46f2087 | 2015-01-15 12:52:16 +0100 | [diff] [blame] | 2500 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 2501 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); |
| 2502 | |
| 2503 | switch (event) { |
| 2504 | case SND_SOC_DAPM_POST_PMU: |
| 2505 | regmap_update_bits(rt5677->regmap, RT5677_PWR_ANLG2, |
| 2506 | RT5677_PWR_CLK_MB1 | RT5677_PWR_PP_MB1 | |
| 2507 | RT5677_PWR_CLK_MB, RT5677_PWR_CLK_MB1 | |
| 2508 | RT5677_PWR_PP_MB1 | RT5677_PWR_CLK_MB); |
| 2509 | break; |
Oder Chiou | f58c3b9 | 2014-06-10 14:35:26 +0800 | [diff] [blame] | 2510 | |
| 2511 | case SND_SOC_DAPM_PRE_PMD: |
| 2512 | regmap_update_bits(rt5677->regmap, RT5677_PWR_ANLG2, |
| 2513 | RT5677_PWR_CLK_MB1 | RT5677_PWR_PP_MB1 | |
| 2514 | RT5677_PWR_CLK_MB, 0); |
| 2515 | break; |
| 2516 | |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 2517 | default: |
| 2518 | return 0; |
| 2519 | } |
| 2520 | |
| 2521 | return 0; |
| 2522 | } |
| 2523 | |
Oder Chiou | e6f6ebc | 2014-10-22 16:11:39 +0800 | [diff] [blame] | 2524 | static int rt5677_if1_adc_tdm_event(struct snd_soc_dapm_widget *w, |
| 2525 | struct snd_kcontrol *kcontrol, int event) |
| 2526 | { |
Lars-Peter Clausen | 46f2087 | 2015-01-15 12:52:16 +0100 | [diff] [blame] | 2527 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
Oder Chiou | e6f6ebc | 2014-10-22 16:11:39 +0800 | [diff] [blame] | 2528 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); |
| 2529 | unsigned int value; |
| 2530 | |
| 2531 | switch (event) { |
| 2532 | case SND_SOC_DAPM_PRE_PMU: |
| 2533 | regmap_read(rt5677->regmap, RT5677_TDM1_CTRL2, &value); |
| 2534 | if (value & RT5677_IF1_ADC_CTRL_MASK) |
| 2535 | regmap_update_bits(rt5677->regmap, RT5677_TDM1_CTRL1, |
| 2536 | RT5677_IF1_ADC_MODE_MASK, |
| 2537 | RT5677_IF1_ADC_MODE_TDM); |
| 2538 | break; |
| 2539 | |
| 2540 | default: |
| 2541 | return 0; |
| 2542 | } |
| 2543 | |
| 2544 | return 0; |
| 2545 | } |
| 2546 | |
| 2547 | static int rt5677_if2_adc_tdm_event(struct snd_soc_dapm_widget *w, |
| 2548 | struct snd_kcontrol *kcontrol, int event) |
| 2549 | { |
Lars-Peter Clausen | 46f2087 | 2015-01-15 12:52:16 +0100 | [diff] [blame] | 2550 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
Oder Chiou | e6f6ebc | 2014-10-22 16:11:39 +0800 | [diff] [blame] | 2551 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); |
| 2552 | unsigned int value; |
| 2553 | |
| 2554 | switch (event) { |
| 2555 | case SND_SOC_DAPM_PRE_PMU: |
| 2556 | regmap_read(rt5677->regmap, RT5677_TDM2_CTRL2, &value); |
| 2557 | if (value & RT5677_IF2_ADC_CTRL_MASK) |
| 2558 | regmap_update_bits(rt5677->regmap, RT5677_TDM2_CTRL1, |
| 2559 | RT5677_IF2_ADC_MODE_MASK, |
| 2560 | RT5677_IF2_ADC_MODE_TDM); |
| 2561 | break; |
| 2562 | |
| 2563 | default: |
| 2564 | return 0; |
| 2565 | } |
| 2566 | |
| 2567 | return 0; |
| 2568 | } |
| 2569 | |
Oder Chiou | 683996c | 2014-11-19 13:52:20 +0800 | [diff] [blame] | 2570 | static int rt5677_vref_event(struct snd_soc_dapm_widget *w, |
| 2571 | struct snd_kcontrol *kcontrol, int event) |
| 2572 | { |
Lars-Peter Clausen | 46f2087 | 2015-01-15 12:52:16 +0100 | [diff] [blame] | 2573 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); |
Oder Chiou | 683996c | 2014-11-19 13:52:20 +0800 | [diff] [blame] | 2574 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); |
| 2575 | |
| 2576 | switch (event) { |
| 2577 | case SND_SOC_DAPM_POST_PMU: |
| 2578 | if (codec->dapm.bias_level != SND_SOC_BIAS_ON && |
| 2579 | !rt5677->is_vref_slow) { |
| 2580 | mdelay(20); |
| 2581 | regmap_update_bits(rt5677->regmap, RT5677_PWR_ANLG1, |
| 2582 | RT5677_PWR_FV1 | RT5677_PWR_FV2, |
| 2583 | RT5677_PWR_FV1 | RT5677_PWR_FV2); |
| 2584 | rt5677->is_vref_slow = true; |
| 2585 | } |
| 2586 | break; |
| 2587 | |
| 2588 | default: |
| 2589 | return 0; |
| 2590 | } |
| 2591 | |
| 2592 | return 0; |
| 2593 | } |
| 2594 | |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 2595 | static const struct snd_soc_dapm_widget rt5677_dapm_widgets[] = { |
| 2596 | SND_SOC_DAPM_SUPPLY("PLL1", RT5677_PWR_ANLG2, RT5677_PWR_PLL1_BIT, |
Oder Chiou | bdfbf25 | 2015-01-08 10:31:05 +0800 | [diff] [blame] | 2597 | 0, rt5677_set_pll1_event, SND_SOC_DAPM_PRE_PMU | |
| 2598 | SND_SOC_DAPM_POST_PMU), |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 2599 | SND_SOC_DAPM_SUPPLY("PLL2", RT5677_PWR_ANLG2, RT5677_PWR_PLL2_BIT, |
Oder Chiou | bdfbf25 | 2015-01-08 10:31:05 +0800 | [diff] [blame] | 2600 | 0, rt5677_set_pll2_event, SND_SOC_DAPM_PRE_PMU | |
| 2601 | SND_SOC_DAPM_POST_PMU), |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 2602 | |
Oder Chiou | 5a8c7c2 | 2014-12-23 10:27:55 +0800 | [diff] [blame] | 2603 | /* ASRC */ |
| 2604 | SND_SOC_DAPM_SUPPLY_S("I2S1 ASRC", 1, RT5677_ASRC_1, 0, 0, NULL, 0), |
| 2605 | SND_SOC_DAPM_SUPPLY_S("I2S2 ASRC", 1, RT5677_ASRC_1, 1, 0, NULL, 0), |
| 2606 | SND_SOC_DAPM_SUPPLY_S("I2S3 ASRC", 1, RT5677_ASRC_1, 2, 0, NULL, 0), |
| 2607 | SND_SOC_DAPM_SUPPLY_S("I2S4 ASRC", 1, RT5677_ASRC_1, 3, 0, NULL, 0), |
| 2608 | SND_SOC_DAPM_SUPPLY_S("DAC STO ASRC", 1, RT5677_ASRC_2, 14, 0, NULL, 0), |
| 2609 | SND_SOC_DAPM_SUPPLY_S("DAC MONO2 L ASRC", 1, RT5677_ASRC_2, 13, 0, NULL, |
| 2610 | 0), |
| 2611 | SND_SOC_DAPM_SUPPLY_S("DAC MONO2 R ASRC", 1, RT5677_ASRC_2, 12, 0, NULL, |
| 2612 | 0), |
| 2613 | SND_SOC_DAPM_SUPPLY_S("DAC MONO3 L ASRC", 1, RT5677_ASRC_1, 15, 0, NULL, |
| 2614 | 0), |
| 2615 | SND_SOC_DAPM_SUPPLY_S("DAC MONO3 R ASRC", 1, RT5677_ASRC_1, 14, 0, NULL, |
| 2616 | 0), |
| 2617 | SND_SOC_DAPM_SUPPLY_S("DAC MONO4 L ASRC", 1, RT5677_ASRC_1, 13, 0, NULL, |
| 2618 | 0), |
| 2619 | SND_SOC_DAPM_SUPPLY_S("DAC MONO4 R ASRC", 1, RT5677_ASRC_1, 12, 0, NULL, |
| 2620 | 0), |
| 2621 | SND_SOC_DAPM_SUPPLY_S("DMIC STO1 ASRC", 1, RT5677_ASRC_2, 11, 0, NULL, |
| 2622 | 0), |
| 2623 | SND_SOC_DAPM_SUPPLY_S("DMIC STO2 ASRC", 1, RT5677_ASRC_2, 10, 0, NULL, |
| 2624 | 0), |
| 2625 | SND_SOC_DAPM_SUPPLY_S("DMIC STO3 ASRC", 1, RT5677_ASRC_2, 9, 0, NULL, |
| 2626 | 0), |
| 2627 | SND_SOC_DAPM_SUPPLY_S("DMIC STO4 ASRC", 1, RT5677_ASRC_2, 8, 0, NULL, |
| 2628 | 0), |
| 2629 | SND_SOC_DAPM_SUPPLY_S("DMIC MONO L ASRC", 1, RT5677_ASRC_2, 7, 0, NULL, |
| 2630 | 0), |
| 2631 | SND_SOC_DAPM_SUPPLY_S("DMIC MONO R ASRC", 1, RT5677_ASRC_2, 6, 0, NULL, |
| 2632 | 0), |
| 2633 | SND_SOC_DAPM_SUPPLY_S("ADC STO1 ASRC", 1, RT5677_ASRC_2, 5, 0, NULL, 0), |
| 2634 | SND_SOC_DAPM_SUPPLY_S("ADC STO2 ASRC", 1, RT5677_ASRC_2, 4, 0, NULL, 0), |
| 2635 | SND_SOC_DAPM_SUPPLY_S("ADC STO3 ASRC", 1, RT5677_ASRC_2, 3, 0, NULL, 0), |
| 2636 | SND_SOC_DAPM_SUPPLY_S("ADC STO4 ASRC", 1, RT5677_ASRC_2, 2, 0, NULL, 0), |
| 2637 | SND_SOC_DAPM_SUPPLY_S("ADC MONO L ASRC", 1, RT5677_ASRC_2, 1, 0, NULL, |
| 2638 | 0), |
| 2639 | SND_SOC_DAPM_SUPPLY_S("ADC MONO R ASRC", 1, RT5677_ASRC_2, 0, 0, NULL, |
| 2640 | 0), |
| 2641 | |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 2642 | /* Input Side */ |
| 2643 | /* micbias */ |
Oder Chiou | 3d0c03d | 2014-06-10 14:35:23 +0800 | [diff] [blame] | 2644 | SND_SOC_DAPM_SUPPLY("MICBIAS1", RT5677_PWR_ANLG2, RT5677_PWR_MB1_BIT, |
Oder Chiou | f58c3b9 | 2014-06-10 14:35:26 +0800 | [diff] [blame] | 2645 | 0, rt5677_set_micbias1_event, SND_SOC_DAPM_PRE_PMD | |
| 2646 | SND_SOC_DAPM_POST_PMU), |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 2647 | |
| 2648 | /* Input Lines */ |
| 2649 | SND_SOC_DAPM_INPUT("DMIC L1"), |
| 2650 | SND_SOC_DAPM_INPUT("DMIC R1"), |
| 2651 | SND_SOC_DAPM_INPUT("DMIC L2"), |
| 2652 | SND_SOC_DAPM_INPUT("DMIC R2"), |
| 2653 | SND_SOC_DAPM_INPUT("DMIC L3"), |
| 2654 | SND_SOC_DAPM_INPUT("DMIC R3"), |
| 2655 | SND_SOC_DAPM_INPUT("DMIC L4"), |
| 2656 | SND_SOC_DAPM_INPUT("DMIC R4"), |
| 2657 | |
| 2658 | SND_SOC_DAPM_INPUT("IN1P"), |
| 2659 | SND_SOC_DAPM_INPUT("IN1N"), |
| 2660 | SND_SOC_DAPM_INPUT("IN2P"), |
| 2661 | SND_SOC_DAPM_INPUT("IN2N"), |
| 2662 | |
| 2663 | SND_SOC_DAPM_INPUT("Haptic Generator"), |
| 2664 | |
Bard Liao | 2d15d97 | 2014-08-27 19:50:34 +0800 | [diff] [blame] | 2665 | SND_SOC_DAPM_PGA("DMIC1", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2666 | SND_SOC_DAPM_PGA("DMIC2", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2667 | SND_SOC_DAPM_PGA("DMIC3", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2668 | SND_SOC_DAPM_PGA("DMIC4", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2669 | |
| 2670 | SND_SOC_DAPM_SUPPLY("DMIC1 power", RT5677_DMIC_CTRL1, |
| 2671 | RT5677_DMIC_1_EN_SFT, 0, NULL, 0), |
| 2672 | SND_SOC_DAPM_SUPPLY("DMIC2 power", RT5677_DMIC_CTRL1, |
| 2673 | RT5677_DMIC_2_EN_SFT, 0, NULL, 0), |
| 2674 | SND_SOC_DAPM_SUPPLY("DMIC3 power", RT5677_DMIC_CTRL1, |
| 2675 | RT5677_DMIC_3_EN_SFT, 0, NULL, 0), |
| 2676 | SND_SOC_DAPM_SUPPLY("DMIC4 power", RT5677_DMIC_CTRL2, |
| 2677 | RT5677_DMIC_4_EN_SFT, 0, NULL, 0), |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 2678 | |
| 2679 | SND_SOC_DAPM_SUPPLY("DMIC CLK", SND_SOC_NOPM, 0, 0, |
| 2680 | set_dmic_clk, SND_SOC_DAPM_PRE_PMU), |
| 2681 | |
| 2682 | /* Boost */ |
| 2683 | SND_SOC_DAPM_PGA_E("BST1", RT5677_PWR_ANLG2, |
| 2684 | RT5677_PWR_BST1_BIT, 0, NULL, 0, rt5677_bst1_event, |
| 2685 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), |
| 2686 | SND_SOC_DAPM_PGA_E("BST2", RT5677_PWR_ANLG2, |
| 2687 | RT5677_PWR_BST2_BIT, 0, NULL, 0, rt5677_bst2_event, |
| 2688 | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), |
| 2689 | |
| 2690 | /* ADCs */ |
| 2691 | SND_SOC_DAPM_ADC("ADC 1", NULL, SND_SOC_NOPM, |
| 2692 | 0, 0), |
| 2693 | SND_SOC_DAPM_ADC("ADC 2", NULL, SND_SOC_NOPM, |
| 2694 | 0, 0), |
| 2695 | SND_SOC_DAPM_PGA("ADC 1_2", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2696 | |
| 2697 | SND_SOC_DAPM_SUPPLY("ADC 1 power", RT5677_PWR_DIG1, |
| 2698 | RT5677_PWR_ADC_L_BIT, 0, NULL, 0), |
| 2699 | SND_SOC_DAPM_SUPPLY("ADC 2 power", RT5677_PWR_DIG1, |
| 2700 | RT5677_PWR_ADC_R_BIT, 0, NULL, 0), |
| 2701 | SND_SOC_DAPM_SUPPLY("ADC1 clock", RT5677_PWR_DIG1, |
| 2702 | RT5677_PWR_ADCFED1_BIT, 0, NULL, 0), |
| 2703 | SND_SOC_DAPM_SUPPLY("ADC2 clock", RT5677_PWR_DIG1, |
| 2704 | RT5677_PWR_ADCFED2_BIT, 0, NULL, 0), |
| 2705 | |
| 2706 | /* ADC Mux */ |
| 2707 | SND_SOC_DAPM_MUX("Stereo1 DMIC Mux", SND_SOC_NOPM, 0, 0, |
| 2708 | &rt5677_sto1_dmic_mux), |
| 2709 | SND_SOC_DAPM_MUX("Stereo1 ADC1 Mux", SND_SOC_NOPM, 0, 0, |
| 2710 | &rt5677_sto1_adc1_mux), |
| 2711 | SND_SOC_DAPM_MUX("Stereo1 ADC2 Mux", SND_SOC_NOPM, 0, 0, |
| 2712 | &rt5677_sto1_adc2_mux), |
| 2713 | SND_SOC_DAPM_MUX("Stereo2 DMIC Mux", SND_SOC_NOPM, 0, 0, |
| 2714 | &rt5677_sto2_dmic_mux), |
| 2715 | SND_SOC_DAPM_MUX("Stereo2 ADC1 Mux", SND_SOC_NOPM, 0, 0, |
| 2716 | &rt5677_sto2_adc1_mux), |
| 2717 | SND_SOC_DAPM_MUX("Stereo2 ADC2 Mux", SND_SOC_NOPM, 0, 0, |
| 2718 | &rt5677_sto2_adc2_mux), |
| 2719 | SND_SOC_DAPM_MUX("Stereo2 ADC LR Mux", SND_SOC_NOPM, 0, 0, |
| 2720 | &rt5677_sto2_adc_lr_mux), |
| 2721 | SND_SOC_DAPM_MUX("Stereo3 DMIC Mux", SND_SOC_NOPM, 0, 0, |
| 2722 | &rt5677_sto3_dmic_mux), |
| 2723 | SND_SOC_DAPM_MUX("Stereo3 ADC1 Mux", SND_SOC_NOPM, 0, 0, |
| 2724 | &rt5677_sto3_adc1_mux), |
| 2725 | SND_SOC_DAPM_MUX("Stereo3 ADC2 Mux", SND_SOC_NOPM, 0, 0, |
| 2726 | &rt5677_sto3_adc2_mux), |
| 2727 | SND_SOC_DAPM_MUX("Stereo4 DMIC Mux", SND_SOC_NOPM, 0, 0, |
| 2728 | &rt5677_sto4_dmic_mux), |
| 2729 | SND_SOC_DAPM_MUX("Stereo4 ADC1 Mux", SND_SOC_NOPM, 0, 0, |
| 2730 | &rt5677_sto4_adc1_mux), |
| 2731 | SND_SOC_DAPM_MUX("Stereo4 ADC2 Mux", SND_SOC_NOPM, 0, 0, |
| 2732 | &rt5677_sto4_adc2_mux), |
| 2733 | SND_SOC_DAPM_MUX("Mono DMIC L Mux", SND_SOC_NOPM, 0, 0, |
| 2734 | &rt5677_mono_dmic_l_mux), |
| 2735 | SND_SOC_DAPM_MUX("Mono DMIC R Mux", SND_SOC_NOPM, 0, 0, |
| 2736 | &rt5677_mono_dmic_r_mux), |
| 2737 | SND_SOC_DAPM_MUX("Mono ADC2 L Mux", SND_SOC_NOPM, 0, 0, |
| 2738 | &rt5677_mono_adc2_l_mux), |
| 2739 | SND_SOC_DAPM_MUX("Mono ADC1 L Mux", SND_SOC_NOPM, 0, 0, |
| 2740 | &rt5677_mono_adc1_l_mux), |
| 2741 | SND_SOC_DAPM_MUX("Mono ADC1 R Mux", SND_SOC_NOPM, 0, 0, |
| 2742 | &rt5677_mono_adc1_r_mux), |
| 2743 | SND_SOC_DAPM_MUX("Mono ADC2 R Mux", SND_SOC_NOPM, 0, 0, |
| 2744 | &rt5677_mono_adc2_r_mux), |
| 2745 | |
| 2746 | /* ADC Mixer */ |
| 2747 | SND_SOC_DAPM_SUPPLY("adc stereo1 filter", RT5677_PWR_DIG2, |
| 2748 | RT5677_PWR_ADC_S1F_BIT, 0, NULL, 0), |
| 2749 | SND_SOC_DAPM_SUPPLY("adc stereo2 filter", RT5677_PWR_DIG2, |
| 2750 | RT5677_PWR_ADC_S2F_BIT, 0, NULL, 0), |
| 2751 | SND_SOC_DAPM_SUPPLY("adc stereo3 filter", RT5677_PWR_DIG2, |
| 2752 | RT5677_PWR_ADC_S3F_BIT, 0, NULL, 0), |
| 2753 | SND_SOC_DAPM_SUPPLY("adc stereo4 filter", RT5677_PWR_DIG2, |
| 2754 | RT5677_PWR_ADC_S4F_BIT, 0, NULL, 0), |
| 2755 | SND_SOC_DAPM_MIXER("Sto1 ADC MIXL", SND_SOC_NOPM, 0, 0, |
| 2756 | rt5677_sto1_adc_l_mix, ARRAY_SIZE(rt5677_sto1_adc_l_mix)), |
| 2757 | SND_SOC_DAPM_MIXER("Sto1 ADC MIXR", SND_SOC_NOPM, 0, 0, |
| 2758 | rt5677_sto1_adc_r_mix, ARRAY_SIZE(rt5677_sto1_adc_r_mix)), |
| 2759 | SND_SOC_DAPM_MIXER("Sto2 ADC MIXL", SND_SOC_NOPM, 0, 0, |
| 2760 | rt5677_sto2_adc_l_mix, ARRAY_SIZE(rt5677_sto2_adc_l_mix)), |
| 2761 | SND_SOC_DAPM_MIXER("Sto2 ADC MIXR", SND_SOC_NOPM, 0, 0, |
| 2762 | rt5677_sto2_adc_r_mix, ARRAY_SIZE(rt5677_sto2_adc_r_mix)), |
| 2763 | SND_SOC_DAPM_MIXER("Sto3 ADC MIXL", SND_SOC_NOPM, 0, 0, |
| 2764 | rt5677_sto3_adc_l_mix, ARRAY_SIZE(rt5677_sto3_adc_l_mix)), |
| 2765 | SND_SOC_DAPM_MIXER("Sto3 ADC MIXR", SND_SOC_NOPM, 0, 0, |
| 2766 | rt5677_sto3_adc_r_mix, ARRAY_SIZE(rt5677_sto3_adc_r_mix)), |
| 2767 | SND_SOC_DAPM_MIXER("Sto4 ADC MIXL", SND_SOC_NOPM, 0, 0, |
| 2768 | rt5677_sto4_adc_l_mix, ARRAY_SIZE(rt5677_sto4_adc_l_mix)), |
| 2769 | SND_SOC_DAPM_MIXER("Sto4 ADC MIXR", SND_SOC_NOPM, 0, 0, |
| 2770 | rt5677_sto4_adc_r_mix, ARRAY_SIZE(rt5677_sto4_adc_r_mix)), |
| 2771 | SND_SOC_DAPM_SUPPLY("adc mono left filter", RT5677_PWR_DIG2, |
| 2772 | RT5677_PWR_ADC_MF_L_BIT, 0, NULL, 0), |
| 2773 | SND_SOC_DAPM_MIXER("Mono ADC MIXL", SND_SOC_NOPM, 0, 0, |
| 2774 | rt5677_mono_adc_l_mix, ARRAY_SIZE(rt5677_mono_adc_l_mix)), |
| 2775 | SND_SOC_DAPM_SUPPLY("adc mono right filter", RT5677_PWR_DIG2, |
| 2776 | RT5677_PWR_ADC_MF_R_BIT, 0, NULL, 0), |
| 2777 | SND_SOC_DAPM_MIXER("Mono ADC MIXR", SND_SOC_NOPM, 0, 0, |
| 2778 | rt5677_mono_adc_r_mix, ARRAY_SIZE(rt5677_mono_adc_r_mix)), |
| 2779 | |
| 2780 | /* ADC PGA */ |
| 2781 | SND_SOC_DAPM_PGA("Stereo1 ADC MIXL", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2782 | SND_SOC_DAPM_PGA("Stereo1 ADC MIXR", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2783 | SND_SOC_DAPM_PGA("Stereo1 ADC MIX", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2784 | SND_SOC_DAPM_PGA("Stereo2 ADC MIXL", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2785 | SND_SOC_DAPM_PGA("Stereo2 ADC MIXR", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2786 | SND_SOC_DAPM_PGA("Stereo2 ADC MIX", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2787 | SND_SOC_DAPM_PGA("Stereo3 ADC MIXL", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2788 | SND_SOC_DAPM_PGA("Stereo3 ADC MIXR", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2789 | SND_SOC_DAPM_PGA("Stereo3 ADC MIX", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2790 | SND_SOC_DAPM_PGA("Stereo4 ADC MIXL", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2791 | SND_SOC_DAPM_PGA("Stereo4 ADC MIXR", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2792 | SND_SOC_DAPM_PGA("Stereo4 ADC MIX", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2793 | SND_SOC_DAPM_PGA("Sto2 ADC LR MIX", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2794 | SND_SOC_DAPM_PGA("Mono ADC MIX", SND_SOC_NOPM, 0, 0, NULL, 0), |
Oder Chiou | e6f6ebc | 2014-10-22 16:11:39 +0800 | [diff] [blame] | 2795 | SND_SOC_DAPM_PGA("IF1 ADC", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2796 | SND_SOC_DAPM_PGA("IF2 ADC", SND_SOC_NOPM, 0, 0, NULL, 0), |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 2797 | |
| 2798 | /* DSP */ |
| 2799 | SND_SOC_DAPM_MUX("IB9 Mux", SND_SOC_NOPM, 0, 0, |
| 2800 | &rt5677_ib9_src_mux), |
| 2801 | SND_SOC_DAPM_MUX("IB8 Mux", SND_SOC_NOPM, 0, 0, |
| 2802 | &rt5677_ib8_src_mux), |
| 2803 | SND_SOC_DAPM_MUX("IB7 Mux", SND_SOC_NOPM, 0, 0, |
| 2804 | &rt5677_ib7_src_mux), |
| 2805 | SND_SOC_DAPM_MUX("IB6 Mux", SND_SOC_NOPM, 0, 0, |
| 2806 | &rt5677_ib6_src_mux), |
| 2807 | SND_SOC_DAPM_MUX("IB45 Mux", SND_SOC_NOPM, 0, 0, |
| 2808 | &rt5677_ib45_src_mux), |
| 2809 | SND_SOC_DAPM_MUX("IB23 Mux", SND_SOC_NOPM, 0, 0, |
| 2810 | &rt5677_ib23_src_mux), |
| 2811 | SND_SOC_DAPM_MUX("IB01 Mux", SND_SOC_NOPM, 0, 0, |
| 2812 | &rt5677_ib01_src_mux), |
| 2813 | SND_SOC_DAPM_MUX("IB45 Bypass Mux", SND_SOC_NOPM, 0, 0, |
| 2814 | &rt5677_ib45_bypass_src_mux), |
| 2815 | SND_SOC_DAPM_MUX("IB23 Bypass Mux", SND_SOC_NOPM, 0, 0, |
| 2816 | &rt5677_ib23_bypass_src_mux), |
| 2817 | SND_SOC_DAPM_MUX("IB01 Bypass Mux", SND_SOC_NOPM, 0, 0, |
| 2818 | &rt5677_ib01_bypass_src_mux), |
| 2819 | SND_SOC_DAPM_MUX("OB23 Bypass Mux", SND_SOC_NOPM, 0, 0, |
| 2820 | &rt5677_ob23_bypass_src_mux), |
| 2821 | SND_SOC_DAPM_MUX("OB01 Bypass Mux", SND_SOC_NOPM, 0, 0, |
| 2822 | &rt5677_ob01_bypass_src_mux), |
| 2823 | |
| 2824 | SND_SOC_DAPM_PGA("OB45", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2825 | SND_SOC_DAPM_PGA("OB67", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2826 | |
| 2827 | SND_SOC_DAPM_PGA("OutBound2", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2828 | SND_SOC_DAPM_PGA("OutBound3", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2829 | SND_SOC_DAPM_PGA("OutBound4", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2830 | SND_SOC_DAPM_PGA("OutBound5", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2831 | SND_SOC_DAPM_PGA("OutBound6", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2832 | SND_SOC_DAPM_PGA("OutBound7", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2833 | |
| 2834 | /* Digital Interface */ |
| 2835 | SND_SOC_DAPM_SUPPLY("I2S1", RT5677_PWR_DIG1, |
| 2836 | RT5677_PWR_I2S1_BIT, 0, NULL, 0), |
| 2837 | SND_SOC_DAPM_PGA("IF1 DAC0", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2838 | SND_SOC_DAPM_PGA("IF1 DAC1", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2839 | SND_SOC_DAPM_PGA("IF1 DAC2", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2840 | SND_SOC_DAPM_PGA("IF1 DAC3", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2841 | SND_SOC_DAPM_PGA("IF1 DAC4", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2842 | SND_SOC_DAPM_PGA("IF1 DAC5", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2843 | SND_SOC_DAPM_PGA("IF1 DAC6", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2844 | SND_SOC_DAPM_PGA("IF1 DAC7", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2845 | SND_SOC_DAPM_PGA("IF1 DAC01", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2846 | SND_SOC_DAPM_PGA("IF1 DAC23", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2847 | SND_SOC_DAPM_PGA("IF1 DAC45", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2848 | SND_SOC_DAPM_PGA("IF1 DAC67", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2849 | SND_SOC_DAPM_PGA("IF1 ADC1", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2850 | SND_SOC_DAPM_PGA("IF1 ADC2", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2851 | SND_SOC_DAPM_PGA("IF1 ADC3", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2852 | SND_SOC_DAPM_PGA("IF1 ADC4", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2853 | |
| 2854 | SND_SOC_DAPM_SUPPLY("I2S2", RT5677_PWR_DIG1, |
| 2855 | RT5677_PWR_I2S2_BIT, 0, NULL, 0), |
| 2856 | SND_SOC_DAPM_PGA("IF2 DAC0", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2857 | SND_SOC_DAPM_PGA("IF2 DAC1", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2858 | SND_SOC_DAPM_PGA("IF2 DAC2", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2859 | SND_SOC_DAPM_PGA("IF2 DAC3", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2860 | SND_SOC_DAPM_PGA("IF2 DAC4", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2861 | SND_SOC_DAPM_PGA("IF2 DAC5", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2862 | SND_SOC_DAPM_PGA("IF2 DAC6", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2863 | SND_SOC_DAPM_PGA("IF2 DAC7", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2864 | SND_SOC_DAPM_PGA("IF2 DAC01", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2865 | SND_SOC_DAPM_PGA("IF2 DAC23", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2866 | SND_SOC_DAPM_PGA("IF2 DAC45", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2867 | SND_SOC_DAPM_PGA("IF2 DAC67", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2868 | SND_SOC_DAPM_PGA("IF2 ADC1", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2869 | SND_SOC_DAPM_PGA("IF2 ADC2", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2870 | SND_SOC_DAPM_PGA("IF2 ADC3", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2871 | SND_SOC_DAPM_PGA("IF2 ADC4", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2872 | |
| 2873 | SND_SOC_DAPM_SUPPLY("I2S3", RT5677_PWR_DIG1, |
| 2874 | RT5677_PWR_I2S3_BIT, 0, NULL, 0), |
| 2875 | SND_SOC_DAPM_PGA("IF3 DAC", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2876 | SND_SOC_DAPM_PGA("IF3 DAC L", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2877 | SND_SOC_DAPM_PGA("IF3 DAC R", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2878 | SND_SOC_DAPM_PGA("IF3 ADC", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2879 | SND_SOC_DAPM_PGA("IF3 ADC L", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2880 | SND_SOC_DAPM_PGA("IF3 ADC R", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2881 | |
| 2882 | SND_SOC_DAPM_SUPPLY("I2S4", RT5677_PWR_DIG1, |
| 2883 | RT5677_PWR_I2S4_BIT, 0, NULL, 0), |
| 2884 | SND_SOC_DAPM_PGA("IF4 DAC", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2885 | SND_SOC_DAPM_PGA("IF4 DAC L", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2886 | SND_SOC_DAPM_PGA("IF4 DAC R", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2887 | SND_SOC_DAPM_PGA("IF4 ADC", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2888 | SND_SOC_DAPM_PGA("IF4 ADC L", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2889 | SND_SOC_DAPM_PGA("IF4 ADC R", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2890 | |
| 2891 | SND_SOC_DAPM_SUPPLY("SLB", RT5677_PWR_DIG1, |
| 2892 | RT5677_PWR_SLB_BIT, 0, NULL, 0), |
| 2893 | SND_SOC_DAPM_PGA("SLB DAC0", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2894 | SND_SOC_DAPM_PGA("SLB DAC1", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2895 | SND_SOC_DAPM_PGA("SLB DAC2", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2896 | SND_SOC_DAPM_PGA("SLB DAC3", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2897 | SND_SOC_DAPM_PGA("SLB DAC4", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2898 | SND_SOC_DAPM_PGA("SLB DAC5", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2899 | SND_SOC_DAPM_PGA("SLB DAC6", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2900 | SND_SOC_DAPM_PGA("SLB DAC7", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2901 | SND_SOC_DAPM_PGA("SLB DAC01", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2902 | SND_SOC_DAPM_PGA("SLB DAC23", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2903 | SND_SOC_DAPM_PGA("SLB DAC45", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2904 | SND_SOC_DAPM_PGA("SLB DAC67", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2905 | SND_SOC_DAPM_PGA("SLB ADC1", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2906 | SND_SOC_DAPM_PGA("SLB ADC2", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2907 | SND_SOC_DAPM_PGA("SLB ADC3", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2908 | SND_SOC_DAPM_PGA("SLB ADC4", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 2909 | |
| 2910 | /* Digital Interface Select */ |
| 2911 | SND_SOC_DAPM_MUX("IF1 ADC1 Mux", SND_SOC_NOPM, 0, 0, |
| 2912 | &rt5677_if1_adc1_mux), |
| 2913 | SND_SOC_DAPM_MUX("IF1 ADC2 Mux", SND_SOC_NOPM, 0, 0, |
| 2914 | &rt5677_if1_adc2_mux), |
| 2915 | SND_SOC_DAPM_MUX("IF1 ADC3 Mux", SND_SOC_NOPM, 0, 0, |
| 2916 | &rt5677_if1_adc3_mux), |
| 2917 | SND_SOC_DAPM_MUX("IF1 ADC4 Mux", SND_SOC_NOPM, 0, 0, |
| 2918 | &rt5677_if1_adc4_mux), |
Oder Chiou | e6f6ebc | 2014-10-22 16:11:39 +0800 | [diff] [blame] | 2919 | SND_SOC_DAPM_MUX("IF1 ADC1 Swap Mux", SND_SOC_NOPM, 0, 0, |
| 2920 | &rt5677_if1_adc1_swap_mux), |
| 2921 | SND_SOC_DAPM_MUX("IF1 ADC2 Swap Mux", SND_SOC_NOPM, 0, 0, |
| 2922 | &rt5677_if1_adc2_swap_mux), |
| 2923 | SND_SOC_DAPM_MUX("IF1 ADC3 Swap Mux", SND_SOC_NOPM, 0, 0, |
| 2924 | &rt5677_if1_adc3_swap_mux), |
| 2925 | SND_SOC_DAPM_MUX("IF1 ADC4 Swap Mux", SND_SOC_NOPM, 0, 0, |
| 2926 | &rt5677_if1_adc4_swap_mux), |
| 2927 | SND_SOC_DAPM_MUX_E("IF1 ADC TDM Swap Mux", SND_SOC_NOPM, 0, 0, |
| 2928 | &rt5677_if1_adc_tdm_swap_mux, rt5677_if1_adc_tdm_event, |
| 2929 | SND_SOC_DAPM_PRE_PMU), |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 2930 | SND_SOC_DAPM_MUX("IF2 ADC1 Mux", SND_SOC_NOPM, 0, 0, |
| 2931 | &rt5677_if2_adc1_mux), |
| 2932 | SND_SOC_DAPM_MUX("IF2 ADC2 Mux", SND_SOC_NOPM, 0, 0, |
| 2933 | &rt5677_if2_adc2_mux), |
| 2934 | SND_SOC_DAPM_MUX("IF2 ADC3 Mux", SND_SOC_NOPM, 0, 0, |
| 2935 | &rt5677_if2_adc3_mux), |
| 2936 | SND_SOC_DAPM_MUX("IF2 ADC4 Mux", SND_SOC_NOPM, 0, 0, |
| 2937 | &rt5677_if2_adc4_mux), |
Oder Chiou | e6f6ebc | 2014-10-22 16:11:39 +0800 | [diff] [blame] | 2938 | SND_SOC_DAPM_MUX("IF2 ADC1 Swap Mux", SND_SOC_NOPM, 0, 0, |
| 2939 | &rt5677_if2_adc1_swap_mux), |
| 2940 | SND_SOC_DAPM_MUX("IF2 ADC2 Swap Mux", SND_SOC_NOPM, 0, 0, |
| 2941 | &rt5677_if2_adc2_swap_mux), |
| 2942 | SND_SOC_DAPM_MUX("IF2 ADC3 Swap Mux", SND_SOC_NOPM, 0, 0, |
| 2943 | &rt5677_if2_adc3_swap_mux), |
| 2944 | SND_SOC_DAPM_MUX("IF2 ADC4 Swap Mux", SND_SOC_NOPM, 0, 0, |
| 2945 | &rt5677_if2_adc4_swap_mux), |
| 2946 | SND_SOC_DAPM_MUX_E("IF2 ADC TDM Swap Mux", SND_SOC_NOPM, 0, 0, |
| 2947 | &rt5677_if2_adc_tdm_swap_mux, rt5677_if2_adc_tdm_event, |
| 2948 | SND_SOC_DAPM_PRE_PMU), |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 2949 | SND_SOC_DAPM_MUX("IF3 ADC Mux", SND_SOC_NOPM, 0, 0, |
| 2950 | &rt5677_if3_adc_mux), |
| 2951 | SND_SOC_DAPM_MUX("IF4 ADC Mux", SND_SOC_NOPM, 0, 0, |
| 2952 | &rt5677_if4_adc_mux), |
| 2953 | SND_SOC_DAPM_MUX("SLB ADC1 Mux", SND_SOC_NOPM, 0, 0, |
| 2954 | &rt5677_slb_adc1_mux), |
| 2955 | SND_SOC_DAPM_MUX("SLB ADC2 Mux", SND_SOC_NOPM, 0, 0, |
| 2956 | &rt5677_slb_adc2_mux), |
| 2957 | SND_SOC_DAPM_MUX("SLB ADC3 Mux", SND_SOC_NOPM, 0, 0, |
| 2958 | &rt5677_slb_adc3_mux), |
| 2959 | SND_SOC_DAPM_MUX("SLB ADC4 Mux", SND_SOC_NOPM, 0, 0, |
| 2960 | &rt5677_slb_adc4_mux), |
| 2961 | |
Oder Chiou | 91159ec | 2014-11-11 15:31:19 +0800 | [diff] [blame] | 2962 | SND_SOC_DAPM_MUX("IF1 DAC0 Mux", SND_SOC_NOPM, 0, 0, |
| 2963 | &rt5677_if1_dac0_tdm_sel_mux), |
| 2964 | SND_SOC_DAPM_MUX("IF1 DAC1 Mux", SND_SOC_NOPM, 0, 0, |
| 2965 | &rt5677_if1_dac1_tdm_sel_mux), |
| 2966 | SND_SOC_DAPM_MUX("IF1 DAC2 Mux", SND_SOC_NOPM, 0, 0, |
| 2967 | &rt5677_if1_dac2_tdm_sel_mux), |
| 2968 | SND_SOC_DAPM_MUX("IF1 DAC3 Mux", SND_SOC_NOPM, 0, 0, |
| 2969 | &rt5677_if1_dac3_tdm_sel_mux), |
| 2970 | SND_SOC_DAPM_MUX("IF1 DAC4 Mux", SND_SOC_NOPM, 0, 0, |
| 2971 | &rt5677_if1_dac4_tdm_sel_mux), |
| 2972 | SND_SOC_DAPM_MUX("IF1 DAC5 Mux", SND_SOC_NOPM, 0, 0, |
| 2973 | &rt5677_if1_dac5_tdm_sel_mux), |
| 2974 | SND_SOC_DAPM_MUX("IF1 DAC6 Mux", SND_SOC_NOPM, 0, 0, |
| 2975 | &rt5677_if1_dac6_tdm_sel_mux), |
| 2976 | SND_SOC_DAPM_MUX("IF1 DAC7 Mux", SND_SOC_NOPM, 0, 0, |
| 2977 | &rt5677_if1_dac7_tdm_sel_mux), |
| 2978 | |
| 2979 | SND_SOC_DAPM_MUX("IF2 DAC0 Mux", SND_SOC_NOPM, 0, 0, |
| 2980 | &rt5677_if2_dac0_tdm_sel_mux), |
| 2981 | SND_SOC_DAPM_MUX("IF2 DAC1 Mux", SND_SOC_NOPM, 0, 0, |
| 2982 | &rt5677_if2_dac1_tdm_sel_mux), |
| 2983 | SND_SOC_DAPM_MUX("IF2 DAC2 Mux", SND_SOC_NOPM, 0, 0, |
| 2984 | &rt5677_if2_dac2_tdm_sel_mux), |
| 2985 | SND_SOC_DAPM_MUX("IF2 DAC3 Mux", SND_SOC_NOPM, 0, 0, |
| 2986 | &rt5677_if2_dac3_tdm_sel_mux), |
| 2987 | SND_SOC_DAPM_MUX("IF2 DAC4 Mux", SND_SOC_NOPM, 0, 0, |
| 2988 | &rt5677_if2_dac4_tdm_sel_mux), |
| 2989 | SND_SOC_DAPM_MUX("IF2 DAC5 Mux", SND_SOC_NOPM, 0, 0, |
| 2990 | &rt5677_if2_dac5_tdm_sel_mux), |
| 2991 | SND_SOC_DAPM_MUX("IF2 DAC6 Mux", SND_SOC_NOPM, 0, 0, |
| 2992 | &rt5677_if2_dac6_tdm_sel_mux), |
| 2993 | SND_SOC_DAPM_MUX("IF2 DAC7 Mux", SND_SOC_NOPM, 0, 0, |
| 2994 | &rt5677_if2_dac7_tdm_sel_mux), |
| 2995 | |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 2996 | /* Audio Interface */ |
| 2997 | SND_SOC_DAPM_AIF_IN("AIF1RX", "AIF1 Playback", 0, SND_SOC_NOPM, 0, 0), |
| 2998 | SND_SOC_DAPM_AIF_OUT("AIF1TX", "AIF1 Capture", 0, SND_SOC_NOPM, 0, 0), |
| 2999 | SND_SOC_DAPM_AIF_IN("AIF2RX", "AIF2 Playback", 0, SND_SOC_NOPM, 0, 0), |
| 3000 | SND_SOC_DAPM_AIF_OUT("AIF2TX", "AIF2 Capture", 0, SND_SOC_NOPM, 0, 0), |
| 3001 | SND_SOC_DAPM_AIF_IN("AIF3RX", "AIF3 Playback", 0, SND_SOC_NOPM, 0, 0), |
| 3002 | SND_SOC_DAPM_AIF_OUT("AIF3TX", "AIF3 Capture", 0, SND_SOC_NOPM, 0, 0), |
| 3003 | SND_SOC_DAPM_AIF_IN("AIF4RX", "AIF4 Playback", 0, SND_SOC_NOPM, 0, 0), |
| 3004 | SND_SOC_DAPM_AIF_OUT("AIF4TX", "AIF4 Capture", 0, SND_SOC_NOPM, 0, 0), |
| 3005 | SND_SOC_DAPM_AIF_IN("SLBRX", "SLIMBus Playback", 0, SND_SOC_NOPM, 0, 0), |
| 3006 | SND_SOC_DAPM_AIF_OUT("SLBTX", "SLIMBus Capture", 0, SND_SOC_NOPM, 0, 0), |
| 3007 | |
| 3008 | /* Sidetone Mux */ |
| 3009 | SND_SOC_DAPM_MUX("Sidetone Mux", SND_SOC_NOPM, 0, 0, |
| 3010 | &rt5677_sidetone_mux), |
Oder Chiou | 90bdbb4 | 2014-09-18 14:45:59 +0800 | [diff] [blame] | 3011 | SND_SOC_DAPM_SUPPLY("Sidetone Power", RT5677_SIDETONE_CTRL, |
| 3012 | RT5677_ST_EN_SFT, 0, NULL, 0), |
| 3013 | |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 3014 | /* VAD Mux*/ |
| 3015 | SND_SOC_DAPM_MUX("VAD ADC Mux", SND_SOC_NOPM, 0, 0, |
| 3016 | &rt5677_vad_src_mux), |
| 3017 | |
| 3018 | /* Tensilica DSP */ |
| 3019 | SND_SOC_DAPM_PGA("Tensilica DSP", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 3020 | SND_SOC_DAPM_MIXER("OB01 MIX", SND_SOC_NOPM, 0, 0, |
| 3021 | rt5677_ob_01_mix, ARRAY_SIZE(rt5677_ob_01_mix)), |
| 3022 | SND_SOC_DAPM_MIXER("OB23 MIX", SND_SOC_NOPM, 0, 0, |
| 3023 | rt5677_ob_23_mix, ARRAY_SIZE(rt5677_ob_23_mix)), |
| 3024 | SND_SOC_DAPM_MIXER("OB4 MIX", SND_SOC_NOPM, 0, 0, |
| 3025 | rt5677_ob_4_mix, ARRAY_SIZE(rt5677_ob_4_mix)), |
| 3026 | SND_SOC_DAPM_MIXER("OB5 MIX", SND_SOC_NOPM, 0, 0, |
| 3027 | rt5677_ob_5_mix, ARRAY_SIZE(rt5677_ob_5_mix)), |
| 3028 | SND_SOC_DAPM_MIXER("OB6 MIX", SND_SOC_NOPM, 0, 0, |
| 3029 | rt5677_ob_6_mix, ARRAY_SIZE(rt5677_ob_6_mix)), |
| 3030 | SND_SOC_DAPM_MIXER("OB7 MIX", SND_SOC_NOPM, 0, 0, |
| 3031 | rt5677_ob_7_mix, ARRAY_SIZE(rt5677_ob_7_mix)), |
| 3032 | |
| 3033 | /* Output Side */ |
Oder Chiou | d65fd3a | 2014-11-05 13:42:52 +0800 | [diff] [blame] | 3034 | /* DAC mixer before sound effect */ |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 3035 | SND_SOC_DAPM_MIXER("DAC1 MIXL", SND_SOC_NOPM, 0, 0, |
| 3036 | rt5677_dac_l_mix, ARRAY_SIZE(rt5677_dac_l_mix)), |
| 3037 | SND_SOC_DAPM_MIXER("DAC1 MIXR", SND_SOC_NOPM, 0, 0, |
| 3038 | rt5677_dac_r_mix, ARRAY_SIZE(rt5677_dac_r_mix)), |
| 3039 | SND_SOC_DAPM_PGA("DAC1 FS", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 3040 | |
| 3041 | /* DAC Mux */ |
| 3042 | SND_SOC_DAPM_MUX("DAC1 Mux", SND_SOC_NOPM, 0, 0, |
| 3043 | &rt5677_dac1_mux), |
| 3044 | SND_SOC_DAPM_MUX("ADDA1 Mux", SND_SOC_NOPM, 0, 0, |
| 3045 | &rt5677_adda1_mux), |
| 3046 | SND_SOC_DAPM_MUX("DAC12 SRC Mux", SND_SOC_NOPM, 0, 0, |
| 3047 | &rt5677_dac12_mux), |
| 3048 | SND_SOC_DAPM_MUX("DAC3 SRC Mux", SND_SOC_NOPM, 0, 0, |
| 3049 | &rt5677_dac3_mux), |
| 3050 | |
| 3051 | /* DAC2 channel Mux */ |
| 3052 | SND_SOC_DAPM_MUX("DAC2 L Mux", SND_SOC_NOPM, 0, 0, |
| 3053 | &rt5677_dac2_l_mux), |
| 3054 | SND_SOC_DAPM_MUX("DAC2 R Mux", SND_SOC_NOPM, 0, 0, |
| 3055 | &rt5677_dac2_r_mux), |
| 3056 | |
| 3057 | /* DAC3 channel Mux */ |
| 3058 | SND_SOC_DAPM_MUX("DAC3 L Mux", SND_SOC_NOPM, 0, 0, |
| 3059 | &rt5677_dac3_l_mux), |
| 3060 | SND_SOC_DAPM_MUX("DAC3 R Mux", SND_SOC_NOPM, 0, 0, |
| 3061 | &rt5677_dac3_r_mux), |
| 3062 | |
| 3063 | /* DAC4 channel Mux */ |
| 3064 | SND_SOC_DAPM_MUX("DAC4 L Mux", SND_SOC_NOPM, 0, 0, |
| 3065 | &rt5677_dac4_l_mux), |
| 3066 | SND_SOC_DAPM_MUX("DAC4 R Mux", SND_SOC_NOPM, 0, 0, |
| 3067 | &rt5677_dac4_r_mux), |
| 3068 | |
| 3069 | /* DAC Mixer */ |
| 3070 | SND_SOC_DAPM_SUPPLY("dac stereo1 filter", RT5677_PWR_DIG2, |
| 3071 | RT5677_PWR_DAC_S1F_BIT, 0, NULL, 0), |
Oder Chiou | 6800b5b | 2014-12-23 10:27:54 +0800 | [diff] [blame] | 3072 | SND_SOC_DAPM_SUPPLY("dac mono2 left filter", RT5677_PWR_DIG2, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 3073 | RT5677_PWR_DAC_M2F_L_BIT, 0, NULL, 0), |
Oder Chiou | 6800b5b | 2014-12-23 10:27:54 +0800 | [diff] [blame] | 3074 | SND_SOC_DAPM_SUPPLY("dac mono2 right filter", RT5677_PWR_DIG2, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 3075 | RT5677_PWR_DAC_M2F_R_BIT, 0, NULL, 0), |
Oder Chiou | 6800b5b | 2014-12-23 10:27:54 +0800 | [diff] [blame] | 3076 | SND_SOC_DAPM_SUPPLY("dac mono3 left filter", RT5677_PWR_DIG2, |
| 3077 | RT5677_PWR_DAC_M3F_L_BIT, 0, NULL, 0), |
| 3078 | SND_SOC_DAPM_SUPPLY("dac mono3 right filter", RT5677_PWR_DIG2, |
| 3079 | RT5677_PWR_DAC_M3F_R_BIT, 0, NULL, 0), |
| 3080 | SND_SOC_DAPM_SUPPLY("dac mono4 left filter", RT5677_PWR_DIG2, |
| 3081 | RT5677_PWR_DAC_M4F_L_BIT, 0, NULL, 0), |
| 3082 | SND_SOC_DAPM_SUPPLY("dac mono4 right filter", RT5677_PWR_DIG2, |
| 3083 | RT5677_PWR_DAC_M4F_R_BIT, 0, NULL, 0), |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 3084 | |
| 3085 | SND_SOC_DAPM_MIXER("Stereo DAC MIXL", SND_SOC_NOPM, 0, 0, |
| 3086 | rt5677_sto1_dac_l_mix, ARRAY_SIZE(rt5677_sto1_dac_l_mix)), |
| 3087 | SND_SOC_DAPM_MIXER("Stereo DAC MIXR", SND_SOC_NOPM, 0, 0, |
| 3088 | rt5677_sto1_dac_r_mix, ARRAY_SIZE(rt5677_sto1_dac_r_mix)), |
| 3089 | SND_SOC_DAPM_MIXER("Mono DAC MIXL", SND_SOC_NOPM, 0, 0, |
| 3090 | rt5677_mono_dac_l_mix, ARRAY_SIZE(rt5677_mono_dac_l_mix)), |
| 3091 | SND_SOC_DAPM_MIXER("Mono DAC MIXR", SND_SOC_NOPM, 0, 0, |
| 3092 | rt5677_mono_dac_r_mix, ARRAY_SIZE(rt5677_mono_dac_r_mix)), |
| 3093 | SND_SOC_DAPM_MIXER("DD1 MIXL", SND_SOC_NOPM, 0, 0, |
| 3094 | rt5677_dd1_l_mix, ARRAY_SIZE(rt5677_dd1_l_mix)), |
| 3095 | SND_SOC_DAPM_MIXER("DD1 MIXR", SND_SOC_NOPM, 0, 0, |
| 3096 | rt5677_dd1_r_mix, ARRAY_SIZE(rt5677_dd1_r_mix)), |
| 3097 | SND_SOC_DAPM_MIXER("DD2 MIXL", SND_SOC_NOPM, 0, 0, |
| 3098 | rt5677_dd2_l_mix, ARRAY_SIZE(rt5677_dd2_l_mix)), |
| 3099 | SND_SOC_DAPM_MIXER("DD2 MIXR", SND_SOC_NOPM, 0, 0, |
| 3100 | rt5677_dd2_r_mix, ARRAY_SIZE(rt5677_dd2_r_mix)), |
| 3101 | SND_SOC_DAPM_PGA("Stereo DAC MIX", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 3102 | SND_SOC_DAPM_PGA("Mono DAC MIX", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 3103 | SND_SOC_DAPM_PGA("DD1 MIX", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 3104 | SND_SOC_DAPM_PGA("DD2 MIX", SND_SOC_NOPM, 0, 0, NULL, 0), |
| 3105 | |
| 3106 | /* DACs */ |
| 3107 | SND_SOC_DAPM_DAC("DAC 1", NULL, RT5677_PWR_DIG1, |
| 3108 | RT5677_PWR_DAC1_BIT, 0), |
| 3109 | SND_SOC_DAPM_DAC("DAC 2", NULL, RT5677_PWR_DIG1, |
| 3110 | RT5677_PWR_DAC2_BIT, 0), |
| 3111 | SND_SOC_DAPM_DAC("DAC 3", NULL, RT5677_PWR_DIG1, |
| 3112 | RT5677_PWR_DAC3_BIT, 0), |
| 3113 | |
| 3114 | /* PDM */ |
| 3115 | SND_SOC_DAPM_SUPPLY("PDM1 Power", RT5677_PWR_DIG2, |
| 3116 | RT5677_PWR_PDM1_BIT, 0, NULL, 0), |
| 3117 | SND_SOC_DAPM_SUPPLY("PDM2 Power", RT5677_PWR_DIG2, |
| 3118 | RT5677_PWR_PDM2_BIT, 0, NULL, 0), |
| 3119 | |
| 3120 | SND_SOC_DAPM_MUX("PDM1 L Mux", RT5677_PDM_OUT_CTRL, RT5677_M_PDM1_L_SFT, |
| 3121 | 1, &rt5677_pdm1_l_mux), |
| 3122 | SND_SOC_DAPM_MUX("PDM1 R Mux", RT5677_PDM_OUT_CTRL, RT5677_M_PDM1_R_SFT, |
| 3123 | 1, &rt5677_pdm1_r_mux), |
| 3124 | SND_SOC_DAPM_MUX("PDM2 L Mux", RT5677_PDM_OUT_CTRL, RT5677_M_PDM2_L_SFT, |
| 3125 | 1, &rt5677_pdm2_l_mux), |
| 3126 | SND_SOC_DAPM_MUX("PDM2 R Mux", RT5677_PDM_OUT_CTRL, RT5677_M_PDM2_R_SFT, |
| 3127 | 1, &rt5677_pdm2_r_mux), |
| 3128 | |
Oder Chiou | 683996c | 2014-11-19 13:52:20 +0800 | [diff] [blame] | 3129 | SND_SOC_DAPM_PGA_S("LOUT1 amp", 0, RT5677_PWR_ANLG1, RT5677_PWR_LO1_BIT, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 3130 | 0, NULL, 0), |
Oder Chiou | 683996c | 2014-11-19 13:52:20 +0800 | [diff] [blame] | 3131 | SND_SOC_DAPM_PGA_S("LOUT2 amp", 0, RT5677_PWR_ANLG1, RT5677_PWR_LO2_BIT, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 3132 | 0, NULL, 0), |
Oder Chiou | 683996c | 2014-11-19 13:52:20 +0800 | [diff] [blame] | 3133 | SND_SOC_DAPM_PGA_S("LOUT3 amp", 0, RT5677_PWR_ANLG1, RT5677_PWR_LO3_BIT, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 3134 | 0, NULL, 0), |
| 3135 | |
Oder Chiou | 683996c | 2014-11-19 13:52:20 +0800 | [diff] [blame] | 3136 | SND_SOC_DAPM_PGA_S("LOUT1 vref", 1, SND_SOC_NOPM, 0, 0, |
| 3137 | rt5677_vref_event, SND_SOC_DAPM_POST_PMU), |
| 3138 | SND_SOC_DAPM_PGA_S("LOUT2 vref", 1, SND_SOC_NOPM, 0, 0, |
| 3139 | rt5677_vref_event, SND_SOC_DAPM_POST_PMU), |
| 3140 | SND_SOC_DAPM_PGA_S("LOUT3 vref", 1, SND_SOC_NOPM, 0, 0, |
| 3141 | rt5677_vref_event, SND_SOC_DAPM_POST_PMU), |
| 3142 | |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 3143 | /* Output Lines */ |
| 3144 | SND_SOC_DAPM_OUTPUT("LOUT1"), |
| 3145 | SND_SOC_DAPM_OUTPUT("LOUT2"), |
| 3146 | SND_SOC_DAPM_OUTPUT("LOUT3"), |
| 3147 | SND_SOC_DAPM_OUTPUT("PDM1L"), |
| 3148 | SND_SOC_DAPM_OUTPUT("PDM1R"), |
| 3149 | SND_SOC_DAPM_OUTPUT("PDM2L"), |
| 3150 | SND_SOC_DAPM_OUTPUT("PDM2R"), |
Oder Chiou | 683996c | 2014-11-19 13:52:20 +0800 | [diff] [blame] | 3151 | |
| 3152 | SND_SOC_DAPM_POST("vref", rt5677_vref_event), |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 3153 | }; |
| 3154 | |
| 3155 | static const struct snd_soc_dapm_route rt5677_dapm_routes[] = { |
Oder Chiou | 5220f7f | 2015-05-08 13:24:02 +0800 | [diff] [blame^] | 3156 | { "Stereo1 DMIC Mux", NULL, "DMIC STO1 ASRC", rt5677_dmic_use_asrc }, |
| 3157 | { "Stereo2 DMIC Mux", NULL, "DMIC STO2 ASRC", rt5677_dmic_use_asrc }, |
| 3158 | { "Stereo3 DMIC Mux", NULL, "DMIC STO3 ASRC", rt5677_dmic_use_asrc }, |
| 3159 | { "Stereo4 DMIC Mux", NULL, "DMIC STO4 ASRC", rt5677_dmic_use_asrc }, |
| 3160 | { "Mono DMIC L Mux", NULL, "DMIC MONO L ASRC", rt5677_dmic_use_asrc }, |
| 3161 | { "Mono DMIC R Mux", NULL, "DMIC MONO R ASRC", rt5677_dmic_use_asrc }, |
Oder Chiou | 5a8c7c2 | 2014-12-23 10:27:55 +0800 | [diff] [blame] | 3162 | { "I2S1", NULL, "I2S1 ASRC", can_use_asrc}, |
| 3163 | { "I2S2", NULL, "I2S2 ASRC", can_use_asrc}, |
| 3164 | { "I2S3", NULL, "I2S3 ASRC", can_use_asrc}, |
| 3165 | { "I2S4", NULL, "I2S4 ASRC", can_use_asrc}, |
| 3166 | |
| 3167 | { "dac stereo1 filter", NULL, "DAC STO ASRC", is_using_asrc }, |
| 3168 | { "dac mono2 left filter", NULL, "DAC MONO2 L ASRC", is_using_asrc }, |
| 3169 | { "dac mono2 right filter", NULL, "DAC MONO2 R ASRC", is_using_asrc }, |
| 3170 | { "dac mono3 left filter", NULL, "DAC MONO3 L ASRC", is_using_asrc }, |
| 3171 | { "dac mono3 right filter", NULL, "DAC MONO3 R ASRC", is_using_asrc }, |
| 3172 | { "dac mono4 left filter", NULL, "DAC MONO4 L ASRC", is_using_asrc }, |
| 3173 | { "dac mono4 right filter", NULL, "DAC MONO4 R ASRC", is_using_asrc }, |
| 3174 | { "adc stereo1 filter", NULL, "ADC STO1 ASRC", is_using_asrc }, |
| 3175 | { "adc stereo2 filter", NULL, "ADC STO2 ASRC", is_using_asrc }, |
| 3176 | { "adc stereo3 filter", NULL, "ADC STO3 ASRC", is_using_asrc }, |
| 3177 | { "adc stereo4 filter", NULL, "ADC STO4 ASRC", is_using_asrc }, |
| 3178 | { "adc mono left filter", NULL, "ADC MONO L ASRC", is_using_asrc }, |
| 3179 | { "adc mono right filter", NULL, "ADC MONO R ASRC", is_using_asrc }, |
| 3180 | |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 3181 | { "DMIC1", NULL, "DMIC L1" }, |
| 3182 | { "DMIC1", NULL, "DMIC R1" }, |
| 3183 | { "DMIC2", NULL, "DMIC L2" }, |
| 3184 | { "DMIC2", NULL, "DMIC R2" }, |
| 3185 | { "DMIC3", NULL, "DMIC L3" }, |
| 3186 | { "DMIC3", NULL, "DMIC R3" }, |
| 3187 | { "DMIC4", NULL, "DMIC L4" }, |
| 3188 | { "DMIC4", NULL, "DMIC R4" }, |
| 3189 | |
| 3190 | { "DMIC L1", NULL, "DMIC CLK" }, |
| 3191 | { "DMIC R1", NULL, "DMIC CLK" }, |
| 3192 | { "DMIC L2", NULL, "DMIC CLK" }, |
| 3193 | { "DMIC R2", NULL, "DMIC CLK" }, |
| 3194 | { "DMIC L3", NULL, "DMIC CLK" }, |
| 3195 | { "DMIC R3", NULL, "DMIC CLK" }, |
| 3196 | { "DMIC L4", NULL, "DMIC CLK" }, |
| 3197 | { "DMIC R4", NULL, "DMIC CLK" }, |
| 3198 | |
Bard Liao | 2d15d97 | 2014-08-27 19:50:34 +0800 | [diff] [blame] | 3199 | { "DMIC L1", NULL, "DMIC1 power" }, |
| 3200 | { "DMIC R1", NULL, "DMIC1 power" }, |
| 3201 | { "DMIC L3", NULL, "DMIC3 power" }, |
| 3202 | { "DMIC R3", NULL, "DMIC3 power" }, |
| 3203 | { "DMIC L4", NULL, "DMIC4 power" }, |
| 3204 | { "DMIC R4", NULL, "DMIC4 power" }, |
| 3205 | |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 3206 | { "BST1", NULL, "IN1P" }, |
| 3207 | { "BST1", NULL, "IN1N" }, |
| 3208 | { "BST2", NULL, "IN2P" }, |
| 3209 | { "BST2", NULL, "IN2N" }, |
| 3210 | |
Bard Liao | 22e5134 | 2014-08-27 19:50:33 +0800 | [diff] [blame] | 3211 | { "IN1P", NULL, "MICBIAS1" }, |
| 3212 | { "IN1N", NULL, "MICBIAS1" }, |
| 3213 | { "IN2P", NULL, "MICBIAS1" }, |
| 3214 | { "IN2N", NULL, "MICBIAS1" }, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 3215 | |
| 3216 | { "ADC 1", NULL, "BST1" }, |
| 3217 | { "ADC 1", NULL, "ADC 1 power" }, |
| 3218 | { "ADC 1", NULL, "ADC1 clock" }, |
| 3219 | { "ADC 2", NULL, "BST2" }, |
| 3220 | { "ADC 2", NULL, "ADC 2 power" }, |
| 3221 | { "ADC 2", NULL, "ADC2 clock" }, |
| 3222 | |
| 3223 | { "Stereo1 DMIC Mux", "DMIC1", "DMIC1" }, |
| 3224 | { "Stereo1 DMIC Mux", "DMIC2", "DMIC2" }, |
| 3225 | { "Stereo1 DMIC Mux", "DMIC3", "DMIC3" }, |
| 3226 | { "Stereo1 DMIC Mux", "DMIC4", "DMIC4" }, |
| 3227 | |
| 3228 | { "Stereo2 DMIC Mux", "DMIC1", "DMIC1" }, |
| 3229 | { "Stereo2 DMIC Mux", "DMIC2", "DMIC2" }, |
| 3230 | { "Stereo2 DMIC Mux", "DMIC3", "DMIC3" }, |
| 3231 | { "Stereo2 DMIC Mux", "DMIC4", "DMIC4" }, |
| 3232 | |
| 3233 | { "Stereo3 DMIC Mux", "DMIC1", "DMIC1" }, |
| 3234 | { "Stereo3 DMIC Mux", "DMIC2", "DMIC2" }, |
| 3235 | { "Stereo3 DMIC Mux", "DMIC3", "DMIC3" }, |
| 3236 | { "Stereo3 DMIC Mux", "DMIC4", "DMIC4" }, |
| 3237 | |
| 3238 | { "Stereo4 DMIC Mux", "DMIC1", "DMIC1" }, |
| 3239 | { "Stereo4 DMIC Mux", "DMIC2", "DMIC2" }, |
| 3240 | { "Stereo4 DMIC Mux", "DMIC3", "DMIC3" }, |
| 3241 | { "Stereo4 DMIC Mux", "DMIC4", "DMIC4" }, |
| 3242 | |
| 3243 | { "Mono DMIC L Mux", "DMIC1", "DMIC1" }, |
| 3244 | { "Mono DMIC L Mux", "DMIC2", "DMIC2" }, |
| 3245 | { "Mono DMIC L Mux", "DMIC3", "DMIC3" }, |
| 3246 | { "Mono DMIC L Mux", "DMIC4", "DMIC4" }, |
| 3247 | |
| 3248 | { "Mono DMIC R Mux", "DMIC1", "DMIC1" }, |
| 3249 | { "Mono DMIC R Mux", "DMIC2", "DMIC2" }, |
| 3250 | { "Mono DMIC R Mux", "DMIC3", "DMIC3" }, |
| 3251 | { "Mono DMIC R Mux", "DMIC4", "DMIC4" }, |
| 3252 | |
| 3253 | { "ADC 1_2", NULL, "ADC 1" }, |
| 3254 | { "ADC 1_2", NULL, "ADC 2" }, |
| 3255 | |
| 3256 | { "Stereo1 ADC1 Mux", "DD MIX1", "DD1 MIX" }, |
| 3257 | { "Stereo1 ADC1 Mux", "ADC1/2", "ADC 1_2" }, |
| 3258 | { "Stereo1 ADC1 Mux", "Stereo DAC MIX", "Stereo DAC MIX" }, |
| 3259 | |
| 3260 | { "Stereo1 ADC2 Mux", "DD MIX1", "DD1 MIX" }, |
| 3261 | { "Stereo1 ADC2 Mux", "DMIC", "Stereo1 DMIC Mux" }, |
| 3262 | { "Stereo1 ADC2 Mux", "Stereo DAC MIX", "Stereo DAC MIX" }, |
| 3263 | |
| 3264 | { "Stereo2 ADC1 Mux", "DD MIX1", "DD1 MIX" }, |
| 3265 | { "Stereo2 ADC1 Mux", "ADC1/2", "ADC 1_2" }, |
| 3266 | { "Stereo2 ADC1 Mux", "Stereo DAC MIX", "Stereo DAC MIX" }, |
| 3267 | |
| 3268 | { "Stereo2 ADC2 Mux", "DD MIX1", "DD1 MIX" }, |
| 3269 | { "Stereo2 ADC2 Mux", "DMIC", "Stereo2 DMIC Mux" }, |
| 3270 | { "Stereo2 ADC2 Mux", "Stereo DAC MIX", "Stereo DAC MIX" }, |
| 3271 | |
| 3272 | { "Stereo3 ADC1 Mux", "DD MIX1", "DD1 MIX" }, |
| 3273 | { "Stereo3 ADC1 Mux", "ADC1/2", "ADC 1_2" }, |
| 3274 | { "Stereo3 ADC1 Mux", "Stereo DAC MIX", "Stereo DAC MIX" }, |
| 3275 | |
| 3276 | { "Stereo3 ADC2 Mux", "DD MIX1", "DD1 MIX" }, |
| 3277 | { "Stereo3 ADC2 Mux", "DMIC", "Stereo3 DMIC Mux" }, |
| 3278 | { "Stereo3 ADC2 Mux", "Stereo DAC MIX", "Stereo DAC MIX" }, |
| 3279 | |
| 3280 | { "Stereo4 ADC1 Mux", "DD MIX1", "DD1 MIX" }, |
| 3281 | { "Stereo4 ADC1 Mux", "ADC1/2", "ADC 1_2" }, |
| 3282 | { "Stereo4 ADC1 Mux", "DD MIX2", "DD2 MIX" }, |
| 3283 | |
| 3284 | { "Stereo4 ADC2 Mux", "DD MIX1", "DD1 MIX" }, |
| 3285 | { "Stereo4 ADC2 Mux", "DMIC", "Stereo3 DMIC Mux" }, |
| 3286 | { "Stereo4 ADC2 Mux", "DD MIX2", "DD2 MIX" }, |
| 3287 | |
| 3288 | { "Mono ADC2 L Mux", "DD MIX1L", "DD1 MIXL" }, |
| 3289 | { "Mono ADC2 L Mux", "DMIC", "Mono DMIC L Mux" }, |
| 3290 | { "Mono ADC2 L Mux", "MONO DAC MIXL", "Mono DAC MIXL" }, |
| 3291 | |
| 3292 | { "Mono ADC1 L Mux", "DD MIX1L", "DD1 MIXL" }, |
| 3293 | { "Mono ADC1 L Mux", "ADC1", "ADC 1" }, |
| 3294 | { "Mono ADC1 L Mux", "MONO DAC MIXL", "Mono DAC MIXL" }, |
| 3295 | |
| 3296 | { "Mono ADC1 R Mux", "DD MIX1R", "DD1 MIXR" }, |
| 3297 | { "Mono ADC1 R Mux", "ADC2", "ADC 2" }, |
| 3298 | { "Mono ADC1 R Mux", "MONO DAC MIXR", "Mono DAC MIXR" }, |
| 3299 | |
| 3300 | { "Mono ADC2 R Mux", "DD MIX1R", "DD1 MIXR" }, |
| 3301 | { "Mono ADC2 R Mux", "DMIC", "Mono DMIC R Mux" }, |
| 3302 | { "Mono ADC2 R Mux", "MONO DAC MIXR", "Mono DAC MIXR" }, |
| 3303 | |
| 3304 | { "Sto1 ADC MIXL", "ADC1 Switch", "Stereo1 ADC1 Mux" }, |
| 3305 | { "Sto1 ADC MIXL", "ADC2 Switch", "Stereo1 ADC2 Mux" }, |
| 3306 | { "Sto1 ADC MIXR", "ADC1 Switch", "Stereo1 ADC1 Mux" }, |
| 3307 | { "Sto1 ADC MIXR", "ADC2 Switch", "Stereo1 ADC2 Mux" }, |
| 3308 | |
| 3309 | { "Stereo1 ADC MIXL", NULL, "Sto1 ADC MIXL" }, |
| 3310 | { "Stereo1 ADC MIXL", NULL, "adc stereo1 filter" }, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 3311 | { "Stereo1 ADC MIXR", NULL, "Sto1 ADC MIXR" }, |
| 3312 | { "Stereo1 ADC MIXR", NULL, "adc stereo1 filter" }, |
| 3313 | { "adc stereo1 filter", NULL, "PLL1", is_sys_clk_from_pll }, |
| 3314 | |
| 3315 | { "Stereo1 ADC MIX", NULL, "Stereo1 ADC MIXL" }, |
| 3316 | { "Stereo1 ADC MIX", NULL, "Stereo1 ADC MIXR" }, |
| 3317 | |
| 3318 | { "Sto2 ADC MIXL", "ADC1 Switch", "Stereo2 ADC1 Mux" }, |
| 3319 | { "Sto2 ADC MIXL", "ADC2 Switch", "Stereo2 ADC2 Mux" }, |
| 3320 | { "Sto2 ADC MIXR", "ADC1 Switch", "Stereo2 ADC1 Mux" }, |
| 3321 | { "Sto2 ADC MIXR", "ADC2 Switch", "Stereo2 ADC2 Mux" }, |
| 3322 | |
| 3323 | { "Sto2 ADC LR MIX", NULL, "Sto2 ADC MIXL" }, |
| 3324 | { "Sto2 ADC LR MIX", NULL, "Sto2 ADC MIXR" }, |
| 3325 | |
| 3326 | { "Stereo2 ADC LR Mux", "L", "Sto2 ADC MIXL" }, |
| 3327 | { "Stereo2 ADC LR Mux", "LR", "Sto2 ADC LR MIX" }, |
| 3328 | |
| 3329 | { "Stereo2 ADC MIXL", NULL, "Stereo2 ADC LR Mux" }, |
| 3330 | { "Stereo2 ADC MIXL", NULL, "adc stereo2 filter" }, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 3331 | { "Stereo2 ADC MIXR", NULL, "Sto2 ADC MIXR" }, |
| 3332 | { "Stereo2 ADC MIXR", NULL, "adc stereo2 filter" }, |
| 3333 | { "adc stereo2 filter", NULL, "PLL1", is_sys_clk_from_pll }, |
| 3334 | |
| 3335 | { "Stereo2 ADC MIX", NULL, "Stereo2 ADC MIXL" }, |
| 3336 | { "Stereo2 ADC MIX", NULL, "Stereo2 ADC MIXR" }, |
| 3337 | |
| 3338 | { "Sto3 ADC MIXL", "ADC1 Switch", "Stereo3 ADC1 Mux" }, |
| 3339 | { "Sto3 ADC MIXL", "ADC2 Switch", "Stereo3 ADC2 Mux" }, |
| 3340 | { "Sto3 ADC MIXR", "ADC1 Switch", "Stereo3 ADC1 Mux" }, |
| 3341 | { "Sto3 ADC MIXR", "ADC2 Switch", "Stereo3 ADC2 Mux" }, |
| 3342 | |
| 3343 | { "Stereo3 ADC MIXL", NULL, "Sto3 ADC MIXL" }, |
| 3344 | { "Stereo3 ADC MIXL", NULL, "adc stereo3 filter" }, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 3345 | { "Stereo3 ADC MIXR", NULL, "Sto3 ADC MIXR" }, |
| 3346 | { "Stereo3 ADC MIXR", NULL, "adc stereo3 filter" }, |
| 3347 | { "adc stereo3 filter", NULL, "PLL1", is_sys_clk_from_pll }, |
| 3348 | |
| 3349 | { "Stereo3 ADC MIX", NULL, "Stereo3 ADC MIXL" }, |
| 3350 | { "Stereo3 ADC MIX", NULL, "Stereo3 ADC MIXR" }, |
| 3351 | |
| 3352 | { "Sto4 ADC MIXL", "ADC1 Switch", "Stereo4 ADC1 Mux" }, |
| 3353 | { "Sto4 ADC MIXL", "ADC2 Switch", "Stereo4 ADC2 Mux" }, |
| 3354 | { "Sto4 ADC MIXR", "ADC1 Switch", "Stereo4 ADC1 Mux" }, |
| 3355 | { "Sto4 ADC MIXR", "ADC2 Switch", "Stereo4 ADC2 Mux" }, |
| 3356 | |
| 3357 | { "Stereo4 ADC MIXL", NULL, "Sto4 ADC MIXL" }, |
| 3358 | { "Stereo4 ADC MIXL", NULL, "adc stereo4 filter" }, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 3359 | { "Stereo4 ADC MIXR", NULL, "Sto4 ADC MIXR" }, |
| 3360 | { "Stereo4 ADC MIXR", NULL, "adc stereo4 filter" }, |
| 3361 | { "adc stereo4 filter", NULL, "PLL1", is_sys_clk_from_pll }, |
| 3362 | |
| 3363 | { "Stereo4 ADC MIX", NULL, "Stereo4 ADC MIXL" }, |
| 3364 | { "Stereo4 ADC MIX", NULL, "Stereo4 ADC MIXR" }, |
| 3365 | |
| 3366 | { "Mono ADC MIXL", "ADC1 Switch", "Mono ADC1 L Mux" }, |
| 3367 | { "Mono ADC MIXL", "ADC2 Switch", "Mono ADC2 L Mux" }, |
| 3368 | { "Mono ADC MIXL", NULL, "adc mono left filter" }, |
| 3369 | { "adc mono left filter", NULL, "PLL1", is_sys_clk_from_pll }, |
| 3370 | |
| 3371 | { "Mono ADC MIXR", "ADC1 Switch", "Mono ADC1 R Mux" }, |
| 3372 | { "Mono ADC MIXR", "ADC2 Switch", "Mono ADC2 R Mux" }, |
| 3373 | { "Mono ADC MIXR", NULL, "adc mono right filter" }, |
| 3374 | { "adc mono right filter", NULL, "PLL1", is_sys_clk_from_pll }, |
| 3375 | |
| 3376 | { "Mono ADC MIX", NULL, "Mono ADC MIXL" }, |
| 3377 | { "Mono ADC MIX", NULL, "Mono ADC MIXR" }, |
| 3378 | |
| 3379 | { "VAD ADC Mux", "STO1 ADC MIX L", "Stereo1 ADC MIXL" }, |
| 3380 | { "VAD ADC Mux", "MONO ADC MIX L", "Mono ADC MIXL" }, |
| 3381 | { "VAD ADC Mux", "MONO ADC MIX R", "Mono ADC MIXR" }, |
| 3382 | { "VAD ADC Mux", "STO2 ADC MIX L", "Stereo2 ADC MIXL" }, |
| 3383 | { "VAD ADC Mux", "STO3 ADC MIX L", "Stereo3 ADC MIXL" }, |
| 3384 | |
| 3385 | { "IF1 ADC1 Mux", "STO1 ADC MIX", "Stereo1 ADC MIX" }, |
| 3386 | { "IF1 ADC1 Mux", "OB01", "OB01 Bypass Mux" }, |
| 3387 | { "IF1 ADC1 Mux", "VAD ADC", "VAD ADC Mux" }, |
| 3388 | |
| 3389 | { "IF1 ADC2 Mux", "STO2 ADC MIX", "Stereo2 ADC MIX" }, |
| 3390 | { "IF1 ADC2 Mux", "OB23", "OB23 Bypass Mux" }, |
| 3391 | |
| 3392 | { "IF1 ADC3 Mux", "STO3 ADC MIX", "Stereo3 ADC MIX" }, |
| 3393 | { "IF1 ADC3 Mux", "MONO ADC MIX", "Mono ADC MIX" }, |
| 3394 | { "IF1 ADC3 Mux", "OB45", "OB45" }, |
| 3395 | |
| 3396 | { "IF1 ADC4 Mux", "STO4 ADC MIX", "Stereo4 ADC MIX" }, |
| 3397 | { "IF1 ADC4 Mux", "OB67", "OB67" }, |
| 3398 | { "IF1 ADC4 Mux", "OB01", "OB01 Bypass Mux" }, |
| 3399 | |
Oder Chiou | e6f6ebc | 2014-10-22 16:11:39 +0800 | [diff] [blame] | 3400 | { "IF1 ADC1 Swap Mux", "L/R", "IF1 ADC1 Mux" }, |
| 3401 | { "IF1 ADC1 Swap Mux", "R/L", "IF1 ADC1 Mux" }, |
| 3402 | { "IF1 ADC1 Swap Mux", "L/L", "IF1 ADC1 Mux" }, |
| 3403 | { "IF1 ADC1 Swap Mux", "R/R", "IF1 ADC1 Mux" }, |
| 3404 | |
| 3405 | { "IF1 ADC2 Swap Mux", "L/R", "IF1 ADC2 Mux" }, |
| 3406 | { "IF1 ADC2 Swap Mux", "R/L", "IF1 ADC2 Mux" }, |
| 3407 | { "IF1 ADC2 Swap Mux", "L/L", "IF1 ADC2 Mux" }, |
| 3408 | { "IF1 ADC2 Swap Mux", "R/R", "IF1 ADC2 Mux" }, |
| 3409 | |
| 3410 | { "IF1 ADC3 Swap Mux", "L/R", "IF1 ADC3 Mux" }, |
| 3411 | { "IF1 ADC3 Swap Mux", "R/L", "IF1 ADC3 Mux" }, |
| 3412 | { "IF1 ADC3 Swap Mux", "L/L", "IF1 ADC3 Mux" }, |
| 3413 | { "IF1 ADC3 Swap Mux", "R/R", "IF1 ADC3 Mux" }, |
| 3414 | |
| 3415 | { "IF1 ADC4 Swap Mux", "L/R", "IF1 ADC4 Mux" }, |
| 3416 | { "IF1 ADC4 Swap Mux", "R/L", "IF1 ADC4 Mux" }, |
| 3417 | { "IF1 ADC4 Swap Mux", "L/L", "IF1 ADC4 Mux" }, |
| 3418 | { "IF1 ADC4 Swap Mux", "R/R", "IF1 ADC4 Mux" }, |
| 3419 | |
| 3420 | { "IF1 ADC", NULL, "IF1 ADC1 Swap Mux" }, |
| 3421 | { "IF1 ADC", NULL, "IF1 ADC2 Swap Mux" }, |
| 3422 | { "IF1 ADC", NULL, "IF1 ADC3 Swap Mux" }, |
| 3423 | { "IF1 ADC", NULL, "IF1 ADC4 Swap Mux" }, |
| 3424 | |
| 3425 | { "IF1 ADC TDM Swap Mux", "1/2/3/4", "IF1 ADC" }, |
| 3426 | { "IF1 ADC TDM Swap Mux", "2/1/3/4", "IF1 ADC" }, |
| 3427 | { "IF1 ADC TDM Swap Mux", "2/3/1/4", "IF1 ADC" }, |
| 3428 | { "IF1 ADC TDM Swap Mux", "4/1/2/3", "IF1 ADC" }, |
| 3429 | { "IF1 ADC TDM Swap Mux", "1/3/2/4", "IF1 ADC" }, |
| 3430 | { "IF1 ADC TDM Swap Mux", "1/4/2/3", "IF1 ADC" }, |
| 3431 | { "IF1 ADC TDM Swap Mux", "3/1/2/4", "IF1 ADC" }, |
| 3432 | { "IF1 ADC TDM Swap Mux", "3/4/1/2", "IF1 ADC" }, |
| 3433 | |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 3434 | { "AIF1TX", NULL, "I2S1" }, |
Oder Chiou | e6f6ebc | 2014-10-22 16:11:39 +0800 | [diff] [blame] | 3435 | { "AIF1TX", NULL, "IF1 ADC TDM Swap Mux" }, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 3436 | |
| 3437 | { "IF2 ADC1 Mux", "STO1 ADC MIX", "Stereo1 ADC MIX" }, |
| 3438 | { "IF2 ADC1 Mux", "OB01", "OB01 Bypass Mux" }, |
| 3439 | { "IF2 ADC1 Mux", "VAD ADC", "VAD ADC Mux" }, |
| 3440 | |
| 3441 | { "IF2 ADC2 Mux", "STO2 ADC MIX", "Stereo2 ADC MIX" }, |
| 3442 | { "IF2 ADC2 Mux", "OB23", "OB23 Bypass Mux" }, |
| 3443 | |
| 3444 | { "IF2 ADC3 Mux", "STO3 ADC MIX", "Stereo3 ADC MIX" }, |
| 3445 | { "IF2 ADC3 Mux", "MONO ADC MIX", "Mono ADC MIX" }, |
| 3446 | { "IF2 ADC3 Mux", "OB45", "OB45" }, |
| 3447 | |
| 3448 | { "IF2 ADC4 Mux", "STO4 ADC MIX", "Stereo4 ADC MIX" }, |
| 3449 | { "IF2 ADC4 Mux", "OB67", "OB67" }, |
| 3450 | { "IF2 ADC4 Mux", "OB01", "OB01 Bypass Mux" }, |
| 3451 | |
Oder Chiou | e6f6ebc | 2014-10-22 16:11:39 +0800 | [diff] [blame] | 3452 | { "IF2 ADC1 Swap Mux", "L/R", "IF2 ADC1 Mux" }, |
| 3453 | { "IF2 ADC1 Swap Mux", "R/L", "IF2 ADC1 Mux" }, |
| 3454 | { "IF2 ADC1 Swap Mux", "L/L", "IF2 ADC1 Mux" }, |
| 3455 | { "IF2 ADC1 Swap Mux", "R/R", "IF2 ADC1 Mux" }, |
| 3456 | |
| 3457 | { "IF2 ADC2 Swap Mux", "L/R", "IF2 ADC2 Mux" }, |
| 3458 | { "IF2 ADC2 Swap Mux", "R/L", "IF2 ADC2 Mux" }, |
| 3459 | { "IF2 ADC2 Swap Mux", "L/L", "IF2 ADC2 Mux" }, |
| 3460 | { "IF2 ADC2 Swap Mux", "R/R", "IF2 ADC2 Mux" }, |
| 3461 | |
| 3462 | { "IF2 ADC3 Swap Mux", "L/R", "IF2 ADC3 Mux" }, |
| 3463 | { "IF2 ADC3 Swap Mux", "R/L", "IF2 ADC3 Mux" }, |
| 3464 | { "IF2 ADC3 Swap Mux", "L/L", "IF2 ADC3 Mux" }, |
| 3465 | { "IF2 ADC3 Swap Mux", "R/R", "IF2 ADC3 Mux" }, |
| 3466 | |
| 3467 | { "IF2 ADC4 Swap Mux", "L/R", "IF2 ADC4 Mux" }, |
| 3468 | { "IF2 ADC4 Swap Mux", "R/L", "IF2 ADC4 Mux" }, |
| 3469 | { "IF2 ADC4 Swap Mux", "L/L", "IF2 ADC4 Mux" }, |
| 3470 | { "IF2 ADC4 Swap Mux", "R/R", "IF2 ADC4 Mux" }, |
| 3471 | |
| 3472 | { "IF2 ADC", NULL, "IF2 ADC1 Swap Mux" }, |
| 3473 | { "IF2 ADC", NULL, "IF2 ADC2 Swap Mux" }, |
| 3474 | { "IF2 ADC", NULL, "IF2 ADC3 Swap Mux" }, |
| 3475 | { "IF2 ADC", NULL, "IF2 ADC4 Swap Mux" }, |
| 3476 | |
| 3477 | { "IF2 ADC TDM Swap Mux", "1/2/3/4", "IF2 ADC" }, |
| 3478 | { "IF2 ADC TDM Swap Mux", "2/1/3/4", "IF2 ADC" }, |
| 3479 | { "IF2 ADC TDM Swap Mux", "3/1/2/4", "IF2 ADC" }, |
| 3480 | { "IF2 ADC TDM Swap Mux", "4/1/2/3", "IF2 ADC" }, |
| 3481 | { "IF2 ADC TDM Swap Mux", "1/3/2/4", "IF2 ADC" }, |
| 3482 | { "IF2 ADC TDM Swap Mux", "1/4/2/3", "IF2 ADC" }, |
| 3483 | { "IF2 ADC TDM Swap Mux", "2/3/1/4", "IF2 ADC" }, |
| 3484 | { "IF2 ADC TDM Swap Mux", "3/4/1/2", "IF2 ADC" }, |
| 3485 | |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 3486 | { "AIF2TX", NULL, "I2S2" }, |
Oder Chiou | e6f6ebc | 2014-10-22 16:11:39 +0800 | [diff] [blame] | 3487 | { "AIF2TX", NULL, "IF2 ADC TDM Swap Mux" }, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 3488 | |
| 3489 | { "IF3 ADC Mux", "STO1 ADC MIX", "Stereo1 ADC MIX" }, |
| 3490 | { "IF3 ADC Mux", "STO2 ADC MIX", "Stereo2 ADC MIX" }, |
| 3491 | { "IF3 ADC Mux", "STO3 ADC MIX", "Stereo3 ADC MIX" }, |
| 3492 | { "IF3 ADC Mux", "STO4 ADC MIX", "Stereo4 ADC MIX" }, |
| 3493 | { "IF3 ADC Mux", "MONO ADC MIX", "Mono ADC MIX" }, |
| 3494 | { "IF3 ADC Mux", "OB01", "OB01 Bypass Mux" }, |
| 3495 | { "IF3 ADC Mux", "OB23", "OB23 Bypass Mux" }, |
| 3496 | { "IF3 ADC Mux", "VAD ADC", "VAD ADC Mux" }, |
| 3497 | |
| 3498 | { "AIF3TX", NULL, "I2S3" }, |
| 3499 | { "AIF3TX", NULL, "IF3 ADC Mux" }, |
| 3500 | |
| 3501 | { "IF4 ADC Mux", "STO1 ADC MIX", "Stereo1 ADC MIX" }, |
| 3502 | { "IF4 ADC Mux", "STO2 ADC MIX", "Stereo2 ADC MIX" }, |
| 3503 | { "IF4 ADC Mux", "STO3 ADC MIX", "Stereo3 ADC MIX" }, |
| 3504 | { "IF4 ADC Mux", "STO4 ADC MIX", "Stereo4 ADC MIX" }, |
| 3505 | { "IF4 ADC Mux", "MONO ADC MIX", "Mono ADC MIX" }, |
| 3506 | { "IF4 ADC Mux", "OB01", "OB01 Bypass Mux" }, |
| 3507 | { "IF4 ADC Mux", "OB23", "OB23 Bypass Mux" }, |
| 3508 | { "IF4 ADC Mux", "VAD ADC", "VAD ADC Mux" }, |
| 3509 | |
| 3510 | { "AIF4TX", NULL, "I2S4" }, |
| 3511 | { "AIF4TX", NULL, "IF4 ADC Mux" }, |
| 3512 | |
| 3513 | { "SLB ADC1 Mux", "STO1 ADC MIX", "Stereo1 ADC MIX" }, |
| 3514 | { "SLB ADC1 Mux", "OB01", "OB01 Bypass Mux" }, |
| 3515 | { "SLB ADC1 Mux", "VAD ADC", "VAD ADC Mux" }, |
| 3516 | |
| 3517 | { "SLB ADC2 Mux", "STO2 ADC MIX", "Stereo2 ADC MIX" }, |
| 3518 | { "SLB ADC2 Mux", "OB23", "OB23 Bypass Mux" }, |
| 3519 | |
| 3520 | { "SLB ADC3 Mux", "STO3 ADC MIX", "Stereo3 ADC MIX" }, |
| 3521 | { "SLB ADC3 Mux", "MONO ADC MIX", "Mono ADC MIX" }, |
| 3522 | { "SLB ADC3 Mux", "OB45", "OB45" }, |
| 3523 | |
| 3524 | { "SLB ADC4 Mux", "STO4 ADC MIX", "Stereo4 ADC MIX" }, |
| 3525 | { "SLB ADC4 Mux", "OB67", "OB67" }, |
| 3526 | { "SLB ADC4 Mux", "OB01", "OB01 Bypass Mux" }, |
| 3527 | |
| 3528 | { "SLBTX", NULL, "SLB" }, |
| 3529 | { "SLBTX", NULL, "SLB ADC1 Mux" }, |
| 3530 | { "SLBTX", NULL, "SLB ADC2 Mux" }, |
| 3531 | { "SLBTX", NULL, "SLB ADC3 Mux" }, |
| 3532 | { "SLBTX", NULL, "SLB ADC4 Mux" }, |
| 3533 | |
| 3534 | { "IB01 Mux", "IF1 DAC 01", "IF1 DAC01" }, |
| 3535 | { "IB01 Mux", "IF2 DAC 01", "IF2 DAC01" }, |
| 3536 | { "IB01 Mux", "SLB DAC 01", "SLB DAC01" }, |
| 3537 | { "IB01 Mux", "STO1 ADC MIX", "Stereo1 ADC MIX" }, |
| 3538 | { "IB01 Mux", "VAD ADC/DAC1 FS", "DAC1 FS" }, |
| 3539 | |
| 3540 | { "IB01 Bypass Mux", "Bypass", "IB01 Mux" }, |
| 3541 | { "IB01 Bypass Mux", "Pass SRC", "IB01 Mux" }, |
| 3542 | |
| 3543 | { "IB23 Mux", "IF1 DAC 23", "IF1 DAC23" }, |
| 3544 | { "IB23 Mux", "IF2 DAC 23", "IF2 DAC23" }, |
| 3545 | { "IB23 Mux", "SLB DAC 23", "SLB DAC23" }, |
| 3546 | { "IB23 Mux", "STO2 ADC MIX", "Stereo2 ADC MIX" }, |
| 3547 | { "IB23 Mux", "DAC1 FS", "DAC1 FS" }, |
| 3548 | { "IB23 Mux", "IF4 DAC", "IF4 DAC" }, |
| 3549 | |
| 3550 | { "IB23 Bypass Mux", "Bypass", "IB23 Mux" }, |
| 3551 | { "IB23 Bypass Mux", "Pass SRC", "IB23 Mux" }, |
| 3552 | |
| 3553 | { "IB45 Mux", "IF1 DAC 45", "IF1 DAC45" }, |
| 3554 | { "IB45 Mux", "IF2 DAC 45", "IF2 DAC45" }, |
| 3555 | { "IB45 Mux", "SLB DAC 45", "SLB DAC45" }, |
| 3556 | { "IB45 Mux", "STO3 ADC MIX", "Stereo3 ADC MIX" }, |
| 3557 | { "IB45 Mux", "IF3 DAC", "IF3 DAC" }, |
| 3558 | |
| 3559 | { "IB45 Bypass Mux", "Bypass", "IB45 Mux" }, |
| 3560 | { "IB45 Bypass Mux", "Pass SRC", "IB45 Mux" }, |
| 3561 | |
Oder Chiou | 7006877 | 2015-02-25 17:36:13 +0800 | [diff] [blame] | 3562 | { "IB6 Mux", "IF1 DAC 6", "IF1 DAC6 Mux" }, |
| 3563 | { "IB6 Mux", "IF2 DAC 6", "IF2 DAC6 Mux" }, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 3564 | { "IB6 Mux", "SLB DAC 6", "SLB DAC6" }, |
| 3565 | { "IB6 Mux", "STO4 ADC MIX L", "Stereo4 ADC MIXL" }, |
| 3566 | { "IB6 Mux", "IF4 DAC L", "IF4 DAC L" }, |
| 3567 | { "IB6 Mux", "STO1 ADC MIX L", "Stereo1 ADC MIXL" }, |
| 3568 | { "IB6 Mux", "STO2 ADC MIX L", "Stereo2 ADC MIXL" }, |
| 3569 | { "IB6 Mux", "STO3 ADC MIX L", "Stereo3 ADC MIXL" }, |
| 3570 | |
Oder Chiou | 7006877 | 2015-02-25 17:36:13 +0800 | [diff] [blame] | 3571 | { "IB7 Mux", "IF1 DAC 7", "IF1 DAC7 Mux" }, |
| 3572 | { "IB7 Mux", "IF2 DAC 7", "IF2 DAC7 Mux" }, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 3573 | { "IB7 Mux", "SLB DAC 7", "SLB DAC7" }, |
| 3574 | { "IB7 Mux", "STO4 ADC MIX R", "Stereo4 ADC MIXR" }, |
| 3575 | { "IB7 Mux", "IF4 DAC R", "IF4 DAC R" }, |
| 3576 | { "IB7 Mux", "STO1 ADC MIX R", "Stereo1 ADC MIXR" }, |
| 3577 | { "IB7 Mux", "STO2 ADC MIX R", "Stereo2 ADC MIXR" }, |
| 3578 | { "IB7 Mux", "STO3 ADC MIX R", "Stereo3 ADC MIXR" }, |
| 3579 | |
| 3580 | { "IB8 Mux", "STO1 ADC MIX L", "Stereo1 ADC MIXL" }, |
| 3581 | { "IB8 Mux", "STO2 ADC MIX L", "Stereo2 ADC MIXL" }, |
| 3582 | { "IB8 Mux", "STO3 ADC MIX L", "Stereo3 ADC MIXL" }, |
| 3583 | { "IB8 Mux", "STO4 ADC MIX L", "Stereo4 ADC MIXL" }, |
| 3584 | { "IB8 Mux", "MONO ADC MIX L", "Mono ADC MIXL" }, |
| 3585 | { "IB8 Mux", "DACL1 FS", "DAC1 MIXL" }, |
| 3586 | |
| 3587 | { "IB9 Mux", "STO1 ADC MIX R", "Stereo1 ADC MIXR" }, |
| 3588 | { "IB9 Mux", "STO2 ADC MIX R", "Stereo2 ADC MIXR" }, |
| 3589 | { "IB9 Mux", "STO3 ADC MIX R", "Stereo3 ADC MIXR" }, |
| 3590 | { "IB9 Mux", "STO4 ADC MIX R", "Stereo4 ADC MIXR" }, |
| 3591 | { "IB9 Mux", "MONO ADC MIX R", "Mono ADC MIXR" }, |
| 3592 | { "IB9 Mux", "DACR1 FS", "DAC1 MIXR" }, |
| 3593 | { "IB9 Mux", "DAC1 FS", "DAC1 FS" }, |
| 3594 | |
| 3595 | { "OB01 MIX", "IB01 Switch", "IB01 Bypass Mux" }, |
| 3596 | { "OB01 MIX", "IB23 Switch", "IB23 Bypass Mux" }, |
| 3597 | { "OB01 MIX", "IB45 Switch", "IB45 Bypass Mux" }, |
| 3598 | { "OB01 MIX", "IB6 Switch", "IB6 Mux" }, |
| 3599 | { "OB01 MIX", "IB7 Switch", "IB7 Mux" }, |
| 3600 | { "OB01 MIX", "IB8 Switch", "IB8 Mux" }, |
| 3601 | { "OB01 MIX", "IB9 Switch", "IB9 Mux" }, |
| 3602 | |
| 3603 | { "OB23 MIX", "IB01 Switch", "IB01 Bypass Mux" }, |
| 3604 | { "OB23 MIX", "IB23 Switch", "IB23 Bypass Mux" }, |
| 3605 | { "OB23 MIX", "IB45 Switch", "IB45 Bypass Mux" }, |
| 3606 | { "OB23 MIX", "IB6 Switch", "IB6 Mux" }, |
| 3607 | { "OB23 MIX", "IB7 Switch", "IB7 Mux" }, |
| 3608 | { "OB23 MIX", "IB8 Switch", "IB8 Mux" }, |
| 3609 | { "OB23 MIX", "IB9 Switch", "IB9 Mux" }, |
| 3610 | |
| 3611 | { "OB4 MIX", "IB01 Switch", "IB01 Bypass Mux" }, |
| 3612 | { "OB4 MIX", "IB23 Switch", "IB23 Bypass Mux" }, |
| 3613 | { "OB4 MIX", "IB45 Switch", "IB45 Bypass Mux" }, |
| 3614 | { "OB4 MIX", "IB6 Switch", "IB6 Mux" }, |
| 3615 | { "OB4 MIX", "IB7 Switch", "IB7 Mux" }, |
| 3616 | { "OB4 MIX", "IB8 Switch", "IB8 Mux" }, |
| 3617 | { "OB4 MIX", "IB9 Switch", "IB9 Mux" }, |
| 3618 | |
| 3619 | { "OB5 MIX", "IB01 Switch", "IB01 Bypass Mux" }, |
| 3620 | { "OB5 MIX", "IB23 Switch", "IB23 Bypass Mux" }, |
| 3621 | { "OB5 MIX", "IB45 Switch", "IB45 Bypass Mux" }, |
| 3622 | { "OB5 MIX", "IB6 Switch", "IB6 Mux" }, |
| 3623 | { "OB5 MIX", "IB7 Switch", "IB7 Mux" }, |
| 3624 | { "OB5 MIX", "IB8 Switch", "IB8 Mux" }, |
| 3625 | { "OB5 MIX", "IB9 Switch", "IB9 Mux" }, |
| 3626 | |
| 3627 | { "OB6 MIX", "IB01 Switch", "IB01 Bypass Mux" }, |
| 3628 | { "OB6 MIX", "IB23 Switch", "IB23 Bypass Mux" }, |
| 3629 | { "OB6 MIX", "IB45 Switch", "IB45 Bypass Mux" }, |
| 3630 | { "OB6 MIX", "IB6 Switch", "IB6 Mux" }, |
| 3631 | { "OB6 MIX", "IB7 Switch", "IB7 Mux" }, |
| 3632 | { "OB6 MIX", "IB8 Switch", "IB8 Mux" }, |
| 3633 | { "OB6 MIX", "IB9 Switch", "IB9 Mux" }, |
| 3634 | |
| 3635 | { "OB7 MIX", "IB01 Switch", "IB01 Bypass Mux" }, |
| 3636 | { "OB7 MIX", "IB23 Switch", "IB23 Bypass Mux" }, |
| 3637 | { "OB7 MIX", "IB45 Switch", "IB45 Bypass Mux" }, |
| 3638 | { "OB7 MIX", "IB6 Switch", "IB6 Mux" }, |
| 3639 | { "OB7 MIX", "IB7 Switch", "IB7 Mux" }, |
| 3640 | { "OB7 MIX", "IB8 Switch", "IB8 Mux" }, |
| 3641 | { "OB7 MIX", "IB9 Switch", "IB9 Mux" }, |
| 3642 | |
| 3643 | { "OB01 Bypass Mux", "Bypass", "OB01 MIX" }, |
| 3644 | { "OB01 Bypass Mux", "Pass SRC", "OB01 MIX" }, |
| 3645 | { "OB23 Bypass Mux", "Bypass", "OB23 MIX" }, |
| 3646 | { "OB23 Bypass Mux", "Pass SRC", "OB23 MIX" }, |
| 3647 | |
| 3648 | { "OutBound2", NULL, "OB23 Bypass Mux" }, |
| 3649 | { "OutBound3", NULL, "OB23 Bypass Mux" }, |
| 3650 | { "OutBound4", NULL, "OB4 MIX" }, |
| 3651 | { "OutBound5", NULL, "OB5 MIX" }, |
| 3652 | { "OutBound6", NULL, "OB6 MIX" }, |
| 3653 | { "OutBound7", NULL, "OB7 MIX" }, |
| 3654 | |
| 3655 | { "OB45", NULL, "OutBound4" }, |
| 3656 | { "OB45", NULL, "OutBound5" }, |
| 3657 | { "OB67", NULL, "OutBound6" }, |
| 3658 | { "OB67", NULL, "OutBound7" }, |
| 3659 | |
| 3660 | { "IF1 DAC0", NULL, "AIF1RX" }, |
| 3661 | { "IF1 DAC1", NULL, "AIF1RX" }, |
| 3662 | { "IF1 DAC2", NULL, "AIF1RX" }, |
| 3663 | { "IF1 DAC3", NULL, "AIF1RX" }, |
| 3664 | { "IF1 DAC4", NULL, "AIF1RX" }, |
| 3665 | { "IF1 DAC5", NULL, "AIF1RX" }, |
| 3666 | { "IF1 DAC6", NULL, "AIF1RX" }, |
| 3667 | { "IF1 DAC7", NULL, "AIF1RX" }, |
| 3668 | { "IF1 DAC0", NULL, "I2S1" }, |
| 3669 | { "IF1 DAC1", NULL, "I2S1" }, |
| 3670 | { "IF1 DAC2", NULL, "I2S1" }, |
| 3671 | { "IF1 DAC3", NULL, "I2S1" }, |
| 3672 | { "IF1 DAC4", NULL, "I2S1" }, |
| 3673 | { "IF1 DAC5", NULL, "I2S1" }, |
| 3674 | { "IF1 DAC6", NULL, "I2S1" }, |
| 3675 | { "IF1 DAC7", NULL, "I2S1" }, |
| 3676 | |
Oder Chiou | 91159ec | 2014-11-11 15:31:19 +0800 | [diff] [blame] | 3677 | { "IF1 DAC0 Mux", "Slot0", "IF1 DAC0" }, |
| 3678 | { "IF1 DAC0 Mux", "Slot1", "IF1 DAC1" }, |
| 3679 | { "IF1 DAC0 Mux", "Slot2", "IF1 DAC2" }, |
| 3680 | { "IF1 DAC0 Mux", "Slot3", "IF1 DAC3" }, |
| 3681 | { "IF1 DAC0 Mux", "Slot4", "IF1 DAC4" }, |
| 3682 | { "IF1 DAC0 Mux", "Slot5", "IF1 DAC5" }, |
| 3683 | { "IF1 DAC0 Mux", "Slot6", "IF1 DAC6" }, |
| 3684 | { "IF1 DAC0 Mux", "Slot7", "IF1 DAC7" }, |
| 3685 | |
| 3686 | { "IF1 DAC1 Mux", "Slot0", "IF1 DAC0" }, |
| 3687 | { "IF1 DAC1 Mux", "Slot1", "IF1 DAC1" }, |
| 3688 | { "IF1 DAC1 Mux", "Slot2", "IF1 DAC2" }, |
| 3689 | { "IF1 DAC1 Mux", "Slot3", "IF1 DAC3" }, |
| 3690 | { "IF1 DAC1 Mux", "Slot4", "IF1 DAC4" }, |
| 3691 | { "IF1 DAC1 Mux", "Slot5", "IF1 DAC5" }, |
| 3692 | { "IF1 DAC1 Mux", "Slot6", "IF1 DAC6" }, |
| 3693 | { "IF1 DAC1 Mux", "Slot7", "IF1 DAC7" }, |
| 3694 | |
| 3695 | { "IF1 DAC2 Mux", "Slot0", "IF1 DAC0" }, |
| 3696 | { "IF1 DAC2 Mux", "Slot1", "IF1 DAC1" }, |
| 3697 | { "IF1 DAC2 Mux", "Slot2", "IF1 DAC2" }, |
| 3698 | { "IF1 DAC2 Mux", "Slot3", "IF1 DAC3" }, |
| 3699 | { "IF1 DAC2 Mux", "Slot4", "IF1 DAC4" }, |
| 3700 | { "IF1 DAC2 Mux", "Slot5", "IF1 DAC5" }, |
| 3701 | { "IF1 DAC2 Mux", "Slot6", "IF1 DAC6" }, |
| 3702 | { "IF1 DAC2 Mux", "Slot7", "IF1 DAC7" }, |
| 3703 | |
| 3704 | { "IF1 DAC3 Mux", "Slot0", "IF1 DAC0" }, |
| 3705 | { "IF1 DAC3 Mux", "Slot1", "IF1 DAC1" }, |
| 3706 | { "IF1 DAC3 Mux", "Slot2", "IF1 DAC2" }, |
| 3707 | { "IF1 DAC3 Mux", "Slot3", "IF1 DAC3" }, |
| 3708 | { "IF1 DAC3 Mux", "Slot4", "IF1 DAC4" }, |
| 3709 | { "IF1 DAC3 Mux", "Slot5", "IF1 DAC5" }, |
| 3710 | { "IF1 DAC3 Mux", "Slot6", "IF1 DAC6" }, |
| 3711 | { "IF1 DAC3 Mux", "Slot7", "IF1 DAC7" }, |
| 3712 | |
| 3713 | { "IF1 DAC4 Mux", "Slot0", "IF1 DAC0" }, |
| 3714 | { "IF1 DAC4 Mux", "Slot1", "IF1 DAC1" }, |
| 3715 | { "IF1 DAC4 Mux", "Slot2", "IF1 DAC2" }, |
| 3716 | { "IF1 DAC4 Mux", "Slot3", "IF1 DAC3" }, |
| 3717 | { "IF1 DAC4 Mux", "Slot4", "IF1 DAC4" }, |
| 3718 | { "IF1 DAC4 Mux", "Slot5", "IF1 DAC5" }, |
| 3719 | { "IF1 DAC4 Mux", "Slot6", "IF1 DAC6" }, |
| 3720 | { "IF1 DAC4 Mux", "Slot7", "IF1 DAC7" }, |
| 3721 | |
| 3722 | { "IF1 DAC5 Mux", "Slot0", "IF1 DAC0" }, |
| 3723 | { "IF1 DAC5 Mux", "Slot1", "IF1 DAC1" }, |
| 3724 | { "IF1 DAC5 Mux", "Slot2", "IF1 DAC2" }, |
| 3725 | { "IF1 DAC5 Mux", "Slot3", "IF1 DAC3" }, |
| 3726 | { "IF1 DAC5 Mux", "Slot4", "IF1 DAC4" }, |
| 3727 | { "IF1 DAC5 Mux", "Slot5", "IF1 DAC5" }, |
| 3728 | { "IF1 DAC5 Mux", "Slot6", "IF1 DAC6" }, |
| 3729 | { "IF1 DAC5 Mux", "Slot7", "IF1 DAC7" }, |
| 3730 | |
| 3731 | { "IF1 DAC6 Mux", "Slot0", "IF1 DAC0" }, |
| 3732 | { "IF1 DAC6 Mux", "Slot1", "IF1 DAC1" }, |
| 3733 | { "IF1 DAC6 Mux", "Slot2", "IF1 DAC2" }, |
| 3734 | { "IF1 DAC6 Mux", "Slot3", "IF1 DAC3" }, |
| 3735 | { "IF1 DAC6 Mux", "Slot4", "IF1 DAC4" }, |
| 3736 | { "IF1 DAC6 Mux", "Slot5", "IF1 DAC5" }, |
| 3737 | { "IF1 DAC6 Mux", "Slot6", "IF1 DAC6" }, |
| 3738 | { "IF1 DAC6 Mux", "Slot7", "IF1 DAC7" }, |
| 3739 | |
| 3740 | { "IF1 DAC7 Mux", "Slot0", "IF1 DAC0" }, |
| 3741 | { "IF1 DAC7 Mux", "Slot1", "IF1 DAC1" }, |
| 3742 | { "IF1 DAC7 Mux", "Slot2", "IF1 DAC2" }, |
| 3743 | { "IF1 DAC7 Mux", "Slot3", "IF1 DAC3" }, |
| 3744 | { "IF1 DAC7 Mux", "Slot4", "IF1 DAC4" }, |
| 3745 | { "IF1 DAC7 Mux", "Slot5", "IF1 DAC5" }, |
| 3746 | { "IF1 DAC7 Mux", "Slot6", "IF1 DAC6" }, |
| 3747 | { "IF1 DAC7 Mux", "Slot7", "IF1 DAC7" }, |
| 3748 | |
| 3749 | { "IF1 DAC01", NULL, "IF1 DAC0 Mux" }, |
| 3750 | { "IF1 DAC01", NULL, "IF1 DAC1 Mux" }, |
| 3751 | { "IF1 DAC23", NULL, "IF1 DAC2 Mux" }, |
| 3752 | { "IF1 DAC23", NULL, "IF1 DAC3 Mux" }, |
| 3753 | { "IF1 DAC45", NULL, "IF1 DAC4 Mux" }, |
| 3754 | { "IF1 DAC45", NULL, "IF1 DAC5 Mux" }, |
| 3755 | { "IF1 DAC67", NULL, "IF1 DAC6 Mux" }, |
| 3756 | { "IF1 DAC67", NULL, "IF1 DAC7 Mux" }, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 3757 | |
| 3758 | { "IF2 DAC0", NULL, "AIF2RX" }, |
| 3759 | { "IF2 DAC1", NULL, "AIF2RX" }, |
| 3760 | { "IF2 DAC2", NULL, "AIF2RX" }, |
| 3761 | { "IF2 DAC3", NULL, "AIF2RX" }, |
| 3762 | { "IF2 DAC4", NULL, "AIF2RX" }, |
| 3763 | { "IF2 DAC5", NULL, "AIF2RX" }, |
| 3764 | { "IF2 DAC6", NULL, "AIF2RX" }, |
| 3765 | { "IF2 DAC7", NULL, "AIF2RX" }, |
| 3766 | { "IF2 DAC0", NULL, "I2S2" }, |
| 3767 | { "IF2 DAC1", NULL, "I2S2" }, |
| 3768 | { "IF2 DAC2", NULL, "I2S2" }, |
| 3769 | { "IF2 DAC3", NULL, "I2S2" }, |
| 3770 | { "IF2 DAC4", NULL, "I2S2" }, |
| 3771 | { "IF2 DAC5", NULL, "I2S2" }, |
| 3772 | { "IF2 DAC6", NULL, "I2S2" }, |
| 3773 | { "IF2 DAC7", NULL, "I2S2" }, |
| 3774 | |
Oder Chiou | 91159ec | 2014-11-11 15:31:19 +0800 | [diff] [blame] | 3775 | { "IF2 DAC0 Mux", "Slot0", "IF2 DAC0" }, |
| 3776 | { "IF2 DAC0 Mux", "Slot1", "IF2 DAC1" }, |
| 3777 | { "IF2 DAC0 Mux", "Slot2", "IF2 DAC2" }, |
| 3778 | { "IF2 DAC0 Mux", "Slot3", "IF2 DAC3" }, |
| 3779 | { "IF2 DAC0 Mux", "Slot4", "IF2 DAC4" }, |
| 3780 | { "IF2 DAC0 Mux", "Slot5", "IF2 DAC5" }, |
| 3781 | { "IF2 DAC0 Mux", "Slot6", "IF2 DAC6" }, |
| 3782 | { "IF2 DAC0 Mux", "Slot7", "IF2 DAC7" }, |
| 3783 | |
| 3784 | { "IF2 DAC1 Mux", "Slot0", "IF2 DAC0" }, |
| 3785 | { "IF2 DAC1 Mux", "Slot1", "IF2 DAC1" }, |
| 3786 | { "IF2 DAC1 Mux", "Slot2", "IF2 DAC2" }, |
| 3787 | { "IF2 DAC1 Mux", "Slot3", "IF2 DAC3" }, |
| 3788 | { "IF2 DAC1 Mux", "Slot4", "IF2 DAC4" }, |
| 3789 | { "IF2 DAC1 Mux", "Slot5", "IF2 DAC5" }, |
| 3790 | { "IF2 DAC1 Mux", "Slot6", "IF2 DAC6" }, |
| 3791 | { "IF2 DAC1 Mux", "Slot7", "IF2 DAC7" }, |
| 3792 | |
| 3793 | { "IF2 DAC2 Mux", "Slot0", "IF2 DAC0" }, |
| 3794 | { "IF2 DAC2 Mux", "Slot1", "IF2 DAC1" }, |
| 3795 | { "IF2 DAC2 Mux", "Slot2", "IF2 DAC2" }, |
| 3796 | { "IF2 DAC2 Mux", "Slot3", "IF2 DAC3" }, |
| 3797 | { "IF2 DAC2 Mux", "Slot4", "IF2 DAC4" }, |
| 3798 | { "IF2 DAC2 Mux", "Slot5", "IF2 DAC5" }, |
| 3799 | { "IF2 DAC2 Mux", "Slot6", "IF2 DAC6" }, |
| 3800 | { "IF2 DAC2 Mux", "Slot7", "IF2 DAC7" }, |
| 3801 | |
| 3802 | { "IF2 DAC3 Mux", "Slot0", "IF2 DAC0" }, |
| 3803 | { "IF2 DAC3 Mux", "Slot1", "IF2 DAC1" }, |
| 3804 | { "IF2 DAC3 Mux", "Slot2", "IF2 DAC2" }, |
| 3805 | { "IF2 DAC3 Mux", "Slot3", "IF2 DAC3" }, |
| 3806 | { "IF2 DAC3 Mux", "Slot4", "IF2 DAC4" }, |
| 3807 | { "IF2 DAC3 Mux", "Slot5", "IF2 DAC5" }, |
| 3808 | { "IF2 DAC3 Mux", "Slot6", "IF2 DAC6" }, |
| 3809 | { "IF2 DAC3 Mux", "Slot7", "IF2 DAC7" }, |
| 3810 | |
| 3811 | { "IF2 DAC4 Mux", "Slot0", "IF2 DAC0" }, |
| 3812 | { "IF2 DAC4 Mux", "Slot1", "IF2 DAC1" }, |
| 3813 | { "IF2 DAC4 Mux", "Slot2", "IF2 DAC2" }, |
| 3814 | { "IF2 DAC4 Mux", "Slot3", "IF2 DAC3" }, |
| 3815 | { "IF2 DAC4 Mux", "Slot4", "IF2 DAC4" }, |
| 3816 | { "IF2 DAC4 Mux", "Slot5", "IF2 DAC5" }, |
| 3817 | { "IF2 DAC4 Mux", "Slot6", "IF2 DAC6" }, |
| 3818 | { "IF2 DAC4 Mux", "Slot7", "IF2 DAC7" }, |
| 3819 | |
| 3820 | { "IF2 DAC5 Mux", "Slot0", "IF2 DAC0" }, |
| 3821 | { "IF2 DAC5 Mux", "Slot1", "IF2 DAC1" }, |
| 3822 | { "IF2 DAC5 Mux", "Slot2", "IF2 DAC2" }, |
| 3823 | { "IF2 DAC5 Mux", "Slot3", "IF2 DAC3" }, |
| 3824 | { "IF2 DAC5 Mux", "Slot4", "IF2 DAC4" }, |
| 3825 | { "IF2 DAC5 Mux", "Slot5", "IF2 DAC5" }, |
| 3826 | { "IF2 DAC5 Mux", "Slot6", "IF2 DAC6" }, |
| 3827 | { "IF2 DAC5 Mux", "Slot7", "IF2 DAC7" }, |
| 3828 | |
| 3829 | { "IF2 DAC6 Mux", "Slot0", "IF2 DAC0" }, |
| 3830 | { "IF2 DAC6 Mux", "Slot1", "IF2 DAC1" }, |
| 3831 | { "IF2 DAC6 Mux", "Slot2", "IF2 DAC2" }, |
| 3832 | { "IF2 DAC6 Mux", "Slot3", "IF2 DAC3" }, |
| 3833 | { "IF2 DAC6 Mux", "Slot4", "IF2 DAC4" }, |
| 3834 | { "IF2 DAC6 Mux", "Slot5", "IF2 DAC5" }, |
| 3835 | { "IF2 DAC6 Mux", "Slot6", "IF2 DAC6" }, |
| 3836 | { "IF2 DAC6 Mux", "Slot7", "IF2 DAC7" }, |
| 3837 | |
| 3838 | { "IF2 DAC7 Mux", "Slot0", "IF2 DAC0" }, |
| 3839 | { "IF2 DAC7 Mux", "Slot1", "IF2 DAC1" }, |
| 3840 | { "IF2 DAC7 Mux", "Slot2", "IF2 DAC2" }, |
| 3841 | { "IF2 DAC7 Mux", "Slot3", "IF2 DAC3" }, |
| 3842 | { "IF2 DAC7 Mux", "Slot4", "IF2 DAC4" }, |
| 3843 | { "IF2 DAC7 Mux", "Slot5", "IF2 DAC5" }, |
| 3844 | { "IF2 DAC7 Mux", "Slot6", "IF2 DAC6" }, |
| 3845 | { "IF2 DAC7 Mux", "Slot7", "IF2 DAC7" }, |
| 3846 | |
| 3847 | { "IF2 DAC01", NULL, "IF2 DAC0 Mux" }, |
| 3848 | { "IF2 DAC01", NULL, "IF2 DAC1 Mux" }, |
| 3849 | { "IF2 DAC23", NULL, "IF2 DAC2 Mux" }, |
| 3850 | { "IF2 DAC23", NULL, "IF2 DAC3 Mux" }, |
| 3851 | { "IF2 DAC45", NULL, "IF2 DAC4 Mux" }, |
| 3852 | { "IF2 DAC45", NULL, "IF2 DAC5 Mux" }, |
| 3853 | { "IF2 DAC67", NULL, "IF2 DAC6 Mux" }, |
| 3854 | { "IF2 DAC67", NULL, "IF2 DAC7 Mux" }, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 3855 | |
| 3856 | { "IF3 DAC", NULL, "AIF3RX" }, |
| 3857 | { "IF3 DAC", NULL, "I2S3" }, |
| 3858 | |
| 3859 | { "IF4 DAC", NULL, "AIF4RX" }, |
| 3860 | { "IF4 DAC", NULL, "I2S4" }, |
| 3861 | |
| 3862 | { "IF3 DAC L", NULL, "IF3 DAC" }, |
| 3863 | { "IF3 DAC R", NULL, "IF3 DAC" }, |
| 3864 | |
| 3865 | { "IF4 DAC L", NULL, "IF4 DAC" }, |
| 3866 | { "IF4 DAC R", NULL, "IF4 DAC" }, |
| 3867 | |
| 3868 | { "SLB DAC0", NULL, "SLBRX" }, |
| 3869 | { "SLB DAC1", NULL, "SLBRX" }, |
| 3870 | { "SLB DAC2", NULL, "SLBRX" }, |
| 3871 | { "SLB DAC3", NULL, "SLBRX" }, |
| 3872 | { "SLB DAC4", NULL, "SLBRX" }, |
| 3873 | { "SLB DAC5", NULL, "SLBRX" }, |
| 3874 | { "SLB DAC6", NULL, "SLBRX" }, |
| 3875 | { "SLB DAC7", NULL, "SLBRX" }, |
| 3876 | { "SLB DAC0", NULL, "SLB" }, |
| 3877 | { "SLB DAC1", NULL, "SLB" }, |
| 3878 | { "SLB DAC2", NULL, "SLB" }, |
| 3879 | { "SLB DAC3", NULL, "SLB" }, |
| 3880 | { "SLB DAC4", NULL, "SLB" }, |
| 3881 | { "SLB DAC5", NULL, "SLB" }, |
| 3882 | { "SLB DAC6", NULL, "SLB" }, |
| 3883 | { "SLB DAC7", NULL, "SLB" }, |
| 3884 | |
| 3885 | { "SLB DAC01", NULL, "SLB DAC0" }, |
| 3886 | { "SLB DAC01", NULL, "SLB DAC1" }, |
| 3887 | { "SLB DAC23", NULL, "SLB DAC2" }, |
| 3888 | { "SLB DAC23", NULL, "SLB DAC3" }, |
| 3889 | { "SLB DAC45", NULL, "SLB DAC4" }, |
| 3890 | { "SLB DAC45", NULL, "SLB DAC5" }, |
| 3891 | { "SLB DAC67", NULL, "SLB DAC6" }, |
| 3892 | { "SLB DAC67", NULL, "SLB DAC7" }, |
| 3893 | |
| 3894 | { "ADDA1 Mux", "STO1 ADC MIX", "Stereo1 ADC MIX" }, |
| 3895 | { "ADDA1 Mux", "STO2 ADC MIX", "Stereo2 ADC MIX" }, |
| 3896 | { "ADDA1 Mux", "OB 67", "OB67" }, |
| 3897 | |
| 3898 | { "DAC1 Mux", "IF1 DAC 01", "IF1 DAC01" }, |
| 3899 | { "DAC1 Mux", "IF2 DAC 01", "IF2 DAC01" }, |
| 3900 | { "DAC1 Mux", "IF3 DAC LR", "IF3 DAC" }, |
| 3901 | { "DAC1 Mux", "IF4 DAC LR", "IF4 DAC" }, |
| 3902 | { "DAC1 Mux", "SLB DAC 01", "SLB DAC01" }, |
| 3903 | { "DAC1 Mux", "OB 01", "OB01 Bypass Mux" }, |
| 3904 | |
| 3905 | { "DAC1 MIXL", "Stereo ADC Switch", "ADDA1 Mux" }, |
| 3906 | { "DAC1 MIXL", "DAC1 Switch", "DAC1 Mux" }, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 3907 | { "DAC1 MIXR", "Stereo ADC Switch", "ADDA1 Mux" }, |
| 3908 | { "DAC1 MIXR", "DAC1 Switch", "DAC1 Mux" }, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 3909 | |
| 3910 | { "DAC1 FS", NULL, "DAC1 MIXL" }, |
| 3911 | { "DAC1 FS", NULL, "DAC1 MIXR" }, |
| 3912 | |
Oder Chiou | 7006877 | 2015-02-25 17:36:13 +0800 | [diff] [blame] | 3913 | { "DAC2 L Mux", "IF1 DAC 2", "IF1 DAC2 Mux" }, |
| 3914 | { "DAC2 L Mux", "IF2 DAC 2", "IF2 DAC2 Mux" }, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 3915 | { "DAC2 L Mux", "IF3 DAC L", "IF3 DAC L" }, |
| 3916 | { "DAC2 L Mux", "IF4 DAC L", "IF4 DAC L" }, |
| 3917 | { "DAC2 L Mux", "SLB DAC 2", "SLB DAC2" }, |
| 3918 | { "DAC2 L Mux", "OB 2", "OutBound2" }, |
| 3919 | |
Oder Chiou | 7006877 | 2015-02-25 17:36:13 +0800 | [diff] [blame] | 3920 | { "DAC2 R Mux", "IF1 DAC 3", "IF1 DAC3 Mux" }, |
| 3921 | { "DAC2 R Mux", "IF2 DAC 3", "IF2 DAC3 Mux" }, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 3922 | { "DAC2 R Mux", "IF3 DAC R", "IF3 DAC R" }, |
| 3923 | { "DAC2 R Mux", "IF4 DAC R", "IF4 DAC R" }, |
| 3924 | { "DAC2 R Mux", "SLB DAC 3", "SLB DAC3" }, |
| 3925 | { "DAC2 R Mux", "OB 3", "OutBound3" }, |
| 3926 | { "DAC2 R Mux", "Haptic Generator", "Haptic Generator" }, |
| 3927 | { "DAC2 R Mux", "VAD ADC", "VAD ADC Mux" }, |
| 3928 | |
Oder Chiou | 7006877 | 2015-02-25 17:36:13 +0800 | [diff] [blame] | 3929 | { "DAC3 L Mux", "IF1 DAC 4", "IF1 DAC4 Mux" }, |
| 3930 | { "DAC3 L Mux", "IF2 DAC 4", "IF2 DAC4 Mux" }, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 3931 | { "DAC3 L Mux", "IF3 DAC L", "IF3 DAC L" }, |
| 3932 | { "DAC3 L Mux", "IF4 DAC L", "IF4 DAC L" }, |
| 3933 | { "DAC3 L Mux", "SLB DAC 4", "SLB DAC4" }, |
| 3934 | { "DAC3 L Mux", "OB 4", "OutBound4" }, |
| 3935 | |
Oder Chiou | 7006877 | 2015-02-25 17:36:13 +0800 | [diff] [blame] | 3936 | { "DAC3 R Mux", "IF1 DAC 5", "IF1 DAC5 Mux" }, |
| 3937 | { "DAC3 R Mux", "IF2 DAC 5", "IF2 DAC5 Mux" }, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 3938 | { "DAC3 R Mux", "IF3 DAC R", "IF3 DAC R" }, |
| 3939 | { "DAC3 R Mux", "IF4 DAC R", "IF4 DAC R" }, |
| 3940 | { "DAC3 R Mux", "SLB DAC 5", "SLB DAC5" }, |
| 3941 | { "DAC3 R Mux", "OB 5", "OutBound5" }, |
| 3942 | |
Oder Chiou | 7006877 | 2015-02-25 17:36:13 +0800 | [diff] [blame] | 3943 | { "DAC4 L Mux", "IF1 DAC 6", "IF1 DAC6 Mux" }, |
| 3944 | { "DAC4 L Mux", "IF2 DAC 6", "IF2 DAC6 Mux" }, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 3945 | { "DAC4 L Mux", "IF3 DAC L", "IF3 DAC L" }, |
| 3946 | { "DAC4 L Mux", "IF4 DAC L", "IF4 DAC L" }, |
| 3947 | { "DAC4 L Mux", "SLB DAC 6", "SLB DAC6" }, |
| 3948 | { "DAC4 L Mux", "OB 6", "OutBound6" }, |
| 3949 | |
Oder Chiou | 7006877 | 2015-02-25 17:36:13 +0800 | [diff] [blame] | 3950 | { "DAC4 R Mux", "IF1 DAC 7", "IF1 DAC7 Mux" }, |
| 3951 | { "DAC4 R Mux", "IF2 DAC 7", "IF2 DAC7 Mux" }, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 3952 | { "DAC4 R Mux", "IF3 DAC R", "IF3 DAC R" }, |
| 3953 | { "DAC4 R Mux", "IF4 DAC R", "IF4 DAC R" }, |
| 3954 | { "DAC4 R Mux", "SLB DAC 7", "SLB DAC7" }, |
| 3955 | { "DAC4 R Mux", "OB 7", "OutBound7" }, |
| 3956 | |
| 3957 | { "Sidetone Mux", "DMIC1 L", "DMIC L1" }, |
| 3958 | { "Sidetone Mux", "DMIC2 L", "DMIC L2" }, |
| 3959 | { "Sidetone Mux", "DMIC3 L", "DMIC L3" }, |
| 3960 | { "Sidetone Mux", "DMIC4 L", "DMIC L4" }, |
| 3961 | { "Sidetone Mux", "ADC1", "ADC 1" }, |
| 3962 | { "Sidetone Mux", "ADC2", "ADC 2" }, |
Oder Chiou | 90bdbb4 | 2014-09-18 14:45:59 +0800 | [diff] [blame] | 3963 | { "Sidetone Mux", NULL, "Sidetone Power" }, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 3964 | |
| 3965 | { "Stereo DAC MIXL", "ST L Switch", "Sidetone Mux" }, |
| 3966 | { "Stereo DAC MIXL", "DAC1 L Switch", "DAC1 MIXL" }, |
| 3967 | { "Stereo DAC MIXL", "DAC2 L Switch", "DAC2 L Mux" }, |
| 3968 | { "Stereo DAC MIXL", "DAC1 R Switch", "DAC1 MIXR" }, |
| 3969 | { "Stereo DAC MIXL", NULL, "dac stereo1 filter" }, |
| 3970 | { "Stereo DAC MIXR", "ST R Switch", "Sidetone Mux" }, |
| 3971 | { "Stereo DAC MIXR", "DAC1 R Switch", "DAC1 MIXR" }, |
| 3972 | { "Stereo DAC MIXR", "DAC2 R Switch", "DAC2 R Mux" }, |
| 3973 | { "Stereo DAC MIXR", "DAC1 L Switch", "DAC1 MIXL" }, |
| 3974 | { "Stereo DAC MIXR", NULL, "dac stereo1 filter" }, |
Oder Chiou | 38d595e | 2014-12-23 10:27:56 +0800 | [diff] [blame] | 3975 | { "dac stereo1 filter", NULL, "PLL1", is_sys_clk_from_pll }, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 3976 | |
| 3977 | { "Mono DAC MIXL", "ST L Switch", "Sidetone Mux" }, |
| 3978 | { "Mono DAC MIXL", "DAC1 L Switch", "DAC1 MIXL" }, |
| 3979 | { "Mono DAC MIXL", "DAC2 L Switch", "DAC2 L Mux" }, |
| 3980 | { "Mono DAC MIXL", "DAC2 R Switch", "DAC2 R Mux" }, |
Oder Chiou | 6800b5b | 2014-12-23 10:27:54 +0800 | [diff] [blame] | 3981 | { "Mono DAC MIXL", NULL, "dac mono2 left filter" }, |
Oder Chiou | 38d595e | 2014-12-23 10:27:56 +0800 | [diff] [blame] | 3982 | { "dac mono2 left filter", NULL, "PLL1", is_sys_clk_from_pll }, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 3983 | { "Mono DAC MIXR", "ST R Switch", "Sidetone Mux" }, |
| 3984 | { "Mono DAC MIXR", "DAC1 R Switch", "DAC1 MIXR" }, |
| 3985 | { "Mono DAC MIXR", "DAC2 R Switch", "DAC2 R Mux" }, |
| 3986 | { "Mono DAC MIXR", "DAC2 L Switch", "DAC2 L Mux" }, |
Oder Chiou | 6800b5b | 2014-12-23 10:27:54 +0800 | [diff] [blame] | 3987 | { "Mono DAC MIXR", NULL, "dac mono2 right filter" }, |
Oder Chiou | 38d595e | 2014-12-23 10:27:56 +0800 | [diff] [blame] | 3988 | { "dac mono2 right filter", NULL, "PLL1", is_sys_clk_from_pll }, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 3989 | |
| 3990 | { "DD1 MIXL", "Sto DAC Mix L Switch", "Stereo DAC MIXL" }, |
| 3991 | { "DD1 MIXL", "Mono DAC Mix L Switch", "Mono DAC MIXL" }, |
| 3992 | { "DD1 MIXL", "DAC3 L Switch", "DAC3 L Mux" }, |
| 3993 | { "DD1 MIXL", "DAC3 R Switch", "DAC3 R Mux" }, |
Oder Chiou | 6800b5b | 2014-12-23 10:27:54 +0800 | [diff] [blame] | 3994 | { "DD1 MIXL", NULL, "dac mono3 left filter" }, |
Oder Chiou | 38d595e | 2014-12-23 10:27:56 +0800 | [diff] [blame] | 3995 | { "dac mono3 left filter", NULL, "PLL1", is_sys_clk_from_pll }, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 3996 | { "DD1 MIXR", "Sto DAC Mix R Switch", "Stereo DAC MIXR" }, |
| 3997 | { "DD1 MIXR", "Mono DAC Mix R Switch", "Mono DAC MIXR" }, |
| 3998 | { "DD1 MIXR", "DAC3 L Switch", "DAC3 L Mux" }, |
| 3999 | { "DD1 MIXR", "DAC3 R Switch", "DAC3 R Mux" }, |
Oder Chiou | 6800b5b | 2014-12-23 10:27:54 +0800 | [diff] [blame] | 4000 | { "DD1 MIXR", NULL, "dac mono3 right filter" }, |
Oder Chiou | 38d595e | 2014-12-23 10:27:56 +0800 | [diff] [blame] | 4001 | { "dac mono3 right filter", NULL, "PLL1", is_sys_clk_from_pll }, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 4002 | |
| 4003 | { "DD2 MIXL", "Sto DAC Mix L Switch", "Stereo DAC MIXL" }, |
| 4004 | { "DD2 MIXL", "Mono DAC Mix L Switch", "Mono DAC MIXL" }, |
| 4005 | { "DD2 MIXL", "DAC4 L Switch", "DAC4 L Mux" }, |
| 4006 | { "DD2 MIXL", "DAC4 R Switch", "DAC4 R Mux" }, |
Oder Chiou | 6800b5b | 2014-12-23 10:27:54 +0800 | [diff] [blame] | 4007 | { "DD2 MIXL", NULL, "dac mono4 left filter" }, |
Oder Chiou | 38d595e | 2014-12-23 10:27:56 +0800 | [diff] [blame] | 4008 | { "dac mono4 left filter", NULL, "PLL1", is_sys_clk_from_pll }, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 4009 | { "DD2 MIXR", "Sto DAC Mix R Switch", "Stereo DAC MIXR" }, |
| 4010 | { "DD2 MIXR", "Mono DAC Mix R Switch", "Mono DAC MIXR" }, |
| 4011 | { "DD2 MIXR", "DAC4 L Switch", "DAC4 L Mux" }, |
| 4012 | { "DD2 MIXR", "DAC4 R Switch", "DAC4 R Mux" }, |
Oder Chiou | 6800b5b | 2014-12-23 10:27:54 +0800 | [diff] [blame] | 4013 | { "DD2 MIXR", NULL, "dac mono4 right filter" }, |
Oder Chiou | 38d595e | 2014-12-23 10:27:56 +0800 | [diff] [blame] | 4014 | { "dac mono4 right filter", NULL, "PLL1", is_sys_clk_from_pll }, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 4015 | |
| 4016 | { "Stereo DAC MIX", NULL, "Stereo DAC MIXL" }, |
| 4017 | { "Stereo DAC MIX", NULL, "Stereo DAC MIXR" }, |
| 4018 | { "Mono DAC MIX", NULL, "Mono DAC MIXL" }, |
| 4019 | { "Mono DAC MIX", NULL, "Mono DAC MIXR" }, |
| 4020 | { "DD1 MIX", NULL, "DD1 MIXL" }, |
| 4021 | { "DD1 MIX", NULL, "DD1 MIXR" }, |
| 4022 | { "DD2 MIX", NULL, "DD2 MIXL" }, |
| 4023 | { "DD2 MIX", NULL, "DD2 MIXR" }, |
| 4024 | |
| 4025 | { "DAC12 SRC Mux", "STO1 DAC MIX", "Stereo DAC MIX" }, |
| 4026 | { "DAC12 SRC Mux", "MONO DAC MIX", "Mono DAC MIX" }, |
| 4027 | { "DAC12 SRC Mux", "DD MIX1", "DD1 MIX" }, |
| 4028 | { "DAC12 SRC Mux", "DD MIX2", "DD2 MIX" }, |
| 4029 | |
| 4030 | { "DAC3 SRC Mux", "MONO DAC MIXL", "Mono DAC MIXL" }, |
| 4031 | { "DAC3 SRC Mux", "MONO DAC MIXR", "Mono DAC MIXR" }, |
| 4032 | { "DAC3 SRC Mux", "DD MIX1L", "DD1 MIXL" }, |
| 4033 | { "DAC3 SRC Mux", "DD MIX2L", "DD2 MIXL" }, |
| 4034 | |
| 4035 | { "DAC 1", NULL, "DAC12 SRC Mux" }, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 4036 | { "DAC 2", NULL, "DAC12 SRC Mux" }, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 4037 | { "DAC 3", NULL, "DAC3 SRC Mux" }, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 4038 | |
| 4039 | { "PDM1 L Mux", "STO1 DAC MIX", "Stereo DAC MIXL" }, |
| 4040 | { "PDM1 L Mux", "MONO DAC MIX", "Mono DAC MIXL" }, |
| 4041 | { "PDM1 L Mux", "DD MIX1", "DD1 MIXL" }, |
| 4042 | { "PDM1 L Mux", "DD MIX2", "DD2 MIXL" }, |
| 4043 | { "PDM1 L Mux", NULL, "PDM1 Power" }, |
| 4044 | { "PDM1 R Mux", "STO1 DAC MIX", "Stereo DAC MIXR" }, |
| 4045 | { "PDM1 R Mux", "MONO DAC MIX", "Mono DAC MIXR" }, |
| 4046 | { "PDM1 R Mux", "DD MIX1", "DD1 MIXR" }, |
| 4047 | { "PDM1 R Mux", "DD MIX2", "DD2 MIXR" }, |
| 4048 | { "PDM1 R Mux", NULL, "PDM1 Power" }, |
| 4049 | { "PDM2 L Mux", "STO1 DAC MIX", "Stereo DAC MIXL" }, |
| 4050 | { "PDM2 L Mux", "MONO DAC MIX", "Mono DAC MIXL" }, |
| 4051 | { "PDM2 L Mux", "DD MIX1", "DD1 MIXL" }, |
| 4052 | { "PDM2 L Mux", "DD MIX2", "DD2 MIXL" }, |
| 4053 | { "PDM2 L Mux", NULL, "PDM2 Power" }, |
| 4054 | { "PDM2 R Mux", "STO1 DAC MIX", "Stereo DAC MIXR" }, |
| 4055 | { "PDM2 R Mux", "MONO DAC MIX", "Mono DAC MIXR" }, |
| 4056 | { "PDM2 R Mux", "DD MIX1", "DD1 MIXR" }, |
| 4057 | { "PDM2 R Mux", "DD MIX1", "DD2 MIXR" }, |
| 4058 | { "PDM2 R Mux", NULL, "PDM2 Power" }, |
| 4059 | |
| 4060 | { "LOUT1 amp", NULL, "DAC 1" }, |
| 4061 | { "LOUT2 amp", NULL, "DAC 2" }, |
| 4062 | { "LOUT3 amp", NULL, "DAC 3" }, |
| 4063 | |
Oder Chiou | 683996c | 2014-11-19 13:52:20 +0800 | [diff] [blame] | 4064 | { "LOUT1 vref", NULL, "LOUT1 amp" }, |
| 4065 | { "LOUT2 vref", NULL, "LOUT2 amp" }, |
| 4066 | { "LOUT3 vref", NULL, "LOUT3 amp" }, |
| 4067 | |
| 4068 | { "LOUT1", NULL, "LOUT1 vref" }, |
| 4069 | { "LOUT2", NULL, "LOUT2 vref" }, |
| 4070 | { "LOUT3", NULL, "LOUT3 vref" }, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 4071 | |
| 4072 | { "PDM1L", NULL, "PDM1 L Mux" }, |
| 4073 | { "PDM1R", NULL, "PDM1 R Mux" }, |
| 4074 | { "PDM2L", NULL, "PDM2 L Mux" }, |
| 4075 | { "PDM2R", NULL, "PDM2 R Mux" }, |
| 4076 | }; |
| 4077 | |
Bard Liao | 2d15d97 | 2014-08-27 19:50:34 +0800 | [diff] [blame] | 4078 | static const struct snd_soc_dapm_route rt5677_dmic2_clk_1[] = { |
| 4079 | { "DMIC L2", NULL, "DMIC1 power" }, |
| 4080 | { "DMIC R2", NULL, "DMIC1 power" }, |
| 4081 | }; |
| 4082 | |
| 4083 | static const struct snd_soc_dapm_route rt5677_dmic2_clk_2[] = { |
| 4084 | { "DMIC L2", NULL, "DMIC2 power" }, |
| 4085 | { "DMIC R2", NULL, "DMIC2 power" }, |
| 4086 | }; |
| 4087 | |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 4088 | static int rt5677_hw_params(struct snd_pcm_substream *substream, |
| 4089 | struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) |
| 4090 | { |
| 4091 | struct snd_soc_codec *codec = dai->codec; |
| 4092 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); |
| 4093 | unsigned int val_len = 0, val_clk, mask_clk; |
| 4094 | int pre_div, bclk_ms, frame_size; |
| 4095 | |
| 4096 | rt5677->lrck[dai->id] = params_rate(params); |
Axel Lin | 30f14b4 | 2014-06-10 08:57:36 +0800 | [diff] [blame] | 4097 | pre_div = rl6231_get_clk_info(rt5677->sysclk, rt5677->lrck[dai->id]); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 4098 | if (pre_div < 0) { |
Anatol Pomozov | 8a4bd60 | 2014-10-15 13:55:32 -0700 | [diff] [blame] | 4099 | dev_err(codec->dev, "Unsupported clock setting: sysclk=%dHz lrck=%dHz\n", |
| 4100 | rt5677->sysclk, rt5677->lrck[dai->id]); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 4101 | return -EINVAL; |
| 4102 | } |
| 4103 | frame_size = snd_soc_params_to_frame_size(params); |
| 4104 | if (frame_size < 0) { |
| 4105 | dev_err(codec->dev, "Unsupported frame size: %d\n", frame_size); |
| 4106 | return -EINVAL; |
| 4107 | } |
| 4108 | bclk_ms = frame_size > 32; |
| 4109 | rt5677->bclk[dai->id] = rt5677->lrck[dai->id] * (32 << bclk_ms); |
| 4110 | |
| 4111 | dev_dbg(dai->dev, "bclk is %dHz and lrck is %dHz\n", |
| 4112 | rt5677->bclk[dai->id], rt5677->lrck[dai->id]); |
| 4113 | dev_dbg(dai->dev, "bclk_ms is %d and pre_div is %d for iis %d\n", |
| 4114 | bclk_ms, pre_div, dai->id); |
| 4115 | |
| 4116 | switch (params_width(params)) { |
| 4117 | case 16: |
| 4118 | break; |
| 4119 | case 20: |
| 4120 | val_len |= RT5677_I2S_DL_20; |
| 4121 | break; |
| 4122 | case 24: |
| 4123 | val_len |= RT5677_I2S_DL_24; |
| 4124 | break; |
| 4125 | case 8: |
| 4126 | val_len |= RT5677_I2S_DL_8; |
| 4127 | break; |
| 4128 | default: |
| 4129 | return -EINVAL; |
| 4130 | } |
| 4131 | |
| 4132 | switch (dai->id) { |
| 4133 | case RT5677_AIF1: |
| 4134 | mask_clk = RT5677_I2S_PD1_MASK; |
| 4135 | val_clk = pre_div << RT5677_I2S_PD1_SFT; |
| 4136 | regmap_update_bits(rt5677->regmap, RT5677_I2S1_SDP, |
| 4137 | RT5677_I2S_DL_MASK, val_len); |
| 4138 | regmap_update_bits(rt5677->regmap, RT5677_CLK_TREE_CTRL1, |
| 4139 | mask_clk, val_clk); |
| 4140 | break; |
| 4141 | case RT5677_AIF2: |
| 4142 | mask_clk = RT5677_I2S_PD2_MASK; |
| 4143 | val_clk = pre_div << RT5677_I2S_PD2_SFT; |
| 4144 | regmap_update_bits(rt5677->regmap, RT5677_I2S2_SDP, |
| 4145 | RT5677_I2S_DL_MASK, val_len); |
| 4146 | regmap_update_bits(rt5677->regmap, RT5677_CLK_TREE_CTRL1, |
| 4147 | mask_clk, val_clk); |
| 4148 | break; |
| 4149 | case RT5677_AIF3: |
| 4150 | mask_clk = RT5677_I2S_BCLK_MS3_MASK | RT5677_I2S_PD3_MASK; |
| 4151 | val_clk = bclk_ms << RT5677_I2S_BCLK_MS3_SFT | |
| 4152 | pre_div << RT5677_I2S_PD3_SFT; |
| 4153 | regmap_update_bits(rt5677->regmap, RT5677_I2S3_SDP, |
| 4154 | RT5677_I2S_DL_MASK, val_len); |
| 4155 | regmap_update_bits(rt5677->regmap, RT5677_CLK_TREE_CTRL1, |
| 4156 | mask_clk, val_clk); |
| 4157 | break; |
| 4158 | case RT5677_AIF4: |
| 4159 | mask_clk = RT5677_I2S_BCLK_MS4_MASK | RT5677_I2S_PD4_MASK; |
| 4160 | val_clk = bclk_ms << RT5677_I2S_BCLK_MS4_SFT | |
| 4161 | pre_div << RT5677_I2S_PD4_SFT; |
| 4162 | regmap_update_bits(rt5677->regmap, RT5677_I2S4_SDP, |
| 4163 | RT5677_I2S_DL_MASK, val_len); |
| 4164 | regmap_update_bits(rt5677->regmap, RT5677_CLK_TREE_CTRL1, |
| 4165 | mask_clk, val_clk); |
| 4166 | break; |
| 4167 | default: |
| 4168 | break; |
| 4169 | } |
| 4170 | |
| 4171 | return 0; |
| 4172 | } |
| 4173 | |
| 4174 | static int rt5677_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt) |
| 4175 | { |
| 4176 | struct snd_soc_codec *codec = dai->codec; |
| 4177 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); |
| 4178 | unsigned int reg_val = 0; |
| 4179 | |
| 4180 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { |
| 4181 | case SND_SOC_DAIFMT_CBM_CFM: |
| 4182 | rt5677->master[dai->id] = 1; |
| 4183 | break; |
| 4184 | case SND_SOC_DAIFMT_CBS_CFS: |
| 4185 | reg_val |= RT5677_I2S_MS_S; |
| 4186 | rt5677->master[dai->id] = 0; |
| 4187 | break; |
| 4188 | default: |
| 4189 | return -EINVAL; |
| 4190 | } |
| 4191 | |
| 4192 | switch (fmt & SND_SOC_DAIFMT_INV_MASK) { |
| 4193 | case SND_SOC_DAIFMT_NB_NF: |
| 4194 | break; |
| 4195 | case SND_SOC_DAIFMT_IB_NF: |
| 4196 | reg_val |= RT5677_I2S_BP_INV; |
| 4197 | break; |
| 4198 | default: |
| 4199 | return -EINVAL; |
| 4200 | } |
| 4201 | |
| 4202 | switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { |
| 4203 | case SND_SOC_DAIFMT_I2S: |
| 4204 | break; |
| 4205 | case SND_SOC_DAIFMT_LEFT_J: |
| 4206 | reg_val |= RT5677_I2S_DF_LEFT; |
| 4207 | break; |
| 4208 | case SND_SOC_DAIFMT_DSP_A: |
| 4209 | reg_val |= RT5677_I2S_DF_PCM_A; |
| 4210 | break; |
| 4211 | case SND_SOC_DAIFMT_DSP_B: |
| 4212 | reg_val |= RT5677_I2S_DF_PCM_B; |
| 4213 | break; |
| 4214 | default: |
| 4215 | return -EINVAL; |
| 4216 | } |
| 4217 | |
| 4218 | switch (dai->id) { |
| 4219 | case RT5677_AIF1: |
| 4220 | regmap_update_bits(rt5677->regmap, RT5677_I2S1_SDP, |
| 4221 | RT5677_I2S_MS_MASK | RT5677_I2S_BP_MASK | |
| 4222 | RT5677_I2S_DF_MASK, reg_val); |
| 4223 | break; |
| 4224 | case RT5677_AIF2: |
| 4225 | regmap_update_bits(rt5677->regmap, RT5677_I2S2_SDP, |
| 4226 | RT5677_I2S_MS_MASK | RT5677_I2S_BP_MASK | |
| 4227 | RT5677_I2S_DF_MASK, reg_val); |
| 4228 | break; |
| 4229 | case RT5677_AIF3: |
| 4230 | regmap_update_bits(rt5677->regmap, RT5677_I2S3_SDP, |
| 4231 | RT5677_I2S_MS_MASK | RT5677_I2S_BP_MASK | |
| 4232 | RT5677_I2S_DF_MASK, reg_val); |
| 4233 | break; |
| 4234 | case RT5677_AIF4: |
| 4235 | regmap_update_bits(rt5677->regmap, RT5677_I2S4_SDP, |
| 4236 | RT5677_I2S_MS_MASK | RT5677_I2S_BP_MASK | |
| 4237 | RT5677_I2S_DF_MASK, reg_val); |
| 4238 | break; |
| 4239 | default: |
| 4240 | break; |
| 4241 | } |
| 4242 | |
| 4243 | |
| 4244 | return 0; |
| 4245 | } |
| 4246 | |
| 4247 | static int rt5677_set_dai_sysclk(struct snd_soc_dai *dai, |
| 4248 | int clk_id, unsigned int freq, int dir) |
| 4249 | { |
| 4250 | struct snd_soc_codec *codec = dai->codec; |
| 4251 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); |
| 4252 | unsigned int reg_val = 0; |
| 4253 | |
| 4254 | if (freq == rt5677->sysclk && clk_id == rt5677->sysclk_src) |
| 4255 | return 0; |
| 4256 | |
| 4257 | switch (clk_id) { |
| 4258 | case RT5677_SCLK_S_MCLK: |
| 4259 | reg_val |= RT5677_SCLK_SRC_MCLK; |
| 4260 | break; |
| 4261 | case RT5677_SCLK_S_PLL1: |
| 4262 | reg_val |= RT5677_SCLK_SRC_PLL1; |
| 4263 | break; |
| 4264 | case RT5677_SCLK_S_RCCLK: |
| 4265 | reg_val |= RT5677_SCLK_SRC_RCCLK; |
| 4266 | break; |
| 4267 | default: |
| 4268 | dev_err(codec->dev, "Invalid clock id (%d)\n", clk_id); |
| 4269 | return -EINVAL; |
| 4270 | } |
| 4271 | regmap_update_bits(rt5677->regmap, RT5677_GLB_CLK1, |
| 4272 | RT5677_SCLK_SRC_MASK, reg_val); |
| 4273 | rt5677->sysclk = freq; |
| 4274 | rt5677->sysclk_src = clk_id; |
| 4275 | |
| 4276 | dev_dbg(dai->dev, "Sysclk is %dHz and clock id is %d\n", freq, clk_id); |
| 4277 | |
| 4278 | return 0; |
| 4279 | } |
| 4280 | |
| 4281 | /** |
| 4282 | * rt5677_pll_calc - Calcualte PLL M/N/K code. |
| 4283 | * @freq_in: external clock provided to codec. |
| 4284 | * @freq_out: target clock which codec works on. |
| 4285 | * @pll_code: Pointer to structure with M, N, K, bypass K and bypass M flag. |
| 4286 | * |
| 4287 | * Calcualte M/N/K code and bypass K/M flag to configure PLL for codec. |
| 4288 | * |
| 4289 | * Returns 0 for success or negative error code. |
| 4290 | */ |
| 4291 | static int rt5677_pll_calc(const unsigned int freq_in, |
Axel Lin | 099d334 | 2014-06-17 12:41:31 +0800 | [diff] [blame] | 4292 | const unsigned int freq_out, struct rl6231_pll_code *pll_code) |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 4293 | { |
Axel Lin | 099d334 | 2014-06-17 12:41:31 +0800 | [diff] [blame] | 4294 | if (RT5677_PLL_INP_MIN > freq_in) |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 4295 | return -EINVAL; |
| 4296 | |
Axel Lin | 099d334 | 2014-06-17 12:41:31 +0800 | [diff] [blame] | 4297 | return rl6231_pll_calc(freq_in, freq_out, pll_code); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 4298 | } |
| 4299 | |
| 4300 | static int rt5677_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source, |
| 4301 | unsigned int freq_in, unsigned int freq_out) |
| 4302 | { |
| 4303 | struct snd_soc_codec *codec = dai->codec; |
| 4304 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); |
Axel Lin | 099d334 | 2014-06-17 12:41:31 +0800 | [diff] [blame] | 4305 | struct rl6231_pll_code pll_code; |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 4306 | int ret; |
| 4307 | |
| 4308 | if (source == rt5677->pll_src && freq_in == rt5677->pll_in && |
| 4309 | freq_out == rt5677->pll_out) |
| 4310 | return 0; |
| 4311 | |
| 4312 | if (!freq_in || !freq_out) { |
| 4313 | dev_dbg(codec->dev, "PLL disabled\n"); |
| 4314 | |
| 4315 | rt5677->pll_in = 0; |
| 4316 | rt5677->pll_out = 0; |
| 4317 | regmap_update_bits(rt5677->regmap, RT5677_GLB_CLK1, |
| 4318 | RT5677_SCLK_SRC_MASK, RT5677_SCLK_SRC_MCLK); |
| 4319 | return 0; |
| 4320 | } |
| 4321 | |
| 4322 | switch (source) { |
| 4323 | case RT5677_PLL1_S_MCLK: |
| 4324 | regmap_update_bits(rt5677->regmap, RT5677_GLB_CLK1, |
| 4325 | RT5677_PLL1_SRC_MASK, RT5677_PLL1_SRC_MCLK); |
| 4326 | break; |
| 4327 | case RT5677_PLL1_S_BCLK1: |
| 4328 | case RT5677_PLL1_S_BCLK2: |
| 4329 | case RT5677_PLL1_S_BCLK3: |
| 4330 | case RT5677_PLL1_S_BCLK4: |
| 4331 | switch (dai->id) { |
| 4332 | case RT5677_AIF1: |
| 4333 | regmap_update_bits(rt5677->regmap, RT5677_GLB_CLK1, |
| 4334 | RT5677_PLL1_SRC_MASK, RT5677_PLL1_SRC_BCLK1); |
| 4335 | break; |
| 4336 | case RT5677_AIF2: |
| 4337 | regmap_update_bits(rt5677->regmap, RT5677_GLB_CLK1, |
| 4338 | RT5677_PLL1_SRC_MASK, RT5677_PLL1_SRC_BCLK2); |
| 4339 | break; |
| 4340 | case RT5677_AIF3: |
| 4341 | regmap_update_bits(rt5677->regmap, RT5677_GLB_CLK1, |
| 4342 | RT5677_PLL1_SRC_MASK, RT5677_PLL1_SRC_BCLK3); |
| 4343 | break; |
| 4344 | case RT5677_AIF4: |
| 4345 | regmap_update_bits(rt5677->regmap, RT5677_GLB_CLK1, |
| 4346 | RT5677_PLL1_SRC_MASK, RT5677_PLL1_SRC_BCLK4); |
| 4347 | break; |
| 4348 | default: |
| 4349 | break; |
| 4350 | } |
| 4351 | break; |
| 4352 | default: |
| 4353 | dev_err(codec->dev, "Unknown PLL source %d\n", source); |
| 4354 | return -EINVAL; |
| 4355 | } |
| 4356 | |
| 4357 | ret = rt5677_pll_calc(freq_in, freq_out, &pll_code); |
| 4358 | if (ret < 0) { |
| 4359 | dev_err(codec->dev, "Unsupport input clock %d\n", freq_in); |
| 4360 | return ret; |
| 4361 | } |
| 4362 | |
Axel Lin | 099d334 | 2014-06-17 12:41:31 +0800 | [diff] [blame] | 4363 | dev_dbg(codec->dev, "m_bypass=%d m=%d n=%d k=%d\n", |
| 4364 | pll_code.m_bp, (pll_code.m_bp ? 0 : pll_code.m_code), |
| 4365 | pll_code.n_code, pll_code.k_code); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 4366 | |
| 4367 | regmap_write(rt5677->regmap, RT5677_PLL1_CTRL1, |
Axel Lin | 099d334 | 2014-06-17 12:41:31 +0800 | [diff] [blame] | 4368 | pll_code.n_code << RT5677_PLL_N_SFT | pll_code.k_code); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 4369 | regmap_write(rt5677->regmap, RT5677_PLL1_CTRL2, |
| 4370 | (pll_code.m_bp ? 0 : pll_code.m_code) << RT5677_PLL_M_SFT | |
| 4371 | pll_code.m_bp << RT5677_PLL_M_BP_SFT); |
| 4372 | |
| 4373 | rt5677->pll_in = freq_in; |
| 4374 | rt5677->pll_out = freq_out; |
| 4375 | rt5677->pll_src = source; |
| 4376 | |
| 4377 | return 0; |
| 4378 | } |
| 4379 | |
Oder Chiou | 48561af | 2014-09-17 15:12:33 +0800 | [diff] [blame] | 4380 | static int rt5677_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, |
| 4381 | unsigned int rx_mask, int slots, int slot_width) |
| 4382 | { |
| 4383 | struct snd_soc_codec *codec = dai->codec; |
Oder Chiou | e4b7e6a | 2015-01-13 11:13:14 +0800 | [diff] [blame] | 4384 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); |
Oder Chiou | 9913b9f | 2015-01-13 11:13:15 +0800 | [diff] [blame] | 4385 | unsigned int val = 0, slot_width_25 = 0; |
Oder Chiou | 48561af | 2014-09-17 15:12:33 +0800 | [diff] [blame] | 4386 | |
| 4387 | if (rx_mask || tx_mask) |
| 4388 | val |= (1 << 12); |
| 4389 | |
| 4390 | switch (slots) { |
| 4391 | case 4: |
| 4392 | val |= (1 << 10); |
| 4393 | break; |
| 4394 | case 6: |
| 4395 | val |= (2 << 10); |
| 4396 | break; |
| 4397 | case 8: |
| 4398 | val |= (3 << 10); |
| 4399 | break; |
| 4400 | case 2: |
| 4401 | default: |
| 4402 | break; |
| 4403 | } |
| 4404 | |
| 4405 | switch (slot_width) { |
| 4406 | case 20: |
| 4407 | val |= (1 << 8); |
| 4408 | break; |
Oder Chiou | 9913b9f | 2015-01-13 11:13:15 +0800 | [diff] [blame] | 4409 | case 25: |
| 4410 | slot_width_25 = 0x8080; |
Oder Chiou | 48561af | 2014-09-17 15:12:33 +0800 | [diff] [blame] | 4411 | case 24: |
| 4412 | val |= (2 << 8); |
| 4413 | break; |
| 4414 | case 32: |
| 4415 | val |= (3 << 8); |
| 4416 | break; |
| 4417 | case 16: |
| 4418 | default: |
| 4419 | break; |
| 4420 | } |
| 4421 | |
| 4422 | switch (dai->id) { |
| 4423 | case RT5677_AIF1: |
Oder Chiou | e4b7e6a | 2015-01-13 11:13:14 +0800 | [diff] [blame] | 4424 | regmap_update_bits(rt5677->regmap, RT5677_TDM1_CTRL1, 0x1f00, |
| 4425 | val); |
Oder Chiou | 9913b9f | 2015-01-13 11:13:15 +0800 | [diff] [blame] | 4426 | regmap_update_bits(rt5677->regmap, RT5677_DIG_MISC, 0x8000, |
| 4427 | slot_width_25); |
Oder Chiou | 48561af | 2014-09-17 15:12:33 +0800 | [diff] [blame] | 4428 | break; |
| 4429 | case RT5677_AIF2: |
Oder Chiou | e4b7e6a | 2015-01-13 11:13:14 +0800 | [diff] [blame] | 4430 | regmap_update_bits(rt5677->regmap, RT5677_TDM2_CTRL1, 0x1f00, |
| 4431 | val); |
Oder Chiou | 9913b9f | 2015-01-13 11:13:15 +0800 | [diff] [blame] | 4432 | regmap_update_bits(rt5677->regmap, RT5677_DIG_MISC, 0x80, |
| 4433 | slot_width_25); |
Oder Chiou | 48561af | 2014-09-17 15:12:33 +0800 | [diff] [blame] | 4434 | break; |
| 4435 | default: |
| 4436 | break; |
| 4437 | } |
| 4438 | |
| 4439 | return 0; |
| 4440 | } |
| 4441 | |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 4442 | static int rt5677_set_bias_level(struct snd_soc_codec *codec, |
| 4443 | enum snd_soc_bias_level level) |
| 4444 | { |
| 4445 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); |
| 4446 | |
| 4447 | switch (level) { |
| 4448 | case SND_SOC_BIAS_ON: |
| 4449 | break; |
| 4450 | |
| 4451 | case SND_SOC_BIAS_PREPARE: |
| 4452 | if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY) { |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 4453 | rt5677_set_dsp_vad(codec, false); |
| 4454 | |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 4455 | regmap_update_bits(rt5677->regmap, RT5677_PWR_ANLG1, |
| 4456 | RT5677_LDO1_SEL_MASK | RT5677_LDO2_SEL_MASK, |
| 4457 | 0x0055); |
| 4458 | regmap_update_bits(rt5677->regmap, |
| 4459 | RT5677_PR_BASE + RT5677_BIAS_CUR4, |
| 4460 | 0x0f00, 0x0f00); |
| 4461 | regmap_update_bits(rt5677->regmap, RT5677_PWR_ANLG1, |
Oder Chiou | 683996c | 2014-11-19 13:52:20 +0800 | [diff] [blame] | 4462 | RT5677_PWR_FV1 | RT5677_PWR_FV2 | |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 4463 | RT5677_PWR_VREF1 | RT5677_PWR_MB | |
| 4464 | RT5677_PWR_BG | RT5677_PWR_VREF2, |
| 4465 | RT5677_PWR_VREF1 | RT5677_PWR_MB | |
| 4466 | RT5677_PWR_BG | RT5677_PWR_VREF2); |
Oder Chiou | 683996c | 2014-11-19 13:52:20 +0800 | [diff] [blame] | 4467 | rt5677->is_vref_slow = false; |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 4468 | regmap_update_bits(rt5677->regmap, RT5677_PWR_ANLG2, |
| 4469 | RT5677_PWR_CORE, RT5677_PWR_CORE); |
| 4470 | regmap_update_bits(rt5677->regmap, RT5677_DIG_MISC, |
| 4471 | 0x1, 0x1); |
| 4472 | } |
| 4473 | break; |
| 4474 | |
| 4475 | case SND_SOC_BIAS_STANDBY: |
| 4476 | break; |
| 4477 | |
| 4478 | case SND_SOC_BIAS_OFF: |
| 4479 | regmap_update_bits(rt5677->regmap, RT5677_DIG_MISC, 0x1, 0x0); |
| 4480 | regmap_write(rt5677->regmap, RT5677_PWR_DIG1, 0x0000); |
| 4481 | regmap_write(rt5677->regmap, RT5677_PWR_DIG2, 0x0000); |
Oder Chiou | f18803a | 2014-07-07 15:37:00 +0800 | [diff] [blame] | 4482 | regmap_write(rt5677->regmap, RT5677_PWR_ANLG1, 0x0022); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 4483 | regmap_write(rt5677->regmap, RT5677_PWR_ANLG2, 0x0000); |
| 4484 | regmap_update_bits(rt5677->regmap, |
| 4485 | RT5677_PR_BASE + RT5677_BIAS_CUR4, 0x0f00, 0x0000); |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 4486 | |
| 4487 | if (rt5677->dsp_vad_en) |
| 4488 | rt5677_set_dsp_vad(codec, true); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 4489 | break; |
| 4490 | |
| 4491 | default: |
| 4492 | break; |
| 4493 | } |
| 4494 | codec->dapm.bias_level = level; |
| 4495 | |
| 4496 | return 0; |
| 4497 | } |
| 4498 | |
Oder Chiou | 44caf76 | 2014-09-16 11:37:39 +0800 | [diff] [blame] | 4499 | #ifdef CONFIG_GPIOLIB |
| 4500 | static inline struct rt5677_priv *gpio_to_rt5677(struct gpio_chip *chip) |
| 4501 | { |
| 4502 | return container_of(chip, struct rt5677_priv, gpio_chip); |
| 4503 | } |
| 4504 | |
| 4505 | static void rt5677_gpio_set(struct gpio_chip *chip, unsigned offset, int value) |
| 4506 | { |
| 4507 | struct rt5677_priv *rt5677 = gpio_to_rt5677(chip); |
| 4508 | |
| 4509 | switch (offset) { |
| 4510 | case RT5677_GPIO1 ... RT5677_GPIO5: |
| 4511 | regmap_update_bits(rt5677->regmap, RT5677_GPIO_CTRL2, |
| 4512 | 0x1 << (offset * 3 + 1), !!value << (offset * 3 + 1)); |
| 4513 | break; |
| 4514 | |
| 4515 | case RT5677_GPIO6: |
| 4516 | regmap_update_bits(rt5677->regmap, RT5677_GPIO_CTRL3, |
| 4517 | RT5677_GPIO6_OUT_MASK, !!value << RT5677_GPIO6_OUT_SFT); |
| 4518 | break; |
| 4519 | |
| 4520 | default: |
| 4521 | break; |
| 4522 | } |
| 4523 | } |
| 4524 | |
| 4525 | static int rt5677_gpio_direction_out(struct gpio_chip *chip, |
| 4526 | unsigned offset, int value) |
| 4527 | { |
| 4528 | struct rt5677_priv *rt5677 = gpio_to_rt5677(chip); |
| 4529 | |
| 4530 | switch (offset) { |
| 4531 | case RT5677_GPIO1 ... RT5677_GPIO5: |
| 4532 | regmap_update_bits(rt5677->regmap, RT5677_GPIO_CTRL2, |
| 4533 | 0x3 << (offset * 3 + 1), |
| 4534 | (0x2 | !!value) << (offset * 3 + 1)); |
| 4535 | break; |
| 4536 | |
| 4537 | case RT5677_GPIO6: |
| 4538 | regmap_update_bits(rt5677->regmap, RT5677_GPIO_CTRL3, |
| 4539 | RT5677_GPIO6_DIR_MASK | RT5677_GPIO6_OUT_MASK, |
| 4540 | RT5677_GPIO6_DIR_OUT | !!value << RT5677_GPIO6_OUT_SFT); |
| 4541 | break; |
| 4542 | |
| 4543 | default: |
| 4544 | break; |
| 4545 | } |
| 4546 | |
| 4547 | return 0; |
| 4548 | } |
| 4549 | |
| 4550 | static int rt5677_gpio_get(struct gpio_chip *chip, unsigned offset) |
| 4551 | { |
| 4552 | struct rt5677_priv *rt5677 = gpio_to_rt5677(chip); |
| 4553 | int value, ret; |
| 4554 | |
| 4555 | ret = regmap_read(rt5677->regmap, RT5677_GPIO_ST, &value); |
| 4556 | if (ret < 0) |
| 4557 | return ret; |
| 4558 | |
| 4559 | return (value & (0x1 << offset)) >> offset; |
| 4560 | } |
| 4561 | |
| 4562 | static int rt5677_gpio_direction_in(struct gpio_chip *chip, unsigned offset) |
| 4563 | { |
| 4564 | struct rt5677_priv *rt5677 = gpio_to_rt5677(chip); |
| 4565 | |
| 4566 | switch (offset) { |
| 4567 | case RT5677_GPIO1 ... RT5677_GPIO5: |
| 4568 | regmap_update_bits(rt5677->regmap, RT5677_GPIO_CTRL2, |
| 4569 | 0x1 << (offset * 3 + 2), 0x0); |
| 4570 | break; |
| 4571 | |
| 4572 | case RT5677_GPIO6: |
| 4573 | regmap_update_bits(rt5677->regmap, RT5677_GPIO_CTRL3, |
| 4574 | RT5677_GPIO6_DIR_MASK, RT5677_GPIO6_DIR_IN); |
| 4575 | break; |
| 4576 | |
| 4577 | default: |
| 4578 | break; |
| 4579 | } |
| 4580 | |
| 4581 | return 0; |
| 4582 | } |
| 4583 | |
Anatol Pomozov | 40eb90a | 2014-10-10 20:46:36 -0700 | [diff] [blame] | 4584 | /** Configures the gpio as |
| 4585 | * 0 - floating |
| 4586 | * 1 - pull down |
| 4587 | * 2 - pull up |
| 4588 | */ |
| 4589 | static void rt5677_gpio_config(struct rt5677_priv *rt5677, unsigned offset, |
| 4590 | int value) |
| 4591 | { |
| 4592 | int shift; |
| 4593 | |
| 4594 | switch (offset) { |
| 4595 | case RT5677_GPIO1 ... RT5677_GPIO2: |
| 4596 | shift = 2 * (1 - offset); |
| 4597 | regmap_update_bits(rt5677->regmap, |
| 4598 | RT5677_PR_BASE + RT5677_DIG_IN_PIN_ST_CTRL2, |
| 4599 | 0x3 << shift, |
| 4600 | (value & 0x3) << shift); |
| 4601 | break; |
| 4602 | |
| 4603 | case RT5677_GPIO3 ... RT5677_GPIO6: |
| 4604 | shift = 2 * (9 - offset); |
| 4605 | regmap_update_bits(rt5677->regmap, |
| 4606 | RT5677_PR_BASE + RT5677_DIG_IN_PIN_ST_CTRL3, |
| 4607 | 0x3 << shift, |
| 4608 | (value & 0x3) << shift); |
| 4609 | break; |
| 4610 | |
| 4611 | default: |
| 4612 | break; |
| 4613 | } |
| 4614 | } |
| 4615 | |
Oder Chiou | 5e3363a | 2014-10-16 11:24:26 -0700 | [diff] [blame] | 4616 | static int rt5677_to_irq(struct gpio_chip *chip, unsigned offset) |
| 4617 | { |
| 4618 | struct rt5677_priv *rt5677 = gpio_to_rt5677(chip); |
| 4619 | struct regmap_irq_chip_data *data = rt5677->irq_data; |
| 4620 | int irq; |
| 4621 | |
| 4622 | if (offset >= RT5677_GPIO1 && offset <= RT5677_GPIO3) { |
| 4623 | if ((rt5677->pdata.jd1_gpio == 1 && offset == RT5677_GPIO1) || |
| 4624 | (rt5677->pdata.jd1_gpio == 2 && |
| 4625 | offset == RT5677_GPIO2) || |
| 4626 | (rt5677->pdata.jd1_gpio == 3 && |
| 4627 | offset == RT5677_GPIO3)) { |
| 4628 | irq = RT5677_IRQ_JD1; |
| 4629 | } else { |
| 4630 | return -ENXIO; |
| 4631 | } |
| 4632 | } |
| 4633 | |
| 4634 | if (offset >= RT5677_GPIO4 && offset <= RT5677_GPIO6) { |
| 4635 | if ((rt5677->pdata.jd2_gpio == 1 && offset == RT5677_GPIO4) || |
| 4636 | (rt5677->pdata.jd2_gpio == 2 && |
| 4637 | offset == RT5677_GPIO5) || |
| 4638 | (rt5677->pdata.jd2_gpio == 3 && |
| 4639 | offset == RT5677_GPIO6)) { |
| 4640 | irq = RT5677_IRQ_JD2; |
| 4641 | } else if ((rt5677->pdata.jd3_gpio == 1 && |
| 4642 | offset == RT5677_GPIO4) || |
| 4643 | (rt5677->pdata.jd3_gpio == 2 && |
| 4644 | offset == RT5677_GPIO5) || |
| 4645 | (rt5677->pdata.jd3_gpio == 3 && |
| 4646 | offset == RT5677_GPIO6)) { |
| 4647 | irq = RT5677_IRQ_JD3; |
| 4648 | } else { |
| 4649 | return -ENXIO; |
| 4650 | } |
| 4651 | } |
| 4652 | |
| 4653 | return regmap_irq_get_virq(data, irq); |
| 4654 | } |
| 4655 | |
Oder Chiou | 44caf76 | 2014-09-16 11:37:39 +0800 | [diff] [blame] | 4656 | static struct gpio_chip rt5677_template_chip = { |
| 4657 | .label = "rt5677", |
| 4658 | .owner = THIS_MODULE, |
| 4659 | .direction_output = rt5677_gpio_direction_out, |
| 4660 | .set = rt5677_gpio_set, |
| 4661 | .direction_input = rt5677_gpio_direction_in, |
| 4662 | .get = rt5677_gpio_get, |
Oder Chiou | 5e3363a | 2014-10-16 11:24:26 -0700 | [diff] [blame] | 4663 | .to_irq = rt5677_to_irq, |
Oder Chiou | 44caf76 | 2014-09-16 11:37:39 +0800 | [diff] [blame] | 4664 | .can_sleep = 1, |
| 4665 | }; |
| 4666 | |
| 4667 | static void rt5677_init_gpio(struct i2c_client *i2c) |
| 4668 | { |
| 4669 | struct rt5677_priv *rt5677 = i2c_get_clientdata(i2c); |
| 4670 | int ret; |
| 4671 | |
| 4672 | rt5677->gpio_chip = rt5677_template_chip; |
| 4673 | rt5677->gpio_chip.ngpio = RT5677_GPIO_NUM; |
| 4674 | rt5677->gpio_chip.dev = &i2c->dev; |
| 4675 | rt5677->gpio_chip.base = -1; |
| 4676 | |
| 4677 | ret = gpiochip_add(&rt5677->gpio_chip); |
| 4678 | if (ret != 0) |
| 4679 | dev_err(&i2c->dev, "Failed to add GPIOs: %d\n", ret); |
| 4680 | } |
| 4681 | |
| 4682 | static void rt5677_free_gpio(struct i2c_client *i2c) |
| 4683 | { |
| 4684 | struct rt5677_priv *rt5677 = i2c_get_clientdata(i2c); |
Oder Chiou | 44caf76 | 2014-09-16 11:37:39 +0800 | [diff] [blame] | 4685 | |
Axel Lin | 5d5e63a | 2014-09-17 20:58:02 +0800 | [diff] [blame] | 4686 | gpiochip_remove(&rt5677->gpio_chip); |
Oder Chiou | 44caf76 | 2014-09-16 11:37:39 +0800 | [diff] [blame] | 4687 | } |
| 4688 | #else |
Anatol Pomozov | 45b6e1d | 2014-10-16 09:40:58 -0700 | [diff] [blame] | 4689 | static void rt5677_gpio_config(struct rt5677_priv *rt5677, unsigned offset, |
| 4690 | int value) |
| 4691 | { |
| 4692 | } |
| 4693 | |
Oder Chiou | 44caf76 | 2014-09-16 11:37:39 +0800 | [diff] [blame] | 4694 | static void rt5677_init_gpio(struct i2c_client *i2c) |
| 4695 | { |
| 4696 | } |
| 4697 | |
| 4698 | static void rt5677_free_gpio(struct i2c_client *i2c) |
| 4699 | { |
| 4700 | } |
| 4701 | #endif |
| 4702 | |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 4703 | static int rt5677_probe(struct snd_soc_codec *codec) |
| 4704 | { |
| 4705 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); |
Anatol Pomozov | 40eb90a | 2014-10-10 20:46:36 -0700 | [diff] [blame] | 4706 | int i; |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 4707 | |
| 4708 | rt5677->codec = codec; |
| 4709 | |
Bard Liao | 2d15d97 | 2014-08-27 19:50:34 +0800 | [diff] [blame] | 4710 | if (rt5677->pdata.dmic2_clk_pin == RT5677_DMIC_CLK2) { |
| 4711 | snd_soc_dapm_add_routes(&codec->dapm, |
| 4712 | rt5677_dmic2_clk_2, |
| 4713 | ARRAY_SIZE(rt5677_dmic2_clk_2)); |
| 4714 | } else { /*use dmic1 clock by default*/ |
| 4715 | snd_soc_dapm_add_routes(&codec->dapm, |
| 4716 | rt5677_dmic2_clk_1, |
| 4717 | ARRAY_SIZE(rt5677_dmic2_clk_1)); |
| 4718 | } |
| 4719 | |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 4720 | rt5677_set_bias_level(codec, SND_SOC_BIAS_OFF); |
| 4721 | |
| 4722 | regmap_write(rt5677->regmap, RT5677_DIG_MISC, 0x0020); |
| 4723 | regmap_write(rt5677->regmap, RT5677_PWR_DSP2, 0x0c00); |
| 4724 | |
Anatol Pomozov | 40eb90a | 2014-10-10 20:46:36 -0700 | [diff] [blame] | 4725 | for (i = 0; i < RT5677_GPIO_NUM; i++) |
| 4726 | rt5677_gpio_config(rt5677, i, rt5677->pdata.gpio_config[i]); |
| 4727 | |
Oder Chiou | 5e3363a | 2014-10-16 11:24:26 -0700 | [diff] [blame] | 4728 | if (rt5677->irq_data) { |
| 4729 | regmap_update_bits(rt5677->regmap, RT5677_GPIO_CTRL1, 0x8000, |
| 4730 | 0x8000); |
| 4731 | regmap_update_bits(rt5677->regmap, RT5677_DIG_MISC, 0x0018, |
| 4732 | 0x0008); |
| 4733 | |
| 4734 | if (rt5677->pdata.jd1_gpio) |
| 4735 | regmap_update_bits(rt5677->regmap, RT5677_JD_CTRL1, |
| 4736 | RT5677_SEL_GPIO_JD1_MASK, |
| 4737 | rt5677->pdata.jd1_gpio << |
| 4738 | RT5677_SEL_GPIO_JD1_SFT); |
| 4739 | |
| 4740 | if (rt5677->pdata.jd2_gpio) |
| 4741 | regmap_update_bits(rt5677->regmap, RT5677_JD_CTRL1, |
| 4742 | RT5677_SEL_GPIO_JD2_MASK, |
| 4743 | rt5677->pdata.jd2_gpio << |
| 4744 | RT5677_SEL_GPIO_JD2_SFT); |
| 4745 | |
| 4746 | if (rt5677->pdata.jd3_gpio) |
| 4747 | regmap_update_bits(rt5677->regmap, RT5677_JD_CTRL1, |
| 4748 | RT5677_SEL_GPIO_JD3_MASK, |
| 4749 | rt5677->pdata.jd3_gpio << |
| 4750 | RT5677_SEL_GPIO_JD3_SFT); |
| 4751 | } |
| 4752 | |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 4753 | mutex_init(&rt5677->dsp_cmd_lock); |
Oder Chiou | 6fe17da | 2014-11-25 09:51:41 +0800 | [diff] [blame] | 4754 | mutex_init(&rt5677->dsp_pri_lock); |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 4755 | |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 4756 | return 0; |
| 4757 | } |
| 4758 | |
| 4759 | static int rt5677_remove(struct snd_soc_codec *codec) |
| 4760 | { |
| 4761 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); |
| 4762 | |
| 4763 | regmap_write(rt5677->regmap, RT5677_RESET, 0x10ec); |
Anatol Pomozov | f9f6a59 | 2014-09-17 13:14:20 -0700 | [diff] [blame] | 4764 | if (gpio_is_valid(rt5677->pow_ldo2)) |
| 4765 | gpio_set_value_cansleep(rt5677->pow_ldo2, 0); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 4766 | |
| 4767 | return 0; |
| 4768 | } |
| 4769 | |
| 4770 | #ifdef CONFIG_PM |
| 4771 | static int rt5677_suspend(struct snd_soc_codec *codec) |
| 4772 | { |
| 4773 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); |
| 4774 | |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 4775 | if (!rt5677->dsp_vad_en) { |
| 4776 | regcache_cache_only(rt5677->regmap, true); |
| 4777 | regcache_mark_dirty(rt5677->regmap); |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 4778 | |
Oder Chiou | cbca407 | 2015-02-25 17:36:14 +0800 | [diff] [blame] | 4779 | if (gpio_is_valid(rt5677->pow_ldo2)) |
| 4780 | gpio_set_value_cansleep(rt5677->pow_ldo2, 0); |
| 4781 | } |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 4782 | |
| 4783 | return 0; |
| 4784 | } |
| 4785 | |
| 4786 | static int rt5677_resume(struct snd_soc_codec *codec) |
| 4787 | { |
| 4788 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); |
| 4789 | |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 4790 | if (!rt5677->dsp_vad_en) { |
Oder Chiou | cbca407 | 2015-02-25 17:36:14 +0800 | [diff] [blame] | 4791 | if (gpio_is_valid(rt5677->pow_ldo2)) { |
| 4792 | gpio_set_value_cansleep(rt5677->pow_ldo2, 1); |
| 4793 | msleep(10); |
| 4794 | } |
| 4795 | |
Oder Chiou | af48f1d | 2014-10-06 16:30:51 +0800 | [diff] [blame] | 4796 | regcache_cache_only(rt5677->regmap, false); |
| 4797 | regcache_sync(rt5677->regmap); |
| 4798 | } |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 4799 | |
| 4800 | return 0; |
| 4801 | } |
| 4802 | #else |
| 4803 | #define rt5677_suspend NULL |
| 4804 | #define rt5677_resume NULL |
| 4805 | #endif |
| 4806 | |
Oder Chiou | 19ba484 | 2014-11-05 13:42:53 +0800 | [diff] [blame] | 4807 | static int rt5677_read(void *context, unsigned int reg, unsigned int *val) |
| 4808 | { |
| 4809 | struct i2c_client *client = context; |
| 4810 | struct rt5677_priv *rt5677 = i2c_get_clientdata(client); |
| 4811 | |
Oder Chiou | 6fe17da | 2014-11-25 09:51:41 +0800 | [diff] [blame] | 4812 | if (rt5677->is_dsp_mode) { |
| 4813 | if (reg > 0xff) { |
| 4814 | mutex_lock(&rt5677->dsp_pri_lock); |
| 4815 | rt5677_dsp_mode_i2c_write(rt5677, RT5677_PRIV_INDEX, |
| 4816 | reg & 0xff); |
| 4817 | rt5677_dsp_mode_i2c_read(rt5677, RT5677_PRIV_DATA, val); |
| 4818 | mutex_unlock(&rt5677->dsp_pri_lock); |
| 4819 | } else { |
| 4820 | rt5677_dsp_mode_i2c_read(rt5677, reg, val); |
| 4821 | } |
| 4822 | } else { |
Oder Chiou | 19ba484 | 2014-11-05 13:42:53 +0800 | [diff] [blame] | 4823 | regmap_read(rt5677->regmap_physical, reg, val); |
Oder Chiou | 6fe17da | 2014-11-25 09:51:41 +0800 | [diff] [blame] | 4824 | } |
Oder Chiou | 19ba484 | 2014-11-05 13:42:53 +0800 | [diff] [blame] | 4825 | |
| 4826 | return 0; |
| 4827 | } |
| 4828 | |
| 4829 | static int rt5677_write(void *context, unsigned int reg, unsigned int val) |
| 4830 | { |
| 4831 | struct i2c_client *client = context; |
| 4832 | struct rt5677_priv *rt5677 = i2c_get_clientdata(client); |
| 4833 | |
Oder Chiou | 6fe17da | 2014-11-25 09:51:41 +0800 | [diff] [blame] | 4834 | if (rt5677->is_dsp_mode) { |
| 4835 | if (reg > 0xff) { |
| 4836 | mutex_lock(&rt5677->dsp_pri_lock); |
| 4837 | rt5677_dsp_mode_i2c_write(rt5677, RT5677_PRIV_INDEX, |
| 4838 | reg & 0xff); |
| 4839 | rt5677_dsp_mode_i2c_write(rt5677, RT5677_PRIV_DATA, |
| 4840 | val); |
| 4841 | mutex_unlock(&rt5677->dsp_pri_lock); |
| 4842 | } else { |
| 4843 | rt5677_dsp_mode_i2c_write(rt5677, reg, val); |
| 4844 | } |
| 4845 | } else { |
Oder Chiou | 19ba484 | 2014-11-05 13:42:53 +0800 | [diff] [blame] | 4846 | regmap_write(rt5677->regmap_physical, reg, val); |
Oder Chiou | 6fe17da | 2014-11-25 09:51:41 +0800 | [diff] [blame] | 4847 | } |
Oder Chiou | 19ba484 | 2014-11-05 13:42:53 +0800 | [diff] [blame] | 4848 | |
| 4849 | return 0; |
| 4850 | } |
| 4851 | |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 4852 | #define RT5677_STEREO_RATES SNDRV_PCM_RATE_8000_96000 |
| 4853 | #define RT5677_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ |
| 4854 | SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S8) |
| 4855 | |
| 4856 | static struct snd_soc_dai_ops rt5677_aif_dai_ops = { |
| 4857 | .hw_params = rt5677_hw_params, |
| 4858 | .set_fmt = rt5677_set_dai_fmt, |
| 4859 | .set_sysclk = rt5677_set_dai_sysclk, |
| 4860 | .set_pll = rt5677_set_dai_pll, |
Oder Chiou | 48561af | 2014-09-17 15:12:33 +0800 | [diff] [blame] | 4861 | .set_tdm_slot = rt5677_set_tdm_slot, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 4862 | }; |
| 4863 | |
| 4864 | static struct snd_soc_dai_driver rt5677_dai[] = { |
| 4865 | { |
| 4866 | .name = "rt5677-aif1", |
| 4867 | .id = RT5677_AIF1, |
| 4868 | .playback = { |
| 4869 | .stream_name = "AIF1 Playback", |
| 4870 | .channels_min = 1, |
| 4871 | .channels_max = 2, |
| 4872 | .rates = RT5677_STEREO_RATES, |
| 4873 | .formats = RT5677_FORMATS, |
| 4874 | }, |
| 4875 | .capture = { |
| 4876 | .stream_name = "AIF1 Capture", |
| 4877 | .channels_min = 1, |
| 4878 | .channels_max = 2, |
| 4879 | .rates = RT5677_STEREO_RATES, |
| 4880 | .formats = RT5677_FORMATS, |
| 4881 | }, |
| 4882 | .ops = &rt5677_aif_dai_ops, |
| 4883 | }, |
| 4884 | { |
| 4885 | .name = "rt5677-aif2", |
| 4886 | .id = RT5677_AIF2, |
| 4887 | .playback = { |
| 4888 | .stream_name = "AIF2 Playback", |
| 4889 | .channels_min = 1, |
| 4890 | .channels_max = 2, |
| 4891 | .rates = RT5677_STEREO_RATES, |
| 4892 | .formats = RT5677_FORMATS, |
| 4893 | }, |
| 4894 | .capture = { |
| 4895 | .stream_name = "AIF2 Capture", |
| 4896 | .channels_min = 1, |
| 4897 | .channels_max = 2, |
| 4898 | .rates = RT5677_STEREO_RATES, |
| 4899 | .formats = RT5677_FORMATS, |
| 4900 | }, |
| 4901 | .ops = &rt5677_aif_dai_ops, |
| 4902 | }, |
| 4903 | { |
| 4904 | .name = "rt5677-aif3", |
| 4905 | .id = RT5677_AIF3, |
| 4906 | .playback = { |
| 4907 | .stream_name = "AIF3 Playback", |
| 4908 | .channels_min = 1, |
| 4909 | .channels_max = 2, |
| 4910 | .rates = RT5677_STEREO_RATES, |
| 4911 | .formats = RT5677_FORMATS, |
| 4912 | }, |
| 4913 | .capture = { |
| 4914 | .stream_name = "AIF3 Capture", |
| 4915 | .channels_min = 1, |
| 4916 | .channels_max = 2, |
| 4917 | .rates = RT5677_STEREO_RATES, |
| 4918 | .formats = RT5677_FORMATS, |
| 4919 | }, |
| 4920 | .ops = &rt5677_aif_dai_ops, |
| 4921 | }, |
| 4922 | { |
| 4923 | .name = "rt5677-aif4", |
| 4924 | .id = RT5677_AIF4, |
| 4925 | .playback = { |
| 4926 | .stream_name = "AIF4 Playback", |
| 4927 | .channels_min = 1, |
| 4928 | .channels_max = 2, |
| 4929 | .rates = RT5677_STEREO_RATES, |
| 4930 | .formats = RT5677_FORMATS, |
| 4931 | }, |
| 4932 | .capture = { |
| 4933 | .stream_name = "AIF4 Capture", |
| 4934 | .channels_min = 1, |
| 4935 | .channels_max = 2, |
| 4936 | .rates = RT5677_STEREO_RATES, |
| 4937 | .formats = RT5677_FORMATS, |
| 4938 | }, |
| 4939 | .ops = &rt5677_aif_dai_ops, |
| 4940 | }, |
| 4941 | { |
| 4942 | .name = "rt5677-slimbus", |
| 4943 | .id = RT5677_AIF5, |
| 4944 | .playback = { |
| 4945 | .stream_name = "SLIMBus Playback", |
| 4946 | .channels_min = 1, |
| 4947 | .channels_max = 2, |
| 4948 | .rates = RT5677_STEREO_RATES, |
| 4949 | .formats = RT5677_FORMATS, |
| 4950 | }, |
| 4951 | .capture = { |
| 4952 | .stream_name = "SLIMBus Capture", |
| 4953 | .channels_min = 1, |
| 4954 | .channels_max = 2, |
| 4955 | .rates = RT5677_STEREO_RATES, |
| 4956 | .formats = RT5677_FORMATS, |
| 4957 | }, |
| 4958 | .ops = &rt5677_aif_dai_ops, |
| 4959 | }, |
| 4960 | }; |
| 4961 | |
| 4962 | static struct snd_soc_codec_driver soc_codec_dev_rt5677 = { |
| 4963 | .probe = rt5677_probe, |
| 4964 | .remove = rt5677_remove, |
| 4965 | .suspend = rt5677_suspend, |
| 4966 | .resume = rt5677_resume, |
| 4967 | .set_bias_level = rt5677_set_bias_level, |
| 4968 | .idle_bias_off = true, |
| 4969 | .controls = rt5677_snd_controls, |
| 4970 | .num_controls = ARRAY_SIZE(rt5677_snd_controls), |
| 4971 | .dapm_widgets = rt5677_dapm_widgets, |
| 4972 | .num_dapm_widgets = ARRAY_SIZE(rt5677_dapm_widgets), |
| 4973 | .dapm_routes = rt5677_dapm_routes, |
| 4974 | .num_dapm_routes = ARRAY_SIZE(rt5677_dapm_routes), |
| 4975 | }; |
| 4976 | |
Oder Chiou | 19ba484 | 2014-11-05 13:42:53 +0800 | [diff] [blame] | 4977 | static const struct regmap_config rt5677_regmap_physical = { |
| 4978 | .name = "physical", |
| 4979 | .reg_bits = 8, |
| 4980 | .val_bits = 16, |
| 4981 | |
Oder Chiou | 6fe17da | 2014-11-25 09:51:41 +0800 | [diff] [blame] | 4982 | .max_register = RT5677_VENDOR_ID2 + 1 + (ARRAY_SIZE(rt5677_ranges) * |
| 4983 | RT5677_PR_SPACING), |
Oder Chiou | 19ba484 | 2014-11-05 13:42:53 +0800 | [diff] [blame] | 4984 | .readable_reg = rt5677_readable_register, |
| 4985 | |
| 4986 | .cache_type = REGCACHE_NONE, |
Oder Chiou | 6fe17da | 2014-11-25 09:51:41 +0800 | [diff] [blame] | 4987 | .ranges = rt5677_ranges, |
| 4988 | .num_ranges = ARRAY_SIZE(rt5677_ranges), |
Oder Chiou | 19ba484 | 2014-11-05 13:42:53 +0800 | [diff] [blame] | 4989 | }; |
| 4990 | |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 4991 | static const struct regmap_config rt5677_regmap = { |
| 4992 | .reg_bits = 8, |
| 4993 | .val_bits = 16, |
| 4994 | |
| 4995 | .max_register = RT5677_VENDOR_ID2 + 1 + (ARRAY_SIZE(rt5677_ranges) * |
| 4996 | RT5677_PR_SPACING), |
| 4997 | |
| 4998 | .volatile_reg = rt5677_volatile_register, |
| 4999 | .readable_reg = rt5677_readable_register, |
Oder Chiou | 19ba484 | 2014-11-05 13:42:53 +0800 | [diff] [blame] | 5000 | .reg_read = rt5677_read, |
| 5001 | .reg_write = rt5677_write, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 5002 | |
| 5003 | .cache_type = REGCACHE_RBTREE, |
| 5004 | .reg_defaults = rt5677_reg, |
| 5005 | .num_reg_defaults = ARRAY_SIZE(rt5677_reg), |
| 5006 | .ranges = rt5677_ranges, |
| 5007 | .num_ranges = ARRAY_SIZE(rt5677_ranges), |
| 5008 | }; |
| 5009 | |
| 5010 | static const struct i2c_device_id rt5677_i2c_id[] = { |
Oder Chiou | ab1f709 | 2015-02-11 19:18:51 +0800 | [diff] [blame] | 5011 | { "rt5677", RT5677 }, |
| 5012 | { "rt5676", RT5676 }, |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 5013 | { } |
| 5014 | }; |
| 5015 | MODULE_DEVICE_TABLE(i2c, rt5677_i2c_id); |
| 5016 | |
Anatol Pomozov | f9f6a59 | 2014-09-17 13:14:20 -0700 | [diff] [blame] | 5017 | static int rt5677_parse_dt(struct rt5677_priv *rt5677, struct device_node *np) |
| 5018 | { |
Anatol Pomozov | 6f67c38 | 2014-09-26 09:57:27 -0700 | [diff] [blame] | 5019 | rt5677->pdata.in1_diff = of_property_read_bool(np, |
| 5020 | "realtek,in1-differential"); |
| 5021 | rt5677->pdata.in2_diff = of_property_read_bool(np, |
| 5022 | "realtek,in2-differential"); |
| 5023 | rt5677->pdata.lout1_diff = of_property_read_bool(np, |
| 5024 | "realtek,lout1-differential"); |
| 5025 | rt5677->pdata.lout2_diff = of_property_read_bool(np, |
| 5026 | "realtek,lout2-differential"); |
| 5027 | rt5677->pdata.lout3_diff = of_property_read_bool(np, |
| 5028 | "realtek,lout3-differential"); |
| 5029 | |
Anatol Pomozov | f9f6a59 | 2014-09-17 13:14:20 -0700 | [diff] [blame] | 5030 | rt5677->pow_ldo2 = of_get_named_gpio(np, |
| 5031 | "realtek,pow-ldo2-gpio", 0); |
| 5032 | |
| 5033 | /* |
| 5034 | * POW_LDO2 is optional (it may be statically tied on the board). |
| 5035 | * -ENOENT means that the property doesn't exist, i.e. there is no |
| 5036 | * GPIO, so is not an error. Any other error code means the property |
| 5037 | * exists, but could not be parsed. |
| 5038 | */ |
| 5039 | if (!gpio_is_valid(rt5677->pow_ldo2) && |
| 5040 | (rt5677->pow_ldo2 != -ENOENT)) |
| 5041 | return rt5677->pow_ldo2; |
| 5042 | |
Anatol Pomozov | 40eb90a | 2014-10-10 20:46:36 -0700 | [diff] [blame] | 5043 | of_property_read_u8_array(np, "realtek,gpio-config", |
| 5044 | rt5677->pdata.gpio_config, RT5677_GPIO_NUM); |
| 5045 | |
Oder Chiou | 5e3363a | 2014-10-16 11:24:26 -0700 | [diff] [blame] | 5046 | of_property_read_u32(np, "realtek,jd1-gpio", &rt5677->pdata.jd1_gpio); |
| 5047 | of_property_read_u32(np, "realtek,jd2-gpio", &rt5677->pdata.jd2_gpio); |
| 5048 | of_property_read_u32(np, "realtek,jd3-gpio", &rt5677->pdata.jd3_gpio); |
| 5049 | |
Anatol Pomozov | f9f6a59 | 2014-09-17 13:14:20 -0700 | [diff] [blame] | 5050 | return 0; |
| 5051 | } |
| 5052 | |
Oder Chiou | 5e3363a | 2014-10-16 11:24:26 -0700 | [diff] [blame] | 5053 | static struct regmap_irq rt5677_irqs[] = { |
| 5054 | [RT5677_IRQ_JD1] = { |
| 5055 | .reg_offset = 0, |
| 5056 | .mask = RT5677_EN_IRQ_GPIO_JD1, |
| 5057 | }, |
| 5058 | [RT5677_IRQ_JD2] = { |
| 5059 | .reg_offset = 0, |
| 5060 | .mask = RT5677_EN_IRQ_GPIO_JD2, |
| 5061 | }, |
| 5062 | [RT5677_IRQ_JD3] = { |
| 5063 | .reg_offset = 0, |
| 5064 | .mask = RT5677_EN_IRQ_GPIO_JD3, |
| 5065 | }, |
| 5066 | }; |
| 5067 | |
| 5068 | static struct regmap_irq_chip rt5677_irq_chip = { |
| 5069 | .name = "rt5677", |
| 5070 | .irqs = rt5677_irqs, |
| 5071 | .num_irqs = ARRAY_SIZE(rt5677_irqs), |
| 5072 | |
| 5073 | .num_regs = 1, |
| 5074 | .status_base = RT5677_IRQ_CTRL1, |
| 5075 | .mask_base = RT5677_IRQ_CTRL1, |
| 5076 | .mask_invert = 1, |
| 5077 | }; |
| 5078 | |
Oder Chiou | 35d40d1 | 2014-11-19 13:52:19 +0800 | [diff] [blame] | 5079 | static int rt5677_init_irq(struct i2c_client *i2c) |
Oder Chiou | 5e3363a | 2014-10-16 11:24:26 -0700 | [diff] [blame] | 5080 | { |
| 5081 | int ret; |
| 5082 | struct rt5677_priv *rt5677 = i2c_get_clientdata(i2c); |
| 5083 | |
| 5084 | if (!rt5677->pdata.jd1_gpio && |
| 5085 | !rt5677->pdata.jd2_gpio && |
| 5086 | !rt5677->pdata.jd3_gpio) |
| 5087 | return 0; |
| 5088 | |
| 5089 | if (!i2c->irq) { |
| 5090 | dev_err(&i2c->dev, "No interrupt specified\n"); |
| 5091 | return -EINVAL; |
| 5092 | } |
| 5093 | |
| 5094 | ret = regmap_add_irq_chip(rt5677->regmap, i2c->irq, |
| 5095 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, 0, |
| 5096 | &rt5677_irq_chip, &rt5677->irq_data); |
| 5097 | |
| 5098 | if (ret != 0) { |
| 5099 | dev_err(&i2c->dev, "Failed to register IRQ chip: %d\n", ret); |
| 5100 | return ret; |
| 5101 | } |
| 5102 | |
| 5103 | return 0; |
| 5104 | } |
| 5105 | |
Oder Chiou | 35d40d1 | 2014-11-19 13:52:19 +0800 | [diff] [blame] | 5106 | static void rt5677_free_irq(struct i2c_client *i2c) |
Oder Chiou | 5e3363a | 2014-10-16 11:24:26 -0700 | [diff] [blame] | 5107 | { |
| 5108 | struct rt5677_priv *rt5677 = i2c_get_clientdata(i2c); |
| 5109 | |
| 5110 | if (rt5677->irq_data) |
| 5111 | regmap_del_irq_chip(i2c->irq, rt5677->irq_data); |
| 5112 | } |
| 5113 | |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 5114 | static int rt5677_i2c_probe(struct i2c_client *i2c, |
| 5115 | const struct i2c_device_id *id) |
| 5116 | { |
| 5117 | struct rt5677_platform_data *pdata = dev_get_platdata(&i2c->dev); |
| 5118 | struct rt5677_priv *rt5677; |
| 5119 | int ret; |
| 5120 | unsigned int val; |
| 5121 | |
| 5122 | rt5677 = devm_kzalloc(&i2c->dev, sizeof(struct rt5677_priv), |
| 5123 | GFP_KERNEL); |
| 5124 | if (rt5677 == NULL) |
| 5125 | return -ENOMEM; |
| 5126 | |
| 5127 | i2c_set_clientdata(i2c, rt5677); |
| 5128 | |
Oder Chiou | ab1f709 | 2015-02-11 19:18:51 +0800 | [diff] [blame] | 5129 | rt5677->type = id->driver_data; |
| 5130 | |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 5131 | if (pdata) |
| 5132 | rt5677->pdata = *pdata; |
| 5133 | |
Anatol Pomozov | f9f6a59 | 2014-09-17 13:14:20 -0700 | [diff] [blame] | 5134 | if (i2c->dev.of_node) { |
| 5135 | ret = rt5677_parse_dt(rt5677, i2c->dev.of_node); |
| 5136 | if (ret) { |
| 5137 | dev_err(&i2c->dev, "Failed to parse device tree: %d\n", |
| 5138 | ret); |
| 5139 | return ret; |
| 5140 | } |
| 5141 | } else { |
| 5142 | rt5677->pow_ldo2 = -EINVAL; |
| 5143 | } |
| 5144 | |
| 5145 | if (gpio_is_valid(rt5677->pow_ldo2)) { |
| 5146 | ret = devm_gpio_request_one(&i2c->dev, rt5677->pow_ldo2, |
| 5147 | GPIOF_OUT_INIT_HIGH, |
| 5148 | "RT5677 POW_LDO2"); |
| 5149 | if (ret < 0) { |
| 5150 | dev_err(&i2c->dev, "Failed to request POW_LDO2 %d: %d\n", |
| 5151 | rt5677->pow_ldo2, ret); |
| 5152 | return ret; |
| 5153 | } |
| 5154 | /* Wait a while until I2C bus becomes available. The datasheet |
| 5155 | * does not specify the exact we should wait but startup |
| 5156 | * sequence mentiones at least a few milliseconds. |
| 5157 | */ |
| 5158 | msleep(10); |
| 5159 | } |
| 5160 | |
Oder Chiou | 19ba484 | 2014-11-05 13:42:53 +0800 | [diff] [blame] | 5161 | rt5677->regmap_physical = devm_regmap_init_i2c(i2c, |
| 5162 | &rt5677_regmap_physical); |
| 5163 | if (IS_ERR(rt5677->regmap_physical)) { |
| 5164 | ret = PTR_ERR(rt5677->regmap_physical); |
| 5165 | dev_err(&i2c->dev, "Failed to allocate register map: %d\n", |
| 5166 | ret); |
| 5167 | return ret; |
| 5168 | } |
| 5169 | |
| 5170 | rt5677->regmap = devm_regmap_init(&i2c->dev, NULL, i2c, &rt5677_regmap); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 5171 | if (IS_ERR(rt5677->regmap)) { |
| 5172 | ret = PTR_ERR(rt5677->regmap); |
| 5173 | dev_err(&i2c->dev, "Failed to allocate register map: %d\n", |
| 5174 | ret); |
| 5175 | return ret; |
| 5176 | } |
| 5177 | |
| 5178 | regmap_read(rt5677->regmap, RT5677_VENDOR_ID2, &val); |
| 5179 | if (val != RT5677_DEVICE_ID) { |
| 5180 | dev_err(&i2c->dev, |
| 5181 | "Device with ID register %x is not rt5677\n", val); |
| 5182 | return -ENODEV; |
| 5183 | } |
| 5184 | |
| 5185 | regmap_write(rt5677->regmap, RT5677_RESET, 0x10ec); |
| 5186 | |
| 5187 | ret = regmap_register_patch(rt5677->regmap, init_list, |
| 5188 | ARRAY_SIZE(init_list)); |
| 5189 | if (ret != 0) |
| 5190 | dev_warn(&i2c->dev, "Failed to apply regmap patch: %d\n", ret); |
| 5191 | |
| 5192 | if (rt5677->pdata.in1_diff) |
| 5193 | regmap_update_bits(rt5677->regmap, RT5677_IN1, |
| 5194 | RT5677_IN_DF1, RT5677_IN_DF1); |
| 5195 | |
| 5196 | if (rt5677->pdata.in2_diff) |
| 5197 | regmap_update_bits(rt5677->regmap, RT5677_IN1, |
| 5198 | RT5677_IN_DF2, RT5677_IN_DF2); |
| 5199 | |
Anatol Pomozov | 6f67c38 | 2014-09-26 09:57:27 -0700 | [diff] [blame] | 5200 | if (rt5677->pdata.lout1_diff) |
| 5201 | regmap_update_bits(rt5677->regmap, RT5677_LOUT1, |
| 5202 | RT5677_LOUT1_L_DF, RT5677_LOUT1_L_DF); |
| 5203 | |
| 5204 | if (rt5677->pdata.lout2_diff) |
| 5205 | regmap_update_bits(rt5677->regmap, RT5677_LOUT1, |
| 5206 | RT5677_LOUT2_L_DF, RT5677_LOUT2_L_DF); |
| 5207 | |
| 5208 | if (rt5677->pdata.lout3_diff) |
| 5209 | regmap_update_bits(rt5677->regmap, RT5677_LOUT1, |
| 5210 | RT5677_LOUT3_L_DF, RT5677_LOUT3_L_DF); |
| 5211 | |
Bard Liao | 2d15d97 | 2014-08-27 19:50:34 +0800 | [diff] [blame] | 5212 | if (rt5677->pdata.dmic2_clk_pin == RT5677_DMIC_CLK2) { |
| 5213 | regmap_update_bits(rt5677->regmap, RT5677_GEN_CTRL2, |
| 5214 | RT5677_GPIO5_FUNC_MASK, |
| 5215 | RT5677_GPIO5_FUNC_DMIC); |
| 5216 | regmap_update_bits(rt5677->regmap, RT5677_GPIO_CTRL2, |
| 5217 | RT5677_GPIO5_DIR_MASK, |
| 5218 | RT5677_GPIO5_DIR_OUT); |
| 5219 | } |
| 5220 | |
Oder Chiou | 277880a | 2015-01-08 10:31:06 +0800 | [diff] [blame] | 5221 | if (rt5677->pdata.micbias1_vdd_3v3) |
| 5222 | regmap_update_bits(rt5677->regmap, RT5677_MICBIAS, |
| 5223 | RT5677_MICBIAS1_CTRL_VDD_MASK, |
| 5224 | RT5677_MICBIAS1_CTRL_VDD_3_3V); |
| 5225 | |
Oder Chiou | 44caf76 | 2014-09-16 11:37:39 +0800 | [diff] [blame] | 5226 | rt5677_init_gpio(i2c); |
Oder Chiou | 35d40d1 | 2014-11-19 13:52:19 +0800 | [diff] [blame] | 5227 | rt5677_init_irq(i2c); |
Oder Chiou | 44caf76 | 2014-09-16 11:37:39 +0800 | [diff] [blame] | 5228 | |
Axel Lin | d0bdcb9 | 2014-06-10 11:37:24 +0800 | [diff] [blame] | 5229 | return snd_soc_register_codec(&i2c->dev, &soc_codec_dev_rt5677, |
| 5230 | rt5677_dai, ARRAY_SIZE(rt5677_dai)); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 5231 | } |
| 5232 | |
| 5233 | static int rt5677_i2c_remove(struct i2c_client *i2c) |
| 5234 | { |
| 5235 | snd_soc_unregister_codec(&i2c->dev); |
Oder Chiou | 35d40d1 | 2014-11-19 13:52:19 +0800 | [diff] [blame] | 5236 | rt5677_free_irq(i2c); |
Oder Chiou | 44caf76 | 2014-09-16 11:37:39 +0800 | [diff] [blame] | 5237 | rt5677_free_gpio(i2c); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 5238 | |
| 5239 | return 0; |
| 5240 | } |
| 5241 | |
| 5242 | static struct i2c_driver rt5677_i2c_driver = { |
| 5243 | .driver = { |
| 5244 | .name = "rt5677", |
| 5245 | .owner = THIS_MODULE, |
| 5246 | }, |
| 5247 | .probe = rt5677_i2c_probe, |
| 5248 | .remove = rt5677_i2c_remove, |
| 5249 | .id_table = rt5677_i2c_id, |
| 5250 | }; |
Axel Lin | c8cfbec | 2014-06-03 10:56:41 +0800 | [diff] [blame] | 5251 | module_i2c_driver(rt5677_i2c_driver); |
Oder Chiou | 0e826e8 | 2014-05-26 20:32:33 +0800 | [diff] [blame] | 5252 | |
| 5253 | MODULE_DESCRIPTION("ASoC RT5677 driver"); |
| 5254 | MODULE_AUTHOR("Oder Chiou <oder_chiou@realtek.com>"); |
| 5255 | MODULE_LICENSE("GPL v2"); |