Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 1 | /* |
| 2 | * ALSA SoC TLV320AIC23 codec driver |
| 3 | * |
| 4 | * Author: Arun KS, <arunks@mistralsolutions.com> |
| 5 | * Copyright: (C) 2008 Mistral Solutions Pvt Ltd., |
| 6 | * |
| 7 | * Based on sound/soc/codecs/wm8731.c by Richard Purdie |
| 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 AIC23 is a driver for a low power stereo audio |
| 15 | * codec tlv320aic23 |
| 16 | * |
| 17 | * The machine layer should disable unsupported inputs/outputs by |
| 18 | * snd_soc_dapm_disable_pin(codec, "LHPOUT"), etc. |
| 19 | */ |
| 20 | |
| 21 | #include <linux/module.h> |
| 22 | #include <linux/moduleparam.h> |
| 23 | #include <linux/init.h> |
| 24 | #include <linux/delay.h> |
| 25 | #include <linux/pm.h> |
Mark Brown | 4aa11d6 | 2013-09-24 19:26:08 +0100 | [diff] [blame] | 26 | #include <linux/regmap.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 27 | #include <linux/slab.h> |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 28 | #include <sound/core.h> |
| 29 | #include <sound/pcm.h> |
| 30 | #include <sound/pcm_params.h> |
| 31 | #include <sound/soc.h> |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 32 | #include <sound/tlv.h> |
| 33 | #include <sound/initval.h> |
| 34 | |
| 35 | #include "tlv320aic23.h" |
| 36 | |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 37 | /* |
| 38 | * AIC23 register cache |
| 39 | */ |
Mark Brown | 4aa11d6 | 2013-09-24 19:26:08 +0100 | [diff] [blame] | 40 | static const struct reg_default tlv320aic23_reg[] = { |
| 41 | { 0, 0x0097 }, |
| 42 | { 1, 0x0097 }, |
| 43 | { 2, 0x00F9 }, |
| 44 | { 3, 0x00F9 }, |
| 45 | { 4, 0x001A }, |
| 46 | { 5, 0x0004 }, |
| 47 | { 6, 0x0007 }, |
| 48 | { 7, 0x0001 }, |
| 49 | { 8, 0x0020 }, |
| 50 | { 9, 0x0000 }, |
| 51 | }; |
| 52 | |
Max Filippov | b3fc572 | 2014-03-06 14:04:41 +0400 | [diff] [blame] | 53 | const struct regmap_config tlv320aic23_regmap = { |
Mark Brown | 4aa11d6 | 2013-09-24 19:26:08 +0100 | [diff] [blame] | 54 | .reg_bits = 7, |
| 55 | .val_bits = 9, |
| 56 | |
| 57 | .max_register = TLV320AIC23_RESET, |
| 58 | .reg_defaults = tlv320aic23_reg, |
| 59 | .num_reg_defaults = ARRAY_SIZE(tlv320aic23_reg), |
| 60 | .cache_type = REGCACHE_RBTREE, |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 61 | }; |
Max Filippov | 4042328 | 2014-03-08 13:31:06 +0400 | [diff] [blame] | 62 | EXPORT_SYMBOL(tlv320aic23_regmap); |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 63 | |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 64 | static const char *rec_src_text[] = { "Line", "Mic" }; |
| 65 | static const char *deemph_text[] = {"None", "32Khz", "44.1Khz", "48Khz"}; |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 66 | |
Takashi Iwai | 806057c | 2014-02-18 10:45:53 +0100 | [diff] [blame] | 67 | static SOC_ENUM_SINGLE_DECL(rec_src_enum, |
| 68 | TLV320AIC23_ANLG, 2, rec_src_text); |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 69 | |
| 70 | static const struct snd_kcontrol_new tlv320aic23_rec_src_mux_controls = |
| 71 | SOC_DAPM_ENUM("Input Select", rec_src_enum); |
| 72 | |
Takashi Iwai | 806057c | 2014-02-18 10:45:53 +0100 | [diff] [blame] | 73 | static SOC_ENUM_SINGLE_DECL(tlv320aic23_rec_src, |
| 74 | TLV320AIC23_ANLG, 2, rec_src_text); |
| 75 | static SOC_ENUM_SINGLE_DECL(tlv320aic23_deemph, |
| 76 | TLV320AIC23_DIGT, 1, deemph_text); |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 77 | |
| 78 | static const DECLARE_TLV_DB_SCALE(out_gain_tlv, -12100, 100, 0); |
| 79 | static const DECLARE_TLV_DB_SCALE(input_gain_tlv, -1725, 75, 0); |
Arun KS | df91ddf | 2008-10-03 17:07:30 +0530 | [diff] [blame] | 80 | static const DECLARE_TLV_DB_SCALE(sidetone_vol_tlv, -1800, 300, 0); |
| 81 | |
| 82 | static int snd_soc_tlv320aic23_put_volsw(struct snd_kcontrol *kcontrol, |
| 83 | struct snd_ctl_elem_value *ucontrol) |
| 84 | { |
Lars-Peter Clausen | ea53bf7 | 2014-03-18 09:02:04 +0100 | [diff] [blame] | 85 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
Arun KS | df91ddf | 2008-10-03 17:07:30 +0530 | [diff] [blame] | 86 | u16 val, reg; |
| 87 | |
| 88 | val = (ucontrol->value.integer.value[0] & 0x07); |
| 89 | |
| 90 | /* linear conversion to userspace |
| 91 | * 000 = -6db |
| 92 | * 001 = -9db |
| 93 | * 010 = -12db |
| 94 | * 011 = -18db (Min) |
| 95 | * 100 = 0db (Max) |
| 96 | */ |
| 97 | val = (val >= 4) ? 4 : (3 - val); |
| 98 | |
Axel Lin | f9dfbf9 | 2011-10-13 15:06:43 +0800 | [diff] [blame] | 99 | reg = snd_soc_read(codec, TLV320AIC23_ANLG) & (~0x1C0); |
| 100 | snd_soc_write(codec, TLV320AIC23_ANLG, reg | (val << 6)); |
Arun KS | df91ddf | 2008-10-03 17:07:30 +0530 | [diff] [blame] | 101 | |
| 102 | return 0; |
| 103 | } |
| 104 | |
| 105 | static int snd_soc_tlv320aic23_get_volsw(struct snd_kcontrol *kcontrol, |
| 106 | struct snd_ctl_elem_value *ucontrol) |
| 107 | { |
Lars-Peter Clausen | ea53bf7 | 2014-03-18 09:02:04 +0100 | [diff] [blame] | 108 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
Arun KS | df91ddf | 2008-10-03 17:07:30 +0530 | [diff] [blame] | 109 | u16 val; |
| 110 | |
Axel Lin | f9dfbf9 | 2011-10-13 15:06:43 +0800 | [diff] [blame] | 111 | val = snd_soc_read(codec, TLV320AIC23_ANLG) & (0x1C0); |
Arun KS | df91ddf | 2008-10-03 17:07:30 +0530 | [diff] [blame] | 112 | val = val >> 6; |
| 113 | val = (val >= 4) ? 4 : (3 - val); |
| 114 | ucontrol->value.integer.value[0] = val; |
| 115 | return 0; |
| 116 | |
| 117 | } |
| 118 | |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 119 | static const struct snd_kcontrol_new tlv320aic23_snd_controls[] = { |
| 120 | SOC_DOUBLE_R_TLV("Digital Playback Volume", TLV320AIC23_LCHNVOL, |
| 121 | TLV320AIC23_RCHNVOL, 0, 127, 0, out_gain_tlv), |
| 122 | SOC_SINGLE("Digital Playback Switch", TLV320AIC23_DIGT, 3, 1, 1), |
| 123 | SOC_DOUBLE_R("Line Input Switch", TLV320AIC23_LINVOL, |
| 124 | TLV320AIC23_RINVOL, 7, 1, 0), |
| 125 | SOC_DOUBLE_R_TLV("Line Input Volume", TLV320AIC23_LINVOL, |
| 126 | TLV320AIC23_RINVOL, 0, 31, 0, input_gain_tlv), |
| 127 | SOC_SINGLE("Mic Input Switch", TLV320AIC23_ANLG, 1, 1, 1), |
| 128 | SOC_SINGLE("Mic Booster Switch", TLV320AIC23_ANLG, 0, 1, 0), |
Peter Ujfalusi | 0f9887d | 2011-10-05 10:29:19 +0300 | [diff] [blame] | 129 | SOC_SINGLE_EXT_TLV("Sidetone Volume", TLV320AIC23_ANLG, 6, 4, 0, |
| 130 | snd_soc_tlv320aic23_get_volsw, |
| 131 | snd_soc_tlv320aic23_put_volsw, sidetone_vol_tlv), |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 132 | SOC_ENUM("Playback De-emphasis", tlv320aic23_deemph), |
| 133 | }; |
| 134 | |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 135 | /* PGA Mixer controls for Line and Mic switch */ |
| 136 | static const struct snd_kcontrol_new tlv320aic23_output_mixer_controls[] = { |
| 137 | SOC_DAPM_SINGLE("Line Bypass Switch", TLV320AIC23_ANLG, 3, 1, 0), |
| 138 | SOC_DAPM_SINGLE("Mic Sidetone Switch", TLV320AIC23_ANLG, 5, 1, 0), |
| 139 | SOC_DAPM_SINGLE("Playback Switch", TLV320AIC23_ANLG, 4, 1, 0), |
| 140 | }; |
| 141 | |
| 142 | static const struct snd_soc_dapm_widget tlv320aic23_dapm_widgets[] = { |
| 143 | SND_SOC_DAPM_DAC("DAC", "Playback", TLV320AIC23_PWR, 3, 1), |
| 144 | SND_SOC_DAPM_ADC("ADC", "Capture", TLV320AIC23_PWR, 2, 1), |
| 145 | SND_SOC_DAPM_MUX("Capture Source", SND_SOC_NOPM, 0, 0, |
| 146 | &tlv320aic23_rec_src_mux_controls), |
| 147 | SND_SOC_DAPM_MIXER("Output Mixer", TLV320AIC23_PWR, 4, 1, |
| 148 | &tlv320aic23_output_mixer_controls[0], |
| 149 | ARRAY_SIZE(tlv320aic23_output_mixer_controls)), |
| 150 | SND_SOC_DAPM_PGA("Line Input", TLV320AIC23_PWR, 0, 1, NULL, 0), |
| 151 | SND_SOC_DAPM_PGA("Mic Input", TLV320AIC23_PWR, 1, 1, NULL, 0), |
| 152 | |
| 153 | SND_SOC_DAPM_OUTPUT("LHPOUT"), |
| 154 | SND_SOC_DAPM_OUTPUT("RHPOUT"), |
| 155 | SND_SOC_DAPM_OUTPUT("LOUT"), |
| 156 | SND_SOC_DAPM_OUTPUT("ROUT"), |
| 157 | |
| 158 | SND_SOC_DAPM_INPUT("LLINEIN"), |
| 159 | SND_SOC_DAPM_INPUT("RLINEIN"), |
| 160 | |
| 161 | SND_SOC_DAPM_INPUT("MICIN"), |
| 162 | }; |
| 163 | |
Lu Guanqun | a7dca70 | 2011-03-30 21:53:16 +0800 | [diff] [blame] | 164 | static const struct snd_soc_dapm_route tlv320aic23_intercon[] = { |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 165 | /* Output Mixer */ |
| 166 | {"Output Mixer", "Line Bypass Switch", "Line Input"}, |
| 167 | {"Output Mixer", "Playback Switch", "DAC"}, |
| 168 | {"Output Mixer", "Mic Sidetone Switch", "Mic Input"}, |
| 169 | |
| 170 | /* Outputs */ |
| 171 | {"RHPOUT", NULL, "Output Mixer"}, |
| 172 | {"LHPOUT", NULL, "Output Mixer"}, |
| 173 | {"LOUT", NULL, "Output Mixer"}, |
| 174 | {"ROUT", NULL, "Output Mixer"}, |
| 175 | |
| 176 | /* Inputs */ |
| 177 | {"Line Input", "NULL", "LLINEIN"}, |
| 178 | {"Line Input", "NULL", "RLINEIN"}, |
| 179 | |
| 180 | {"Mic Input", "NULL", "MICIN"}, |
| 181 | |
| 182 | /* input mux */ |
| 183 | {"Capture Source", "Line", "Line Input"}, |
| 184 | {"Capture Source", "Mic", "Mic Input"}, |
| 185 | {"ADC", NULL, "Capture Source"}, |
| 186 | |
| 187 | }; |
| 188 | |
Troy Kisky | 26df91c | 2008-11-05 18:53:28 +0000 | [diff] [blame] | 189 | /* AIC23 driver data */ |
| 190 | struct aic23 { |
Mark Brown | 4aa11d6 | 2013-09-24 19:26:08 +0100 | [diff] [blame] | 191 | struct regmap *regmap; |
Troy Kisky | 26df91c | 2008-11-05 18:53:28 +0000 | [diff] [blame] | 192 | int mclk; |
| 193 | int requested_adc; |
| 194 | int requested_dac; |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 195 | }; |
| 196 | |
Troy Kisky | 26df91c | 2008-11-05 18:53:28 +0000 | [diff] [blame] | 197 | /* |
| 198 | * Common Crystals used |
| 199 | * 11.2896 Mhz /128 = *88.2k /192 = 58.8k |
| 200 | * 12.0000 Mhz /125 = *96k /136 = 88.235K |
| 201 | * 12.2880 Mhz /128 = *96k /192 = 64k |
| 202 | * 16.9344 Mhz /128 = 132.3k /192 = *88.2k |
| 203 | * 18.4320 Mhz /128 = 144k /192 = *96k |
| 204 | */ |
| 205 | |
| 206 | /* |
| 207 | * Normal BOSR 0-256/2 = 128, 1-384/2 = 192 |
| 208 | * USB BOSR 0-250/2 = 125, 1-272/2 = 136 |
| 209 | */ |
| 210 | static const int bosr_usb_divisor_table[] = { |
| 211 | 128, 125, 192, 136 |
| 212 | }; |
| 213 | #define LOWER_GROUP ((1<<0) | (1<<1) | (1<<2) | (1<<3) | (1<<6) | (1<<7)) |
| 214 | #define UPPER_GROUP ((1<<8) | (1<<9) | (1<<10) | (1<<11) | (1<<15)) |
| 215 | static const unsigned short sr_valid_mask[] = { |
| 216 | LOWER_GROUP|UPPER_GROUP, /* Normal, bosr - 0*/ |
Troy Kisky | 26df91c | 2008-11-05 18:53:28 +0000 | [diff] [blame] | 217 | LOWER_GROUP, /* Usb, bosr - 0*/ |
Troy Kisky | bab0212 | 2009-11-17 13:51:01 -0700 | [diff] [blame] | 218 | LOWER_GROUP|UPPER_GROUP, /* Normal, bosr - 1*/ |
Troy Kisky | 26df91c | 2008-11-05 18:53:28 +0000 | [diff] [blame] | 219 | UPPER_GROUP, /* Usb, bosr - 1*/ |
| 220 | }; |
| 221 | /* |
| 222 | * Every divisor is a factor of 11*12 |
| 223 | */ |
| 224 | #define SR_MULT (11*12) |
Troy Kisky | ccff4b1 | 2009-06-05 19:15:58 -0700 | [diff] [blame] | 225 | #define A(x) (SR_MULT/x) |
Troy Kisky | 26df91c | 2008-11-05 18:53:28 +0000 | [diff] [blame] | 226 | static const unsigned char sr_adc_mult_table[] = { |
Troy Kisky | ccff4b1 | 2009-06-05 19:15:58 -0700 | [diff] [blame] | 227 | A(2), A(2), A(12), A(12), 0, 0, A(3), A(1), |
| 228 | A(2), A(2), A(11), A(11), 0, 0, 0, A(1) |
Troy Kisky | 26df91c | 2008-11-05 18:53:28 +0000 | [diff] [blame] | 229 | }; |
| 230 | static const unsigned char sr_dac_mult_table[] = { |
Troy Kisky | ccff4b1 | 2009-06-05 19:15:58 -0700 | [diff] [blame] | 231 | A(2), A(12), A(2), A(12), 0, 0, A(3), A(1), |
| 232 | A(2), A(11), A(2), A(11), 0, 0, 0, A(1) |
Troy Kisky | 26df91c | 2008-11-05 18:53:28 +0000 | [diff] [blame] | 233 | }; |
| 234 | |
| 235 | static unsigned get_score(int adc, int adc_l, int adc_h, int need_adc, |
| 236 | int dac, int dac_l, int dac_h, int need_dac) |
| 237 | { |
| 238 | if ((adc >= adc_l) && (adc <= adc_h) && |
| 239 | (dac >= dac_l) && (dac <= dac_h)) { |
| 240 | int diff_adc = need_adc - adc; |
| 241 | int diff_dac = need_dac - dac; |
| 242 | return abs(diff_adc) + abs(diff_dac); |
| 243 | } |
| 244 | return UINT_MAX; |
| 245 | } |
| 246 | |
| 247 | static int find_rate(int mclk, u32 need_adc, u32 need_dac) |
| 248 | { |
| 249 | int i, j; |
| 250 | int best_i = -1; |
| 251 | int best_j = -1; |
| 252 | int best_div = 0; |
| 253 | unsigned best_score = UINT_MAX; |
| 254 | int adc_l, adc_h, dac_l, dac_h; |
| 255 | |
| 256 | need_adc *= SR_MULT; |
| 257 | need_dac *= SR_MULT; |
| 258 | /* |
| 259 | * rates given are +/- 1/32 |
| 260 | */ |
| 261 | adc_l = need_adc - (need_adc >> 5); |
| 262 | adc_h = need_adc + (need_adc >> 5); |
| 263 | dac_l = need_dac - (need_dac >> 5); |
| 264 | dac_h = need_dac + (need_dac >> 5); |
Mark Brown | 8d702f2 | 2008-11-17 21:42:01 +0000 | [diff] [blame] | 265 | for (i = 0; i < ARRAY_SIZE(bosr_usb_divisor_table); i++) { |
Troy Kisky | 26df91c | 2008-11-05 18:53:28 +0000 | [diff] [blame] | 266 | int base = mclk / bosr_usb_divisor_table[i]; |
| 267 | int mask = sr_valid_mask[i]; |
Mark Brown | 8d702f2 | 2008-11-17 21:42:01 +0000 | [diff] [blame] | 268 | for (j = 0; j < ARRAY_SIZE(sr_adc_mult_table); |
| 269 | j++, mask >>= 1) { |
Troy Kisky | 26df91c | 2008-11-05 18:53:28 +0000 | [diff] [blame] | 270 | int adc; |
| 271 | int dac; |
| 272 | int score; |
| 273 | if ((mask & 1) == 0) |
| 274 | continue; |
| 275 | adc = base * sr_adc_mult_table[j]; |
| 276 | dac = base * sr_dac_mult_table[j]; |
| 277 | score = get_score(adc, adc_l, adc_h, need_adc, |
| 278 | dac, dac_l, dac_h, need_dac); |
| 279 | if (best_score > score) { |
| 280 | best_score = score; |
| 281 | best_i = i; |
| 282 | best_j = j; |
| 283 | best_div = 0; |
| 284 | } |
| 285 | score = get_score((adc >> 1), adc_l, adc_h, need_adc, |
| 286 | (dac >> 1), dac_l, dac_h, need_dac); |
| 287 | /* prefer to have a /2 */ |
| 288 | if ((score != UINT_MAX) && (best_score >= score)) { |
| 289 | best_score = score; |
| 290 | best_i = i; |
| 291 | best_j = j; |
| 292 | best_div = 1; |
| 293 | } |
| 294 | } |
| 295 | } |
| 296 | return (best_j << 2) | best_i | (best_div << TLV320AIC23_CLKIN_SHIFT); |
| 297 | } |
| 298 | |
Mark Brown | 8d702f2 | 2008-11-17 21:42:01 +0000 | [diff] [blame] | 299 | #ifdef DEBUG |
Troy Kisky | 26df91c | 2008-11-05 18:53:28 +0000 | [diff] [blame] | 300 | static void get_current_sample_rates(struct snd_soc_codec *codec, int mclk, |
| 301 | u32 *sample_rate_adc, u32 *sample_rate_dac) |
| 302 | { |
Axel Lin | f9dfbf9 | 2011-10-13 15:06:43 +0800 | [diff] [blame] | 303 | int src = snd_soc_read(codec, TLV320AIC23_SRATE); |
Troy Kisky | 26df91c | 2008-11-05 18:53:28 +0000 | [diff] [blame] | 304 | int sr = (src >> 2) & 0x0f; |
| 305 | int val = (mclk / bosr_usb_divisor_table[src & 3]); |
| 306 | int adc = (val * sr_adc_mult_table[sr]) / SR_MULT; |
| 307 | int dac = (val * sr_dac_mult_table[sr]) / SR_MULT; |
| 308 | if (src & TLV320AIC23_CLKIN_HALF) { |
| 309 | adc >>= 1; |
| 310 | dac >>= 1; |
| 311 | } |
| 312 | *sample_rate_adc = adc; |
| 313 | *sample_rate_dac = dac; |
| 314 | } |
Mark Brown | 8d702f2 | 2008-11-17 21:42:01 +0000 | [diff] [blame] | 315 | #endif |
Troy Kisky | 26df91c | 2008-11-05 18:53:28 +0000 | [diff] [blame] | 316 | |
| 317 | static int set_sample_rate_control(struct snd_soc_codec *codec, int mclk, |
| 318 | u32 sample_rate_adc, u32 sample_rate_dac) |
| 319 | { |
| 320 | /* Search for the right sample rate */ |
| 321 | int data = find_rate(mclk, sample_rate_adc, sample_rate_dac); |
| 322 | if (data < 0) { |
| 323 | printk(KERN_ERR "%s:Invalid rate %u,%u requested\n", |
| 324 | __func__, sample_rate_adc, sample_rate_dac); |
| 325 | return -EINVAL; |
| 326 | } |
Axel Lin | f9dfbf9 | 2011-10-13 15:06:43 +0800 | [diff] [blame] | 327 | snd_soc_write(codec, TLV320AIC23_SRATE, data); |
Mark Brown | 8d702f2 | 2008-11-17 21:42:01 +0000 | [diff] [blame] | 328 | #ifdef DEBUG |
| 329 | { |
| 330 | u32 adc, dac; |
Troy Kisky | 26df91c | 2008-11-05 18:53:28 +0000 | [diff] [blame] | 331 | get_current_sample_rates(codec, mclk, &adc, &dac); |
| 332 | printk(KERN_DEBUG "actual samplerate = %u,%u reg=%x\n", |
| 333 | adc, dac, data); |
| 334 | } |
Mark Brown | 8d702f2 | 2008-11-17 21:42:01 +0000 | [diff] [blame] | 335 | #endif |
Troy Kisky | 26df91c | 2008-11-05 18:53:28 +0000 | [diff] [blame] | 336 | return 0; |
| 337 | } |
| 338 | |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 339 | static int tlv320aic23_hw_params(struct snd_pcm_substream *substream, |
Mark Brown | dee89c4 | 2008-11-18 22:11:38 +0000 | [diff] [blame] | 340 | struct snd_pcm_hw_params *params, |
| 341 | struct snd_soc_dai *dai) |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 342 | { |
Mark Brown | e6968a1 | 2012-04-04 15:58:16 +0100 | [diff] [blame] | 343 | struct snd_soc_codec *codec = dai->codec; |
Troy Kisky | 26df91c | 2008-11-05 18:53:28 +0000 | [diff] [blame] | 344 | u16 iface_reg; |
| 345 | int ret; |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 346 | struct aic23 *aic23 = snd_soc_codec_get_drvdata(codec); |
Troy Kisky | 26df91c | 2008-11-05 18:53:28 +0000 | [diff] [blame] | 347 | u32 sample_rate_adc = aic23->requested_adc; |
| 348 | u32 sample_rate_dac = aic23->requested_dac; |
| 349 | u32 sample_rate = params_rate(params); |
| 350 | |
| 351 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
| 352 | aic23->requested_dac = sample_rate_dac = sample_rate; |
| 353 | if (!sample_rate_adc) |
| 354 | sample_rate_adc = sample_rate; |
| 355 | } else { |
| 356 | aic23->requested_adc = sample_rate_adc = sample_rate; |
| 357 | if (!sample_rate_dac) |
| 358 | sample_rate_dac = sample_rate; |
| 359 | } |
| 360 | ret = set_sample_rate_control(codec, aic23->mclk, sample_rate_adc, |
| 361 | sample_rate_dac); |
| 362 | if (ret < 0) |
| 363 | return ret; |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 364 | |
Axel Lin | f9dfbf9 | 2011-10-13 15:06:43 +0800 | [diff] [blame] | 365 | iface_reg = snd_soc_read(codec, TLV320AIC23_DIGT_FMT) & ~(0x03 << 2); |
| 366 | |
Mark Brown | 08074dc | 2014-07-29 20:13:00 +0100 | [diff] [blame] | 367 | switch (params_width(params)) { |
| 368 | case 16: |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 369 | break; |
Mark Brown | 08074dc | 2014-07-29 20:13:00 +0100 | [diff] [blame] | 370 | case 20: |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 371 | iface_reg |= (0x01 << 2); |
| 372 | break; |
Mark Brown | 08074dc | 2014-07-29 20:13:00 +0100 | [diff] [blame] | 373 | case 24: |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 374 | iface_reg |= (0x02 << 2); |
| 375 | break; |
Mark Brown | 08074dc | 2014-07-29 20:13:00 +0100 | [diff] [blame] | 376 | case 32: |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 377 | iface_reg |= (0x03 << 2); |
| 378 | break; |
| 379 | } |
Axel Lin | f9dfbf9 | 2011-10-13 15:06:43 +0800 | [diff] [blame] | 380 | snd_soc_write(codec, TLV320AIC23_DIGT_FMT, iface_reg); |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 381 | |
| 382 | return 0; |
| 383 | } |
| 384 | |
Mark Brown | dee89c4 | 2008-11-18 22:11:38 +0000 | [diff] [blame] | 385 | static int tlv320aic23_pcm_prepare(struct snd_pcm_substream *substream, |
| 386 | struct snd_soc_dai *dai) |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 387 | { |
Mark Brown | e6968a1 | 2012-04-04 15:58:16 +0100 | [diff] [blame] | 388 | struct snd_soc_codec *codec = dai->codec; |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 389 | |
| 390 | /* set active */ |
Axel Lin | f9dfbf9 | 2011-10-13 15:06:43 +0800 | [diff] [blame] | 391 | snd_soc_write(codec, TLV320AIC23_ACTIVE, 0x0001); |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 392 | |
| 393 | return 0; |
| 394 | } |
| 395 | |
Mark Brown | dee89c4 | 2008-11-18 22:11:38 +0000 | [diff] [blame] | 396 | static void tlv320aic23_shutdown(struct snd_pcm_substream *substream, |
| 397 | struct snd_soc_dai *dai) |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 398 | { |
Mark Brown | e6968a1 | 2012-04-04 15:58:16 +0100 | [diff] [blame] | 399 | struct snd_soc_codec *codec = dai->codec; |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 400 | struct aic23 *aic23 = snd_soc_codec_get_drvdata(codec); |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 401 | |
| 402 | /* deactivate */ |
Lars-Peter Clausen | 5c898e7 | 2014-03-05 13:17:45 +0100 | [diff] [blame] | 403 | if (!snd_soc_codec_is_active(codec)) { |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 404 | udelay(50); |
Axel Lin | f9dfbf9 | 2011-10-13 15:06:43 +0800 | [diff] [blame] | 405 | snd_soc_write(codec, TLV320AIC23_ACTIVE, 0x0); |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 406 | } |
Troy Kisky | 26df91c | 2008-11-05 18:53:28 +0000 | [diff] [blame] | 407 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
| 408 | aic23->requested_dac = 0; |
| 409 | else |
| 410 | aic23->requested_adc = 0; |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 411 | } |
| 412 | |
| 413 | static int tlv320aic23_mute(struct snd_soc_dai *dai, int mute) |
| 414 | { |
| 415 | struct snd_soc_codec *codec = dai->codec; |
| 416 | u16 reg; |
| 417 | |
Axel Lin | f9dfbf9 | 2011-10-13 15:06:43 +0800 | [diff] [blame] | 418 | reg = snd_soc_read(codec, TLV320AIC23_DIGT); |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 419 | if (mute) |
| 420 | reg |= TLV320AIC23_DACM_MUTE; |
| 421 | |
| 422 | else |
| 423 | reg &= ~TLV320AIC23_DACM_MUTE; |
| 424 | |
Axel Lin | f9dfbf9 | 2011-10-13 15:06:43 +0800 | [diff] [blame] | 425 | snd_soc_write(codec, TLV320AIC23_DIGT, reg); |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 426 | |
| 427 | return 0; |
| 428 | } |
| 429 | |
| 430 | static int tlv320aic23_set_dai_fmt(struct snd_soc_dai *codec_dai, |
| 431 | unsigned int fmt) |
| 432 | { |
| 433 | struct snd_soc_codec *codec = codec_dai->codec; |
| 434 | u16 iface_reg; |
| 435 | |
Axel Lin | f9dfbf9 | 2011-10-13 15:06:43 +0800 | [diff] [blame] | 436 | iface_reg = snd_soc_read(codec, TLV320AIC23_DIGT_FMT) & (~0x03); |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 437 | |
| 438 | /* set master/slave audio interface */ |
| 439 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { |
| 440 | case SND_SOC_DAIFMT_CBM_CFM: |
| 441 | iface_reg |= TLV320AIC23_MS_MASTER; |
| 442 | break; |
| 443 | case SND_SOC_DAIFMT_CBS_CFS: |
Axel Lin | b01a3d6 | 2011-10-27 16:35:49 +0800 | [diff] [blame] | 444 | iface_reg &= ~TLV320AIC23_MS_MASTER; |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 445 | break; |
| 446 | default: |
| 447 | return -EINVAL; |
| 448 | |
| 449 | } |
| 450 | |
| 451 | /* interface format */ |
| 452 | switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { |
| 453 | case SND_SOC_DAIFMT_I2S: |
| 454 | iface_reg |= TLV320AIC23_FOR_I2S; |
| 455 | break; |
Peter Ujfalusi | 894bf92 | 2009-04-09 12:34:40 +0300 | [diff] [blame] | 456 | case SND_SOC_DAIFMT_DSP_A: |
| 457 | iface_reg |= TLV320AIC23_LRP_ON; |
Jarkko Nikula | bd25867 | 2008-12-22 10:21:36 +0200 | [diff] [blame] | 458 | case SND_SOC_DAIFMT_DSP_B: |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 459 | iface_reg |= TLV320AIC23_FOR_DSP; |
| 460 | break; |
| 461 | case SND_SOC_DAIFMT_RIGHT_J: |
| 462 | break; |
| 463 | case SND_SOC_DAIFMT_LEFT_J: |
| 464 | iface_reg |= TLV320AIC23_FOR_LJUST; |
| 465 | break; |
| 466 | default: |
| 467 | return -EINVAL; |
| 468 | |
| 469 | } |
| 470 | |
Axel Lin | f9dfbf9 | 2011-10-13 15:06:43 +0800 | [diff] [blame] | 471 | snd_soc_write(codec, TLV320AIC23_DIGT_FMT, iface_reg); |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 472 | |
| 473 | return 0; |
| 474 | } |
| 475 | |
| 476 | static int tlv320aic23_set_dai_sysclk(struct snd_soc_dai *codec_dai, |
| 477 | int clk_id, unsigned int freq, int dir) |
| 478 | { |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 479 | struct aic23 *aic23 = snd_soc_dai_get_drvdata(codec_dai); |
Troy Kisky | 26df91c | 2008-11-05 18:53:28 +0000 | [diff] [blame] | 480 | aic23->mclk = freq; |
| 481 | return 0; |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 482 | } |
| 483 | |
| 484 | static int tlv320aic23_set_bias_level(struct snd_soc_codec *codec, |
| 485 | enum snd_soc_bias_level level) |
| 486 | { |
Eric Bénard | e875c1e | 2012-04-29 17:37:57 +0200 | [diff] [blame] | 487 | u16 reg = snd_soc_read(codec, TLV320AIC23_PWR) & 0x17f; |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 488 | |
| 489 | switch (level) { |
| 490 | case SND_SOC_BIAS_ON: |
| 491 | /* vref/mid, osc on, dac unmute */ |
Eric Bénard | 3d5a451 | 2010-06-19 19:33:39 +0200 | [diff] [blame] | 492 | reg &= ~(TLV320AIC23_DEVICE_PWR_OFF | TLV320AIC23_OSC_OFF | \ |
| 493 | TLV320AIC23_DAC_OFF); |
Axel Lin | f9dfbf9 | 2011-10-13 15:06:43 +0800 | [diff] [blame] | 494 | snd_soc_write(codec, TLV320AIC23_PWR, reg); |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 495 | break; |
| 496 | case SND_SOC_BIAS_PREPARE: |
| 497 | break; |
| 498 | case SND_SOC_BIAS_STANDBY: |
| 499 | /* everything off except vref/vmid, */ |
Axel Lin | f9dfbf9 | 2011-10-13 15:06:43 +0800 | [diff] [blame] | 500 | snd_soc_write(codec, TLV320AIC23_PWR, |
| 501 | reg | TLV320AIC23_CLK_OFF); |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 502 | break; |
| 503 | case SND_SOC_BIAS_OFF: |
| 504 | /* everything off, dac mute, inactive */ |
Axel Lin | f9dfbf9 | 2011-10-13 15:06:43 +0800 | [diff] [blame] | 505 | snd_soc_write(codec, TLV320AIC23_ACTIVE, 0x0); |
Eric Bénard | e875c1e | 2012-04-29 17:37:57 +0200 | [diff] [blame] | 506 | snd_soc_write(codec, TLV320AIC23_PWR, 0x1ff); |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 507 | break; |
| 508 | } |
Liam Girdwood | ce6120c | 2010-11-05 15:53:46 +0200 | [diff] [blame] | 509 | codec->dapm.bias_level = level; |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 510 | return 0; |
| 511 | } |
| 512 | |
| 513 | #define AIC23_RATES SNDRV_PCM_RATE_8000_96000 |
| 514 | #define AIC23_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ |
| 515 | SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE) |
| 516 | |
Lars-Peter Clausen | 85e7652 | 2011-11-23 11:40:40 +0100 | [diff] [blame] | 517 | static const struct snd_soc_dai_ops tlv320aic23_dai_ops = { |
Eric Miao | 6335d05 | 2009-03-03 09:41:00 +0800 | [diff] [blame] | 518 | .prepare = tlv320aic23_pcm_prepare, |
| 519 | .hw_params = tlv320aic23_hw_params, |
| 520 | .shutdown = tlv320aic23_shutdown, |
| 521 | .digital_mute = tlv320aic23_mute, |
| 522 | .set_fmt = tlv320aic23_set_dai_fmt, |
| 523 | .set_sysclk = tlv320aic23_set_dai_sysclk, |
| 524 | }; |
| 525 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 526 | static struct snd_soc_dai_driver tlv320aic23_dai = { |
| 527 | .name = "tlv320aic23-hifi", |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 528 | .playback = { |
| 529 | .stream_name = "Playback", |
| 530 | .channels_min = 2, |
| 531 | .channels_max = 2, |
| 532 | .rates = AIC23_RATES, |
| 533 | .formats = AIC23_FORMATS,}, |
| 534 | .capture = { |
| 535 | .stream_name = "Capture", |
| 536 | .channels_min = 2, |
| 537 | .channels_max = 2, |
| 538 | .rates = AIC23_RATES, |
| 539 | .formats = AIC23_FORMATS,}, |
Eric Miao | 6335d05 | 2009-03-03 09:41:00 +0800 | [diff] [blame] | 540 | .ops = &tlv320aic23_dai_ops, |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 541 | }; |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 542 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 543 | static int tlv320aic23_resume(struct snd_soc_codec *codec) |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 544 | { |
Mark Brown | 4aa11d6 | 2013-09-24 19:26:08 +0100 | [diff] [blame] | 545 | struct aic23 *aic23 = snd_soc_codec_get_drvdata(codec); |
| 546 | regcache_mark_dirty(aic23->regmap); |
| 547 | regcache_sync(aic23->regmap); |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 548 | |
| 549 | return 0; |
| 550 | } |
| 551 | |
Max Filippov | b3fc572 | 2014-03-06 14:04:41 +0400 | [diff] [blame] | 552 | static int tlv320aic23_codec_probe(struct snd_soc_codec *codec) |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 553 | { |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 554 | /* Reset codec */ |
Axel Lin | f9dfbf9 | 2011-10-13 15:06:43 +0800 | [diff] [blame] | 555 | snd_soc_write(codec, TLV320AIC23_RESET, 0); |
| 556 | |
Axel Lin | f9dfbf9 | 2011-10-13 15:06:43 +0800 | [diff] [blame] | 557 | snd_soc_write(codec, TLV320AIC23_DIGT, TLV320AIC23_DEEMP_44K); |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 558 | |
| 559 | /* Unmute input */ |
Axel Lin | f9dfbf9 | 2011-10-13 15:06:43 +0800 | [diff] [blame] | 560 | snd_soc_update_bits(codec, TLV320AIC23_LINVOL, |
| 561 | TLV320AIC23_LIM_MUTED, TLV320AIC23_LRS_ENABLED); |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 562 | |
Axel Lin | f9dfbf9 | 2011-10-13 15:06:43 +0800 | [diff] [blame] | 563 | snd_soc_update_bits(codec, TLV320AIC23_RINVOL, |
| 564 | TLV320AIC23_LIM_MUTED, TLV320AIC23_LRS_ENABLED); |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 565 | |
Axel Lin | f9dfbf9 | 2011-10-13 15:06:43 +0800 | [diff] [blame] | 566 | snd_soc_update_bits(codec, TLV320AIC23_ANLG, |
| 567 | TLV320AIC23_BYPASS_ON | TLV320AIC23_MICM_MUTED, |
| 568 | 0); |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 569 | |
| 570 | /* Default output volume */ |
Axel Lin | f9dfbf9 | 2011-10-13 15:06:43 +0800 | [diff] [blame] | 571 | snd_soc_write(codec, TLV320AIC23_LCHNVOL, |
| 572 | TLV320AIC23_DEFAULT_OUT_VOL & TLV320AIC23_OUT_VOL_MASK); |
| 573 | snd_soc_write(codec, TLV320AIC23_RCHNVOL, |
| 574 | TLV320AIC23_DEFAULT_OUT_VOL & TLV320AIC23_OUT_VOL_MASK); |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 575 | |
Axel Lin | f9dfbf9 | 2011-10-13 15:06:43 +0800 | [diff] [blame] | 576 | snd_soc_write(codec, TLV320AIC23_ACTIVE, 0x1); |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 577 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 578 | return 0; |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 579 | } |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 580 | |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 581 | static struct snd_soc_codec_driver soc_codec_dev_tlv320aic23 = { |
Max Filippov | b3fc572 | 2014-03-06 14:04:41 +0400 | [diff] [blame] | 582 | .probe = tlv320aic23_codec_probe, |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 583 | .resume = tlv320aic23_resume, |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 584 | .set_bias_level = tlv320aic23_set_bias_level, |
Lars-Peter Clausen | aabb87f | 2014-11-26 20:57:54 +0100 | [diff] [blame] | 585 | .suspend_bias_off = true, |
| 586 | |
Mark Brown | b07c443 | 2013-09-24 18:51:26 +0100 | [diff] [blame] | 587 | .controls = tlv320aic23_snd_controls, |
| 588 | .num_controls = ARRAY_SIZE(tlv320aic23_snd_controls), |
Lu Guanqun | a7dca70 | 2011-03-30 21:53:16 +0800 | [diff] [blame] | 589 | .dapm_widgets = tlv320aic23_dapm_widgets, |
| 590 | .num_dapm_widgets = ARRAY_SIZE(tlv320aic23_dapm_widgets), |
| 591 | .dapm_routes = tlv320aic23_intercon, |
| 592 | .num_dapm_routes = ARRAY_SIZE(tlv320aic23_intercon), |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 593 | }; |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 594 | |
Max Filippov | b3fc572 | 2014-03-06 14:04:41 +0400 | [diff] [blame] | 595 | int tlv320aic23_probe(struct device *dev, struct regmap *regmap) |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 596 | { |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 597 | struct aic23 *aic23; |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 598 | |
Max Filippov | b3fc572 | 2014-03-06 14:04:41 +0400 | [diff] [blame] | 599 | if (IS_ERR(regmap)) |
| 600 | return PTR_ERR(regmap); |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 601 | |
Max Filippov | b3fc572 | 2014-03-06 14:04:41 +0400 | [diff] [blame] | 602 | aic23 = devm_kzalloc(dev, sizeof(struct aic23), GFP_KERNEL); |
Liam Girdwood | f0fba2a | 2010-03-17 20:15:21 +0000 | [diff] [blame] | 603 | if (aic23 == NULL) |
| 604 | return -ENOMEM; |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 605 | |
Max Filippov | b3fc572 | 2014-03-06 14:04:41 +0400 | [diff] [blame] | 606 | aic23->regmap = regmap; |
Mark Brown | 4aa11d6 | 2013-09-24 19:26:08 +0100 | [diff] [blame] | 607 | |
Max Filippov | b3fc572 | 2014-03-06 14:04:41 +0400 | [diff] [blame] | 608 | dev_set_drvdata(dev, aic23); |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 609 | |
Max Filippov | b3fc572 | 2014-03-06 14:04:41 +0400 | [diff] [blame] | 610 | return snd_soc_register_codec(dev, &soc_codec_dev_tlv320aic23, |
| 611 | &tlv320aic23_dai, 1); |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 612 | } |
Max Filippov | 4042328 | 2014-03-08 13:31:06 +0400 | [diff] [blame] | 613 | EXPORT_SYMBOL(tlv320aic23_probe); |
Mark Brown | 64089b8 | 2008-12-08 19:17:58 +0000 | [diff] [blame] | 614 | |
Arun KS | c1f2719 | 2008-10-02 14:45:49 +0530 | [diff] [blame] | 615 | MODULE_DESCRIPTION("ASoC TLV320AIC23 codec driver"); |
| 616 | MODULE_AUTHOR("Arun KS <arunks@mistralsolutions.com>"); |
| 617 | MODULE_LICENSE("GPL"); |