4 * ASoC Driver for Cirrus Logic CS42L51 codecs
6 * Copyright (c) 2010 Arnaud Patard <apatard@mandriva.com>
8 * Based on cs4270.c - Copyright (c) Freescale Semiconductor
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
20 * - Only I2C is support. Not SPI
21 * - master mode *NOT* supported
24 #include <linux/module.h>
25 #include <linux/platform_device.h>
26 #include <linux/slab.h>
27 #include <sound/core.h>
28 #include <sound/soc.h>
29 #include <sound/soc-dapm.h>
30 #include <sound/tlv.h>
31 #include <sound/initval.h>
32 #include <sound/pcm_params.h>
33 #include <sound/pcm.h>
34 #include <linux/i2c.h>
38 enum master_slave_mode {
44 struct cs42l51_private {
45 enum snd_soc_control_type control_type;
48 unsigned int audio_mode; /* The mode (I2S or left-justified) */
49 enum master_slave_mode func;
50 u8 reg_cache[CS42L51_NUMREGS];
53 #define CS42L51_FORMATS ( \
54 SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S16_BE | \
55 SNDRV_PCM_FMTBIT_S18_3LE | SNDRV_PCM_FMTBIT_S18_3BE | \
56 SNDRV_PCM_FMTBIT_S20_3LE | SNDRV_PCM_FMTBIT_S20_3BE | \
57 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S24_BE)
59 static int cs42l51_fill_cache(struct snd_soc_codec *codec)
61 u8 *cache = codec->reg_cache + 1;
62 struct i2c_client *i2c_client = codec->control_data;
65 length = i2c_smbus_read_i2c_block_data(i2c_client,
66 CS42L51_FIRSTREG | 0x80, CS42L51_NUMREGS, cache);
67 if (length != CS42L51_NUMREGS) {
68 dev_err(&i2c_client->dev,
69 "I2C read failure, addr=0x%x (ret=%d vs %d)\n",
70 i2c_client->addr, length, CS42L51_NUMREGS);
77 static int cs42l51_get_chan_mix(struct snd_kcontrol *kcontrol,
78 struct snd_ctl_elem_value *ucontrol)
80 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
81 unsigned long value = snd_soc_read(codec, CS42L51_PCM_MIXER)&3;
86 ucontrol->value.integer.value[0] = 0;
88 /* same value : (L+R)/2 and (R+L)/2 */
91 ucontrol->value.integer.value[0] = 1;
94 ucontrol->value.integer.value[0] = 2;
101 #define CHAN_MIX_NORMAL 0x00
102 #define CHAN_MIX_BOTH 0x55
103 #define CHAN_MIX_SWAP 0xFF
105 static int cs42l51_set_chan_mix(struct snd_kcontrol *kcontrol,
106 struct snd_ctl_elem_value *ucontrol)
108 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
111 switch (ucontrol->value.integer.value[0]) {
114 val = CHAN_MIX_NORMAL;
124 snd_soc_write(codec, CS42L51_PCM_MIXER, val);
129 static const DECLARE_TLV_DB_SCALE(adc_pcm_tlv, -5150, 50, 0);
130 static const DECLARE_TLV_DB_SCALE(tone_tlv, -1050, 150, 0);
131 /* This is a lie. after -102 db, it stays at -102 */
132 /* maybe a range would be better */
133 static const DECLARE_TLV_DB_SCALE(aout_tlv, -11550, 50, 0);
135 static const DECLARE_TLV_DB_SCALE(boost_tlv, 1600, 1600, 0);
136 static const char *chan_mix[] = {
142 static const struct soc_enum cs42l51_chan_mix =
143 SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(chan_mix), chan_mix);
145 static const struct snd_kcontrol_new cs42l51_snd_controls[] = {
146 SOC_DOUBLE_R_SX_TLV("PCM Playback Volume",
147 CS42L51_PCMA_VOL, CS42L51_PCMB_VOL,
148 7, 0xffffff99, 0x18, adc_pcm_tlv),
149 SOC_DOUBLE_R("PCM Playback Switch",
150 CS42L51_PCMA_VOL, CS42L51_PCMB_VOL, 7, 1, 1),
151 SOC_DOUBLE_R_SX_TLV("Analog Playback Volume",
152 CS42L51_AOUTA_VOL, CS42L51_AOUTB_VOL,
153 8, 0xffffff19, 0x18, aout_tlv),
154 SOC_DOUBLE_R_SX_TLV("ADC Mixer Volume",
155 CS42L51_ADCA_VOL, CS42L51_ADCB_VOL,
156 7, 0xffffff99, 0x18, adc_pcm_tlv),
157 SOC_DOUBLE_R("ADC Mixer Switch",
158 CS42L51_ADCA_VOL, CS42L51_ADCB_VOL, 7, 1, 1),
159 SOC_SINGLE("Playback Deemphasis Switch", CS42L51_DAC_CTL, 3, 1, 0),
160 SOC_SINGLE("Auto-Mute Switch", CS42L51_DAC_CTL, 2, 1, 0),
161 SOC_SINGLE("Soft Ramp Switch", CS42L51_DAC_CTL, 1, 1, 0),
162 SOC_SINGLE("Zero Cross Switch", CS42L51_DAC_CTL, 0, 0, 0),
163 SOC_DOUBLE_TLV("Mic Boost Volume",
164 CS42L51_MIC_CTL, 0, 1, 1, 0, boost_tlv),
165 SOC_SINGLE_TLV("Bass Volume", CS42L51_TONE_CTL, 0, 0xf, 1, tone_tlv),
166 SOC_SINGLE_TLV("Treble Volume", CS42L51_TONE_CTL, 4, 0xf, 1, tone_tlv),
167 SOC_ENUM_EXT("PCM channel mixer",
169 cs42l51_get_chan_mix, cs42l51_set_chan_mix),
173 * to power down, one must:
174 * 1.) Enable the PDN bit
175 * 2.) enable power-down for the select channels
176 * 3.) disable the PDN bit.
178 static int cs42l51_pdn_event(struct snd_soc_dapm_widget *w,
179 struct snd_kcontrol *kcontrol, int event)
183 value = snd_soc_read(w->codec, CS42L51_POWER_CTL1);
184 value &= ~CS42L51_POWER_CTL1_PDN;
187 case SND_SOC_DAPM_PRE_PMD:
188 value |= CS42L51_POWER_CTL1_PDN;
191 case SND_SOC_DAPM_POST_PMD:
194 snd_soc_update_bits(w->codec, CS42L51_POWER_CTL1,
195 CS42L51_POWER_CTL1_PDN, value);
200 static const char *cs42l51_dac_names[] = {"Direct PCM",
202 static const struct soc_enum cs42l51_dac_mux_enum =
203 SOC_ENUM_SINGLE(CS42L51_DAC_CTL, 6, 3, cs42l51_dac_names);
204 static const struct snd_kcontrol_new cs42l51_dac_mux_controls =
205 SOC_DAPM_ENUM("Route", cs42l51_dac_mux_enum);
207 static const char *cs42l51_adcl_names[] = {"AIN1 Left", "AIN2 Left",
208 "MIC Left", "MIC+preamp Left"};
209 static const struct soc_enum cs42l51_adcl_mux_enum =
210 SOC_ENUM_SINGLE(CS42L51_ADC_INPUT, 4, 4, cs42l51_adcl_names);
211 static const struct snd_kcontrol_new cs42l51_adcl_mux_controls =
212 SOC_DAPM_ENUM("Route", cs42l51_adcl_mux_enum);
214 static const char *cs42l51_adcr_names[] = {"AIN1 Right", "AIN2 Right",
215 "MIC Right", "MIC+preamp Right"};
216 static const struct soc_enum cs42l51_adcr_mux_enum =
217 SOC_ENUM_SINGLE(CS42L51_ADC_INPUT, 6, 4, cs42l51_adcr_names);
218 static const struct snd_kcontrol_new cs42l51_adcr_mux_controls =
219 SOC_DAPM_ENUM("Route", cs42l51_adcr_mux_enum);
221 static const struct snd_soc_dapm_widget cs42l51_dapm_widgets[] = {
222 SND_SOC_DAPM_MICBIAS("Mic Bias", CS42L51_MIC_POWER_CTL, 1, 1),
223 SND_SOC_DAPM_PGA_E("Left PGA", CS42L51_POWER_CTL1, 3, 1, NULL, 0,
224 cs42l51_pdn_event, SND_SOC_DAPM_PRE_POST_PMD),
225 SND_SOC_DAPM_PGA_E("Right PGA", CS42L51_POWER_CTL1, 4, 1, NULL, 0,
226 cs42l51_pdn_event, SND_SOC_DAPM_PRE_POST_PMD),
227 SND_SOC_DAPM_ADC_E("Left ADC", "Left HiFi Capture",
228 CS42L51_POWER_CTL1, 1, 1,
229 cs42l51_pdn_event, SND_SOC_DAPM_PRE_POST_PMD),
230 SND_SOC_DAPM_ADC_E("Right ADC", "Right HiFi Capture",
231 CS42L51_POWER_CTL1, 2, 1,
232 cs42l51_pdn_event, SND_SOC_DAPM_PRE_POST_PMD),
233 SND_SOC_DAPM_DAC_E("Left DAC", "Left HiFi Playback",
234 CS42L51_POWER_CTL1, 5, 1,
235 cs42l51_pdn_event, SND_SOC_DAPM_PRE_POST_PMD),
236 SND_SOC_DAPM_DAC_E("Right DAC", "Right HiFi Playback",
237 CS42L51_POWER_CTL1, 6, 1,
238 cs42l51_pdn_event, SND_SOC_DAPM_PRE_POST_PMD),
241 SND_SOC_DAPM_INPUT("AIN1L"),
242 SND_SOC_DAPM_INPUT("AIN1R"),
243 SND_SOC_DAPM_INPUT("AIN2L"),
244 SND_SOC_DAPM_INPUT("AIN2R"),
245 SND_SOC_DAPM_INPUT("MICL"),
246 SND_SOC_DAPM_INPUT("MICR"),
248 SND_SOC_DAPM_MIXER("Mic Preamp Left",
249 CS42L51_MIC_POWER_CTL, 2, 1, NULL, 0),
250 SND_SOC_DAPM_MIXER("Mic Preamp Right",
251 CS42L51_MIC_POWER_CTL, 3, 1, NULL, 0),
254 SND_SOC_DAPM_OUTPUT("HPL"),
255 SND_SOC_DAPM_OUTPUT("HPR"),
258 SND_SOC_DAPM_MUX("DAC Mux", SND_SOC_NOPM, 0, 0,
259 &cs42l51_dac_mux_controls),
260 SND_SOC_DAPM_MUX("PGA-ADC Mux Left", SND_SOC_NOPM, 0, 0,
261 &cs42l51_adcl_mux_controls),
262 SND_SOC_DAPM_MUX("PGA-ADC Mux Right", SND_SOC_NOPM, 0, 0,
263 &cs42l51_adcr_mux_controls),
266 static const struct snd_soc_dapm_route cs42l51_routes[] = {
267 {"HPL", NULL, "Left DAC"},
268 {"HPR", NULL, "Right DAC"},
270 {"Left ADC", NULL, "Left PGA"},
271 {"Right ADC", NULL, "Right PGA"},
273 {"Mic Preamp Left", NULL, "MICL"},
274 {"Mic Preamp Right", NULL, "MICR"},
276 {"PGA-ADC Mux Left", "AIN1 Left", "AIN1L" },
277 {"PGA-ADC Mux Left", "AIN2 Left", "AIN2L" },
278 {"PGA-ADC Mux Left", "MIC Left", "MICL" },
279 {"PGA-ADC Mux Left", "MIC+preamp Left", "Mic Preamp Left" },
280 {"PGA-ADC Mux Right", "AIN1 Right", "AIN1R" },
281 {"PGA-ADC Mux Right", "AIN2 Right", "AIN2R" },
282 {"PGA-ADC Mux Right", "MIC Right", "MICR" },
283 {"PGA-ADC Mux Right", "MIC+preamp Right", "Mic Preamp Right" },
285 {"Left PGA", NULL, "PGA-ADC Mux Left"},
286 {"Right PGA", NULL, "PGA-ADC Mux Right"},
289 static int cs42l51_set_dai_fmt(struct snd_soc_dai *codec_dai,
292 struct snd_soc_codec *codec = codec_dai->codec;
293 struct cs42l51_private *cs42l51 = snd_soc_codec_get_drvdata(codec);
296 switch (format & SND_SOC_DAIFMT_FORMAT_MASK) {
297 case SND_SOC_DAIFMT_I2S:
298 case SND_SOC_DAIFMT_LEFT_J:
299 case SND_SOC_DAIFMT_RIGHT_J:
300 cs42l51->audio_mode = format & SND_SOC_DAIFMT_FORMAT_MASK;
303 dev_err(codec->dev, "invalid DAI format\n");
307 switch (format & SND_SOC_DAIFMT_MASTER_MASK) {
308 case SND_SOC_DAIFMT_CBM_CFM:
309 cs42l51->func = MODE_MASTER;
311 case SND_SOC_DAIFMT_CBS_CFS:
312 cs42l51->func = MODE_SLAVE_AUTO;
322 struct cs42l51_ratios {
324 unsigned char speed_mode;
328 static struct cs42l51_ratios slave_ratios[] = {
329 { 512, CS42L51_QSM_MODE, 0 }, { 768, CS42L51_QSM_MODE, 0 },
330 { 1024, CS42L51_QSM_MODE, 0 }, { 1536, CS42L51_QSM_MODE, 0 },
331 { 2048, CS42L51_QSM_MODE, 0 }, { 3072, CS42L51_QSM_MODE, 0 },
332 { 256, CS42L51_HSM_MODE, 0 }, { 384, CS42L51_HSM_MODE, 0 },
333 { 512, CS42L51_HSM_MODE, 0 }, { 768, CS42L51_HSM_MODE, 0 },
334 { 1024, CS42L51_HSM_MODE, 0 }, { 1536, CS42L51_HSM_MODE, 0 },
335 { 128, CS42L51_SSM_MODE, 0 }, { 192, CS42L51_SSM_MODE, 0 },
336 { 256, CS42L51_SSM_MODE, 0 }, { 384, CS42L51_SSM_MODE, 0 },
337 { 512, CS42L51_SSM_MODE, 0 }, { 768, CS42L51_SSM_MODE, 0 },
338 { 128, CS42L51_DSM_MODE, 0 }, { 192, CS42L51_DSM_MODE, 0 },
339 { 256, CS42L51_DSM_MODE, 0 }, { 384, CS42L51_DSM_MODE, 0 },
342 static struct cs42l51_ratios slave_auto_ratios[] = {
343 { 1024, CS42L51_QSM_MODE, 0 }, { 1536, CS42L51_QSM_MODE, 0 },
344 { 2048, CS42L51_QSM_MODE, 1 }, { 3072, CS42L51_QSM_MODE, 1 },
345 { 512, CS42L51_HSM_MODE, 0 }, { 768, CS42L51_HSM_MODE, 0 },
346 { 1024, CS42L51_HSM_MODE, 1 }, { 1536, CS42L51_HSM_MODE, 1 },
347 { 256, CS42L51_SSM_MODE, 0 }, { 384, CS42L51_SSM_MODE, 0 },
348 { 512, CS42L51_SSM_MODE, 1 }, { 768, CS42L51_SSM_MODE, 1 },
349 { 128, CS42L51_DSM_MODE, 0 }, { 192, CS42L51_DSM_MODE, 0 },
350 { 256, CS42L51_DSM_MODE, 1 }, { 384, CS42L51_DSM_MODE, 1 },
353 static int cs42l51_set_dai_sysclk(struct snd_soc_dai *codec_dai,
354 int clk_id, unsigned int freq, int dir)
356 struct snd_soc_codec *codec = codec_dai->codec;
357 struct cs42l51_private *cs42l51 = snd_soc_codec_get_drvdata(codec);
359 cs42l51->mclk = freq;
363 static int cs42l51_hw_params(struct snd_pcm_substream *substream,
364 struct snd_pcm_hw_params *params,
365 struct snd_soc_dai *dai)
367 struct snd_soc_pcm_runtime *rtd = substream->private_data;
368 struct snd_soc_codec *codec = rtd->codec;
369 struct cs42l51_private *cs42l51 = snd_soc_codec_get_drvdata(codec);
374 struct cs42l51_ratios *ratios = NULL;
376 int intf_ctl, power_ctl, fmt;
378 switch (cs42l51->func) {
382 ratios = slave_ratios;
383 nr_ratios = ARRAY_SIZE(slave_ratios);
385 case MODE_SLAVE_AUTO:
386 ratios = slave_auto_ratios;
387 nr_ratios = ARRAY_SIZE(slave_auto_ratios);
391 /* Figure out which MCLK/LRCK ratio to use */
392 rate = params_rate(params); /* Sampling rate, in Hz */
393 ratio = cs42l51->mclk / rate; /* MCLK/LRCK ratio */
394 for (i = 0; i < nr_ratios; i++) {
395 if (ratios[i].ratio == ratio)
399 if (i == nr_ratios) {
400 /* We did not find a matching ratio */
401 dev_err(codec->dev, "could not find matching ratio\n");
405 intf_ctl = snd_soc_read(codec, CS42L51_INTF_CTL);
406 power_ctl = snd_soc_read(codec, CS42L51_MIC_POWER_CTL);
408 intf_ctl &= ~(CS42L51_INTF_CTL_MASTER | CS42L51_INTF_CTL_ADC_I2S
409 | CS42L51_INTF_CTL_DAC_FORMAT(7));
410 power_ctl &= ~(CS42L51_MIC_POWER_CTL_SPEED(3)
411 | CS42L51_MIC_POWER_CTL_MCLK_DIV2);
413 switch (cs42l51->func) {
415 intf_ctl |= CS42L51_INTF_CTL_MASTER;
416 power_ctl |= CS42L51_MIC_POWER_CTL_SPEED(ratios[i].speed_mode);
419 power_ctl |= CS42L51_MIC_POWER_CTL_SPEED(ratios[i].speed_mode);
421 case MODE_SLAVE_AUTO:
422 power_ctl |= CS42L51_MIC_POWER_CTL_AUTO;
426 switch (cs42l51->audio_mode) {
427 case SND_SOC_DAIFMT_I2S:
428 intf_ctl |= CS42L51_INTF_CTL_ADC_I2S;
429 intf_ctl |= CS42L51_INTF_CTL_DAC_FORMAT(CS42L51_DAC_DIF_I2S);
431 case SND_SOC_DAIFMT_LEFT_J:
432 intf_ctl |= CS42L51_INTF_CTL_DAC_FORMAT(CS42L51_DAC_DIF_LJ24);
434 case SND_SOC_DAIFMT_RIGHT_J:
435 switch (params_format(params)) {
436 case SNDRV_PCM_FORMAT_S16_LE:
437 case SNDRV_PCM_FORMAT_S16_BE:
438 fmt = CS42L51_DAC_DIF_RJ16;
440 case SNDRV_PCM_FORMAT_S18_3LE:
441 case SNDRV_PCM_FORMAT_S18_3BE:
442 fmt = CS42L51_DAC_DIF_RJ18;
444 case SNDRV_PCM_FORMAT_S20_3LE:
445 case SNDRV_PCM_FORMAT_S20_3BE:
446 fmt = CS42L51_DAC_DIF_RJ20;
448 case SNDRV_PCM_FORMAT_S24_LE:
449 case SNDRV_PCM_FORMAT_S24_BE:
450 fmt = CS42L51_DAC_DIF_RJ24;
453 dev_err(codec->dev, "unknown format\n");
456 intf_ctl |= CS42L51_INTF_CTL_DAC_FORMAT(fmt);
459 dev_err(codec->dev, "unknown format\n");
464 power_ctl |= CS42L51_MIC_POWER_CTL_MCLK_DIV2;
466 ret = snd_soc_write(codec, CS42L51_INTF_CTL, intf_ctl);
470 ret = snd_soc_write(codec, CS42L51_MIC_POWER_CTL, power_ctl);
477 static int cs42l51_dai_mute(struct snd_soc_dai *dai, int mute)
479 struct snd_soc_codec *codec = dai->codec;
481 int mask = CS42L51_DAC_OUT_CTL_DACA_MUTE|CS42L51_DAC_OUT_CTL_DACB_MUTE;
483 reg = snd_soc_read(codec, CS42L51_DAC_OUT_CTL);
490 return snd_soc_write(codec, CS42L51_DAC_OUT_CTL, reg);
493 static struct snd_soc_dai_ops cs42l51_dai_ops = {
494 .hw_params = cs42l51_hw_params,
495 .set_sysclk = cs42l51_set_dai_sysclk,
496 .set_fmt = cs42l51_set_dai_fmt,
497 .digital_mute = cs42l51_dai_mute,
500 static struct snd_soc_dai_driver cs42l51_dai = {
501 .name = "cs42l51-hifi",
503 .stream_name = "Playback",
506 .rates = SNDRV_PCM_RATE_8000_96000,
507 .formats = CS42L51_FORMATS,
510 .stream_name = "Capture",
513 .rates = SNDRV_PCM_RATE_8000_96000,
514 .formats = CS42L51_FORMATS,
516 .ops = &cs42l51_dai_ops,
519 static int cs42l51_probe(struct snd_soc_codec *codec)
521 struct cs42l51_private *cs42l51 = snd_soc_codec_get_drvdata(codec);
524 codec->control_data = cs42l51->control_data;
526 ret = cs42l51_fill_cache(codec);
528 dev_err(codec->dev, "failed to fill register cache\n");
532 ret = snd_soc_codec_set_cache_io(codec, 8, 8, cs42l51->control_type);
534 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
540 * - Use signal processor
542 * - vol changes immediate
545 reg = CS42L51_DAC_CTL_DATA_SEL(1)
546 | CS42L51_DAC_CTL_AMUTE | CS42L51_DAC_CTL_DACSZ(0);
547 ret = snd_soc_write(codec, CS42L51_DAC_CTL, reg);
551 snd_soc_add_controls(codec, cs42l51_snd_controls,
552 ARRAY_SIZE(cs42l51_snd_controls));
553 snd_soc_dapm_new_controls(codec, cs42l51_dapm_widgets,
554 ARRAY_SIZE(cs42l51_dapm_widgets));
555 snd_soc_dapm_add_routes(codec, cs42l51_routes,
556 ARRAY_SIZE(cs42l51_routes));
561 static struct snd_soc_codec_driver soc_codec_device_cs42l51 = {
562 .probe = cs42l51_probe,
563 .reg_cache_size = CS42L51_NUMREGS,
564 .reg_word_size = sizeof(u8),
567 static int cs42l51_i2c_probe(struct i2c_client *i2c_client,
568 const struct i2c_device_id *id)
570 struct cs42l51_private *cs42l51;
573 /* Verify that we have a CS42L51 */
574 ret = i2c_smbus_read_byte_data(i2c_client, CS42L51_CHIP_REV_ID);
576 dev_err(&i2c_client->dev, "failed to read I2C\n");
580 if ((ret != CS42L51_MK_CHIP_REV(CS42L51_CHIP_ID, CS42L51_CHIP_REV_A)) &&
581 (ret != CS42L51_MK_CHIP_REV(CS42L51_CHIP_ID, CS42L51_CHIP_REV_B))) {
582 dev_err(&i2c_client->dev, "Invalid chip id\n");
587 dev_info(&i2c_client->dev, "found device cs42l51 rev %d\n",
590 cs42l51 = kzalloc(sizeof(struct cs42l51_private), GFP_KERNEL);
592 dev_err(&i2c_client->dev, "could not allocate codec\n");
596 i2c_set_clientdata(i2c_client, cs42l51);
597 cs42l51->control_data = i2c_client;
598 cs42l51->control_type = SND_SOC_I2C;
600 ret = snd_soc_register_codec(&i2c_client->dev,
601 &soc_codec_device_cs42l51, &cs42l51_dai, 1);
608 static int cs42l51_i2c_remove(struct i2c_client *client)
610 struct cs42l51_private *cs42l51 = i2c_get_clientdata(client);
612 snd_soc_unregister_codec(&client->dev);
617 static const struct i2c_device_id cs42l51_id[] = {
621 MODULE_DEVICE_TABLE(i2c, cs42l51_id);
623 static struct i2c_driver cs42l51_i2c_driver = {
625 .name = "cs42l51-codec",
626 .owner = THIS_MODULE,
628 .id_table = cs42l51_id,
629 .probe = cs42l51_i2c_probe,
630 .remove = cs42l51_i2c_remove,
633 static int __init cs42l51_init(void)
637 ret = i2c_add_driver(&cs42l51_i2c_driver);
639 printk(KERN_ERR "%s: can't add i2c driver\n", __func__);
644 module_init(cs42l51_init);
646 static void __exit cs42l51_exit(void)
648 i2c_del_driver(&cs42l51_i2c_driver);
650 module_exit(cs42l51_exit);
652 MODULE_AUTHOR("Arnaud Patard <arnaud.patard@rtp-net.org>");
653 MODULE_DESCRIPTION("Cirrus Logic CS42L51 ALSA SoC Codec Driver");
654 MODULE_LICENSE("GPL");