| OLD | NEW |
| 1 /* | 1 /* |
| 2 * ALSA SoC TLV320AIC23 codec driver | 2 * ALSA SoC TLV320AIC23 codec driver |
| 3 * | 3 * |
| 4 * Author: Arun KS, <arunks@mistralsolutions.com> | 4 * Author: Arun KS, <arunks@mistralsolutions.com> |
| 5 * Copyright: (C) 2008 Mistral Solutions Pvt Ltd., | 5 * Copyright: (C) 2008 Mistral Solutions Pvt Ltd., |
| 6 * | 6 * |
| 7 * Based on sound/soc/codecs/wm8731.c by Richard Purdie | 7 * Based on sound/soc/codecs/wm8731.c by Richard Purdie |
| 8 * | 8 * |
| 9 * This program is free software; you can redistribute it and/or modify | 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 | 10 * it under the terms of the GNU General Public License version 2 as |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include <linux/init.h> | 23 #include <linux/init.h> |
| 24 #include <linux/delay.h> | 24 #include <linux/delay.h> |
| 25 #include <linux/pm.h> | 25 #include <linux/pm.h> |
| 26 #include <linux/i2c.h> | 26 #include <linux/i2c.h> |
| 27 #include <linux/platform_device.h> | 27 #include <linux/platform_device.h> |
| 28 #include <linux/slab.h> | 28 #include <linux/slab.h> |
| 29 #include <sound/core.h> | 29 #include <sound/core.h> |
| 30 #include <sound/pcm.h> | 30 #include <sound/pcm.h> |
| 31 #include <sound/pcm_params.h> | 31 #include <sound/pcm_params.h> |
| 32 #include <sound/soc.h> | 32 #include <sound/soc.h> |
| 33 #include <sound/soc-dapm.h> | |
| 34 #include <sound/tlv.h> | 33 #include <sound/tlv.h> |
| 35 #include <sound/initval.h> | 34 #include <sound/initval.h> |
| 36 | 35 |
| 37 #include "tlv320aic23.h" | 36 #include "tlv320aic23.h" |
| 38 | 37 |
| 39 #define AIC23_VERSION "0.1" | 38 #define AIC23_VERSION "0.1" |
| 40 | 39 |
| 41 /* | 40 /* |
| 42 * AIC23 register cache | 41 * AIC23 register cache |
| 43 */ | 42 */ |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 get_current_sample_rates(codec, mclk, &adc, &dac); | 383 get_current_sample_rates(codec, mclk, &adc, &dac); |
| 385 printk(KERN_DEBUG "actual samplerate = %u,%u reg=%x\n", | 384 printk(KERN_DEBUG "actual samplerate = %u,%u reg=%x\n", |
| 386 adc, dac, data); | 385 adc, dac, data); |
| 387 } | 386 } |
| 388 #endif | 387 #endif |
| 389 return 0; | 388 return 0; |
| 390 } | 389 } |
| 391 | 390 |
| 392 static int tlv320aic23_add_widgets(struct snd_soc_codec *codec) | 391 static int tlv320aic23_add_widgets(struct snd_soc_codec *codec) |
| 393 { | 392 { |
| 394 » snd_soc_dapm_new_controls(codec, tlv320aic23_dapm_widgets, | 393 » struct snd_soc_dapm_context *dapm = &codec->dapm; |
| 394 |
| 395 » snd_soc_dapm_new_controls(dapm, tlv320aic23_dapm_widgets, |
| 395 ARRAY_SIZE(tlv320aic23_dapm_widgets)); | 396 ARRAY_SIZE(tlv320aic23_dapm_widgets)); |
| 396 | |
| 397 /* set up audio path interconnects */ | 397 /* set up audio path interconnects */ |
| 398 » snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon)); | 398 » snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon)); |
| 399 | 399 |
| 400 return 0; | 400 return 0; |
| 401 } | 401 } |
| 402 | 402 |
| 403 static int tlv320aic23_hw_params(struct snd_pcm_substream *substream, | 403 static int tlv320aic23_hw_params(struct snd_pcm_substream *substream, |
| 404 struct snd_pcm_hw_params *params, | 404 struct snd_pcm_hw_params *params, |
| 405 struct snd_soc_dai *dai) | 405 struct snd_soc_dai *dai) |
| 406 { | 406 { |
| 407 struct snd_soc_pcm_runtime *rtd = substream->private_data; | 407 struct snd_soc_pcm_runtime *rtd = substream->private_data; |
| 408 struct snd_soc_codec *codec = rtd->codec; | 408 struct snd_soc_codec *codec = rtd->codec; |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 /* everything off except vref/vmid, */ | 567 /* everything off except vref/vmid, */ |
| 568 tlv320aic23_write(codec, TLV320AIC23_PWR, reg | \ | 568 tlv320aic23_write(codec, TLV320AIC23_PWR, reg | \ |
| 569 TLV320AIC23_CLK_OFF); | 569 TLV320AIC23_CLK_OFF); |
| 570 break; | 570 break; |
| 571 case SND_SOC_BIAS_OFF: | 571 case SND_SOC_BIAS_OFF: |
| 572 /* everything off, dac mute, inactive */ | 572 /* everything off, dac mute, inactive */ |
| 573 tlv320aic23_write(codec, TLV320AIC23_ACTIVE, 0x0); | 573 tlv320aic23_write(codec, TLV320AIC23_ACTIVE, 0x0); |
| 574 tlv320aic23_write(codec, TLV320AIC23_PWR, 0xffff); | 574 tlv320aic23_write(codec, TLV320AIC23_PWR, 0xffff); |
| 575 break; | 575 break; |
| 576 } | 576 } |
| 577 » codec->bias_level = level; | 577 » codec->dapm.bias_level = level; |
| 578 return 0; | 578 return 0; |
| 579 } | 579 } |
| 580 | 580 |
| 581 #define AIC23_RATES SNDRV_PCM_RATE_8000_96000 | 581 #define AIC23_RATES SNDRV_PCM_RATE_8000_96000 |
| 582 #define AIC23_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ | 582 #define AIC23_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ |
| 583 SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE) | 583 SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE) |
| 584 | 584 |
| 585 static struct snd_soc_dai_ops tlv320aic23_dai_ops = { | 585 static struct snd_soc_dai_ops tlv320aic23_dai_ops = { |
| 586 .prepare = tlv320aic23_pcm_prepare, | 586 .prepare = tlv320aic23_pcm_prepare, |
| 587 .hw_params = tlv320aic23_hw_params, | 587 .hw_params = tlv320aic23_hw_params, |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 771 { | 771 { |
| 772 #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) | 772 #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) |
| 773 i2c_del_driver(&tlv320aic23_i2c_driver); | 773 i2c_del_driver(&tlv320aic23_i2c_driver); |
| 774 #endif | 774 #endif |
| 775 } | 775 } |
| 776 module_exit(tlv320aic23_exit); | 776 module_exit(tlv320aic23_exit); |
| 777 | 777 |
| 778 MODULE_DESCRIPTION("ASoC TLV320AIC23 codec driver"); | 778 MODULE_DESCRIPTION("ASoC TLV320AIC23 codec driver"); |
| 779 MODULE_AUTHOR("Arun KS <arunks@mistralsolutions.com>"); | 779 MODULE_AUTHOR("Arun KS <arunks@mistralsolutions.com>"); |
| 780 MODULE_LICENSE("GPL"); | 780 MODULE_LICENSE("GPL"); |
| OLD | NEW |