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

Side by Side Diff: sound/soc/codecs/jz4740.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/dmic.c ('k') | sound/soc/codecs/max98088.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 * Copyright (C) 2009-2010, Lars-Peter Clausen <lars@metafoo.de> 2 * Copyright (C) 2009-2010, Lars-Peter Clausen <lars@metafoo.de>
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as 5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation. 6 * published by the Free Software Foundation.
7 * 7 *
8 * You should have received a copy of the GNU General Public License along 8 * You should have received a copy of the GNU General Public License along
9 * with this program; if not, write to the Free Software Foundation, Inc., 9 * with this program; if not, write to the Free Software Foundation, Inc.,
10 * 675 Mass Ave, Cambridge, MA 02139, USA. 10 * 675 Mass Ave, Cambridge, MA 02139, USA.
11 * 11 *
12 */ 12 */
13 13
14 #include <linux/kernel.h> 14 #include <linux/kernel.h>
15 #include <linux/module.h> 15 #include <linux/module.h>
16 #include <linux/platform_device.h> 16 #include <linux/platform_device.h>
17 #include <linux/slab.h> 17 #include <linux/slab.h>
18 18
19 #include <linux/delay.h> 19 #include <linux/delay.h>
20 20
21 #include <sound/core.h> 21 #include <sound/core.h>
22 #include <sound/pcm.h> 22 #include <sound/pcm.h>
23 #include <sound/pcm_params.h> 23 #include <sound/pcm_params.h>
24 #include <sound/initval.h> 24 #include <sound/initval.h>
25 #include <sound/soc-dapm.h>
26 #include <sound/soc.h> 25 #include <sound/soc.h>
27 26
28 #define JZ4740_REG_CODEC_1 0x0 27 #define JZ4740_REG_CODEC_1 0x0
29 #define JZ4740_REG_CODEC_2 0x1 28 #define JZ4740_REG_CODEC_2 0x1
30 29
31 #define JZ4740_CODEC_1_LINE_ENABLE BIT(29) 30 #define JZ4740_CODEC_1_LINE_ENABLE BIT(29)
32 #define JZ4740_CODEC_1_MIC_ENABLE BIT(28) 31 #define JZ4740_CODEC_1_MIC_ENABLE BIT(28)
33 #define JZ4740_CODEC_1_SW1_ENABLE BIT(27) 32 #define JZ4740_CODEC_1_SW1_ENABLE BIT(27)
34 #define JZ4740_CODEC_1_ADC_ENABLE BIT(26) 33 #define JZ4740_CODEC_1_ADC_ENABLE BIT(26)
35 #define JZ4740_CODEC_1_SW2_ENABLE BIT(25) 34 #define JZ4740_CODEC_1_SW2_ENABLE BIT(25)
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 case SND_SOC_BIAS_PREPARE: 258 case SND_SOC_BIAS_PREPARE:
260 mask = JZ4740_CODEC_1_VREF_DISABLE | 259 mask = JZ4740_CODEC_1_VREF_DISABLE |
261 JZ4740_CODEC_1_VREF_AMP_DISABLE | 260 JZ4740_CODEC_1_VREF_AMP_DISABLE |
262 JZ4740_CODEC_1_HEADPHONE_POWERDOWN_M; 261 JZ4740_CODEC_1_HEADPHONE_POWERDOWN_M;
263 value = 0; 262 value = 0;
264 263
265 snd_soc_update_bits(codec, JZ4740_REG_CODEC_1, mask, value); 264 snd_soc_update_bits(codec, JZ4740_REG_CODEC_1, mask, value);
266 break; 265 break;
267 case SND_SOC_BIAS_STANDBY: 266 case SND_SOC_BIAS_STANDBY:
268 /* The only way to clear the suspend flag is to reset the codec */ 267 /* The only way to clear the suspend flag is to reset the codec */
269 » » if (codec->bias_level == SND_SOC_BIAS_OFF) 268 » » if (codec->dapm.bias_level == SND_SOC_BIAS_OFF)
270 jz4740_codec_wakeup(codec); 269 jz4740_codec_wakeup(codec);
271 270
272 mask = JZ4740_CODEC_1_VREF_DISABLE | 271 mask = JZ4740_CODEC_1_VREF_DISABLE |
273 JZ4740_CODEC_1_VREF_AMP_DISABLE | 272 JZ4740_CODEC_1_VREF_AMP_DISABLE |
274 JZ4740_CODEC_1_HEADPHONE_POWERDOWN_M; 273 JZ4740_CODEC_1_HEADPHONE_POWERDOWN_M;
275 value = JZ4740_CODEC_1_VREF_DISABLE | 274 value = JZ4740_CODEC_1_VREF_DISABLE |
276 JZ4740_CODEC_1_VREF_AMP_DISABLE | 275 JZ4740_CODEC_1_VREF_AMP_DISABLE |
277 JZ4740_CODEC_1_HEADPHONE_POWERDOWN_M; 276 JZ4740_CODEC_1_HEADPHONE_POWERDOWN_M;
278 277
279 snd_soc_update_bits(codec, JZ4740_REG_CODEC_1, mask, value); 278 snd_soc_update_bits(codec, JZ4740_REG_CODEC_1, mask, value);
280 break; 279 break;
281 case SND_SOC_BIAS_OFF: 280 case SND_SOC_BIAS_OFF:
282 mask = JZ4740_CODEC_1_SUSPEND; 281 mask = JZ4740_CODEC_1_SUSPEND;
283 value = JZ4740_CODEC_1_SUSPEND; 282 value = JZ4740_CODEC_1_SUSPEND;
284 283
285 snd_soc_update_bits(codec, JZ4740_REG_CODEC_1, mask, value); 284 snd_soc_update_bits(codec, JZ4740_REG_CODEC_1, mask, value);
286 break; 285 break;
287 default: 286 default:
288 break; 287 break;
289 } 288 }
290 289
291 » codec->bias_level = level; 290 » codec->dapm.bias_level = level;
292 291
293 return 0; 292 return 0;
294 } 293 }
295 294
296 static int jz4740_codec_dev_probe(struct snd_soc_codec *codec) 295 static int jz4740_codec_dev_probe(struct snd_soc_codec *codec)
297 { 296 {
297 struct snd_soc_dapm_context *dapm = &codec->dapm;
298
298 snd_soc_update_bits(codec, JZ4740_REG_CODEC_1, 299 snd_soc_update_bits(codec, JZ4740_REG_CODEC_1,
299 JZ4740_CODEC_1_SW2_ENABLE, JZ4740_CODEC_1_SW2_ENABLE); 300 JZ4740_CODEC_1_SW2_ENABLE, JZ4740_CODEC_1_SW2_ENABLE);
300 301
301 snd_soc_add_controls(codec, jz4740_codec_controls, 302 snd_soc_add_controls(codec, jz4740_codec_controls,
302 ARRAY_SIZE(jz4740_codec_controls)); 303 ARRAY_SIZE(jz4740_codec_controls));
303 304
304 » snd_soc_dapm_new_controls(codec, jz4740_codec_dapm_widgets, 305 » snd_soc_dapm_new_controls(dapm, jz4740_codec_dapm_widgets,
305 ARRAY_SIZE(jz4740_codec_dapm_widgets)); 306 ARRAY_SIZE(jz4740_codec_dapm_widgets));
306 307
307 » snd_soc_dapm_add_routes(codec, jz4740_codec_dapm_routes, 308 » snd_soc_dapm_add_routes(dapm, jz4740_codec_dapm_routes,
308 ARRAY_SIZE(jz4740_codec_dapm_routes)); 309 ARRAY_SIZE(jz4740_codec_dapm_routes));
309 310
310 snd_soc_dapm_new_widgets(codec); 311 snd_soc_dapm_new_widgets(codec);
311 312
312 jz4740_codec_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 313 jz4740_codec_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
313 314
314 return 0; 315 return 0;
315 } 316 }
316 317
317 static int jz4740_codec_dev_remove(struct snd_soc_codec *codec) 318 static int jz4740_codec_dev_remove(struct snd_soc_codec *codec)
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 static void __exit jz4740_codec_exit(void) 439 static void __exit jz4740_codec_exit(void)
439 { 440 {
440 platform_driver_unregister(&jz4740_codec_driver); 441 platform_driver_unregister(&jz4740_codec_driver);
441 } 442 }
442 module_exit(jz4740_codec_exit); 443 module_exit(jz4740_codec_exit);
443 444
444 MODULE_DESCRIPTION("JZ4740 SoC internal codec driver"); 445 MODULE_DESCRIPTION("JZ4740 SoC internal codec driver");
445 MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>"); 446 MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
446 MODULE_LICENSE("GPL v2"); 447 MODULE_LICENSE("GPL v2");
447 MODULE_ALIAS("platform:jz4740-codec"); 448 MODULE_ALIAS("platform:jz4740-codec");
OLDNEW
« no previous file with comments | « sound/soc/codecs/dmic.c ('k') | sound/soc/codecs/max98088.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698