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

Side by Side Diff: sound/soc/codecs/wm8985.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/wm8978.c ('k') | sound/soc/codecs/wm8988.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 * wm8985.c -- WM8985 ALSA SoC Audio driver 2 * wm8985.c -- WM8985 ALSA SoC Audio driver
3 * 3 *
4 * Copyright 2010 Wolfson Microelectronics plc 4 * Copyright 2010 Wolfson Microelectronics plc
5 * 5 *
6 * Author: Dimitris Papastamos <dp@opensource.wolfsonmicro.com> 6 * Author: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
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 * TODO: 12 * TODO:
13 * o Add OUT3/OUT4 mixer controls. 13 * o Add OUT3/OUT4 mixer controls.
14 */ 14 */
15 15
16 #include <linux/module.h> 16 #include <linux/module.h>
17 #include <linux/moduleparam.h> 17 #include <linux/moduleparam.h>
18 #include <linux/init.h> 18 #include <linux/init.h>
19 #include <linux/delay.h> 19 #include <linux/delay.h>
20 #include <linux/pm.h> 20 #include <linux/pm.h>
21 #include <linux/i2c.h> 21 #include <linux/i2c.h>
22 #include <linux/regulator/consumer.h> 22 #include <linux/regulator/consumer.h>
23 #include <linux/spi/spi.h> 23 #include <linux/spi/spi.h>
24 #include <linux/slab.h> 24 #include <linux/slab.h>
25 #include <sound/core.h> 25 #include <sound/core.h>
26 #include <sound/pcm.h> 26 #include <sound/pcm.h>
27 #include <sound/pcm_params.h> 27 #include <sound/pcm_params.h>
28 #include <sound/soc.h> 28 #include <sound/soc.h>
29 #include <sound/soc-dapm.h>
30 #include <sound/initval.h> 29 #include <sound/initval.h>
31 #include <sound/tlv.h> 30 #include <sound/tlv.h>
32 31
33 #include "wm8985.h" 32 #include "wm8985.h"
34 33
35 #define WM8985_NUM_SUPPLIES 4 34 #define WM8985_NUM_SUPPLIES 4
36 static const char *wm8985_supply_names[WM8985_NUM_SUPPLIES] = { 35 static const char *wm8985_supply_names[WM8985_NUM_SUPPLIES] = {
37 "DCVDD", 36 "DCVDD",
38 "DBVDD", 37 "DBVDD",
39 "AVDD1", 38 "AVDD1",
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 ucontrol->value.integer.value[0] 525 ucontrol->value.integer.value[0]
527 << WM8985_EQ3DMODE_SHIFT); 526 << WM8985_EQ3DMODE_SHIFT);
528 /* restore DAC/ADC configuration */ 527 /* restore DAC/ADC configuration */
529 snd_soc_write(codec, WM8985_POWER_MANAGEMENT_2, regpwr2); 528 snd_soc_write(codec, WM8985_POWER_MANAGEMENT_2, regpwr2);
530 snd_soc_write(codec, WM8985_POWER_MANAGEMENT_3, regpwr3); 529 snd_soc_write(codec, WM8985_POWER_MANAGEMENT_3, regpwr3);
531 return 0; 530 return 0;
532 } 531 }
533 532
534 static int wm8985_add_widgets(struct snd_soc_codec *codec) 533 static int wm8985_add_widgets(struct snd_soc_codec *codec)
535 { 534 {
536 » snd_soc_dapm_new_controls(codec, wm8985_dapm_widgets, 535 » struct snd_soc_dapm_context *dapm = &codec->dapm;
536
537 » snd_soc_dapm_new_controls(dapm, wm8985_dapm_widgets,
537 ARRAY_SIZE(wm8985_dapm_widgets)); 538 ARRAY_SIZE(wm8985_dapm_widgets));
538 539 » snd_soc_dapm_add_routes(dapm, audio_map,
539 » snd_soc_dapm_add_routes(codec, audio_map,
540 ARRAY_SIZE(audio_map)); 540 ARRAY_SIZE(audio_map));
541 return 0; 541 return 0;
542 } 542 }
543 543
544 static int wm8985_reset(struct snd_soc_codec *codec) 544 static int wm8985_reset(struct snd_soc_codec *codec)
545 { 545 {
546 return snd_soc_write(codec, WM8985_SOFTWARE_RESET, 0x0); 546 return snd_soc_write(codec, WM8985_SOFTWARE_RESET, 0x0);
547 } 547 }
548 548
549 static int wm8985_dac_mute(struct snd_soc_dai *dai, int mute) 549 static int wm8985_dac_mute(struct snd_soc_dai *dai, int mute)
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 wm8985 = snd_soc_codec_get_drvdata(codec); 872 wm8985 = snd_soc_codec_get_drvdata(codec);
873 switch (level) { 873 switch (level) {
874 case SND_SOC_BIAS_ON: 874 case SND_SOC_BIAS_ON:
875 case SND_SOC_BIAS_PREPARE: 875 case SND_SOC_BIAS_PREPARE:
876 /* VMID at 75k */ 876 /* VMID at 75k */
877 snd_soc_update_bits(codec, WM8985_POWER_MANAGEMENT_1, 877 snd_soc_update_bits(codec, WM8985_POWER_MANAGEMENT_1,
878 WM8985_VMIDSEL_MASK, 878 WM8985_VMIDSEL_MASK,
879 1 << WM8985_VMIDSEL_SHIFT); 879 1 << WM8985_VMIDSEL_SHIFT);
880 break; 880 break;
881 case SND_SOC_BIAS_STANDBY: 881 case SND_SOC_BIAS_STANDBY:
882 » » if (codec->bias_level == SND_SOC_BIAS_OFF) { 882 » » if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
883 ret = regulator_bulk_enable(ARRAY_SIZE(wm8985->supplies) , 883 ret = regulator_bulk_enable(ARRAY_SIZE(wm8985->supplies) ,
884 wm8985->supplies); 884 wm8985->supplies);
885 if (ret) { 885 if (ret) {
886 dev_err(codec->dev, 886 dev_err(codec->dev,
887 "Failed to enable supplies: %d\n", 887 "Failed to enable supplies: %d\n",
888 ret); 888 ret);
889 return ret; 889 return ret;
890 } 890 }
891 891
892 wm8985_sync_cache(codec); 892 wm8985_sync_cache(codec);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 snd_soc_write(codec, WM8985_POWER_MANAGEMENT_2, 0); 932 snd_soc_write(codec, WM8985_POWER_MANAGEMENT_2, 0);
933 snd_soc_write(codec, WM8985_POWER_MANAGEMENT_3, 0); 933 snd_soc_write(codec, WM8985_POWER_MANAGEMENT_3, 0);
934 934
935 codec->cache_sync = 1; 935 codec->cache_sync = 1;
936 936
937 regulator_bulk_disable(ARRAY_SIZE(wm8985->supplies), 937 regulator_bulk_disable(ARRAY_SIZE(wm8985->supplies),
938 wm8985->supplies); 938 wm8985->supplies);
939 break; 939 break;
940 } 940 }
941 941
942 » codec->bias_level = level; 942 » codec->dapm.bias_level = level;
943 return 0; 943 return 0;
944 } 944 }
945 945
946 #ifdef CONFIG_PM 946 #ifdef CONFIG_PM
947 static int wm8985_suspend(struct snd_soc_codec *codec, pm_message_t state) 947 static int wm8985_suspend(struct snd_soc_codec *codec, pm_message_t state)
948 { 948 {
949 wm8985_set_bias_level(codec, SND_SOC_BIAS_OFF); 949 wm8985_set_bias_level(codec, SND_SOC_BIAS_OFF);
950 return 0; 950 return 0;
951 } 951 }
952 952
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
1183 #endif 1183 #endif
1184 #if defined(CONFIG_SPI_MASTER) 1184 #if defined(CONFIG_SPI_MASTER)
1185 spi_unregister_driver(&wm8985_spi_driver); 1185 spi_unregister_driver(&wm8985_spi_driver);
1186 #endif 1186 #endif
1187 } 1187 }
1188 module_exit(wm8985_exit); 1188 module_exit(wm8985_exit);
1189 1189
1190 MODULE_DESCRIPTION("ASoC WM8985 driver"); 1190 MODULE_DESCRIPTION("ASoC WM8985 driver");
1191 MODULE_AUTHOR("Dimitris Papastamos <dp@opensource.wolfsonmicro.com>"); 1191 MODULE_AUTHOR("Dimitris Papastamos <dp@opensource.wolfsonmicro.com>");
1192 MODULE_LICENSE("GPL"); 1192 MODULE_LICENSE("GPL");
OLDNEW
« no previous file with comments | « sound/soc/codecs/wm8978.c ('k') | sound/soc/codecs/wm8988.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698