Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 1 | /* |
| 2 | * ALSA SoC TLV320AIC3X codec driver |
| 3 | * |
Vladimir Barinov | d6b5203 | 2008-09-29 23:14:11 +0400 | [diff] [blame] | 4 | * Author: Vladimir Barinov, <vbarinov@embeddedalley.com> |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 5 | * Copyright: (C) 2007 MontaVista Software, Inc., <source@mvista.com> |
| 6 | * |
| 7 | * Based on sound/soc/codecs/wm8753.c by Liam Girdwood |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License version 2 as |
| 11 | * published by the Free Software Foundation. |
| 12 | * |
| 13 | * Notes: |
| 14 | * The AIC3X is a driver for a low power stereo audio |
| 15 | * codecs aic31, aic32, aic33. |
| 16 | * |
| 17 | * It supports full aic33 codec functionality. |
| 18 | * The compatibility with aic32, aic31 is as follows: |
| 19 | * aic32 | aic31 |
| 20 | * --------------------------------------- |
| 21 | * MONO_LOUT -> N/A | MONO_LOUT -> N/A |
| 22 | * | IN1L -> LINE1L |
| 23 | * | IN1R -> LINE1R |
| 24 | * | IN2L -> LINE2L |
| 25 | * | IN2R -> LINE2R |
| 26 | * | MIC3L/R -> N/A |
| 27 | * truncated internal functionality in |
| 28 | * accordance with documentation |
| 29 | * --------------------------------------- |
| 30 | * |
| 31 | * Hence the machine layer should disable unsupported inputs/outputs by |
Liam Girdwood | a530218 | 2008-07-07 13:35:17 +0100 | [diff] [blame] | 32 | * snd_soc_dapm_disable_pin(codec, "MONO_LOUT"), etc. |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 33 | */ |
| 34 | |
| 35 | #include <linux/module.h> |
| 36 | #include <linux/moduleparam.h> |
| 37 | #include <linux/init.h> |
| 38 | #include <linux/delay.h> |
| 39 | #include <linux/pm.h> |
| 40 | #include <linux/i2c.h> |
Jarkko Nikula | 5193d62 | 2010-05-05 13:02:03 +0300 | [diff] [blame] | 41 | #include <linux/gpio.h> |
Jarkko Nikula | 07779fd | 2010-04-26 15:49:14 +0300 | [diff] [blame] | 42 | #include <linux/regulator/consumer.h> |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 43 | #include <linux/platform_device.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 44 | #include <linux/slab.h> |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 45 | #include <sound/core.h> |
| 46 | #include <sound/pcm.h> |
| 47 | #include <sound/pcm_params.h> |
| 48 | #include <sound/soc.h> |
| 49 | #include <sound/soc-dapm.h> |
| 50 | #include <sound/initval.h> |
Jarkko Nikula | 7565fc3 | 2009-02-09 14:27:07 +0200 | [diff] [blame] | 51 | #include <sound/tlv.h> |
Jarkko Nikula | 5193d62 | 2010-05-05 13:02:03 +0300 | [diff] [blame] | 52 | #include <sound/tlv320aic3x.h> |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 53 | |
| 54 | #include "tlv320aic3x.h" |
| 55 | |
Jarkko Nikula | 07779fd | 2010-04-26 15:49:14 +0300 | [diff] [blame] | 56 | #define AIC3X_NUM_SUPPLIES 4 |
| 57 | static const char *aic3x_supply_names[AIC3X_NUM_SUPPLIES] = { |
| 58 | "IOVDD", /* I/O Voltage */ |
| 59 | "DVDD", /* Digital Core Voltage */ |
| 60 | "AVDD", /* Analog DAC Voltage */ |
| 61 | "DRVDD", /* ADC Analog and Output Driver Voltage */ |
| 62 | }; |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 63 | |
| 64 | /* codec private data */ |
| 65 | struct aic3x_priv { |
Jarkko Nikula | 07779fd | 2010-04-26 15:49:14 +0300 | [diff] [blame] | 66 | struct regulator_bulk_data supplies[AIC3X_NUM_SUPPLIES]; |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 67 | enum snd_soc_control_type control_type; |
| 68 | struct aic3x_setup_data *setup; |
| 69 | void *control_data; |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 70 | unsigned int sysclk; |
| 71 | int master; |
Jarkko Nikula | 5193d62 | 2010-05-05 13:02:03 +0300 | [diff] [blame] | 72 | int gpio_reset; |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 73 | }; |
| 74 | |
| 75 | /* |
| 76 | * AIC3X register cache |
| 77 | * We can't read the AIC3X register space when we are |
| 78 | * using 2 wire for device control, so we cache them instead. |
| 79 | * There is no point in caching the reset register |
| 80 | */ |
| 81 | static const u8 aic3x_reg[AIC3X_CACHEREGNUM] = { |
| 82 | 0x00, 0x00, 0x00, 0x10, /* 0 */ |
| 83 | 0x04, 0x00, 0x00, 0x00, /* 4 */ |
| 84 | 0x00, 0x00, 0x00, 0x01, /* 8 */ |
| 85 | 0x00, 0x00, 0x00, 0x80, /* 12 */ |
| 86 | 0x80, 0xff, 0xff, 0x78, /* 16 */ |
| 87 | 0x78, 0x78, 0x78, 0x78, /* 20 */ |
| 88 | 0x78, 0x00, 0x00, 0xfe, /* 24 */ |
| 89 | 0x00, 0x00, 0xfe, 0x00, /* 28 */ |
| 90 | 0x18, 0x18, 0x00, 0x00, /* 32 */ |
| 91 | 0x00, 0x00, 0x00, 0x00, /* 36 */ |
| 92 | 0x00, 0x00, 0x00, 0x80, /* 40 */ |
| 93 | 0x80, 0x00, 0x00, 0x00, /* 44 */ |
| 94 | 0x00, 0x00, 0x00, 0x04, /* 48 */ |
| 95 | 0x00, 0x00, 0x00, 0x00, /* 52 */ |
| 96 | 0x00, 0x00, 0x04, 0x00, /* 56 */ |
| 97 | 0x00, 0x00, 0x00, 0x00, /* 60 */ |
| 98 | 0x00, 0x04, 0x00, 0x00, /* 64 */ |
| 99 | 0x00, 0x00, 0x00, 0x00, /* 68 */ |
| 100 | 0x04, 0x00, 0x00, 0x00, /* 72 */ |
| 101 | 0x00, 0x00, 0x00, 0x00, /* 76 */ |
| 102 | 0x00, 0x00, 0x00, 0x00, /* 80 */ |
| 103 | 0x00, 0x00, 0x00, 0x00, /* 84 */ |
| 104 | 0x00, 0x00, 0x00, 0x00, /* 88 */ |
| 105 | 0x00, 0x00, 0x00, 0x00, /* 92 */ |
| 106 | 0x00, 0x00, 0x00, 0x00, /* 96 */ |
| 107 | 0x00, 0x00, 0x02, /* 100 */ |
| 108 | }; |
| 109 | |
| 110 | /* |
| 111 | * read aic3x register cache |
| 112 | */ |
| 113 | static inline unsigned int aic3x_read_reg_cache(struct snd_soc_codec *codec, |
| 114 | unsigned int reg) |
| 115 | { |
| 116 | u8 *cache = codec->reg_cache; |
| 117 | if (reg >= AIC3X_CACHEREGNUM) |
| 118 | return -1; |
| 119 | return cache[reg]; |
| 120 | } |
| 121 | |
| 122 | /* |
| 123 | * write aic3x register cache |
| 124 | */ |
| 125 | static inline void aic3x_write_reg_cache(struct snd_soc_codec *codec, |
| 126 | u8 reg, u8 value) |
| 127 | { |
| 128 | u8 *cache = codec->reg_cache; |
| 129 | if (reg >= AIC3X_CACHEREGNUM) |
| 130 | return; |
| 131 | cache[reg] = value; |
| 132 | } |
| 133 | |
| 134 | /* |
| 135 | * write to the aic3x register space |
| 136 | */ |
| 137 | static int aic3x_write(struct snd_soc_codec *codec, unsigned int reg, |
| 138 | unsigned int value) |
| 139 | { |
| 140 | u8 data[2]; |
| 141 | |
| 142 | /* data is |
| 143 | * D15..D8 aic3x register offset |
| 144 | * D7...D0 register data |
| 145 | */ |
| 146 | data[0] = reg & 0xff; |
| 147 | data[1] = value & 0xff; |
| 148 | |
| 149 | aic3x_write_reg_cache(codec, data[0], data[1]); |
| 150 | if (codec->hw_write(codec->control_data, data, 2) == 2) |
| 151 | return 0; |
| 152 | else |
| 153 | return -EIO; |
| 154 | } |
| 155 | |
Daniel Mack | 54e7e61 | 2008-04-30 16:20:52 +0200 | [diff] [blame] | 156 | /* |
| 157 | * read from the aic3x register space |
| 158 | */ |
| 159 | static int aic3x_read(struct snd_soc_codec *codec, unsigned int reg, |
| 160 | u8 *value) |
| 161 | { |
| 162 | *value = reg & 0xff; |
Mark Brown | 5f34534 | 2009-07-05 17:35:28 +0100 | [diff] [blame] | 163 | |
| 164 | value[0] = i2c_smbus_read_byte_data(codec->control_data, value[0]); |
Daniel Mack | 54e7e61 | 2008-04-30 16:20:52 +0200 | [diff] [blame] | 165 | |
| 166 | aic3x_write_reg_cache(codec, reg, *value); |
| 167 | return 0; |
| 168 | } |
| 169 | |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 170 | #define SOC_DAPM_SINGLE_AIC3X(xname, reg, shift, mask, invert) \ |
| 171 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ |
| 172 | .info = snd_soc_info_volsw, \ |
| 173 | .get = snd_soc_dapm_get_volsw, .put = snd_soc_dapm_put_volsw_aic3x, \ |
| 174 | .private_value = SOC_SINGLE_VALUE(reg, shift, mask, invert) } |
| 175 | |
| 176 | /* |
| 177 | * All input lines are connected when !0xf and disconnected with 0xf bit field, |
| 178 | * so we have to use specific dapm_put call for input mixer |
| 179 | */ |
| 180 | static int snd_soc_dapm_put_volsw_aic3x(struct snd_kcontrol *kcontrol, |
| 181 | struct snd_ctl_elem_value *ucontrol) |
| 182 | { |
| 183 | struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol); |
Eero Nurkkala | 4453dba | 2009-02-06 12:01:04 +0200 | [diff] [blame] | 184 | struct soc_mixer_control *mc = |
| 185 | (struct soc_mixer_control *)kcontrol->private_value; |
| 186 | unsigned int reg = mc->reg; |
| 187 | unsigned int shift = mc->shift; |
| 188 | int max = mc->max; |
| 189 | unsigned int mask = (1 << fls(max)) - 1; |
| 190 | unsigned int invert = mc->invert; |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 191 | unsigned short val, val_mask; |
| 192 | int ret; |
| 193 | struct snd_soc_dapm_path *path; |
| 194 | int found = 0; |
| 195 | |
| 196 | val = (ucontrol->value.integer.value[0] & mask); |
| 197 | |
| 198 | mask = 0xf; |
| 199 | if (val) |
| 200 | val = mask; |
| 201 | |
| 202 | if (invert) |
| 203 | val = mask - val; |
| 204 | val_mask = mask << shift; |
| 205 | val = val << shift; |
| 206 | |
| 207 | mutex_lock(&widget->codec->mutex); |
| 208 | |
| 209 | if (snd_soc_test_bits(widget->codec, reg, val_mask, val)) { |
| 210 | /* find dapm widget path assoc with kcontrol */ |
| 211 | list_for_each_entry(path, &widget->codec->dapm_paths, list) { |
| 212 | if (path->kcontrol != kcontrol) |
| 213 | continue; |
| 214 | |
| 215 | /* found, now check type */ |
| 216 | found = 1; |
| 217 | if (val) |
| 218 | /* new connection */ |
| 219 | path->connect = invert ? 0 : 1; |
| 220 | else |
| 221 | /* old connection must be powered down */ |
| 222 | path->connect = invert ? 1 : 0; |
| 223 | break; |
| 224 | } |
| 225 | |
| 226 | if (found) |
Liam Girdwood | a530218 | 2008-07-07 13:35:17 +0100 | [diff] [blame] | 227 | snd_soc_dapm_sync(widget->codec); |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 228 | } |
| 229 | |
| 230 | ret = snd_soc_update_bits(widget->codec, reg, val_mask, val); |
| 231 | |
| 232 | mutex_unlock(&widget->codec->mutex); |
| 233 | return ret; |
| 234 | } |
| 235 | |
| 236 | static const char *aic3x_left_dac_mux[] = { "DAC_L1", "DAC_L3", "DAC_L2" }; |
| 237 | static const char *aic3x_right_dac_mux[] = { "DAC_R1", "DAC_R3", "DAC_R2" }; |
| 238 | static const char *aic3x_left_hpcom_mux[] = |
| 239 | { "differential of HPLOUT", "constant VCM", "single-ended" }; |
| 240 | static const char *aic3x_right_hpcom_mux[] = |
| 241 | { "differential of HPROUT", "constant VCM", "single-ended", |
| 242 | "differential of HPLCOM", "external feedback" }; |
| 243 | static const char *aic3x_linein_mode_mux[] = { "single-ended", "differential" }; |
Jarkko Nikula | 4d20f70 | 2008-06-27 14:07:57 +0300 | [diff] [blame] | 244 | static const char *aic3x_adc_hpf[] = |
| 245 | { "Disabled", "0.0045xFs", "0.0125xFs", "0.025xFs" }; |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 246 | |
| 247 | #define LDAC_ENUM 0 |
| 248 | #define RDAC_ENUM 1 |
| 249 | #define LHPCOM_ENUM 2 |
| 250 | #define RHPCOM_ENUM 3 |
| 251 | #define LINE1L_ENUM 4 |
| 252 | #define LINE1R_ENUM 5 |
| 253 | #define LINE2L_ENUM 6 |
| 254 | #define LINE2R_ENUM 7 |
Jarkko Nikula | 4d20f70 | 2008-06-27 14:07:57 +0300 | [diff] [blame] | 255 | #define ADC_HPF_ENUM 8 |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 256 | |
| 257 | static const struct soc_enum aic3x_enum[] = { |
| 258 | SOC_ENUM_SINGLE(DAC_LINE_MUX, 6, 3, aic3x_left_dac_mux), |
| 259 | SOC_ENUM_SINGLE(DAC_LINE_MUX, 4, 3, aic3x_right_dac_mux), |
| 260 | SOC_ENUM_SINGLE(HPLCOM_CFG, 4, 3, aic3x_left_hpcom_mux), |
| 261 | SOC_ENUM_SINGLE(HPRCOM_CFG, 3, 5, aic3x_right_hpcom_mux), |
| 262 | SOC_ENUM_SINGLE(LINE1L_2_LADC_CTRL, 7, 2, aic3x_linein_mode_mux), |
| 263 | SOC_ENUM_SINGLE(LINE1R_2_RADC_CTRL, 7, 2, aic3x_linein_mode_mux), |
| 264 | SOC_ENUM_SINGLE(LINE2L_2_LADC_CTRL, 7, 2, aic3x_linein_mode_mux), |
| 265 | SOC_ENUM_SINGLE(LINE2R_2_RADC_CTRL, 7, 2, aic3x_linein_mode_mux), |
Jarkko Nikula | 4d20f70 | 2008-06-27 14:07:57 +0300 | [diff] [blame] | 266 | SOC_ENUM_DOUBLE(AIC3X_CODEC_DFILT_CTRL, 6, 4, 4, aic3x_adc_hpf), |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 267 | }; |
| 268 | |
Jarkko Nikula | 7565fc3 | 2009-02-09 14:27:07 +0200 | [diff] [blame] | 269 | /* |
| 270 | * DAC digital volumes. From -63.5 to 0 dB in 0.5 dB steps |
| 271 | */ |
| 272 | static DECLARE_TLV_DB_SCALE(dac_tlv, -6350, 50, 0); |
| 273 | /* ADC PGA gain volumes. From 0 to 59.5 dB in 0.5 dB steps */ |
| 274 | static DECLARE_TLV_DB_SCALE(adc_tlv, 0, 50, 0); |
| 275 | /* |
| 276 | * Output stage volumes. From -78.3 to 0 dB. Muted below -78.3 dB. |
| 277 | * Step size is approximately 0.5 dB over most of the scale but increasing |
| 278 | * near the very low levels. |
| 279 | * Define dB scale so that it is mostly correct for range about -55 to 0 dB |
| 280 | * but having increasing dB difference below that (and where it doesn't count |
| 281 | * so much). This setting shows -50 dB (actual is -50.3 dB) for register |
| 282 | * value 100 and -58.5 dB (actual is -78.3 dB) for register value 117. |
| 283 | */ |
| 284 | static DECLARE_TLV_DB_SCALE(output_stage_tlv, -5900, 50, 1); |
| 285 | |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 286 | static const struct snd_kcontrol_new aic3x_snd_controls[] = { |
| 287 | /* Output */ |
Jarkko Nikula | 7565fc3 | 2009-02-09 14:27:07 +0200 | [diff] [blame] | 288 | SOC_DOUBLE_R_TLV("PCM Playback Volume", |
| 289 | LDAC_VOL, RDAC_VOL, 0, 0x7f, 1, dac_tlv), |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 290 | |
Jarkko Nikula | 7565fc3 | 2009-02-09 14:27:07 +0200 | [diff] [blame] | 291 | SOC_DOUBLE_R_TLV("Line DAC Playback Volume", |
| 292 | DACL1_2_LLOPM_VOL, DACR1_2_RLOPM_VOL, |
| 293 | 0, 118, 1, output_stage_tlv), |
Daniel Mack | 28a1d86 | 2008-12-05 17:31:00 +0100 | [diff] [blame] | 294 | SOC_SINGLE("LineL Playback Switch", LLOPM_CTRL, 3, 0x01, 0), |
| 295 | SOC_SINGLE("LineR Playback Switch", RLOPM_CTRL, 3, 0x01, 0), |
Jarkko Nikula | 7565fc3 | 2009-02-09 14:27:07 +0200 | [diff] [blame] | 296 | SOC_DOUBLE_R_TLV("LineL DAC Playback Volume", |
| 297 | DACL1_2_LLOPM_VOL, DACR1_2_LLOPM_VOL, |
| 298 | 0, 118, 1, output_stage_tlv), |
| 299 | SOC_SINGLE_TLV("LineL Left PGA Bypass Playback Volume", |
| 300 | PGAL_2_LLOPM_VOL, 0, 118, 1, output_stage_tlv), |
| 301 | SOC_SINGLE_TLV("LineR Right PGA Bypass Playback Volume", |
| 302 | PGAR_2_RLOPM_VOL, 0, 118, 1, output_stage_tlv), |
| 303 | SOC_DOUBLE_R_TLV("LineL Line2 Bypass Playback Volume", |
| 304 | LINE2L_2_LLOPM_VOL, LINE2R_2_LLOPM_VOL, |
| 305 | 0, 118, 1, output_stage_tlv), |
| 306 | SOC_DOUBLE_R_TLV("LineR Line2 Bypass Playback Volume", |
| 307 | LINE2L_2_RLOPM_VOL, LINE2R_2_RLOPM_VOL, |
| 308 | 0, 118, 1, output_stage_tlv), |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 309 | |
Jarkko Nikula | 7565fc3 | 2009-02-09 14:27:07 +0200 | [diff] [blame] | 310 | SOC_DOUBLE_R_TLV("Mono DAC Playback Volume", |
| 311 | DACL1_2_MONOLOPM_VOL, DACR1_2_MONOLOPM_VOL, |
| 312 | 0, 118, 1, output_stage_tlv), |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 313 | SOC_SINGLE("Mono DAC Playback Switch", MONOLOPM_CTRL, 3, 0x01, 0), |
Jarkko Nikula | 7565fc3 | 2009-02-09 14:27:07 +0200 | [diff] [blame] | 314 | SOC_DOUBLE_R_TLV("Mono PGA Bypass Playback Volume", |
| 315 | PGAL_2_MONOLOPM_VOL, PGAR_2_MONOLOPM_VOL, |
| 316 | 0, 118, 1, output_stage_tlv), |
| 317 | SOC_DOUBLE_R_TLV("Mono Line2 Bypass Playback Volume", |
| 318 | LINE2L_2_MONOLOPM_VOL, LINE2R_2_MONOLOPM_VOL, |
| 319 | 0, 118, 1, output_stage_tlv), |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 320 | |
Jarkko Nikula | 7565fc3 | 2009-02-09 14:27:07 +0200 | [diff] [blame] | 321 | SOC_DOUBLE_R_TLV("HP DAC Playback Volume", |
| 322 | DACL1_2_HPLOUT_VOL, DACR1_2_HPROUT_VOL, |
| 323 | 0, 118, 1, output_stage_tlv), |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 324 | SOC_DOUBLE_R("HP DAC Playback Switch", HPLOUT_CTRL, HPROUT_CTRL, 3, |
| 325 | 0x01, 0), |
Jarkko Nikula | 7565fc3 | 2009-02-09 14:27:07 +0200 | [diff] [blame] | 326 | SOC_DOUBLE_R_TLV("HP Right PGA Bypass Playback Volume", |
| 327 | PGAR_2_HPLOUT_VOL, PGAR_2_HPROUT_VOL, |
| 328 | 0, 118, 1, output_stage_tlv), |
| 329 | SOC_SINGLE_TLV("HPL PGA Bypass Playback Volume", |
| 330 | PGAL_2_HPLOUT_VOL, 0, 118, 1, output_stage_tlv), |
| 331 | SOC_SINGLE_TLV("HPR PGA Bypass Playback Volume", |
| 332 | PGAL_2_HPROUT_VOL, 0, 118, 1, output_stage_tlv), |
| 333 | SOC_DOUBLE_R_TLV("HP Line2 Bypass Playback Volume", |
| 334 | LINE2L_2_HPLOUT_VOL, LINE2R_2_HPROUT_VOL, |
| 335 | 0, 118, 1, output_stage_tlv), |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 336 | |
Jarkko Nikula | 7565fc3 | 2009-02-09 14:27:07 +0200 | [diff] [blame] | 337 | SOC_DOUBLE_R_TLV("HPCOM DAC Playback Volume", |
| 338 | DACL1_2_HPLCOM_VOL, DACR1_2_HPRCOM_VOL, |
| 339 | 0, 118, 1, output_stage_tlv), |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 340 | SOC_DOUBLE_R("HPCOM DAC Playback Switch", HPLCOM_CTRL, HPRCOM_CTRL, 3, |
| 341 | 0x01, 0), |
Jarkko Nikula | 7565fc3 | 2009-02-09 14:27:07 +0200 | [diff] [blame] | 342 | SOC_SINGLE_TLV("HPLCOM PGA Bypass Playback Volume", |
| 343 | PGAL_2_HPLCOM_VOL, 0, 118, 1, output_stage_tlv), |
| 344 | SOC_SINGLE_TLV("HPRCOM PGA Bypass Playback Volume", |
| 345 | PGAL_2_HPRCOM_VOL, 0, 118, 1, output_stage_tlv), |
| 346 | SOC_DOUBLE_R_TLV("HPCOM Line2 Bypass Playback Volume", |
| 347 | LINE2L_2_HPLCOM_VOL, LINE2R_2_HPRCOM_VOL, |
| 348 | 0, 118, 1, output_stage_tlv), |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 349 | |
| 350 | /* |
| 351 | * Note: enable Automatic input Gain Controller with care. It can |
| 352 | * adjust PGA to max value when ADC is on and will never go back. |
| 353 | */ |
| 354 | SOC_DOUBLE_R("AGC Switch", LAGC_CTRL_A, RAGC_CTRL_A, 7, 0x01, 0), |
| 355 | |
| 356 | /* Input */ |
Jarkko Nikula | 7565fc3 | 2009-02-09 14:27:07 +0200 | [diff] [blame] | 357 | SOC_DOUBLE_R_TLV("PGA Capture Volume", LADC_VOL, RADC_VOL, |
| 358 | 0, 119, 0, adc_tlv), |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 359 | SOC_DOUBLE_R("PGA Capture Switch", LADC_VOL, RADC_VOL, 7, 0x01, 1), |
Jarkko Nikula | 4d20f70 | 2008-06-27 14:07:57 +0300 | [diff] [blame] | 360 | |
| 361 | SOC_ENUM("ADC HPF Cut-off", aic3x_enum[ADC_HPF_ENUM]), |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 362 | }; |
| 363 | |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 364 | /* Left DAC Mux */ |
| 365 | static const struct snd_kcontrol_new aic3x_left_dac_mux_controls = |
| 366 | SOC_DAPM_ENUM("Route", aic3x_enum[LDAC_ENUM]); |
| 367 | |
| 368 | /* Right DAC Mux */ |
| 369 | static const struct snd_kcontrol_new aic3x_right_dac_mux_controls = |
| 370 | SOC_DAPM_ENUM("Route", aic3x_enum[RDAC_ENUM]); |
| 371 | |
| 372 | /* Left HPCOM Mux */ |
| 373 | static const struct snd_kcontrol_new aic3x_left_hpcom_mux_controls = |
| 374 | SOC_DAPM_ENUM("Route", aic3x_enum[LHPCOM_ENUM]); |
| 375 | |
| 376 | /* Right HPCOM Mux */ |
| 377 | static const struct snd_kcontrol_new aic3x_right_hpcom_mux_controls = |
| 378 | SOC_DAPM_ENUM("Route", aic3x_enum[RHPCOM_ENUM]); |
| 379 | |
| 380 | /* Left DAC_L1 Mixer */ |
| 381 | static const struct snd_kcontrol_new aic3x_left_dac_mixer_controls[] = { |
Daniel Mack | 54f0191 | 2008-11-26 17:47:36 +0100 | [diff] [blame] | 382 | SOC_DAPM_SINGLE("LineL Switch", DACL1_2_LLOPM_VOL, 7, 1, 0), |
| 383 | SOC_DAPM_SINGLE("LineR Switch", DACL1_2_RLOPM_VOL, 7, 1, 0), |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 384 | SOC_DAPM_SINGLE("Mono Switch", DACL1_2_MONOLOPM_VOL, 7, 1, 0), |
| 385 | SOC_DAPM_SINGLE("HP Switch", DACL1_2_HPLOUT_VOL, 7, 1, 0), |
| 386 | SOC_DAPM_SINGLE("HPCOM Switch", DACL1_2_HPLCOM_VOL, 7, 1, 0), |
| 387 | }; |
| 388 | |
| 389 | /* Right DAC_R1 Mixer */ |
| 390 | static const struct snd_kcontrol_new aic3x_right_dac_mixer_controls[] = { |
Daniel Mack | 54f0191 | 2008-11-26 17:47:36 +0100 | [diff] [blame] | 391 | SOC_DAPM_SINGLE("LineL Switch", DACR1_2_LLOPM_VOL, 7, 1, 0), |
| 392 | SOC_DAPM_SINGLE("LineR Switch", DACR1_2_RLOPM_VOL, 7, 1, 0), |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 393 | SOC_DAPM_SINGLE("Mono Switch", DACR1_2_MONOLOPM_VOL, 7, 1, 0), |
| 394 | SOC_DAPM_SINGLE("HP Switch", DACR1_2_HPROUT_VOL, 7, 1, 0), |
| 395 | SOC_DAPM_SINGLE("HPCOM Switch", DACR1_2_HPRCOM_VOL, 7, 1, 0), |
| 396 | }; |
| 397 | |
| 398 | /* Left PGA Mixer */ |
| 399 | static const struct snd_kcontrol_new aic3x_left_pga_mixer_controls[] = { |
| 400 | SOC_DAPM_SINGLE_AIC3X("Line1L Switch", LINE1L_2_LADC_CTRL, 3, 1, 1), |
Daniel Mack | 54f0191 | 2008-11-26 17:47:36 +0100 | [diff] [blame] | 401 | SOC_DAPM_SINGLE_AIC3X("Line1R Switch", LINE1R_2_LADC_CTRL, 3, 1, 1), |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 402 | SOC_DAPM_SINGLE_AIC3X("Line2L Switch", LINE2L_2_LADC_CTRL, 3, 1, 1), |
| 403 | SOC_DAPM_SINGLE_AIC3X("Mic3L Switch", MIC3LR_2_LADC_CTRL, 4, 1, 1), |
Daniel Mack | 54f0191 | 2008-11-26 17:47:36 +0100 | [diff] [blame] | 404 | SOC_DAPM_SINGLE_AIC3X("Mic3R Switch", MIC3LR_2_LADC_CTRL, 0, 1, 1), |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 405 | }; |
| 406 | |
| 407 | /* Right PGA Mixer */ |
| 408 | static const struct snd_kcontrol_new aic3x_right_pga_mixer_controls[] = { |
| 409 | SOC_DAPM_SINGLE_AIC3X("Line1R Switch", LINE1R_2_RADC_CTRL, 3, 1, 1), |
Daniel Mack | 54f0191 | 2008-11-26 17:47:36 +0100 | [diff] [blame] | 410 | SOC_DAPM_SINGLE_AIC3X("Line1L Switch", LINE1L_2_RADC_CTRL, 3, 1, 1), |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 411 | SOC_DAPM_SINGLE_AIC3X("Line2R Switch", LINE2R_2_RADC_CTRL, 3, 1, 1), |
Daniel Mack | 54f0191 | 2008-11-26 17:47:36 +0100 | [diff] [blame] | 412 | SOC_DAPM_SINGLE_AIC3X("Mic3L Switch", MIC3LR_2_RADC_CTRL, 4, 1, 1), |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 413 | SOC_DAPM_SINGLE_AIC3X("Mic3R Switch", MIC3LR_2_RADC_CTRL, 0, 1, 1), |
| 414 | }; |
| 415 | |
| 416 | /* Left Line1 Mux */ |
| 417 | static const struct snd_kcontrol_new aic3x_left_line1_mux_controls = |
| 418 | SOC_DAPM_ENUM("Route", aic3x_enum[LINE1L_ENUM]); |
| 419 | |
| 420 | /* Right Line1 Mux */ |
| 421 | static const struct snd_kcontrol_new aic3x_right_line1_mux_controls = |
| 422 | SOC_DAPM_ENUM("Route", aic3x_enum[LINE1R_ENUM]); |
| 423 | |
| 424 | /* Left Line2 Mux */ |
| 425 | static const struct snd_kcontrol_new aic3x_left_line2_mux_controls = |
| 426 | SOC_DAPM_ENUM("Route", aic3x_enum[LINE2L_ENUM]); |
| 427 | |
| 428 | /* Right Line2 Mux */ |
| 429 | static const struct snd_kcontrol_new aic3x_right_line2_mux_controls = |
| 430 | SOC_DAPM_ENUM("Route", aic3x_enum[LINE2R_ENUM]); |
| 431 | |
| 432 | /* Left PGA Bypass Mixer */ |
| 433 | static const struct snd_kcontrol_new aic3x_left_pga_bp_mixer_controls[] = { |
Daniel Mack | 54f0191 | 2008-11-26 17:47:36 +0100 | [diff] [blame] | 434 | SOC_DAPM_SINGLE("LineL Switch", PGAL_2_LLOPM_VOL, 7, 1, 0), |
| 435 | SOC_DAPM_SINGLE("LineR Switch", PGAL_2_RLOPM_VOL, 7, 1, 0), |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 436 | SOC_DAPM_SINGLE("Mono Switch", PGAL_2_MONOLOPM_VOL, 7, 1, 0), |
Daniel Mack | 54f0191 | 2008-11-26 17:47:36 +0100 | [diff] [blame] | 437 | SOC_DAPM_SINGLE("HPL Switch", PGAL_2_HPLOUT_VOL, 7, 1, 0), |
| 438 | SOC_DAPM_SINGLE("HPR Switch", PGAL_2_HPROUT_VOL, 7, 1, 0), |
| 439 | SOC_DAPM_SINGLE("HPLCOM Switch", PGAL_2_HPLCOM_VOL, 7, 1, 0), |
| 440 | SOC_DAPM_SINGLE("HPRCOM Switch", PGAL_2_HPRCOM_VOL, 7, 1, 0), |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 441 | }; |
| 442 | |
| 443 | /* Right PGA Bypass Mixer */ |
| 444 | static const struct snd_kcontrol_new aic3x_right_pga_bp_mixer_controls[] = { |
Daniel Mack | 54f0191 | 2008-11-26 17:47:36 +0100 | [diff] [blame] | 445 | SOC_DAPM_SINGLE("LineL Switch", PGAR_2_LLOPM_VOL, 7, 1, 0), |
| 446 | SOC_DAPM_SINGLE("LineR Switch", PGAR_2_RLOPM_VOL, 7, 1, 0), |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 447 | SOC_DAPM_SINGLE("Mono Switch", PGAR_2_MONOLOPM_VOL, 7, 1, 0), |
Daniel Mack | 54f0191 | 2008-11-26 17:47:36 +0100 | [diff] [blame] | 448 | SOC_DAPM_SINGLE("HPL Switch", PGAR_2_HPLOUT_VOL, 7, 1, 0), |
| 449 | SOC_DAPM_SINGLE("HPR Switch", PGAR_2_HPROUT_VOL, 7, 1, 0), |
| 450 | SOC_DAPM_SINGLE("HPLCOM Switch", PGAR_2_HPLCOM_VOL, 7, 1, 0), |
| 451 | SOC_DAPM_SINGLE("HPRCOM Switch", PGAR_2_HPRCOM_VOL, 7, 1, 0), |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 452 | }; |
| 453 | |
| 454 | /* Left Line2 Bypass Mixer */ |
| 455 | static const struct snd_kcontrol_new aic3x_left_line2_bp_mixer_controls[] = { |
Daniel Mack | 54f0191 | 2008-11-26 17:47:36 +0100 | [diff] [blame] | 456 | SOC_DAPM_SINGLE("LineL Switch", LINE2L_2_LLOPM_VOL, 7, 1, 0), |
| 457 | SOC_DAPM_SINGLE("LineR Switch", LINE2L_2_RLOPM_VOL, 7, 1, 0), |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 458 | SOC_DAPM_SINGLE("Mono Switch", LINE2L_2_MONOLOPM_VOL, 7, 1, 0), |
| 459 | SOC_DAPM_SINGLE("HP Switch", LINE2L_2_HPLOUT_VOL, 7, 1, 0), |
Daniel Mack | 54f0191 | 2008-11-26 17:47:36 +0100 | [diff] [blame] | 460 | SOC_DAPM_SINGLE("HPLCOM Switch", LINE2L_2_HPLCOM_VOL, 7, 1, 0), |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 461 | }; |
| 462 | |
| 463 | /* Right Line2 Bypass Mixer */ |
| 464 | static const struct snd_kcontrol_new aic3x_right_line2_bp_mixer_controls[] = { |
Daniel Mack | 54f0191 | 2008-11-26 17:47:36 +0100 | [diff] [blame] | 465 | SOC_DAPM_SINGLE("LineL Switch", LINE2R_2_LLOPM_VOL, 7, 1, 0), |
| 466 | SOC_DAPM_SINGLE("LineR Switch", LINE2R_2_RLOPM_VOL, 7, 1, 0), |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 467 | SOC_DAPM_SINGLE("Mono Switch", LINE2R_2_MONOLOPM_VOL, 7, 1, 0), |
| 468 | SOC_DAPM_SINGLE("HP Switch", LINE2R_2_HPROUT_VOL, 7, 1, 0), |
Daniel Mack | 54f0191 | 2008-11-26 17:47:36 +0100 | [diff] [blame] | 469 | SOC_DAPM_SINGLE("HPRCOM Switch", LINE2R_2_HPRCOM_VOL, 7, 1, 0), |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 470 | }; |
| 471 | |
| 472 | static const struct snd_soc_dapm_widget aic3x_dapm_widgets[] = { |
| 473 | /* Left DAC to Left Outputs */ |
| 474 | SND_SOC_DAPM_DAC("Left DAC", "Left Playback", DAC_PWR, 7, 0), |
| 475 | SND_SOC_DAPM_MUX("Left DAC Mux", SND_SOC_NOPM, 0, 0, |
| 476 | &aic3x_left_dac_mux_controls), |
| 477 | SND_SOC_DAPM_MIXER("Left DAC_L1 Mixer", SND_SOC_NOPM, 0, 0, |
| 478 | &aic3x_left_dac_mixer_controls[0], |
| 479 | ARRAY_SIZE(aic3x_left_dac_mixer_controls)), |
| 480 | SND_SOC_DAPM_MUX("Left HPCOM Mux", SND_SOC_NOPM, 0, 0, |
| 481 | &aic3x_left_hpcom_mux_controls), |
| 482 | SND_SOC_DAPM_PGA("Left Line Out", LLOPM_CTRL, 0, 0, NULL, 0), |
| 483 | SND_SOC_DAPM_PGA("Left HP Out", HPLOUT_CTRL, 0, 0, NULL, 0), |
| 484 | SND_SOC_DAPM_PGA("Left HP Com", HPLCOM_CTRL, 0, 0, NULL, 0), |
| 485 | |
| 486 | /* Right DAC to Right Outputs */ |
| 487 | SND_SOC_DAPM_DAC("Right DAC", "Right Playback", DAC_PWR, 6, 0), |
| 488 | SND_SOC_DAPM_MUX("Right DAC Mux", SND_SOC_NOPM, 0, 0, |
| 489 | &aic3x_right_dac_mux_controls), |
| 490 | SND_SOC_DAPM_MIXER("Right DAC_R1 Mixer", SND_SOC_NOPM, 0, 0, |
| 491 | &aic3x_right_dac_mixer_controls[0], |
| 492 | ARRAY_SIZE(aic3x_right_dac_mixer_controls)), |
| 493 | SND_SOC_DAPM_MUX("Right HPCOM Mux", SND_SOC_NOPM, 0, 0, |
| 494 | &aic3x_right_hpcom_mux_controls), |
| 495 | SND_SOC_DAPM_PGA("Right Line Out", RLOPM_CTRL, 0, 0, NULL, 0), |
| 496 | SND_SOC_DAPM_PGA("Right HP Out", HPROUT_CTRL, 0, 0, NULL, 0), |
| 497 | SND_SOC_DAPM_PGA("Right HP Com", HPRCOM_CTRL, 0, 0, NULL, 0), |
| 498 | |
| 499 | /* Mono Output */ |
| 500 | SND_SOC_DAPM_PGA("Mono Out", MONOLOPM_CTRL, 0, 0, NULL, 0), |
| 501 | |
Daniel Mack | 54f0191 | 2008-11-26 17:47:36 +0100 | [diff] [blame] | 502 | /* Inputs to Left ADC */ |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 503 | SND_SOC_DAPM_ADC("Left ADC", "Left Capture", LINE1L_2_LADC_CTRL, 2, 0), |
| 504 | SND_SOC_DAPM_MIXER("Left PGA Mixer", SND_SOC_NOPM, 0, 0, |
| 505 | &aic3x_left_pga_mixer_controls[0], |
| 506 | ARRAY_SIZE(aic3x_left_pga_mixer_controls)), |
| 507 | SND_SOC_DAPM_MUX("Left Line1L Mux", SND_SOC_NOPM, 0, 0, |
| 508 | &aic3x_left_line1_mux_controls), |
Daniel Mack | 54f0191 | 2008-11-26 17:47:36 +0100 | [diff] [blame] | 509 | SND_SOC_DAPM_MUX("Left Line1R Mux", SND_SOC_NOPM, 0, 0, |
| 510 | &aic3x_left_line1_mux_controls), |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 511 | SND_SOC_DAPM_MUX("Left Line2L Mux", SND_SOC_NOPM, 0, 0, |
| 512 | &aic3x_left_line2_mux_controls), |
| 513 | |
Daniel Mack | 54f0191 | 2008-11-26 17:47:36 +0100 | [diff] [blame] | 514 | /* Inputs to Right ADC */ |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 515 | SND_SOC_DAPM_ADC("Right ADC", "Right Capture", |
| 516 | LINE1R_2_RADC_CTRL, 2, 0), |
| 517 | SND_SOC_DAPM_MIXER("Right PGA Mixer", SND_SOC_NOPM, 0, 0, |
| 518 | &aic3x_right_pga_mixer_controls[0], |
| 519 | ARRAY_SIZE(aic3x_right_pga_mixer_controls)), |
Daniel Mack | 54f0191 | 2008-11-26 17:47:36 +0100 | [diff] [blame] | 520 | SND_SOC_DAPM_MUX("Right Line1L Mux", SND_SOC_NOPM, 0, 0, |
| 521 | &aic3x_right_line1_mux_controls), |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 522 | SND_SOC_DAPM_MUX("Right Line1R Mux", SND_SOC_NOPM, 0, 0, |
| 523 | &aic3x_right_line1_mux_controls), |
| 524 | SND_SOC_DAPM_MUX("Right Line2R Mux", SND_SOC_NOPM, 0, 0, |
| 525 | &aic3x_right_line2_mux_controls), |
| 526 | |
Jarkko Nikula | ee15ffd | 2008-06-25 14:58:46 +0300 | [diff] [blame] | 527 | /* |
| 528 | * Not a real mic bias widget but similar function. This is for dynamic |
| 529 | * control of GPIO1 digital mic modulator clock output function when |
| 530 | * using digital mic. |
| 531 | */ |
| 532 | SND_SOC_DAPM_REG(snd_soc_dapm_micbias, "GPIO1 dmic modclk", |
| 533 | AIC3X_GPIO1_REG, 4, 0xf, |
| 534 | AIC3X_GPIO1_FUNC_DIGITAL_MIC_MODCLK, |
| 535 | AIC3X_GPIO1_FUNC_DISABLED), |
| 536 | |
| 537 | /* |
| 538 | * Also similar function like mic bias. Selects digital mic with |
| 539 | * configurable oversampling rate instead of ADC converter. |
| 540 | */ |
| 541 | SND_SOC_DAPM_REG(snd_soc_dapm_micbias, "DMic Rate 128", |
| 542 | AIC3X_ASD_INTF_CTRLA, 0, 3, 1, 0), |
| 543 | SND_SOC_DAPM_REG(snd_soc_dapm_micbias, "DMic Rate 64", |
| 544 | AIC3X_ASD_INTF_CTRLA, 0, 3, 2, 0), |
| 545 | SND_SOC_DAPM_REG(snd_soc_dapm_micbias, "DMic Rate 32", |
| 546 | AIC3X_ASD_INTF_CTRLA, 0, 3, 3, 0), |
| 547 | |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 548 | /* Mic Bias */ |
Jarkko Nikula | 0bd72a3 | 2008-06-25 14:42:08 +0300 | [diff] [blame] | 549 | SND_SOC_DAPM_REG(snd_soc_dapm_micbias, "Mic Bias 2V", |
| 550 | MICBIAS_CTRL, 6, 3, 1, 0), |
| 551 | SND_SOC_DAPM_REG(snd_soc_dapm_micbias, "Mic Bias 2.5V", |
| 552 | MICBIAS_CTRL, 6, 3, 2, 0), |
| 553 | SND_SOC_DAPM_REG(snd_soc_dapm_micbias, "Mic Bias AVDD", |
| 554 | MICBIAS_CTRL, 6, 3, 3, 0), |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 555 | |
| 556 | /* Left PGA to Left Output bypass */ |
| 557 | SND_SOC_DAPM_MIXER("Left PGA Bypass Mixer", SND_SOC_NOPM, 0, 0, |
| 558 | &aic3x_left_pga_bp_mixer_controls[0], |
| 559 | ARRAY_SIZE(aic3x_left_pga_bp_mixer_controls)), |
| 560 | |
| 561 | /* Right PGA to Right Output bypass */ |
| 562 | SND_SOC_DAPM_MIXER("Right PGA Bypass Mixer", SND_SOC_NOPM, 0, 0, |
| 563 | &aic3x_right_pga_bp_mixer_controls[0], |
| 564 | ARRAY_SIZE(aic3x_right_pga_bp_mixer_controls)), |
| 565 | |
| 566 | /* Left Line2 to Left Output bypass */ |
| 567 | SND_SOC_DAPM_MIXER("Left Line2 Bypass Mixer", SND_SOC_NOPM, 0, 0, |
| 568 | &aic3x_left_line2_bp_mixer_controls[0], |
| 569 | ARRAY_SIZE(aic3x_left_line2_bp_mixer_controls)), |
| 570 | |
| 571 | /* Right Line2 to Right Output bypass */ |
| 572 | SND_SOC_DAPM_MIXER("Right Line2 Bypass Mixer", SND_SOC_NOPM, 0, 0, |
| 573 | &aic3x_right_line2_bp_mixer_controls[0], |
| 574 | ARRAY_SIZE(aic3x_right_line2_bp_mixer_controls)), |
| 575 | |
| 576 | SND_SOC_DAPM_OUTPUT("LLOUT"), |
| 577 | SND_SOC_DAPM_OUTPUT("RLOUT"), |
| 578 | SND_SOC_DAPM_OUTPUT("MONO_LOUT"), |
| 579 | SND_SOC_DAPM_OUTPUT("HPLOUT"), |
| 580 | SND_SOC_DAPM_OUTPUT("HPROUT"), |
| 581 | SND_SOC_DAPM_OUTPUT("HPLCOM"), |
| 582 | SND_SOC_DAPM_OUTPUT("HPRCOM"), |
| 583 | |
| 584 | SND_SOC_DAPM_INPUT("MIC3L"), |
| 585 | SND_SOC_DAPM_INPUT("MIC3R"), |
| 586 | SND_SOC_DAPM_INPUT("LINE1L"), |
| 587 | SND_SOC_DAPM_INPUT("LINE1R"), |
| 588 | SND_SOC_DAPM_INPUT("LINE2L"), |
| 589 | SND_SOC_DAPM_INPUT("LINE2R"), |
| 590 | }; |
| 591 | |
Mark Brown | d0cc0d3 | 2008-05-13 14:55:22 +0200 | [diff] [blame] | 592 | static const struct snd_soc_dapm_route intercon[] = { |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 593 | /* Left Output */ |
| 594 | {"Left DAC Mux", "DAC_L1", "Left DAC"}, |
| 595 | {"Left DAC Mux", "DAC_L2", "Left DAC"}, |
| 596 | {"Left DAC Mux", "DAC_L3", "Left DAC"}, |
| 597 | |
Daniel Mack | 54f0191 | 2008-11-26 17:47:36 +0100 | [diff] [blame] | 598 | {"Left DAC_L1 Mixer", "LineL Switch", "Left DAC Mux"}, |
| 599 | {"Left DAC_L1 Mixer", "LineR Switch", "Left DAC Mux"}, |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 600 | {"Left DAC_L1 Mixer", "Mono Switch", "Left DAC Mux"}, |
| 601 | {"Left DAC_L1 Mixer", "HP Switch", "Left DAC Mux"}, |
| 602 | {"Left DAC_L1 Mixer", "HPCOM Switch", "Left DAC Mux"}, |
| 603 | {"Left Line Out", NULL, "Left DAC Mux"}, |
| 604 | {"Left HP Out", NULL, "Left DAC Mux"}, |
| 605 | |
| 606 | {"Left HPCOM Mux", "differential of HPLOUT", "Left DAC_L1 Mixer"}, |
| 607 | {"Left HPCOM Mux", "constant VCM", "Left DAC_L1 Mixer"}, |
| 608 | {"Left HPCOM Mux", "single-ended", "Left DAC_L1 Mixer"}, |
| 609 | |
| 610 | {"Left Line Out", NULL, "Left DAC_L1 Mixer"}, |
| 611 | {"Mono Out", NULL, "Left DAC_L1 Mixer"}, |
| 612 | {"Left HP Out", NULL, "Left DAC_L1 Mixer"}, |
| 613 | {"Left HP Com", NULL, "Left HPCOM Mux"}, |
| 614 | |
| 615 | {"LLOUT", NULL, "Left Line Out"}, |
| 616 | {"LLOUT", NULL, "Left Line Out"}, |
| 617 | {"HPLOUT", NULL, "Left HP Out"}, |
| 618 | {"HPLCOM", NULL, "Left HP Com"}, |
| 619 | |
| 620 | /* Right Output */ |
| 621 | {"Right DAC Mux", "DAC_R1", "Right DAC"}, |
| 622 | {"Right DAC Mux", "DAC_R2", "Right DAC"}, |
| 623 | {"Right DAC Mux", "DAC_R3", "Right DAC"}, |
| 624 | |
Daniel Mack | 54f0191 | 2008-11-26 17:47:36 +0100 | [diff] [blame] | 625 | {"Right DAC_R1 Mixer", "LineL Switch", "Right DAC Mux"}, |
| 626 | {"Right DAC_R1 Mixer", "LineR Switch", "Right DAC Mux"}, |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 627 | {"Right DAC_R1 Mixer", "Mono Switch", "Right DAC Mux"}, |
| 628 | {"Right DAC_R1 Mixer", "HP Switch", "Right DAC Mux"}, |
| 629 | {"Right DAC_R1 Mixer", "HPCOM Switch", "Right DAC Mux"}, |
| 630 | {"Right Line Out", NULL, "Right DAC Mux"}, |
| 631 | {"Right HP Out", NULL, "Right DAC Mux"}, |
| 632 | |
| 633 | {"Right HPCOM Mux", "differential of HPROUT", "Right DAC_R1 Mixer"}, |
| 634 | {"Right HPCOM Mux", "constant VCM", "Right DAC_R1 Mixer"}, |
| 635 | {"Right HPCOM Mux", "single-ended", "Right DAC_R1 Mixer"}, |
| 636 | {"Right HPCOM Mux", "differential of HPLCOM", "Right DAC_R1 Mixer"}, |
| 637 | {"Right HPCOM Mux", "external feedback", "Right DAC_R1 Mixer"}, |
| 638 | |
| 639 | {"Right Line Out", NULL, "Right DAC_R1 Mixer"}, |
| 640 | {"Mono Out", NULL, "Right DAC_R1 Mixer"}, |
| 641 | {"Right HP Out", NULL, "Right DAC_R1 Mixer"}, |
| 642 | {"Right HP Com", NULL, "Right HPCOM Mux"}, |
| 643 | |
| 644 | {"RLOUT", NULL, "Right Line Out"}, |
| 645 | {"RLOUT", NULL, "Right Line Out"}, |
| 646 | {"HPROUT", NULL, "Right HP Out"}, |
| 647 | {"HPRCOM", NULL, "Right HP Com"}, |
| 648 | |
| 649 | /* Mono Output */ |
Jarkko Nikula | 5b00613 | 2008-05-09 15:05:41 +0200 | [diff] [blame] | 650 | {"MONO_LOUT", NULL, "Mono Out"}, |
| 651 | {"MONO_LOUT", NULL, "Mono Out"}, |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 652 | |
| 653 | /* Left Input */ |
| 654 | {"Left Line1L Mux", "single-ended", "LINE1L"}, |
| 655 | {"Left Line1L Mux", "differential", "LINE1L"}, |
| 656 | |
| 657 | {"Left Line2L Mux", "single-ended", "LINE2L"}, |
| 658 | {"Left Line2L Mux", "differential", "LINE2L"}, |
| 659 | |
| 660 | {"Left PGA Mixer", "Line1L Switch", "Left Line1L Mux"}, |
Daniel Mack | 54f0191 | 2008-11-26 17:47:36 +0100 | [diff] [blame] | 661 | {"Left PGA Mixer", "Line1R Switch", "Left Line1R Mux"}, |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 662 | {"Left PGA Mixer", "Line2L Switch", "Left Line2L Mux"}, |
| 663 | {"Left PGA Mixer", "Mic3L Switch", "MIC3L"}, |
Daniel Mack | 54f0191 | 2008-11-26 17:47:36 +0100 | [diff] [blame] | 664 | {"Left PGA Mixer", "Mic3R Switch", "MIC3R"}, |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 665 | |
| 666 | {"Left ADC", NULL, "Left PGA Mixer"}, |
Jarkko Nikula | ee15ffd | 2008-06-25 14:58:46 +0300 | [diff] [blame] | 667 | {"Left ADC", NULL, "GPIO1 dmic modclk"}, |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 668 | |
| 669 | /* Right Input */ |
| 670 | {"Right Line1R Mux", "single-ended", "LINE1R"}, |
| 671 | {"Right Line1R Mux", "differential", "LINE1R"}, |
| 672 | |
| 673 | {"Right Line2R Mux", "single-ended", "LINE2R"}, |
| 674 | {"Right Line2R Mux", "differential", "LINE2R"}, |
| 675 | |
Daniel Mack | 54f0191 | 2008-11-26 17:47:36 +0100 | [diff] [blame] | 676 | {"Right PGA Mixer", "Line1L Switch", "Right Line1L Mux"}, |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 677 | {"Right PGA Mixer", "Line1R Switch", "Right Line1R Mux"}, |
| 678 | {"Right PGA Mixer", "Line2R Switch", "Right Line2R Mux"}, |
Daniel Mack | 54f0191 | 2008-11-26 17:47:36 +0100 | [diff] [blame] | 679 | {"Right PGA Mixer", "Mic3L Switch", "MIC3L"}, |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 680 | {"Right PGA Mixer", "Mic3R Switch", "MIC3R"}, |
| 681 | |
| 682 | {"Right ADC", NULL, "Right PGA Mixer"}, |
Jarkko Nikula | ee15ffd | 2008-06-25 14:58:46 +0300 | [diff] [blame] | 683 | {"Right ADC", NULL, "GPIO1 dmic modclk"}, |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 684 | |
| 685 | /* Left PGA Bypass */ |
Daniel Mack | 54f0191 | 2008-11-26 17:47:36 +0100 | [diff] [blame] | 686 | {"Left PGA Bypass Mixer", "LineL Switch", "Left PGA Mixer"}, |
| 687 | {"Left PGA Bypass Mixer", "LineR Switch", "Left PGA Mixer"}, |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 688 | {"Left PGA Bypass Mixer", "Mono Switch", "Left PGA Mixer"}, |
Daniel Mack | 54f0191 | 2008-11-26 17:47:36 +0100 | [diff] [blame] | 689 | {"Left PGA Bypass Mixer", "HPL Switch", "Left PGA Mixer"}, |
| 690 | {"Left PGA Bypass Mixer", "HPR Switch", "Left PGA Mixer"}, |
| 691 | {"Left PGA Bypass Mixer", "HPLCOM Switch", "Left PGA Mixer"}, |
| 692 | {"Left PGA Bypass Mixer", "HPRCOM Switch", "Left PGA Mixer"}, |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 693 | |
| 694 | {"Left HPCOM Mux", "differential of HPLOUT", "Left PGA Bypass Mixer"}, |
| 695 | {"Left HPCOM Mux", "constant VCM", "Left PGA Bypass Mixer"}, |
| 696 | {"Left HPCOM Mux", "single-ended", "Left PGA Bypass Mixer"}, |
| 697 | |
| 698 | {"Left Line Out", NULL, "Left PGA Bypass Mixer"}, |
| 699 | {"Mono Out", NULL, "Left PGA Bypass Mixer"}, |
| 700 | {"Left HP Out", NULL, "Left PGA Bypass Mixer"}, |
| 701 | |
| 702 | /* Right PGA Bypass */ |
Daniel Mack | 54f0191 | 2008-11-26 17:47:36 +0100 | [diff] [blame] | 703 | {"Right PGA Bypass Mixer", "LineL Switch", "Right PGA Mixer"}, |
| 704 | {"Right PGA Bypass Mixer", "LineR Switch", "Right PGA Mixer"}, |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 705 | {"Right PGA Bypass Mixer", "Mono Switch", "Right PGA Mixer"}, |
Daniel Mack | 54f0191 | 2008-11-26 17:47:36 +0100 | [diff] [blame] | 706 | {"Right PGA Bypass Mixer", "HPL Switch", "Right PGA Mixer"}, |
| 707 | {"Right PGA Bypass Mixer", "HPR Switch", "Right PGA Mixer"}, |
| 708 | {"Right PGA Bypass Mixer", "HPLCOM Switch", "Right PGA Mixer"}, |
| 709 | {"Right PGA Bypass Mixer", "HPRCOM Switch", "Right PGA Mixer"}, |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 710 | |
| 711 | {"Right HPCOM Mux", "differential of HPROUT", "Right PGA Bypass Mixer"}, |
| 712 | {"Right HPCOM Mux", "constant VCM", "Right PGA Bypass Mixer"}, |
| 713 | {"Right HPCOM Mux", "single-ended", "Right PGA Bypass Mixer"}, |
| 714 | {"Right HPCOM Mux", "differential of HPLCOM", "Right PGA Bypass Mixer"}, |
| 715 | {"Right HPCOM Mux", "external feedback", "Right PGA Bypass Mixer"}, |
| 716 | |
| 717 | {"Right Line Out", NULL, "Right PGA Bypass Mixer"}, |
| 718 | {"Mono Out", NULL, "Right PGA Bypass Mixer"}, |
| 719 | {"Right HP Out", NULL, "Right PGA Bypass Mixer"}, |
| 720 | |
| 721 | /* Left Line2 Bypass */ |
Daniel Mack | 54f0191 | 2008-11-26 17:47:36 +0100 | [diff] [blame] | 722 | {"Left Line2 Bypass Mixer", "LineL Switch", "Left Line2L Mux"}, |
| 723 | {"Left Line2 Bypass Mixer", "LineR Switch", "Left Line2L Mux"}, |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 724 | {"Left Line2 Bypass Mixer", "Mono Switch", "Left Line2L Mux"}, |
| 725 | {"Left Line2 Bypass Mixer", "HP Switch", "Left Line2L Mux"}, |
Daniel Mack | 54f0191 | 2008-11-26 17:47:36 +0100 | [diff] [blame] | 726 | {"Left Line2 Bypass Mixer", "HPLCOM Switch", "Left Line2L Mux"}, |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 727 | |
| 728 | {"Left HPCOM Mux", "differential of HPLOUT", "Left Line2 Bypass Mixer"}, |
| 729 | {"Left HPCOM Mux", "constant VCM", "Left Line2 Bypass Mixer"}, |
| 730 | {"Left HPCOM Mux", "single-ended", "Left Line2 Bypass Mixer"}, |
| 731 | |
| 732 | {"Left Line Out", NULL, "Left Line2 Bypass Mixer"}, |
| 733 | {"Mono Out", NULL, "Left Line2 Bypass Mixer"}, |
| 734 | {"Left HP Out", NULL, "Left Line2 Bypass Mixer"}, |
| 735 | |
| 736 | /* Right Line2 Bypass */ |
Daniel Mack | 54f0191 | 2008-11-26 17:47:36 +0100 | [diff] [blame] | 737 | {"Right Line2 Bypass Mixer", "LineL Switch", "Right Line2R Mux"}, |
| 738 | {"Right Line2 Bypass Mixer", "LineR Switch", "Right Line2R Mux"}, |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 739 | {"Right Line2 Bypass Mixer", "Mono Switch", "Right Line2R Mux"}, |
| 740 | {"Right Line2 Bypass Mixer", "HP Switch", "Right Line2R Mux"}, |
Daniel Mack | 54f0191 | 2008-11-26 17:47:36 +0100 | [diff] [blame] | 741 | {"Right Line2 Bypass Mixer", "HPRCOM Switch", "Right Line2R Mux"}, |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 742 | |
| 743 | {"Right HPCOM Mux", "differential of HPROUT", "Right Line2 Bypass Mixer"}, |
| 744 | {"Right HPCOM Mux", "constant VCM", "Right Line2 Bypass Mixer"}, |
| 745 | {"Right HPCOM Mux", "single-ended", "Right Line2 Bypass Mixer"}, |
| 746 | {"Right HPCOM Mux", "differential of HPLCOM", "Right Line2 Bypass Mixer"}, |
| 747 | {"Right HPCOM Mux", "external feedback", "Right Line2 Bypass Mixer"}, |
| 748 | |
| 749 | {"Right Line Out", NULL, "Right Line2 Bypass Mixer"}, |
| 750 | {"Mono Out", NULL, "Right Line2 Bypass Mixer"}, |
| 751 | {"Right HP Out", NULL, "Right Line2 Bypass Mixer"}, |
Jarkko Nikula | ee15ffd | 2008-06-25 14:58:46 +0300 | [diff] [blame] | 752 | |
| 753 | /* |
| 754 | * Logical path between digital mic enable and GPIO1 modulator clock |
| 755 | * output function |
| 756 | */ |
| 757 | {"GPIO1 dmic modclk", NULL, "DMic Rate 128"}, |
| 758 | {"GPIO1 dmic modclk", NULL, "DMic Rate 64"}, |
| 759 | {"GPIO1 dmic modclk", NULL, "DMic Rate 32"}, |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 760 | }; |
| 761 | |
| 762 | static int aic3x_add_widgets(struct snd_soc_codec *codec) |
| 763 | { |
Mark Brown | d0cc0d3 | 2008-05-13 14:55:22 +0200 | [diff] [blame] | 764 | snd_soc_dapm_new_controls(codec, aic3x_dapm_widgets, |
| 765 | ARRAY_SIZE(aic3x_dapm_widgets)); |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 766 | |
| 767 | /* set up audio path interconnects */ |
Mark Brown | d0cc0d3 | 2008-05-13 14:55:22 +0200 | [diff] [blame] | 768 | snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon)); |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 769 | |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 770 | return 0; |
| 771 | } |
| 772 | |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 773 | static int aic3x_hw_params(struct snd_pcm_substream *substream, |
Mark Brown | dee89c4 | 2008-11-18 22:11:38 +0000 | [diff] [blame] | 774 | struct snd_pcm_hw_params *params, |
| 775 | struct snd_soc_dai *dai) |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 776 | { |
| 777 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 778 | struct snd_soc_codec *codec =rtd->codec; |
Mark Brown | b2c812e | 2010-04-14 15:35:19 +0900 | [diff] [blame] | 779 | struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec); |
Daniel Mack | 4f9c16c | 2008-04-30 16:20:19 +0200 | [diff] [blame] | 780 | int codec_clk = 0, bypass_pll = 0, fsref, last_clk = 0; |
Peter Meerwald | 255173b | 2009-12-14 14:44:56 +0100 | [diff] [blame] | 781 | u8 data, j, r, p, pll_q, pll_p = 1, pll_r = 1, pll_j = 1; |
| 782 | u16 d, pll_d = 1; |
Chaithrika U S | 06c7128 | 2009-07-22 07:45:04 -0400 | [diff] [blame] | 783 | u8 reg; |
Peter Meerwald | 255173b | 2009-12-14 14:44:56 +0100 | [diff] [blame] | 784 | int clk; |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 785 | |
| 786 | /* select data word length */ |
| 787 | data = |
| 788 | aic3x_read_reg_cache(codec, AIC3X_ASD_INTF_CTRLB) & (~(0x3 << 4)); |
| 789 | switch (params_format(params)) { |
| 790 | case SNDRV_PCM_FORMAT_S16_LE: |
| 791 | break; |
| 792 | case SNDRV_PCM_FORMAT_S20_3LE: |
| 793 | data |= (0x01 << 4); |
| 794 | break; |
| 795 | case SNDRV_PCM_FORMAT_S24_LE: |
| 796 | data |= (0x02 << 4); |
| 797 | break; |
| 798 | case SNDRV_PCM_FORMAT_S32_LE: |
| 799 | data |= (0x03 << 4); |
| 800 | break; |
| 801 | } |
| 802 | aic3x_write(codec, AIC3X_ASD_INTF_CTRLB, data); |
| 803 | |
Daniel Mack | 4f9c16c | 2008-04-30 16:20:19 +0200 | [diff] [blame] | 804 | /* Fsref can be 44100 or 48000 */ |
| 805 | fsref = (params_rate(params) % 11025 == 0) ? 44100 : 48000; |
| 806 | |
| 807 | /* Try to find a value for Q which allows us to bypass the PLL and |
| 808 | * generate CODEC_CLK directly. */ |
| 809 | for (pll_q = 2; pll_q < 18; pll_q++) |
| 810 | if (aic3x->sysclk / (128 * pll_q) == fsref) { |
| 811 | bypass_pll = 1; |
| 812 | break; |
| 813 | } |
| 814 | |
| 815 | if (bypass_pll) { |
| 816 | pll_q &= 0xf; |
| 817 | aic3x_write(codec, AIC3X_PLL_PROGA_REG, pll_q << PLLQ_SHIFT); |
| 818 | aic3x_write(codec, AIC3X_GPIOB_REG, CODEC_CLKIN_CLKDIV); |
Chaithrika U S | 06c7128 | 2009-07-22 07:45:04 -0400 | [diff] [blame] | 819 | /* disable PLL if it is bypassed */ |
| 820 | reg = aic3x_read_reg_cache(codec, AIC3X_PLL_PROGA_REG); |
| 821 | aic3x_write(codec, AIC3X_PLL_PROGA_REG, reg & ~PLL_ENABLE); |
| 822 | |
| 823 | } else { |
Daniel Mack | 4f9c16c | 2008-04-30 16:20:19 +0200 | [diff] [blame] | 824 | aic3x_write(codec, AIC3X_GPIOB_REG, CODEC_CLKIN_PLLDIV); |
Chaithrika U S | 06c7128 | 2009-07-22 07:45:04 -0400 | [diff] [blame] | 825 | /* enable PLL when it is used */ |
| 826 | reg = aic3x_read_reg_cache(codec, AIC3X_PLL_PROGA_REG); |
| 827 | aic3x_write(codec, AIC3X_PLL_PROGA_REG, reg | PLL_ENABLE); |
| 828 | } |
Daniel Mack | 4f9c16c | 2008-04-30 16:20:19 +0200 | [diff] [blame] | 829 | |
| 830 | /* Route Left DAC to left channel input and |
| 831 | * right DAC to right channel input */ |
| 832 | data = (LDAC2LCH | RDAC2RCH); |
| 833 | data |= (fsref == 44100) ? FSREF_44100 : FSREF_48000; |
| 834 | if (params_rate(params) >= 64000) |
| 835 | data |= DUAL_RATE_MODE; |
| 836 | aic3x_write(codec, AIC3X_CODEC_DATAPATH_REG, data); |
| 837 | |
| 838 | /* codec sample rate select */ |
| 839 | data = (fsref * 20) / params_rate(params); |
| 840 | if (params_rate(params) < 64000) |
| 841 | data /= 2; |
| 842 | data /= 5; |
| 843 | data -= 2; |
| 844 | data |= (data << 4); |
| 845 | aic3x_write(codec, AIC3X_SAMPLE_RATE_SEL_REG, data); |
| 846 | |
| 847 | if (bypass_pll) |
| 848 | return 0; |
| 849 | |
Peter Meerwald | 255173b | 2009-12-14 14:44:56 +0100 | [diff] [blame] | 850 | /* Use PLL, compute apropriate setup for j, d, r and p, the closest |
| 851 | * one wins the game. Try with d==0 first, next with d!=0. |
| 852 | * Constraints for j are according to the datasheet. |
Daniel Mack | 4f9c16c | 2008-04-30 16:20:19 +0200 | [diff] [blame] | 853 | * The sysclk is divided by 1000 to prevent integer overflows. |
| 854 | */ |
Peter Meerwald | 255173b | 2009-12-14 14:44:56 +0100 | [diff] [blame] | 855 | |
Daniel Mack | 4f9c16c | 2008-04-30 16:20:19 +0200 | [diff] [blame] | 856 | codec_clk = (2048 * fsref) / (aic3x->sysclk / 1000); |
| 857 | |
| 858 | for (r = 1; r <= 16; r++) |
| 859 | for (p = 1; p <= 8; p++) { |
Peter Meerwald | 255173b | 2009-12-14 14:44:56 +0100 | [diff] [blame] | 860 | for (j = 4; j <= 55; j++) { |
| 861 | /* This is actually 1000*((j+(d/10000))*r)/p |
| 862 | * The term had to be converted to get |
| 863 | * rid of the division by 10000; d = 0 here |
| 864 | */ |
Mark Brown | 5baf831 | 2010-01-02 13:13:42 +0000 | [diff] [blame] | 865 | int tmp_clk = (1000 * j * r) / p; |
Daniel Mack | 4f9c16c | 2008-04-30 16:20:19 +0200 | [diff] [blame] | 866 | |
Peter Meerwald | 255173b | 2009-12-14 14:44:56 +0100 | [diff] [blame] | 867 | /* Check whether this values get closer than |
| 868 | * the best ones we had before |
| 869 | */ |
Mark Brown | 5baf831 | 2010-01-02 13:13:42 +0000 | [diff] [blame] | 870 | if (abs(codec_clk - tmp_clk) < |
Peter Meerwald | 255173b | 2009-12-14 14:44:56 +0100 | [diff] [blame] | 871 | abs(codec_clk - last_clk)) { |
| 872 | pll_j = j; pll_d = 0; |
| 873 | pll_r = r; pll_p = p; |
Mark Brown | 5baf831 | 2010-01-02 13:13:42 +0000 | [diff] [blame] | 874 | last_clk = tmp_clk; |
Peter Meerwald | 255173b | 2009-12-14 14:44:56 +0100 | [diff] [blame] | 875 | } |
Daniel Mack | 4f9c16c | 2008-04-30 16:20:19 +0200 | [diff] [blame] | 876 | |
Peter Meerwald | 255173b | 2009-12-14 14:44:56 +0100 | [diff] [blame] | 877 | /* Early exit for exact matches */ |
Mark Brown | 5baf831 | 2010-01-02 13:13:42 +0000 | [diff] [blame] | 878 | if (tmp_clk == codec_clk) |
Peter Meerwald | 255173b | 2009-12-14 14:44:56 +0100 | [diff] [blame] | 879 | goto found; |
Daniel Mack | 4f9c16c | 2008-04-30 16:20:19 +0200 | [diff] [blame] | 880 | } |
Daniel Mack | 4f9c16c | 2008-04-30 16:20:19 +0200 | [diff] [blame] | 881 | } |
| 882 | |
Peter Meerwald | 255173b | 2009-12-14 14:44:56 +0100 | [diff] [blame] | 883 | /* try with d != 0 */ |
| 884 | for (p = 1; p <= 8; p++) { |
| 885 | j = codec_clk * p / 1000; |
| 886 | |
| 887 | if (j < 4 || j > 11) |
| 888 | continue; |
| 889 | |
| 890 | /* do not use codec_clk here since we'd loose precision */ |
| 891 | d = ((2048 * p * fsref) - j * aic3x->sysclk) |
| 892 | * 100 / (aic3x->sysclk/100); |
| 893 | |
| 894 | clk = (10000 * j + d) / (10 * p); |
| 895 | |
| 896 | /* check whether this values get closer than the best |
| 897 | * ones we had before */ |
| 898 | if (abs(codec_clk - clk) < abs(codec_clk - last_clk)) { |
| 899 | pll_j = j; pll_d = d; pll_r = 1; pll_p = p; |
| 900 | last_clk = clk; |
| 901 | } |
| 902 | |
| 903 | /* Early exit for exact matches */ |
| 904 | if (clk == codec_clk) |
| 905 | goto found; |
| 906 | } |
| 907 | |
Daniel Mack | 4f9c16c | 2008-04-30 16:20:19 +0200 | [diff] [blame] | 908 | if (last_clk == 0) { |
| 909 | printk(KERN_ERR "%s(): unable to setup PLL\n", __func__); |
| 910 | return -EINVAL; |
| 911 | } |
| 912 | |
Peter Meerwald | 255173b | 2009-12-14 14:44:56 +0100 | [diff] [blame] | 913 | found: |
Daniel Mack | 4f9c16c | 2008-04-30 16:20:19 +0200 | [diff] [blame] | 914 | data = aic3x_read_reg_cache(codec, AIC3X_PLL_PROGA_REG); |
| 915 | aic3x_write(codec, AIC3X_PLL_PROGA_REG, data | (pll_p << PLLP_SHIFT)); |
| 916 | aic3x_write(codec, AIC3X_OVRF_STATUS_AND_PLLR_REG, pll_r << PLLR_SHIFT); |
| 917 | aic3x_write(codec, AIC3X_PLL_PROGB_REG, pll_j << PLLJ_SHIFT); |
| 918 | aic3x_write(codec, AIC3X_PLL_PROGC_REG, (pll_d >> 6) << PLLD_MSB_SHIFT); |
| 919 | aic3x_write(codec, AIC3X_PLL_PROGD_REG, |
| 920 | (pll_d & 0x3F) << PLLD_LSB_SHIFT); |
| 921 | |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 922 | return 0; |
| 923 | } |
| 924 | |
Liam Girdwood | e550e17 | 2008-07-07 16:07:52 +0100 | [diff] [blame] | 925 | static int aic3x_mute(struct snd_soc_dai *dai, int mute) |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 926 | { |
| 927 | struct snd_soc_codec *codec = dai->codec; |
| 928 | u8 ldac_reg = aic3x_read_reg_cache(codec, LDAC_VOL) & ~MUTE_ON; |
| 929 | u8 rdac_reg = aic3x_read_reg_cache(codec, RDAC_VOL) & ~MUTE_ON; |
| 930 | |
| 931 | if (mute) { |
| 932 | aic3x_write(codec, LDAC_VOL, ldac_reg | MUTE_ON); |
| 933 | aic3x_write(codec, RDAC_VOL, rdac_reg | MUTE_ON); |
| 934 | } else { |
| 935 | aic3x_write(codec, LDAC_VOL, ldac_reg); |
| 936 | aic3x_write(codec, RDAC_VOL, rdac_reg); |
| 937 | } |
| 938 | |
| 939 | return 0; |
| 940 | } |
| 941 | |
Liam Girdwood | e550e17 | 2008-07-07 16:07:52 +0100 | [diff] [blame] | 942 | static int aic3x_set_dai_sysclk(struct snd_soc_dai *codec_dai, |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 943 | int clk_id, unsigned int freq, int dir) |
| 944 | { |
| 945 | struct snd_soc_codec *codec = codec_dai->codec; |
Mark Brown | b2c812e | 2010-04-14 15:35:19 +0900 | [diff] [blame] | 946 | struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec); |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 947 | |
Daniel Mack | 4f9c16c | 2008-04-30 16:20:19 +0200 | [diff] [blame] | 948 | aic3x->sysclk = freq; |
| 949 | return 0; |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 950 | } |
| 951 | |
Liam Girdwood | e550e17 | 2008-07-07 16:07:52 +0100 | [diff] [blame] | 952 | static int aic3x_set_dai_fmt(struct snd_soc_dai *codec_dai, |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 953 | unsigned int fmt) |
| 954 | { |
| 955 | struct snd_soc_codec *codec = codec_dai->codec; |
Mark Brown | b2c812e | 2010-04-14 15:35:19 +0900 | [diff] [blame] | 956 | struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec); |
Jarkko Nikula | 81971a1 | 2008-06-25 14:58:45 +0300 | [diff] [blame] | 957 | u8 iface_areg, iface_breg; |
Troy Kisky | a24f4f6 | 2008-12-19 13:05:22 -0700 | [diff] [blame] | 958 | int delay = 0; |
Jarkko Nikula | 81971a1 | 2008-06-25 14:58:45 +0300 | [diff] [blame] | 959 | |
| 960 | iface_areg = aic3x_read_reg_cache(codec, AIC3X_ASD_INTF_CTRLA) & 0x3f; |
| 961 | iface_breg = aic3x_read_reg_cache(codec, AIC3X_ASD_INTF_CTRLB) & 0x3f; |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 962 | |
| 963 | /* set master/slave audio interface */ |
| 964 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { |
| 965 | case SND_SOC_DAIFMT_CBM_CFM: |
| 966 | aic3x->master = 1; |
| 967 | iface_areg |= BIT_CLK_MASTER | WORD_CLK_MASTER; |
| 968 | break; |
| 969 | case SND_SOC_DAIFMT_CBS_CFS: |
| 970 | aic3x->master = 0; |
| 971 | break; |
| 972 | default: |
| 973 | return -EINVAL; |
| 974 | } |
| 975 | |
Jarkko Nikula | 4b7d283 | 2008-10-23 14:27:03 +0300 | [diff] [blame] | 976 | /* |
| 977 | * match both interface format and signal polarities since they |
| 978 | * are fixed |
| 979 | */ |
| 980 | switch (fmt & (SND_SOC_DAIFMT_FORMAT_MASK | |
| 981 | SND_SOC_DAIFMT_INV_MASK)) { |
| 982 | case (SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF): |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 983 | break; |
Troy Kisky | a24f4f6 | 2008-12-19 13:05:22 -0700 | [diff] [blame] | 984 | case (SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_IB_NF): |
| 985 | delay = 1; |
Jarkko Nikula | 4b7d283 | 2008-10-23 14:27:03 +0300 | [diff] [blame] | 986 | case (SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_IB_NF): |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 987 | iface_breg |= (0x01 << 6); |
| 988 | break; |
Jarkko Nikula | 4b7d283 | 2008-10-23 14:27:03 +0300 | [diff] [blame] | 989 | case (SND_SOC_DAIFMT_RIGHT_J | SND_SOC_DAIFMT_NB_NF): |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 990 | iface_breg |= (0x02 << 6); |
| 991 | break; |
Jarkko Nikula | 4b7d283 | 2008-10-23 14:27:03 +0300 | [diff] [blame] | 992 | case (SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_NB_NF): |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 993 | iface_breg |= (0x03 << 6); |
| 994 | break; |
| 995 | default: |
| 996 | return -EINVAL; |
| 997 | } |
| 998 | |
| 999 | /* set iface */ |
| 1000 | aic3x_write(codec, AIC3X_ASD_INTF_CTRLA, iface_areg); |
| 1001 | aic3x_write(codec, AIC3X_ASD_INTF_CTRLB, iface_breg); |
Troy Kisky | a24f4f6 | 2008-12-19 13:05:22 -0700 | [diff] [blame] | 1002 | aic3x_write(codec, AIC3X_ASD_INTF_CTRLC, delay); |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 1003 | |
| 1004 | return 0; |
| 1005 | } |
| 1006 | |
Mark Brown | 0be9898 | 2008-05-19 12:31:28 +0200 | [diff] [blame] | 1007 | static int aic3x_set_bias_level(struct snd_soc_codec *codec, |
| 1008 | enum snd_soc_bias_level level) |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 1009 | { |
Mark Brown | b2c812e | 2010-04-14 15:35:19 +0900 | [diff] [blame] | 1010 | struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec); |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 1011 | u8 reg; |
| 1012 | |
Mark Brown | 0be9898 | 2008-05-19 12:31:28 +0200 | [diff] [blame] | 1013 | switch (level) { |
| 1014 | case SND_SOC_BIAS_ON: |
Jarkko Nikula | db13802 | 2010-04-26 15:49:13 +0300 | [diff] [blame] | 1015 | break; |
| 1016 | case SND_SOC_BIAS_PREPARE: |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 1017 | if (aic3x->master) { |
| 1018 | /* enable pll */ |
| 1019 | reg = aic3x_read_reg_cache(codec, AIC3X_PLL_PROGA_REG); |
| 1020 | aic3x_write(codec, AIC3X_PLL_PROGA_REG, |
| 1021 | reg | PLL_ENABLE); |
| 1022 | } |
| 1023 | break; |
Mark Brown | 0be9898 | 2008-05-19 12:31:28 +0200 | [diff] [blame] | 1024 | case SND_SOC_BIAS_STANDBY: |
Jarkko Nikula | db13802 | 2010-04-26 15:49:13 +0300 | [diff] [blame] | 1025 | /* fall through and disable pll */ |
Mark Brown | 0be9898 | 2008-05-19 12:31:28 +0200 | [diff] [blame] | 1026 | case SND_SOC_BIAS_OFF: |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 1027 | if (aic3x->master) { |
| 1028 | /* disable pll */ |
| 1029 | reg = aic3x_read_reg_cache(codec, AIC3X_PLL_PROGA_REG); |
| 1030 | aic3x_write(codec, AIC3X_PLL_PROGA_REG, |
| 1031 | reg & ~PLL_ENABLE); |
| 1032 | } |
| 1033 | break; |
| 1034 | } |
Mark Brown | 0be9898 | 2008-05-19 12:31:28 +0200 | [diff] [blame] | 1035 | codec->bias_level = level; |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 1036 | |
| 1037 | return 0; |
| 1038 | } |
| 1039 | |
Daniel Mack | 54e7e61 | 2008-04-30 16:20:52 +0200 | [diff] [blame] | 1040 | void aic3x_set_gpio(struct snd_soc_codec *codec, int gpio, int state) |
| 1041 | { |
| 1042 | u8 reg = gpio ? AIC3X_GPIO2_REG : AIC3X_GPIO1_REG; |
| 1043 | u8 bit = gpio ? 3: 0; |
| 1044 | u8 val = aic3x_read_reg_cache(codec, reg) & ~(1 << bit); |
| 1045 | aic3x_write(codec, reg, val | (!!state << bit)); |
| 1046 | } |
| 1047 | EXPORT_SYMBOL_GPL(aic3x_set_gpio); |
| 1048 | |
| 1049 | int aic3x_get_gpio(struct snd_soc_codec *codec, int gpio) |
| 1050 | { |
| 1051 | u8 reg = gpio ? AIC3X_GPIO2_REG : AIC3X_GPIO1_REG; |
| 1052 | u8 val, bit = gpio ? 2: 1; |
| 1053 | |
| 1054 | aic3x_read(codec, reg, &val); |
| 1055 | return (val >> bit) & 1; |
| 1056 | } |
| 1057 | EXPORT_SYMBOL_GPL(aic3x_get_gpio); |
| 1058 | |
Daniel Mack | 6f2a974 | 2008-12-03 11:44:17 +0100 | [diff] [blame] | 1059 | void aic3x_set_headset_detection(struct snd_soc_codec *codec, int detect, |
| 1060 | int headset_debounce, int button_debounce) |
| 1061 | { |
| 1062 | u8 val; |
| 1063 | |
| 1064 | val = ((detect & AIC3X_HEADSET_DETECT_MASK) |
| 1065 | << AIC3X_HEADSET_DETECT_SHIFT) | |
| 1066 | ((headset_debounce & AIC3X_HEADSET_DEBOUNCE_MASK) |
| 1067 | << AIC3X_HEADSET_DEBOUNCE_SHIFT) | |
| 1068 | ((button_debounce & AIC3X_BUTTON_DEBOUNCE_MASK) |
| 1069 | << AIC3X_BUTTON_DEBOUNCE_SHIFT); |
| 1070 | |
| 1071 | if (detect & AIC3X_HEADSET_DETECT_MASK) |
| 1072 | val |= AIC3X_HEADSET_DETECT_ENABLED; |
| 1073 | |
| 1074 | aic3x_write(codec, AIC3X_HEADSET_DETECT_CTRL_A, val); |
| 1075 | } |
| 1076 | EXPORT_SYMBOL_GPL(aic3x_set_headset_detection); |
| 1077 | |
Daniel Mack | 54e7e61 | 2008-04-30 16:20:52 +0200 | [diff] [blame] | 1078 | int aic3x_headset_detected(struct snd_soc_codec *codec) |
| 1079 | { |
| 1080 | u8 val; |
Daniel Mack | 6f2a974 | 2008-12-03 11:44:17 +0100 | [diff] [blame] | 1081 | aic3x_read(codec, AIC3X_HEADSET_DETECT_CTRL_B, &val); |
| 1082 | return (val >> 4) & 1; |
Daniel Mack | 54e7e61 | 2008-04-30 16:20:52 +0200 | [diff] [blame] | 1083 | } |
| 1084 | EXPORT_SYMBOL_GPL(aic3x_headset_detected); |
| 1085 | |
Daniel Mack | 6f2a974 | 2008-12-03 11:44:17 +0100 | [diff] [blame] | 1086 | int aic3x_button_pressed(struct snd_soc_codec *codec) |
| 1087 | { |
| 1088 | u8 val; |
| 1089 | aic3x_read(codec, AIC3X_HEADSET_DETECT_CTRL_B, &val); |
| 1090 | return (val >> 5) & 1; |
| 1091 | } |
| 1092 | EXPORT_SYMBOL_GPL(aic3x_button_pressed); |
| 1093 | |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 1094 | #define AIC3X_RATES SNDRV_PCM_RATE_8000_96000 |
| 1095 | #define AIC3X_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ |
| 1096 | SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE) |
| 1097 | |
Eric Miao | 6335d05 | 2009-03-03 09:41:00 +0800 | [diff] [blame] | 1098 | static struct snd_soc_dai_ops aic3x_dai_ops = { |
| 1099 | .hw_params = aic3x_hw_params, |
| 1100 | .digital_mute = aic3x_mute, |
| 1101 | .set_sysclk = aic3x_set_dai_sysclk, |
| 1102 | .set_fmt = aic3x_set_dai_fmt, |
| 1103 | }; |
| 1104 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 1105 | static struct snd_soc_dai_driver aic3x_dai = { |
| 1106 | .name = "tlv320aic3x-hifi", |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 1107 | .playback = { |
| 1108 | .stream_name = "Playback", |
| 1109 | .channels_min = 1, |
| 1110 | .channels_max = 2, |
| 1111 | .rates = AIC3X_RATES, |
| 1112 | .formats = AIC3X_FORMATS,}, |
| 1113 | .capture = { |
| 1114 | .stream_name = "Capture", |
| 1115 | .channels_min = 1, |
| 1116 | .channels_max = 2, |
| 1117 | .rates = AIC3X_RATES, |
| 1118 | .formats = AIC3X_FORMATS,}, |
Eric Miao | 6335d05 | 2009-03-03 09:41:00 +0800 | [diff] [blame] | 1119 | .ops = &aic3x_dai_ops, |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 1120 | }; |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 1121 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 1122 | static int aic3x_suspend(struct snd_soc_codec *codec, pm_message_t state) |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 1123 | { |
Mark Brown | 0be9898 | 2008-05-19 12:31:28 +0200 | [diff] [blame] | 1124 | aic3x_set_bias_level(codec, SND_SOC_BIAS_OFF); |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 1125 | |
| 1126 | return 0; |
| 1127 | } |
| 1128 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 1129 | static int aic3x_resume(struct snd_soc_codec *codec) |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 1130 | { |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 1131 | int i; |
| 1132 | u8 data[2]; |
| 1133 | u8 *cache = codec->reg_cache; |
| 1134 | |
| 1135 | /* Sync reg_cache with the hardware */ |
| 1136 | for (i = 0; i < ARRAY_SIZE(aic3x_reg); i++) { |
| 1137 | data[0] = i; |
| 1138 | data[1] = cache[i]; |
| 1139 | codec->hw_write(codec->control_data, data, 2); |
| 1140 | } |
| 1141 | |
Mark Brown | 29e189c | 2010-05-07 20:30:00 +0100 | [diff] [blame] | 1142 | aic3x_set_bias_level(codec, SND_SOC_BIAS_STANDBY); |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 1143 | |
| 1144 | return 0; |
| 1145 | } |
| 1146 | |
| 1147 | /* |
| 1148 | * initialise the AIC3X driver |
| 1149 | * register the mixer and dsp interfaces with the kernel |
| 1150 | */ |
Ben Dooks | cb3826f | 2009-08-20 22:50:41 +0100 | [diff] [blame] | 1151 | static int aic3x_init(struct snd_soc_codec *codec) |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 1152 | { |
Ben Dooks | cb3826f | 2009-08-20 22:50:41 +0100 | [diff] [blame] | 1153 | int reg; |
| 1154 | |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 1155 | aic3x_write(codec, AIC3X_PAGE_SELECT, PAGE0_SELECT); |
| 1156 | aic3x_write(codec, AIC3X_RESET, SOFT_RESET); |
| 1157 | |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 1158 | /* DAC default volume and mute */ |
| 1159 | aic3x_write(codec, LDAC_VOL, DEFAULT_VOL | MUTE_ON); |
| 1160 | aic3x_write(codec, RDAC_VOL, DEFAULT_VOL | MUTE_ON); |
| 1161 | |
| 1162 | /* DAC to HP default volume and route to Output mixer */ |
| 1163 | aic3x_write(codec, DACL1_2_HPLOUT_VOL, DEFAULT_VOL | ROUTE_ON); |
| 1164 | aic3x_write(codec, DACR1_2_HPROUT_VOL, DEFAULT_VOL | ROUTE_ON); |
| 1165 | aic3x_write(codec, DACL1_2_HPLCOM_VOL, DEFAULT_VOL | ROUTE_ON); |
| 1166 | aic3x_write(codec, DACR1_2_HPRCOM_VOL, DEFAULT_VOL | ROUTE_ON); |
| 1167 | /* DAC to Line Out default volume and route to Output mixer */ |
| 1168 | aic3x_write(codec, DACL1_2_LLOPM_VOL, DEFAULT_VOL | ROUTE_ON); |
| 1169 | aic3x_write(codec, DACR1_2_RLOPM_VOL, DEFAULT_VOL | ROUTE_ON); |
| 1170 | /* DAC to Mono Line Out default volume and route to Output mixer */ |
| 1171 | aic3x_write(codec, DACL1_2_MONOLOPM_VOL, DEFAULT_VOL | ROUTE_ON); |
| 1172 | aic3x_write(codec, DACR1_2_MONOLOPM_VOL, DEFAULT_VOL | ROUTE_ON); |
| 1173 | |
| 1174 | /* unmute all outputs */ |
| 1175 | reg = aic3x_read_reg_cache(codec, LLOPM_CTRL); |
| 1176 | aic3x_write(codec, LLOPM_CTRL, reg | UNMUTE); |
| 1177 | reg = aic3x_read_reg_cache(codec, RLOPM_CTRL); |
| 1178 | aic3x_write(codec, RLOPM_CTRL, reg | UNMUTE); |
| 1179 | reg = aic3x_read_reg_cache(codec, MONOLOPM_CTRL); |
| 1180 | aic3x_write(codec, MONOLOPM_CTRL, reg | UNMUTE); |
| 1181 | reg = aic3x_read_reg_cache(codec, HPLOUT_CTRL); |
| 1182 | aic3x_write(codec, HPLOUT_CTRL, reg | UNMUTE); |
| 1183 | reg = aic3x_read_reg_cache(codec, HPROUT_CTRL); |
| 1184 | aic3x_write(codec, HPROUT_CTRL, reg | UNMUTE); |
| 1185 | reg = aic3x_read_reg_cache(codec, HPLCOM_CTRL); |
| 1186 | aic3x_write(codec, HPLCOM_CTRL, reg | UNMUTE); |
| 1187 | reg = aic3x_read_reg_cache(codec, HPRCOM_CTRL); |
| 1188 | aic3x_write(codec, HPRCOM_CTRL, reg | UNMUTE); |
| 1189 | |
| 1190 | /* ADC default volume and unmute */ |
| 1191 | aic3x_write(codec, LADC_VOL, DEFAULT_GAIN); |
| 1192 | aic3x_write(codec, RADC_VOL, DEFAULT_GAIN); |
| 1193 | /* By default route Line1 to ADC PGA mixer */ |
| 1194 | aic3x_write(codec, LINE1L_2_LADC_CTRL, 0x0); |
| 1195 | aic3x_write(codec, LINE1R_2_RADC_CTRL, 0x0); |
| 1196 | |
| 1197 | /* PGA to HP Bypass default volume, disconnect from Output Mixer */ |
| 1198 | aic3x_write(codec, PGAL_2_HPLOUT_VOL, DEFAULT_VOL); |
| 1199 | aic3x_write(codec, PGAR_2_HPROUT_VOL, DEFAULT_VOL); |
| 1200 | aic3x_write(codec, PGAL_2_HPLCOM_VOL, DEFAULT_VOL); |
| 1201 | aic3x_write(codec, PGAR_2_HPRCOM_VOL, DEFAULT_VOL); |
| 1202 | /* PGA to Line Out default volume, disconnect from Output Mixer */ |
| 1203 | aic3x_write(codec, PGAL_2_LLOPM_VOL, DEFAULT_VOL); |
| 1204 | aic3x_write(codec, PGAR_2_RLOPM_VOL, DEFAULT_VOL); |
| 1205 | /* PGA to Mono Line Out default volume, disconnect from Output Mixer */ |
| 1206 | aic3x_write(codec, PGAL_2_MONOLOPM_VOL, DEFAULT_VOL); |
| 1207 | aic3x_write(codec, PGAR_2_MONOLOPM_VOL, DEFAULT_VOL); |
| 1208 | |
| 1209 | /* Line2 to HP Bypass default volume, disconnect from Output Mixer */ |
| 1210 | aic3x_write(codec, LINE2L_2_HPLOUT_VOL, DEFAULT_VOL); |
| 1211 | aic3x_write(codec, LINE2R_2_HPROUT_VOL, DEFAULT_VOL); |
| 1212 | aic3x_write(codec, LINE2L_2_HPLCOM_VOL, DEFAULT_VOL); |
| 1213 | aic3x_write(codec, LINE2R_2_HPRCOM_VOL, DEFAULT_VOL); |
| 1214 | /* Line2 Line Out default volume, disconnect from Output Mixer */ |
| 1215 | aic3x_write(codec, LINE2L_2_LLOPM_VOL, DEFAULT_VOL); |
| 1216 | aic3x_write(codec, LINE2R_2_RLOPM_VOL, DEFAULT_VOL); |
| 1217 | /* Line2 to Mono Out default volume, disconnect from Output Mixer */ |
| 1218 | aic3x_write(codec, LINE2L_2_MONOLOPM_VOL, DEFAULT_VOL); |
| 1219 | aic3x_write(codec, LINE2R_2_MONOLOPM_VOL, DEFAULT_VOL); |
| 1220 | |
| 1221 | /* off, with power on */ |
Mark Brown | 0be9898 | 2008-05-19 12:31:28 +0200 | [diff] [blame] | 1222 | aic3x_set_bias_level(codec, SND_SOC_BIAS_STANDBY); |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 1223 | |
Ben Dooks | cb3826f | 2009-08-20 22:50:41 +0100 | [diff] [blame] | 1224 | return 0; |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 1225 | } |
| 1226 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 1227 | static int aic3x_probe(struct snd_soc_codec *codec) |
Ben Dooks | cb3826f | 2009-08-20 22:50:41 +0100 | [diff] [blame] | 1228 | { |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 1229 | struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec); |
Ben Dooks | cb3826f | 2009-08-20 22:50:41 +0100 | [diff] [blame] | 1230 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 1231 | codec->hw_write = (hw_write_t) i2c_master_send; |
| 1232 | codec->control_data = aic3x->control_data; |
| 1233 | |
Jarkko Nikula | 37b4765 | 2010-08-23 10:38:40 +0300 | [diff] [blame^] | 1234 | aic3x_init(codec); |
| 1235 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 1236 | if (aic3x->setup) { |
| 1237 | /* setup GPIO functions */ |
| 1238 | aic3x_write(codec, AIC3X_GPIO1_REG, |
| 1239 | (aic3x->setup->gpio_func[0] & 0xf) << 4); |
| 1240 | aic3x_write(codec, AIC3X_GPIO2_REG, |
| 1241 | (aic3x->setup->gpio_func[1] & 0xf) << 4); |
Ben Dooks | cb3826f | 2009-08-20 22:50:41 +0100 | [diff] [blame] | 1242 | } |
| 1243 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 1244 | snd_soc_add_controls(codec, aic3x_snd_controls, |
| 1245 | ARRAY_SIZE(aic3x_snd_controls)); |
Ben Dooks | cb3826f | 2009-08-20 22:50:41 +0100 | [diff] [blame] | 1246 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 1247 | aic3x_add_widgets(codec); |
Ben Dooks | cb3826f | 2009-08-20 22:50:41 +0100 | [diff] [blame] | 1248 | |
| 1249 | return 0; |
| 1250 | } |
| 1251 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 1252 | static int aic3x_remove(struct snd_soc_codec *codec) |
Ben Dooks | cb3826f | 2009-08-20 22:50:41 +0100 | [diff] [blame] | 1253 | { |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 1254 | aic3x_set_bias_level(codec, SND_SOC_BIAS_OFF); |
Ben Dooks | cb3826f | 2009-08-20 22:50:41 +0100 | [diff] [blame] | 1255 | return 0; |
| 1256 | } |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 1257 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 1258 | static struct snd_soc_codec_driver soc_codec_dev_aic3x = { |
| 1259 | .read = aic3x_read_reg_cache, |
| 1260 | .write = aic3x_write, |
| 1261 | .set_bias_level = aic3x_set_bias_level, |
| 1262 | .reg_cache_size = ARRAY_SIZE(aic3x_reg), |
| 1263 | .reg_word_size = sizeof(u8), |
| 1264 | .reg_cache_default = aic3x_reg, |
| 1265 | .probe = aic3x_probe, |
| 1266 | .remove = aic3x_remove, |
| 1267 | .suspend = aic3x_suspend, |
| 1268 | .resume = aic3x_resume, |
| 1269 | }; |
| 1270 | |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 1271 | #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) |
| 1272 | /* |
| 1273 | * AIC3X 2 wire address can be up to 4 devices with device addresses |
| 1274 | * 0x18, 0x19, 0x1A, 0x1B |
| 1275 | */ |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 1276 | |
| 1277 | /* |
| 1278 | * If the i2c layer weren't so broken, we could pass this kind of data |
| 1279 | * around |
| 1280 | */ |
Jean Delvare | ba8ed12 | 2008-09-22 14:15:53 +0200 | [diff] [blame] | 1281 | static int aic3x_i2c_probe(struct i2c_client *i2c, |
| 1282 | const struct i2c_device_id *id) |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 1283 | { |
Jarkko Nikula | 5193d62 | 2010-05-05 13:02:03 +0300 | [diff] [blame] | 1284 | struct aic3x_pdata *pdata = i2c->dev.platform_data; |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 1285 | struct aic3x_setup_data *setup = pdata->setup; |
| 1286 | struct aic3x_priv *aic3x; |
Jarkko Nikula | 07779fd | 2010-04-26 15:49:14 +0300 | [diff] [blame] | 1287 | int ret, i; |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 1288 | |
Ben Dooks | cb3826f | 2009-08-20 22:50:41 +0100 | [diff] [blame] | 1289 | aic3x = kzalloc(sizeof(struct aic3x_priv), GFP_KERNEL); |
| 1290 | if (aic3x == NULL) { |
| 1291 | dev_err(&i2c->dev, "failed to create private data\n"); |
| 1292 | return -ENOMEM; |
| 1293 | } |
| 1294 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 1295 | aic3x->control_data = i2c; |
| 1296 | aic3x->setup = setup; |
Ben Dooks | cb3826f | 2009-08-20 22:50:41 +0100 | [diff] [blame] | 1297 | i2c_set_clientdata(i2c, aic3x); |
| 1298 | |
Jarkko Nikula | 5193d62 | 2010-05-05 13:02:03 +0300 | [diff] [blame] | 1299 | aic3x->gpio_reset = -1; |
| 1300 | if (pdata && pdata->gpio_reset >= 0) { |
| 1301 | ret = gpio_request(pdata->gpio_reset, "tlv320aic3x reset"); |
| 1302 | if (ret != 0) |
| 1303 | goto err_gpio; |
| 1304 | aic3x->gpio_reset = pdata->gpio_reset; |
| 1305 | gpio_direction_output(aic3x->gpio_reset, 0); |
| 1306 | } |
| 1307 | |
Jarkko Nikula | 07779fd | 2010-04-26 15:49:14 +0300 | [diff] [blame] | 1308 | for (i = 0; i < ARRAY_SIZE(aic3x->supplies); i++) |
| 1309 | aic3x->supplies[i].supply = aic3x_supply_names[i]; |
| 1310 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 1311 | ret = regulator_bulk_get(&i2c->dev, ARRAY_SIZE(aic3x->supplies), |
Jarkko Nikula | 07779fd | 2010-04-26 15:49:14 +0300 | [diff] [blame] | 1312 | aic3x->supplies); |
| 1313 | if (ret != 0) { |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 1314 | dev_err(&i2c->dev, "Failed to request supplies: %d\n", ret); |
Jarkko Nikula | 07779fd | 2010-04-26 15:49:14 +0300 | [diff] [blame] | 1315 | goto err_get; |
| 1316 | } |
| 1317 | |
| 1318 | ret = regulator_bulk_enable(ARRAY_SIZE(aic3x->supplies), |
| 1319 | aic3x->supplies); |
| 1320 | if (ret != 0) { |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 1321 | dev_err(&i2c->dev, "Failed to enable supplies: %d\n", ret); |
Jarkko Nikula | 07779fd | 2010-04-26 15:49:14 +0300 | [diff] [blame] | 1322 | goto err_enable; |
| 1323 | } |
| 1324 | |
Jarkko Nikula | 5193d62 | 2010-05-05 13:02:03 +0300 | [diff] [blame] | 1325 | if (aic3x->gpio_reset >= 0) { |
| 1326 | udelay(1); |
| 1327 | gpio_set_value(aic3x->gpio_reset, 1); |
| 1328 | } |
| 1329 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 1330 | ret = snd_soc_register_codec(&i2c->dev, |
| 1331 | &soc_codec_dev_aic3x, &aic3x_dai, 1); |
| 1332 | if (ret < 0) |
| 1333 | goto err_enable; |
| 1334 | return ret; |
Jarkko Nikula | 07779fd | 2010-04-26 15:49:14 +0300 | [diff] [blame] | 1335 | |
| 1336 | err_enable: |
| 1337 | regulator_bulk_free(ARRAY_SIZE(aic3x->supplies), aic3x->supplies); |
| 1338 | err_get: |
Jarkko Nikula | 5193d62 | 2010-05-05 13:02:03 +0300 | [diff] [blame] | 1339 | if (aic3x->gpio_reset >= 0) |
| 1340 | gpio_free(aic3x->gpio_reset); |
| 1341 | err_gpio: |
Jarkko Nikula | 07779fd | 2010-04-26 15:49:14 +0300 | [diff] [blame] | 1342 | kfree(aic3x); |
| 1343 | return ret; |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 1344 | } |
| 1345 | |
Jean Delvare | ba8ed12 | 2008-09-22 14:15:53 +0200 | [diff] [blame] | 1346 | static int aic3x_i2c_remove(struct i2c_client *client) |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 1347 | { |
Ben Dooks | cb3826f | 2009-08-20 22:50:41 +0100 | [diff] [blame] | 1348 | struct aic3x_priv *aic3x = i2c_get_clientdata(client); |
| 1349 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 1350 | if (aic3x->gpio_reset >= 0) { |
| 1351 | gpio_set_value(aic3x->gpio_reset, 0); |
| 1352 | gpio_free(aic3x->gpio_reset); |
| 1353 | } |
| 1354 | regulator_bulk_disable(ARRAY_SIZE(aic3x->supplies), aic3x->supplies); |
| 1355 | regulator_bulk_free(ARRAY_SIZE(aic3x->supplies), aic3x->supplies); |
| 1356 | |
| 1357 | snd_soc_unregister_codec(&client->dev); |
| 1358 | kfree(i2c_get_clientdata(client)); |
| 1359 | return 0; |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 1360 | } |
| 1361 | |
Jean Delvare | ba8ed12 | 2008-09-22 14:15:53 +0200 | [diff] [blame] | 1362 | static const struct i2c_device_id aic3x_i2c_id[] = { |
| 1363 | { "tlv320aic3x", 0 }, |
Ben Dooks | cb3826f | 2009-08-20 22:50:41 +0100 | [diff] [blame] | 1364 | { "tlv320aic33", 0 }, |
Jean Delvare | ba8ed12 | 2008-09-22 14:15:53 +0200 | [diff] [blame] | 1365 | { } |
| 1366 | }; |
| 1367 | MODULE_DEVICE_TABLE(i2c, aic3x_i2c_id); |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 1368 | |
| 1369 | /* machine i2c codec control layer */ |
| 1370 | static struct i2c_driver aic3x_i2c_driver = { |
| 1371 | .driver = { |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 1372 | .name = "tlv320aic3x-codec", |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 1373 | .owner = THIS_MODULE, |
| 1374 | }, |
Ben Dooks | cb3826f | 2009-08-20 22:50:41 +0100 | [diff] [blame] | 1375 | .probe = aic3x_i2c_probe, |
Jean Delvare | ba8ed12 | 2008-09-22 14:15:53 +0200 | [diff] [blame] | 1376 | .remove = aic3x_i2c_remove, |
| 1377 | .id_table = aic3x_i2c_id, |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 1378 | }; |
Daniel Mack | 54e7e61 | 2008-04-30 16:20:52 +0200 | [diff] [blame] | 1379 | |
Ben Dooks | cb3826f | 2009-08-20 22:50:41 +0100 | [diff] [blame] | 1380 | static inline void aic3x_i2c_init(void) |
Jean Delvare | ba8ed12 | 2008-09-22 14:15:53 +0200 | [diff] [blame] | 1381 | { |
Jean Delvare | ba8ed12 | 2008-09-22 14:15:53 +0200 | [diff] [blame] | 1382 | int ret; |
| 1383 | |
| 1384 | ret = i2c_add_driver(&aic3x_i2c_driver); |
Ben Dooks | cb3826f | 2009-08-20 22:50:41 +0100 | [diff] [blame] | 1385 | if (ret) |
| 1386 | printk(KERN_ERR "%s: error regsitering i2c driver, %d\n", |
| 1387 | __func__, ret); |
Jean Delvare | ba8ed12 | 2008-09-22 14:15:53 +0200 | [diff] [blame] | 1388 | } |
Ben Dooks | cb3826f | 2009-08-20 22:50:41 +0100 | [diff] [blame] | 1389 | |
| 1390 | static inline void aic3x_i2c_exit(void) |
| 1391 | { |
| 1392 | i2c_del_driver(&aic3x_i2c_driver); |
| 1393 | } |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 1394 | #endif |
| 1395 | |
Takashi Iwai | c9b3a40 | 2008-12-10 07:47:22 +0100 | [diff] [blame] | 1396 | static int __init aic3x_modinit(void) |
Mark Brown | 64089b8 | 2008-12-08 19:17:58 +0000 | [diff] [blame] | 1397 | { |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 1398 | int ret = 0; |
| 1399 | #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) |
| 1400 | ret = i2c_add_driver(&aic3x_i2c_driver); |
| 1401 | if (ret != 0) { |
| 1402 | printk(KERN_ERR "Failed to register TLV320AIC3x I2C driver: %d\n", |
| 1403 | ret); |
| 1404 | } |
| 1405 | #endif |
| 1406 | return ret; |
Mark Brown | 64089b8 | 2008-12-08 19:17:58 +0000 | [diff] [blame] | 1407 | } |
| 1408 | module_init(aic3x_modinit); |
| 1409 | |
| 1410 | static void __exit aic3x_exit(void) |
| 1411 | { |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 1412 | #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) |
| 1413 | i2c_del_driver(&aic3x_i2c_driver); |
| 1414 | #endif |
Mark Brown | 64089b8 | 2008-12-08 19:17:58 +0000 | [diff] [blame] | 1415 | } |
| 1416 | module_exit(aic3x_exit); |
| 1417 | |
Vladimir Barinov | 44d0a87 | 2007-11-14 17:07:17 +0100 | [diff] [blame] | 1418 | MODULE_DESCRIPTION("ASoC TLV320AIC3X codec driver"); |
| 1419 | MODULE_AUTHOR("Vladimir Barinov"); |
| 1420 | MODULE_LICENSE("GPL"); |