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

Side by Side Diff: sound/soc/codecs/wm8711.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/wm8580.c ('k') | sound/soc/codecs/wm8728.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 * wm8711.c -- WM8711 ALSA SoC Audio driver 2 * wm8711.c -- WM8711 ALSA SoC Audio driver
3 * 3 *
4 * Copyright 2006 Wolfson Microelectronics 4 * Copyright 2006 Wolfson Microelectronics
5 * 5 *
6 * Author: Mike Arthur <linux@wolfsonmicro.com> 6 * Author: Mike Arthur <linux@wolfsonmicro.com>
7 * 7 *
8 * Based on wm8731.c by Richard Purdie 8 * Based on wm8731.c by Richard Purdie
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 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 11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 */ 13 */
14 14
15 #include <linux/module.h> 15 #include <linux/module.h>
16 #include <linux/moduleparam.h> 16 #include <linux/moduleparam.h>
17 #include <linux/init.h> 17 #include <linux/init.h>
18 #include <linux/delay.h> 18 #include <linux/delay.h>
19 #include <linux/pm.h> 19 #include <linux/pm.h>
20 #include <linux/i2c.h> 20 #include <linux/i2c.h>
21 #include <linux/platform_device.h> 21 #include <linux/platform_device.h>
22 #include <linux/spi/spi.h> 22 #include <linux/spi/spi.h>
23 #include <linux/slab.h> 23 #include <linux/slab.h>
24 #include <sound/core.h> 24 #include <sound/core.h>
25 #include <sound/pcm.h> 25 #include <sound/pcm.h>
26 #include <sound/pcm_params.h> 26 #include <sound/pcm_params.h>
27 #include <sound/soc.h> 27 #include <sound/soc.h>
28 #include <sound/soc-dapm.h>
29 #include <sound/tlv.h> 28 #include <sound/tlv.h>
30 #include <sound/initval.h> 29 #include <sound/initval.h>
31 30
32 #include "wm8711.h" 31 #include "wm8711.h"
33 32
34 /* codec private data */ 33 /* codec private data */
35 struct wm8711_priv { 34 struct wm8711_priv {
36 enum snd_soc_control_type bus_type; 35 enum snd_soc_control_type bus_type;
37 u16 reg_cache[WM8711_CACHEREGNUM];
38 unsigned int sysclk; 36 unsigned int sysclk;
39 }; 37 };
40 38
41 /* 39 /*
42 * wm8711 register cache 40 * wm8711 register cache
43 * We can't read the WM8711 register space when we are 41 * We can't read the WM8711 register space when we are
44 * using 2 wire for device control, so we cache them instead. 42 * using 2 wire for device control, so we cache them instead.
45 * There is no point in caching the reset register 43 * There is no point in caching the reset register
46 */ 44 */
47 static const u16 wm8711_reg[WM8711_CACHEREGNUM] = { 45 static const u16 wm8711_reg[WM8711_CACHEREGNUM] = {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 84
87 /* outputs */ 85 /* outputs */
88 {"RHPOUT", NULL, "Output Mixer"}, 86 {"RHPOUT", NULL, "Output Mixer"},
89 {"ROUT", NULL, "Output Mixer"}, 87 {"ROUT", NULL, "Output Mixer"},
90 {"LHPOUT", NULL, "Output Mixer"}, 88 {"LHPOUT", NULL, "Output Mixer"},
91 {"LOUT", NULL, "Output Mixer"}, 89 {"LOUT", NULL, "Output Mixer"},
92 }; 90 };
93 91
94 static int wm8711_add_widgets(struct snd_soc_codec *codec) 92 static int wm8711_add_widgets(struct snd_soc_codec *codec)
95 { 93 {
96 » snd_soc_dapm_new_controls(codec, wm8711_dapm_widgets, 94 » struct snd_soc_dapm_context *dapm = &codec->dapm;
95
96 » snd_soc_dapm_new_controls(dapm, wm8711_dapm_widgets,
97 ARRAY_SIZE(wm8711_dapm_widgets)); 97 ARRAY_SIZE(wm8711_dapm_widgets));
98 98 » snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
99 » snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon));
100 99
101 return 0; 100 return 0;
102 } 101 }
103 102
104 struct _coeff_div { 103 struct _coeff_div {
105 u32 mclk; 104 u32 mclk;
106 u32 rate; 105 u32 rate;
107 u16 fs; 106 u16 fs;
108 u8 sr:4; 107 u8 sr:4;
109 u8 bosr:1; 108 u8 bosr:1;
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 case SND_SOC_BIAS_PREPARE: 310 case SND_SOC_BIAS_PREPARE:
312 break; 311 break;
313 case SND_SOC_BIAS_STANDBY: 312 case SND_SOC_BIAS_STANDBY:
314 snd_soc_write(codec, WM8711_PWR, reg | 0x0040); 313 snd_soc_write(codec, WM8711_PWR, reg | 0x0040);
315 break; 314 break;
316 case SND_SOC_BIAS_OFF: 315 case SND_SOC_BIAS_OFF:
317 snd_soc_write(codec, WM8711_ACTIVE, 0x0); 316 snd_soc_write(codec, WM8711_ACTIVE, 0x0);
318 snd_soc_write(codec, WM8711_PWR, 0xffff); 317 snd_soc_write(codec, WM8711_PWR, 0xffff);
319 break; 318 break;
320 } 319 }
321 » codec->bias_level = level; 320 » codec->dapm.bias_level = level;
322 return 0; 321 return 0;
323 } 322 }
324 323
325 #define WM8711_RATES SNDRV_PCM_RATE_8000_96000 324 #define WM8711_RATES SNDRV_PCM_RATE_8000_96000
326 325
327 #define WM8711_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ 326 #define WM8711_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
328 SNDRV_PCM_FMTBIT_S24_LE) 327 SNDRV_PCM_FMTBIT_S24_LE)
329 328
330 static struct snd_soc_dai_ops wm8711_ops = { 329 static struct snd_soc_dai_ops wm8711_ops = {
331 .prepare = wm8711_pcm_prepare, 330 .prepare = wm8711_pcm_prepare,
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 #endif 532 #endif
534 #if defined(CONFIG_SPI_MASTER) 533 #if defined(CONFIG_SPI_MASTER)
535 spi_unregister_driver(&wm8711_spi_driver); 534 spi_unregister_driver(&wm8711_spi_driver);
536 #endif 535 #endif
537 } 536 }
538 module_exit(wm8711_exit); 537 module_exit(wm8711_exit);
539 538
540 MODULE_DESCRIPTION("ASoC WM8711 driver"); 539 MODULE_DESCRIPTION("ASoC WM8711 driver");
541 MODULE_AUTHOR("Mike Arthur"); 540 MODULE_AUTHOR("Mike Arthur");
542 MODULE_LICENSE("GPL"); 541 MODULE_LICENSE("GPL");
OLDNEW
« no previous file with comments | « sound/soc/codecs/wm8580.c ('k') | sound/soc/codecs/wm8728.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698