]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - drivers/i2c/chips/tlv320aic23.c
Merge current mainline tree into linux-omap tree
[linux-2.6-omap-h63xx.git] / drivers / i2c / chips / tlv320aic23.c
1 /*
2  *   Texas Instrumens TLV320AIC23 audio codec's i2c interface.
3  *
4  *   Copyright (c) by Kai Svahn <kai.svahn@nokia.com>
5  *   Copyright (c) by Jussi Laako <jussi.laako@nokia.com>
6  *
7  *   This program is free software; you can redistribute it and/or modify
8  *   it under the terms of the GNU General Public License as published by
9  *   the Free Software Foundation; either version 2 of the License, or
10  *   (at your option) any later version.
11  *
12  *   This program is distributed in the hope that it will be useful,
13  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *   GNU General Public License for more details.
16  *
17  *   You should have received a copy of the GNU General Public License
18  *   along with this program; if not, write to the Free Software
19  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
20  *
21  */
22
23 #include <linux/module.h>
24 #include <linux/init.h>
25 #include <linux/i2c.h>
26 #include <linux/slab.h>
27 #include <linux/device.h>
28 #include <linux/platform_device.h>
29 #include <asm/io.h>
30 #include <mach/aic23.h>
31 #include <mach/mcbsp.h>
32
33 #define TLV320AIC23_VERSION     "1.8"
34 #define TLV320AIC23_DATE        "10-Feb-2006"
35 #define MAX_VOL                 100
36 #define MIN_VOL                 0
37 #define MAX_GAIN                100
38 #define MIN_GAIN                0
39 #define OUTPUT_VOLUME_MIN       LHV_MIN
40 #define OUTPUT_VOLUME_MAX       LHV_MAX
41 #define OUTPUT_VOLUME_RANGE     (OUTPUT_VOLUME_MAX - OUTPUT_VOLUME_MIN)
42 #define INPUT_VOLUME_MIN        LIV_MIN
43 #define INPUT_VOLUME_MAX        LIV_MAX
44 #define INPUT_VOLUME_RANGE      (INPUT_VOLUME_MAX - INPUT_VOLUME_MIN)
45
46 /* I2C Addresses to scan */
47 static unsigned short normal_i2c[] = { TLV320AIC23ID1, TLV320AIC23ID2, \
48                                        I2C_CLIENT_END };
49 /*static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };*/
50
51 /* This makes all addr_data:s */
52 I2C_CLIENT_INSMOD;
53
54 static struct i2c_driver aic23_driver;
55 static struct i2c_client *new_client;
56 static int selftest;
57 static struct platform_device audio_i2c_device;
58
59 static struct aic23_info {
60         u16 volume_reg_left;
61         u16 volume_reg_right;
62         u16 input_gain_reg_left;
63         u16 input_gain_reg_right;
64         u16 power;                      /* For POWER_DOWN_CONTROL_ADDR */
65         u16 mask;                       /* For ANALOG_AUDIO_CONTROL_ADDR */
66         int mic_loopback;
67         int mic_enable;
68         int sta;
69         int power_down;
70         int initialized;
71 } aic23_info_l;
72
73 static int _aic23_write_value(struct i2c_client *client, u8 reg, u16 value)
74 {
75         u8 val, wreg;
76
77         /* TLV320AIC23 has 7 bit address and 9 bits of data
78          * so we need to switch one data bit into reg and rest
79          * of data into val
80          */
81
82         wreg = (reg << 1);
83         val = (0x01 & (value >> 8));
84         wreg = (wreg | val);
85         val = (0x00ff & value);
86
87         return i2c_smbus_write_byte_data(client, wreg, val);
88 }
89
90 int aic23_write_value(u8 reg, u16 value)
91 {
92         static struct i2c_client *client;
93         client = new_client;
94         _aic23_write_value(client, reg, value);
95
96         return 0;
97 }
98
99 /*
100  * Configures the McBSP3 which is used to send clock to the AIC23 codec.
101  * The input clock rate from DSP is 12MHz.
102  * The DSP clock must be on before this is called.
103  */
104 static int omap_mcbsp3_aic23_clock_init(void)
105 {
106         u16 w;
107
108         /* enable 12MHz clock to mcbsp 1 & 3 */
109         __raw_writew(__raw_readw(DSP_IDLECT2) | (1<<1), DSP_IDLECT2);
110         __raw_writew(__raw_readw(DSP_RSTCT2) | 1 | 1<<1, DSP_RSTCT2);
111
112         /* disable sample rate generator */
113         OMAP_MCBSP_WRITE(OMAP1610_MCBSP3_BASE, SPCR1, 0x0000);
114         OMAP_MCBSP_WRITE(OMAP1610_MCBSP3_BASE, SPCR2, 0x0000);
115
116         /* pin control register */
117         OMAP_MCBSP_WRITE(OMAP1610_MCBSP3_BASE, PCR0,(CLKXM | CLKXP | CLKRP));
118
119         /* configure srg to send 12MHz pulse from dsp peripheral clock */
120         OMAP_MCBSP_WRITE(OMAP1610_MCBSP3_BASE, SRGR1, 0x0000);
121         OMAP_MCBSP_WRITE(OMAP1610_MCBSP3_BASE, SRGR2, CLKSM);
122
123         /* enable sample rate generator */
124         w = OMAP_MCBSP_READ(OMAP1610_MCBSP3_BASE, SPCR2);
125         OMAP_MCBSP_WRITE(OMAP1610_MCBSP3_BASE, SPCR2, (w | FREE | GRST));
126         printk("Clock enabled to MCBSP1 & 3 \n");
127
128         return 0;
129 }
130
131 static int aic23_detect_client(struct i2c_adapter *adapter, int address,
132                                      int kind)
133 {
134         int err = 0;
135         const char *client_name = "TLV320AIC23 Audio Codec";
136
137         if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_WORD_DATA |
138                                      I2C_FUNC_SMBUS_WRITE_BYTE)) {
139                 printk(KERN_WARNING "%s functionality check failed\n",
140                        client_name);
141                 return err;
142         }
143
144         if (!(new_client = kmalloc(sizeof(struct i2c_client),
145                                    GFP_KERNEL))) {
146                 err = -ENOMEM;
147                 printk(KERN_WARNING "Couldn't allocate memory for %s\n",
148                        client_name);
149                 return err;
150         }
151
152         memset(new_client, 0x00, sizeof(struct i2c_client));
153         new_client->addr = address;
154         new_client->adapter = adapter;
155         new_client->driver = &aic23_driver;
156         new_client->flags = 0;
157         strlcpy(new_client->name, client_name, I2C_NAME_SIZE);
158
159         if ((err = i2c_attach_client(new_client))) {
160                 printk(KERN_WARNING "Couldn't attach %s\n", client_name);
161                 kfree(new_client);
162                 return err;
163         }
164
165         if (platform_device_register(&audio_i2c_device)) {
166                 printk(KERN_WARNING "Failed to register audio i2c device\n");
167                 selftest = -ENODEV;
168                 return selftest;
169         }
170         /* FIXME: Do in board-specific file */
171         omap_mcbsp3_aic23_clock_init();
172
173         if (!aic23_info_l.power_down)
174                 aic23_power_up();
175         aic23_info_l.initialized = 1;
176
177         return 0;
178 }
179
180 static int aic23_detach_client(struct i2c_client *client)
181 {
182         int err;
183
184         platform_device_unregister(&audio_i2c_device);
185
186         if ((err = i2c_detach_client(client))) {
187                 printk("aic23.o: Client deregistration failed, \
188                        client not detached.\n");
189                 return err;
190         }
191         kfree(client);
192         return 0;
193 }
194
195 static int aic23_attach_adapter(struct i2c_adapter *adapter)
196 {
197         int res;
198
199         res = i2c_probe(adapter, &addr_data, &aic23_detect_client);
200         return res;
201 }
202
203 static struct i2c_driver aic23_driver = {
204         .driver = {
205                 .name   = "OMAP+TLV320AIC23 codec",
206                 /*.flags        = I2C_DF_NOTIFY,*/
207         },
208         .id             = I2C_DRIVERID_MISC, /* Experimental ID */
209         .attach_adapter = aic23_attach_adapter,
210         .detach_client  = aic23_detach_client,
211 };
212
213 static void update_volume_left(int volume)
214 {
215         u16 val = 0;
216         val = ((volume * OUTPUT_VOLUME_RANGE) / 100) + OUTPUT_VOLUME_MIN;
217         aic23_write_value(LEFT_CHANNEL_VOLUME_ADDR, val);
218         aic23_info_l.volume_reg_left = volume;
219 }
220
221 static void update_volume_right(int volume)
222 {
223         u16 val = 0;
224         val = ((volume * OUTPUT_VOLUME_RANGE) / 100) + OUTPUT_VOLUME_MIN;
225         aic23_write_value(RIGHT_CHANNEL_VOLUME_ADDR, val);
226         aic23_info_l.volume_reg_right = volume;
227 }
228
229 static void set_mic(int mic_en)
230 {
231         u16 dg_ctrl;
232
233         if (mic_en) {
234                 aic23_info_l.power = OSC_OFF | LINE_OFF;
235                 dg_ctrl = ADCHP_ON;
236                 aic23_info_l.mask &= ~MICM_MUTED;
237                 aic23_info_l.mask |= MICB_20DB; /* STE_ENABLED */
238         } else {
239                 aic23_info_l.power =
240                         OSC_OFF | ADC_OFF | MIC_OFF | LINE_OFF;
241                 dg_ctrl = 0x00;
242                 aic23_info_l.mask =
243                         DAC_SELECTED | INSEL_MIC | MICM_MUTED;
244         }
245         aic23_write_value(POWER_DOWN_CONTROL_ADDR,
246                                 aic23_info_l.power);
247         aic23_write_value(DIGITAL_AUDIO_CONTROL_ADDR, dg_ctrl);
248         aic23_write_value(ANALOG_AUDIO_CONTROL_ADDR,
249                                 aic23_info_l.mask);
250         aic23_info_l.mic_enable = mic_en;
251
252         printk(KERN_INFO "aic23 mic state: %i\n", mic_en);
253 }
254
255 static void aic23_init_power(void)
256 {
257         aic23_write_value(RESET_CONTROL_ADDR, 0x00);
258
259         if (aic23_info_l.initialized == 0) {
260                 aic23_write_value(LEFT_CHANNEL_VOLUME_ADDR, LHV_MIN);
261                 aic23_write_value(RIGHT_CHANNEL_VOLUME_ADDR, LHV_MIN);
262         }
263         else {
264                 update_volume_left(aic23_info_l.volume_reg_left);
265                 update_volume_right(aic23_info_l.volume_reg_right);
266         }
267
268         aic23_info_l.mask = DAC_SELECTED | INSEL_MIC | MICM_MUTED;
269         aic23_write_value(ANALOG_AUDIO_CONTROL_ADDR,
270                                 aic23_info_l.mask);
271         aic23_write_value(DIGITAL_AUDIO_CONTROL_ADDR, 0x00);
272         aic23_write_value(DIGITAL_AUDIO_FORMAT_ADDR, LRP_ON | FOR_DSP);
273         aic23_write_value(SAMPLE_RATE_CONTROL_ADDR, USB_CLK_ON);
274         aic23_write_value(DIGITAL_INTERFACE_ACT_ADDR, ACT_ON);
275         aic23_info_l.power = OSC_OFF | ADC_OFF | MIC_OFF | LINE_OFF;
276         aic23_write_value(POWER_DOWN_CONTROL_ADDR,
277                                 aic23_info_l.power);
278
279         /* enable mic input */
280         if (aic23_info_l.mic_enable)
281                 set_mic(aic23_info_l.mic_enable);
282
283         printk(KERN_INFO "aic23_init_power() done\n");
284 }
285
286 void aic23_power_down(void)
287 {
288         if (aic23_info_l.initialized) {
289                 printk("aic23 powering down\n");
290                 aic23_write_value(POWER_DOWN_CONTROL_ADDR, 0xff);
291         }
292         aic23_info_l.power_down = 1;
293 }
294
295 void aic23_power_up(void)
296 {
297         if (aic23_info_l.initialized) {
298                 printk("aic23 powering up\n");
299                 aic23_init_power();
300         }
301         aic23_info_l.power_down = 0;
302 }
303
304 /*----------------------------------------------------------------------*/
305 /*                      sysfs initializations                           */
306 /*----------------------------------------------------------------------*/
307
308 static ssize_t store_volume_left(struct device *dev,
309                                  struct device_attribute *attr,
310                                  const char *buf, size_t count)
311 {
312         signed volume;
313
314         sscanf(buf, "%i", &volume);
315
316         if (volume < MIN_VOL) {
317                 aic23_power_down();
318                 return count;
319         } else if (volume > MIN_VOL && aic23_info_l.power_down) {
320                 aic23_info_l.volume_reg_left = volume;
321                 aic23_power_up();
322                 return count;
323         }
324         if (volume > MAX_VOL)
325                 volume = MAX_VOL;
326
327         update_volume_left(volume);
328         return count;
329 }
330
331 static ssize_t show_volume_left(struct device *dev,
332                                 struct device_attribute *attr, char *buf)
333 {
334         return sprintf(buf, "%u\n", aic23_info_l.volume_reg_left);
335 }
336
337 static DEVICE_ATTR(volume_left, S_IRUGO | S_IWUGO,
338                    show_volume_left, store_volume_left);
339
340 static ssize_t store_volume_right(struct device *dev,
341                                   struct device_attribute *attr,
342                                   const char *buf, size_t count)
343 {
344         signed volume;
345
346         sscanf(buf, "%i", &volume);
347         if (volume < MIN_VOL) {
348                 aic23_power_down();
349                 return count;
350         } else if (volume > MIN_VOL && aic23_info_l.power_down) {
351                 aic23_info_l.volume_reg_right = volume;
352                 aic23_power_up();
353                 return count;
354         }
355         if (volume > MAX_VOL)
356                 volume = MAX_VOL;
357
358         update_volume_right(volume);
359         return count;
360 }
361
362 static ssize_t show_volume_right(struct device *dev,
363                                  struct device_attribute *attr, char *buf)
364 {
365         return sprintf(buf, "%u\n", aic23_info_l.volume_reg_right);
366 }
367
368 static DEVICE_ATTR(volume_right, S_IRUGO | S_IWUGO,
369                    show_volume_right, store_volume_right);
370
371 static ssize_t store_gain_left(struct device *dev,
372                                struct device_attribute *attr,
373                                const char *buf, size_t count)
374 {
375         u16 val = 0;
376         unsigned gain;
377
378         sscanf(buf, "%u", &gain);
379         if (gain > MAX_VOL)
380                 gain = MAX_VOL;
381
382         val = ((gain * INPUT_VOLUME_RANGE) / 100) + INPUT_VOLUME_MIN;
383         aic23_write_value(LEFT_LINE_VOLUME_ADDR, val);
384         aic23_info_l.input_gain_reg_left = gain;
385
386         return count;
387 }
388
389 static ssize_t show_gain_left(struct device *dev,
390                               struct device_attribute *attr, char *buf)
391 {
392         return sprintf(buf, "%u\n", aic23_info_l.input_gain_reg_left);
393 }
394
395 static DEVICE_ATTR(gain_left, S_IRUGO | S_IWUSR, show_gain_left,
396                    store_gain_left);
397
398 static ssize_t store_gain_right(struct device *dev,
399                                 struct device_attribute *attr,
400                                 const char *buf, size_t count)
401 {
402         u16 val = 0;
403         unsigned gain;
404
405         sscanf(buf, "%u", &gain);
406         if (gain > MAX_VOL)
407                 gain = MAX_VOL;
408
409         val = ((gain * INPUT_VOLUME_RANGE) / 100) + INPUT_VOLUME_MIN;
410         aic23_write_value(RIGHT_LINE_VOLUME_ADDR, val);
411         aic23_info_l.input_gain_reg_right = gain;
412
413         return count;
414 }
415
416 static ssize_t show_gain_right(struct device *dev,
417                                struct device_attribute *attr, char *buf)
418 {
419         return sprintf(buf, "%u\n", aic23_info_l.input_gain_reg_right);
420 }
421
422 static DEVICE_ATTR(gain_right, S_IRUGO | S_IWUSR, show_gain_right,
423                    store_gain_right);
424
425 static ssize_t store_mic_loopback(struct device *dev,
426                                   struct device_attribute *attr,
427                                   const char *buf, size_t count)
428 {
429         int mic;
430
431         sscanf(buf, "%i", &mic);
432         if (mic > 0) {
433                 aic23_write_value(POWER_DOWN_CONTROL_ADDR, \
434                                         OSC_OFF | ADC_OFF | LINE_OFF);
435                 aic23_info_l.mask = STE_ENABLED | DAC_SELECTED \
436                                           | INSEL_MIC | MICB_20DB;
437                 aic23_write_value(ANALOG_AUDIO_CONTROL_ADDR,
438                                         aic23_info_l.mask);
439                 mic = 1;
440         }
441         else {
442                 aic23_write_value(POWER_DOWN_CONTROL_ADDR, \
443                                         OSC_OFF | ADC_OFF | MIC_OFF | LINE_OFF);
444                 mic = 0;
445         }
446         aic23_info_l.mic_loopback = mic;
447
448         return count;
449 }
450
451 static ssize_t show_mic_loopback(struct device *dev,
452                                  struct device_attribute *attr, char *buf)
453 {
454         return sprintf(buf, "%i\n", aic23_info_l.mic_loopback);
455 }
456
457 static DEVICE_ATTR(mic_loopback, S_IRUGO | S_IWUSR,
458                    show_mic_loopback, store_mic_loopback);
459
460 static ssize_t store_st_attenuation(struct device *dev,
461                                     struct device_attribute *attr,
462                                     const char *buf, size_t count)
463 {
464         unsigned sta;
465         u16 tmp;
466
467         sscanf(buf, "%u", &sta);
468         if (sta > 3)
469                 sta = 3;
470
471         tmp = aic23_info_l.mask;
472         tmp &= 0x3f;
473
474         aic23_info_l.mask =  tmp | STA_REG(sta);
475         aic23_write_value(ANALOG_AUDIO_CONTROL_ADDR,
476                                 aic23_info_l.mask);
477         aic23_info_l.sta = sta;
478
479         return count;
480 }
481
482 static ssize_t show_st_attenuation(struct device *dev,
483                                    struct device_attribute *attr, char *buf)
484 {
485         return sprintf(buf, "%i\n", aic23_info_l.sta);
486 }
487
488 static DEVICE_ATTR(st_attenuation, S_IRUGO | S_IWUSR,
489                    show_st_attenuation, store_st_attenuation);
490
491 static ssize_t store_mic_enable(struct device *dev,
492                                 struct device_attribute *attr,
493                                 const char *buf, size_t count)
494 {
495         int mic;
496
497         sscanf(buf, "%i", &mic);
498         set_mic(mic);
499
500         return count;
501 }
502
503 static ssize_t show_mic_enable(struct device *dev,
504                                struct device_attribute *attr, char *buf)
505 {
506         return sprintf(buf, "%i\n", aic23_info_l.mic_enable);
507 }
508
509 static DEVICE_ATTR(mic_enable, S_IRUGO | S_IWUSR,
510         show_mic_enable, store_mic_enable);
511
512 static ssize_t show_audio_selftest(struct device *dev,
513                                    struct device_attribute *attr, char *buf)
514 {
515         return sprintf(buf, "%i\n", selftest);
516 }
517
518 static DEVICE_ATTR(audio_selftest, S_IRUGO | S_IWUSR,
519                 show_audio_selftest, NULL);
520
521 static int audio_i2c_probe(struct platform_device *dev)
522 {
523         int r;
524
525         if ((r = device_create_file(&dev->dev, &dev_attr_volume_left)) != 0)
526                 return r;
527         else if ((r = device_create_file(&dev->dev,
528                 &dev_attr_volume_right)) != 0)
529                 goto err_volume_left;
530         else if ((r = device_create_file(&dev->dev,
531                 &dev_attr_gain_right)) != 0)
532                 goto err_volume_right;
533         else if ((r = device_create_file(&dev->dev,
534                 &dev_attr_gain_left)) != 0)
535                 goto err_gain_right;
536         else if ((r = device_create_file(&dev->dev,
537                 &dev_attr_mic_loopback)) != 0)
538                 goto err_gain_left;
539         else if ((r = device_create_file(&dev->dev,
540                 &dev_attr_mic_enable)) != 0)
541                 goto err_mic_loopback;
542         else if ((r = device_create_file(&dev->dev,
543                 &dev_attr_st_attenuation)) != 0)
544                 goto err_mic_enable;
545         else if ((r = device_create_file(&dev->dev,
546                 &dev_attr_audio_selftest)) != 0)
547                 goto err_st_attenuation;
548         else
549                 return r;
550
551 err_st_attenuation:
552         device_remove_file(&dev->dev, &dev_attr_st_attenuation);
553 err_mic_enable:
554         device_remove_file(&dev->dev, &dev_attr_mic_enable);
555 err_mic_loopback:
556         device_remove_file(&dev->dev, &dev_attr_mic_loopback);
557 err_gain_left:
558         device_remove_file(&dev->dev, &dev_attr_gain_left);
559 err_gain_right:
560         device_remove_file(&dev->dev, &dev_attr_gain_right);
561 err_volume_right:
562         device_remove_file(&dev->dev, &dev_attr_volume_right);
563 err_volume_left:
564         device_remove_file(&dev->dev, &dev_attr_volume_left);
565
566         return r;
567 }
568
569 static int audio_i2c_remove(struct platform_device *dev)
570 {
571         device_remove_file(&dev->dev, &dev_attr_st_attenuation);
572         device_remove_file(&dev->dev, &dev_attr_mic_enable);
573         device_remove_file(&dev->dev, &dev_attr_mic_loopback);
574         device_remove_file(&dev->dev, &dev_attr_gain_left);
575         device_remove_file(&dev->dev, &dev_attr_gain_right);
576         device_remove_file(&dev->dev, &dev_attr_volume_right);
577         device_remove_file(&dev->dev, &dev_attr_volume_left);
578
579         return 0;
580 }
581
582 /*----------------------------------------------------------------*/
583 /*                      PM functions                              */
584 /*----------------------------------------------------------------*/
585
586 static void audio_i2c_shutdown(struct platform_device *dev)
587 {
588         /* Let's mute the codec before powering off to prevent
589         * glitch in the sound
590         */
591         aic23_write_value(LEFT_CHANNEL_VOLUME_ADDR, LHV_MIN);
592         aic23_write_value(RIGHT_CHANNEL_VOLUME_ADDR, LHV_MIN);
593         aic23_power_down();
594 }
595
596 static int audio_i2c_suspend(struct platform_device *dev, pm_message_t state)
597 {
598         /* Let's mute the codec before powering off to prevent
599          * glitch in the sound
600          */
601         aic23_write_value(LEFT_CHANNEL_VOLUME_ADDR, LHV_MIN);
602         aic23_write_value(RIGHT_CHANNEL_VOLUME_ADDR, LHV_MIN);
603         aic23_power_down();
604
605         return 0;
606 }
607
608 static int audio_i2c_resume(struct platform_device *dev)
609 {
610         aic23_power_up();
611
612         return 0;
613 }
614
615 static struct platform_driver audio_i2c_driver = {
616         .driver = {
617                 .owner  = THIS_MODULE,
618                 .name   = "audio-i2c",
619         },
620         .shutdown       = audio_i2c_shutdown,
621         .probe          = audio_i2c_probe,
622         .remove         = audio_i2c_remove,
623         .suspend        = audio_i2c_suspend,
624         .resume         = audio_i2c_resume,
625 };
626
627 static struct platform_device audio_i2c_device = {
628         .name           = "audio-i2c",
629         .id             = -1,
630 };
631
632 /*----------------------------------------------------------------*/
633
634 static int __init aic23_init(void)
635 {
636         selftest =  0;
637         aic23_info_l.initialized = 0;
638
639         if (i2c_add_driver(&aic23_driver)) {
640                 printk("aic23 i2c: Driver registration failed, \
641                       module not inserted.\n");
642                 selftest = -ENODEV;
643                 return selftest;
644         }
645
646         if (platform_driver_register(&audio_i2c_driver)) {
647                 printk(KERN_WARNING "Failed to register audio i2c driver\n");
648                 selftest = -ENODEV;
649                 return selftest;
650         }
651
652         printk("TLV320AIC23 I2C version %s (%s)\n",
653                TLV320AIC23_VERSION, TLV320AIC23_DATE);
654
655         return selftest;
656 }
657
658 static void __exit aic23_exit(void)
659 {
660         aic23_power_down();
661         i2c_del_driver(&aic23_driver);
662
663         platform_driver_unregister(&audio_i2c_driver);
664 }
665
666 MODULE_AUTHOR("Kai Svahn <kai.svahn@nokia.com>");
667 MODULE_DESCRIPTION("I2C interface for TLV320AIC23 codec.");
668 MODULE_LICENSE("GPL");
669
670 module_init(aic23_init)
671 module_exit(aic23_exit)
672
673 EXPORT_SYMBOL(aic23_write_value);
674 EXPORT_SYMBOL(aic23_power_up);
675 EXPORT_SYMBOL(aic23_power_down);