2 * ALSA SoC TLV320AIC23 codec driver
4 * Author: Arun KS, <arunks@mistralsolutions.com>
5 * Copyright: (C) 2008 Mistral Solutions Pvt Ltd.,
7 * Based on sound/soc/codecs/wm8731.c by Richard Purdie
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.
14 * The AIC23 is a driver for a low power stereo audio
17 * The machine layer should disable unsupported inputs/outputs by
18 * snd_soc_dapm_disable_pin(codec, "LHPOUT"), etc.
21 #include <linux/module.h>
22 #include <linux/moduleparam.h>
23 #include <linux/init.h>
24 #include <linux/delay.h>
26 #include <linux/i2c.h>
27 #include <linux/platform_device.h>
28 #include <linux/slab.h>
29 #include <sound/core.h>
30 #include <sound/pcm.h>
31 #include <sound/pcm_params.h>
32 #include <sound/soc.h>
33 #include <sound/tlv.h>
34 #include <sound/initval.h>
36 #include "tlv320aic23.h"
38 #define AIC23_VERSION "0.1"
41 * AIC23 register cache
43 static const u16 tlv320aic23_reg[] = {
44 0x0097, 0x0097, 0x00F9, 0x00F9, /* 0 */
45 0x001A, 0x0004, 0x0007, 0x0001, /* 4 */
46 0x0020, 0x0000, 0x0000, 0x0000, /* 8 */
47 0x0000, 0x0000, 0x0000, 0x0000, /* 12 */
50 static const char *rec_src_text[] = { "Line", "Mic" };
51 static const char *deemph_text[] = {"None", "32Khz", "44.1Khz", "48Khz"};
53 static const struct soc_enum rec_src_enum =
54 SOC_ENUM_SINGLE(TLV320AIC23_ANLG, 2, 2, rec_src_text);
56 static const struct snd_kcontrol_new tlv320aic23_rec_src_mux_controls =
57 SOC_DAPM_ENUM("Input Select", rec_src_enum);
59 static const struct soc_enum tlv320aic23_rec_src =
60 SOC_ENUM_SINGLE(TLV320AIC23_ANLG, 2, 2, rec_src_text);
61 static const struct soc_enum tlv320aic23_deemph =
62 SOC_ENUM_SINGLE(TLV320AIC23_DIGT, 1, 4, deemph_text);
64 static const DECLARE_TLV_DB_SCALE(out_gain_tlv, -12100, 100, 0);
65 static const DECLARE_TLV_DB_SCALE(input_gain_tlv, -1725, 75, 0);
66 static const DECLARE_TLV_DB_SCALE(sidetone_vol_tlv, -1800, 300, 0);
68 static int snd_soc_tlv320aic23_put_volsw(struct snd_kcontrol *kcontrol,
69 struct snd_ctl_elem_value *ucontrol)
71 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
74 val = (ucontrol->value.integer.value[0] & 0x07);
76 /* linear conversion to userspace
83 val = (val >= 4) ? 4 : (3 - val);
85 reg = snd_soc_read(codec, TLV320AIC23_ANLG) & (~0x1C0);
86 snd_soc_write(codec, TLV320AIC23_ANLG, reg | (val << 6));
91 static int snd_soc_tlv320aic23_get_volsw(struct snd_kcontrol *kcontrol,
92 struct snd_ctl_elem_value *ucontrol)
94 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
97 val = snd_soc_read(codec, TLV320AIC23_ANLG) & (0x1C0);
99 val = (val >= 4) ? 4 : (3 - val);
100 ucontrol->value.integer.value[0] = val;
105 static const struct snd_kcontrol_new tlv320aic23_snd_controls[] = {
106 SOC_DOUBLE_R_TLV("Digital Playback Volume", TLV320AIC23_LCHNVOL,
107 TLV320AIC23_RCHNVOL, 0, 127, 0, out_gain_tlv),
108 SOC_SINGLE("Digital Playback Switch", TLV320AIC23_DIGT, 3, 1, 1),
109 SOC_DOUBLE_R("Line Input Switch", TLV320AIC23_LINVOL,
110 TLV320AIC23_RINVOL, 7, 1, 0),
111 SOC_DOUBLE_R_TLV("Line Input Volume", TLV320AIC23_LINVOL,
112 TLV320AIC23_RINVOL, 0, 31, 0, input_gain_tlv),
113 SOC_SINGLE("Mic Input Switch", TLV320AIC23_ANLG, 1, 1, 1),
114 SOC_SINGLE("Mic Booster Switch", TLV320AIC23_ANLG, 0, 1, 0),
115 SOC_SINGLE_EXT_TLV("Sidetone Volume", TLV320AIC23_ANLG, 6, 4, 0,
116 snd_soc_tlv320aic23_get_volsw,
117 snd_soc_tlv320aic23_put_volsw, sidetone_vol_tlv),
118 SOC_ENUM("Playback De-emphasis", tlv320aic23_deemph),
121 /* PGA Mixer controls for Line and Mic switch */
122 static const struct snd_kcontrol_new tlv320aic23_output_mixer_controls[] = {
123 SOC_DAPM_SINGLE("Line Bypass Switch", TLV320AIC23_ANLG, 3, 1, 0),
124 SOC_DAPM_SINGLE("Mic Sidetone Switch", TLV320AIC23_ANLG, 5, 1, 0),
125 SOC_DAPM_SINGLE("Playback Switch", TLV320AIC23_ANLG, 4, 1, 0),
128 static const struct snd_soc_dapm_widget tlv320aic23_dapm_widgets[] = {
129 SND_SOC_DAPM_DAC("DAC", "Playback", TLV320AIC23_PWR, 3, 1),
130 SND_SOC_DAPM_ADC("ADC", "Capture", TLV320AIC23_PWR, 2, 1),
131 SND_SOC_DAPM_MUX("Capture Source", SND_SOC_NOPM, 0, 0,
132 &tlv320aic23_rec_src_mux_controls),
133 SND_SOC_DAPM_MIXER("Output Mixer", TLV320AIC23_PWR, 4, 1,
134 &tlv320aic23_output_mixer_controls[0],
135 ARRAY_SIZE(tlv320aic23_output_mixer_controls)),
136 SND_SOC_DAPM_PGA("Line Input", TLV320AIC23_PWR, 0, 1, NULL, 0),
137 SND_SOC_DAPM_PGA("Mic Input", TLV320AIC23_PWR, 1, 1, NULL, 0),
139 SND_SOC_DAPM_OUTPUT("LHPOUT"),
140 SND_SOC_DAPM_OUTPUT("RHPOUT"),
141 SND_SOC_DAPM_OUTPUT("LOUT"),
142 SND_SOC_DAPM_OUTPUT("ROUT"),
144 SND_SOC_DAPM_INPUT("LLINEIN"),
145 SND_SOC_DAPM_INPUT("RLINEIN"),
147 SND_SOC_DAPM_INPUT("MICIN"),
150 static const struct snd_soc_dapm_route tlv320aic23_intercon[] = {
152 {"Output Mixer", "Line Bypass Switch", "Line Input"},
153 {"Output Mixer", "Playback Switch", "DAC"},
154 {"Output Mixer", "Mic Sidetone Switch", "Mic Input"},
157 {"RHPOUT", NULL, "Output Mixer"},
158 {"LHPOUT", NULL, "Output Mixer"},
159 {"LOUT", NULL, "Output Mixer"},
160 {"ROUT", NULL, "Output Mixer"},
163 {"Line Input", "NULL", "LLINEIN"},
164 {"Line Input", "NULL", "RLINEIN"},
166 {"Mic Input", "NULL", "MICIN"},
169 {"Capture Source", "Line", "Line Input"},
170 {"Capture Source", "Mic", "Mic Input"},
171 {"ADC", NULL, "Capture Source"},
175 /* AIC23 driver data */
177 enum snd_soc_control_type control_type;
184 * Common Crystals used
185 * 11.2896 Mhz /128 = *88.2k /192 = 58.8k
186 * 12.0000 Mhz /125 = *96k /136 = 88.235K
187 * 12.2880 Mhz /128 = *96k /192 = 64k
188 * 16.9344 Mhz /128 = 132.3k /192 = *88.2k
189 * 18.4320 Mhz /128 = 144k /192 = *96k
193 * Normal BOSR 0-256/2 = 128, 1-384/2 = 192
194 * USB BOSR 0-250/2 = 125, 1-272/2 = 136
196 static const int bosr_usb_divisor_table[] = {
199 #define LOWER_GROUP ((1<<0) | (1<<1) | (1<<2) | (1<<3) | (1<<6) | (1<<7))
200 #define UPPER_GROUP ((1<<8) | (1<<9) | (1<<10) | (1<<11) | (1<<15))
201 static const unsigned short sr_valid_mask[] = {
202 LOWER_GROUP|UPPER_GROUP, /* Normal, bosr - 0*/
203 LOWER_GROUP, /* Usb, bosr - 0*/
204 LOWER_GROUP|UPPER_GROUP, /* Normal, bosr - 1*/
205 UPPER_GROUP, /* Usb, bosr - 1*/
208 * Every divisor is a factor of 11*12
210 #define SR_MULT (11*12)
211 #define A(x) (SR_MULT/x)
212 static const unsigned char sr_adc_mult_table[] = {
213 A(2), A(2), A(12), A(12), 0, 0, A(3), A(1),
214 A(2), A(2), A(11), A(11), 0, 0, 0, A(1)
216 static const unsigned char sr_dac_mult_table[] = {
217 A(2), A(12), A(2), A(12), 0, 0, A(3), A(1),
218 A(2), A(11), A(2), A(11), 0, 0, 0, A(1)
221 static unsigned get_score(int adc, int adc_l, int adc_h, int need_adc,
222 int dac, int dac_l, int dac_h, int need_dac)
224 if ((adc >= adc_l) && (adc <= adc_h) &&
225 (dac >= dac_l) && (dac <= dac_h)) {
226 int diff_adc = need_adc - adc;
227 int diff_dac = need_dac - dac;
228 return abs(diff_adc) + abs(diff_dac);
233 static int find_rate(int mclk, u32 need_adc, u32 need_dac)
239 unsigned best_score = UINT_MAX;
240 int adc_l, adc_h, dac_l, dac_h;
245 * rates given are +/- 1/32
247 adc_l = need_adc - (need_adc >> 5);
248 adc_h = need_adc + (need_adc >> 5);
249 dac_l = need_dac - (need_dac >> 5);
250 dac_h = need_dac + (need_dac >> 5);
251 for (i = 0; i < ARRAY_SIZE(bosr_usb_divisor_table); i++) {
252 int base = mclk / bosr_usb_divisor_table[i];
253 int mask = sr_valid_mask[i];
254 for (j = 0; j < ARRAY_SIZE(sr_adc_mult_table);
261 adc = base * sr_adc_mult_table[j];
262 dac = base * sr_dac_mult_table[j];
263 score = get_score(adc, adc_l, adc_h, need_adc,
264 dac, dac_l, dac_h, need_dac);
265 if (best_score > score) {
271 score = get_score((adc >> 1), adc_l, adc_h, need_adc,
272 (dac >> 1), dac_l, dac_h, need_dac);
273 /* prefer to have a /2 */
274 if ((score != UINT_MAX) && (best_score >= score)) {
282 return (best_j << 2) | best_i | (best_div << TLV320AIC23_CLKIN_SHIFT);
286 static void get_current_sample_rates(struct snd_soc_codec *codec, int mclk,
287 u32 *sample_rate_adc, u32 *sample_rate_dac)
289 int src = snd_soc_read(codec, TLV320AIC23_SRATE);
290 int sr = (src >> 2) & 0x0f;
291 int val = (mclk / bosr_usb_divisor_table[src & 3]);
292 int adc = (val * sr_adc_mult_table[sr]) / SR_MULT;
293 int dac = (val * sr_dac_mult_table[sr]) / SR_MULT;
294 if (src & TLV320AIC23_CLKIN_HALF) {
298 *sample_rate_adc = adc;
299 *sample_rate_dac = dac;
303 static int set_sample_rate_control(struct snd_soc_codec *codec, int mclk,
304 u32 sample_rate_adc, u32 sample_rate_dac)
306 /* Search for the right sample rate */
307 int data = find_rate(mclk, sample_rate_adc, sample_rate_dac);
309 printk(KERN_ERR "%s:Invalid rate %u,%u requested\n",
310 __func__, sample_rate_adc, sample_rate_dac);
313 snd_soc_write(codec, TLV320AIC23_SRATE, data);
317 get_current_sample_rates(codec, mclk, &adc, &dac);
318 printk(KERN_DEBUG "actual samplerate = %u,%u reg=%x\n",
325 static int tlv320aic23_hw_params(struct snd_pcm_substream *substream,
326 struct snd_pcm_hw_params *params,
327 struct snd_soc_dai *dai)
329 struct snd_soc_pcm_runtime *rtd = substream->private_data;
330 struct snd_soc_codec *codec = rtd->codec;
333 struct aic23 *aic23 = snd_soc_codec_get_drvdata(codec);
334 u32 sample_rate_adc = aic23->requested_adc;
335 u32 sample_rate_dac = aic23->requested_dac;
336 u32 sample_rate = params_rate(params);
338 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
339 aic23->requested_dac = sample_rate_dac = sample_rate;
340 if (!sample_rate_adc)
341 sample_rate_adc = sample_rate;
343 aic23->requested_adc = sample_rate_adc = sample_rate;
344 if (!sample_rate_dac)
345 sample_rate_dac = sample_rate;
347 ret = set_sample_rate_control(codec, aic23->mclk, sample_rate_adc,
352 iface_reg = snd_soc_read(codec, TLV320AIC23_DIGT_FMT) & ~(0x03 << 2);
354 switch (params_format(params)) {
355 case SNDRV_PCM_FORMAT_S16_LE:
357 case SNDRV_PCM_FORMAT_S20_3LE:
358 iface_reg |= (0x01 << 2);
360 case SNDRV_PCM_FORMAT_S24_LE:
361 iface_reg |= (0x02 << 2);
363 case SNDRV_PCM_FORMAT_S32_LE:
364 iface_reg |= (0x03 << 2);
367 snd_soc_write(codec, TLV320AIC23_DIGT_FMT, iface_reg);
372 static int tlv320aic23_pcm_prepare(struct snd_pcm_substream *substream,
373 struct snd_soc_dai *dai)
375 struct snd_soc_pcm_runtime *rtd = substream->private_data;
376 struct snd_soc_codec *codec = rtd->codec;
379 snd_soc_write(codec, TLV320AIC23_ACTIVE, 0x0001);
384 static void tlv320aic23_shutdown(struct snd_pcm_substream *substream,
385 struct snd_soc_dai *dai)
387 struct snd_soc_pcm_runtime *rtd = substream->private_data;
388 struct snd_soc_codec *codec = rtd->codec;
389 struct aic23 *aic23 = snd_soc_codec_get_drvdata(codec);
392 if (!codec->active) {
394 snd_soc_write(codec, TLV320AIC23_ACTIVE, 0x0);
396 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
397 aic23->requested_dac = 0;
399 aic23->requested_adc = 0;
402 static int tlv320aic23_mute(struct snd_soc_dai *dai, int mute)
404 struct snd_soc_codec *codec = dai->codec;
407 reg = snd_soc_read(codec, TLV320AIC23_DIGT);
409 reg |= TLV320AIC23_DACM_MUTE;
412 reg &= ~TLV320AIC23_DACM_MUTE;
414 snd_soc_write(codec, TLV320AIC23_DIGT, reg);
419 static int tlv320aic23_set_dai_fmt(struct snd_soc_dai *codec_dai,
422 struct snd_soc_codec *codec = codec_dai->codec;
425 iface_reg = snd_soc_read(codec, TLV320AIC23_DIGT_FMT) & (~0x03);
427 /* set master/slave audio interface */
428 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
429 case SND_SOC_DAIFMT_CBM_CFM:
430 iface_reg |= TLV320AIC23_MS_MASTER;
432 case SND_SOC_DAIFMT_CBS_CFS:
439 /* interface format */
440 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
441 case SND_SOC_DAIFMT_I2S:
442 iface_reg |= TLV320AIC23_FOR_I2S;
444 case SND_SOC_DAIFMT_DSP_A:
445 iface_reg |= TLV320AIC23_LRP_ON;
446 case SND_SOC_DAIFMT_DSP_B:
447 iface_reg |= TLV320AIC23_FOR_DSP;
449 case SND_SOC_DAIFMT_RIGHT_J:
451 case SND_SOC_DAIFMT_LEFT_J:
452 iface_reg |= TLV320AIC23_FOR_LJUST;
459 snd_soc_write(codec, TLV320AIC23_DIGT_FMT, iface_reg);
464 static int tlv320aic23_set_dai_sysclk(struct snd_soc_dai *codec_dai,
465 int clk_id, unsigned int freq, int dir)
467 struct aic23 *aic23 = snd_soc_dai_get_drvdata(codec_dai);
472 static int tlv320aic23_set_bias_level(struct snd_soc_codec *codec,
473 enum snd_soc_bias_level level)
475 u16 reg = snd_soc_read(codec, TLV320AIC23_PWR) & 0xff7f;
478 case SND_SOC_BIAS_ON:
479 /* vref/mid, osc on, dac unmute */
480 reg &= ~(TLV320AIC23_DEVICE_PWR_OFF | TLV320AIC23_OSC_OFF | \
481 TLV320AIC23_DAC_OFF);
482 snd_soc_write(codec, TLV320AIC23_PWR, reg);
484 case SND_SOC_BIAS_PREPARE:
486 case SND_SOC_BIAS_STANDBY:
487 /* everything off except vref/vmid, */
488 snd_soc_write(codec, TLV320AIC23_PWR,
489 reg | TLV320AIC23_CLK_OFF);
491 case SND_SOC_BIAS_OFF:
492 /* everything off, dac mute, inactive */
493 snd_soc_write(codec, TLV320AIC23_ACTIVE, 0x0);
494 snd_soc_write(codec, TLV320AIC23_PWR, 0xffff);
497 codec->dapm.bias_level = level;
501 #define AIC23_RATES SNDRV_PCM_RATE_8000_96000
502 #define AIC23_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \
503 SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE)
505 static struct snd_soc_dai_ops tlv320aic23_dai_ops = {
506 .prepare = tlv320aic23_pcm_prepare,
507 .hw_params = tlv320aic23_hw_params,
508 .shutdown = tlv320aic23_shutdown,
509 .digital_mute = tlv320aic23_mute,
510 .set_fmt = tlv320aic23_set_dai_fmt,
511 .set_sysclk = tlv320aic23_set_dai_sysclk,
514 static struct snd_soc_dai_driver tlv320aic23_dai = {
515 .name = "tlv320aic23-hifi",
517 .stream_name = "Playback",
520 .rates = AIC23_RATES,
521 .formats = AIC23_FORMATS,},
523 .stream_name = "Capture",
526 .rates = AIC23_RATES,
527 .formats = AIC23_FORMATS,},
528 .ops = &tlv320aic23_dai_ops,
531 static int tlv320aic23_suspend(struct snd_soc_codec *codec,
534 tlv320aic23_set_bias_level(codec, SND_SOC_BIAS_OFF);
539 static int tlv320aic23_resume(struct snd_soc_codec *codec)
541 snd_soc_cache_sync(codec);
542 tlv320aic23_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
547 static int tlv320aic23_probe(struct snd_soc_codec *codec)
549 struct aic23 *aic23 = snd_soc_codec_get_drvdata(codec);
552 printk(KERN_INFO "AIC23 Audio Codec %s\n", AIC23_VERSION);
554 ret = snd_soc_codec_set_cache_io(codec, 7, 9, aic23->control_type);
556 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
561 snd_soc_write(codec, TLV320AIC23_RESET, 0);
563 /* Write the register default value to cache for reserved registers,
564 * so the write to the these registers are suppressed by the cache
565 * restore code when it skips writes of default registers.
567 snd_soc_cache_write(codec, 0x0A, 0);
568 snd_soc_cache_write(codec, 0x0B, 0);
569 snd_soc_cache_write(codec, 0x0C, 0);
570 snd_soc_cache_write(codec, 0x0D, 0);
571 snd_soc_cache_write(codec, 0x0E, 0);
573 /* power on device */
574 tlv320aic23_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
576 snd_soc_write(codec, TLV320AIC23_DIGT, TLV320AIC23_DEEMP_44K);
579 snd_soc_update_bits(codec, TLV320AIC23_LINVOL,
580 TLV320AIC23_LIM_MUTED, TLV320AIC23_LRS_ENABLED);
582 snd_soc_update_bits(codec, TLV320AIC23_RINVOL,
583 TLV320AIC23_LIM_MUTED, TLV320AIC23_LRS_ENABLED);
585 snd_soc_update_bits(codec, TLV320AIC23_ANLG,
586 TLV320AIC23_BYPASS_ON | TLV320AIC23_MICM_MUTED,
589 /* Default output volume */
590 snd_soc_write(codec, TLV320AIC23_LCHNVOL,
591 TLV320AIC23_DEFAULT_OUT_VOL & TLV320AIC23_OUT_VOL_MASK);
592 snd_soc_write(codec, TLV320AIC23_RCHNVOL,
593 TLV320AIC23_DEFAULT_OUT_VOL & TLV320AIC23_OUT_VOL_MASK);
595 snd_soc_write(codec, TLV320AIC23_ACTIVE, 0x1);
597 snd_soc_add_controls(codec, tlv320aic23_snd_controls,
598 ARRAY_SIZE(tlv320aic23_snd_controls));
603 static int tlv320aic23_remove(struct snd_soc_codec *codec)
605 tlv320aic23_set_bias_level(codec, SND_SOC_BIAS_OFF);
609 static struct snd_soc_codec_driver soc_codec_dev_tlv320aic23 = {
610 .reg_cache_size = ARRAY_SIZE(tlv320aic23_reg),
611 .reg_word_size = sizeof(u16),
612 .reg_cache_default = tlv320aic23_reg,
613 .probe = tlv320aic23_probe,
614 .remove = tlv320aic23_remove,
615 .suspend = tlv320aic23_suspend,
616 .resume = tlv320aic23_resume,
617 .set_bias_level = tlv320aic23_set_bias_level,
618 .dapm_widgets = tlv320aic23_dapm_widgets,
619 .num_dapm_widgets = ARRAY_SIZE(tlv320aic23_dapm_widgets),
620 .dapm_routes = tlv320aic23_intercon,
621 .num_dapm_routes = ARRAY_SIZE(tlv320aic23_intercon),
624 #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
626 * If the i2c layer weren't so broken, we could pass this kind of data
629 static int tlv320aic23_codec_probe(struct i2c_client *i2c,
630 const struct i2c_device_id *i2c_id)
635 if (!i2c_check_functionality(i2c->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
638 aic23 = kzalloc(sizeof(struct aic23), GFP_KERNEL);
642 i2c_set_clientdata(i2c, aic23);
643 aic23->control_type = SND_SOC_I2C;
645 ret = snd_soc_register_codec(&i2c->dev,
646 &soc_codec_dev_tlv320aic23, &tlv320aic23_dai, 1);
651 static int __exit tlv320aic23_i2c_remove(struct i2c_client *i2c)
653 snd_soc_unregister_codec(&i2c->dev);
654 kfree(i2c_get_clientdata(i2c));
658 static const struct i2c_device_id tlv320aic23_id[] = {
663 MODULE_DEVICE_TABLE(i2c, tlv320aic23_id);
665 static struct i2c_driver tlv320aic23_i2c_driver = {
667 .name = "tlv320aic23-codec",
669 .probe = tlv320aic23_codec_probe,
670 .remove = __exit_p(tlv320aic23_i2c_remove),
671 .id_table = tlv320aic23_id,
676 static int __init tlv320aic23_modinit(void)
679 #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
680 ret = i2c_add_driver(&tlv320aic23_i2c_driver);
682 printk(KERN_ERR "Failed to register TLV320AIC23 I2C driver: %d\n",
688 module_init(tlv320aic23_modinit);
690 static void __exit tlv320aic23_exit(void)
692 #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
693 i2c_del_driver(&tlv320aic23_i2c_driver);
696 module_exit(tlv320aic23_exit);
698 MODULE_DESCRIPTION("ASoC TLV320AIC23 codec driver");
699 MODULE_AUTHOR("Arun KS <arunks@mistralsolutions.com>");
700 MODULE_LICENSE("GPL");