diff options
Diffstat (limited to 'sound/soc')
29 files changed, 2345 insertions, 209 deletions
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index b92759a39361..80799639814e 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig | |||
@@ -146,6 +146,13 @@ config SND_SOC_WM_HUBS | |||
146 | default y if SND_SOC_WM8993=y || SND_SOC_WM8994=y | 146 | default y if SND_SOC_WM8993=y || SND_SOC_WM8994=y |
147 | default m if SND_SOC_WM8993=m || SND_SOC_WM8994=m | 147 | default m if SND_SOC_WM8993=m || SND_SOC_WM8994=m |
148 | 148 | ||
149 | config SND_SOC_WM_ADSP | ||
150 | tristate | ||
151 | default y if SND_SOC_WM5102=y | ||
152 | default y if SND_SOC_WM2200=y | ||
153 | default m if SND_SOC_WM5102=m | ||
154 | default m if SND_SOC_WM2200=m | ||
155 | |||
149 | config SND_SOC_AB8500_CODEC | 156 | config SND_SOC_AB8500_CODEC |
150 | tristate | 157 | tristate |
151 | 158 | ||
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile index 9bd4d95aab4f..61633d5ff3da 100644 --- a/sound/soc/codecs/Makefile +++ b/sound/soc/codecs/Makefile | |||
@@ -62,6 +62,7 @@ snd-soc-twl6040-objs := twl6040.o | |||
62 | snd-soc-uda134x-objs := uda134x.o | 62 | snd-soc-uda134x-objs := uda134x.o |
63 | snd-soc-uda1380-objs := uda1380.o | 63 | snd-soc-uda1380-objs := uda1380.o |
64 | snd-soc-wl1273-objs := wl1273.o | 64 | snd-soc-wl1273-objs := wl1273.o |
65 | snd-soc-wm-adsp-objs := wm_adsp.o | ||
65 | snd-soc-wm0010-objs := wm0010.o | 66 | snd-soc-wm0010-objs := wm0010.o |
66 | snd-soc-wm1250-ev1-objs := wm1250-ev1.o | 67 | snd-soc-wm1250-ev1-objs := wm1250-ev1.o |
67 | snd-soc-wm2000-objs := wm2000.o | 68 | snd-soc-wm2000-objs := wm2000.o |
@@ -229,6 +230,7 @@ obj-$(CONFIG_SND_SOC_WM9090) += snd-soc-wm9090.o | |||
229 | obj-$(CONFIG_SND_SOC_WM9705) += snd-soc-wm9705.o | 230 | obj-$(CONFIG_SND_SOC_WM9705) += snd-soc-wm9705.o |
230 | obj-$(CONFIG_SND_SOC_WM9712) += snd-soc-wm9712.o | 231 | obj-$(CONFIG_SND_SOC_WM9712) += snd-soc-wm9712.o |
231 | obj-$(CONFIG_SND_SOC_WM9713) += snd-soc-wm9713.o | 232 | obj-$(CONFIG_SND_SOC_WM9713) += snd-soc-wm9713.o |
233 | obj-$(CONFIG_SND_SOC_WM_ADSP) += snd-soc-wm-adsp.o | ||
232 | obj-$(CONFIG_SND_SOC_WM_HUBS) += snd-soc-wm-hubs.o | 234 | obj-$(CONFIG_SND_SOC_WM_HUBS) += snd-soc-wm-hubs.o |
233 | 235 | ||
234 | # Amp | 236 | # Amp |
diff --git a/sound/soc/codecs/ab8500-codec.c b/sound/soc/codecs/ab8500-codec.c index af547490b4f7..4d96090db662 100644 --- a/sound/soc/codecs/ab8500-codec.c +++ b/sound/soc/codecs/ab8500-codec.c | |||
@@ -2356,7 +2356,7 @@ static int ab8500_codec_set_dai_tdm_slot(struct snd_soc_dai *dai, | |||
2356 | return 0; | 2356 | return 0; |
2357 | } | 2357 | } |
2358 | 2358 | ||
2359 | struct snd_soc_dai_driver ab8500_codec_dai[] = { | 2359 | static struct snd_soc_dai_driver ab8500_codec_dai[] = { |
2360 | { | 2360 | { |
2361 | .name = "ab8500-codec-dai.0", | 2361 | .name = "ab8500-codec-dai.0", |
2362 | .id = 0, | 2362 | .id = 0, |
diff --git a/sound/soc/codecs/ak4104.c b/sound/soc/codecs/ak4104.c index 31d4483245d0..4b11b82b2273 100644 --- a/sound/soc/codecs/ak4104.c +++ b/sound/soc/codecs/ak4104.c | |||
@@ -15,6 +15,8 @@ | |||
15 | #include <sound/soc.h> | 15 | #include <sound/soc.h> |
16 | #include <sound/initval.h> | 16 | #include <sound/initval.h> |
17 | #include <linux/spi/spi.h> | 17 | #include <linux/spi/spi.h> |
18 | #include <linux/of_device.h> | ||
19 | #include <linux/of_gpio.h> | ||
18 | #include <sound/asoundef.h> | 20 | #include <sound/asoundef.h> |
19 | 21 | ||
20 | /* AK4104 registers addresses */ | 22 | /* AK4104 registers addresses */ |
@@ -98,14 +100,32 @@ static int ak4104_hw_params(struct snd_pcm_substream *substream, | |||
98 | val = 0; | 100 | val = 0; |
99 | 101 | ||
100 | switch (params_rate(params)) { | 102 | switch (params_rate(params)) { |
103 | case 22050: | ||
104 | val |= IEC958_AES3_CON_FS_22050; | ||
105 | break; | ||
106 | case 24000: | ||
107 | val |= IEC958_AES3_CON_FS_24000; | ||
108 | break; | ||
109 | case 32000: | ||
110 | val |= IEC958_AES3_CON_FS_32000; | ||
111 | break; | ||
101 | case 44100: | 112 | case 44100: |
102 | val |= IEC958_AES3_CON_FS_44100; | 113 | val |= IEC958_AES3_CON_FS_44100; |
103 | break; | 114 | break; |
104 | case 48000: | 115 | case 48000: |
105 | val |= IEC958_AES3_CON_FS_48000; | 116 | val |= IEC958_AES3_CON_FS_48000; |
106 | break; | 117 | break; |
107 | case 32000: | 118 | case 88200: |
108 | val |= IEC958_AES3_CON_FS_32000; | 119 | val |= IEC958_AES3_CON_FS_88200; |
120 | break; | ||
121 | case 96000: | ||
122 | val |= IEC958_AES3_CON_FS_96000; | ||
123 | break; | ||
124 | case 176400: | ||
125 | val |= IEC958_AES3_CON_FS_176400; | ||
126 | break; | ||
127 | case 192000: | ||
128 | val |= IEC958_AES3_CON_FS_192000; | ||
109 | break; | 129 | break; |
110 | default: | 130 | default: |
111 | dev_err(codec->dev, "unsupported sampling rate\n"); | 131 | dev_err(codec->dev, "unsupported sampling rate\n"); |
@@ -186,6 +206,7 @@ static const struct regmap_config ak4104_regmap = { | |||
186 | 206 | ||
187 | static int ak4104_spi_probe(struct spi_device *spi) | 207 | static int ak4104_spi_probe(struct spi_device *spi) |
188 | { | 208 | { |
209 | struct device_node *np = spi->dev.of_node; | ||
189 | struct ak4104_private *ak4104; | 210 | struct ak4104_private *ak4104; |
190 | unsigned int val; | 211 | unsigned int val; |
191 | int ret; | 212 | int ret; |
@@ -201,49 +222,59 @@ static int ak4104_spi_probe(struct spi_device *spi) | |||
201 | if (ak4104 == NULL) | 222 | if (ak4104 == NULL) |
202 | return -ENOMEM; | 223 | return -ENOMEM; |
203 | 224 | ||
204 | ak4104->regmap = regmap_init_spi(spi, &ak4104_regmap); | 225 | ak4104->regmap = devm_regmap_init_spi(spi, &ak4104_regmap); |
205 | if (IS_ERR(ak4104->regmap)) { | 226 | if (IS_ERR(ak4104->regmap)) { |
206 | ret = PTR_ERR(ak4104->regmap); | 227 | ret = PTR_ERR(ak4104->regmap); |
207 | return ret; | 228 | return ret; |
208 | } | 229 | } |
209 | 230 | ||
231 | if (np) { | ||
232 | enum of_gpio_flags flags; | ||
233 | int gpio = of_get_named_gpio_flags(np, "reset-gpio", 0, &flags); | ||
234 | |||
235 | if (gpio_is_valid(gpio)) { | ||
236 | ret = devm_gpio_request_one(&spi->dev, gpio, | ||
237 | flags & OF_GPIO_ACTIVE_LOW ? | ||
238 | GPIOF_OUT_INIT_LOW : GPIOF_OUT_INIT_HIGH, | ||
239 | "ak4104 reset"); | ||
240 | if (ret < 0) | ||
241 | return ret; | ||
242 | } | ||
243 | } | ||
244 | |||
210 | /* read the 'reserved' register - according to the datasheet, it | 245 | /* read the 'reserved' register - according to the datasheet, it |
211 | * should contain 0x5b. Not a good way to verify the presence of | 246 | * should contain 0x5b. Not a good way to verify the presence of |
212 | * the device, but there is no hardware ID register. */ | 247 | * the device, but there is no hardware ID register. */ |
213 | ret = regmap_read(ak4104->regmap, AK4104_REG_RESERVED, &val); | 248 | ret = regmap_read(ak4104->regmap, AK4104_REG_RESERVED, &val); |
214 | if (ret != 0) | 249 | if (ret != 0) |
215 | goto err; | 250 | return ret; |
216 | if (val != AK4104_RESERVED_VAL) { | 251 | if (val != AK4104_RESERVED_VAL) |
217 | ret = -ENODEV; | 252 | return -ENODEV; |
218 | goto err; | ||
219 | } | ||
220 | 253 | ||
221 | spi_set_drvdata(spi, ak4104); | 254 | spi_set_drvdata(spi, ak4104); |
222 | 255 | ||
223 | ret = snd_soc_register_codec(&spi->dev, | 256 | ret = snd_soc_register_codec(&spi->dev, |
224 | &soc_codec_device_ak4104, &ak4104_dai, 1); | 257 | &soc_codec_device_ak4104, &ak4104_dai, 1); |
225 | if (ret != 0) | ||
226 | goto err; | ||
227 | |||
228 | return 0; | ||
229 | |||
230 | err: | ||
231 | regmap_exit(ak4104->regmap); | ||
232 | return ret; | 258 | return ret; |
233 | } | 259 | } |
234 | 260 | ||
235 | static int __devexit ak4104_spi_remove(struct spi_device *spi) | 261 | static int __devexit ak4104_spi_remove(struct spi_device *spi) |
236 | { | 262 | { |
237 | struct ak4104_private *ak4101 = spi_get_drvdata(spi); | ||
238 | regmap_exit(ak4101->regmap); | ||
239 | snd_soc_unregister_codec(&spi->dev); | 263 | snd_soc_unregister_codec(&spi->dev); |
240 | return 0; | 264 | return 0; |
241 | } | 265 | } |
242 | 266 | ||
267 | static const struct of_device_id ak4104_of_match[] = { | ||
268 | { .compatible = "asahi-kasei,ak4104", }, | ||
269 | { } | ||
270 | }; | ||
271 | MODULE_DEVICE_TABLE(of, ak4104_of_match); | ||
272 | |||
243 | static struct spi_driver ak4104_spi_driver = { | 273 | static struct spi_driver ak4104_spi_driver = { |
244 | .driver = { | 274 | .driver = { |
245 | .name = DRV_NAME, | 275 | .name = DRV_NAME, |
246 | .owner = THIS_MODULE, | 276 | .owner = THIS_MODULE, |
277 | .of_match_table = ak4104_of_match, | ||
247 | }, | 278 | }, |
248 | .probe = ak4104_spi_probe, | 279 | .probe = ak4104_spi_probe, |
249 | .remove = __devexit_p(ak4104_spi_remove), | 280 | .remove = __devexit_p(ak4104_spi_remove), |
diff --git a/sound/soc/codecs/ak4535.c b/sound/soc/codecs/ak4535.c index 618fdc30f73e..fc5581063b2d 100644 --- a/sound/soc/codecs/ak4535.c +++ b/sound/soc/codecs/ak4535.c | |||
@@ -447,7 +447,7 @@ static __devinit int ak4535_i2c_probe(struct i2c_client *i2c, | |||
447 | if (ak4535 == NULL) | 447 | if (ak4535 == NULL) |
448 | return -ENOMEM; | 448 | return -ENOMEM; |
449 | 449 | ||
450 | ak4535->regmap = regmap_init_i2c(i2c, &ak4535_regmap); | 450 | ak4535->regmap = devm_regmap_init_i2c(i2c, &ak4535_regmap); |
451 | if (IS_ERR(ak4535->regmap)) { | 451 | if (IS_ERR(ak4535->regmap)) { |
452 | ret = PTR_ERR(ak4535->regmap); | 452 | ret = PTR_ERR(ak4535->regmap); |
453 | dev_err(&i2c->dev, "Failed to init regmap: %d\n", ret); | 453 | dev_err(&i2c->dev, "Failed to init regmap: %d\n", ret); |
@@ -458,18 +458,13 @@ static __devinit int ak4535_i2c_probe(struct i2c_client *i2c, | |||
458 | 458 | ||
459 | ret = snd_soc_register_codec(&i2c->dev, | 459 | ret = snd_soc_register_codec(&i2c->dev, |
460 | &soc_codec_dev_ak4535, &ak4535_dai, 1); | 460 | &soc_codec_dev_ak4535, &ak4535_dai, 1); |
461 | if (ret != 0) | ||
462 | regmap_exit(ak4535->regmap); | ||
463 | 461 | ||
464 | return ret; | 462 | return ret; |
465 | } | 463 | } |
466 | 464 | ||
467 | static __devexit int ak4535_i2c_remove(struct i2c_client *client) | 465 | static __devexit int ak4535_i2c_remove(struct i2c_client *client) |
468 | { | 466 | { |
469 | struct ak4535_priv *ak4535 = i2c_get_clientdata(client); | ||
470 | |||
471 | snd_soc_unregister_codec(&client->dev); | 467 | snd_soc_unregister_codec(&client->dev); |
472 | regmap_exit(ak4535->regmap); | ||
473 | return 0; | 468 | return 0; |
474 | } | 469 | } |
475 | 470 | ||
diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c index b3e24f289421..546466abb77f 100644 --- a/sound/soc/codecs/ak4642.c +++ b/sound/soc/codecs/ak4642.c | |||
@@ -194,12 +194,6 @@ static const struct snd_soc_dapm_route ak4642_intercon[] = { | |||
194 | {"LINEOUT Mixer", "DACL", "DAC"}, | 194 | {"LINEOUT Mixer", "DACL", "DAC"}, |
195 | }; | 195 | }; |
196 | 196 | ||
197 | /* codec private data */ | ||
198 | struct ak4642_priv { | ||
199 | unsigned int sysclk; | ||
200 | enum snd_soc_control_type control_type; | ||
201 | }; | ||
202 | |||
203 | /* | 197 | /* |
204 | * ak4642 register cache | 198 | * ak4642 register cache |
205 | */ | 199 | */ |
@@ -468,10 +462,9 @@ static int ak4642_resume(struct snd_soc_codec *codec) | |||
468 | 462 | ||
469 | static int ak4642_probe(struct snd_soc_codec *codec) | 463 | static int ak4642_probe(struct snd_soc_codec *codec) |
470 | { | 464 | { |
471 | struct ak4642_priv *ak4642 = snd_soc_codec_get_drvdata(codec); | ||
472 | int ret; | 465 | int ret; |
473 | 466 | ||
474 | ret = snd_soc_codec_set_cache_io(codec, 8, 8, ak4642->control_type); | 467 | ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_I2C); |
475 | if (ret < 0) { | 468 | if (ret < 0) { |
476 | dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret); | 469 | dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret); |
477 | return ret; | 470 | return ret; |
@@ -523,21 +516,9 @@ static struct snd_soc_codec_driver soc_codec_dev_ak4648 = { | |||
523 | static __devinit int ak4642_i2c_probe(struct i2c_client *i2c, | 516 | static __devinit int ak4642_i2c_probe(struct i2c_client *i2c, |
524 | const struct i2c_device_id *id) | 517 | const struct i2c_device_id *id) |
525 | { | 518 | { |
526 | struct ak4642_priv *ak4642; | 519 | return snd_soc_register_codec(&i2c->dev, |
527 | int ret; | ||
528 | |||
529 | ak4642 = devm_kzalloc(&i2c->dev, sizeof(struct ak4642_priv), | ||
530 | GFP_KERNEL); | ||
531 | if (!ak4642) | ||
532 | return -ENOMEM; | ||
533 | |||
534 | i2c_set_clientdata(i2c, ak4642); | ||
535 | ak4642->control_type = SND_SOC_I2C; | ||
536 | |||
537 | ret = snd_soc_register_codec(&i2c->dev, | ||
538 | (struct snd_soc_codec_driver *)id->driver_data, | 520 | (struct snd_soc_codec_driver *)id->driver_data, |
539 | &ak4642_dai, 1); | 521 | &ak4642_dai, 1); |
540 | return ret; | ||
541 | } | 522 | } |
542 | 523 | ||
543 | static __devexit int ak4642_i2c_remove(struct i2c_client *client) | 524 | static __devexit int ak4642_i2c_remove(struct i2c_client *client) |
diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c index c03b65af3059..87cfaa3a6f0e 100644 --- a/sound/soc/codecs/arizona.c +++ b/sound/soc/codecs/arizona.c | |||
@@ -268,7 +268,7 @@ EXPORT_SYMBOL_GPL(arizona_out_ev); | |||
268 | static unsigned int arizona_sysclk_48k_rates[] = { | 268 | static unsigned int arizona_sysclk_48k_rates[] = { |
269 | 6144000, | 269 | 6144000, |
270 | 12288000, | 270 | 12288000, |
271 | 22579200, | 271 | 24576000, |
272 | 49152000, | 272 | 49152000, |
273 | 73728000, | 273 | 73728000, |
274 | 98304000, | 274 | 98304000, |
@@ -278,7 +278,7 @@ static unsigned int arizona_sysclk_48k_rates[] = { | |||
278 | static unsigned int arizona_sysclk_44k1_rates[] = { | 278 | static unsigned int arizona_sysclk_44k1_rates[] = { |
279 | 5644800, | 279 | 5644800, |
280 | 11289600, | 280 | 11289600, |
281 | 24576000, | 281 | 22579200, |
282 | 45158400, | 282 | 45158400, |
283 | 67737600, | 283 | 67737600, |
284 | 90316800, | 284 | 90316800, |
@@ -380,6 +380,18 @@ int arizona_set_sysclk(struct snd_soc_codec *codec, int clk_id, | |||
380 | case 49152000: | 380 | case 49152000: |
381 | val |= 3 << ARIZONA_SYSCLK_FREQ_SHIFT; | 381 | val |= 3 << ARIZONA_SYSCLK_FREQ_SHIFT; |
382 | break; | 382 | break; |
383 | case 67737600: | ||
384 | case 73728000: | ||
385 | val |= 4 << ARIZONA_SYSCLK_FREQ_SHIFT; | ||
386 | break; | ||
387 | case 90316800: | ||
388 | case 98304000: | ||
389 | val |= 5 << ARIZONA_SYSCLK_FREQ_SHIFT; | ||
390 | break; | ||
391 | case 135475200: | ||
392 | case 147456000: | ||
393 | val |= 6 << ARIZONA_SYSCLK_FREQ_SHIFT; | ||
394 | break; | ||
383 | default: | 395 | default: |
384 | return -EINVAL; | 396 | return -EINVAL; |
385 | } | 397 | } |
@@ -925,6 +937,9 @@ int arizona_set_fll(struct arizona_fll *fll, int source, | |||
925 | bool ena; | 937 | bool ena; |
926 | int ret; | 938 | int ret; |
927 | 939 | ||
940 | if (fll->fref == Fref && fll->fout == Fout) | ||
941 | return 0; | ||
942 | |||
928 | ret = regmap_read(arizona->regmap, fll->base + 1, ®); | 943 | ret = regmap_read(arizona->regmap, fll->base + 1, ®); |
929 | if (ret != 0) { | 944 | if (ret != 0) { |
930 | arizona_fll_err(fll, "Failed to read current state: %d\n", | 945 | arizona_fll_err(fll, "Failed to read current state: %d\n", |
@@ -970,6 +985,9 @@ int arizona_set_fll(struct arizona_fll *fll, int source, | |||
970 | if (ena) | 985 | if (ena) |
971 | pm_runtime_put_autosuspend(arizona->dev); | 986 | pm_runtime_put_autosuspend(arizona->dev); |
972 | 987 | ||
988 | fll->fref = Fref; | ||
989 | fll->fout = Fout; | ||
990 | |||
973 | return 0; | 991 | return 0; |
974 | } | 992 | } |
975 | 993 | ||
@@ -1002,6 +1020,9 @@ int arizona_set_fll(struct arizona_fll *fll, int source, | |||
1002 | if (ret == 0) | 1020 | if (ret == 0) |
1003 | arizona_fll_warn(fll, "Timed out waiting for lock\n"); | 1021 | arizona_fll_warn(fll, "Timed out waiting for lock\n"); |
1004 | 1022 | ||
1023 | fll->fref = Fref; | ||
1024 | fll->fout = Fout; | ||
1025 | |||
1005 | return 0; | 1026 | return 0; |
1006 | } | 1027 | } |
1007 | EXPORT_SYMBOL_GPL(arizona_set_fll); | 1028 | EXPORT_SYMBOL_GPL(arizona_set_fll); |
diff --git a/sound/soc/codecs/arizona.h b/sound/soc/codecs/arizona.h index 36ec64946120..84c415d335bd 100644 --- a/sound/soc/codecs/arizona.h +++ b/sound/soc/codecs/arizona.h | |||
@@ -17,6 +17,8 @@ | |||
17 | 17 | ||
18 | #include <sound/soc.h> | 18 | #include <sound/soc.h> |
19 | 19 | ||
20 | #include "wm_adsp.h" | ||
21 | |||
20 | #define ARIZONA_CLK_SYSCLK 1 | 22 | #define ARIZONA_CLK_SYSCLK 1 |
21 | #define ARIZONA_CLK_ASYNCCLK 2 | 23 | #define ARIZONA_CLK_ASYNCCLK 2 |
22 | #define ARIZONA_CLK_OPCLK 3 | 24 | #define ARIZONA_CLK_OPCLK 3 |
@@ -46,15 +48,18 @@ | |||
46 | #define ARIZONA_MIXER_VOL_SHIFT 1 | 48 | #define ARIZONA_MIXER_VOL_SHIFT 1 |
47 | #define ARIZONA_MIXER_VOL_WIDTH 7 | 49 | #define ARIZONA_MIXER_VOL_WIDTH 7 |
48 | 50 | ||
49 | #define ARIZONA_MAX_DAI 3 | 51 | #define ARIZONA_MAX_DAI 4 |
52 | #define ARIZONA_MAX_ADSP 4 | ||
50 | 53 | ||
51 | struct arizona; | 54 | struct arizona; |
55 | struct wm_adsp; | ||
52 | 56 | ||
53 | struct arizona_dai_priv { | 57 | struct arizona_dai_priv { |
54 | int clk; | 58 | int clk; |
55 | }; | 59 | }; |
56 | 60 | ||
57 | struct arizona_priv { | 61 | struct arizona_priv { |
62 | struct wm_adsp adsp[ARIZONA_MAX_ADSP]; | ||
58 | struct arizona *arizona; | 63 | struct arizona *arizona; |
59 | int sysclk; | 64 | int sysclk; |
60 | int asyncclk; | 65 | int asyncclk; |
@@ -89,19 +94,30 @@ extern int arizona_mixer_values[ARIZONA_NUM_MIXER_INPUTS]; | |||
89 | const struct snd_kcontrol_new name##_mux = \ | 94 | const struct snd_kcontrol_new name##_mux = \ |
90 | SOC_DAPM_VALUE_ENUM("Route", name##_enum) | 95 | SOC_DAPM_VALUE_ENUM("Route", name##_enum) |
91 | 96 | ||
97 | #define ARIZONA_MUX_ENUMS(name, base_reg) \ | ||
98 | static ARIZONA_MUX_ENUM_DECL(name##_enum, base_reg); \ | ||
99 | static ARIZONA_MUX_CTL_DECL(name) | ||
100 | |||
92 | #define ARIZONA_MIXER_ENUMS(name, base_reg) \ | 101 | #define ARIZONA_MIXER_ENUMS(name, base_reg) \ |
93 | static ARIZONA_MUX_ENUM_DECL(name##_in1_enum, base_reg); \ | 102 | ARIZONA_MUX_ENUMS(name##_in1, base_reg); \ |
94 | static ARIZONA_MUX_ENUM_DECL(name##_in2_enum, base_reg + 2); \ | 103 | ARIZONA_MUX_ENUMS(name##_in2, base_reg + 2); \ |
95 | static ARIZONA_MUX_ENUM_DECL(name##_in3_enum, base_reg + 4); \ | 104 | ARIZONA_MUX_ENUMS(name##_in3, base_reg + 4); \ |
96 | static ARIZONA_MUX_ENUM_DECL(name##_in4_enum, base_reg + 6); \ | 105 | ARIZONA_MUX_ENUMS(name##_in4, base_reg + 6) |
97 | static ARIZONA_MUX_CTL_DECL(name##_in1); \ | 106 | |
98 | static ARIZONA_MUX_CTL_DECL(name##_in2); \ | 107 | #define ARIZONA_DSP_AUX_ENUMS(name, base_reg) \ |
99 | static ARIZONA_MUX_CTL_DECL(name##_in3); \ | 108 | ARIZONA_MUX_ENUMS(name##_aux1, base_reg); \ |
100 | static ARIZONA_MUX_CTL_DECL(name##_in4) | 109 | ARIZONA_MUX_ENUMS(name##_aux2, base_reg + 8); \ |
110 | ARIZONA_MUX_ENUMS(name##_aux3, base_reg + 16); \ | ||
111 | ARIZONA_MUX_ENUMS(name##_aux4, base_reg + 24); \ | ||
112 | ARIZONA_MUX_ENUMS(name##_aux5, base_reg + 32); \ | ||
113 | ARIZONA_MUX_ENUMS(name##_aux6, base_reg + 40) | ||
101 | 114 | ||
102 | #define ARIZONA_MUX(name, ctrl) \ | 115 | #define ARIZONA_MUX(name, ctrl) \ |
103 | SND_SOC_DAPM_VALUE_MUX(name, SND_SOC_NOPM, 0, 0, ctrl) | 116 | SND_SOC_DAPM_VALUE_MUX(name, SND_SOC_NOPM, 0, 0, ctrl) |
104 | 117 | ||
118 | #define ARIZONA_MUX_WIDGETS(name, name_str) \ | ||
119 | ARIZONA_MUX(name_str " Input", &name##_mux) | ||
120 | |||
105 | #define ARIZONA_MIXER_WIDGETS(name, name_str) \ | 121 | #define ARIZONA_MIXER_WIDGETS(name, name_str) \ |
106 | ARIZONA_MUX(name_str " Input 1", &name##_in1_mux), \ | 122 | ARIZONA_MUX(name_str " Input 1", &name##_in1_mux), \ |
107 | ARIZONA_MUX(name_str " Input 2", &name##_in2_mux), \ | 123 | ARIZONA_MUX(name_str " Input 2", &name##_in2_mux), \ |
@@ -109,6 +125,19 @@ extern int arizona_mixer_values[ARIZONA_NUM_MIXER_INPUTS]; | |||
109 | ARIZONA_MUX(name_str " Input 4", &name##_in4_mux), \ | 125 | ARIZONA_MUX(name_str " Input 4", &name##_in4_mux), \ |
110 | SND_SOC_DAPM_MIXER(name_str " Mixer", SND_SOC_NOPM, 0, 0, NULL, 0) | 126 | SND_SOC_DAPM_MIXER(name_str " Mixer", SND_SOC_NOPM, 0, 0, NULL, 0) |
111 | 127 | ||
128 | #define ARIZONA_DSP_WIDGETS(name, name_str) \ | ||
129 | ARIZONA_MIXER_WIDGETS(name##L, name_str "L"), \ | ||
130 | ARIZONA_MIXER_WIDGETS(name##R, name_str "R"), \ | ||
131 | ARIZONA_MUX(name_str " Aux 1", &name##_aux1_mux), \ | ||
132 | ARIZONA_MUX(name_str " Aux 2", &name##_aux2_mux), \ | ||
133 | ARIZONA_MUX(name_str " Aux 3", &name##_aux3_mux), \ | ||
134 | ARIZONA_MUX(name_str " Aux 4", &name##_aux4_mux), \ | ||
135 | ARIZONA_MUX(name_str " Aux 5", &name##_aux5_mux), \ | ||
136 | ARIZONA_MUX(name_str " Aux 6", &name##_aux6_mux) | ||
137 | |||
138 | #define ARIZONA_MUX_ROUTES(name) \ | ||
139 | ARIZONA_MIXER_INPUT_ROUTES(name " Input") | ||
140 | |||
112 | #define ARIZONA_MIXER_ROUTES(widget, name) \ | 141 | #define ARIZONA_MIXER_ROUTES(widget, name) \ |
113 | { widget, NULL, name " Mixer" }, \ | 142 | { widget, NULL, name " Mixer" }, \ |
114 | { name " Mixer", NULL, name " Input 1" }, \ | 143 | { name " Mixer", NULL, name " Input 1" }, \ |
@@ -120,6 +149,22 @@ extern int arizona_mixer_values[ARIZONA_NUM_MIXER_INPUTS]; | |||
120 | ARIZONA_MIXER_INPUT_ROUTES(name " Input 3"), \ | 149 | ARIZONA_MIXER_INPUT_ROUTES(name " Input 3"), \ |
121 | ARIZONA_MIXER_INPUT_ROUTES(name " Input 4") | 150 | ARIZONA_MIXER_INPUT_ROUTES(name " Input 4") |
122 | 151 | ||
152 | #define ARIZONA_DSP_ROUTES(name) \ | ||
153 | { name, NULL, name " Aux 1" }, \ | ||
154 | { name, NULL, name " Aux 2" }, \ | ||
155 | { name, NULL, name " Aux 3" }, \ | ||
156 | { name, NULL, name " Aux 4" }, \ | ||
157 | { name, NULL, name " Aux 5" }, \ | ||
158 | { name, NULL, name " Aux 6" }, \ | ||
159 | ARIZONA_MIXER_INPUT_ROUTES(name " Aux 1"), \ | ||
160 | ARIZONA_MIXER_INPUT_ROUTES(name " Aux 2"), \ | ||
161 | ARIZONA_MIXER_INPUT_ROUTES(name " Aux 3"), \ | ||
162 | ARIZONA_MIXER_INPUT_ROUTES(name " Aux 4"), \ | ||
163 | ARIZONA_MIXER_INPUT_ROUTES(name " Aux 5"), \ | ||
164 | ARIZONA_MIXER_INPUT_ROUTES(name " Aux 6"), \ | ||
165 | ARIZONA_MIXER_ROUTES(name, name "L"), \ | ||
166 | ARIZONA_MIXER_ROUTES(name, name "R") | ||
167 | |||
123 | extern const struct soc_enum arizona_lhpf1_mode; | 168 | extern const struct soc_enum arizona_lhpf1_mode; |
124 | extern const struct soc_enum arizona_lhpf2_mode; | 169 | extern const struct soc_enum arizona_lhpf2_mode; |
125 | extern const struct soc_enum arizona_lhpf3_mode; | 170 | extern const struct soc_enum arizona_lhpf3_mode; |
@@ -146,6 +191,8 @@ struct arizona_fll { | |||
146 | unsigned int vco_mult; | 191 | unsigned int vco_mult; |
147 | struct completion lock; | 192 | struct completion lock; |
148 | struct completion ok; | 193 | struct completion ok; |
194 | unsigned int fref; | ||
195 | unsigned int fout; | ||
149 | 196 | ||
150 | char lock_name[ARIZONA_FLL_NAME_LEN]; | 197 | char lock_name[ARIZONA_FLL_NAME_LEN]; |
151 | char clock_ok_name[ARIZONA_FLL_NAME_LEN]; | 198 | char clock_ok_name[ARIZONA_FLL_NAME_LEN]; |
diff --git a/sound/soc/codecs/cs4271.c b/sound/soc/codecs/cs4271.c index f994af34f552..e3f0a7f3131e 100644 --- a/sound/soc/codecs/cs4271.c +++ b/sound/soc/codecs/cs4271.c | |||
@@ -485,7 +485,7 @@ static int cs4271_probe(struct snd_soc_codec *codec) | |||
485 | gpio_nreset = cs4271plat->gpio_nreset; | 485 | gpio_nreset = cs4271plat->gpio_nreset; |
486 | 486 | ||
487 | if (gpio_nreset >= 0) | 487 | if (gpio_nreset >= 0) |
488 | if (gpio_request(gpio_nreset, "CS4271 Reset")) | 488 | if (devm_gpio_request(codec->dev, gpio_nreset, "CS4271 Reset")) |
489 | gpio_nreset = -EINVAL; | 489 | gpio_nreset = -EINVAL; |
490 | if (gpio_nreset >= 0) { | 490 | if (gpio_nreset >= 0) { |
491 | /* Reset codec */ | 491 | /* Reset codec */ |
@@ -535,15 +535,10 @@ static int cs4271_probe(struct snd_soc_codec *codec) | |||
535 | static int cs4271_remove(struct snd_soc_codec *codec) | 535 | static int cs4271_remove(struct snd_soc_codec *codec) |
536 | { | 536 | { |
537 | struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); | 537 | struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); |
538 | int gpio_nreset; | ||
539 | 538 | ||
540 | gpio_nreset = cs4271->gpio_nreset; | 539 | if (gpio_is_valid(cs4271->gpio_nreset)) |
541 | |||
542 | if (gpio_is_valid(gpio_nreset)) { | ||
543 | /* Set codec to the reset state */ | 540 | /* Set codec to the reset state */ |
544 | gpio_set_value(gpio_nreset, 0); | 541 | gpio_set_value(cs4271->gpio_nreset, 0); |
545 | gpio_free(gpio_nreset); | ||
546 | } | ||
547 | 542 | ||
548 | return 0; | 543 | return 0; |
549 | }; | 544 | }; |
diff --git a/sound/soc/codecs/cs42l52.c b/sound/soc/codecs/cs42l52.c index 61599298fb26..97a81051e88d 100644 --- a/sound/soc/codecs/cs42l52.c +++ b/sound/soc/codecs/cs42l52.c | |||
@@ -763,7 +763,7 @@ static int cs42l52_set_sysclk(struct snd_soc_dai *codec_dai, | |||
763 | if ((freq >= CS42L52_MIN_CLK) && (freq <= CS42L52_MAX_CLK)) { | 763 | if ((freq >= CS42L52_MIN_CLK) && (freq <= CS42L52_MAX_CLK)) { |
764 | cs42l52->sysclk = freq; | 764 | cs42l52->sysclk = freq; |
765 | } else { | 765 | } else { |
766 | dev_err(codec->dev, "Invalid freq paramter\n"); | 766 | dev_err(codec->dev, "Invalid freq parameter\n"); |
767 | return -EINVAL; | 767 | return -EINVAL; |
768 | } | 768 | } |
769 | return 0; | 769 | return 0; |
@@ -773,7 +773,6 @@ static int cs42l52_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) | |||
773 | { | 773 | { |
774 | struct snd_soc_codec *codec = codec_dai->codec; | 774 | struct snd_soc_codec *codec = codec_dai->codec; |
775 | struct cs42l52_private *cs42l52 = snd_soc_codec_get_drvdata(codec); | 775 | struct cs42l52_private *cs42l52 = snd_soc_codec_get_drvdata(codec); |
776 | int ret = 0; | ||
777 | u8 iface = 0; | 776 | u8 iface = 0; |
778 | 777 | ||
779 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { | 778 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { |
@@ -822,7 +821,7 @@ static int cs42l52_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) | |||
822 | case SND_SOC_DAIFMT_NB_IF: | 821 | case SND_SOC_DAIFMT_NB_IF: |
823 | break; | 822 | break; |
824 | default: | 823 | default: |
825 | ret = -EINVAL; | 824 | return -EINVAL; |
826 | } | 825 | } |
827 | cs42l52->config.format = iface; | 826 | cs42l52->config.format = iface; |
828 | snd_soc_write(codec, CS42L52_IFACE_CTL1, cs42l52->config.format); | 827 | snd_soc_write(codec, CS42L52_IFACE_CTL1, cs42l52->config.format); |
diff --git a/sound/soc/codecs/wm2200.c b/sound/soc/codecs/wm2200.c index eab64a193989..06d4e612a164 100644 --- a/sound/soc/codecs/wm2200.c +++ b/sound/soc/codecs/wm2200.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | #include <linux/delay.h> | 16 | #include <linux/delay.h> |
17 | #include <linux/pm.h> | 17 | #include <linux/pm.h> |
18 | #include <linux/firmware.h> | ||
18 | #include <linux/gcd.h> | 19 | #include <linux/gcd.h> |
19 | #include <linux/gpio.h> | 20 | #include <linux/gpio.h> |
20 | #include <linux/i2c.h> | 21 | #include <linux/i2c.h> |
@@ -32,6 +33,39 @@ | |||
32 | #include <sound/wm2200.h> | 33 | #include <sound/wm2200.h> |
33 | 34 | ||
34 | #include "wm2200.h" | 35 | #include "wm2200.h" |
36 | #include "wmfw.h" | ||
37 | |||
38 | #define WM2200_DSP_CONTROL_1 0x00 | ||
39 | #define WM2200_DSP_CONTROL_2 0x02 | ||
40 | #define WM2200_DSP_CONTROL_3 0x03 | ||
41 | #define WM2200_DSP_CONTROL_4 0x04 | ||
42 | #define WM2200_DSP_CONTROL_5 0x06 | ||
43 | #define WM2200_DSP_CONTROL_6 0x07 | ||
44 | #define WM2200_DSP_CONTROL_7 0x08 | ||
45 | #define WM2200_DSP_CONTROL_8 0x09 | ||
46 | #define WM2200_DSP_CONTROL_9 0x0A | ||
47 | #define WM2200_DSP_CONTROL_10 0x0B | ||
48 | #define WM2200_DSP_CONTROL_11 0x0C | ||
49 | #define WM2200_DSP_CONTROL_12 0x0D | ||
50 | #define WM2200_DSP_CONTROL_13 0x0F | ||
51 | #define WM2200_DSP_CONTROL_14 0x10 | ||
52 | #define WM2200_DSP_CONTROL_15 0x11 | ||
53 | #define WM2200_DSP_CONTROL_16 0x12 | ||
54 | #define WM2200_DSP_CONTROL_17 0x13 | ||
55 | #define WM2200_DSP_CONTROL_18 0x14 | ||
56 | #define WM2200_DSP_CONTROL_19 0x16 | ||
57 | #define WM2200_DSP_CONTROL_20 0x17 | ||
58 | #define WM2200_DSP_CONTROL_21 0x18 | ||
59 | #define WM2200_DSP_CONTROL_22 0x1A | ||
60 | #define WM2200_DSP_CONTROL_23 0x1B | ||
61 | #define WM2200_DSP_CONTROL_24 0x1C | ||
62 | #define WM2200_DSP_CONTROL_25 0x1E | ||
63 | #define WM2200_DSP_CONTROL_26 0x20 | ||
64 | #define WM2200_DSP_CONTROL_27 0x21 | ||
65 | #define WM2200_DSP_CONTROL_28 0x22 | ||
66 | #define WM2200_DSP_CONTROL_29 0x23 | ||
67 | #define WM2200_DSP_CONTROL_30 0x24 | ||
68 | #define WM2200_DSP_CONTROL_31 0x26 | ||
35 | 69 | ||
36 | /* The code assumes DCVDD is generated internally */ | 70 | /* The code assumes DCVDD is generated internally */ |
37 | #define WM2200_NUM_CORE_SUPPLIES 2 | 71 | #define WM2200_NUM_CORE_SUPPLIES 2 |
@@ -64,6 +98,66 @@ struct wm2200_priv { | |||
64 | int sysclk; | 98 | int sysclk; |
65 | }; | 99 | }; |
66 | 100 | ||
101 | #define WM2200_DSP_RANGE_BASE (WM2200_MAX_REGISTER + 1) | ||
102 | #define WM2200_DSP_SPACING 12288 | ||
103 | |||
104 | #define WM2200_DSP1_DM_BASE (WM2200_DSP_RANGE_BASE + (0 * WM2200_DSP_SPACING)) | ||
105 | #define WM2200_DSP1_PM_BASE (WM2200_DSP_RANGE_BASE + (1 * WM2200_DSP_SPACING)) | ||
106 | #define WM2200_DSP1_ZM_BASE (WM2200_DSP_RANGE_BASE + (2 * WM2200_DSP_SPACING)) | ||
107 | #define WM2200_DSP2_DM_BASE (WM2200_DSP_RANGE_BASE + (3 * WM2200_DSP_SPACING)) | ||
108 | #define WM2200_DSP2_PM_BASE (WM2200_DSP_RANGE_BASE + (4 * WM2200_DSP_SPACING)) | ||
109 | #define WM2200_DSP2_ZM_BASE (WM2200_DSP_RANGE_BASE + (5 * WM2200_DSP_SPACING)) | ||
110 | |||
111 | static const struct regmap_range_cfg wm2200_ranges[] = { | ||
112 | /* DSP1 DM */ | ||
113 | { .range_min = WM2200_DSP1_DM_BASE, | ||
114 | .range_max = WM2200_DSP1_DM_BASE + 12287, | ||
115 | .selector_reg = WM2200_DSP1_CONTROL_3, | ||
116 | .selector_mask = WM2200_DSP1_PAGE_BASE_DM_0_MASK, | ||
117 | .selector_shift = WM2200_DSP1_PAGE_BASE_DM_0_SHIFT, | ||
118 | .window_start = WM2200_DSP1_DM_0, .window_len = 2048, }, | ||
119 | |||
120 | /* DSP1 PM */ | ||
121 | { .range_min = WM2200_DSP1_PM_BASE, | ||
122 | .range_max = WM2200_DSP1_PM_BASE + 12287, | ||
123 | .selector_reg = WM2200_DSP1_CONTROL_2, | ||
124 | .selector_mask = WM2200_DSP1_PAGE_BASE_PM_0_MASK, | ||
125 | .selector_shift = WM2200_DSP1_PAGE_BASE_PM_0_SHIFT, | ||
126 | .window_start = WM2200_DSP1_PM_0, .window_len = 768, }, | ||
127 | |||
128 | /* DSP1 ZM */ | ||
129 | { .range_min = WM2200_DSP1_ZM_BASE, | ||
130 | .range_max = WM2200_DSP1_ZM_BASE + 2047, | ||
131 | .selector_reg = WM2200_DSP1_CONTROL_4, | ||
132 | .selector_mask = WM2200_DSP1_PAGE_BASE_ZM_0_MASK, | ||
133 | .selector_shift = WM2200_DSP1_PAGE_BASE_ZM_0_SHIFT, | ||
134 | .window_start = WM2200_DSP1_ZM_0, .window_len = 1024, }, | ||
135 | |||
136 | /* DSP2 DM */ | ||
137 | { .range_min = WM2200_DSP2_DM_BASE, | ||
138 | .range_max = WM2200_DSP2_DM_BASE + 4095, | ||
139 | .selector_reg = WM2200_DSP2_CONTROL_3, | ||
140 | .selector_mask = WM2200_DSP2_PAGE_BASE_DM_0_MASK, | ||
141 | .selector_shift = WM2200_DSP2_PAGE_BASE_DM_0_SHIFT, | ||
142 | .window_start = WM2200_DSP2_DM_0, .window_len = 2048, }, | ||
143 | |||
144 | /* DSP2 PM */ | ||
145 | { .range_min = WM2200_DSP2_PM_BASE, | ||
146 | .range_max = WM2200_DSP2_PM_BASE + 11287, | ||
147 | .selector_reg = WM2200_DSP2_CONTROL_2, | ||
148 | .selector_mask = WM2200_DSP2_PAGE_BASE_PM_0_MASK, | ||
149 | .selector_shift = WM2200_DSP2_PAGE_BASE_PM_0_SHIFT, | ||
150 | .window_start = WM2200_DSP2_PM_0, .window_len = 768, }, | ||
151 | |||
152 | /* DSP2 ZM */ | ||
153 | { .range_min = WM2200_DSP2_ZM_BASE, | ||
154 | .range_max = WM2200_DSP2_ZM_BASE + 2047, | ||
155 | .selector_reg = WM2200_DSP2_CONTROL_4, | ||
156 | .selector_mask = WM2200_DSP2_PAGE_BASE_ZM_0_MASK, | ||
157 | .selector_shift = WM2200_DSP2_PAGE_BASE_ZM_0_SHIFT, | ||
158 | .window_start = WM2200_DSP2_ZM_0, .window_len = 1024, }, | ||
159 | }; | ||
160 | |||
67 | static struct reg_default wm2200_reg_defaults[] = { | 161 | static struct reg_default wm2200_reg_defaults[] = { |
68 | { 0x000B, 0x0000 }, /* R11 - Tone Generator 1 */ | 162 | { 0x000B, 0x0000 }, /* R11 - Tone Generator 1 */ |
69 | { 0x0102, 0x0000 }, /* R258 - Clocking 3 */ | 163 | { 0x0102, 0x0000 }, /* R258 - Clocking 3 */ |
@@ -407,6 +501,16 @@ static struct reg_default wm2200_reg_defaults[] = { | |||
407 | 501 | ||
408 | static bool wm2200_volatile_register(struct device *dev, unsigned int reg) | 502 | static bool wm2200_volatile_register(struct device *dev, unsigned int reg) |
409 | { | 503 | { |
504 | int i; | ||
505 | |||
506 | for (i = 0; i < ARRAY_SIZE(wm2200_ranges); i++) | ||
507 | if ((reg >= wm2200_ranges[i].window_start && | ||
508 | reg <= wm2200_ranges[i].window_start + | ||
509 | wm2200_ranges[i].window_len) || | ||
510 | (reg >= wm2200_ranges[i].range_min && | ||
511 | reg <= wm2200_ranges[i].range_max)) | ||
512 | return true; | ||
513 | |||
410 | switch (reg) { | 514 | switch (reg) { |
411 | case WM2200_SOFTWARE_RESET: | 515 | case WM2200_SOFTWARE_RESET: |
412 | case WM2200_DEVICE_REVISION: | 516 | case WM2200_DEVICE_REVISION: |
@@ -423,6 +527,16 @@ static bool wm2200_volatile_register(struct device *dev, unsigned int reg) | |||
423 | 527 | ||
424 | static bool wm2200_readable_register(struct device *dev, unsigned int reg) | 528 | static bool wm2200_readable_register(struct device *dev, unsigned int reg) |
425 | { | 529 | { |
530 | int i; | ||
531 | |||
532 | for (i = 0; i < ARRAY_SIZE(wm2200_ranges); i++) | ||
533 | if ((reg >= wm2200_ranges[i].window_start && | ||
534 | reg <= wm2200_ranges[i].window_start + | ||
535 | wm2200_ranges[i].window_len) || | ||
536 | (reg >= wm2200_ranges[i].range_min && | ||
537 | reg <= wm2200_ranges[i].range_max)) | ||
538 | return true; | ||
539 | |||
426 | switch (reg) { | 540 | switch (reg) { |
427 | case WM2200_SOFTWARE_RESET: | 541 | case WM2200_SOFTWARE_RESET: |
428 | case WM2200_DEVICE_REVISION: | 542 | case WM2200_DEVICE_REVISION: |
@@ -873,6 +987,400 @@ static int wm2200_reset(struct wm2200_priv *wm2200) | |||
873 | } | 987 | } |
874 | } | 988 | } |
875 | 989 | ||
990 | static int wm2200_dsp_load(struct snd_soc_codec *codec, int base) | ||
991 | { | ||
992 | const struct firmware *firmware; | ||
993 | struct regmap *regmap = codec->control_data; | ||
994 | unsigned int pos = 0; | ||
995 | const struct wmfw_header *header; | ||
996 | const struct wmfw_adsp1_sizes *adsp1_sizes; | ||
997 | const struct wmfw_footer *footer; | ||
998 | const struct wmfw_region *region; | ||
999 | const char *file, *region_name; | ||
1000 | char *text; | ||
1001 | unsigned int dm, pm, zm, reg; | ||
1002 | int regions = 0; | ||
1003 | int ret, offset, type; | ||
1004 | |||
1005 | switch (base) { | ||
1006 | case WM2200_DSP1_CONTROL_1: | ||
1007 | file = "wm2200-dsp1.wmfw"; | ||
1008 | dm = WM2200_DSP1_DM_BASE; | ||
1009 | pm = WM2200_DSP1_PM_BASE; | ||
1010 | zm = WM2200_DSP1_ZM_BASE; | ||
1011 | break; | ||
1012 | case WM2200_DSP2_CONTROL_1: | ||
1013 | file = "wm2200-dsp2.wmfw"; | ||
1014 | dm = WM2200_DSP2_DM_BASE; | ||
1015 | pm = WM2200_DSP2_PM_BASE; | ||
1016 | zm = WM2200_DSP2_ZM_BASE; | ||
1017 | break; | ||
1018 | default: | ||
1019 | dev_err(codec->dev, "BASE %x\n", base); | ||
1020 | BUG_ON(1); | ||
1021 | return -EINVAL; | ||
1022 | } | ||
1023 | |||
1024 | ret = request_firmware(&firmware, file, codec->dev); | ||
1025 | if (ret != 0) { | ||
1026 | dev_err(codec->dev, "Failed to request '%s'\n", file); | ||
1027 | return ret; | ||
1028 | } | ||
1029 | |||
1030 | pos = sizeof(*header) + sizeof(*adsp1_sizes) + sizeof(*footer); | ||
1031 | if (pos >= firmware->size) { | ||
1032 | dev_err(codec->dev, "%s: file too short, %d bytes\n", | ||
1033 | file, firmware->size); | ||
1034 | return -EINVAL; | ||
1035 | } | ||
1036 | |||
1037 | header = (void*)&firmware->data[0]; | ||
1038 | |||
1039 | if (memcmp(&header->magic[0], "WMFW", 4) != 0) { | ||
1040 | dev_err(codec->dev, "%s: invalid magic\n", file); | ||
1041 | return -EINVAL; | ||
1042 | } | ||
1043 | |||
1044 | if (header->ver != 0) { | ||
1045 | dev_err(codec->dev, "%s: unknown file format %d\n", | ||
1046 | file, header->ver); | ||
1047 | return -EINVAL; | ||
1048 | } | ||
1049 | |||
1050 | if (le32_to_cpu(header->len) != sizeof(*header) + | ||
1051 | sizeof(*adsp1_sizes) + sizeof(*footer)) { | ||
1052 | dev_err(codec->dev, "%s: unexpected header length %d\n", | ||
1053 | file, le32_to_cpu(header->len)); | ||
1054 | return -EINVAL; | ||
1055 | } | ||
1056 | |||
1057 | if (header->core != WMFW_ADSP1) { | ||
1058 | dev_err(codec->dev, "%s: invalid core %d\n", | ||
1059 | file, header->core); | ||
1060 | return -EINVAL; | ||
1061 | } | ||
1062 | |||
1063 | adsp1_sizes = (void *)&(header[1]); | ||
1064 | footer = (void *)&(adsp1_sizes[1]); | ||
1065 | |||
1066 | dev_dbg(codec->dev, "%s: %d DM, %d PM, %d ZM\n", | ||
1067 | file, le32_to_cpu(adsp1_sizes->dm), | ||
1068 | le32_to_cpu(adsp1_sizes->pm), le32_to_cpu(adsp1_sizes->zm)); | ||
1069 | |||
1070 | dev_dbg(codec->dev, "%s: timestamp %llu\n", file, | ||
1071 | le64_to_cpu(footer->timestamp)); | ||
1072 | |||
1073 | while (pos < firmware->size && | ||
1074 | pos - firmware->size > sizeof(*region)) { | ||
1075 | region = (void *)&(firmware->data[pos]); | ||
1076 | region_name = "Unknown"; | ||
1077 | reg = 0; | ||
1078 | text = NULL; | ||
1079 | offset = le32_to_cpu(region->offset) & 0xffffff; | ||
1080 | type = be32_to_cpu(region->type) & 0xff; | ||
1081 | |||
1082 | switch (type) { | ||
1083 | case WMFW_NAME_TEXT: | ||
1084 | region_name = "Firmware name"; | ||
1085 | text = kzalloc(le32_to_cpu(region->len) + 1, | ||
1086 | GFP_KERNEL); | ||
1087 | break; | ||
1088 | case WMFW_INFO_TEXT: | ||
1089 | region_name = "Information"; | ||
1090 | text = kzalloc(le32_to_cpu(region->len) + 1, | ||
1091 | GFP_KERNEL); | ||
1092 | break; | ||
1093 | case WMFW_ABSOLUTE: | ||
1094 | region_name = "Absolute"; | ||
1095 | reg = offset; | ||
1096 | break; | ||
1097 | case WMFW_ADSP1_PM: | ||
1098 | region_name = "PM"; | ||
1099 | reg = pm + (offset * 3); | ||
1100 | break; | ||
1101 | case WMFW_ADSP1_DM: | ||
1102 | region_name = "DM"; | ||
1103 | reg = dm + (offset * 2); | ||
1104 | break; | ||
1105 | case WMFW_ADSP1_ZM: | ||
1106 | region_name = "ZM"; | ||
1107 | reg = zm + (offset * 2); | ||
1108 | break; | ||
1109 | default: | ||
1110 | dev_warn(codec->dev, | ||
1111 | "%s.%d: Unknown region type %x at %d(%x)\n", | ||
1112 | file, regions, type, pos, pos); | ||
1113 | break; | ||
1114 | } | ||
1115 | |||
1116 | dev_dbg(codec->dev, "%s.%d: %d bytes at %d in %s\n", file, | ||
1117 | regions, le32_to_cpu(region->len), offset, | ||
1118 | region_name); | ||
1119 | |||
1120 | if (text) { | ||
1121 | memcpy(text, region->data, le32_to_cpu(region->len)); | ||
1122 | dev_info(codec->dev, "%s: %s\n", file, text); | ||
1123 | kfree(text); | ||
1124 | } | ||
1125 | |||
1126 | if (reg) { | ||
1127 | ret = regmap_raw_write(regmap, reg, region->data, | ||
1128 | le32_to_cpu(region->len)); | ||
1129 | if (ret != 0) { | ||
1130 | dev_err(codec->dev, | ||
1131 | "%s.%d: Failed to write %d bytes at %d in %s: %d\n", | ||
1132 | file, regions, | ||
1133 | le32_to_cpu(region->len), offset, | ||
1134 | region_name, ret); | ||
1135 | goto out; | ||
1136 | } | ||
1137 | } | ||
1138 | |||
1139 | pos += le32_to_cpu(region->len) + sizeof(*region); | ||
1140 | regions++; | ||
1141 | } | ||
1142 | |||
1143 | if (pos > firmware->size) | ||
1144 | dev_warn(codec->dev, "%s.%d: %d bytes at end of file\n", | ||
1145 | file, regions, pos - firmware->size); | ||
1146 | |||
1147 | out: | ||
1148 | release_firmware(firmware); | ||
1149 | |||
1150 | return ret; | ||
1151 | } | ||
1152 | |||
1153 | static int wm2200_setup_algs(struct snd_soc_codec *codec, int base) | ||
1154 | { | ||
1155 | struct regmap *regmap = codec->control_data; | ||
1156 | struct wmfw_adsp1_id_hdr id; | ||
1157 | struct wmfw_adsp1_alg_hdr *alg; | ||
1158 | size_t algs; | ||
1159 | int zm, dm, pm, ret, i; | ||
1160 | __be32 val; | ||
1161 | |||
1162 | switch (base) { | ||
1163 | case WM2200_DSP1_CONTROL_1: | ||
1164 | dm = WM2200_DSP1_DM_BASE; | ||
1165 | pm = WM2200_DSP1_PM_BASE; | ||
1166 | zm = WM2200_DSP1_ZM_BASE; | ||
1167 | break; | ||
1168 | case WM2200_DSP2_CONTROL_1: | ||
1169 | dm = WM2200_DSP2_DM_BASE; | ||
1170 | pm = WM2200_DSP2_PM_BASE; | ||
1171 | zm = WM2200_DSP2_ZM_BASE; | ||
1172 | break; | ||
1173 | default: | ||
1174 | dev_err(codec->dev, "BASE %x\n", base); | ||
1175 | BUG_ON(1); | ||
1176 | return -EINVAL; | ||
1177 | } | ||
1178 | |||
1179 | ret = regmap_raw_read(regmap, dm, &id, sizeof(id)); | ||
1180 | if (ret != 0) { | ||
1181 | dev_err(codec->dev, "Failed to read algorithm info: %d\n", | ||
1182 | ret); | ||
1183 | return ret; | ||
1184 | } | ||
1185 | |||
1186 | algs = be32_to_cpu(id.algs); | ||
1187 | dev_info(codec->dev, "Firmware: %x v%d.%d.%d, %d algorithms\n", | ||
1188 | be32_to_cpu(id.fw.id), | ||
1189 | (be32_to_cpu(id.fw.ver) & 0xff000) >> 16, | ||
1190 | (be32_to_cpu(id.fw.ver) & 0xff00) >> 8, | ||
1191 | be32_to_cpu(id.fw.ver) & 0xff, | ||
1192 | algs); | ||
1193 | |||
1194 | /* Read the terminator first to validate the length */ | ||
1195 | ret = regmap_raw_read(regmap, dm + | ||
1196 | (sizeof(id) + (algs * sizeof(*alg))) / 2, | ||
1197 | &val, sizeof(val)); | ||
1198 | if (ret != 0) { | ||
1199 | dev_err(codec->dev, "Failed to read algorithm list end: %d\n", | ||
1200 | ret); | ||
1201 | return ret; | ||
1202 | } | ||
1203 | |||
1204 | if (be32_to_cpu(val) != 0xbedead) | ||
1205 | dev_warn(codec->dev, "Algorithm list end %x 0x%x != 0xbeadead\n", | ||
1206 | (sizeof(id) + (algs * sizeof(*alg))) / 2, | ||
1207 | be32_to_cpu(val)); | ||
1208 | |||
1209 | alg = kzalloc(sizeof(*alg) * algs, GFP_KERNEL); | ||
1210 | if (!alg) | ||
1211 | return -ENOMEM; | ||
1212 | |||
1213 | ret = regmap_raw_read(regmap, dm + (sizeof(id) / 2), | ||
1214 | alg, algs * sizeof(*alg)); | ||
1215 | if (ret != 0) { | ||
1216 | dev_err(codec->dev, "Failed to read algorithm list: %d\n", | ||
1217 | ret); | ||
1218 | goto out; | ||
1219 | } | ||
1220 | |||
1221 | for (i = 0; i < algs; i++) { | ||
1222 | dev_info(codec->dev, "%d: ID %x v%d.%d.%d\n", | ||
1223 | i, be32_to_cpu(alg[i].alg.id), | ||
1224 | (be32_to_cpu(alg[i].alg.ver) & 0xff000) >> 16, | ||
1225 | (be32_to_cpu(alg[i].alg.ver) & 0xff00) >> 8, | ||
1226 | be32_to_cpu(alg[i].alg.ver) & 0xff); | ||
1227 | } | ||
1228 | |||
1229 | out: | ||
1230 | kfree(alg); | ||
1231 | return ret; | ||
1232 | } | ||
1233 | |||
1234 | static int wm2200_load_coeff(struct snd_soc_codec *codec, int base) | ||
1235 | { | ||
1236 | struct regmap *regmap = codec->control_data; | ||
1237 | struct wmfw_coeff_hdr *hdr; | ||
1238 | struct wmfw_coeff_item *blk; | ||
1239 | const struct firmware *firmware; | ||
1240 | const char *file, *region_name; | ||
1241 | int ret, dm, pm, zm, pos, blocks, type, offset, reg; | ||
1242 | |||
1243 | switch (base) { | ||
1244 | case WM2200_DSP1_CONTROL_1: | ||
1245 | file = "wm2200-dsp1.bin"; | ||
1246 | dm = WM2200_DSP1_DM_BASE; | ||
1247 | pm = WM2200_DSP1_PM_BASE; | ||
1248 | zm = WM2200_DSP1_ZM_BASE; | ||
1249 | break; | ||
1250 | case WM2200_DSP2_CONTROL_1: | ||
1251 | file = "wm2200-dsp2.bin"; | ||
1252 | dm = WM2200_DSP2_DM_BASE; | ||
1253 | pm = WM2200_DSP2_PM_BASE; | ||
1254 | zm = WM2200_DSP2_ZM_BASE; | ||
1255 | break; | ||
1256 | default: | ||
1257 | dev_err(codec->dev, "BASE %x\n", base); | ||
1258 | BUG_ON(1); | ||
1259 | return -EINVAL; | ||
1260 | } | ||
1261 | |||
1262 | ret = request_firmware(&firmware, file, codec->dev); | ||
1263 | if (ret != 0) { | ||
1264 | dev_err(codec->dev, "Failed to request '%s'\n", file); | ||
1265 | return ret; | ||
1266 | } | ||
1267 | |||
1268 | if (sizeof(*hdr) >= firmware->size) { | ||
1269 | dev_err(codec->dev, "%s: file too short, %d bytes\n", | ||
1270 | file, firmware->size); | ||
1271 | return -EINVAL; | ||
1272 | } | ||
1273 | |||
1274 | hdr = (void*)&firmware->data[0]; | ||
1275 | if (memcmp(hdr->magic, "WMDR", 4) != 0) { | ||
1276 | dev_err(codec->dev, "%s: invalid magic\n", file); | ||
1277 | return -EINVAL; | ||
1278 | } | ||
1279 | |||
1280 | dev_dbg(codec->dev, "%s: v%d.%d.%d\n", file, | ||
1281 | (le32_to_cpu(hdr->ver) >> 16) & 0xff, | ||
1282 | (le32_to_cpu(hdr->ver) >> 8) & 0xff, | ||
1283 | le32_to_cpu(hdr->ver) & 0xff); | ||
1284 | |||
1285 | pos = le32_to_cpu(hdr->len); | ||
1286 | |||
1287 | blocks = 0; | ||
1288 | while (pos < firmware->size && | ||
1289 | pos - firmware->size > sizeof(*blk)) { | ||
1290 | blk = (void*)(&firmware->data[pos]); | ||
1291 | |||
1292 | type = be32_to_cpu(blk->type) & 0xff; | ||
1293 | offset = le32_to_cpu(blk->offset) & 0xffffff; | ||
1294 | |||
1295 | dev_dbg(codec->dev, "%s.%d: %x v%d.%d.%d\n", | ||
1296 | file, blocks, le32_to_cpu(blk->id), | ||
1297 | (le32_to_cpu(blk->ver) >> 16) & 0xff, | ||
1298 | (le32_to_cpu(blk->ver) >> 8) & 0xff, | ||
1299 | le32_to_cpu(blk->ver) & 0xff); | ||
1300 | dev_dbg(codec->dev, "%s.%d: %d bytes at 0x%x in %x\n", | ||
1301 | file, blocks, le32_to_cpu(blk->len), offset, type); | ||
1302 | |||
1303 | reg = 0; | ||
1304 | region_name = "Unknown"; | ||
1305 | switch (type) { | ||
1306 | case WMFW_NAME_TEXT: | ||
1307 | case WMFW_INFO_TEXT: | ||
1308 | break; | ||
1309 | case WMFW_ABSOLUTE: | ||
1310 | region_name = "register"; | ||
1311 | reg = offset; | ||
1312 | break; | ||
1313 | default: | ||
1314 | dev_err(codec->dev, "Unknown region type %x\n", type); | ||
1315 | break; | ||
1316 | } | ||
1317 | |||
1318 | if (reg) { | ||
1319 | ret = regmap_raw_write(regmap, reg, blk->data, | ||
1320 | le32_to_cpu(blk->len)); | ||
1321 | if (ret != 0) { | ||
1322 | dev_err(codec->dev, | ||
1323 | "%s.%d: Failed to write to %x in %s\n", | ||
1324 | file, blocks, reg, region_name); | ||
1325 | } | ||
1326 | } | ||
1327 | |||
1328 | pos += le32_to_cpu(blk->len) + sizeof(*blk); | ||
1329 | blocks++; | ||
1330 | } | ||
1331 | |||
1332 | if (pos > firmware->size) | ||
1333 | dev_warn(codec->dev, "%s.%d: %d bytes at end of file\n", | ||
1334 | file, blocks, pos - firmware->size); | ||
1335 | |||
1336 | return 0; | ||
1337 | } | ||
1338 | |||
1339 | static int wm2200_dsp_ev(struct snd_soc_dapm_widget *w, | ||
1340 | struct snd_kcontrol *kcontrol, | ||
1341 | int event) | ||
1342 | { | ||
1343 | struct snd_soc_codec *codec = w->codec; | ||
1344 | int base = w->reg - WM2200_DSP_CONTROL_30; | ||
1345 | int ret; | ||
1346 | |||
1347 | switch (event) { | ||
1348 | case SND_SOC_DAPM_POST_PMU: | ||
1349 | ret = wm2200_dsp_load(codec, base); | ||
1350 | if (ret != 0) | ||
1351 | return ret; | ||
1352 | |||
1353 | ret = wm2200_setup_algs(codec, base); | ||
1354 | if (ret != 0) | ||
1355 | return ret; | ||
1356 | |||
1357 | ret = wm2200_load_coeff(codec, base); | ||
1358 | if (ret != 0) | ||
1359 | return ret; | ||
1360 | |||
1361 | /* Start the core running */ | ||
1362 | snd_soc_update_bits(codec, w->reg, | ||
1363 | WM2200_DSP1_CORE_ENA | WM2200_DSP1_START, | ||
1364 | WM2200_DSP1_CORE_ENA | WM2200_DSP1_START); | ||
1365 | break; | ||
1366 | |||
1367 | case SND_SOC_DAPM_PRE_PMD: | ||
1368 | /* Halt the core */ | ||
1369 | snd_soc_update_bits(codec, w->reg, | ||
1370 | WM2200_DSP1_CORE_ENA | WM2200_DSP1_START, | ||
1371 | 0); | ||
1372 | |||
1373 | snd_soc_update_bits(codec, base + WM2200_DSP_CONTROL_19, | ||
1374 | WM2200_DSP1_WDMA_BUFFER_LENGTH_MASK, 0); | ||
1375 | break; | ||
1376 | |||
1377 | default: | ||
1378 | break; | ||
1379 | } | ||
1380 | |||
1381 | return 0; | ||
1382 | } | ||
1383 | |||
876 | static DECLARE_TLV_DB_SCALE(in_tlv, -6300, 100, 0); | 1384 | static DECLARE_TLV_DB_SCALE(in_tlv, -6300, 100, 0); |
877 | static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0); | 1385 | static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0); |
878 | static DECLARE_TLV_DB_SCALE(out_tlv, -6400, 100, 0); | 1386 | static DECLARE_TLV_DB_SCALE(out_tlv, -6400, 100, 0); |
@@ -880,7 +1388,7 @@ static DECLARE_TLV_DB_SCALE(out_tlv, -6400, 100, 0); | |||
880 | static const char *wm2200_mixer_texts[] = { | 1388 | static const char *wm2200_mixer_texts[] = { |
881 | "None", | 1389 | "None", |
882 | "Tone Generator", | 1390 | "Tone Generator", |
883 | "AEC loopback", | 1391 | "AEC Loopback", |
884 | "IN1L", | 1392 | "IN1L", |
885 | "IN1R", | 1393 | "IN1R", |
886 | "IN2L", | 1394 | "IN2L", |
@@ -976,6 +1484,20 @@ static int wm2200_mixer_values[] = { | |||
976 | static WM2200_MUX_CTL_DECL(name##_in3); \ | 1484 | static WM2200_MUX_CTL_DECL(name##_in3); \ |
977 | static WM2200_MUX_CTL_DECL(name##_in4) | 1485 | static WM2200_MUX_CTL_DECL(name##_in4) |
978 | 1486 | ||
1487 | #define WM2200_DSP_ENUMS(name, base_reg) \ | ||
1488 | static WM2200_MUX_ENUM_DECL(name##_aux1_enum, base_reg); \ | ||
1489 | static WM2200_MUX_ENUM_DECL(name##_aux2_enum, base_reg + 1); \ | ||
1490 | static WM2200_MUX_ENUM_DECL(name##_aux3_enum, base_reg + 2); \ | ||
1491 | static WM2200_MUX_ENUM_DECL(name##_aux4_enum, base_reg + 3); \ | ||
1492 | static WM2200_MUX_ENUM_DECL(name##_aux5_enum, base_reg + 4); \ | ||
1493 | static WM2200_MUX_ENUM_DECL(name##_aux6_enum, base_reg + 5); \ | ||
1494 | static WM2200_MUX_CTL_DECL(name##_aux1); \ | ||
1495 | static WM2200_MUX_CTL_DECL(name##_aux2); \ | ||
1496 | static WM2200_MUX_CTL_DECL(name##_aux3); \ | ||
1497 | static WM2200_MUX_CTL_DECL(name##_aux4); \ | ||
1498 | static WM2200_MUX_CTL_DECL(name##_aux5); \ | ||
1499 | static WM2200_MUX_CTL_DECL(name##_aux6); | ||
1500 | |||
979 | static const struct snd_kcontrol_new wm2200_snd_controls[] = { | 1501 | static const struct snd_kcontrol_new wm2200_snd_controls[] = { |
980 | SOC_SINGLE("IN1 High Performance Switch", WM2200_IN1L_CONTROL, | 1502 | SOC_SINGLE("IN1 High Performance Switch", WM2200_IN1L_CONTROL, |
981 | WM2200_IN1_OSR_SHIFT, 1, 0), | 1503 | WM2200_IN1_OSR_SHIFT, 1, 0), |
@@ -1051,6 +1573,9 @@ WM2200_MIXER_ENUMS(DSP1R, WM2200_DSP1RMIX_INPUT_1_SOURCE); | |||
1051 | WM2200_MIXER_ENUMS(DSP2L, WM2200_DSP2LMIX_INPUT_1_SOURCE); | 1573 | WM2200_MIXER_ENUMS(DSP2L, WM2200_DSP2LMIX_INPUT_1_SOURCE); |
1052 | WM2200_MIXER_ENUMS(DSP2R, WM2200_DSP2RMIX_INPUT_1_SOURCE); | 1574 | WM2200_MIXER_ENUMS(DSP2R, WM2200_DSP2RMIX_INPUT_1_SOURCE); |
1053 | 1575 | ||
1576 | WM2200_DSP_ENUMS(DSP1, WM2200_DSP1AUX1MIX_INPUT_1_SOURCE); | ||
1577 | WM2200_DSP_ENUMS(DSP2, WM2200_DSP2AUX1MIX_INPUT_1_SOURCE); | ||
1578 | |||
1054 | WM2200_MIXER_ENUMS(LHPF1, WM2200_LHPF1MIX_INPUT_1_SOURCE); | 1579 | WM2200_MIXER_ENUMS(LHPF1, WM2200_LHPF1MIX_INPUT_1_SOURCE); |
1055 | WM2200_MIXER_ENUMS(LHPF2, WM2200_LHPF2MIX_INPUT_1_SOURCE); | 1580 | WM2200_MIXER_ENUMS(LHPF2, WM2200_LHPF2MIX_INPUT_1_SOURCE); |
1056 | 1581 | ||
@@ -1064,8 +1589,19 @@ WM2200_MIXER_ENUMS(LHPF2, WM2200_LHPF2MIX_INPUT_1_SOURCE); | |||
1064 | WM2200_MUX(name_str " Input 4", &name##_in4_mux), \ | 1589 | WM2200_MUX(name_str " Input 4", &name##_in4_mux), \ |
1065 | SND_SOC_DAPM_MIXER(name_str " Mixer", SND_SOC_NOPM, 0, 0, NULL, 0) | 1590 | SND_SOC_DAPM_MIXER(name_str " Mixer", SND_SOC_NOPM, 0, 0, NULL, 0) |
1066 | 1591 | ||
1592 | #define WM2200_DSP_WIDGETS(name, name_str) \ | ||
1593 | WM2200_MIXER_WIDGETS(name##L, name_str "L"), \ | ||
1594 | WM2200_MIXER_WIDGETS(name##R, name_str "R"), \ | ||
1595 | WM2200_MUX(name_str " Aux 1", &name##_aux1_mux), \ | ||
1596 | WM2200_MUX(name_str " Aux 2", &name##_aux2_mux), \ | ||
1597 | WM2200_MUX(name_str " Aux 3", &name##_aux3_mux), \ | ||
1598 | WM2200_MUX(name_str " Aux 4", &name##_aux4_mux), \ | ||
1599 | WM2200_MUX(name_str " Aux 5", &name##_aux5_mux), \ | ||
1600 | WM2200_MUX(name_str " Aux 6", &name##_aux6_mux) | ||
1601 | |||
1067 | #define WM2200_MIXER_INPUT_ROUTES(name) \ | 1602 | #define WM2200_MIXER_INPUT_ROUTES(name) \ |
1068 | { name, "Tone Generator", "Tone Generator" }, \ | 1603 | { name, "Tone Generator", "Tone Generator" }, \ |
1604 | { name, "AEC Loopback", "AEC Loopback" }, \ | ||
1069 | { name, "IN1L", "IN1L PGA" }, \ | 1605 | { name, "IN1L", "IN1L PGA" }, \ |
1070 | { name, "IN1R", "IN1R PGA" }, \ | 1606 | { name, "IN1R", "IN1R PGA" }, \ |
1071 | { name, "IN2L", "IN2L PGA" }, \ | 1607 | { name, "IN2L", "IN2L PGA" }, \ |
@@ -1106,6 +1642,33 @@ WM2200_MIXER_ENUMS(LHPF2, WM2200_LHPF2MIX_INPUT_1_SOURCE); | |||
1106 | WM2200_MIXER_INPUT_ROUTES(name " Input 3"), \ | 1642 | WM2200_MIXER_INPUT_ROUTES(name " Input 3"), \ |
1107 | WM2200_MIXER_INPUT_ROUTES(name " Input 4") | 1643 | WM2200_MIXER_INPUT_ROUTES(name " Input 4") |
1108 | 1644 | ||
1645 | #define WM2200_DSP_AUX_ROUTES(name) \ | ||
1646 | { name, NULL, name " Aux 1" }, \ | ||
1647 | { name, NULL, name " Aux 2" }, \ | ||
1648 | { name, NULL, name " Aux 3" }, \ | ||
1649 | { name, NULL, name " Aux 4" }, \ | ||
1650 | { name, NULL, name " Aux 5" }, \ | ||
1651 | { name, NULL, name " Aux 6" }, \ | ||
1652 | WM2200_MIXER_INPUT_ROUTES(name " Aux 1"), \ | ||
1653 | WM2200_MIXER_INPUT_ROUTES(name " Aux 2"), \ | ||
1654 | WM2200_MIXER_INPUT_ROUTES(name " Aux 3"), \ | ||
1655 | WM2200_MIXER_INPUT_ROUTES(name " Aux 4"), \ | ||
1656 | WM2200_MIXER_INPUT_ROUTES(name " Aux 5"), \ | ||
1657 | WM2200_MIXER_INPUT_ROUTES(name " Aux 6") | ||
1658 | |||
1659 | static const char *wm2200_aec_loopback_texts[] = { | ||
1660 | "OUT1L", "OUT1R", "OUT2L", "OUT2R", | ||
1661 | }; | ||
1662 | |||
1663 | static const struct soc_enum wm2200_aec_loopback = | ||
1664 | SOC_ENUM_SINGLE(WM2200_DAC_AEC_CONTROL_1, | ||
1665 | WM2200_AEC_LOOPBACK_SRC_SHIFT, | ||
1666 | ARRAY_SIZE(wm2200_aec_loopback_texts), | ||
1667 | wm2200_aec_loopback_texts); | ||
1668 | |||
1669 | static const struct snd_kcontrol_new wm2200_aec_loopback_mux = | ||
1670 | SOC_DAPM_ENUM("AEC Loopback", wm2200_aec_loopback); | ||
1671 | |||
1109 | static const struct snd_soc_dapm_widget wm2200_dapm_widgets[] = { | 1672 | static const struct snd_soc_dapm_widget wm2200_dapm_widgets[] = { |
1110 | SND_SOC_DAPM_SUPPLY("SYSCLK", WM2200_CLOCKING_3, WM2200_SYSCLK_ENA_SHIFT, 0, | 1673 | SND_SOC_DAPM_SUPPLY("SYSCLK", WM2200_CLOCKING_3, WM2200_SYSCLK_ENA_SHIFT, 0, |
1111 | NULL, 0), | 1674 | NULL, 0), |
@@ -1165,8 +1728,12 @@ SND_SOC_DAPM_PGA("LHPF1", WM2200_HPLPF1_1, WM2200_LHPF1_ENA_SHIFT, 0, | |||
1165 | SND_SOC_DAPM_PGA("LHPF2", WM2200_HPLPF2_1, WM2200_LHPF2_ENA_SHIFT, 0, | 1728 | SND_SOC_DAPM_PGA("LHPF2", WM2200_HPLPF2_1, WM2200_LHPF2_ENA_SHIFT, 0, |
1166 | NULL, 0), | 1729 | NULL, 0), |
1167 | 1730 | ||
1168 | SND_SOC_DAPM_PGA_E("DSP1", SND_SOC_NOPM, 0, 0, NULL, 0, NULL, 0), | 1731 | SND_SOC_DAPM_PGA_E("DSP1", WM2200_DSP1_CONTROL_30, WM2200_DSP1_SYS_ENA_SHIFT, |
1169 | SND_SOC_DAPM_PGA_E("DSP2", SND_SOC_NOPM, 1, 0, NULL, 0, NULL, 0), | 1732 | 0, NULL, 0, wm2200_dsp_ev, |
1733 | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), | ||
1734 | SND_SOC_DAPM_PGA_E("DSP2", WM2200_DSP2_CONTROL_30, WM2200_DSP2_SYS_ENA_SHIFT, | ||
1735 | 0, NULL, 0, wm2200_dsp_ev, | ||
1736 | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), | ||
1170 | 1737 | ||
1171 | SND_SOC_DAPM_AIF_OUT("AIF1TX1", "Capture", 0, | 1738 | SND_SOC_DAPM_AIF_OUT("AIF1TX1", "Capture", 0, |
1172 | WM2200_AUDIO_IF_1_22, WM2200_AIF1TX1_ENA_SHIFT, 0), | 1739 | WM2200_AUDIO_IF_1_22, WM2200_AIF1TX1_ENA_SHIFT, 0), |
@@ -1181,6 +1748,9 @@ SND_SOC_DAPM_AIF_OUT("AIF1TX5", "Capture", 4, | |||
1181 | SND_SOC_DAPM_AIF_OUT("AIF1TX6", "Capture", 5, | 1748 | SND_SOC_DAPM_AIF_OUT("AIF1TX6", "Capture", 5, |
1182 | WM2200_AUDIO_IF_1_22, WM2200_AIF1TX6_ENA_SHIFT, 0), | 1749 | WM2200_AUDIO_IF_1_22, WM2200_AIF1TX6_ENA_SHIFT, 0), |
1183 | 1750 | ||
1751 | SND_SOC_DAPM_MUX("AEC Loopback", WM2200_DAC_AEC_CONTROL_1, | ||
1752 | WM2200_AEC_LOOPBACK_ENA_SHIFT, 0, &wm2200_aec_loopback_mux), | ||
1753 | |||
1184 | SND_SOC_DAPM_PGA_S("OUT1L", 0, WM2200_OUTPUT_ENABLES, | 1754 | SND_SOC_DAPM_PGA_S("OUT1L", 0, WM2200_OUTPUT_ENABLES, |
1185 | WM2200_OUT1L_ENA_SHIFT, 0, NULL, 0), | 1755 | WM2200_OUT1L_ENA_SHIFT, 0, NULL, 0), |
1186 | SND_SOC_DAPM_PGA_S("OUT1R", 0, WM2200_OUTPUT_ENABLES, | 1756 | SND_SOC_DAPM_PGA_S("OUT1R", 0, WM2200_OUTPUT_ENABLES, |
@@ -1231,10 +1801,8 @@ WM2200_MIXER_WIDGETS(EQR, "EQR"), | |||
1231 | WM2200_MIXER_WIDGETS(LHPF1, "LHPF1"), | 1801 | WM2200_MIXER_WIDGETS(LHPF1, "LHPF1"), |
1232 | WM2200_MIXER_WIDGETS(LHPF2, "LHPF2"), | 1802 | WM2200_MIXER_WIDGETS(LHPF2, "LHPF2"), |
1233 | 1803 | ||
1234 | WM2200_MIXER_WIDGETS(DSP1L, "DSP1L"), | 1804 | WM2200_DSP_WIDGETS(DSP1, "DSP1"), |
1235 | WM2200_MIXER_WIDGETS(DSP1R, "DSP1R"), | 1805 | WM2200_DSP_WIDGETS(DSP2, "DSP2"), |
1236 | WM2200_MIXER_WIDGETS(DSP2L, "DSP2L"), | ||
1237 | WM2200_MIXER_WIDGETS(DSP2R, "DSP2R"), | ||
1238 | 1806 | ||
1239 | WM2200_MIXER_WIDGETS(AIF1TX1, "AIF1TX1"), | 1807 | WM2200_MIXER_WIDGETS(AIF1TX1, "AIF1TX1"), |
1240 | WM2200_MIXER_WIDGETS(AIF1TX2, "AIF1TX2"), | 1808 | WM2200_MIXER_WIDGETS(AIF1TX2, "AIF1TX2"), |
@@ -1326,11 +1894,19 @@ static const struct snd_soc_dapm_route wm2200_dapm_routes[] = { | |||
1326 | { "SPK", NULL, "OUT2L" }, | 1894 | { "SPK", NULL, "OUT2L" }, |
1327 | { "SPK", NULL, "OUT2R" }, | 1895 | { "SPK", NULL, "OUT2R" }, |
1328 | 1896 | ||
1897 | { "AEC Loopback", "OUT1L", "OUT1L" }, | ||
1898 | { "AEC Loopback", "OUT1R", "OUT1R" }, | ||
1899 | { "AEC Loopback", "OUT2L", "OUT2L" }, | ||
1900 | { "AEC Loopback", "OUT2R", "OUT2R" }, | ||
1901 | |||
1329 | WM2200_MIXER_ROUTES("DSP1", "DSP1L"), | 1902 | WM2200_MIXER_ROUTES("DSP1", "DSP1L"), |
1330 | WM2200_MIXER_ROUTES("DSP1", "DSP1R"), | 1903 | WM2200_MIXER_ROUTES("DSP1", "DSP1R"), |
1331 | WM2200_MIXER_ROUTES("DSP2", "DSP2L"), | 1904 | WM2200_MIXER_ROUTES("DSP2", "DSP2L"), |
1332 | WM2200_MIXER_ROUTES("DSP2", "DSP2R"), | 1905 | WM2200_MIXER_ROUTES("DSP2", "DSP2R"), |
1333 | 1906 | ||
1907 | WM2200_DSP_AUX_ROUTES("DSP1"), | ||
1908 | WM2200_DSP_AUX_ROUTES("DSP2"), | ||
1909 | |||
1334 | WM2200_MIXER_ROUTES("OUT1L", "OUT1L"), | 1910 | WM2200_MIXER_ROUTES("OUT1L", "OUT1L"), |
1335 | WM2200_MIXER_ROUTES("OUT1R", "OUT1R"), | 1911 | WM2200_MIXER_ROUTES("OUT1R", "OUT1R"), |
1336 | WM2200_MIXER_ROUTES("OUT2L", "OUT2L"), | 1912 | WM2200_MIXER_ROUTES("OUT2L", "OUT2L"), |
@@ -1968,12 +2544,15 @@ static const struct regmap_config wm2200_regmap = { | |||
1968 | .reg_bits = 16, | 2544 | .reg_bits = 16, |
1969 | .val_bits = 16, | 2545 | .val_bits = 16, |
1970 | 2546 | ||
1971 | .max_register = WM2200_MAX_REGISTER, | 2547 | .max_register = WM2200_MAX_REGISTER + (ARRAY_SIZE(wm2200_ranges) * |
2548 | WM2200_DSP_SPACING), | ||
1972 | .reg_defaults = wm2200_reg_defaults, | 2549 | .reg_defaults = wm2200_reg_defaults, |
1973 | .num_reg_defaults = ARRAY_SIZE(wm2200_reg_defaults), | 2550 | .num_reg_defaults = ARRAY_SIZE(wm2200_reg_defaults), |
1974 | .volatile_reg = wm2200_volatile_register, | 2551 | .volatile_reg = wm2200_volatile_register, |
1975 | .readable_reg = wm2200_readable_register, | 2552 | .readable_reg = wm2200_readable_register, |
1976 | .cache_type = REGCACHE_RBTREE, | 2553 | .cache_type = REGCACHE_RBTREE, |
2554 | .ranges = wm2200_ranges, | ||
2555 | .num_ranges = ARRAY_SIZE(wm2200_ranges), | ||
1977 | }; | 2556 | }; |
1978 | 2557 | ||
1979 | static const unsigned int wm2200_dig_vu[] = { | 2558 | static const unsigned int wm2200_dig_vu[] = { |
@@ -2011,7 +2590,7 @@ static __devinit int wm2200_i2c_probe(struct i2c_client *i2c, | |||
2011 | wm2200->dev = &i2c->dev; | 2590 | wm2200->dev = &i2c->dev; |
2012 | init_completion(&wm2200->fll_lock); | 2591 | init_completion(&wm2200->fll_lock); |
2013 | 2592 | ||
2014 | wm2200->regmap = regmap_init_i2c(i2c, &wm2200_regmap); | 2593 | wm2200->regmap = devm_regmap_init_i2c(i2c, &wm2200_regmap); |
2015 | if (IS_ERR(wm2200->regmap)) { | 2594 | if (IS_ERR(wm2200->regmap)) { |
2016 | ret = PTR_ERR(wm2200->regmap); | 2595 | ret = PTR_ERR(wm2200->regmap); |
2017 | dev_err(&i2c->dev, "Failed to allocate register map: %d\n", | 2596 | dev_err(&i2c->dev, "Failed to allocate register map: %d\n", |
@@ -2027,8 +2606,9 @@ static __devinit int wm2200_i2c_probe(struct i2c_client *i2c, | |||
2027 | for (i = 0; i < ARRAY_SIZE(wm2200->core_supplies); i++) | 2606 | for (i = 0; i < ARRAY_SIZE(wm2200->core_supplies); i++) |
2028 | wm2200->core_supplies[i].supply = wm2200_core_supply_names[i]; | 2607 | wm2200->core_supplies[i].supply = wm2200_core_supply_names[i]; |
2029 | 2608 | ||
2030 | ret = regulator_bulk_get(&i2c->dev, ARRAY_SIZE(wm2200->core_supplies), | 2609 | ret = devm_regulator_bulk_get(&i2c->dev, |
2031 | wm2200->core_supplies); | 2610 | ARRAY_SIZE(wm2200->core_supplies), |
2611 | wm2200->core_supplies); | ||
2032 | if (ret != 0) { | 2612 | if (ret != 0) { |
2033 | dev_err(&i2c->dev, "Failed to request core supplies: %d\n", | 2613 | dev_err(&i2c->dev, "Failed to request core supplies: %d\n", |
2034 | ret); | 2614 | ret); |
@@ -2044,8 +2624,9 @@ static __devinit int wm2200_i2c_probe(struct i2c_client *i2c, | |||
2044 | } | 2624 | } |
2045 | 2625 | ||
2046 | if (wm2200->pdata.ldo_ena) { | 2626 | if (wm2200->pdata.ldo_ena) { |
2047 | ret = gpio_request_one(wm2200->pdata.ldo_ena, | 2627 | ret = devm_gpio_request_one(&i2c->dev, wm2200->pdata.ldo_ena, |
2048 | GPIOF_OUT_INIT_HIGH, "WM2200 LDOENA"); | 2628 | GPIOF_OUT_INIT_HIGH, |
2629 | "WM2200 LDOENA"); | ||
2049 | if (ret < 0) { | 2630 | if (ret < 0) { |
2050 | dev_err(&i2c->dev, "Failed to request LDOENA %d: %d\n", | 2631 | dev_err(&i2c->dev, "Failed to request LDOENA %d: %d\n", |
2051 | wm2200->pdata.ldo_ena, ret); | 2632 | wm2200->pdata.ldo_ena, ret); |
@@ -2055,8 +2636,9 @@ static __devinit int wm2200_i2c_probe(struct i2c_client *i2c, | |||
2055 | } | 2636 | } |
2056 | 2637 | ||
2057 | if (wm2200->pdata.reset) { | 2638 | if (wm2200->pdata.reset) { |
2058 | ret = gpio_request_one(wm2200->pdata.reset, | 2639 | ret = devm_gpio_request_one(&i2c->dev, wm2200->pdata.reset, |
2059 | GPIOF_OUT_INIT_HIGH, "WM2200 /RESET"); | 2640 | GPIOF_OUT_INIT_HIGH, |
2641 | "WM2200 /RESET"); | ||
2060 | if (ret < 0) { | 2642 | if (ret < 0) { |
2061 | dev_err(&i2c->dev, "Failed to request /RESET %d: %d\n", | 2643 | dev_err(&i2c->dev, "Failed to request /RESET %d: %d\n", |
2062 | wm2200->pdata.reset, ret); | 2644 | wm2200->pdata.reset, ret); |
@@ -2166,23 +2748,16 @@ static __devinit int wm2200_i2c_probe(struct i2c_client *i2c, | |||
2166 | err_pm_runtime: | 2748 | err_pm_runtime: |
2167 | pm_runtime_disable(&i2c->dev); | 2749 | pm_runtime_disable(&i2c->dev); |
2168 | err_reset: | 2750 | err_reset: |
2169 | if (wm2200->pdata.reset) { | 2751 | if (wm2200->pdata.reset) |
2170 | gpio_set_value_cansleep(wm2200->pdata.reset, 0); | 2752 | gpio_set_value_cansleep(wm2200->pdata.reset, 0); |
2171 | gpio_free(wm2200->pdata.reset); | ||
2172 | } | ||
2173 | err_ldo: | 2753 | err_ldo: |
2174 | if (wm2200->pdata.ldo_ena) { | 2754 | if (wm2200->pdata.ldo_ena) |
2175 | gpio_set_value_cansleep(wm2200->pdata.ldo_ena, 0); | 2755 | gpio_set_value_cansleep(wm2200->pdata.ldo_ena, 0); |
2176 | gpio_free(wm2200->pdata.ldo_ena); | ||
2177 | } | ||
2178 | err_enable: | 2756 | err_enable: |
2179 | regulator_bulk_disable(ARRAY_SIZE(wm2200->core_supplies), | 2757 | regulator_bulk_disable(ARRAY_SIZE(wm2200->core_supplies), |
2180 | wm2200->core_supplies); | 2758 | wm2200->core_supplies); |
2181 | err_core: | 2759 | err_core: |
2182 | regulator_bulk_free(ARRAY_SIZE(wm2200->core_supplies), | ||
2183 | wm2200->core_supplies); | ||
2184 | err_regmap: | 2760 | err_regmap: |
2185 | regmap_exit(wm2200->regmap); | ||
2186 | err: | 2761 | err: |
2187 | return ret; | 2762 | return ret; |
2188 | } | 2763 | } |
@@ -2194,17 +2769,10 @@ static __devexit int wm2200_i2c_remove(struct i2c_client *i2c) | |||
2194 | snd_soc_unregister_codec(&i2c->dev); | 2769 | snd_soc_unregister_codec(&i2c->dev); |
2195 | if (i2c->irq) | 2770 | if (i2c->irq) |
2196 | free_irq(i2c->irq, wm2200); | 2771 | free_irq(i2c->irq, wm2200); |
2197 | if (wm2200->pdata.reset) { | 2772 | if (wm2200->pdata.reset) |
2198 | gpio_set_value_cansleep(wm2200->pdata.reset, 0); | 2773 | gpio_set_value_cansleep(wm2200->pdata.reset, 0); |
2199 | gpio_free(wm2200->pdata.reset); | 2774 | if (wm2200->pdata.ldo_ena) |
2200 | } | ||
2201 | if (wm2200->pdata.ldo_ena) { | ||
2202 | gpio_set_value_cansleep(wm2200->pdata.ldo_ena, 0); | 2775 | gpio_set_value_cansleep(wm2200->pdata.ldo_ena, 0); |
2203 | gpio_free(wm2200->pdata.ldo_ena); | ||
2204 | } | ||
2205 | regulator_bulk_free(ARRAY_SIZE(wm2200->core_supplies), | ||
2206 | wm2200->core_supplies); | ||
2207 | regmap_exit(wm2200->regmap); | ||
2208 | 2776 | ||
2209 | return 0; | 2777 | return 0; |
2210 | } | 2778 | } |
diff --git a/sound/soc/codecs/wm5102.c b/sound/soc/codecs/wm5102.c index 1722b586bdba..53793b1849f7 100644 --- a/sound/soc/codecs/wm5102.c +++ b/sound/soc/codecs/wm5102.c | |||
@@ -31,6 +31,7 @@ | |||
31 | 31 | ||
32 | #include "arizona.h" | 32 | #include "arizona.h" |
33 | #include "wm5102.h" | 33 | #include "wm5102.h" |
34 | #include "wm_adsp.h" | ||
34 | 35 | ||
35 | struct wm5102_priv { | 36 | struct wm5102_priv { |
36 | struct arizona_priv core; | 37 | struct arizona_priv core; |
@@ -42,6 +43,563 @@ static DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0); | |||
42 | static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0); | 43 | static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0); |
43 | static DECLARE_TLV_DB_SCALE(noise_tlv, 0, 600, 0); | 44 | static DECLARE_TLV_DB_SCALE(noise_tlv, 0, 600, 0); |
44 | 45 | ||
46 | static const struct wm_adsp_region wm5102_dsp1_regions[] = { | ||
47 | { .type = WMFW_ADSP2_PM, .base = 0x100000 }, | ||
48 | { .type = WMFW_ADSP2_ZM, .base = 0x180000 }, | ||
49 | { .type = WMFW_ADSP2_XM, .base = 0x190000 }, | ||
50 | { .type = WMFW_ADSP2_YM, .base = 0x1a8000 }, | ||
51 | }; | ||
52 | |||
53 | static const struct reg_default wm5102_sysclk_reva_patch[] = { | ||
54 | { 0x3000, 0x2225 }, | ||
55 | { 0x3001, 0x3a03 }, | ||
56 | { 0x3002, 0x0225 }, | ||
57 | { 0x3003, 0x0801 }, | ||
58 | { 0x3004, 0x6249 }, | ||
59 | { 0x3005, 0x0c04 }, | ||
60 | { 0x3006, 0x0225 }, | ||
61 | { 0x3007, 0x5901 }, | ||
62 | { 0x3008, 0xe249 }, | ||
63 | { 0x3009, 0x030d }, | ||
64 | { 0x300a, 0x0249 }, | ||
65 | { 0x300b, 0x2c01 }, | ||
66 | { 0x300c, 0xe249 }, | ||
67 | { 0x300d, 0x4342 }, | ||
68 | { 0x300e, 0xe249 }, | ||
69 | { 0x300f, 0x73c0 }, | ||
70 | { 0x3010, 0x4249 }, | ||
71 | { 0x3011, 0x0c00 }, | ||
72 | { 0x3012, 0x0225 }, | ||
73 | { 0x3013, 0x1f01 }, | ||
74 | { 0x3014, 0x0225 }, | ||
75 | { 0x3015, 0x1e01 }, | ||
76 | { 0x3016, 0x0225 }, | ||
77 | { 0x3017, 0xfa00 }, | ||
78 | { 0x3018, 0x0000 }, | ||
79 | { 0x3019, 0xf000 }, | ||
80 | { 0x301a, 0x0000 }, | ||
81 | { 0x301b, 0xf000 }, | ||
82 | { 0x301c, 0x0000 }, | ||
83 | { 0x301d, 0xf000 }, | ||
84 | { 0x301e, 0x0000 }, | ||
85 | { 0x301f, 0xf000 }, | ||
86 | { 0x3020, 0x0000 }, | ||
87 | { 0x3021, 0xf000 }, | ||
88 | { 0x3022, 0x0000 }, | ||
89 | { 0x3023, 0xf000 }, | ||
90 | { 0x3024, 0x0000 }, | ||
91 | { 0x3025, 0xf000 }, | ||
92 | { 0x3026, 0x0000 }, | ||
93 | { 0x3027, 0xf000 }, | ||
94 | { 0x3028, 0x0000 }, | ||
95 | { 0x3029, 0xf000 }, | ||
96 | { 0x302a, 0x0000 }, | ||
97 | { 0x302b, 0xf000 }, | ||
98 | { 0x302c, 0x0000 }, | ||
99 | { 0x302d, 0xf000 }, | ||
100 | { 0x302e, 0x0000 }, | ||
101 | { 0x302f, 0xf000 }, | ||
102 | { 0x3030, 0x0225 }, | ||
103 | { 0x3031, 0x1a01 }, | ||
104 | { 0x3032, 0x0225 }, | ||
105 | { 0x3033, 0x1e00 }, | ||
106 | { 0x3034, 0x0225 }, | ||
107 | { 0x3035, 0x1f00 }, | ||
108 | { 0x3036, 0x6225 }, | ||
109 | { 0x3037, 0xf800 }, | ||
110 | { 0x3038, 0x0000 }, | ||
111 | { 0x3039, 0xf000 }, | ||
112 | { 0x303a, 0x0000 }, | ||
113 | { 0x303b, 0xf000 }, | ||
114 | { 0x303c, 0x0000 }, | ||
115 | { 0x303d, 0xf000 }, | ||
116 | { 0x303e, 0x0000 }, | ||
117 | { 0x303f, 0xf000 }, | ||
118 | { 0x3040, 0x2226 }, | ||
119 | { 0x3041, 0x3a03 }, | ||
120 | { 0x3042, 0x0226 }, | ||
121 | { 0x3043, 0x0801 }, | ||
122 | { 0x3044, 0x6249 }, | ||
123 | { 0x3045, 0x0c06 }, | ||
124 | { 0x3046, 0x0226 }, | ||
125 | { 0x3047, 0x5901 }, | ||
126 | { 0x3048, 0xe249 }, | ||
127 | { 0x3049, 0x030d }, | ||
128 | { 0x304a, 0x0249 }, | ||
129 | { 0x304b, 0x2c01 }, | ||
130 | { 0x304c, 0xe249 }, | ||
131 | { 0x304d, 0x4342 }, | ||
132 | { 0x304e, 0xe249 }, | ||
133 | { 0x304f, 0x73c0 }, | ||
134 | { 0x3050, 0x4249 }, | ||
135 | { 0x3051, 0x0c00 }, | ||
136 | { 0x3052, 0x0226 }, | ||
137 | { 0x3053, 0x1f01 }, | ||
138 | { 0x3054, 0x0226 }, | ||
139 | { 0x3055, 0x1e01 }, | ||
140 | { 0x3056, 0x0226 }, | ||
141 | { 0x3057, 0xfa00 }, | ||
142 | { 0x3058, 0x0000 }, | ||
143 | { 0x3059, 0xf000 }, | ||
144 | { 0x305a, 0x0000 }, | ||
145 | { 0x305b, 0xf000 }, | ||
146 | { 0x305c, 0x0000 }, | ||
147 | { 0x305d, 0xf000 }, | ||
148 | { 0x305e, 0x0000 }, | ||
149 | { 0x305f, 0xf000 }, | ||
150 | { 0x3060, 0x0000 }, | ||
151 | { 0x3061, 0xf000 }, | ||
152 | { 0x3062, 0x0000 }, | ||
153 | { 0x3063, 0xf000 }, | ||
154 | { 0x3064, 0x0000 }, | ||
155 | { 0x3065, 0xf000 }, | ||
156 | { 0x3066, 0x0000 }, | ||
157 | { 0x3067, 0xf000 }, | ||
158 | { 0x3068, 0x0000 }, | ||
159 | { 0x3069, 0xf000 }, | ||
160 | { 0x306a, 0x0000 }, | ||
161 | { 0x306b, 0xf000 }, | ||
162 | { 0x306c, 0x0000 }, | ||
163 | { 0x306d, 0xf000 }, | ||
164 | { 0x306e, 0x0000 }, | ||
165 | { 0x306f, 0xf000 }, | ||
166 | { 0x3070, 0x0226 }, | ||
167 | { 0x3071, 0x1a01 }, | ||
168 | { 0x3072, 0x0226 }, | ||
169 | { 0x3073, 0x1e00 }, | ||
170 | { 0x3074, 0x0226 }, | ||
171 | { 0x3075, 0x1f00 }, | ||
172 | { 0x3076, 0x6226 }, | ||
173 | { 0x3077, 0xf800 }, | ||
174 | { 0x3078, 0x0000 }, | ||
175 | { 0x3079, 0xf000 }, | ||
176 | { 0x307a, 0x0000 }, | ||
177 | { 0x307b, 0xf000 }, | ||
178 | { 0x307c, 0x0000 }, | ||
179 | { 0x307d, 0xf000 }, | ||
180 | { 0x307e, 0x0000 }, | ||
181 | { 0x307f, 0xf000 }, | ||
182 | { 0x3080, 0x2227 }, | ||
183 | { 0x3081, 0x3a03 }, | ||
184 | { 0x3082, 0x0227 }, | ||
185 | { 0x3083, 0x0801 }, | ||
186 | { 0x3084, 0x6255 }, | ||
187 | { 0x3085, 0x0c04 }, | ||
188 | { 0x3086, 0x0227 }, | ||
189 | { 0x3087, 0x5901 }, | ||
190 | { 0x3088, 0xe255 }, | ||
191 | { 0x3089, 0x030d }, | ||
192 | { 0x308a, 0x0255 }, | ||
193 | { 0x308b, 0x2c01 }, | ||
194 | { 0x308c, 0xe255 }, | ||
195 | { 0x308d, 0x4342 }, | ||
196 | { 0x308e, 0xe255 }, | ||
197 | { 0x308f, 0x73c0 }, | ||
198 | { 0x3090, 0x4255 }, | ||
199 | { 0x3091, 0x0c00 }, | ||
200 | { 0x3092, 0x0227 }, | ||
201 | { 0x3093, 0x1f01 }, | ||
202 | { 0x3094, 0x0227 }, | ||
203 | { 0x3095, 0x1e01 }, | ||
204 | { 0x3096, 0x0227 }, | ||
205 | { 0x3097, 0xfa00 }, | ||
206 | { 0x3098, 0x0000 }, | ||
207 | { 0x3099, 0xf000 }, | ||
208 | { 0x309a, 0x0000 }, | ||
209 | { 0x309b, 0xf000 }, | ||
210 | { 0x309c, 0x0000 }, | ||
211 | { 0x309d, 0xf000 }, | ||
212 | { 0x309e, 0x0000 }, | ||
213 | { 0x309f, 0xf000 }, | ||
214 | { 0x30a0, 0x0000 }, | ||
215 | { 0x30a1, 0xf000 }, | ||
216 | { 0x30a2, 0x0000 }, | ||
217 | { 0x30a3, 0xf000 }, | ||
218 | { 0x30a4, 0x0000 }, | ||
219 | { 0x30a5, 0xf000 }, | ||
220 | { 0x30a6, 0x0000 }, | ||
221 | { 0x30a7, 0xf000 }, | ||
222 | { 0x30a8, 0x0000 }, | ||
223 | { 0x30a9, 0xf000 }, | ||
224 | { 0x30aa, 0x0000 }, | ||
225 | { 0x30ab, 0xf000 }, | ||
226 | { 0x30ac, 0x0000 }, | ||
227 | { 0x30ad, 0xf000 }, | ||
228 | { 0x30ae, 0x0000 }, | ||
229 | { 0x30af, 0xf000 }, | ||
230 | { 0x30b0, 0x0227 }, | ||
231 | { 0x30b1, 0x1a01 }, | ||
232 | { 0x30b2, 0x0227 }, | ||
233 | { 0x30b3, 0x1e00 }, | ||
234 | { 0x30b4, 0x0227 }, | ||
235 | { 0x30b5, 0x1f00 }, | ||
236 | { 0x30b6, 0x6227 }, | ||
237 | { 0x30b7, 0xf800 }, | ||
238 | { 0x30b8, 0x0000 }, | ||
239 | { 0x30b9, 0xf000 }, | ||
240 | { 0x30ba, 0x0000 }, | ||
241 | { 0x30bb, 0xf000 }, | ||
242 | { 0x30bc, 0x0000 }, | ||
243 | { 0x30bd, 0xf000 }, | ||
244 | { 0x30be, 0x0000 }, | ||
245 | { 0x30bf, 0xf000 }, | ||
246 | { 0x30c0, 0x2228 }, | ||
247 | { 0x30c1, 0x3a03 }, | ||
248 | { 0x30c2, 0x0228 }, | ||
249 | { 0x30c3, 0x0801 }, | ||
250 | { 0x30c4, 0x6255 }, | ||
251 | { 0x30c5, 0x0c06 }, | ||
252 | { 0x30c6, 0x0228 }, | ||
253 | { 0x30c7, 0x5901 }, | ||
254 | { 0x30c8, 0xe255 }, | ||
255 | { 0x30c9, 0x030d }, | ||
256 | { 0x30ca, 0x0255 }, | ||
257 | { 0x30cb, 0x2c01 }, | ||
258 | { 0x30cc, 0xe255 }, | ||
259 | { 0x30cd, 0x4342 }, | ||
260 | { 0x30ce, 0xe255 }, | ||
261 | { 0x30cf, 0x73c0 }, | ||
262 | { 0x30d0, 0x4255 }, | ||
263 | { 0x30d1, 0x0c00 }, | ||
264 | { 0x30d2, 0x0228 }, | ||
265 | { 0x30d3, 0x1f01 }, | ||
266 | { 0x30d4, 0x0228 }, | ||
267 | { 0x30d5, 0x1e01 }, | ||
268 | { 0x30d6, 0x0228 }, | ||
269 | { 0x30d7, 0xfa00 }, | ||
270 | { 0x30d8, 0x0000 }, | ||
271 | { 0x30d9, 0xf000 }, | ||
272 | { 0x30da, 0x0000 }, | ||
273 | { 0x30db, 0xf000 }, | ||
274 | { 0x30dc, 0x0000 }, | ||
275 | { 0x30dd, 0xf000 }, | ||
276 | { 0x30de, 0x0000 }, | ||
277 | { 0x30df, 0xf000 }, | ||
278 | { 0x30e0, 0x0000 }, | ||
279 | { 0x30e1, 0xf000 }, | ||
280 | { 0x30e2, 0x0000 }, | ||
281 | { 0x30e3, 0xf000 }, | ||
282 | { 0x30e4, 0x0000 }, | ||
283 | { 0x30e5, 0xf000 }, | ||
284 | { 0x30e6, 0x0000 }, | ||
285 | { 0x30e7, 0xf000 }, | ||
286 | { 0x30e8, 0x0000 }, | ||
287 | { 0x30e9, 0xf000 }, | ||
288 | { 0x30ea, 0x0000 }, | ||
289 | { 0x30eb, 0xf000 }, | ||
290 | { 0x30ec, 0x0000 }, | ||
291 | { 0x30ed, 0xf000 }, | ||
292 | { 0x30ee, 0x0000 }, | ||
293 | { 0x30ef, 0xf000 }, | ||
294 | { 0x30f0, 0x0228 }, | ||
295 | { 0x30f1, 0x1a01 }, | ||
296 | { 0x30f2, 0x0228 }, | ||
297 | { 0x30f3, 0x1e00 }, | ||
298 | { 0x30f4, 0x0228 }, | ||
299 | { 0x30f5, 0x1f00 }, | ||
300 | { 0x30f6, 0x6228 }, | ||
301 | { 0x30f7, 0xf800 }, | ||
302 | { 0x30f8, 0x0000 }, | ||
303 | { 0x30f9, 0xf000 }, | ||
304 | { 0x30fa, 0x0000 }, | ||
305 | { 0x30fb, 0xf000 }, | ||
306 | { 0x30fc, 0x0000 }, | ||
307 | { 0x30fd, 0xf000 }, | ||
308 | { 0x30fe, 0x0000 }, | ||
309 | { 0x30ff, 0xf000 }, | ||
310 | { 0x3100, 0x222b }, | ||
311 | { 0x3101, 0x3a03 }, | ||
312 | { 0x3102, 0x222b }, | ||
313 | { 0x3103, 0x5803 }, | ||
314 | { 0x3104, 0xe26f }, | ||
315 | { 0x3105, 0x030d }, | ||
316 | { 0x3106, 0x626f }, | ||
317 | { 0x3107, 0x2c01 }, | ||
318 | { 0x3108, 0xe26f }, | ||
319 | { 0x3109, 0x4342 }, | ||
320 | { 0x310a, 0xe26f }, | ||
321 | { 0x310b, 0x73c0 }, | ||
322 | { 0x310c, 0x026f }, | ||
323 | { 0x310d, 0x0c00 }, | ||
324 | { 0x310e, 0x022b }, | ||
325 | { 0x310f, 0x1f01 }, | ||
326 | { 0x3110, 0x022b }, | ||
327 | { 0x3111, 0x1e01 }, | ||
328 | { 0x3112, 0x022b }, | ||
329 | { 0x3113, 0xfa00 }, | ||
330 | { 0x3114, 0x0000 }, | ||
331 | { 0x3115, 0xf000 }, | ||
332 | { 0x3116, 0x0000 }, | ||
333 | { 0x3117, 0xf000 }, | ||
334 | { 0x3118, 0x0000 }, | ||
335 | { 0x3119, 0xf000 }, | ||
336 | { 0x311a, 0x0000 }, | ||
337 | { 0x311b, 0xf000 }, | ||
338 | { 0x311c, 0x0000 }, | ||
339 | { 0x311d, 0xf000 }, | ||
340 | { 0x311e, 0x0000 }, | ||
341 | { 0x311f, 0xf000 }, | ||
342 | { 0x3120, 0x022b }, | ||
343 | { 0x3121, 0x0a01 }, | ||
344 | { 0x3122, 0x022b }, | ||
345 | { 0x3123, 0x1e00 }, | ||
346 | { 0x3124, 0x022b }, | ||
347 | { 0x3125, 0x1f00 }, | ||
348 | { 0x3126, 0x622b }, | ||
349 | { 0x3127, 0xf800 }, | ||
350 | { 0x3128, 0x0000 }, | ||
351 | { 0x3129, 0xf000 }, | ||
352 | { 0x312a, 0x0000 }, | ||
353 | { 0x312b, 0xf000 }, | ||
354 | { 0x312c, 0x0000 }, | ||
355 | { 0x312d, 0xf000 }, | ||
356 | { 0x312e, 0x0000 }, | ||
357 | { 0x312f, 0xf000 }, | ||
358 | { 0x3130, 0x0000 }, | ||
359 | { 0x3131, 0xf000 }, | ||
360 | { 0x3132, 0x0000 }, | ||
361 | { 0x3133, 0xf000 }, | ||
362 | { 0x3134, 0x0000 }, | ||
363 | { 0x3135, 0xf000 }, | ||
364 | { 0x3136, 0x0000 }, | ||
365 | { 0x3137, 0xf000 }, | ||
366 | { 0x3138, 0x0000 }, | ||
367 | { 0x3139, 0xf000 }, | ||
368 | { 0x313a, 0x0000 }, | ||
369 | { 0x313b, 0xf000 }, | ||
370 | { 0x313c, 0x0000 }, | ||
371 | { 0x313d, 0xf000 }, | ||
372 | { 0x313e, 0x0000 }, | ||
373 | { 0x313f, 0xf000 }, | ||
374 | { 0x3140, 0x0000 }, | ||
375 | { 0x3141, 0xf000 }, | ||
376 | { 0x3142, 0x0000 }, | ||
377 | { 0x3143, 0xf000 }, | ||
378 | { 0x3144, 0x0000 }, | ||
379 | { 0x3145, 0xf000 }, | ||
380 | { 0x3146, 0x0000 }, | ||
381 | { 0x3147, 0xf000 }, | ||
382 | { 0x3148, 0x0000 }, | ||
383 | { 0x3149, 0xf000 }, | ||
384 | { 0x314a, 0x0000 }, | ||
385 | { 0x314b, 0xf000 }, | ||
386 | { 0x314c, 0x0000 }, | ||
387 | { 0x314d, 0xf000 }, | ||
388 | { 0x314e, 0x0000 }, | ||
389 | { 0x314f, 0xf000 }, | ||
390 | { 0x3150, 0x0000 }, | ||
391 | { 0x3151, 0xf000 }, | ||
392 | { 0x3152, 0x0000 }, | ||
393 | { 0x3153, 0xf000 }, | ||
394 | { 0x3154, 0x0000 }, | ||
395 | { 0x3155, 0xf000 }, | ||
396 | { 0x3156, 0x0000 }, | ||
397 | { 0x3157, 0xf000 }, | ||
398 | { 0x3158, 0x0000 }, | ||
399 | { 0x3159, 0xf000 }, | ||
400 | { 0x315a, 0x0000 }, | ||
401 | { 0x315b, 0xf000 }, | ||
402 | { 0x315c, 0x0000 }, | ||
403 | { 0x315d, 0xf000 }, | ||
404 | { 0x315e, 0x0000 }, | ||
405 | { 0x315f, 0xf000 }, | ||
406 | { 0x3160, 0x0000 }, | ||
407 | { 0x3161, 0xf000 }, | ||
408 | { 0x3162, 0x0000 }, | ||
409 | { 0x3163, 0xf000 }, | ||
410 | { 0x3164, 0x0000 }, | ||
411 | { 0x3165, 0xf000 }, | ||
412 | { 0x3166, 0x0000 }, | ||
413 | { 0x3167, 0xf000 }, | ||
414 | { 0x3168, 0x0000 }, | ||
415 | { 0x3169, 0xf000 }, | ||
416 | { 0x316a, 0x0000 }, | ||
417 | { 0x316b, 0xf000 }, | ||
418 | { 0x316c, 0x0000 }, | ||
419 | { 0x316d, 0xf000 }, | ||
420 | { 0x316e, 0x0000 }, | ||
421 | { 0x316f, 0xf000 }, | ||
422 | { 0x3170, 0x0000 }, | ||
423 | { 0x3171, 0xf000 }, | ||
424 | { 0x3172, 0x0000 }, | ||
425 | { 0x3173, 0xf000 }, | ||
426 | { 0x3174, 0x0000 }, | ||
427 | { 0x3175, 0xf000 }, | ||
428 | { 0x3176, 0x0000 }, | ||
429 | { 0x3177, 0xf000 }, | ||
430 | { 0x3178, 0x0000 }, | ||
431 | { 0x3179, 0xf000 }, | ||
432 | { 0x317a, 0x0000 }, | ||
433 | { 0x317b, 0xf000 }, | ||
434 | { 0x317c, 0x0000 }, | ||
435 | { 0x317d, 0xf000 }, | ||
436 | { 0x317e, 0x0000 }, | ||
437 | { 0x317f, 0xf000 }, | ||
438 | { 0x3180, 0x2001 }, | ||
439 | { 0x3181, 0xf101 }, | ||
440 | { 0x3182, 0x0000 }, | ||
441 | { 0x3183, 0xf000 }, | ||
442 | { 0x3184, 0x0000 }, | ||
443 | { 0x3185, 0xf000 }, | ||
444 | { 0x3186, 0x0000 }, | ||
445 | { 0x3187, 0xf000 }, | ||
446 | { 0x3188, 0x0000 }, | ||
447 | { 0x3189, 0xf000 }, | ||
448 | { 0x318a, 0x0000 }, | ||
449 | { 0x318b, 0xf000 }, | ||
450 | { 0x318c, 0x0000 }, | ||
451 | { 0x318d, 0xf000 }, | ||
452 | { 0x318e, 0x0000 }, | ||
453 | { 0x318f, 0xf000 }, | ||
454 | { 0x3190, 0x0000 }, | ||
455 | { 0x3191, 0xf000 }, | ||
456 | { 0x3192, 0x0000 }, | ||
457 | { 0x3193, 0xf000 }, | ||
458 | { 0x3194, 0x0000 }, | ||
459 | { 0x3195, 0xf000 }, | ||
460 | { 0x3196, 0x0000 }, | ||
461 | { 0x3197, 0xf000 }, | ||
462 | { 0x3198, 0x0000 }, | ||
463 | { 0x3199, 0xf000 }, | ||
464 | { 0x319a, 0x0000 }, | ||
465 | { 0x319b, 0xf000 }, | ||
466 | { 0x319c, 0x0000 }, | ||
467 | { 0x319d, 0xf000 }, | ||
468 | { 0x319e, 0x0000 }, | ||
469 | { 0x319f, 0xf000 }, | ||
470 | { 0x31a0, 0x0000 }, | ||
471 | { 0x31a1, 0xf000 }, | ||
472 | { 0x31a2, 0x0000 }, | ||
473 | { 0x31a3, 0xf000 }, | ||
474 | { 0x31a4, 0x0000 }, | ||
475 | { 0x31a5, 0xf000 }, | ||
476 | { 0x31a6, 0x0000 }, | ||
477 | { 0x31a7, 0xf000 }, | ||
478 | { 0x31a8, 0x0000 }, | ||
479 | { 0x31a9, 0xf000 }, | ||
480 | { 0x31aa, 0x0000 }, | ||
481 | { 0x31ab, 0xf000 }, | ||
482 | { 0x31ac, 0x0000 }, | ||
483 | { 0x31ad, 0xf000 }, | ||
484 | { 0x31ae, 0x0000 }, | ||
485 | { 0x31af, 0xf000 }, | ||
486 | { 0x31b0, 0x0000 }, | ||
487 | { 0x31b1, 0xf000 }, | ||
488 | { 0x31b2, 0x0000 }, | ||
489 | { 0x31b3, 0xf000 }, | ||
490 | { 0x31b4, 0x0000 }, | ||
491 | { 0x31b5, 0xf000 }, | ||
492 | { 0x31b6, 0x0000 }, | ||
493 | { 0x31b7, 0xf000 }, | ||
494 | { 0x31b8, 0x0000 }, | ||
495 | { 0x31b9, 0xf000 }, | ||
496 | { 0x31ba, 0x0000 }, | ||
497 | { 0x31bb, 0xf000 }, | ||
498 | { 0x31bc, 0x0000 }, | ||
499 | { 0x31bd, 0xf000 }, | ||
500 | { 0x31be, 0x0000 }, | ||
501 | { 0x31bf, 0xf000 }, | ||
502 | { 0x31c0, 0x0000 }, | ||
503 | { 0x31c1, 0xf000 }, | ||
504 | { 0x31c2, 0x0000 }, | ||
505 | { 0x31c3, 0xf000 }, | ||
506 | { 0x31c4, 0x0000 }, | ||
507 | { 0x31c5, 0xf000 }, | ||
508 | { 0x31c6, 0x0000 }, | ||
509 | { 0x31c7, 0xf000 }, | ||
510 | { 0x31c8, 0x0000 }, | ||
511 | { 0x31c9, 0xf000 }, | ||
512 | { 0x31ca, 0x0000 }, | ||
513 | { 0x31cb, 0xf000 }, | ||
514 | { 0x31cc, 0x0000 }, | ||
515 | { 0x31cd, 0xf000 }, | ||
516 | { 0x31ce, 0x0000 }, | ||
517 | { 0x31cf, 0xf000 }, | ||
518 | { 0x31d0, 0x0000 }, | ||
519 | { 0x31d1, 0xf000 }, | ||
520 | { 0x31d2, 0x0000 }, | ||
521 | { 0x31d3, 0xf000 }, | ||
522 | { 0x31d4, 0x0000 }, | ||
523 | { 0x31d5, 0xf000 }, | ||
524 | { 0x31d6, 0x0000 }, | ||
525 | { 0x31d7, 0xf000 }, | ||
526 | { 0x31d8, 0x0000 }, | ||
527 | { 0x31d9, 0xf000 }, | ||
528 | { 0x31da, 0x0000 }, | ||
529 | { 0x31db, 0xf000 }, | ||
530 | { 0x31dc, 0x0000 }, | ||
531 | { 0x31dd, 0xf000 }, | ||
532 | { 0x31de, 0x0000 }, | ||
533 | { 0x31df, 0xf000 }, | ||
534 | { 0x31e0, 0x0000 }, | ||
535 | { 0x31e1, 0xf000 }, | ||
536 | { 0x31e2, 0x0000 }, | ||
537 | { 0x31e3, 0xf000 }, | ||
538 | { 0x31e4, 0x0000 }, | ||
539 | { 0x31e5, 0xf000 }, | ||
540 | { 0x31e6, 0x0000 }, | ||
541 | { 0x31e7, 0xf000 }, | ||
542 | { 0x31e8, 0x0000 }, | ||
543 | { 0x31e9, 0xf000 }, | ||
544 | { 0x31ea, 0x0000 }, | ||
545 | { 0x31eb, 0xf000 }, | ||
546 | { 0x31ec, 0x0000 }, | ||
547 | { 0x31ed, 0xf000 }, | ||
548 | { 0x31ee, 0x0000 }, | ||
549 | { 0x31ef, 0xf000 }, | ||
550 | { 0x31f0, 0x0000 }, | ||
551 | { 0x31f1, 0xf000 }, | ||
552 | { 0x31f2, 0x0000 }, | ||
553 | { 0x31f3, 0xf000 }, | ||
554 | { 0x31f4, 0x0000 }, | ||
555 | { 0x31f5, 0xf000 }, | ||
556 | { 0x31f6, 0x0000 }, | ||
557 | { 0x31f7, 0xf000 }, | ||
558 | { 0x31f8, 0x0000 }, | ||
559 | { 0x31f9, 0xf000 }, | ||
560 | { 0x31fa, 0x0000 }, | ||
561 | { 0x31fb, 0xf000 }, | ||
562 | { 0x31fc, 0x0000 }, | ||
563 | { 0x31fd, 0xf000 }, | ||
564 | { 0x31fe, 0x0000 }, | ||
565 | { 0x31ff, 0xf000 }, | ||
566 | { 0x024d, 0xff50 }, | ||
567 | { 0x0252, 0xff50 }, | ||
568 | { 0x0259, 0x0112 }, | ||
569 | { 0x025e, 0x0112 }, | ||
570 | }; | ||
571 | |||
572 | static int wm5102_sysclk_ev(struct snd_soc_dapm_widget *w, | ||
573 | struct snd_kcontrol *kcontrol, int event) | ||
574 | { | ||
575 | struct snd_soc_codec *codec = w->codec; | ||
576 | struct arizona *arizona = dev_get_drvdata(codec->dev); | ||
577 | struct regmap *regmap = codec->control_data; | ||
578 | const struct reg_default *patch = NULL; | ||
579 | int i, patch_size; | ||
580 | |||
581 | switch (arizona->rev) { | ||
582 | case 0: | ||
583 | patch = wm5102_sysclk_reva_patch; | ||
584 | patch_size = ARRAY_SIZE(wm5102_sysclk_reva_patch); | ||
585 | break; | ||
586 | } | ||
587 | |||
588 | switch (event) { | ||
589 | case SND_SOC_DAPM_POST_PMU: | ||
590 | if (patch) | ||
591 | for (i = 0; i < patch_size; i++) | ||
592 | regmap_write(regmap, patch[i].reg, | ||
593 | patch[i].def); | ||
594 | break; | ||
595 | |||
596 | default: | ||
597 | break; | ||
598 | } | ||
599 | |||
600 | return 0; | ||
601 | } | ||
602 | |||
45 | static const struct snd_kcontrol_new wm5102_snd_controls[] = { | 603 | static const struct snd_kcontrol_new wm5102_snd_controls[] = { |
46 | SOC_SINGLE("IN1 High Performance Switch", ARIZONA_IN1L_CONTROL, | 604 | SOC_SINGLE("IN1 High Performance Switch", ARIZONA_IN1L_CONTROL, |
47 | ARIZONA_IN1_OSR_SHIFT, 1, 0), | 605 | ARIZONA_IN1_OSR_SHIFT, 1, 0), |
@@ -137,6 +695,9 @@ ARIZONA_MIXER_CONTROLS("LHPF2", ARIZONA_HPLP2MIX_INPUT_1_SOURCE), | |||
137 | ARIZONA_MIXER_CONTROLS("LHPF3", ARIZONA_HPLP3MIX_INPUT_1_SOURCE), | 695 | ARIZONA_MIXER_CONTROLS("LHPF3", ARIZONA_HPLP3MIX_INPUT_1_SOURCE), |
138 | ARIZONA_MIXER_CONTROLS("LHPF4", ARIZONA_HPLP4MIX_INPUT_1_SOURCE), | 696 | ARIZONA_MIXER_CONTROLS("LHPF4", ARIZONA_HPLP4MIX_INPUT_1_SOURCE), |
139 | 697 | ||
698 | ARIZONA_MIXER_CONTROLS("DSP1L", ARIZONA_DSP1LMIX_INPUT_1_SOURCE), | ||
699 | ARIZONA_MIXER_CONTROLS("DSP1R", ARIZONA_DSP1RMIX_INPUT_1_SOURCE), | ||
700 | |||
140 | SOC_ENUM("LHPF1 Mode", arizona_lhpf1_mode), | 701 | SOC_ENUM("LHPF1 Mode", arizona_lhpf1_mode), |
141 | SOC_ENUM("LHPF2 Mode", arizona_lhpf2_mode), | 702 | SOC_ENUM("LHPF2 Mode", arizona_lhpf2_mode), |
142 | SOC_ENUM("LHPF3 Mode", arizona_lhpf3_mode), | 703 | SOC_ENUM("LHPF3 Mode", arizona_lhpf3_mode), |
@@ -158,14 +719,6 @@ ARIZONA_MIXER_CONTROLS("SPKOUTR", ARIZONA_OUT4RMIX_INPUT_1_SOURCE), | |||
158 | ARIZONA_MIXER_CONTROLS("SPKDAT1L", ARIZONA_OUT5LMIX_INPUT_1_SOURCE), | 719 | ARIZONA_MIXER_CONTROLS("SPKDAT1L", ARIZONA_OUT5LMIX_INPUT_1_SOURCE), |
159 | ARIZONA_MIXER_CONTROLS("SPKDAT1R", ARIZONA_OUT5RMIX_INPUT_1_SOURCE), | 720 | ARIZONA_MIXER_CONTROLS("SPKDAT1R", ARIZONA_OUT5RMIX_INPUT_1_SOURCE), |
160 | 721 | ||
161 | SOC_SINGLE("HPOUT1 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_1L, | ||
162 | ARIZONA_OUT1_OSR_SHIFT, 1, 0), | ||
163 | SOC_SINGLE("OUT2 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_2L, | ||
164 | ARIZONA_OUT2_OSR_SHIFT, 1, 0), | ||
165 | SOC_SINGLE("EPOUT High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_3L, | ||
166 | ARIZONA_OUT3_OSR_SHIFT, 1, 0), | ||
167 | SOC_SINGLE("Speaker High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_4L, | ||
168 | ARIZONA_OUT4_OSR_SHIFT, 1, 0), | ||
169 | SOC_SINGLE("SPKDAT1 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_5L, | 722 | SOC_SINGLE("SPKDAT1 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_5L, |
170 | ARIZONA_OUT5_OSR_SHIFT, 1, 0), | 723 | ARIZONA_OUT5_OSR_SHIFT, 1, 0), |
171 | 724 | ||
@@ -195,17 +748,6 @@ SOC_DOUBLE_R_TLV("SPKDAT1 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_5L, | |||
195 | ARIZONA_DAC_DIGITAL_VOLUME_5R, ARIZONA_OUT5L_VOL_SHIFT, | 748 | ARIZONA_DAC_DIGITAL_VOLUME_5R, ARIZONA_OUT5L_VOL_SHIFT, |
196 | 0xbf, 0, digital_tlv), | 749 | 0xbf, 0, digital_tlv), |
197 | 750 | ||
198 | SOC_DOUBLE_R_RANGE_TLV("HPOUT1 Volume", ARIZONA_OUTPUT_PATH_CONFIG_1L, | ||
199 | ARIZONA_OUTPUT_PATH_CONFIG_1R, | ||
200 | ARIZONA_OUT1L_PGA_VOL_SHIFT, | ||
201 | 0x34, 0x40, 0, ana_tlv), | ||
202 | SOC_DOUBLE_R_RANGE_TLV("OUT2 Volume", ARIZONA_OUTPUT_PATH_CONFIG_2L, | ||
203 | ARIZONA_OUTPUT_PATH_CONFIG_2R, | ||
204 | ARIZONA_OUT2L_PGA_VOL_SHIFT, | ||
205 | 0x34, 0x40, 0, ana_tlv), | ||
206 | SOC_SINGLE_RANGE_TLV("EPOUT Volume", ARIZONA_OUTPUT_PATH_CONFIG_3L, | ||
207 | ARIZONA_OUT3L_PGA_VOL_SHIFT, 0x34, 0x40, 0, ana_tlv), | ||
208 | |||
209 | SOC_DOUBLE("SPKDAT1 Switch", ARIZONA_PDM_SPK1_CTRL_1, ARIZONA_SPK1L_MUTE_SHIFT, | 751 | SOC_DOUBLE("SPKDAT1 Switch", ARIZONA_PDM_SPK1_CTRL_1, ARIZONA_SPK1L_MUTE_SHIFT, |
210 | ARIZONA_SPK1R_MUTE_SHIFT, 1, 1), | 752 | ARIZONA_SPK1R_MUTE_SHIFT, 1, 1), |
211 | 753 | ||
@@ -269,11 +811,15 @@ ARIZONA_MIXER_ENUMS(AIF2TX2, ARIZONA_AIF2TX2MIX_INPUT_1_SOURCE); | |||
269 | ARIZONA_MIXER_ENUMS(AIF3TX1, ARIZONA_AIF3TX1MIX_INPUT_1_SOURCE); | 811 | ARIZONA_MIXER_ENUMS(AIF3TX1, ARIZONA_AIF3TX1MIX_INPUT_1_SOURCE); |
270 | ARIZONA_MIXER_ENUMS(AIF3TX2, ARIZONA_AIF3TX2MIX_INPUT_1_SOURCE); | 812 | ARIZONA_MIXER_ENUMS(AIF3TX2, ARIZONA_AIF3TX2MIX_INPUT_1_SOURCE); |
271 | 813 | ||
272 | ARIZONA_MIXER_ENUMS(ASRC1L, ARIZONA_ASRC1LMIX_INPUT_1_SOURCE); | 814 | ARIZONA_MUX_ENUMS(ASRC1L, ARIZONA_ASRC1LMIX_INPUT_1_SOURCE); |
273 | ARIZONA_MIXER_ENUMS(ASRC1R, ARIZONA_ASRC1RMIX_INPUT_1_SOURCE); | 815 | ARIZONA_MUX_ENUMS(ASRC1R, ARIZONA_ASRC1RMIX_INPUT_1_SOURCE); |
274 | ARIZONA_MIXER_ENUMS(ASRC2L, ARIZONA_ASRC2LMIX_INPUT_1_SOURCE); | 816 | ARIZONA_MUX_ENUMS(ASRC2L, ARIZONA_ASRC2LMIX_INPUT_1_SOURCE); |
275 | ARIZONA_MIXER_ENUMS(ASRC2R, ARIZONA_ASRC2RMIX_INPUT_1_SOURCE); | 817 | ARIZONA_MUX_ENUMS(ASRC2R, ARIZONA_ASRC2RMIX_INPUT_1_SOURCE); |
276 | 818 | ||
819 | ARIZONA_MIXER_ENUMS(DSP1L, ARIZONA_DSP1LMIX_INPUT_1_SOURCE); | ||
820 | ARIZONA_MIXER_ENUMS(DSP1R, ARIZONA_DSP1RMIX_INPUT_1_SOURCE); | ||
821 | |||
822 | ARIZONA_DSP_AUX_ENUMS(DSP1, ARIZONA_DSP1AUX1MIX_INPUT_1_SOURCE); | ||
277 | 823 | ||
278 | static const char *wm5102_aec_loopback_texts[] = { | 824 | static const char *wm5102_aec_loopback_texts[] = { |
279 | "HPOUT1L", "HPOUT1R", "HPOUT2L", "HPOUT2R", "EPOUT", | 825 | "HPOUT1L", "HPOUT1R", "HPOUT2L", "HPOUT2R", "EPOUT", |
@@ -297,7 +843,7 @@ static const struct snd_kcontrol_new wm5102_aec_loopback_mux = | |||
297 | 843 | ||
298 | static const struct snd_soc_dapm_widget wm5102_dapm_widgets[] = { | 844 | static const struct snd_soc_dapm_widget wm5102_dapm_widgets[] = { |
299 | SND_SOC_DAPM_SUPPLY("SYSCLK", ARIZONA_SYSTEM_CLOCK_1, ARIZONA_SYSCLK_ENA_SHIFT, | 845 | SND_SOC_DAPM_SUPPLY("SYSCLK", ARIZONA_SYSTEM_CLOCK_1, ARIZONA_SYSCLK_ENA_SHIFT, |
300 | 0, NULL, 0), | 846 | 0, wm5102_sysclk_ev, SND_SOC_DAPM_POST_PMU), |
301 | SND_SOC_DAPM_SUPPLY("ASYNCCLK", ARIZONA_ASYNC_CLOCK_1, | 847 | SND_SOC_DAPM_SUPPLY("ASYNCCLK", ARIZONA_ASYNC_CLOCK_1, |
302 | ARIZONA_ASYNC_CLK_ENA_SHIFT, 0, NULL, 0), | 848 | ARIZONA_ASYNC_CLK_ENA_SHIFT, 0, NULL, 0), |
303 | SND_SOC_DAPM_SUPPLY("OPCLK", ARIZONA_OUTPUT_SYSTEM_CLOCK, | 849 | SND_SOC_DAPM_SUPPLY("OPCLK", ARIZONA_OUTPUT_SYSTEM_CLOCK, |
@@ -314,6 +860,7 @@ SND_SOC_DAPM_REGULATOR_SUPPLY("SPKVDDR", 0, 0), | |||
314 | 860 | ||
315 | SND_SOC_DAPM_SIGGEN("TONE"), | 861 | SND_SOC_DAPM_SIGGEN("TONE"), |
316 | SND_SOC_DAPM_SIGGEN("NOISE"), | 862 | SND_SOC_DAPM_SIGGEN("NOISE"), |
863 | SND_SOC_DAPM_SIGGEN("HAPTICS"), | ||
317 | 864 | ||
318 | SND_SOC_DAPM_INPUT("IN1L"), | 865 | SND_SOC_DAPM_INPUT("IN1L"), |
319 | SND_SOC_DAPM_INPUT("IN1R"), | 866 | SND_SOC_DAPM_INPUT("IN1R"), |
@@ -344,9 +891,9 @@ SND_SOC_DAPM_PGA_E("IN3R PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN3R_ENA_SHIFT, | |||
344 | SND_SOC_DAPM_SUPPLY("MICBIAS1", ARIZONA_MIC_BIAS_CTRL_1, | 891 | SND_SOC_DAPM_SUPPLY("MICBIAS1", ARIZONA_MIC_BIAS_CTRL_1, |
345 | ARIZONA_MICB1_ENA_SHIFT, 0, NULL, 0), | 892 | ARIZONA_MICB1_ENA_SHIFT, 0, NULL, 0), |
346 | SND_SOC_DAPM_SUPPLY("MICBIAS2", ARIZONA_MIC_BIAS_CTRL_2, | 893 | SND_SOC_DAPM_SUPPLY("MICBIAS2", ARIZONA_MIC_BIAS_CTRL_2, |
347 | ARIZONA_MICB1_ENA_SHIFT, 0, NULL, 0), | 894 | ARIZONA_MICB2_ENA_SHIFT, 0, NULL, 0), |
348 | SND_SOC_DAPM_SUPPLY("MICBIAS3", ARIZONA_MIC_BIAS_CTRL_3, | 895 | SND_SOC_DAPM_SUPPLY("MICBIAS3", ARIZONA_MIC_BIAS_CTRL_3, |
349 | ARIZONA_MICB1_ENA_SHIFT, 0, NULL, 0), | 896 | ARIZONA_MICB3_ENA_SHIFT, 0, NULL, 0), |
350 | 897 | ||
351 | SND_SOC_DAPM_PGA("Noise Generator", ARIZONA_COMFORT_NOISE_GENERATOR, | 898 | SND_SOC_DAPM_PGA("Noise Generator", ARIZONA_COMFORT_NOISE_GENERATOR, |
352 | ARIZONA_NOISE_GEN_ENA_SHIFT, 0, NULL, 0), | 899 | ARIZONA_NOISE_GEN_ENA_SHIFT, 0, NULL, 0), |
@@ -446,6 +993,8 @@ SND_SOC_DAPM_AIF_IN("AIF3RX1", NULL, 0, | |||
446 | SND_SOC_DAPM_AIF_IN("AIF3RX2", NULL, 0, | 993 | SND_SOC_DAPM_AIF_IN("AIF3RX2", NULL, 0, |
447 | ARIZONA_AIF3_RX_ENABLES, ARIZONA_AIF3RX2_ENA_SHIFT, 0), | 994 | ARIZONA_AIF3_RX_ENABLES, ARIZONA_AIF3RX2_ENA_SHIFT, 0), |
448 | 995 | ||
996 | ARIZONA_DSP_WIDGETS(DSP1, "DSP1"), | ||
997 | |||
449 | SND_SOC_DAPM_VALUE_MUX("AEC Loopback", ARIZONA_DAC_AEC_CONTROL_1, | 998 | SND_SOC_DAPM_VALUE_MUX("AEC Loopback", ARIZONA_DAC_AEC_CONTROL_1, |
450 | ARIZONA_AEC_LOOPBACK_ENA, 0, &wm5102_aec_loopback_mux), | 999 | ARIZONA_AEC_LOOPBACK_ENA, 0, &wm5102_aec_loopback_mux), |
451 | 1000 | ||
@@ -521,10 +1070,12 @@ ARIZONA_MIXER_WIDGETS(AIF2TX2, "AIF2TX2"), | |||
521 | ARIZONA_MIXER_WIDGETS(AIF3TX1, "AIF3TX1"), | 1070 | ARIZONA_MIXER_WIDGETS(AIF3TX1, "AIF3TX1"), |
522 | ARIZONA_MIXER_WIDGETS(AIF3TX2, "AIF3TX2"), | 1071 | ARIZONA_MIXER_WIDGETS(AIF3TX2, "AIF3TX2"), |
523 | 1072 | ||
524 | ARIZONA_MIXER_WIDGETS(ASRC1L, "ASRC1L"), | 1073 | ARIZONA_MUX_WIDGETS(ASRC1L, "ASRC1L"), |
525 | ARIZONA_MIXER_WIDGETS(ASRC1R, "ASRC1R"), | 1074 | ARIZONA_MUX_WIDGETS(ASRC1R, "ASRC1R"), |
526 | ARIZONA_MIXER_WIDGETS(ASRC2L, "ASRC2L"), | 1075 | ARIZONA_MUX_WIDGETS(ASRC2L, "ASRC2L"), |
527 | ARIZONA_MIXER_WIDGETS(ASRC2R, "ASRC2R"), | 1076 | ARIZONA_MUX_WIDGETS(ASRC2R, "ASRC2R"), |
1077 | |||
1078 | WM_ADSP2("DSP1", 0), | ||
528 | 1079 | ||
529 | SND_SOC_DAPM_OUTPUT("HPOUT1L"), | 1080 | SND_SOC_DAPM_OUTPUT("HPOUT1L"), |
530 | SND_SOC_DAPM_OUTPUT("HPOUT1R"), | 1081 | SND_SOC_DAPM_OUTPUT("HPOUT1R"), |
@@ -544,6 +1095,7 @@ SND_SOC_DAPM_OUTPUT("SPKDAT1R"), | |||
544 | { name, "Noise Generator", "Noise Generator" }, \ | 1095 | { name, "Noise Generator", "Noise Generator" }, \ |
545 | { name, "Tone Generator 1", "Tone Generator 1" }, \ | 1096 | { name, "Tone Generator 1", "Tone Generator 1" }, \ |
546 | { name, "Tone Generator 2", "Tone Generator 2" }, \ | 1097 | { name, "Tone Generator 2", "Tone Generator 2" }, \ |
1098 | { name, "Haptics", "HAPTICS" }, \ | ||
547 | { name, "AEC", "AEC Loopback" }, \ | 1099 | { name, "AEC", "AEC Loopback" }, \ |
548 | { name, "IN1L", "IN1L PGA" }, \ | 1100 | { name, "IN1L", "IN1L PGA" }, \ |
549 | { name, "IN1R", "IN1R PGA" }, \ | 1101 | { name, "IN1R", "IN1R PGA" }, \ |
@@ -577,7 +1129,13 @@ SND_SOC_DAPM_OUTPUT("SPKDAT1R"), | |||
577 | { name, "ASRC1L", "ASRC1L" }, \ | 1129 | { name, "ASRC1L", "ASRC1L" }, \ |
578 | { name, "ASRC1R", "ASRC1R" }, \ | 1130 | { name, "ASRC1R", "ASRC1R" }, \ |
579 | { name, "ASRC2L", "ASRC2L" }, \ | 1131 | { name, "ASRC2L", "ASRC2L" }, \ |
580 | { name, "ASRC2R", "ASRC2R" } | 1132 | { name, "ASRC2R", "ASRC2R" }, \ |
1133 | { name, "DSP1.1", "DSP1" }, \ | ||
1134 | { name, "DSP1.2", "DSP1" }, \ | ||
1135 | { name, "DSP1.3", "DSP1" }, \ | ||
1136 | { name, "DSP1.4", "DSP1" }, \ | ||
1137 | { name, "DSP1.5", "DSP1" }, \ | ||
1138 | { name, "DSP1.6", "DSP1" } | ||
581 | 1139 | ||
582 | static const struct snd_soc_dapm_route wm5102_dapm_routes[] = { | 1140 | static const struct snd_soc_dapm_route wm5102_dapm_routes[] = { |
583 | { "AIF2 Capture", NULL, "DBVDD2" }, | 1141 | { "AIF2 Capture", NULL, "DBVDD2" }, |
@@ -663,6 +1221,11 @@ static const struct snd_soc_dapm_route wm5102_dapm_routes[] = { | |||
663 | { "IN3L PGA", NULL, "IN3L" }, | 1221 | { "IN3L PGA", NULL, "IN3L" }, |
664 | { "IN3R PGA", NULL, "IN3R" }, | 1222 | { "IN3R PGA", NULL, "IN3R" }, |
665 | 1223 | ||
1224 | { "ASRC1L", NULL, "ASRC1L Input" }, | ||
1225 | { "ASRC1R", NULL, "ASRC1R Input" }, | ||
1226 | { "ASRC2L", NULL, "ASRC2L Input" }, | ||
1227 | { "ASRC2R", NULL, "ASRC2R Input" }, | ||
1228 | |||
666 | ARIZONA_MIXER_ROUTES("OUT1L", "HPOUT1L"), | 1229 | ARIZONA_MIXER_ROUTES("OUT1L", "HPOUT1L"), |
667 | ARIZONA_MIXER_ROUTES("OUT1R", "HPOUT1R"), | 1230 | ARIZONA_MIXER_ROUTES("OUT1R", "HPOUT1R"), |
668 | ARIZONA_MIXER_ROUTES("OUT2L", "HPOUT2L"), | 1231 | ARIZONA_MIXER_ROUTES("OUT2L", "HPOUT2L"), |
@@ -705,10 +1268,12 @@ static const struct snd_soc_dapm_route wm5102_dapm_routes[] = { | |||
705 | ARIZONA_MIXER_ROUTES("LHPF3", "LHPF3"), | 1268 | ARIZONA_MIXER_ROUTES("LHPF3", "LHPF3"), |
706 | ARIZONA_MIXER_ROUTES("LHPF4", "LHPF4"), | 1269 | ARIZONA_MIXER_ROUTES("LHPF4", "LHPF4"), |
707 | 1270 | ||
708 | ARIZONA_MIXER_ROUTES("ASRC1L", "ASRC1L"), | 1271 | ARIZONA_MUX_ROUTES("ASRC1L"), |
709 | ARIZONA_MIXER_ROUTES("ASRC1R", "ASRC1R"), | 1272 | ARIZONA_MUX_ROUTES("ASRC1R"), |
710 | ARIZONA_MIXER_ROUTES("ASRC2L", "ASRC2L"), | 1273 | ARIZONA_MUX_ROUTES("ASRC2L"), |
711 | ARIZONA_MIXER_ROUTES("ASRC2R", "ASRC2R"), | 1274 | ARIZONA_MUX_ROUTES("ASRC2R"), |
1275 | |||
1276 | ARIZONA_DSP_ROUTES("DSP1"), | ||
712 | 1277 | ||
713 | { "AEC Loopback", "HPOUT1L", "OUT1L" }, | 1278 | { "AEC Loopback", "HPOUT1L", "OUT1L" }, |
714 | { "AEC Loopback", "HPOUT1R", "OUT1R" }, | 1279 | { "AEC Loopback", "HPOUT1R", "OUT1R" }, |
@@ -827,9 +1392,28 @@ static struct snd_soc_dai_driver wm5102_dai[] = { | |||
827 | static int wm5102_codec_probe(struct snd_soc_codec *codec) | 1392 | static int wm5102_codec_probe(struct snd_soc_codec *codec) |
828 | { | 1393 | { |
829 | struct wm5102_priv *priv = snd_soc_codec_get_drvdata(codec); | 1394 | struct wm5102_priv *priv = snd_soc_codec_get_drvdata(codec); |
1395 | int ret; | ||
830 | 1396 | ||
831 | codec->control_data = priv->core.arizona->regmap; | 1397 | codec->control_data = priv->core.arizona->regmap; |
832 | return snd_soc_codec_set_cache_io(codec, 32, 16, SND_SOC_REGMAP); | 1398 | |
1399 | ret = snd_soc_codec_set_cache_io(codec, 32, 16, SND_SOC_REGMAP); | ||
1400 | if (ret != 0) | ||
1401 | return ret; | ||
1402 | |||
1403 | snd_soc_dapm_disable_pin(&codec->dapm, "HAPTICS"); | ||
1404 | |||
1405 | priv->core.arizona->dapm = &codec->dapm; | ||
1406 | |||
1407 | return 0; | ||
1408 | } | ||
1409 | |||
1410 | static int wm5102_codec_remove(struct snd_soc_codec *codec) | ||
1411 | { | ||
1412 | struct wm5102_priv *priv = snd_soc_codec_get_drvdata(codec); | ||
1413 | |||
1414 | priv->core.arizona->dapm = NULL; | ||
1415 | |||
1416 | return 0; | ||
833 | } | 1417 | } |
834 | 1418 | ||
835 | #define WM5102_DIG_VU 0x0200 | 1419 | #define WM5102_DIG_VU 0x0200 |
@@ -856,6 +1440,7 @@ static unsigned int wm5102_digital_vu[] = { | |||
856 | 1440 | ||
857 | static struct snd_soc_codec_driver soc_codec_dev_wm5102 = { | 1441 | static struct snd_soc_codec_driver soc_codec_dev_wm5102 = { |
858 | .probe = wm5102_codec_probe, | 1442 | .probe = wm5102_codec_probe, |
1443 | .remove = wm5102_codec_remove, | ||
859 | 1444 | ||
860 | .idle_bias_off = true, | 1445 | .idle_bias_off = true, |
861 | 1446 | ||
@@ -874,7 +1459,7 @@ static int __devinit wm5102_probe(struct platform_device *pdev) | |||
874 | { | 1459 | { |
875 | struct arizona *arizona = dev_get_drvdata(pdev->dev.parent); | 1460 | struct arizona *arizona = dev_get_drvdata(pdev->dev.parent); |
876 | struct wm5102_priv *wm5102; | 1461 | struct wm5102_priv *wm5102; |
877 | int i; | 1462 | int i, ret; |
878 | 1463 | ||
879 | wm5102 = devm_kzalloc(&pdev->dev, sizeof(struct wm5102_priv), | 1464 | wm5102 = devm_kzalloc(&pdev->dev, sizeof(struct wm5102_priv), |
880 | GFP_KERNEL); | 1465 | GFP_KERNEL); |
@@ -884,6 +1469,19 @@ static int __devinit wm5102_probe(struct platform_device *pdev) | |||
884 | 1469 | ||
885 | wm5102->core.arizona = arizona; | 1470 | wm5102->core.arizona = arizona; |
886 | 1471 | ||
1472 | wm5102->core.adsp[0].part = "wm5102"; | ||
1473 | wm5102->core.adsp[0].num = 1; | ||
1474 | wm5102->core.adsp[0].type = WMFW_ADSP2; | ||
1475 | wm5102->core.adsp[0].base = ARIZONA_DSP1_CONTROL_1; | ||
1476 | wm5102->core.adsp[0].dev = arizona->dev; | ||
1477 | wm5102->core.adsp[0].regmap = arizona->regmap; | ||
1478 | wm5102->core.adsp[0].mem = wm5102_dsp1_regions; | ||
1479 | wm5102->core.adsp[0].num_mems = ARRAY_SIZE(wm5102_dsp1_regions); | ||
1480 | |||
1481 | ret = wm_adsp2_init(&wm5102->core.adsp[0], true); | ||
1482 | if (ret != 0) | ||
1483 | return ret; | ||
1484 | |||
887 | for (i = 0; i < ARRAY_SIZE(wm5102->fll); i++) | 1485 | for (i = 0; i < ARRAY_SIZE(wm5102->fll); i++) |
888 | wm5102->fll[i].vco_mult = 1; | 1486 | wm5102->fll[i].vco_mult = 1; |
889 | 1487 | ||
diff --git a/sound/soc/codecs/wm5110.c b/sound/soc/codecs/wm5110.c index 9211e4192f71..2a075ad00d5b 100644 --- a/sound/soc/codecs/wm5110.c +++ b/sound/soc/codecs/wm5110.c | |||
@@ -308,10 +308,10 @@ ARIZONA_MIXER_ENUMS(AIF2TX2, ARIZONA_AIF2TX2MIX_INPUT_1_SOURCE); | |||
308 | ARIZONA_MIXER_ENUMS(AIF3TX1, ARIZONA_AIF3TX1MIX_INPUT_1_SOURCE); | 308 | ARIZONA_MIXER_ENUMS(AIF3TX1, ARIZONA_AIF3TX1MIX_INPUT_1_SOURCE); |
309 | ARIZONA_MIXER_ENUMS(AIF3TX2, ARIZONA_AIF3TX2MIX_INPUT_1_SOURCE); | 309 | ARIZONA_MIXER_ENUMS(AIF3TX2, ARIZONA_AIF3TX2MIX_INPUT_1_SOURCE); |
310 | 310 | ||
311 | ARIZONA_MIXER_ENUMS(ASRC1L, ARIZONA_ASRC1LMIX_INPUT_1_SOURCE); | 311 | ARIZONA_MUX_ENUMS(ASRC1L, ARIZONA_ASRC1LMIX_INPUT_1_SOURCE); |
312 | ARIZONA_MIXER_ENUMS(ASRC1R, ARIZONA_ASRC1RMIX_INPUT_1_SOURCE); | 312 | ARIZONA_MUX_ENUMS(ASRC1R, ARIZONA_ASRC1RMIX_INPUT_1_SOURCE); |
313 | ARIZONA_MIXER_ENUMS(ASRC2L, ARIZONA_ASRC2LMIX_INPUT_1_SOURCE); | 313 | ARIZONA_MUX_ENUMS(ASRC2L, ARIZONA_ASRC2LMIX_INPUT_1_SOURCE); |
314 | ARIZONA_MIXER_ENUMS(ASRC2R, ARIZONA_ASRC2RMIX_INPUT_1_SOURCE); | 314 | ARIZONA_MUX_ENUMS(ASRC2R, ARIZONA_ASRC2RMIX_INPUT_1_SOURCE); |
315 | 315 | ||
316 | static const char *wm5110_aec_loopback_texts[] = { | 316 | static const char *wm5110_aec_loopback_texts[] = { |
317 | "HPOUT1L", "HPOUT1R", "HPOUT2L", "HPOUT2R", "HPOUT3L", "HPOUT3R", | 317 | "HPOUT1L", "HPOUT1R", "HPOUT2L", "HPOUT2R", "HPOUT3L", "HPOUT3R", |
@@ -352,6 +352,7 @@ SND_SOC_DAPM_REGULATOR_SUPPLY("SPKVDDR", 0, 0), | |||
352 | 352 | ||
353 | SND_SOC_DAPM_SIGGEN("TONE"), | 353 | SND_SOC_DAPM_SIGGEN("TONE"), |
354 | SND_SOC_DAPM_SIGGEN("NOISE"), | 354 | SND_SOC_DAPM_SIGGEN("NOISE"), |
355 | SND_SOC_DAPM_SIGGEN("HAPTICS"), | ||
355 | 356 | ||
356 | SND_SOC_DAPM_INPUT("IN1L"), | 357 | SND_SOC_DAPM_INPUT("IN1L"), |
357 | SND_SOC_DAPM_INPUT("IN1R"), | 358 | SND_SOC_DAPM_INPUT("IN1R"), |
@@ -585,10 +586,10 @@ ARIZONA_MIXER_WIDGETS(AIF2TX2, "AIF2TX2"), | |||
585 | ARIZONA_MIXER_WIDGETS(AIF3TX1, "AIF3TX1"), | 586 | ARIZONA_MIXER_WIDGETS(AIF3TX1, "AIF3TX1"), |
586 | ARIZONA_MIXER_WIDGETS(AIF3TX2, "AIF3TX2"), | 587 | ARIZONA_MIXER_WIDGETS(AIF3TX2, "AIF3TX2"), |
587 | 588 | ||
588 | ARIZONA_MIXER_WIDGETS(ASRC1L, "ASRC1L"), | 589 | ARIZONA_MUX_WIDGETS(ASRC1L, "ASRC1L"), |
589 | ARIZONA_MIXER_WIDGETS(ASRC1R, "ASRC1R"), | 590 | ARIZONA_MUX_WIDGETS(ASRC1R, "ASRC1R"), |
590 | ARIZONA_MIXER_WIDGETS(ASRC2L, "ASRC2L"), | 591 | ARIZONA_MUX_WIDGETS(ASRC2L, "ASRC2L"), |
591 | ARIZONA_MIXER_WIDGETS(ASRC2R, "ASRC2R"), | 592 | ARIZONA_MUX_WIDGETS(ASRC2R, "ASRC2R"), |
592 | 593 | ||
593 | SND_SOC_DAPM_OUTPUT("HPOUT1L"), | 594 | SND_SOC_DAPM_OUTPUT("HPOUT1L"), |
594 | SND_SOC_DAPM_OUTPUT("HPOUT1R"), | 595 | SND_SOC_DAPM_OUTPUT("HPOUT1R"), |
@@ -610,6 +611,7 @@ SND_SOC_DAPM_OUTPUT("SPKDAT2R"), | |||
610 | { name, "Noise Generator", "Noise Generator" }, \ | 611 | { name, "Noise Generator", "Noise Generator" }, \ |
611 | { name, "Tone Generator 1", "Tone Generator 1" }, \ | 612 | { name, "Tone Generator 1", "Tone Generator 1" }, \ |
612 | { name, "Tone Generator 2", "Tone Generator 2" }, \ | 613 | { name, "Tone Generator 2", "Tone Generator 2" }, \ |
614 | { name, "Haptics", "HAPTICS" }, \ | ||
613 | { name, "AEC", "AEC Loopback" }, \ | 615 | { name, "AEC", "AEC Loopback" }, \ |
614 | { name, "IN1L", "IN1L PGA" }, \ | 616 | { name, "IN1L", "IN1L PGA" }, \ |
615 | { name, "IN1R", "IN1R PGA" }, \ | 617 | { name, "IN1R", "IN1R PGA" }, \ |
@@ -786,10 +788,10 @@ static const struct snd_soc_dapm_route wm5110_dapm_routes[] = { | |||
786 | ARIZONA_MIXER_ROUTES("LHPF3", "LHPF3"), | 788 | ARIZONA_MIXER_ROUTES("LHPF3", "LHPF3"), |
787 | ARIZONA_MIXER_ROUTES("LHPF4", "LHPF4"), | 789 | ARIZONA_MIXER_ROUTES("LHPF4", "LHPF4"), |
788 | 790 | ||
789 | ARIZONA_MIXER_ROUTES("ASRC1L", "ASRC1L"), | 791 | ARIZONA_MUX_ROUTES("ASRC1L"), |
790 | ARIZONA_MIXER_ROUTES("ASRC1R", "ASRC1R"), | 792 | ARIZONA_MUX_ROUTES("ASRC1R"), |
791 | ARIZONA_MIXER_ROUTES("ASRC2L", "ASRC2L"), | 793 | ARIZONA_MUX_ROUTES("ASRC2L"), |
792 | ARIZONA_MIXER_ROUTES("ASRC2R", "ASRC2R"), | 794 | ARIZONA_MUX_ROUTES("ASRC2R"), |
793 | 795 | ||
794 | { "HPOUT1L", NULL, "OUT1L" }, | 796 | { "HPOUT1L", NULL, "OUT1L" }, |
795 | { "HPOUT1R", NULL, "OUT1R" }, | 797 | { "HPOUT1R", NULL, "OUT1R" }, |
@@ -902,9 +904,29 @@ static struct snd_soc_dai_driver wm5110_dai[] = { | |||
902 | static int wm5110_codec_probe(struct snd_soc_codec *codec) | 904 | static int wm5110_codec_probe(struct snd_soc_codec *codec) |
903 | { | 905 | { |
904 | struct wm5110_priv *priv = snd_soc_codec_get_drvdata(codec); | 906 | struct wm5110_priv *priv = snd_soc_codec_get_drvdata(codec); |
907 | int ret; | ||
905 | 908 | ||
906 | codec->control_data = priv->core.arizona->regmap; | 909 | codec->control_data = priv->core.arizona->regmap; |
907 | return snd_soc_codec_set_cache_io(codec, 32, 16, SND_SOC_REGMAP); | 910 | priv->core.arizona->dapm = &codec->dapm; |
911 | |||
912 | ret = snd_soc_codec_set_cache_io(codec, 32, 16, SND_SOC_REGMAP); | ||
913 | if (ret != 0) | ||
914 | return ret; | ||
915 | |||
916 | snd_soc_dapm_disable_pin(&codec->dapm, "HAPTICS"); | ||
917 | |||
918 | priv->core.arizona->dapm = &codec->dapm; | ||
919 | |||
920 | return 0; | ||
921 | } | ||
922 | |||
923 | static int wm5110_codec_remove(struct snd_soc_codec *codec) | ||
924 | { | ||
925 | struct wm5110_priv *priv = snd_soc_codec_get_drvdata(codec); | ||
926 | |||
927 | priv->core.arizona->dapm = NULL; | ||
928 | |||
929 | return 0; | ||
908 | } | 930 | } |
909 | 931 | ||
910 | #define WM5110_DIG_VU 0x0200 | 932 | #define WM5110_DIG_VU 0x0200 |
@@ -935,6 +957,7 @@ static unsigned int wm5110_digital_vu[] = { | |||
935 | 957 | ||
936 | static struct snd_soc_codec_driver soc_codec_dev_wm5110 = { | 958 | static struct snd_soc_codec_driver soc_codec_dev_wm5110 = { |
937 | .probe = wm5110_codec_probe, | 959 | .probe = wm5110_codec_probe, |
960 | .remove = wm5110_codec_remove, | ||
938 | 961 | ||
939 | .idle_bias_off = true, | 962 | .idle_bias_off = true, |
940 | 963 | ||
diff --git a/sound/soc/codecs/wm8978.c b/sound/soc/codecs/wm8978.c index 5421fd9fbcb5..4c0a8e496131 100644 --- a/sound/soc/codecs/wm8978.c +++ b/sound/soc/codecs/wm8978.c | |||
@@ -782,7 +782,7 @@ static int wm8978_hw_params(struct snd_pcm_substream *substream, | |||
782 | wm8978->mclk_idx = -1; | 782 | wm8978->mclk_idx = -1; |
783 | f_sel = wm8978->f_mclk; | 783 | f_sel = wm8978->f_mclk; |
784 | } else { | 784 | } else { |
785 | if (!wm8978->f_pllout) { | 785 | if (!wm8978->f_opclk) { |
786 | /* We only enter here, if OPCLK is not used */ | 786 | /* We only enter here, if OPCLK is not used */ |
787 | int ret = wm8978_configure_pll(codec); | 787 | int ret = wm8978_configure_pll(codec); |
788 | if (ret < 0) | 788 | if (ret < 0) |
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 3fddc7ad1127..b2b2b37131bd 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c | |||
@@ -3722,7 +3722,7 @@ static irqreturn_t wm8958_mic_irq(int irq, void *data) | |||
3722 | } while (count--); | 3722 | } while (count--); |
3723 | 3723 | ||
3724 | if (count == 0) | 3724 | if (count == 0) |
3725 | dev_warn(codec->dev, "No impedence range reported for jack\n"); | 3725 | dev_warn(codec->dev, "No impedance range reported for jack\n"); |
3726 | 3726 | ||
3727 | #ifndef CONFIG_SND_SOC_WM8994_MODULE | 3727 | #ifndef CONFIG_SND_SOC_WM8994_MODULE |
3728 | trace_snd_soc_jack_irq(dev_name(codec->dev)); | 3728 | trace_snd_soc_jack_irq(dev_name(codec->dev)); |
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c new file mode 100644 index 000000000000..7fdb68ef384e --- /dev/null +++ b/sound/soc/codecs/wm_adsp.c | |||
@@ -0,0 +1,666 @@ | |||
1 | /* | ||
2 | * wm_adsp.c -- Wolfson ADSP support | ||
3 | * | ||
4 | * Copyright 2012 Wolfson Microelectronics plc | ||
5 | * | ||
6 | * Author: Mark Brown <broonie@opensource.wolfsonmicro.com> | ||
7 | * | ||
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 | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #include <linux/module.h> | ||
14 | #include <linux/moduleparam.h> | ||
15 | #include <linux/init.h> | ||
16 | #include <linux/delay.h> | ||
17 | #include <linux/firmware.h> | ||
18 | #include <linux/pm.h> | ||
19 | #include <linux/pm_runtime.h> | ||
20 | #include <linux/regmap.h> | ||
21 | #include <linux/regulator/consumer.h> | ||
22 | #include <linux/slab.h> | ||
23 | #include <sound/core.h> | ||
24 | #include <sound/pcm.h> | ||
25 | #include <sound/pcm_params.h> | ||
26 | #include <sound/soc.h> | ||
27 | #include <sound/jack.h> | ||
28 | #include <sound/initval.h> | ||
29 | #include <sound/tlv.h> | ||
30 | |||
31 | #include <linux/mfd/arizona/registers.h> | ||
32 | |||
33 | #include "wm_adsp.h" | ||
34 | |||
35 | #define adsp_crit(_dsp, fmt, ...) \ | ||
36 | dev_crit(_dsp->dev, "DSP%d: " fmt, _dsp->num, ##__VA_ARGS__) | ||
37 | #define adsp_err(_dsp, fmt, ...) \ | ||
38 | dev_err(_dsp->dev, "DSP%d: " fmt, _dsp->num, ##__VA_ARGS__) | ||
39 | #define adsp_warn(_dsp, fmt, ...) \ | ||
40 | dev_warn(_dsp->dev, "DSP%d: " fmt, _dsp->num, ##__VA_ARGS__) | ||
41 | #define adsp_info(_dsp, fmt, ...) \ | ||
42 | dev_info(_dsp->dev, "DSP%d: " fmt, _dsp->num, ##__VA_ARGS__) | ||
43 | #define adsp_dbg(_dsp, fmt, ...) \ | ||
44 | dev_dbg(_dsp->dev, "DSP%d: " fmt, _dsp->num, ##__VA_ARGS__) | ||
45 | |||
46 | #define ADSP1_CONTROL_1 0x00 | ||
47 | #define ADSP1_CONTROL_2 0x02 | ||
48 | #define ADSP1_CONTROL_3 0x03 | ||
49 | #define ADSP1_CONTROL_4 0x04 | ||
50 | #define ADSP1_CONTROL_5 0x06 | ||
51 | #define ADSP1_CONTROL_6 0x07 | ||
52 | #define ADSP1_CONTROL_7 0x08 | ||
53 | #define ADSP1_CONTROL_8 0x09 | ||
54 | #define ADSP1_CONTROL_9 0x0A | ||
55 | #define ADSP1_CONTROL_10 0x0B | ||
56 | #define ADSP1_CONTROL_11 0x0C | ||
57 | #define ADSP1_CONTROL_12 0x0D | ||
58 | #define ADSP1_CONTROL_13 0x0F | ||
59 | #define ADSP1_CONTROL_14 0x10 | ||
60 | #define ADSP1_CONTROL_15 0x11 | ||
61 | #define ADSP1_CONTROL_16 0x12 | ||
62 | #define ADSP1_CONTROL_17 0x13 | ||
63 | #define ADSP1_CONTROL_18 0x14 | ||
64 | #define ADSP1_CONTROL_19 0x16 | ||
65 | #define ADSP1_CONTROL_20 0x17 | ||
66 | #define ADSP1_CONTROL_21 0x18 | ||
67 | #define ADSP1_CONTROL_22 0x1A | ||
68 | #define ADSP1_CONTROL_23 0x1B | ||
69 | #define ADSP1_CONTROL_24 0x1C | ||
70 | #define ADSP1_CONTROL_25 0x1E | ||
71 | #define ADSP1_CONTROL_26 0x20 | ||
72 | #define ADSP1_CONTROL_27 0x21 | ||
73 | #define ADSP1_CONTROL_28 0x22 | ||
74 | #define ADSP1_CONTROL_29 0x23 | ||
75 | #define ADSP1_CONTROL_30 0x24 | ||
76 | #define ADSP1_CONTROL_31 0x26 | ||
77 | |||
78 | /* | ||
79 | * ADSP1 Control 19 | ||
80 | */ | ||
81 | #define ADSP1_WDMA_BUFFER_LENGTH_MASK 0x00FF /* DSP1_WDMA_BUFFER_LENGTH - [7:0] */ | ||
82 | #define ADSP1_WDMA_BUFFER_LENGTH_SHIFT 0 /* DSP1_WDMA_BUFFER_LENGTH - [7:0] */ | ||
83 | #define ADSP1_WDMA_BUFFER_LENGTH_WIDTH 8 /* DSP1_WDMA_BUFFER_LENGTH - [7:0] */ | ||
84 | |||
85 | |||
86 | /* | ||
87 | * ADSP1 Control 30 | ||
88 | */ | ||
89 | #define ADSP1_DBG_CLK_ENA 0x0008 /* DSP1_DBG_CLK_ENA */ | ||
90 | #define ADSP1_DBG_CLK_ENA_MASK 0x0008 /* DSP1_DBG_CLK_ENA */ | ||
91 | #define ADSP1_DBG_CLK_ENA_SHIFT 3 /* DSP1_DBG_CLK_ENA */ | ||
92 | #define ADSP1_DBG_CLK_ENA_WIDTH 1 /* DSP1_DBG_CLK_ENA */ | ||
93 | #define ADSP1_SYS_ENA 0x0004 /* DSP1_SYS_ENA */ | ||
94 | #define ADSP1_SYS_ENA_MASK 0x0004 /* DSP1_SYS_ENA */ | ||
95 | #define ADSP1_SYS_ENA_SHIFT 2 /* DSP1_SYS_ENA */ | ||
96 | #define ADSP1_SYS_ENA_WIDTH 1 /* DSP1_SYS_ENA */ | ||
97 | #define ADSP1_CORE_ENA 0x0002 /* DSP1_CORE_ENA */ | ||
98 | #define ADSP1_CORE_ENA_MASK 0x0002 /* DSP1_CORE_ENA */ | ||
99 | #define ADSP1_CORE_ENA_SHIFT 1 /* DSP1_CORE_ENA */ | ||
100 | #define ADSP1_CORE_ENA_WIDTH 1 /* DSP1_CORE_ENA */ | ||
101 | #define ADSP1_START 0x0001 /* DSP1_START */ | ||
102 | #define ADSP1_START_MASK 0x0001 /* DSP1_START */ | ||
103 | #define ADSP1_START_SHIFT 0 /* DSP1_START */ | ||
104 | #define ADSP1_START_WIDTH 1 /* DSP1_START */ | ||
105 | |||
106 | #define ADSP2_CONTROL 0 | ||
107 | #define ADSP2_CLOCKING 1 | ||
108 | #define ADSP2_STATUS1 4 | ||
109 | |||
110 | /* | ||
111 | * ADSP2 Control | ||
112 | */ | ||
113 | |||
114 | #define ADSP2_MEM_ENA 0x0010 /* DSP1_MEM_ENA */ | ||
115 | #define ADSP2_MEM_ENA_MASK 0x0010 /* DSP1_MEM_ENA */ | ||
116 | #define ADSP2_MEM_ENA_SHIFT 4 /* DSP1_MEM_ENA */ | ||
117 | #define ADSP2_MEM_ENA_WIDTH 1 /* DSP1_MEM_ENA */ | ||
118 | #define ADSP2_SYS_ENA 0x0004 /* DSP1_SYS_ENA */ | ||
119 | #define ADSP2_SYS_ENA_MASK 0x0004 /* DSP1_SYS_ENA */ | ||
120 | #define ADSP2_SYS_ENA_SHIFT 2 /* DSP1_SYS_ENA */ | ||
121 | #define ADSP2_SYS_ENA_WIDTH 1 /* DSP1_SYS_ENA */ | ||
122 | #define ADSP2_CORE_ENA 0x0002 /* DSP1_CORE_ENA */ | ||
123 | #define ADSP2_CORE_ENA_MASK 0x0002 /* DSP1_CORE_ENA */ | ||
124 | #define ADSP2_CORE_ENA_SHIFT 1 /* DSP1_CORE_ENA */ | ||
125 | #define ADSP2_CORE_ENA_WIDTH 1 /* DSP1_CORE_ENA */ | ||
126 | #define ADSP2_START 0x0001 /* DSP1_START */ | ||
127 | #define ADSP2_START_MASK 0x0001 /* DSP1_START */ | ||
128 | #define ADSP2_START_SHIFT 0 /* DSP1_START */ | ||
129 | #define ADSP2_START_WIDTH 1 /* DSP1_START */ | ||
130 | |||
131 | /* | ||
132 | * ADSP2 clocking | ||
133 | */ | ||
134 | #define ADSP2_CLK_SEL_MASK 0x0007 /* CLK_SEL_ENA */ | ||
135 | #define ADSP2_CLK_SEL_SHIFT 0 /* CLK_SEL_ENA */ | ||
136 | #define ADSP2_CLK_SEL_WIDTH 3 /* CLK_SEL_ENA */ | ||
137 | |||
138 | /* | ||
139 | * ADSP2 Status 1 | ||
140 | */ | ||
141 | #define ADSP2_RAM_RDY 0x0001 | ||
142 | #define ADSP2_RAM_RDY_MASK 0x0001 | ||
143 | #define ADSP2_RAM_RDY_SHIFT 0 | ||
144 | #define ADSP2_RAM_RDY_WIDTH 1 | ||
145 | |||
146 | |||
147 | static struct wm_adsp_region const *wm_adsp_find_region(struct wm_adsp *dsp, | ||
148 | int type) | ||
149 | { | ||
150 | int i; | ||
151 | |||
152 | for (i = 0; i < dsp->num_mems; i++) | ||
153 | if (dsp->mem[i].type == type) | ||
154 | return &dsp->mem[i]; | ||
155 | |||
156 | return NULL; | ||
157 | } | ||
158 | |||
159 | static int wm_adsp_load(struct wm_adsp *dsp) | ||
160 | { | ||
161 | const struct firmware *firmware; | ||
162 | struct regmap *regmap = dsp->regmap; | ||
163 | unsigned int pos = 0; | ||
164 | const struct wmfw_header *header; | ||
165 | const struct wmfw_adsp1_sizes *adsp1_sizes; | ||
166 | const struct wmfw_adsp2_sizes *adsp2_sizes; | ||
167 | const struct wmfw_footer *footer; | ||
168 | const struct wmfw_region *region; | ||
169 | const struct wm_adsp_region *mem; | ||
170 | const char *region_name; | ||
171 | char *file, *text; | ||
172 | unsigned int reg; | ||
173 | int regions = 0; | ||
174 | int ret, offset, type, sizes; | ||
175 | |||
176 | file = kzalloc(PAGE_SIZE, GFP_KERNEL); | ||
177 | if (file == NULL) | ||
178 | return -ENOMEM; | ||
179 | |||
180 | snprintf(file, PAGE_SIZE, "%s-dsp%d.wmfw", dsp->part, dsp->num); | ||
181 | file[PAGE_SIZE - 1] = '\0'; | ||
182 | |||
183 | ret = request_firmware(&firmware, file, dsp->dev); | ||
184 | if (ret != 0) { | ||
185 | adsp_err(dsp, "Failed to request '%s'\n", file); | ||
186 | goto out; | ||
187 | } | ||
188 | ret = -EINVAL; | ||
189 | |||
190 | pos = sizeof(*header) + sizeof(*adsp1_sizes) + sizeof(*footer); | ||
191 | if (pos >= firmware->size) { | ||
192 | adsp_err(dsp, "%s: file too short, %zu bytes\n", | ||
193 | file, firmware->size); | ||
194 | goto out_fw; | ||
195 | } | ||
196 | |||
197 | header = (void*)&firmware->data[0]; | ||
198 | |||
199 | if (memcmp(&header->magic[0], "WMFW", 4) != 0) { | ||
200 | adsp_err(dsp, "%s: invalid magic\n", file); | ||
201 | goto out_fw; | ||
202 | } | ||
203 | |||
204 | if (header->ver != 0) { | ||
205 | adsp_err(dsp, "%s: unknown file format %d\n", | ||
206 | file, header->ver); | ||
207 | goto out_fw; | ||
208 | } | ||
209 | |||
210 | if (header->core != dsp->type) { | ||
211 | adsp_err(dsp, "%s: invalid core %d != %d\n", | ||
212 | file, header->core, dsp->type); | ||
213 | goto out_fw; | ||
214 | } | ||
215 | |||
216 | switch (dsp->type) { | ||
217 | case WMFW_ADSP1: | ||
218 | pos = sizeof(*header) + sizeof(*adsp1_sizes) + sizeof(*footer); | ||
219 | adsp1_sizes = (void *)&(header[1]); | ||
220 | footer = (void *)&(adsp1_sizes[1]); | ||
221 | sizes = sizeof(*adsp1_sizes); | ||
222 | |||
223 | adsp_dbg(dsp, "%s: %d DM, %d PM, %d ZM\n", | ||
224 | file, le32_to_cpu(adsp1_sizes->dm), | ||
225 | le32_to_cpu(adsp1_sizes->pm), | ||
226 | le32_to_cpu(adsp1_sizes->zm)); | ||
227 | break; | ||
228 | |||
229 | case WMFW_ADSP2: | ||
230 | pos = sizeof(*header) + sizeof(*adsp2_sizes) + sizeof(*footer); | ||
231 | adsp2_sizes = (void *)&(header[1]); | ||
232 | footer = (void *)&(adsp2_sizes[1]); | ||
233 | sizes = sizeof(*adsp2_sizes); | ||
234 | |||
235 | adsp_dbg(dsp, "%s: %d XM, %d YM %d PM, %d ZM\n", | ||
236 | file, le32_to_cpu(adsp2_sizes->xm), | ||
237 | le32_to_cpu(adsp2_sizes->ym), | ||
238 | le32_to_cpu(adsp2_sizes->pm), | ||
239 | le32_to_cpu(adsp2_sizes->zm)); | ||
240 | break; | ||
241 | |||
242 | default: | ||
243 | BUG_ON(NULL == "Unknown DSP type"); | ||
244 | goto out_fw; | ||
245 | } | ||
246 | |||
247 | if (le32_to_cpu(header->len) != sizeof(*header) + | ||
248 | sizes + sizeof(*footer)) { | ||
249 | adsp_err(dsp, "%s: unexpected header length %d\n", | ||
250 | file, le32_to_cpu(header->len)); | ||
251 | goto out_fw; | ||
252 | } | ||
253 | |||
254 | adsp_dbg(dsp, "%s: timestamp %llu\n", file, | ||
255 | le64_to_cpu(footer->timestamp)); | ||
256 | |||
257 | while (pos < firmware->size && | ||
258 | pos - firmware->size > sizeof(*region)) { | ||
259 | region = (void *)&(firmware->data[pos]); | ||
260 | region_name = "Unknown"; | ||
261 | reg = 0; | ||
262 | text = NULL; | ||
263 | offset = le32_to_cpu(region->offset) & 0xffffff; | ||
264 | type = be32_to_cpu(region->type) & 0xff; | ||
265 | mem = wm_adsp_find_region(dsp, type); | ||
266 | |||
267 | switch (type) { | ||
268 | case WMFW_NAME_TEXT: | ||
269 | region_name = "Firmware name"; | ||
270 | text = kzalloc(le32_to_cpu(region->len) + 1, | ||
271 | GFP_KERNEL); | ||
272 | break; | ||
273 | case WMFW_INFO_TEXT: | ||
274 | region_name = "Information"; | ||
275 | text = kzalloc(le32_to_cpu(region->len) + 1, | ||
276 | GFP_KERNEL); | ||
277 | break; | ||
278 | case WMFW_ABSOLUTE: | ||
279 | region_name = "Absolute"; | ||
280 | reg = offset; | ||
281 | break; | ||
282 | case WMFW_ADSP1_PM: | ||
283 | BUG_ON(!mem); | ||
284 | region_name = "PM"; | ||
285 | reg = mem->base + (offset * 3); | ||
286 | break; | ||
287 | case WMFW_ADSP1_DM: | ||
288 | BUG_ON(!mem); | ||
289 | region_name = "DM"; | ||
290 | reg = mem->base + (offset * 2); | ||
291 | break; | ||
292 | case WMFW_ADSP2_XM: | ||
293 | BUG_ON(!mem); | ||
294 | region_name = "XM"; | ||
295 | reg = mem->base + (offset * 2); | ||
296 | break; | ||
297 | case WMFW_ADSP2_YM: | ||
298 | BUG_ON(!mem); | ||
299 | region_name = "YM"; | ||
300 | reg = mem->base + (offset * 2); | ||
301 | break; | ||
302 | case WMFW_ADSP1_ZM: | ||
303 | BUG_ON(!mem); | ||
304 | region_name = "ZM"; | ||
305 | reg = mem->base + (offset * 2); | ||
306 | break; | ||
307 | default: | ||
308 | adsp_warn(dsp, | ||
309 | "%s.%d: Unknown region type %x at %d(%x)\n", | ||
310 | file, regions, type, pos, pos); | ||
311 | break; | ||
312 | } | ||
313 | |||
314 | adsp_dbg(dsp, "%s.%d: %d bytes at %d in %s\n", file, | ||
315 | regions, le32_to_cpu(region->len), offset, | ||
316 | region_name); | ||
317 | |||
318 | if (text) { | ||
319 | memcpy(text, region->data, le32_to_cpu(region->len)); | ||
320 | adsp_info(dsp, "%s: %s\n", file, text); | ||
321 | kfree(text); | ||
322 | } | ||
323 | |||
324 | if (reg) { | ||
325 | ret = regmap_raw_write(regmap, reg, region->data, | ||
326 | le32_to_cpu(region->len)); | ||
327 | if (ret != 0) { | ||
328 | adsp_err(dsp, | ||
329 | "%s.%d: Failed to write %d bytes at %d in %s: %d\n", | ||
330 | file, regions, | ||
331 | le32_to_cpu(region->len), offset, | ||
332 | region_name, ret); | ||
333 | goto out_fw; | ||
334 | } | ||
335 | } | ||
336 | |||
337 | pos += le32_to_cpu(region->len) + sizeof(*region); | ||
338 | regions++; | ||
339 | } | ||
340 | |||
341 | if (pos > firmware->size) | ||
342 | adsp_warn(dsp, "%s.%d: %zu bytes at end of file\n", | ||
343 | file, regions, pos - firmware->size); | ||
344 | |||
345 | out_fw: | ||
346 | release_firmware(firmware); | ||
347 | out: | ||
348 | kfree(file); | ||
349 | |||
350 | return ret; | ||
351 | } | ||
352 | |||
353 | static int wm_adsp_load_coeff(struct wm_adsp *dsp) | ||
354 | { | ||
355 | struct regmap *regmap = dsp->regmap; | ||
356 | struct wmfw_coeff_hdr *hdr; | ||
357 | struct wmfw_coeff_item *blk; | ||
358 | const struct firmware *firmware; | ||
359 | const char *region_name; | ||
360 | int ret, pos, blocks, type, offset, reg; | ||
361 | char *file; | ||
362 | |||
363 | file = kzalloc(PAGE_SIZE, GFP_KERNEL); | ||
364 | if (file == NULL) | ||
365 | return -ENOMEM; | ||
366 | |||
367 | snprintf(file, PAGE_SIZE, "%s-dsp%d.bin", dsp->part, dsp->num); | ||
368 | file[PAGE_SIZE - 1] = '\0'; | ||
369 | |||
370 | ret = request_firmware(&firmware, file, dsp->dev); | ||
371 | if (ret != 0) { | ||
372 | adsp_warn(dsp, "Failed to request '%s'\n", file); | ||
373 | ret = 0; | ||
374 | goto out; | ||
375 | } | ||
376 | ret = -EINVAL; | ||
377 | |||
378 | if (sizeof(*hdr) >= firmware->size) { | ||
379 | adsp_err(dsp, "%s: file too short, %zu bytes\n", | ||
380 | file, firmware->size); | ||
381 | goto out_fw; | ||
382 | } | ||
383 | |||
384 | hdr = (void*)&firmware->data[0]; | ||
385 | if (memcmp(hdr->magic, "WMDR", 4) != 0) { | ||
386 | adsp_err(dsp, "%s: invalid magic\n", file); | ||
387 | return -EINVAL; | ||
388 | } | ||
389 | |||
390 | adsp_dbg(dsp, "%s: v%d.%d.%d\n", file, | ||
391 | (le32_to_cpu(hdr->ver) >> 16) & 0xff, | ||
392 | (le32_to_cpu(hdr->ver) >> 8) & 0xff, | ||
393 | le32_to_cpu(hdr->ver) & 0xff); | ||
394 | |||
395 | pos = le32_to_cpu(hdr->len); | ||
396 | |||
397 | blocks = 0; | ||
398 | while (pos < firmware->size && | ||
399 | pos - firmware->size > sizeof(*blk)) { | ||
400 | blk = (void*)(&firmware->data[pos]); | ||
401 | |||
402 | type = be32_to_cpu(blk->type) & 0xff; | ||
403 | offset = le32_to_cpu(blk->offset) & 0xffffff; | ||
404 | |||
405 | adsp_dbg(dsp, "%s.%d: %x v%d.%d.%d\n", | ||
406 | file, blocks, le32_to_cpu(blk->id), | ||
407 | (le32_to_cpu(blk->ver) >> 16) & 0xff, | ||
408 | (le32_to_cpu(blk->ver) >> 8) & 0xff, | ||
409 | le32_to_cpu(blk->ver) & 0xff); | ||
410 | adsp_dbg(dsp, "%s.%d: %d bytes at 0x%x in %x\n", | ||
411 | file, blocks, le32_to_cpu(blk->len), offset, type); | ||
412 | |||
413 | reg = 0; | ||
414 | region_name = "Unknown"; | ||
415 | switch (type) { | ||
416 | case WMFW_NAME_TEXT: | ||
417 | case WMFW_INFO_TEXT: | ||
418 | break; | ||
419 | case WMFW_ABSOLUTE: | ||
420 | region_name = "register"; | ||
421 | reg = offset; | ||
422 | break; | ||
423 | default: | ||
424 | adsp_err(dsp, "Unknown region type %x\n", type); | ||
425 | break; | ||
426 | } | ||
427 | |||
428 | if (reg) { | ||
429 | ret = regmap_raw_write(regmap, reg, blk->data, | ||
430 | le32_to_cpu(blk->len)); | ||
431 | if (ret != 0) { | ||
432 | adsp_err(dsp, | ||
433 | "%s.%d: Failed to write to %x in %s\n", | ||
434 | file, blocks, reg, region_name); | ||
435 | } | ||
436 | } | ||
437 | |||
438 | pos += le32_to_cpu(blk->len) + sizeof(*blk); | ||
439 | blocks++; | ||
440 | } | ||
441 | |||
442 | if (pos > firmware->size) | ||
443 | adsp_warn(dsp, "%s.%d: %zu bytes at end of file\n", | ||
444 | file, blocks, pos - firmware->size); | ||
445 | |||
446 | out_fw: | ||
447 | release_firmware(firmware); | ||
448 | out: | ||
449 | kfree(file); | ||
450 | return 0; | ||
451 | } | ||
452 | |||
453 | int wm_adsp1_event(struct snd_soc_dapm_widget *w, | ||
454 | struct snd_kcontrol *kcontrol, | ||
455 | int event) | ||
456 | { | ||
457 | struct snd_soc_codec *codec = w->codec; | ||
458 | struct wm_adsp *dsps = snd_soc_codec_get_drvdata(codec); | ||
459 | struct wm_adsp *dsp = &dsps[w->shift]; | ||
460 | int ret; | ||
461 | |||
462 | switch (event) { | ||
463 | case SND_SOC_DAPM_POST_PMU: | ||
464 | regmap_update_bits(dsp->regmap, dsp->base + ADSP1_CONTROL_30, | ||
465 | ADSP1_SYS_ENA, ADSP1_SYS_ENA); | ||
466 | |||
467 | ret = wm_adsp_load(dsp); | ||
468 | if (ret != 0) | ||
469 | goto err; | ||
470 | |||
471 | ret = wm_adsp_load_coeff(dsp); | ||
472 | if (ret != 0) | ||
473 | goto err; | ||
474 | |||
475 | /* Start the core running */ | ||
476 | regmap_update_bits(dsp->regmap, dsp->base + ADSP1_CONTROL_30, | ||
477 | ADSP1_CORE_ENA | ADSP1_START, | ||
478 | ADSP1_CORE_ENA | ADSP1_START); | ||
479 | break; | ||
480 | |||
481 | case SND_SOC_DAPM_PRE_PMD: | ||
482 | /* Halt the core */ | ||
483 | regmap_update_bits(dsp->regmap, dsp->base + ADSP1_CONTROL_30, | ||
484 | ADSP1_CORE_ENA | ADSP1_START, 0); | ||
485 | |||
486 | regmap_update_bits(dsp->regmap, dsp->base + ADSP1_CONTROL_19, | ||
487 | ADSP1_WDMA_BUFFER_LENGTH_MASK, 0); | ||
488 | |||
489 | regmap_update_bits(dsp->regmap, dsp->base + ADSP1_CONTROL_30, | ||
490 | ADSP1_SYS_ENA, 0); | ||
491 | break; | ||
492 | |||
493 | default: | ||
494 | break; | ||
495 | } | ||
496 | |||
497 | return 0; | ||
498 | |||
499 | err: | ||
500 | regmap_update_bits(dsp->regmap, dsp->base + ADSP1_CONTROL_30, | ||
501 | ADSP1_SYS_ENA, 0); | ||
502 | return ret; | ||
503 | } | ||
504 | EXPORT_SYMBOL_GPL(wm_adsp1_event); | ||
505 | |||
506 | static int wm_adsp2_ena(struct wm_adsp *dsp) | ||
507 | { | ||
508 | unsigned int val; | ||
509 | int ret, count; | ||
510 | |||
511 | ret = regmap_update_bits(dsp->regmap, dsp->base + ADSP2_CONTROL, | ||
512 | ADSP2_SYS_ENA, ADSP2_SYS_ENA); | ||
513 | if (ret != 0) | ||
514 | return ret; | ||
515 | |||
516 | /* Wait for the RAM to start, should be near instantaneous */ | ||
517 | count = 0; | ||
518 | do { | ||
519 | ret = regmap_read(dsp->regmap, dsp->base + ADSP2_STATUS1, | ||
520 | &val); | ||
521 | if (ret != 0) | ||
522 | return ret; | ||
523 | } while (!(val & ADSP2_RAM_RDY) && ++count < 10); | ||
524 | |||
525 | if (!(val & ADSP2_RAM_RDY)) { | ||
526 | adsp_err(dsp, "Failed to start DSP RAM\n"); | ||
527 | return -EBUSY; | ||
528 | } | ||
529 | |||
530 | adsp_dbg(dsp, "RAM ready after %d polls\n", count); | ||
531 | adsp_info(dsp, "RAM ready after %d polls\n", count); | ||
532 | |||
533 | return 0; | ||
534 | } | ||
535 | |||
536 | int wm_adsp2_event(struct snd_soc_dapm_widget *w, | ||
537 | struct snd_kcontrol *kcontrol, int event) | ||
538 | { | ||
539 | struct snd_soc_codec *codec = w->codec; | ||
540 | struct wm_adsp *dsps = snd_soc_codec_get_drvdata(codec); | ||
541 | struct wm_adsp *dsp = &dsps[w->shift]; | ||
542 | unsigned int val; | ||
543 | int ret; | ||
544 | |||
545 | switch (event) { | ||
546 | case SND_SOC_DAPM_POST_PMU: | ||
547 | if (dsp->dvfs) { | ||
548 | ret = regmap_read(dsp->regmap, | ||
549 | dsp->base + ADSP2_CLOCKING, &val); | ||
550 | if (ret != 0) { | ||
551 | dev_err(dsp->dev, | ||
552 | "Failed to read clocking: %d\n", ret); | ||
553 | return ret; | ||
554 | } | ||
555 | |||
556 | if ((val & ADSP2_CLK_SEL_MASK) >= 3) { | ||
557 | ret = regulator_enable(dsp->dvfs); | ||
558 | if (ret != 0) { | ||
559 | dev_err(dsp->dev, | ||
560 | "Failed to enable supply: %d\n", | ||
561 | ret); | ||
562 | return ret; | ||
563 | } | ||
564 | |||
565 | ret = regulator_set_voltage(dsp->dvfs, | ||
566 | 1800000, | ||
567 | 1800000); | ||
568 | if (ret != 0) { | ||
569 | dev_err(dsp->dev, | ||
570 | "Failed to raise supply: %d\n", | ||
571 | ret); | ||
572 | return ret; | ||
573 | } | ||
574 | } | ||
575 | } | ||
576 | |||
577 | ret = wm_adsp2_ena(dsp); | ||
578 | if (ret != 0) | ||
579 | return ret; | ||
580 | |||
581 | ret = wm_adsp_load(dsp); | ||
582 | if (ret != 0) | ||
583 | goto err; | ||
584 | |||
585 | ret = wm_adsp_load_coeff(dsp); | ||
586 | if (ret != 0) | ||
587 | goto err; | ||
588 | |||
589 | ret = regmap_update_bits(dsp->regmap, | ||
590 | dsp->base + ADSP2_CONTROL, | ||
591 | ADSP2_CORE_ENA | ADSP2_START, | ||
592 | ADSP2_CORE_ENA | ADSP2_START); | ||
593 | if (ret != 0) | ||
594 | goto err; | ||
595 | break; | ||
596 | |||
597 | case SND_SOC_DAPM_PRE_PMD: | ||
598 | regmap_update_bits(dsp->regmap, dsp->base + ADSP2_CONTROL, | ||
599 | ADSP2_SYS_ENA | ADSP2_CORE_ENA | | ||
600 | ADSP2_START, 0); | ||
601 | |||
602 | if (dsp->dvfs) { | ||
603 | ret = regulator_set_voltage(dsp->dvfs, 1200000, | ||
604 | 1800000); | ||
605 | if (ret != 0) | ||
606 | dev_warn(dsp->dev, | ||
607 | "Failed to lower supply: %d\n", | ||
608 | ret); | ||
609 | |||
610 | ret = regulator_disable(dsp->dvfs); | ||
611 | if (ret != 0) | ||
612 | dev_err(dsp->dev, | ||
613 | "Failed to enable supply: %d\n", | ||
614 | ret); | ||
615 | } | ||
616 | break; | ||
617 | |||
618 | default: | ||
619 | break; | ||
620 | } | ||
621 | |||
622 | return 0; | ||
623 | err: | ||
624 | regmap_update_bits(dsp->regmap, dsp->base + ADSP2_CONTROL, | ||
625 | ADSP2_SYS_ENA | ADSP2_CORE_ENA | ADSP2_START, 0); | ||
626 | return ret; | ||
627 | } | ||
628 | EXPORT_SYMBOL_GPL(wm_adsp2_event); | ||
629 | |||
630 | int wm_adsp2_init(struct wm_adsp *adsp, bool dvfs) | ||
631 | { | ||
632 | int ret; | ||
633 | |||
634 | if (dvfs) { | ||
635 | adsp->dvfs = devm_regulator_get(adsp->dev, "DCVDD"); | ||
636 | if (IS_ERR(adsp->dvfs)) { | ||
637 | ret = PTR_ERR(adsp->dvfs); | ||
638 | dev_err(adsp->dev, "Failed to get DCVDD: %d\n", ret); | ||
639 | return ret; | ||
640 | } | ||
641 | |||
642 | ret = regulator_enable(adsp->dvfs); | ||
643 | if (ret != 0) { | ||
644 | dev_err(adsp->dev, "Failed to enable DCVDD: %d\n", | ||
645 | ret); | ||
646 | return ret; | ||
647 | } | ||
648 | |||
649 | ret = regulator_set_voltage(adsp->dvfs, 1200000, 1800000); | ||
650 | if (ret != 0) { | ||
651 | dev_err(adsp->dev, "Failed to initialise DVFS: %d\n", | ||
652 | ret); | ||
653 | return ret; | ||
654 | } | ||
655 | |||
656 | ret = regulator_disable(adsp->dvfs); | ||
657 | if (ret != 0) { | ||
658 | dev_err(adsp->dev, "Failed to disable DCVDD: %d\n", | ||
659 | ret); | ||
660 | return ret; | ||
661 | } | ||
662 | } | ||
663 | |||
664 | return 0; | ||
665 | } | ||
666 | EXPORT_SYMBOL_GPL(wm_adsp2_init); | ||
diff --git a/sound/soc/codecs/wm_adsp.h b/sound/soc/codecs/wm_adsp.h new file mode 100644 index 000000000000..ffd29a4609e2 --- /dev/null +++ b/sound/soc/codecs/wm_adsp.h | |||
@@ -0,0 +1,59 @@ | |||
1 | /* | ||
2 | * wm_adsp.h -- Wolfson ADSP support | ||
3 | * | ||
4 | * Copyright 2012 Wolfson Microelectronics plc | ||
5 | * | ||
6 | * Author: Mark Brown <broonie@opensource.wolfsonmicro.com> | ||
7 | * | ||
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 | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #ifndef __WM_ADSP_H | ||
14 | #define __WM_ADSP_H | ||
15 | |||
16 | #include <sound/soc.h> | ||
17 | #include <sound/soc-dapm.h> | ||
18 | |||
19 | #include "wmfw.h" | ||
20 | |||
21 | struct regulator; | ||
22 | |||
23 | struct wm_adsp_region { | ||
24 | int type; | ||
25 | unsigned int base; | ||
26 | }; | ||
27 | |||
28 | struct wm_adsp { | ||
29 | const char *part; | ||
30 | int num; | ||
31 | int type; | ||
32 | struct device *dev; | ||
33 | struct regmap *regmap; | ||
34 | |||
35 | int base; | ||
36 | |||
37 | const struct wm_adsp_region *mem; | ||
38 | int num_mems; | ||
39 | |||
40 | struct regulator *dvfs; | ||
41 | }; | ||
42 | |||
43 | #define WM_ADSP1(wname, num) \ | ||
44 | { .id = snd_soc_dapm_pga, .name = wname, .reg = SND_SOC_NOPM, \ | ||
45 | .shift = num, .event = wm_adsp1_event, \ | ||
46 | .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD } | ||
47 | |||
48 | #define WM_ADSP2(wname, num) \ | ||
49 | { .id = snd_soc_dapm_pga, .name = wname, .reg = SND_SOC_NOPM, \ | ||
50 | .shift = num, .event = wm_adsp2_event, \ | ||
51 | .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD } | ||
52 | |||
53 | int wm_adsp2_init(struct wm_adsp *adsp, bool dvfs); | ||
54 | int wm_adsp1_event(struct snd_soc_dapm_widget *w, | ||
55 | struct snd_kcontrol *kcontrol, int event); | ||
56 | int wm_adsp2_event(struct snd_soc_dapm_widget *w, | ||
57 | struct snd_kcontrol *kcontrol, int event); | ||
58 | |||
59 | #endif | ||
diff --git a/sound/soc/codecs/wmfw.h b/sound/soc/codecs/wmfw.h new file mode 100644 index 000000000000..5632ded67fdd --- /dev/null +++ b/sound/soc/codecs/wmfw.h | |||
@@ -0,0 +1,128 @@ | |||
1 | /* | ||
2 | * wmfw.h - Wolfson firmware format information | ||
3 | * | ||
4 | * Copyright 2012 Wolfson Microelectronics plc | ||
5 | * | ||
6 | * Author: Mark Brown <broonie@opensource.wolfsonmicro.com> | ||
7 | * | ||
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 | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #ifndef __WMFW_H | ||
14 | #define __WMFW_H | ||
15 | |||
16 | #include <linux/types.h> | ||
17 | |||
18 | struct wmfw_header { | ||
19 | char magic[4]; | ||
20 | __le32 len; | ||
21 | __le16 rev; | ||
22 | u8 core; | ||
23 | u8 ver; | ||
24 | } __packed; | ||
25 | |||
26 | struct wmfw_footer { | ||
27 | __le64 timestamp; | ||
28 | __le32 checksum; | ||
29 | } __packed; | ||
30 | |||
31 | struct wmfw_adsp1_sizes { | ||
32 | __le32 dm; | ||
33 | __le32 pm; | ||
34 | __le32 zm; | ||
35 | } __packed; | ||
36 | |||
37 | struct wmfw_adsp2_sizes { | ||
38 | __le32 xm; | ||
39 | __le32 ym; | ||
40 | __le32 pm; | ||
41 | __le32 zm; | ||
42 | } __packed; | ||
43 | |||
44 | struct wmfw_region { | ||
45 | union { | ||
46 | __be32 type; | ||
47 | __le32 offset; | ||
48 | }; | ||
49 | __le32 len; | ||
50 | u8 data[]; | ||
51 | } __packed; | ||
52 | |||
53 | struct wmfw_id_hdr { | ||
54 | __be32 core_id; | ||
55 | __be32 core_rev; | ||
56 | __be32 id; | ||
57 | __be32 ver; | ||
58 | } __packed; | ||
59 | |||
60 | struct wmfw_adsp1_id_hdr { | ||
61 | struct wmfw_id_hdr fw; | ||
62 | __be32 zm; | ||
63 | __be32 dm; | ||
64 | __be32 algs; | ||
65 | } __packed; | ||
66 | |||
67 | struct wmfw_adsp2_id_hdr { | ||
68 | struct wmfw_id_hdr fw; | ||
69 | __be32 zm; | ||
70 | __be32 xm; | ||
71 | __be32 ym; | ||
72 | __be32 algs; | ||
73 | } __packed; | ||
74 | |||
75 | struct wmfw_alg_hdr { | ||
76 | __be32 id; | ||
77 | __be32 ver; | ||
78 | } __packed; | ||
79 | |||
80 | struct wmfw_adsp1_alg_hdr { | ||
81 | struct wmfw_alg_hdr alg; | ||
82 | __be32 zm; | ||
83 | __be32 dm; | ||
84 | } __packed; | ||
85 | |||
86 | struct wmfw_adsp2_alg_hdr { | ||
87 | struct wmfw_alg_hdr alg; | ||
88 | __be32 zm; | ||
89 | __be32 xm; | ||
90 | __be32 ym; | ||
91 | } __packed; | ||
92 | |||
93 | struct wmfw_coeff_hdr { | ||
94 | u8 magic[4]; | ||
95 | __le32 len; | ||
96 | __le32 ver; | ||
97 | u8 data[]; | ||
98 | } __packed; | ||
99 | |||
100 | struct wmfw_coeff_item { | ||
101 | union { | ||
102 | __be32 type; | ||
103 | __le32 offset; | ||
104 | }; | ||
105 | __le32 id; | ||
106 | __le32 ver; | ||
107 | __le32 sr; | ||
108 | __le32 len; | ||
109 | u8 data[]; | ||
110 | } __packed; | ||
111 | |||
112 | #define WMFW_ADSP1 1 | ||
113 | #define WMFW_ADSP2 2 | ||
114 | |||
115 | #define WMFW_ABSOLUTE 0xf0 | ||
116 | #define WMFW_NAME_TEXT 0xfe | ||
117 | #define WMFW_INFO_TEXT 0xff | ||
118 | |||
119 | #define WMFW_ADSP1_PM 2 | ||
120 | #define WMFW_ADSP1_DM 3 | ||
121 | #define WMFW_ADSP1_ZM 4 | ||
122 | |||
123 | #define WMFW_ADSP2_PM 2 | ||
124 | #define WMFW_ADSP2_ZM 4 | ||
125 | #define WMFW_ADSP2_XM 5 | ||
126 | #define WMFW_ADSP2_YM 6 | ||
127 | |||
128 | #endif | ||
diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig index 4563b28bd625..aa73efa64cb4 100644 --- a/sound/soc/fsl/Kconfig +++ b/sound/soc/fsl/Kconfig | |||
@@ -98,12 +98,12 @@ config SND_SOC_IMX_PCM | |||
98 | tristate | 98 | tristate |
99 | 99 | ||
100 | config SND_SOC_IMX_PCM_FIQ | 100 | config SND_SOC_IMX_PCM_FIQ |
101 | tristate | 101 | bool |
102 | select FIQ | 102 | select FIQ |
103 | select SND_SOC_IMX_PCM | 103 | select SND_SOC_IMX_PCM |
104 | 104 | ||
105 | config SND_SOC_IMX_PCM_DMA | 105 | config SND_SOC_IMX_PCM_DMA |
106 | tristate | 106 | bool |
107 | select SND_SOC_DMAENGINE_PCM | 107 | select SND_SOC_DMAENGINE_PCM |
108 | select SND_SOC_IMX_PCM | 108 | select SND_SOC_IMX_PCM |
109 | 109 | ||
diff --git a/sound/soc/fsl/Makefile b/sound/soc/fsl/Makefile index 5f3cf3f52ea0..c3deee897b5a 100644 --- a/sound/soc/fsl/Makefile +++ b/sound/soc/fsl/Makefile | |||
@@ -26,14 +26,18 @@ obj-$(CONFIG_SND_MPC52xx_SOC_EFIKA) += efika-audio-fabric.o | |||
26 | # i.MX Platform Support | 26 | # i.MX Platform Support |
27 | snd-soc-imx-ssi-objs := imx-ssi.o | 27 | snd-soc-imx-ssi-objs := imx-ssi.o |
28 | snd-soc-imx-audmux-objs := imx-audmux.o | 28 | snd-soc-imx-audmux-objs := imx-audmux.o |
29 | snd-soc-imx-pcm-objs := imx-pcm.o | ||
30 | ifneq ($(CONFIG_SND_SOC_IMX_PCM_FIQ),) | ||
31 | snd-soc-imx-pcm-objs += imx-pcm-fiq.o | ||
32 | endif | ||
33 | ifneq ($(CONFIG_SND_SOC_IMX_PCM_DMA),) | ||
34 | snd-soc-imx-pcm-objs += imx-pcm-dma.o | ||
35 | endif | ||
29 | 36 | ||
30 | obj-$(CONFIG_SND_SOC_IMX_SSI) += snd-soc-imx-ssi.o | 37 | obj-$(CONFIG_SND_SOC_IMX_SSI) += snd-soc-imx-ssi.o |
31 | obj-$(CONFIG_SND_SOC_IMX_AUDMUX) += snd-soc-imx-audmux.o | 38 | obj-$(CONFIG_SND_SOC_IMX_AUDMUX) += snd-soc-imx-audmux.o |
32 | 39 | ||
33 | obj-$(CONFIG_SND_SOC_IMX_PCM) += snd-soc-imx-pcm.o | 40 | obj-$(CONFIG_SND_SOC_IMX_PCM) += snd-soc-imx-pcm.o |
34 | snd-soc-imx-pcm-y := imx-pcm.o | ||
35 | snd-soc-imx-pcm-$(CONFIG_SND_SOC_IMX_PCM_FIQ) += imx-pcm-fiq.o | ||
36 | snd-soc-imx-pcm-$(CONFIG_SND_SOC_IMX_PCM_DMA) += imx-pcm-dma.o | ||
37 | 41 | ||
38 | # i.MX Machine Support | 42 | # i.MX Machine Support |
39 | snd-soc-eukrea-tlv320-objs := eukrea-tlv320.o | 43 | snd-soc-eukrea-tlv320-objs := eukrea-tlv320.o |
diff --git a/sound/soc/kirkwood/kirkwood-dma.c b/sound/soc/kirkwood/kirkwood-dma.c index b9f16598324c..2ba08148655f 100644 --- a/sound/soc/kirkwood/kirkwood-dma.c +++ b/sound/soc/kirkwood/kirkwood-dma.c | |||
@@ -71,7 +71,6 @@ static irqreturn_t kirkwood_dma_irq(int irq, void *dev_id) | |||
71 | printk(KERN_WARNING "%s: got err interrupt 0x%lx\n", | 71 | printk(KERN_WARNING "%s: got err interrupt 0x%lx\n", |
72 | __func__, cause); | 72 | __func__, cause); |
73 | writel(cause, priv->io + KIRKWOOD_ERR_CAUSE); | 73 | writel(cause, priv->io + KIRKWOOD_ERR_CAUSE); |
74 | return IRQ_HANDLED; | ||
75 | } | 74 | } |
76 | 75 | ||
77 | /* we've enabled only bytes interrupts ... */ | 76 | /* we've enabled only bytes interrupts ... */ |
@@ -178,7 +177,7 @@ static int kirkwood_dma_open(struct snd_pcm_substream *substream) | |||
178 | } | 177 | } |
179 | 178 | ||
180 | dram = mv_mbus_dram_info(); | 179 | dram = mv_mbus_dram_info(); |
181 | addr = virt_to_phys(substream->dma_buffer.area); | 180 | addr = substream->dma_buffer.addr; |
182 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { | 181 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
183 | prdata->play_stream = substream; | 182 | prdata->play_stream = substream; |
184 | kirkwood_dma_conf_mbus_windows(priv->io, | 183 | kirkwood_dma_conf_mbus_windows(priv->io, |
diff --git a/sound/soc/kirkwood/kirkwood-i2s.c b/sound/soc/kirkwood/kirkwood-i2s.c index 542538d10ab7..1d5db484d2df 100644 --- a/sound/soc/kirkwood/kirkwood-i2s.c +++ b/sound/soc/kirkwood/kirkwood-i2s.c | |||
@@ -95,7 +95,7 @@ static inline void kirkwood_set_dco(void __iomem *io, unsigned long rate) | |||
95 | do { | 95 | do { |
96 | cpu_relax(); | 96 | cpu_relax(); |
97 | value = readl(io + KIRKWOOD_DCO_SPCR_STATUS); | 97 | value = readl(io + KIRKWOOD_DCO_SPCR_STATUS); |
98 | value &= KIRKWOOD_DCO_SPCR_STATUS; | 98 | value &= KIRKWOOD_DCO_SPCR_STATUS_DCO_LOCK; |
99 | } while (value == 0); | 99 | } while (value == 0); |
100 | } | 100 | } |
101 | 101 | ||
@@ -180,67 +180,72 @@ static int kirkwood_i2s_play_trigger(struct snd_pcm_substream *substream, | |||
180 | int cmd, struct snd_soc_dai *dai) | 180 | int cmd, struct snd_soc_dai *dai) |
181 | { | 181 | { |
182 | struct kirkwood_dma_data *priv = snd_soc_dai_get_drvdata(dai); | 182 | struct kirkwood_dma_data *priv = snd_soc_dai_get_drvdata(dai); |
183 | unsigned long value; | 183 | uint32_t ctl, value; |
184 | 184 | ||
185 | /* | 185 | ctl = readl(priv->io + KIRKWOOD_PLAYCTL); |
186 | * specs says KIRKWOOD_PLAYCTL must be read 2 times before | 186 | if (ctl & KIRKWOOD_PLAYCTL_PAUSE) { |
187 | * changing it. So read 1 time here and 1 later. | 187 | unsigned timeout = 5000; |
188 | */ | 188 | /* |
189 | value = readl(priv->io + KIRKWOOD_PLAYCTL); | 189 | * The Armada510 spec says that if we enter pause mode, the |
190 | * busy bit must be read back as clear _twice_. Make sure | ||
191 | * we respect that otherwise we get DMA underruns. | ||
192 | */ | ||
193 | do { | ||
194 | value = ctl; | ||
195 | ctl = readl(priv->io + KIRKWOOD_PLAYCTL); | ||
196 | if (!((ctl | value) & KIRKWOOD_PLAYCTL_PLAY_BUSY)) | ||
197 | break; | ||
198 | udelay(1); | ||
199 | } while (timeout--); | ||
200 | |||
201 | if ((ctl | value) & KIRKWOOD_PLAYCTL_PLAY_BUSY) | ||
202 | dev_notice(dai->dev, "timed out waiting for busy to deassert: %08x\n", | ||
203 | ctl); | ||
204 | } | ||
190 | 205 | ||
191 | switch (cmd) { | 206 | switch (cmd) { |
192 | case SNDRV_PCM_TRIGGER_START: | 207 | case SNDRV_PCM_TRIGGER_START: |
193 | /* stop audio, enable interrupts */ | ||
194 | value = readl(priv->io + KIRKWOOD_PLAYCTL); | ||
195 | value |= KIRKWOOD_PLAYCTL_PAUSE; | ||
196 | writel(value, priv->io + KIRKWOOD_PLAYCTL); | ||
197 | |||
198 | value = readl(priv->io + KIRKWOOD_INT_MASK); | 208 | value = readl(priv->io + KIRKWOOD_INT_MASK); |
199 | value |= KIRKWOOD_INT_CAUSE_PLAY_BYTES; | 209 | value |= KIRKWOOD_INT_CAUSE_PLAY_BYTES; |
200 | writel(value, priv->io + KIRKWOOD_INT_MASK); | 210 | writel(value, priv->io + KIRKWOOD_INT_MASK); |
201 | 211 | ||
202 | /* configure audio & enable i2s playback */ | 212 | /* configure audio & enable i2s playback */ |
203 | value = readl(priv->io + KIRKWOOD_PLAYCTL); | 213 | ctl &= ~KIRKWOOD_PLAYCTL_BURST_MASK; |
204 | value &= ~KIRKWOOD_PLAYCTL_BURST_MASK; | 214 | ctl &= ~(KIRKWOOD_PLAYCTL_PAUSE | KIRKWOOD_PLAYCTL_I2S_MUTE |
205 | value &= ~(KIRKWOOD_PLAYCTL_PAUSE | KIRKWOOD_PLAYCTL_I2S_MUTE | ||
206 | | KIRKWOOD_PLAYCTL_SPDIF_EN); | 215 | | KIRKWOOD_PLAYCTL_SPDIF_EN); |
207 | 216 | ||
208 | if (priv->burst == 32) | 217 | if (priv->burst == 32) |
209 | value |= KIRKWOOD_PLAYCTL_BURST_32; | 218 | ctl |= KIRKWOOD_PLAYCTL_BURST_32; |
210 | else | 219 | else |
211 | value |= KIRKWOOD_PLAYCTL_BURST_128; | 220 | ctl |= KIRKWOOD_PLAYCTL_BURST_128; |
212 | value |= KIRKWOOD_PLAYCTL_I2S_EN; | 221 | ctl |= KIRKWOOD_PLAYCTL_I2S_EN; |
213 | writel(value, priv->io + KIRKWOOD_PLAYCTL); | 222 | writel(ctl, priv->io + KIRKWOOD_PLAYCTL); |
214 | break; | 223 | break; |
215 | 224 | ||
216 | case SNDRV_PCM_TRIGGER_STOP: | 225 | case SNDRV_PCM_TRIGGER_STOP: |
217 | /* stop audio, disable interrupts */ | 226 | /* stop audio, disable interrupts */ |
218 | value = readl(priv->io + KIRKWOOD_PLAYCTL); | 227 | ctl |= KIRKWOOD_PLAYCTL_PAUSE | KIRKWOOD_PLAYCTL_I2S_MUTE; |
219 | value |= KIRKWOOD_PLAYCTL_PAUSE | KIRKWOOD_PLAYCTL_I2S_MUTE; | 228 | writel(ctl, priv->io + KIRKWOOD_PLAYCTL); |
220 | writel(value, priv->io + KIRKWOOD_PLAYCTL); | ||
221 | 229 | ||
222 | value = readl(priv->io + KIRKWOOD_INT_MASK); | 230 | value = readl(priv->io + KIRKWOOD_INT_MASK); |
223 | value &= ~KIRKWOOD_INT_CAUSE_PLAY_BYTES; | 231 | value &= ~KIRKWOOD_INT_CAUSE_PLAY_BYTES; |
224 | writel(value, priv->io + KIRKWOOD_INT_MASK); | 232 | writel(value, priv->io + KIRKWOOD_INT_MASK); |
225 | 233 | ||
226 | /* disable all playbacks */ | 234 | /* disable all playbacks */ |
227 | value = readl(priv->io + KIRKWOOD_PLAYCTL); | 235 | ctl &= ~(KIRKWOOD_PLAYCTL_I2S_EN | KIRKWOOD_PLAYCTL_SPDIF_EN); |
228 | value &= ~(KIRKWOOD_PLAYCTL_I2S_EN | KIRKWOOD_PLAYCTL_SPDIF_EN); | 236 | writel(ctl, priv->io + KIRKWOOD_PLAYCTL); |
229 | writel(value, priv->io + KIRKWOOD_PLAYCTL); | ||
230 | break; | 237 | break; |
231 | 238 | ||
232 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | 239 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: |
233 | case SNDRV_PCM_TRIGGER_SUSPEND: | 240 | case SNDRV_PCM_TRIGGER_SUSPEND: |
234 | value = readl(priv->io + KIRKWOOD_PLAYCTL); | 241 | ctl |= KIRKWOOD_PLAYCTL_PAUSE | KIRKWOOD_PLAYCTL_I2S_MUTE; |
235 | value |= KIRKWOOD_PLAYCTL_PAUSE | KIRKWOOD_PLAYCTL_I2S_MUTE; | 242 | writel(ctl, priv->io + KIRKWOOD_PLAYCTL); |
236 | writel(value, priv->io + KIRKWOOD_PLAYCTL); | ||
237 | break; | 243 | break; |
238 | 244 | ||
239 | case SNDRV_PCM_TRIGGER_RESUME: | 245 | case SNDRV_PCM_TRIGGER_RESUME: |
240 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: | 246 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: |
241 | value = readl(priv->io + KIRKWOOD_PLAYCTL); | 247 | ctl &= ~(KIRKWOOD_PLAYCTL_PAUSE | KIRKWOOD_PLAYCTL_I2S_MUTE); |
242 | value &= ~(KIRKWOOD_PLAYCTL_PAUSE | KIRKWOOD_PLAYCTL_I2S_MUTE); | 248 | writel(ctl, priv->io + KIRKWOOD_PLAYCTL); |
243 | writel(value, priv->io + KIRKWOOD_PLAYCTL); | ||
244 | break; | 249 | break; |
245 | 250 | ||
246 | default: | 251 | default: |
@@ -260,11 +265,6 @@ static int kirkwood_i2s_rec_trigger(struct snd_pcm_substream *substream, | |||
260 | 265 | ||
261 | switch (cmd) { | 266 | switch (cmd) { |
262 | case SNDRV_PCM_TRIGGER_START: | 267 | case SNDRV_PCM_TRIGGER_START: |
263 | /* stop audio, enable interrupts */ | ||
264 | value = readl(priv->io + KIRKWOOD_RECCTL); | ||
265 | value |= KIRKWOOD_RECCTL_PAUSE; | ||
266 | writel(value, priv->io + KIRKWOOD_RECCTL); | ||
267 | |||
268 | value = readl(priv->io + KIRKWOOD_INT_MASK); | 268 | value = readl(priv->io + KIRKWOOD_INT_MASK); |
269 | value |= KIRKWOOD_INT_CAUSE_REC_BYTES; | 269 | value |= KIRKWOOD_INT_CAUSE_REC_BYTES; |
270 | writel(value, priv->io + KIRKWOOD_INT_MASK); | 270 | writel(value, priv->io + KIRKWOOD_INT_MASK); |
diff --git a/sound/soc/mxs/mxs-saif.c b/sound/soc/mxs/mxs-saif.c index aa037b292f3d..b304e375568a 100644 --- a/sound/soc/mxs/mxs-saif.c +++ b/sound/soc/mxs/mxs-saif.c | |||
@@ -229,6 +229,7 @@ int mxs_saif_put_mclk(unsigned int saif_id) | |||
229 | saif->mclk_in_use = 0; | 229 | saif->mclk_in_use = 0; |
230 | return 0; | 230 | return 0; |
231 | } | 231 | } |
232 | EXPORT_SYMBOL_GPL(mxs_saif_put_mclk); | ||
232 | 233 | ||
233 | /* | 234 | /* |
234 | * Get MCLK and set clock rate, then enable it | 235 | * Get MCLK and set clock rate, then enable it |
@@ -282,6 +283,7 @@ int mxs_saif_get_mclk(unsigned int saif_id, unsigned int mclk, | |||
282 | 283 | ||
283 | return 0; | 284 | return 0; |
284 | } | 285 | } |
286 | EXPORT_SYMBOL_GPL(mxs_saif_get_mclk); | ||
285 | 287 | ||
286 | /* | 288 | /* |
287 | * SAIF DAI format configuration. | 289 | * SAIF DAI format configuration. |
@@ -523,16 +525,24 @@ static int mxs_saif_trigger(struct snd_pcm_substream *substream, int cmd, | |||
523 | 525 | ||
524 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { | 526 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
525 | /* | 527 | /* |
526 | * write a data to saif data register to trigger | 528 | * write data to saif data register to trigger |
527 | * the transfer | 529 | * the transfer. |
530 | * For 24-bit format the 32-bit FIFO register stores | ||
531 | * only one channel, so we need to write twice. | ||
532 | * This is also safe for the other non 24-bit formats. | ||
528 | */ | 533 | */ |
529 | __raw_writel(0, saif->base + SAIF_DATA); | 534 | __raw_writel(0, saif->base + SAIF_DATA); |
535 | __raw_writel(0, saif->base + SAIF_DATA); | ||
530 | } else { | 536 | } else { |
531 | /* | 537 | /* |
532 | * read a data from saif data register to trigger | 538 | * read data from saif data register to trigger |
533 | * the receive | 539 | * the receive. |
540 | * For 24-bit format the 32-bit FIFO register stores | ||
541 | * only one channel, so we need to read twice. | ||
542 | * This is also safe for the other non 24-bit formats. | ||
534 | */ | 543 | */ |
535 | __raw_readl(saif->base + SAIF_DATA); | 544 | __raw_readl(saif->base + SAIF_DATA); |
545 | __raw_readl(saif->base + SAIF_DATA); | ||
536 | } | 546 | } |
537 | 547 | ||
538 | master_saif->ongoing = 1; | 548 | master_saif->ongoing = 1; |
@@ -812,3 +822,4 @@ module_platform_driver(mxs_saif_driver); | |||
812 | MODULE_AUTHOR("Freescale Semiconductor, Inc."); | 822 | MODULE_AUTHOR("Freescale Semiconductor, Inc."); |
813 | MODULE_DESCRIPTION("MXS ASoC SAIF driver"); | 823 | MODULE_DESCRIPTION("MXS ASoC SAIF driver"); |
814 | MODULE_LICENSE("GPL"); | 824 | MODULE_LICENSE("GPL"); |
825 | MODULE_ALIAS("platform:mxs-saif"); | ||
diff --git a/sound/soc/omap/omap-dmic.c b/sound/soc/omap/omap-dmic.c index 68f2cd1a9206..5a6aeaf552a8 100644 --- a/sound/soc/omap/omap-dmic.c +++ b/sound/soc/omap/omap-dmic.c | |||
@@ -464,9 +464,9 @@ static __devinit int asoc_dmic_probe(struct platform_device *pdev) | |||
464 | 464 | ||
465 | mutex_init(&dmic->mutex); | 465 | mutex_init(&dmic->mutex); |
466 | 466 | ||
467 | dmic->fclk = clk_get(dmic->dev, "dmic_fck"); | 467 | dmic->fclk = clk_get(dmic->dev, "fck"); |
468 | if (IS_ERR(dmic->fclk)) { | 468 | if (IS_ERR(dmic->fclk)) { |
469 | dev_err(dmic->dev, "cant get dmic_fck\n"); | 469 | dev_err(dmic->dev, "cant get fck\n"); |
470 | return -ENODEV; | 470 | return -ENODEV; |
471 | } | 471 | } |
472 | 472 | ||
diff --git a/sound/soc/omap/zoom2.c b/sound/soc/omap/zoom2.c index 677b567935f8..1ff6bb9ade5c 100644 --- a/sound/soc/omap/zoom2.c +++ b/sound/soc/omap/zoom2.c | |||
@@ -21,15 +21,14 @@ | |||
21 | 21 | ||
22 | #include <linux/clk.h> | 22 | #include <linux/clk.h> |
23 | #include <linux/platform_device.h> | 23 | #include <linux/platform_device.h> |
24 | #include <linux/gpio.h> | ||
24 | #include <sound/core.h> | 25 | #include <sound/core.h> |
25 | #include <sound/pcm.h> | 26 | #include <sound/pcm.h> |
26 | #include <sound/soc.h> | 27 | #include <sound/soc.h> |
27 | 28 | ||
28 | #include <asm/mach-types.h> | 29 | #include <asm/mach-types.h> |
29 | #include <mach/hardware.h> | ||
30 | #include <mach/gpio.h> | ||
31 | #include <mach/board-zoom.h> | ||
32 | #include <linux/platform_data/asoc-ti-mcbsp.h> | 30 | #include <linux/platform_data/asoc-ti-mcbsp.h> |
31 | #include <linux/platform_data/gpio-omap.h> | ||
33 | 32 | ||
34 | /* Register descriptions for twl4030 codec part */ | 33 | /* Register descriptions for twl4030 codec part */ |
35 | #include <linux/mfd/twl4030-audio.h> | 34 | #include <linux/mfd/twl4030-audio.h> |
diff --git a/sound/soc/samsung/Kconfig b/sound/soc/samsung/Kconfig index e7b83179aca2..3c7c3a59ed39 100644 --- a/sound/soc/samsung/Kconfig +++ b/sound/soc/samsung/Kconfig | |||
@@ -207,6 +207,8 @@ config SND_SOC_BELLS | |||
207 | select SND_SOC_WM5102 | 207 | select SND_SOC_WM5102 |
208 | select SND_SOC_WM5110 | 208 | select SND_SOC_WM5110 |
209 | select SND_SOC_WM9081 | 209 | select SND_SOC_WM9081 |
210 | select SND_SOC_WM0010 | ||
211 | select SND_SOC_WM1250_EV1 | ||
210 | 212 | ||
211 | config SND_SOC_LOWLAND | 213 | config SND_SOC_LOWLAND |
212 | tristate "Audio support for Wolfson Lowland" | 214 | tristate "Audio support for Wolfson Lowland" |
diff --git a/sound/soc/samsung/bells.c b/sound/soc/samsung/bells.c index b0d46d63d55e..a2ca1567b9e4 100644 --- a/sound/soc/samsung/bells.c +++ b/sound/soc/samsung/bells.c | |||
@@ -212,7 +212,7 @@ static struct snd_soc_dai_link bells_dai_wm5102[] = { | |||
212 | { | 212 | { |
213 | .name = "Sub", | 213 | .name = "Sub", |
214 | .stream_name = "Sub", | 214 | .stream_name = "Sub", |
215 | .cpu_dai_name = "wm5110-aif3", | 215 | .cpu_dai_name = "wm5102-aif3", |
216 | .codec_dai_name = "wm9081-hifi", | 216 | .codec_dai_name = "wm9081-hifi", |
217 | .codec_name = "wm9081.1-006c", | 217 | .codec_name = "wm9081.1-006c", |
218 | .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | 218 | .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index d1198627fc40..10d21be383f6 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -2786,8 +2786,9 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol, | |||
2786 | val = (ucontrol->value.integer.value[0] + min) & mask; | 2786 | val = (ucontrol->value.integer.value[0] + min) & mask; |
2787 | val = val << shift; | 2787 | val = val << shift; |
2788 | 2788 | ||
2789 | if (snd_soc_update_bits_locked(codec, reg, val_mask, val)) | 2789 | err = snd_soc_update_bits_locked(codec, reg, val_mask, val); |
2790 | return err; | 2790 | if (err < 0) |
2791 | return err; | ||
2791 | 2792 | ||
2792 | if (snd_soc_volsw_is_stereo(mc)) { | 2793 | if (snd_soc_volsw_is_stereo(mc)) { |
2793 | val_mask = mask << rshift; | 2794 | val_mask = mask << rshift; |
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index d0a4be38dc0f..6e35bcae02df 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -3745,7 +3745,7 @@ void snd_soc_dapm_shutdown(struct snd_soc_card *card) | |||
3745 | { | 3745 | { |
3746 | struct snd_soc_codec *codec; | 3746 | struct snd_soc_codec *codec; |
3747 | 3747 | ||
3748 | list_for_each_entry(codec, &card->codec_dev_list, list) { | 3748 | list_for_each_entry(codec, &card->codec_dev_list, card_list) { |
3749 | soc_dapm_shutdown_codec(&codec->dapm); | 3749 | soc_dapm_shutdown_codec(&codec->dapm); |
3750 | if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY) | 3750 | if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY) |
3751 | snd_soc_dapm_set_bias_level(&codec->dapm, | 3751 | snd_soc_dapm_set_bias_level(&codec->dapm, |