Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(228)

Side by Side Diff: sound/soc/codecs/wm8510.c

Issue 6577007: CHROMIUM: ASoC: Import entire upstream ASoC tree (Closed)
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sound/soc/codecs/wm8400.c ('k') | sound/soc/codecs/wm8523.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * wm8510.c -- WM8510 ALSA Soc Audio driver 2 * wm8510.c -- WM8510 ALSA Soc Audio driver
3 * 3 *
4 * Copyright 2006 Wolfson Microelectronics PLC. 4 * Copyright 2006 Wolfson Microelectronics PLC.
5 * 5 *
6 * Author: Liam Girdwood <lrg@slimlogic.co.uk> 6 * Author: Liam Girdwood <lrg@slimlogic.co.uk>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 */ 11 */
12 12
13 #include <linux/module.h> 13 #include <linux/module.h>
14 #include <linux/moduleparam.h> 14 #include <linux/moduleparam.h>
15 #include <linux/kernel.h> 15 #include <linux/kernel.h>
16 #include <linux/init.h> 16 #include <linux/init.h>
17 #include <linux/delay.h> 17 #include <linux/delay.h>
18 #include <linux/pm.h> 18 #include <linux/pm.h>
19 #include <linux/i2c.h> 19 #include <linux/i2c.h>
20 #include <linux/platform_device.h> 20 #include <linux/platform_device.h>
21 #include <linux/spi/spi.h> 21 #include <linux/spi/spi.h>
22 #include <linux/slab.h> 22 #include <linux/slab.h>
23 #include <sound/core.h> 23 #include <sound/core.h>
24 #include <sound/pcm.h> 24 #include <sound/pcm.h>
25 #include <sound/pcm_params.h> 25 #include <sound/pcm_params.h>
26 #include <sound/soc.h> 26 #include <sound/soc.h>
27 #include <sound/soc-dapm.h>
28 #include <sound/initval.h> 27 #include <sound/initval.h>
29 28
30 #include "wm8510.h" 29 #include "wm8510.h"
31 30
32 /* 31 /*
33 * wm8510 register cache 32 * wm8510 register cache
34 * We can't read the WM8510 register space when we are 33 * We can't read the WM8510 register space when we are
35 * using 2 wire for device control, so we cache them instead. 34 * using 2 wire for device control, so we cache them instead.
36 */ 35 */
37 static const u16 wm8510_reg[WM8510_CACHEREGNUM] = { 36 static const u16 wm8510_reg[WM8510_CACHEREGNUM] = {
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 /* Boost Mixer */ 208 /* Boost Mixer */
210 {"Boost Mixer", "Mic PGA Switch", "Mic PGA"}, 209 {"Boost Mixer", "Mic PGA Switch", "Mic PGA"},
211 {"Boost Mixer", "Mic Volume", "MICP"}, 210 {"Boost Mixer", "Mic Volume", "MICP"},
212 {"Boost Mixer", "Aux Volume", "Aux Input"}, 211 {"Boost Mixer", "Aux Volume", "Aux Input"},
213 212
214 {"ADC", NULL, "Boost Mixer"}, 213 {"ADC", NULL, "Boost Mixer"},
215 }; 214 };
216 215
217 static int wm8510_add_widgets(struct snd_soc_codec *codec) 216 static int wm8510_add_widgets(struct snd_soc_codec *codec)
218 { 217 {
219 » snd_soc_dapm_new_controls(codec, wm8510_dapm_widgets, 218 » struct snd_soc_dapm_context *dapm = &codec->dapm;
219
220 » snd_soc_dapm_new_controls(dapm, wm8510_dapm_widgets,
220 ARRAY_SIZE(wm8510_dapm_widgets)); 221 ARRAY_SIZE(wm8510_dapm_widgets));
221 222 » snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
222 » snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));
223 223
224 return 0; 224 return 0;
225 } 225 }
226 226
227 struct pll_ { 227 struct pll_ {
228 unsigned int pre_div:4; /* prescale - 1 */ 228 unsigned int pre_div:4; /* prescale - 1 */
229 unsigned int n:4; 229 unsigned int n:4;
230 unsigned int k; 230 unsigned int k;
231 }; 231 };
232 232
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 switch (level) { 471 switch (level) {
472 case SND_SOC_BIAS_ON: 472 case SND_SOC_BIAS_ON:
473 case SND_SOC_BIAS_PREPARE: 473 case SND_SOC_BIAS_PREPARE:
474 power1 |= 0x1; /* VMID 50k */ 474 power1 |= 0x1; /* VMID 50k */
475 snd_soc_write(codec, WM8510_POWER1, power1); 475 snd_soc_write(codec, WM8510_POWER1, power1);
476 break; 476 break;
477 477
478 case SND_SOC_BIAS_STANDBY: 478 case SND_SOC_BIAS_STANDBY:
479 power1 |= WM8510_POWER1_BIASEN | WM8510_POWER1_BUFIOEN; 479 power1 |= WM8510_POWER1_BIASEN | WM8510_POWER1_BUFIOEN;
480 480
481 » » if (codec->bias_level == SND_SOC_BIAS_OFF) { 481 » » if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
482 /* Initial cap charge at VMID 5k */ 482 /* Initial cap charge at VMID 5k */
483 snd_soc_write(codec, WM8510_POWER1, power1 | 0x3); 483 snd_soc_write(codec, WM8510_POWER1, power1 | 0x3);
484 mdelay(100); 484 mdelay(100);
485 } 485 }
486 486
487 power1 |= 0x2; /* VMID 500k */ 487 power1 |= 0x2; /* VMID 500k */
488 snd_soc_write(codec, WM8510_POWER1, power1); 488 snd_soc_write(codec, WM8510_POWER1, power1);
489 break; 489 break;
490 490
491 case SND_SOC_BIAS_OFF: 491 case SND_SOC_BIAS_OFF:
492 snd_soc_write(codec, WM8510_POWER1, 0); 492 snd_soc_write(codec, WM8510_POWER1, 0);
493 snd_soc_write(codec, WM8510_POWER2, 0); 493 snd_soc_write(codec, WM8510_POWER2, 0);
494 snd_soc_write(codec, WM8510_POWER3, 0); 494 snd_soc_write(codec, WM8510_POWER3, 0);
495 break; 495 break;
496 } 496 }
497 497
498 » codec->bias_level = level; 498 » codec->dapm.bias_level = level;
499 return 0; 499 return 0;
500 } 500 }
501 501
502 #define WM8510_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 |\ 502 #define WM8510_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 |\
503 SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 |\ 503 SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 |\
504 SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000) 504 SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000)
505 505
506 #define WM8510_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ 506 #define WM8510_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
507 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) 507 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)
508 508
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 #endif 706 #endif
707 #if defined(CONFIG_SPI_MASTER) 707 #if defined(CONFIG_SPI_MASTER)
708 spi_unregister_driver(&wm8510_spi_driver); 708 spi_unregister_driver(&wm8510_spi_driver);
709 #endif 709 #endif
710 } 710 }
711 module_exit(wm8510_exit); 711 module_exit(wm8510_exit);
712 712
713 MODULE_DESCRIPTION("ASoC WM8510 driver"); 713 MODULE_DESCRIPTION("ASoC WM8510 driver");
714 MODULE_AUTHOR("Liam Girdwood"); 714 MODULE_AUTHOR("Liam Girdwood");
715 MODULE_LICENSE("GPL"); 715 MODULE_LICENSE("GPL");
OLDNEW
« no previous file with comments | « sound/soc/codecs/wm8400.c ('k') | sound/soc/codecs/wm8523.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698