| OLD | NEW |
| 1 /* | 1 /* |
| 2 * File: sound/soc/codecs/ssm2602.c | 2 * File: sound/soc/codecs/ssm2602.c |
| 3 * Author: Cliff Cai <Cliff.Cai@analog.com> | 3 * Author: Cliff Cai <Cliff.Cai@analog.com> |
| 4 * | 4 * |
| 5 * Created: Tue June 06 2008 | 5 * Created: Tue June 06 2008 |
| 6 * Description: Driver for ssm2602 sound chip | 6 * Description: Driver for ssm2602 sound chip |
| 7 * | 7 * |
| 8 * Modified: | 8 * Modified: |
| 9 * Copyright 2008 Analog Devices Inc. | 9 * Copyright 2008 Analog Devices Inc. |
| 10 * | 10 * |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 #include <linux/init.h> | 31 #include <linux/init.h> |
| 32 #include <linux/delay.h> | 32 #include <linux/delay.h> |
| 33 #include <linux/pm.h> | 33 #include <linux/pm.h> |
| 34 #include <linux/i2c.h> | 34 #include <linux/i2c.h> |
| 35 #include <linux/platform_device.h> | 35 #include <linux/platform_device.h> |
| 36 #include <linux/slab.h> | 36 #include <linux/slab.h> |
| 37 #include <sound/core.h> | 37 #include <sound/core.h> |
| 38 #include <sound/pcm.h> | 38 #include <sound/pcm.h> |
| 39 #include <sound/pcm_params.h> | 39 #include <sound/pcm_params.h> |
| 40 #include <sound/soc.h> | 40 #include <sound/soc.h> |
| 41 #include <sound/soc-dapm.h> | |
| 42 #include <sound/initval.h> | 41 #include <sound/initval.h> |
| 43 | 42 |
| 44 #include "ssm2602.h" | 43 #include "ssm2602.h" |
| 45 | 44 |
| 46 #define SSM2602_VERSION "0.1" | 45 #define SSM2602_VERSION "0.1" |
| 47 | 46 |
| 48 /* codec private data */ | 47 /* codec private data */ |
| 49 struct ssm2602_priv { | 48 struct ssm2602_priv { |
| 50 unsigned int sysclk; | 49 unsigned int sysclk; |
| 51 enum snd_soc_control_type control_type; | 50 enum snd_soc_control_type control_type; |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 {"ADC", NULL, "Input Mux"}, | 199 {"ADC", NULL, "Input Mux"}, |
| 201 | 200 |
| 202 /* inputs */ | 201 /* inputs */ |
| 203 {"Line Input", NULL, "LLINEIN"}, | 202 {"Line Input", NULL, "LLINEIN"}, |
| 204 {"Line Input", NULL, "RLINEIN"}, | 203 {"Line Input", NULL, "RLINEIN"}, |
| 205 {"Mic Bias", NULL, "MICIN"}, | 204 {"Mic Bias", NULL, "MICIN"}, |
| 206 }; | 205 }; |
| 207 | 206 |
| 208 static int ssm2602_add_widgets(struct snd_soc_codec *codec) | 207 static int ssm2602_add_widgets(struct snd_soc_codec *codec) |
| 209 { | 208 { |
| 210 » snd_soc_dapm_new_controls(codec, ssm2602_dapm_widgets, | 209 » struct snd_soc_dapm_context *dapm = &codec->dapm; |
| 210 |
| 211 » snd_soc_dapm_new_controls(dapm, ssm2602_dapm_widgets, |
| 211 ARRAY_SIZE(ssm2602_dapm_widgets)); | 212 ARRAY_SIZE(ssm2602_dapm_widgets)); |
| 212 | 213 » snd_soc_dapm_add_routes(dapm, audio_conn, ARRAY_SIZE(audio_conn)); |
| 213 » snd_soc_dapm_add_routes(codec, audio_conn, ARRAY_SIZE(audio_conn)); | |
| 214 | 214 |
| 215 return 0; | 215 return 0; |
| 216 } | 216 } |
| 217 | 217 |
| 218 struct _coeff_div { | 218 struct _coeff_div { |
| 219 u32 mclk; | 219 u32 mclk; |
| 220 u32 rate; | 220 u32 rate; |
| 221 u16 fs; | 221 u16 fs; |
| 222 u8 sr:4; | 222 u8 sr:4; |
| 223 u8 bosr:1; | 223 u8 bosr:1; |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 /* everything off except vref/vmid, */ | 486 /* everything off except vref/vmid, */ |
| 487 ssm2602_write(codec, SSM2602_PWR, reg | PWR_CLK_OUT_PDN); | 487 ssm2602_write(codec, SSM2602_PWR, reg | PWR_CLK_OUT_PDN); |
| 488 break; | 488 break; |
| 489 case SND_SOC_BIAS_OFF: | 489 case SND_SOC_BIAS_OFF: |
| 490 /* everything off, dac mute, inactive */ | 490 /* everything off, dac mute, inactive */ |
| 491 ssm2602_write(codec, SSM2602_ACTIVE, 0); | 491 ssm2602_write(codec, SSM2602_ACTIVE, 0); |
| 492 ssm2602_write(codec, SSM2602_PWR, 0xffff); | 492 ssm2602_write(codec, SSM2602_PWR, 0xffff); |
| 493 break; | 493 break; |
| 494 | 494 |
| 495 } | 495 } |
| 496 » codec->bias_level = level; | 496 » codec->dapm.bias_level = level; |
| 497 return 0; | 497 return 0; |
| 498 } | 498 } |
| 499 | 499 |
| 500 #define SSM2602_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_32000 |\ | 500 #define SSM2602_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_32000 |\ |
| 501 SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 |\ | 501 SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 |\ |
| 502 SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000) | 502 SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000) |
| 503 | 503 |
| 504 #define SSM2602_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ | 504 #define SSM2602_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ |
| 505 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) | 505 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) |
| 506 | 506 |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 679 { | 679 { |
| 680 #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) | 680 #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) |
| 681 i2c_del_driver(&ssm2602_i2c_driver); | 681 i2c_del_driver(&ssm2602_i2c_driver); |
| 682 #endif | 682 #endif |
| 683 } | 683 } |
| 684 module_exit(ssm2602_exit); | 684 module_exit(ssm2602_exit); |
| 685 | 685 |
| 686 MODULE_DESCRIPTION("ASoC ssm2602 driver"); | 686 MODULE_DESCRIPTION("ASoC ssm2602 driver"); |
| 687 MODULE_AUTHOR("Cliff Cai"); | 687 MODULE_AUTHOR("Cliff Cai"); |
| 688 MODULE_LICENSE("GPL"); | 688 MODULE_LICENSE("GPL"); |
| OLD | NEW |