diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-05-12 06:32:07 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-05-12 06:32:07 -0400 |
commit | dd4a416442a2fb4bd761163277d37ab6ce75ee4e (patch) | |
tree | 1e6cdbe90333411e0a35045ed06cf67778e86126 | |
parent | ddc4097b77bbb227851a44287acb2fb8a9896cc1 (diff) | |
parent | 13e2c86c20f5d07b20d5a6dee24bcdd2b30b859f (diff) |
Merge branch 'for-2.6.31' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound-2.6 into topic/asoc
-rw-r--r-- | sound/arm/pxa2xx-ac97-lib.c | 2 | ||||
-rw-r--r-- | sound/soc/atmel/Kconfig | 8 | ||||
-rw-r--r-- | sound/soc/atmel/Makefile | 1 | ||||
-rw-r--r-- | sound/soc/atmel/snd-soc-afeb9260.c | 203 | ||||
-rw-r--r-- | sound/soc/codecs/twl4030.c | 52 | ||||
-rw-r--r-- | sound/soc/pxa/Kconfig | 4 | ||||
-rw-r--r-- | sound/soc/pxa/em-x270.c | 9 | ||||
-rw-r--r-- | sound/soc/pxa/pxa2xx-i2s.c | 1 | ||||
-rw-r--r-- | sound/soc/soc-core.c | 43 |
9 files changed, 283 insertions, 40 deletions
diff --git a/sound/arm/pxa2xx-ac97-lib.c b/sound/arm/pxa2xx-ac97-lib.c index a2c12d105c9a..6fdca97186e7 100644 --- a/sound/arm/pxa2xx-ac97-lib.c +++ b/sound/arm/pxa2xx-ac97-lib.c | |||
@@ -65,7 +65,7 @@ static void set_resetgpio_mode(int resetgpio_action) | |||
65 | switch (resetgpio_action) { | 65 | switch (resetgpio_action) { |
66 | case RESETGPIO_NORMAL_ALTFUNC: | 66 | case RESETGPIO_NORMAL_ALTFUNC: |
67 | if (reset_gpio == 113) | 67 | if (reset_gpio == 113) |
68 | mode = 113 | GPIO_OUT | GPIO_DFLT_LOW; | 68 | mode = 113 | GPIO_ALT_FN_2_OUT; |
69 | if (reset_gpio == 95) | 69 | if (reset_gpio == 95) |
70 | mode = 95 | GPIO_ALT_FN_1_OUT; | 70 | mode = 95 | GPIO_ALT_FN_1_OUT; |
71 | break; | 71 | break; |
diff --git a/sound/soc/atmel/Kconfig b/sound/soc/atmel/Kconfig index a608d7009dbd..e720d5e6f04c 100644 --- a/sound/soc/atmel/Kconfig +++ b/sound/soc/atmel/Kconfig | |||
@@ -41,3 +41,11 @@ config SND_AT32_SOC_PLAYPAQ_SLAVE | |||
41 | and FRAME signals on the PlayPaq. Unless you want to play | 41 | and FRAME signals on the PlayPaq. Unless you want to play |
42 | with the AT32 as the SSC master, you probably want to say N here, | 42 | with the AT32 as the SSC master, you probably want to say N here, |
43 | as this will give you better sound quality. | 43 | as this will give you better sound quality. |
44 | |||
45 | config SND_AT91_SOC_AFEB9260 | ||
46 | tristate "SoC Audio support for AFEB9260 board" | ||
47 | depends on ARCH_AT91 && MACH_AFEB9260 && SND_ATMEL_SOC | ||
48 | select SND_ATMEL_SOC_SSC | ||
49 | select SND_SOC_TLV320AIC23 | ||
50 | help | ||
51 | Say Y here to support sound on AFEB9260 board. | ||
diff --git a/sound/soc/atmel/Makefile b/sound/soc/atmel/Makefile index f54a7cc68e66..e7ea56bd5f82 100644 --- a/sound/soc/atmel/Makefile +++ b/sound/soc/atmel/Makefile | |||
@@ -13,3 +13,4 @@ snd-soc-playpaq-objs := playpaq_wm8510.o | |||
13 | 13 | ||
14 | obj-$(CONFIG_SND_AT91_SOC_SAM9G20_WM8731) += snd-soc-sam9g20-wm8731.o | 14 | obj-$(CONFIG_SND_AT91_SOC_SAM9G20_WM8731) += snd-soc-sam9g20-wm8731.o |
15 | obj-$(CONFIG_SND_AT32_SOC_PLAYPAQ) += snd-soc-playpaq.o | 15 | obj-$(CONFIG_SND_AT32_SOC_PLAYPAQ) += snd-soc-playpaq.o |
16 | obj-$(CONFIG_SND_AT91_SOC_AFEB9260) += snd-soc-afeb9260.o | ||
diff --git a/sound/soc/atmel/snd-soc-afeb9260.c b/sound/soc/atmel/snd-soc-afeb9260.c new file mode 100644 index 000000000000..23349de27313 --- /dev/null +++ b/sound/soc/atmel/snd-soc-afeb9260.c | |||
@@ -0,0 +1,203 @@ | |||
1 | /* | ||
2 | * afeb9260.c -- SoC audio for AFEB9260 | ||
3 | * | ||
4 | * Copyright (C) 2009 Sergey Lapin <slapin@ossfans.org> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * version 2 as published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, but | ||
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | * General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
18 | * 02110-1301 USA | ||
19 | * | ||
20 | */ | ||
21 | |||
22 | #include <linux/module.h> | ||
23 | #include <linux/moduleparam.h> | ||
24 | #include <linux/kernel.h> | ||
25 | #include <linux/clk.h> | ||
26 | #include <linux/platform_device.h> | ||
27 | |||
28 | #include <linux/atmel-ssc.h> | ||
29 | #include <sound/core.h> | ||
30 | #include <sound/pcm.h> | ||
31 | #include <sound/pcm_params.h> | ||
32 | #include <sound/soc.h> | ||
33 | #include <sound/soc-dapm.h> | ||
34 | |||
35 | #include <asm/mach-types.h> | ||
36 | #include <mach/hardware.h> | ||
37 | #include <linux/gpio.h> | ||
38 | |||
39 | #include "../codecs/tlv320aic23.h" | ||
40 | #include "atmel-pcm.h" | ||
41 | #include "atmel_ssc_dai.h" | ||
42 | |||
43 | #define CODEC_CLOCK 12000000 | ||
44 | |||
45 | static int afeb9260_hw_params(struct snd_pcm_substream *substream, | ||
46 | struct snd_pcm_hw_params *params) | ||
47 | { | ||
48 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
49 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | ||
50 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | ||
51 | int err; | ||
52 | |||
53 | /* Set codec DAI configuration */ | ||
54 | err = snd_soc_dai_set_fmt(codec_dai, | ||
55 | SND_SOC_DAIFMT_I2S| | ||
56 | SND_SOC_DAIFMT_NB_IF | | ||
57 | SND_SOC_DAIFMT_CBM_CFM); | ||
58 | if (err < 0) { | ||
59 | printk(KERN_ERR "can't set codec DAI configuration\n"); | ||
60 | return err; | ||
61 | } | ||
62 | |||
63 | /* Set cpu DAI configuration */ | ||
64 | err = snd_soc_dai_set_fmt(cpu_dai, | ||
65 | SND_SOC_DAIFMT_I2S | | ||
66 | SND_SOC_DAIFMT_NB_IF | | ||
67 | SND_SOC_DAIFMT_CBM_CFM); | ||
68 | if (err < 0) { | ||
69 | printk(KERN_ERR "can't set cpu DAI configuration\n"); | ||
70 | return err; | ||
71 | } | ||
72 | |||
73 | /* Set the codec system clock for DAC and ADC */ | ||
74 | err = | ||
75 | snd_soc_dai_set_sysclk(codec_dai, 0, CODEC_CLOCK, SND_SOC_CLOCK_IN); | ||
76 | |||
77 | if (err < 0) { | ||
78 | printk(KERN_ERR "can't set codec system clock\n"); | ||
79 | return err; | ||
80 | } | ||
81 | |||
82 | return err; | ||
83 | } | ||
84 | |||
85 | static struct snd_soc_ops afeb9260_ops = { | ||
86 | .hw_params = afeb9260_hw_params, | ||
87 | }; | ||
88 | |||
89 | static const struct snd_soc_dapm_widget tlv320aic23_dapm_widgets[] = { | ||
90 | SND_SOC_DAPM_HP("Headphone Jack", NULL), | ||
91 | SND_SOC_DAPM_LINE("Line In", NULL), | ||
92 | SND_SOC_DAPM_MIC("Mic Jack", NULL), | ||
93 | }; | ||
94 | |||
95 | static const struct snd_soc_dapm_route audio_map[] = { | ||
96 | {"Headphone Jack", NULL, "LHPOUT"}, | ||
97 | {"Headphone Jack", NULL, "RHPOUT"}, | ||
98 | |||
99 | {"LLINEIN", NULL, "Line In"}, | ||
100 | {"RLINEIN", NULL, "Line In"}, | ||
101 | |||
102 | {"MICIN", NULL, "Mic Jack"}, | ||
103 | }; | ||
104 | |||
105 | static int afeb9260_tlv320aic23_init(struct snd_soc_codec *codec) | ||
106 | { | ||
107 | |||
108 | /* Add afeb9260 specific widgets */ | ||
109 | snd_soc_dapm_new_controls(codec, tlv320aic23_dapm_widgets, | ||
110 | ARRAY_SIZE(tlv320aic23_dapm_widgets)); | ||
111 | |||
112 | /* Set up afeb9260 specific audio path audio_map */ | ||
113 | snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); | ||
114 | |||
115 | snd_soc_dapm_enable_pin(codec, "Headphone Jack"); | ||
116 | snd_soc_dapm_enable_pin(codec, "Line In"); | ||
117 | snd_soc_dapm_enable_pin(codec, "Mic Jack"); | ||
118 | |||
119 | snd_soc_dapm_sync(codec); | ||
120 | |||
121 | return 0; | ||
122 | } | ||
123 | |||
124 | /* Digital audio interface glue - connects codec <--> CPU */ | ||
125 | static struct snd_soc_dai_link afeb9260_dai = { | ||
126 | .name = "TLV320AIC23", | ||
127 | .stream_name = "AIC23", | ||
128 | .cpu_dai = &atmel_ssc_dai[0], | ||
129 | .codec_dai = &tlv320aic23_dai, | ||
130 | .init = afeb9260_tlv320aic23_init, | ||
131 | .ops = &afeb9260_ops, | ||
132 | }; | ||
133 | |||
134 | /* Audio machine driver */ | ||
135 | static struct snd_soc_card snd_soc_machine_afeb9260 = { | ||
136 | .name = "AFEB9260", | ||
137 | .platform = &atmel_soc_platform, | ||
138 | .dai_link = &afeb9260_dai, | ||
139 | .num_links = 1, | ||
140 | }; | ||
141 | |||
142 | /* Audio subsystem */ | ||
143 | static struct snd_soc_device afeb9260_snd_devdata = { | ||
144 | .card = &snd_soc_machine_afeb9260, | ||
145 | .codec_dev = &soc_codec_dev_tlv320aic23, | ||
146 | }; | ||
147 | |||
148 | static struct platform_device *afeb9260_snd_device; | ||
149 | |||
150 | static int __init afeb9260_soc_init(void) | ||
151 | { | ||
152 | int err; | ||
153 | struct device *dev; | ||
154 | struct atmel_ssc_info *ssc_p = afeb9260_dai.cpu_dai->private_data; | ||
155 | struct ssc_device *ssc = NULL; | ||
156 | |||
157 | if (!(machine_is_afeb9260())) | ||
158 | return -ENODEV; | ||
159 | |||
160 | ssc = ssc_request(0); | ||
161 | if (IS_ERR(ssc)) { | ||
162 | printk(KERN_ERR "ASoC: Failed to request SSC 0\n"); | ||
163 | err = PTR_ERR(ssc); | ||
164 | ssc = NULL; | ||
165 | goto err_ssc; | ||
166 | } | ||
167 | ssc_p->ssc = ssc; | ||
168 | |||
169 | afeb9260_snd_device = platform_device_alloc("soc-audio", -1); | ||
170 | if (!afeb9260_snd_device) { | ||
171 | printk(KERN_ERR "ASoC: Platform device allocation failed\n"); | ||
172 | return -ENOMEM; | ||
173 | } | ||
174 | |||
175 | platform_set_drvdata(afeb9260_snd_device, &afeb9260_snd_devdata); | ||
176 | afeb9260_snd_devdata.dev = &afeb9260_snd_device->dev; | ||
177 | err = platform_device_add(afeb9260_snd_device); | ||
178 | if (err) | ||
179 | goto err1; | ||
180 | |||
181 | dev = &afeb9260_snd_device->dev; | ||
182 | |||
183 | return 0; | ||
184 | err1: | ||
185 | platform_device_del(afeb9260_snd_device); | ||
186 | platform_device_put(afeb9260_snd_device); | ||
187 | err_ssc: | ||
188 | return err; | ||
189 | |||
190 | } | ||
191 | |||
192 | static void __exit afeb9260_soc_exit(void) | ||
193 | { | ||
194 | platform_device_unregister(afeb9260_snd_device); | ||
195 | } | ||
196 | |||
197 | module_init(afeb9260_soc_init); | ||
198 | module_exit(afeb9260_soc_exit); | ||
199 | |||
200 | MODULE_AUTHOR("Sergey Lapin <slapin@ossfans.org>"); | ||
201 | MODULE_DESCRIPTION("ALSA SoC for AFEB9260"); | ||
202 | MODULE_LICENSE("GPL"); | ||
203 | |||
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c index fd392c65f475..eaf91ab465b4 100644 --- a/sound/soc/codecs/twl4030.c +++ b/sound/soc/codecs/twl4030.c | |||
@@ -422,36 +422,18 @@ static const struct snd_kcontrol_new twl4030_dapm_vibrapath_control = | |||
422 | SOC_DAPM_ENUM("Route", twl4030_vibrapath_enum); | 422 | SOC_DAPM_ENUM("Route", twl4030_vibrapath_enum); |
423 | 423 | ||
424 | /* Left analog microphone selection */ | 424 | /* Left analog microphone selection */ |
425 | static const char *twl4030_analoglmic_texts[] = | 425 | static const struct snd_kcontrol_new twl4030_dapm_analoglmic_controls[] = { |
426 | {"Off", "Main mic", "Headset mic", "AUXL", "Carkit mic"}; | 426 | SOC_DAPM_SINGLE("Main mic", TWL4030_REG_ANAMICL, 0, 1, 0), |
427 | 427 | SOC_DAPM_SINGLE("Headset mic", TWL4030_REG_ANAMICL, 1, 1, 0), | |
428 | static const unsigned int twl4030_analoglmic_values[] = | 428 | SOC_DAPM_SINGLE("AUXL", TWL4030_REG_ANAMICL, 2, 1, 0), |
429 | {0x0, 0x1, 0x2, 0x4, 0x8}; | 429 | SOC_DAPM_SINGLE("Carkit mic", TWL4030_REG_ANAMICL, 3, 1, 0), |
430 | 430 | }; | |
431 | static const struct soc_enum twl4030_analoglmic_enum = | ||
432 | SOC_VALUE_ENUM_SINGLE(TWL4030_REG_ANAMICL, 0, 0xf, | ||
433 | ARRAY_SIZE(twl4030_analoglmic_texts), | ||
434 | twl4030_analoglmic_texts, | ||
435 | twl4030_analoglmic_values); | ||
436 | |||
437 | static const struct snd_kcontrol_new twl4030_dapm_analoglmic_control = | ||
438 | SOC_DAPM_VALUE_ENUM("Route", twl4030_analoglmic_enum); | ||
439 | 431 | ||
440 | /* Right analog microphone selection */ | 432 | /* Right analog microphone selection */ |
441 | static const char *twl4030_analogrmic_texts[] = | 433 | static const struct snd_kcontrol_new twl4030_dapm_analogrmic_controls[] = { |
442 | {"Off", "Sub mic", "AUXR"}; | 434 | SOC_DAPM_SINGLE("Sub mic", TWL4030_REG_ANAMICR, 0, 1, 0), |
443 | 435 | SOC_DAPM_SINGLE("AUXR", TWL4030_REG_ANAMICR, 1, 1, 0), | |
444 | static const unsigned int twl4030_analogrmic_values[] = | 436 | }; |
445 | {0x0, 0x1, 0x4}; | ||
446 | |||
447 | static const struct soc_enum twl4030_analogrmic_enum = | ||
448 | SOC_VALUE_ENUM_SINGLE(TWL4030_REG_ANAMICR, 0, 0x5, | ||
449 | ARRAY_SIZE(twl4030_analogrmic_texts), | ||
450 | twl4030_analogrmic_texts, | ||
451 | twl4030_analogrmic_values); | ||
452 | |||
453 | static const struct snd_kcontrol_new twl4030_dapm_analogrmic_control = | ||
454 | SOC_DAPM_VALUE_ENUM("Route", twl4030_analogrmic_enum); | ||
455 | 437 | ||
456 | /* TX1 L/R Analog/Digital microphone selection */ | 438 | /* TX1 L/R Analog/Digital microphone selection */ |
457 | static const char *twl4030_micpathtx1_texts[] = | 439 | static const char *twl4030_micpathtx1_texts[] = |
@@ -1138,11 +1120,15 @@ static const struct snd_soc_dapm_widget twl4030_dapm_widgets[] = { | |||
1138 | SND_SOC_DAPM_POST_PMU|SND_SOC_DAPM_POST_PMD| | 1120 | SND_SOC_DAPM_POST_PMU|SND_SOC_DAPM_POST_PMD| |
1139 | SND_SOC_DAPM_POST_REG), | 1121 | SND_SOC_DAPM_POST_REG), |
1140 | 1122 | ||
1141 | /* Analog input muxes with switch for the capture amplifiers */ | 1123 | /* Analog input mixers for the capture amplifiers */ |
1142 | SND_SOC_DAPM_VALUE_MUX("Analog Left Capture Route", | 1124 | SND_SOC_DAPM_MIXER("Analog Left Capture Route", |
1143 | TWL4030_REG_ANAMICL, 4, 0, &twl4030_dapm_analoglmic_control), | 1125 | TWL4030_REG_ANAMICL, 4, 0, |
1144 | SND_SOC_DAPM_VALUE_MUX("Analog Right Capture Route", | 1126 | &twl4030_dapm_analoglmic_controls[0], |
1145 | TWL4030_REG_ANAMICR, 4, 0, &twl4030_dapm_analogrmic_control), | 1127 | ARRAY_SIZE(twl4030_dapm_analoglmic_controls)), |
1128 | SND_SOC_DAPM_MIXER("Analog Right Capture Route", | ||
1129 | TWL4030_REG_ANAMICR, 4, 0, | ||
1130 | &twl4030_dapm_analogrmic_controls[0], | ||
1131 | ARRAY_SIZE(twl4030_dapm_analogrmic_controls)), | ||
1146 | 1132 | ||
1147 | SND_SOC_DAPM_PGA("ADC Physical Left", | 1133 | SND_SOC_DAPM_PGA("ADC Physical Left", |
1148 | TWL4030_REG_AVADC_CTL, 3, 0, NULL, 0), | 1134 | TWL4030_REG_AVADC_CTL, 3, 0, NULL, 0), |
diff --git a/sound/soc/pxa/Kconfig b/sound/soc/pxa/Kconfig index eb75a1c061aa..dcd163a4ee9a 100644 --- a/sound/soc/pxa/Kconfig +++ b/sound/soc/pxa/Kconfig | |||
@@ -89,13 +89,13 @@ config SND_PXA2XX_SOC_E800 | |||
89 | Toshiba e800 PDA | 89 | Toshiba e800 PDA |
90 | 90 | ||
91 | config SND_PXA2XX_SOC_EM_X270 | 91 | config SND_PXA2XX_SOC_EM_X270 |
92 | tristate "SoC Audio support for CompuLab EM-x270" | 92 | tristate "SoC Audio support for CompuLab EM-x270, eXeda and CM-X300" |
93 | depends on SND_PXA2XX_SOC && MACH_EM_X270 | 93 | depends on SND_PXA2XX_SOC && MACH_EM_X270 |
94 | select SND_PXA2XX_SOC_AC97 | 94 | select SND_PXA2XX_SOC_AC97 |
95 | select SND_SOC_WM9712 | 95 | select SND_SOC_WM9712 |
96 | help | 96 | help |
97 | Say Y if you want to add support for SoC audio on | 97 | Say Y if you want to add support for SoC audio on |
98 | CompuLab EM-x270. | 98 | CompuLab EM-x270, eXeda and CM-X300 machines. |
99 | 99 | ||
100 | config SND_PXA2XX_SOC_PALM27X | 100 | config SND_PXA2XX_SOC_PALM27X |
101 | bool "SoC Audio support for Palm T|X, T5 and LifeDrive" | 101 | bool "SoC Audio support for Palm T|X, T5 and LifeDrive" |
diff --git a/sound/soc/pxa/em-x270.c b/sound/soc/pxa/em-x270.c index 949be9c2a01b..f4756e4025fd 100644 --- a/sound/soc/pxa/em-x270.c +++ b/sound/soc/pxa/em-x270.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * em-x270.c -- SoC audio for EM-X270 | 2 | * SoC audio driver for EM-X270, eXeda and CM-X300 |
3 | * | 3 | * |
4 | * Copyright 2007 CompuLab, Ltd. | 4 | * Copyright 2007, 2009 CompuLab, Ltd. |
5 | * | 5 | * |
6 | * Author: Mike Rapoport <mike@compulab.co.il> | 6 | * Author: Mike Rapoport <mike@compulab.co.il> |
7 | * | 7 | * |
@@ -68,7 +68,8 @@ static int __init em_x270_init(void) | |||
68 | { | 68 | { |
69 | int ret; | 69 | int ret; |
70 | 70 | ||
71 | if (!machine_is_em_x270()) | 71 | if (!(machine_is_em_x270() || machine_is_exeda() |
72 | || machine_is_cm_x300())) | ||
72 | return -ENODEV; | 73 | return -ENODEV; |
73 | 74 | ||
74 | em_x270_snd_device = platform_device_alloc("soc-audio", -1); | 75 | em_x270_snd_device = platform_device_alloc("soc-audio", -1); |
@@ -95,5 +96,5 @@ module_exit(em_x270_exit); | |||
95 | 96 | ||
96 | /* Module information */ | 97 | /* Module information */ |
97 | MODULE_AUTHOR("Mike Rapoport"); | 98 | MODULE_AUTHOR("Mike Rapoport"); |
98 | MODULE_DESCRIPTION("ALSA SoC EM-X270"); | 99 | MODULE_DESCRIPTION("ALSA SoC EM-X270, eXeda and CM-X300"); |
99 | MODULE_LICENSE("GPL"); | 100 | MODULE_LICENSE("GPL"); |
diff --git a/sound/soc/pxa/pxa2xx-i2s.c b/sound/soc/pxa/pxa2xx-i2s.c index 2f4b6e489b78..60145770aeba 100644 --- a/sound/soc/pxa/pxa2xx-i2s.c +++ b/sound/soc/pxa/pxa2xx-i2s.c | |||
@@ -329,6 +329,7 @@ struct snd_soc_dai pxa_i2s_dai = { | |||
329 | .rates = PXA2XX_I2S_RATES, | 329 | .rates = PXA2XX_I2S_RATES, |
330 | .formats = SNDRV_PCM_FMTBIT_S16_LE,}, | 330 | .formats = SNDRV_PCM_FMTBIT_S16_LE,}, |
331 | .ops = &pxa_i2s_dai_ops, | 331 | .ops = &pxa_i2s_dai_ops, |
332 | .symmetric_rates = 1, | ||
332 | }; | 333 | }; |
333 | 334 | ||
334 | EXPORT_SYMBOL_GPL(pxa_i2s_dai); | 335 | EXPORT_SYMBOL_GPL(pxa_i2s_dai); |
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index af11791a3b8c..c0e706645ec4 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -992,6 +992,9 @@ static int soc_remove(struct platform_device *pdev) | |||
992 | struct snd_soc_platform *platform = card->platform; | 992 | struct snd_soc_platform *platform = card->platform; |
993 | struct snd_soc_codec_device *codec_dev = socdev->codec_dev; | 993 | struct snd_soc_codec_device *codec_dev = socdev->codec_dev; |
994 | 994 | ||
995 | if (!card->instantiated) | ||
996 | return 0; | ||
997 | |||
995 | run_delayed_work(&card->delayed_work); | 998 | run_delayed_work(&card->delayed_work); |
996 | 999 | ||
997 | if (platform->remove) | 1000 | if (platform->remove) |
@@ -2387,6 +2390,39 @@ void snd_soc_unregister_platform(struct snd_soc_platform *platform) | |||
2387 | } | 2390 | } |
2388 | EXPORT_SYMBOL_GPL(snd_soc_unregister_platform); | 2391 | EXPORT_SYMBOL_GPL(snd_soc_unregister_platform); |
2389 | 2392 | ||
2393 | static u64 codec_format_map[] = { | ||
2394 | SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S16_BE, | ||
2395 | SNDRV_PCM_FMTBIT_U16_LE | SNDRV_PCM_FMTBIT_U16_BE, | ||
2396 | SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S24_BE, | ||
2397 | SNDRV_PCM_FMTBIT_U24_LE | SNDRV_PCM_FMTBIT_U24_BE, | ||
2398 | SNDRV_PCM_FMTBIT_S32_LE | SNDRV_PCM_FMTBIT_S32_BE, | ||
2399 | SNDRV_PCM_FMTBIT_U32_LE | SNDRV_PCM_FMTBIT_U32_BE, | ||
2400 | SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_U24_3BE, | ||
2401 | SNDRV_PCM_FMTBIT_U24_3LE | SNDRV_PCM_FMTBIT_U24_3BE, | ||
2402 | SNDRV_PCM_FMTBIT_S20_3LE | SNDRV_PCM_FMTBIT_S20_3BE, | ||
2403 | SNDRV_PCM_FMTBIT_U20_3LE | SNDRV_PCM_FMTBIT_U20_3BE, | ||
2404 | SNDRV_PCM_FMTBIT_S18_3LE | SNDRV_PCM_FMTBIT_S18_3BE, | ||
2405 | SNDRV_PCM_FMTBIT_U18_3LE | SNDRV_PCM_FMTBIT_U18_3BE, | ||
2406 | SNDRV_PCM_FMTBIT_FLOAT_LE | SNDRV_PCM_FMTBIT_FLOAT_BE, | ||
2407 | SNDRV_PCM_FMTBIT_FLOAT64_LE | SNDRV_PCM_FMTBIT_FLOAT64_BE, | ||
2408 | SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE | ||
2409 | | SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_BE, | ||
2410 | }; | ||
2411 | |||
2412 | /* Fix up the DAI formats for endianness: codecs don't actually see | ||
2413 | * the endianness of the data but we're using the CPU format | ||
2414 | * definitions which do need to include endianness so we ensure that | ||
2415 | * codec DAIs always have both big and little endian variants set. | ||
2416 | */ | ||
2417 | static void fixup_codec_formats(struct snd_soc_pcm_stream *stream) | ||
2418 | { | ||
2419 | int i; | ||
2420 | |||
2421 | for (i = 0; i < ARRAY_SIZE(codec_format_map); i++) | ||
2422 | if (stream->formats & codec_format_map[i]) | ||
2423 | stream->formats |= codec_format_map[i]; | ||
2424 | } | ||
2425 | |||
2390 | /** | 2426 | /** |
2391 | * snd_soc_register_codec - Register a codec with the ASoC core | 2427 | * snd_soc_register_codec - Register a codec with the ASoC core |
2392 | * | 2428 | * |
@@ -2394,6 +2430,8 @@ EXPORT_SYMBOL_GPL(snd_soc_unregister_platform); | |||
2394 | */ | 2430 | */ |
2395 | int snd_soc_register_codec(struct snd_soc_codec *codec) | 2431 | int snd_soc_register_codec(struct snd_soc_codec *codec) |
2396 | { | 2432 | { |
2433 | int i; | ||
2434 | |||
2397 | if (!codec->name) | 2435 | if (!codec->name) |
2398 | return -EINVAL; | 2436 | return -EINVAL; |
2399 | 2437 | ||
@@ -2403,6 +2441,11 @@ int snd_soc_register_codec(struct snd_soc_codec *codec) | |||
2403 | 2441 | ||
2404 | INIT_LIST_HEAD(&codec->list); | 2442 | INIT_LIST_HEAD(&codec->list); |
2405 | 2443 | ||
2444 | for (i = 0; i < codec->num_dai; i++) { | ||
2445 | fixup_codec_formats(&codec->dai[i].playback); | ||
2446 | fixup_codec_formats(&codec->dai[i].capture); | ||
2447 | } | ||
2448 | |||
2406 | mutex_lock(&client_mutex); | 2449 | mutex_lock(&client_mutex); |
2407 | list_add(&codec->list, &codec_list); | 2450 | list_add(&codec->list, &codec_list); |
2408 | snd_soc_instantiate_cards(); | 2451 | snd_soc_instantiate_cards(); |